Documentation ¶
Index ¶
- Constants
- func Abs(a int16) uint16
- func ApproxRatSquareRoot(x *big.Rat) *big.Int
- func CalcBlockDistribution(period *types.RewardPeriod) sdk.Uint
- func CalcDenomChangeMultiplier(decimalsX, decimalsY uint8) big.Rat
- func CalcFurySpotPrice(pool *types.Pool, pmtpCurrentRunningRate sdk.Dec) (sdk.Dec, error)
- func CalcFuryValue(furyAmount sdk.Uint, price sdk.Dec) sdk.Uint
- func CalcProviderDistributionAmount(furyProviderDistribution sdk.Dec, totalPoolUnits, providerPoolUnits sdk.Uint) sdk.Uint
- func CalcSpotPriceExternal(pool *types.Pool, decimalsExternal uint8, pmtpCurrentRunningRate sdk.Dec) (sdk.Dec, error)
- func CalcSpotPriceNative(pool *types.Pool, decimalsExternal uint8, pmtpCurrentRunningRate sdk.Dec) (sdk.Dec, error)
- func CalcSpotPriceX(X, Y sdk.Uint, decimalsX, decimalsY uint8, pmtpCurrentRunningRate sdk.Dec, ...) (sdk.Dec, error)
- func CalcSwapPmtp(toFury bool, y, pmtpCurrentRunningRate sdk.Dec) sdk.Dec
- func CalcSwapResult(toFury bool, X, x, Y sdk.Uint, pmtpCurrentRunningRate, swapFeeRate sdk.Dec) (sdk.Uint, sdk.Uint)
- func CalculateAllAssetsForLP(pool types.Pool, lp types.LiquidityProvider) (sdk.Uint, sdk.Uint, sdk.Uint, sdk.Uint)
- func CalculateDiscountedSentAmount(sentAmount sdk.Uint, swapFeeRate sdk.Dec) sdk.Uint
- func CalculateExternalSwapAmountAsymmetric(R, A, r, a sdk.Uint, f, p *big.Rat) sdk.Uint
- func CalculateExternalSwapAmountAsymmetricRat(Y, X, y, x, f, r *big.Rat) big.Rat
- func CalculateNativeSwapAmountAsymmetric(R, A, r, a sdk.Uint, f, p *big.Rat) sdk.Uint
- func CalculateNativeSwapAmountAsymmetricRat(Y, X, y, x, f, r *big.Rat) big.Rat
- func CalculatePoolUnits(P, R, A, r, a sdk.Uint, ...) (sdk.Uint, sdk.Uint, int, sdk.Uint, error)
- func CalculatePoolUnitsSymmetric(X, x, P sdk.Uint) (sdk.Uint, sdk.Uint)
- func CalculateWithdrawal(poolUnits sdk.Uint, nativeAssetDepth string, externalAssetDepth string, ...) (sdk.Uint, sdk.Uint, sdk.Uint, sdk.Uint)
- func CalculateWithdrawalFromUnits(poolUnits sdk.Uint, nativeAssetDepth string, externalAssetDepth string, ...) (sdk.Uint, sdk.Uint, sdk.Uint)
- func CalculateWithdrawalFuryValue(sentAmount sdk.Uint, to types.Asset, pool types.Pool, ...) sdk.Uint
- func CollectProviderDistribution(ctx sdk.Context, pool *types.Pool, poolDepthFury, blockRate sdk.Dec, ...) sdk.Uint
- func CollectRewards(ctx sdk.Context, pool *types.Pool, poolDistribution sdk.Uint, ...)
- func ConvUnitsToWBasisPoints(total, units sdk.Uint) sdk.Int
- func ConvWBasisPointsToUnits(total sdk.Uint, wbasis sdk.Int) sdk.Uint
- func CreateEventBlockHeight(ctx sdk.Context, eventType string, attribute sdk.Attribute) sdk.Event
- func CreateEventMsg(signer string) sdk.Event
- func DecToRat(d *sdk.Dec) big.Rat
- func FindProviderDistributionPeriod(currentHeight int64, periods []*types.ProviderDistributionPeriod) *types.ProviderDistributionPeriod
- func GetLiquidityAddSymmetryState(X, x, Y, y sdk.Uint) int
- func GetPoolMultiplier(asset string, period *types.RewardPeriod) sdk.Dec
- func GetSwapFee(sentAmount sdk.Uint, to types.Asset, pool types.Pool, ...) sdk.Uint
- func Int64ToUint8Safe(x int64) (uint8, error)
- func IsAnyZero(inputs []sdk.Uint) bool
- func IsDistributionBlockPure(blockHeight int64, startHeight, mod uint64) bool
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func PrintPools(pools []LPPool) string
- func RatIntQuo(r *big.Rat) *big.Int
- func RatToDec(r *big.Rat) (sdk.Dec, error)
- func RegisterInvariants(registry sdk.InvariantRegistry, k Keeper)
- func SwapOne(from types.Asset, sentAmount sdk.Uint, to types.Asset, pool types.Pool, ...) (sdk.Uint, sdk.Uint, sdk.Uint, types.Pool, error)
- type FormattedPool
- type Keeper
- func (k Keeper) AddLiquidity(ctx sdk.Context, msg *types.MsgAddLiquidity, pool types.Pool, ...) (*types.LiquidityProvider, error)
- func (k Keeper) BalanceModuleAccountCheck() sdk.Invariant
- func (k Keeper) BurnFury(ctx sdk.Context, amount sdk.Int) error
- func (k Keeper) CLPCalcSwap(ctx sdk.Context, sentAmount sdk.Uint, to types.Asset, pool types.Pool, ...) (sdk.Uint, error)
- func (k Keeper) Codec() codec.BinaryCodec
- func (k Keeper) CollectProviderDistributions(ctx sdk.Context, pools []*types.Pool, blockRate sdk.Dec) (PoolFuryMap, LpFuryMap, LpPoolMap)
- func (k Keeper) CreateLiquidityProvider(ctx sdk.Context, asset *types.Asset, lpunits sdk.Uint, ...) types.LiquidityProvider
- func (k Keeper) CreatePool(ctx sdk.Context, poolUints sdk.Uint, msg *types.MsgCreatePool) (*types.Pool, error)
- func (k Keeper) DecommissionPool(ctx sdk.Context, pool types.Pool) error
- func (k Keeper) DecrementPmtpBlockCounter(ctx sdk.Context)
- func (k Keeper) DecrementPmtpEpochCounter(ctx sdk.Context)
- func (k Keeper) DequeueRemovalRequest(ctx sdk.Context, request types.RemovalRequest)
- func (k Keeper) DestroyLiquidityProvider(ctx sdk.Context, symbol string, lpAddress string)
- func (k Keeper) DestroyPool(ctx sdk.Context, symbol string) error
- func (k Keeper) DistributeDepthRewards(ctx sdk.Context, blockDistribution sdk.Uint, period *types.RewardPeriod, ...) error
- func (k Keeper) Exists(ctx sdk.Context, key []byte) bool
- func (k Keeper) ExistsClpWhiteList(ctx sdk.Context) bool
- func (k Keeper) ExistsPool(ctx sdk.Context, symbol string) bool
- func (k Keeper) FinalizeSwap(ctx sdk.Context, sentAmount string, finalPool types.Pool, msg types.MsgSwap) error
- func (k Keeper) GetAllLiquidityProviders(ctx sdk.Context) ([]*types.LiquidityProvider, error)
- func (k Keeper) GetAllLiquidityProvidersForAsset(ctx sdk.Context, asset types.Asset) ([]*types.LiquidityProvider, error)
- func (k Keeper) GetAllLiquidityProvidersPaginated(ctx sdk.Context, pagination *query.PageRequest) ([]*types.LiquidityProvider, *query.PageResponse, error)
- func (k Keeper) GetAllLiquidityProvidersPartitions(ctx sdk.Context) (map[types.Asset][]*types.LiquidityProvider, error)
- func (k Keeper) GetAssetDecimals(ctx sdk.Context, asset types.Asset) (uint8, error)
- func (k Keeper) GetAssetsForLiquidityProviderPaginated(ctx sdk.Context, lpAddress sdk.AccAddress, pagination *query.PageRequest) ([]*types.Asset, *query.PageResponse, error)
- func (k Keeper) GetAuthKeeper() types.AuthKeeper
- func (k Keeper) GetBankKeeper() types.BankKeeper
- func (k Keeper) GetBlockDistributionAccu(ctx sdk.Context) sdk.Uint
- func (k Keeper) GetClpWhiteList(ctx sdk.Context) []sdk.AccAddress
- func (k Keeper) GetCurrentRewardPeriod(ctx sdk.Context, params *types.RewardParams) *types.RewardPeriod
- func (k Keeper) GetLiquidityProtectionParams(ctx sdk.Context) *types.LiquidityProtectionParams
- func (k Keeper) GetLiquidityProtectionRateParams(ctx sdk.Context) types.LiquidityProtectionRateParams
- func (k Keeper) GetLiquidityProvider(ctx sdk.Context, symbol string, lpAddress string) (types.LiquidityProvider, error)
- func (k Keeper) GetLiquidityProviderIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetLiquidityProvidersForAssetPaginated(ctx sdk.Context, asset types.Asset, pagination *query.PageRequest) ([]*types.LiquidityProvider, *query.PageResponse, error)
- func (k Keeper) GetMarginKeeper() margintypes.Keeper
- func (k Keeper) GetMinCreatePoolThreshold(ctx sdk.Context) (res uint64)
- func (k Keeper) GetModuleFury(ctx sdk.Context) sdk.Coin
- func (k Keeper) GetNativePrice(ctx sdk.Context) (sdk.Dec, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPmtpEpoch(ctx sdk.Context) types.PmtpEpoch
- func (k Keeper) GetPmtpParams(ctx sdk.Context) *types.PmtpParams
- func (k Keeper) GetPmtpRateParams(ctx sdk.Context) types.PmtpRateParams
- func (k Keeper) GetPool(ctx sdk.Context, symbol string) (types.Pool, error)
- func (k Keeper) GetPools(ctx sdk.Context) []*types.Pool
- func (k Keeper) GetPoolsIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetPoolsPaginated(ctx sdk.Context, pagination *query.PageRequest) ([]*types.Pool, *query.PageResponse, error)
- func (k Keeper) GetProviderDistributionParams(ctx sdk.Context) *types.ProviderDistributionParams
- func (k Keeper) GetRemovalQueue(ctx sdk.Context, symbol string) types.RemovalQueue
- func (k Keeper) GetRemovalQueueIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetRemovalQueueUnitsForLP(ctx sdk.Context, lp types.LiquidityProvider) sdk.Uint
- func (k Keeper) GetRewardsParams(ctx sdk.Context) *types.RewardParams
- func (k Keeper) GetSwapFeeParams(ctx sdk.Context) types.SwapFeeParams
- func (k Keeper) GetSwapFeeRate(ctx sdk.Context, asset types.Asset, marginEnabled bool) sdk.Dec
- func (k Keeper) GetSymmetryRatio(ctx sdk.Context) sdk.Dec
- func (k Keeper) GetSymmetryThreshold(ctx sdk.Context) sdk.Dec
- func (k Keeper) HasBalance(ctx sdk.Context, addr sdk.AccAddress, coin sdk.Coin) bool
- func (k Keeper) InitiateSwap(ctx sdk.Context, sentCoin sdk.Coin, swapper sdk.AccAddress) error
- func (k Keeper) IsBlockedByLiquidityProtection(ctx sdk.Context, nativeAmount sdk.Uint, nativePrice sdk.Dec) bool
- func (k Keeper) IsDistributionBlock(ctx sdk.Context) bool
- func (k Keeper) IsInsidePmtpWindow(ctx sdk.Context) bool
- func (k Keeper) IsRemovalQueueEnabled(ctx sdk.Context) (enable bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MustUpdateLiquidityProtectionThreshold(ctx sdk.Context, sellNative bool, nativeAmount sdk.Uint, nativePrice sdk.Dec)
- func (k Keeper) ParseToInt(nu string) (sdk.Int, bool)
- func (k Keeper) PolicyCalculations(ctx sdk.Context) sdk.Dec
- func (k Keeper) PolicyRun(ctx sdk.Context, pmtpCurrentRunningRate sdk.Dec) error
- func (k Keeper) PolicyStart(ctx sdk.Context)
- func (k Keeper) ProcessRemovalQueue(ctx sdk.Context, msg *types.MsgAddLiquidity, unitsToDistribute sdk.Uint)
- func (k Keeper) ProcessRemoveLiquidityMsg(ctx sdk.Context, msg *types.MsgRemoveLiquidity) (sdk.Int, sdk.Int, sdk.Uint, error)
- func (k Keeper) ProviderDistributionPolicyRun(ctx sdk.Context)
- func (k Keeper) PruneUnlockRecords(ctx sdk.Context, lp *types.LiquidityProvider, lockPeriod, cancelPeriod uint64)
- func (k Keeper) QueueRemoval(ctx sdk.Context, msg *types.MsgRemoveLiquidity, furyValue sdk.Uint)
- func (k Keeper) RemoveFuryFromPool(ctx sdk.Context, pool *types.Pool, amount sdk.Uint) error
- func (k Keeper) RemoveLiquidity(ctx sdk.Context, pool types.Pool, externalAssetCoin sdk.Coin, ...) error
- func (k Keeper) RemoveLiquidityProvider(ctx sdk.Context, coins sdk.Coins, lp types.LiquidityProvider) error
- func (k Keeper) SendCoins(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, coins sdk.Coins) error
- func (k Keeper) SendFuryFromPool(ctx sdk.Context, pool *types.Pool, amount sdk.Uint, recipient sdk.AccAddress) error
- func (k Keeper) SendFuryFromPoolNoPoolUpdate(ctx sdk.Context, pool *types.Pool, amount sdk.Uint, recipient sdk.AccAddress) error
- func (k Keeper) SetBlockDistributionAccu(ctx sdk.Context, blockDistribution sdk.Uint)
- func (k Keeper) SetClpWhiteList(ctx sdk.Context, validatorList []sdk.AccAddress)
- func (k Keeper) SetLiquidityProtectionCurrentFuryLiquidityThreshold(ctx sdk.Context, currentFuryLiquidityThreshold sdk.Uint)
- func (k Keeper) SetLiquidityProtectionParams(ctx sdk.Context, params *types.LiquidityProtectionParams)
- func (k Keeper) SetLiquidityProtectionRateParams(ctx sdk.Context, params types.LiquidityProtectionRateParams)
- func (k Keeper) SetLiquidityProvider(ctx sdk.Context, lp *types.LiquidityProvider)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPmtpBlockCounter(ctx sdk.Context, epochLength int64)
- func (k Keeper) SetPmtpBlockRate(ctx sdk.Context, blockRate sdk.Dec)
- func (k Keeper) SetPmtpCurrentRunningRate(ctx sdk.Context, runningRate sdk.Dec)
- func (k Keeper) SetPmtpEpoch(ctx sdk.Context, params types.PmtpEpoch)
- func (k Keeper) SetPmtpInterPolicyRate(ctx sdk.Context, interPolicyRate sdk.Dec)
- func (k Keeper) SetPmtpParams(ctx sdk.Context, params *types.PmtpParams)
- func (k Keeper) SetPmtpRateParams(ctx sdk.Context, params types.PmtpRateParams)
- func (k Keeper) SetPool(ctx sdk.Context, pool *types.Pool) error
- func (k Keeper) SetProcessedRemovalRequest(ctx sdk.Context, request types.RemovalRequest, pointsProcessed sdk.Int, ...)
- func (k Keeper) SetProviderDistributionParams(ctx sdk.Context, params *types.ProviderDistributionParams)
- func (k Keeper) SetRemovalQueue(ctx sdk.Context, queue types.RemovalQueue, symbol string)
- func (k Keeper) SetRewardParams(ctx sdk.Context, params *types.RewardParams)
- func (k Keeper) SetSwapFeeParams(ctx sdk.Context, params *types.SwapFeeParams)
- func (k Keeper) SetSymmetryThreshold(ctx sdk.Context, setThreshold *types.MsgSetSymmetryThreshold)
- func (k Keeper) SingleExternalBalanceModuleAccountCheck(externalAsset string) sdk.Invariant
- func (k Keeper) TransferProviderDistribution(ctx sdk.Context, poolFuryMap PoolFuryMap, lpFuryMap LpFuryMap, ...)
- func (k Keeper) TransferProviderDistributionGeneric(ctx sdk.Context, poolFuryMap PoolFuryMap, lpFuryMap LpFuryMap, ...)
- func (k Keeper) TransferRewards(ctx sdk.Context, poolFuryMap PoolFuryMap, lpFuryMap LpFuryMap, ...)
- func (k Keeper) UnitsCheck() sdk.Invariant
- func (k Keeper) UseUnlockedLiquidity(ctx sdk.Context, lp types.LiquidityProvider, units sdk.Uint, any bool) error
- func (k Keeper) ValidateAddress(ctx sdk.Context, address sdk.AccAddress) bool
- func (k Keeper) ValidatePool(pool types.Pool) bool
- type LPPool
- type LpFuryMap
- type LpPoolMap
- type Migrator
- type PoolFuryMap
- type PoolReward
- type Querier
- func (k Querier) GetAssetList(c context.Context, req *types.AssetListReq) (*types.AssetListRes, error)
- func (k Querier) GetLiquidityProtectionParams(c context.Context, _ *types.LiquidityProtectionParamsReq) (*types.LiquidityProtectionParamsRes, error)
- func (k Querier) GetLiquidityProvider(c context.Context, req *types.LiquidityProviderReq) (*types.LiquidityProviderRes, error)
- func (k Querier) GetLiquidityProviderData(c context.Context, req *types.LiquidityProviderDataReq) (*types.LiquidityProviderDataRes, error)
- func (k Querier) GetLiquidityProviderList(c context.Context, req *types.LiquidityProviderListReq) (*types.LiquidityProviderListRes, error)
- func (k Querier) GetLiquidityProviders(c context.Context, req *types.LiquidityProvidersReq) (*types.LiquidityProvidersRes, error)
- func (k Querier) GetParams(c context.Context, _ *types.ParamsReq) (*types.ParamsRes, error)
- func (k Querier) GetPmtpParams(c context.Context, _ *types.PmtpParamsReq) (*types.PmtpParamsRes, error)
- func (k Querier) GetPool(c context.Context, req *types.PoolReq) (*types.PoolRes, error)
- func (k Querier) GetPoolShareEstimate(c context.Context, req *types.PoolShareEstimateReq) (*types.PoolShareEstimateRes, error)
- func (k Querier) GetPools(c context.Context, req *types.PoolsReq) (*types.PoolsRes, error)
- func (k Querier) GetProviderDistributionParams(c context.Context, _ *types.ProviderDistributionParamsReq) (*types.ProviderDistributionParamsRes, error)
- func (k Querier) GetRewardParams(c context.Context, _ *types.RewardParamsReq) (*types.RewardParamsRes, error)
- func (k Querier) GetSwapFeeParams(c context.Context, _ *types.SwapFeeParamsReq) (*types.SwapFeeParamsRes, error)
- type ValidLiquidityProvider
Constants ¶
const ( SellNative = iota BuyNative NoSwap )
const ( ErrorEmptyPool = iota ErrorNothingAdded NeedMoreY // Need more y token to make Y/X == y/x Symmetric // Y/X == y/x NeedMoreX // Need more x token to make Y/X == y/x )
const MaxPageLimit = 200
Variables ¶
This section is empty.
Functions ¶
func CalcBlockDistribution ¶
func CalcBlockDistribution(period *types.RewardPeriod) sdk.Uint
func CalcDenomChangeMultiplier ¶
Denom change multiplier = 10**decimalsX / 10**decimalsY
func CalcFurySpotPrice ¶
Calculates spot price of Fury accounting for PMTP
func CalcSpotPriceExternal ¶
func CalcSpotPriceNative ¶
func CalcSpotPriceX ¶
func CalcSpotPriceX(X, Y sdk.Uint, decimalsX, decimalsY uint8, pmtpCurrentRunningRate sdk.Dec, isXNative bool) (sdk.Dec, error)
Calculates the spot price of asset X in the preferred denominations accounting for PMTP. Since this method applies PMTP adjustment, one of X, Y must be the native asset.
func CalcSwapResult ¶
func CalculateAllAssetsForLP ¶
func CalculateExternalSwapAmountAsymmetric ¶
Calculates how much external asset to swap for an asymmetric add to become symmetric. R - native asset depth A - external asset depth r - native asset amount a - external asset amount f - swap fee rate p - pmtp (ratio shifting) current running rate
Calculates the amount of external asset to swap, s, such that the ratio of the added assets after the swap equals the ratio of assets in the pool after the swap i.e. calculates s, such that (a+A)/(r+R) = (a−s) / (r + s*R/(s+A)*(1−f)/(1+p)).
Solving for s gives, s = math.Abs((math.Sqrt(R*(-1*(a+A))*(-1*f*f*a*R-f*f*A*R-2*f*p*a*R+4*f*p*A*r+2*f*p*A*R+4*f*A*r+4*f*A*R-p*p*a*R-p*p*A*R-4*p*A*r-4*p*A*R-4*A*r-4*A*R)) + f*a*R + f*A*R + p*a*R - 2*p*A*r - p*A*R - 2*A*r - 2*A*R) / (2 * (p + 1) * (r + R))).
This function should only be used when when more native asset is required in order for an add to be symmetric i.e. when R,A,a > 0 and R/A > r/a. If more external asset is required, then due to ratio shifting the swap formula changes, in which case use CalculateNativeSwapAmountAsymmetric.
func CalculateExternalSwapAmountAsymmetricRat ¶
NOTE: this method is only exported to make testing easier
NOTE: this method panics if a negative value is passed to the sqrt It's not clear whether this condition could ever happen given the external constraints on the inputs (e.g. X,Y,x > 0 and Y/X > y/x). It is possible to guard against a panic by ensuring the sqrt argument is positive.
func CalculateNativeSwapAmountAsymmetric ¶
This function should only be used when when more external asset is required in order for an add to be symmetric i.e. when R,A,r > 0 and (a==0 or R/A < r/a) If more native asset is required, then due to ratio shifting the swap formula changes, in which case use CalculateExternalSwapAmountAsymmetric.
func CalculateNativeSwapAmountAsymmetricRat ¶
NOTE: this method is only exported to make testing easier
NOTE: this method panics if a negative value is passed to the sqrt It's not clear whether this condition could ever happen given the constraints on the inputs (i.e. Y,X,y > 0 and (x==0 or Y/X < y/x). It is possible to guard against a panic by ensuring the sqrt argument is positive.
func CalculatePoolUnits ¶
func CalculatePoolUnits(P, R, A, r, a sdk.Uint, sellNativeSwapFeeRate, buyNativeSwapFeeRate, pmtpCurrentRunningRate sdk.Dec) (sdk.Uint, sdk.Uint, int, sdk.Uint, error)
Calculate pool units taking into account the current pmtpCurrentRunningRate R - native asset depth A - external asset depth r - native asset amount a - external asset amount P - current number of pool units
func CalculateWithdrawal ¶
func CalculateWithdrawal(poolUnits sdk.Uint, nativeAssetDepth string, externalAssetDepth string, lpUnits string, wBasisPoints string, asymmetry sdk.Int) (sdk.Uint, sdk.Uint, sdk.Uint, sdk.Uint)
More details on the formula https://github.com/Furynet/furynode/blob/develop/docs/1.Liquidity%20Pools%20Architecture.md
func CalculateWithdrawalFromUnits ¶
func CalculateWithdrawalFromUnits(poolUnits sdk.Uint, nativeAssetDepth string, externalAssetDepth string, lpUnits string, withdrawUnits sdk.Uint) (sdk.Uint, sdk.Uint, sdk.Uint)
More details on the formula https://github.com/Furynet/furynode/blob/develop/docs/1.Liquidity%20Pools%20Architecture.md
func CollectRewards ¶
func ConvWBasisPointsToUnits ¶
func CreateEventBlockHeight ¶
func CreateEventMsg ¶
func FindProviderDistributionPeriod ¶
func FindProviderDistributionPeriod(currentHeight int64, periods []*types.ProviderDistributionPeriod) *types.ProviderDistributionPeriod
func GetLiquidityAddSymmetryState ¶
Determines how the amount of assets added to a pool, x, y, compare to the current pool ratio, Y/X
func GetPoolMultiplier ¶
func GetPoolMultiplier(asset string, period *types.RewardPeriod) sdk.Dec
func GetSwapFee ¶
func Int64ToUint8Safe ¶
func IsDistributionBlockPure ¶
do the thing every mod blocks starting at startHeight
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the clp MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
NewQuerier is the module level router for state queries
func PrintPools ¶
func RegisterInvariants ¶
func RegisterInvariants(registry sdk.InvariantRegistry, k Keeper)
Types ¶
type FormattedPool ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the clp store
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, bankkeeper types.BankKeeper, accountKeeper types.AuthKeeper, tokenRegistryKeeper tokenregistrytypes.Keeper, adminKeeper types.AdminKeeper, mintKeeper mintkeeper.Keeper, getMarginKeeper func() margintypes.Keeper, ps paramtypes.Subspace) Keeper
NewKeeper creates a clp keeper
func (Keeper) AddLiquidity ¶
func (Keeper) BalanceModuleAccountCheck ¶
func (Keeper) CLPCalcSwap ¶
func (Keeper) Codec ¶
func (k Keeper) Codec() codec.BinaryCodec
func (Keeper) CollectProviderDistributions ¶
func (Keeper) CreateLiquidityProvider ¶
func (Keeper) CreatePool ¶
func (Keeper) DecommissionPool ¶
func (Keeper) DecrementPmtpBlockCounter ¶
func (Keeper) DecrementPmtpEpochCounter ¶
func (Keeper) DequeueRemovalRequest ¶
func (k Keeper) DequeueRemovalRequest(ctx sdk.Context, request types.RemovalRequest)
func (Keeper) DestroyLiquidityProvider ¶
func (Keeper) DistributeDepthRewards ¶
func (Keeper) FinalizeSwap ¶
func (Keeper) GetAllLiquidityProviders ¶
func (Keeper) GetAllLiquidityProvidersForAsset ¶
func (Keeper) GetAllLiquidityProvidersPaginated ¶
func (k Keeper) GetAllLiquidityProvidersPaginated(ctx sdk.Context, pagination *query.PageRequest) ([]*types.LiquidityProvider, *query.PageResponse, error)
func (Keeper) GetAllLiquidityProvidersPartitions ¶
func (Keeper) GetAssetDecimals ¶
func (Keeper) GetAssetsForLiquidityProviderPaginated ¶
func (k Keeper) GetAssetsForLiquidityProviderPaginated(ctx sdk.Context, lpAddress sdk.AccAddress, pagination *query.PageRequest) ([]*types.Asset, *query.PageResponse, error)
func (Keeper) GetAuthKeeper ¶
func (k Keeper) GetAuthKeeper() types.AuthKeeper
func (Keeper) GetBankKeeper ¶
func (k Keeper) GetBankKeeper() types.BankKeeper
func (Keeper) GetBlockDistributionAccu ¶
func (Keeper) GetClpWhiteList ¶
func (k Keeper) GetClpWhiteList(ctx sdk.Context) []sdk.AccAddress
func (Keeper) GetCurrentRewardPeriod ¶
func (k Keeper) GetCurrentRewardPeriod(ctx sdk.Context, params *types.RewardParams) *types.RewardPeriod
func (Keeper) GetLiquidityProtectionParams ¶
func (k Keeper) GetLiquidityProtectionParams(ctx sdk.Context) *types.LiquidityProtectionParams
func (Keeper) GetLiquidityProtectionRateParams ¶
func (k Keeper) GetLiquidityProtectionRateParams(ctx sdk.Context) types.LiquidityProtectionRateParams
func (Keeper) GetLiquidityProvider ¶
func (Keeper) GetLiquidityProviderIterator ¶
func (Keeper) GetLiquidityProvidersForAssetPaginated ¶
func (k Keeper) GetLiquidityProvidersForAssetPaginated(ctx sdk.Context, asset types.Asset, pagination *query.PageRequest) ([]*types.LiquidityProvider, *query.PageResponse, error)
func (Keeper) GetMarginKeeper ¶
func (k Keeper) GetMarginKeeper() margintypes.Keeper
func (Keeper) GetMinCreatePoolThreshold ¶
func (Keeper) GetNativePrice ¶
Currently this calculates the native price on the fly Calculates the price of the native token in MaxFuryLiquidityThresholdAsset
func (Keeper) GetPmtpParams ¶
func (k Keeper) GetPmtpParams(ctx sdk.Context) *types.PmtpParams
func (Keeper) GetPmtpRateParams ¶
func (k Keeper) GetPmtpRateParams(ctx sdk.Context) types.PmtpRateParams
func (Keeper) GetPoolsPaginated ¶
func (k Keeper) GetPoolsPaginated(ctx sdk.Context, pagination *query.PageRequest) ([]*types.Pool, *query.PageResponse, error)
func (Keeper) GetProviderDistributionParams ¶
func (k Keeper) GetProviderDistributionParams(ctx sdk.Context) *types.ProviderDistributionParams
func (Keeper) GetRemovalQueue ¶
func (Keeper) GetRemovalQueueIterator ¶
func (Keeper) GetRemovalQueueUnitsForLP ¶
func (Keeper) GetRewardsParams ¶
func (k Keeper) GetRewardsParams(ctx sdk.Context) *types.RewardParams
func (Keeper) GetSwapFeeParams ¶
func (k Keeper) GetSwapFeeParams(ctx sdk.Context) types.SwapFeeParams
func (Keeper) GetSwapFeeRate ¶
func (Keeper) HasBalance ¶
func (Keeper) InitiateSwap ¶
func (Keeper) IsBlockedByLiquidityProtection ¶
func (k Keeper) IsBlockedByLiquidityProtection(ctx sdk.Context, nativeAmount sdk.Uint, nativePrice sdk.Dec) bool
The nativePrice should be in MaxFuryLiquidityThresholdAsset
func (Keeper) IsRemovalQueueEnabled ¶
func (Keeper) MustUpdateLiquidityProtectionThreshold ¶
func (k Keeper) MustUpdateLiquidityProtectionThreshold(ctx sdk.Context, sellNative bool, nativeAmount sdk.Uint, nativePrice sdk.Dec)
This method should only be called if buying or selling native asset. If sellNative is false then this method assumes that buyNative is true. The nativePrice should be in MaxFuryLiquidityThresholdAsset NOTE: this method panics if sellNative is true and the value of the sell amount is greater than the value of currentFuryLiquidityThreshold. Call IsBlockedByLiquidityProtection before if unsure.
func (Keeper) ParseToInt ¶
Use strings instead of Unit/Int in between conventions
func (Keeper) PolicyRun ¶
NOTE: the code in this method must not panic otherwise the chain will halt see: https://bytemeta.vip/repo/osmosis-labs/osmosis/issues/1305
func (Keeper) PolicyStart ¶
func (Keeper) ProcessRemovalQueue ¶
func (Keeper) ProcessRemoveLiquidityMsg ¶
func (Keeper) ProviderDistributionPolicyRun ¶
func (Keeper) PruneUnlockRecords ¶
func (Keeper) QueueRemoval ¶
func (Keeper) RemoveFuryFromPool ¶
func (Keeper) RemoveLiquidity ¶
func (Keeper) RemoveLiquidityProvider ¶
func (Keeper) SendCoins ¶
func (k Keeper) SendCoins(ctx sdk.Context, from sdk.AccAddress, to sdk.AccAddress, coins sdk.Coins) error
func (Keeper) SendFuryFromPool ¶
func (Keeper) SendFuryFromPoolNoPoolUpdate ¶
func (Keeper) SetBlockDistributionAccu ¶
func (Keeper) SetClpWhiteList ¶
func (k Keeper) SetClpWhiteList(ctx sdk.Context, validatorList []sdk.AccAddress)
func (Keeper) SetLiquidityProtectionCurrentFuryLiquidityThreshold ¶
func (Keeper) SetLiquidityProtectionParams ¶
func (k Keeper) SetLiquidityProtectionParams(ctx sdk.Context, params *types.LiquidityProtectionParams)
func (Keeper) SetLiquidityProtectionRateParams ¶
func (k Keeper) SetLiquidityProtectionRateParams(ctx sdk.Context, params types.LiquidityProtectionRateParams)
func (Keeper) SetLiquidityProvider ¶
func (k Keeper) SetLiquidityProvider(ctx sdk.Context, lp *types.LiquidityProvider)
func (Keeper) SetPmtpBlockCounter ¶
func (Keeper) SetPmtpBlockRate ¶
func (Keeper) SetPmtpCurrentRunningRate ¶
func (Keeper) SetPmtpInterPolicyRate ¶
func (Keeper) SetPmtpParams ¶
func (k Keeper) SetPmtpParams(ctx sdk.Context, params *types.PmtpParams)
func (Keeper) SetPmtpRateParams ¶
func (k Keeper) SetPmtpRateParams(ctx sdk.Context, params types.PmtpRateParams)
func (Keeper) SetProcessedRemovalRequest ¶
func (Keeper) SetProviderDistributionParams ¶
func (k Keeper) SetProviderDistributionParams(ctx sdk.Context, params *types.ProviderDistributionParams)
func (Keeper) SetRemovalQueue ¶
func (Keeper) SetRewardParams ¶
func (k Keeper) SetRewardParams(ctx sdk.Context, params *types.RewardParams)
func (Keeper) SetSwapFeeParams ¶
func (k Keeper) SetSwapFeeParams(ctx sdk.Context, params *types.SwapFeeParams)
func (Keeper) SetSymmetryThreshold ¶
func (k Keeper) SetSymmetryThreshold(ctx sdk.Context, setThreshold *types.MsgSetSymmetryThreshold)
func (Keeper) SingleExternalBalanceModuleAccountCheck ¶
func (Keeper) TransferProviderDistribution ¶
func (Keeper) TransferProviderDistributionGeneric ¶
func (Keeper) TransferRewards ¶
func (Keeper) UnitsCheck ¶
func (Keeper) UseUnlockedLiquidity ¶
func (Keeper) ValidateAddress ¶
type LPPool ¶
func PoolFuryMapToLPPools ¶
func PoolFuryMapToLPPools(poolFuryMap PoolFuryMap) []LPPool
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
type PoolReward ¶
func CollectPoolRewardTuples ¶
type Querier ¶
type Querier struct {
Keeper Keeper
}
Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper
func (Querier) GetAssetList ¶
func (k Querier) GetAssetList(c context.Context, req *types.AssetListReq) (*types.AssetListRes, error)
func (Querier) GetLiquidityProtectionParams ¶
func (k Querier) GetLiquidityProtectionParams(c context.Context, _ *types.LiquidityProtectionParamsReq) (*types.LiquidityProtectionParamsRes, error)
func (Querier) GetLiquidityProvider ¶
func (k Querier) GetLiquidityProvider(c context.Context, req *types.LiquidityProviderReq) (*types.LiquidityProviderRes, error)
func (Querier) GetLiquidityProviderData ¶
func (k Querier) GetLiquidityProviderData(c context.Context, req *types.LiquidityProviderDataReq) (*types.LiquidityProviderDataRes, error)
func (Querier) GetLiquidityProviderList ¶
func (k Querier) GetLiquidityProviderList(c context.Context, req *types.LiquidityProviderListReq) (*types.LiquidityProviderListRes, error)
func (Querier) GetLiquidityProviders ¶
func (k Querier) GetLiquidityProviders(c context.Context, req *types.LiquidityProvidersReq) (*types.LiquidityProvidersRes, error)
func (Querier) GetPmtpParams ¶
func (k Querier) GetPmtpParams(c context.Context, _ *types.PmtpParamsReq) (*types.PmtpParamsRes, error)
func (Querier) GetPoolShareEstimate ¶
func (k Querier) GetPoolShareEstimate(c context.Context, req *types.PoolShareEstimateReq) (*types.PoolShareEstimateRes, error)
func (Querier) GetProviderDistributionParams ¶
func (k Querier) GetProviderDistributionParams(c context.Context, _ *types.ProviderDistributionParamsReq) (*types.ProviderDistributionParamsRes, error)
func (Querier) GetRewardParams ¶
func (k Querier) GetRewardParams(c context.Context, _ *types.RewardParamsReq) (*types.RewardParamsRes, error)
func (Querier) GetSwapFeeParams ¶
func (k Querier) GetSwapFeeParams(c context.Context, _ *types.SwapFeeParamsReq) (*types.SwapFeeParamsRes, error)
type ValidLiquidityProvider ¶
type ValidLiquidityProvider struct { Address sdk.AccAddress LP *types.LiquidityProvider }
func FilterValidLiquidityProviders ¶
func FilterValidLiquidityProviders(ctx sdk.Context, lps []*types.LiquidityProvider) []ValidLiquidityProvider
Source Files ¶
- calculations.go
- events.go
- executors.go
- grpc_query.go
- invariants.go
- keeper.go
- liquidityprotection.go
- liquidityprotection_rate_params.go
- liquidityprovider.go
- migrations.go
- msg_server.go
- params.go
- pmtp.go
- pmtp_epoch.go
- pmtp_params.go
- pmtp_rate_params.go
- pool.go
- provider_distribution.go
- pureCalculation.go
- querier.go
- removalqueue.go
- reward_params.go
- rewards.go
- swap.go
- swap_fee_params.go
- validatorWhitelist.go