Documentation
¶
Index ¶
- func CalculatePurchaseAmount(supply sdkmath.Int, reserve sdkmath.Int, crr uint, wantReceive sdkmath.Int) sdkmath.Int
- func CalculatePurchaseReturn(supply sdkmath.Int, reserve sdkmath.Int, crr uint, deposit sdkmath.Int) sdkmath.Int
- func CalculateSaleAmount(supply sdkmath.Int, reserve sdkmath.Int, crr uint, wantReceive sdkmath.Int) sdkmath.Int
- func CalculateSaleReturn(supply sdkmath.Int, reserve sdkmath.Int, crr uint, sellAmount sdkmath.Int) sdkmath.Int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculatePurchaseAmount ¶
func CalculatePurchaseAmount(supply sdkmath.Int, reserve sdkmath.Int, crr uint, wantReceive sdkmath.Int) sdkmath.Int
CalculatePurchaseAmount is the reversed version of function CalculatePurchaseReturn. Deposit = reserve * (((wantReceive + supply) / supply)^(100/c) - 1)
func CalculatePurchaseReturn ¶
func CalculatePurchaseReturn(supply sdkmath.Int, reserve sdkmath.Int, crr uint, deposit sdkmath.Int) sdkmath.Int
CalculatePurchaseReturn calculates amount of coin that user will receive by depositing given amount of BIP. Return = supply * ((1 + deposit / reserve) ^ (crr / 100) - 1)
func CalculateSaleAmount ¶
func CalculateSaleAmount(supply sdkmath.Int, reserve sdkmath.Int, crr uint, wantReceive sdkmath.Int) sdkmath.Int
CalculateSaleAmount is the reversed version of function CalculateSaleReturn. Deposit = -(-1 + (-(wantReceive - reserve)/reserve)^(1/crr)) * supply
func CalculateSaleReturn ¶
func CalculateSaleReturn(supply sdkmath.Int, reserve sdkmath.Int, crr uint, sellAmount sdkmath.Int) sdkmath.Int
CalculateSaleReturn returns amount of BIP user will receive by depositing given amount of coins. Return = reserve * (1 - (1 - sellAmount / supply) ^ (100 / crr))
Types ¶
This section is empty.