Documentation
¶
Index ¶
Constants ¶
View Source
const ( SecondsPerHour = 3_600 SecondsPerDay = 86_400 SecondsPerYear = 31_536_000 EulerPrecision = 17 )
Variables ¶
This section is empty.
Functions ¶
func CalculateAUMFee ¶ added in v1.1.0
CalculateAUMFee computes the technology fee based on the vault's AUM and configured basis points.
Formula:
Fee = (AUM * (bips / 10000) * duration) / 31536000 (SecondsPerYear)
Returns the fee as a truncated sdkmath.Int.
func CalculateInterestEarned ¶
func CalculateInterestEarned(principal sdk.Coin, rate string, periodSeconds int64) (amount sdkmath.Int, err error)
CalculateInterestEarned computes the continuously compounded interest for a given principal over a period.
It uses the formula `Interest = P * (e^(rt)) - P`, where:
- P is the `principal`.
- r is the annual `rate`.
- t is the time in years, derived from (`periodSeconds` / 31_536_000).
This function returns the interest as a `cosmosmath.Int`, truncating any fractional part to ensure compatibility with coin amounts. It uses deterministic arithmetic via `cosmosmath.LegacyDec` and approximates e^x using a Maclaurin series (`utils.ExpDec`).
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.