Documentation ¶
Index ¶
- Constants
- func CalcLiquidityFee(toRowan bool, normalizationFactor sdk.Dec, adjustExternalToken bool, ...) (sdk.Uint, error)
- func CalcSwapPmtp(toRowan bool, y, pmtpCurrentRunningRate sdk.Dec) sdk.Dec
- func CalcSwapPrice(from types.Asset, sentAmount sdk.Uint, to types.Asset, pool types.Pool, ...) sdk.Dec
- func CalcSwapPriceResult(toRowan bool, normalizationFactor sdk.Dec, adjustExternalToken bool, ...) sdk.Dec
- func CalcSwapResult(toRowan bool, normalizationFactor sdk.Dec, adjustExternalToken bool, ...) (sdk.Uint, error)
- func CalculateAllAssetsForLP(pool types.Pool, lp types.LiquidityProvider) (sdk.Uint, sdk.Uint, sdk.Uint, sdk.Uint)
- func CalculatePoolUnits(...) (sdk.Uint, sdk.Uint, error)
- func CalculateWithdrawal(poolUnits sdk.Uint, nativeAssetBalance string, externalAssetBalance string, ...) (sdk.Uint, sdk.Uint, sdk.Uint, sdk.Uint)
- func CalculateWithdrawalFromUnits(poolUnits sdk.Uint, nativeAssetBalance string, externalAssetBalance string, ...) (sdk.Uint, sdk.Uint, sdk.Uint)
- func GetMinLen(inputs []sdk.Uint) int64
- func GetSwapFee(sentAmount sdk.Uint, to types.Asset, pool types.Pool, ...) sdk.Uint
- func IncreasePrecision(dec sdk.Dec, po int64) sdk.Dec
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(keeper Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func ReducePrecision(dec sdk.Dec, po int64) sdk.Dec
- func SetInputs(sentAmount sdk.Uint, to types.Asset, pool types.Pool) (sdk.Uint, sdk.Uint, sdk.Uint, bool)
- func SwapOne(from types.Asset, sentAmount sdk.Uint, to types.Asset, pool types.Pool, ...) (sdk.Uint, sdk.Uint, sdk.Uint, types.Pool, error)
- func ValidateZero(inputs []sdk.Uint) bool
- type Keeper
- func (k Keeper) AddLiquidity(ctx sdk.Context, msg *types.MsgAddLiquidity, pool types.Pool, ...) (*types.LiquidityProvider, error)
- func (k Keeper) Codec() codec.BinaryCodec
- 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) DecrementBlockCounter(ctx sdk.Context)
- func (k Keeper) DecrementEpochCounter(ctx sdk.Context)
- 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, period *types.RewardPeriod, pools []*types.Pool) 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) GetAllLiquidityProvidersPaginated(ctx sdk.Context, pagination *query.PageRequest) ([]*types.LiquidityProvider, *query.PageResponse, 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) GetClpWhiteList(ctx sdk.Context) []sdk.AccAddress
- func (k Keeper) GetCurrentRewardPeriod(ctx sdk.Context, params *types.RewardParams) *types.RewardPeriod
- 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) GetMinCreatePoolThreshold(ctx sdk.Context) (res uint64)
- func (k Keeper) GetNormalizationFactor(decimals int64) (sdk.Dec, bool)
- func (k Keeper) GetNormalizationFactorFromAsset(ctx sdk.Context, asset types.Asset) (sdk.Dec, bool)
- 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) GetPoolMultiplier(asset string, period *types.RewardPeriod) sdk.Dec
- 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) GetRewardsParams(ctx sdk.Context) *types.RewardParams
- 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) IsInsidePmtpWindow(ctx sdk.Context) bool
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- 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) PruneUnlockRecords(ctx sdk.Context, lp *types.LiquidityProvider, lockPeriod, cancelPeriod uint64)
- 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) SetBlockCounter(ctx sdk.Context, epochLength int64)
- func (k Keeper) SetClpWhiteList(ctx sdk.Context, validatorList []sdk.AccAddress)
- func (k Keeper) SetLiquidityProvider(ctx sdk.Context, lp *types.LiquidityProvider)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- 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) SetRewardParams(ctx sdk.Context, params *types.RewardParams)
- func (k Keeper) SetSymmetryThreshold(ctx sdk.Context, setThreshold *types.MsgSetSymmetryThreshold)
- 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 Migrator
- type Querier
- func (k Querier) GetAssetList(c context.Context, req *types.AssetListReq) (*types.AssetListRes, 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) GetPools(c context.Context, req *types.PoolsReq) (*types.PoolsRes, error)
- func (k Querier) GetRewardParams(c context.Context, _ *types.RewardParamsReq) (*types.RewardParamsRes, error)
Constants ¶
const MaxPageLimit = 200
Variables ¶
This section is empty.
Functions ¶
func CalcLiquidityFee ¶
func CalcSwapPmtp ¶ added in v0.13.0
func CalcSwapPrice ¶ added in v0.13.0
func CalcSwapPriceResult ¶ added in v0.13.0
func CalcSwapResult ¶
func CalculateAllAssetsForLP ¶
func CalculatePoolUnits ¶
func CalculateWithdrawal ¶
func CalculateWithdrawal(poolUnits sdk.Uint, nativeAssetBalance string, externalAssetBalance string, lpUnits string, wBasisPoints string, asymmetry sdk.Int) (sdk.Uint, sdk.Uint, sdk.Uint, sdk.Uint)
More details on the formula https://github.com/Sifchain/sifnode/blob/develop/docs/1.Liquidity%20Pools%20Architecture.md
func CalculateWithdrawalFromUnits ¶ added in v0.13.0
func CalculateWithdrawalFromUnits(poolUnits sdk.Uint, nativeAssetBalance string, externalAssetBalance string, lpUnits string, withdrawUnits sdk.Uint) (sdk.Uint, sdk.Uint, sdk.Uint)
More details on the formula https://github.com/Sifchain/sifnode/blob/develop/docs/1.Liquidity%20Pools%20Architecture.md
func GetSwapFee ¶
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 SwapOne ¶
func SwapOne(from types.Asset, sentAmount sdk.Uint, to types.Asset, pool types.Pool, normalizationFactor sdk.Dec, adjustExternalToken bool, pmtpCurrentRunningRate sdk.Dec) (sdk.Uint, sdk.Uint, sdk.Uint, types.Pool, error)
------------------------------------------------------------------------------------------------------------------ More details on the formula https://github.com/Sifchain/sifnode/blob/develop/docs/1.Liquidity%20Pools%20Architecture.md
func ValidateZero ¶
Types ¶
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, mintKeeper mintkeeper.Keeper, ps paramtypes.Subspace) Keeper
NewKeeper creates a clp keeper
func (Keeper) AddLiquidity ¶
func (Keeper) Codec ¶
func (k Keeper) Codec() codec.BinaryCodec
func (Keeper) CreateLiquidityProvider ¶
func (Keeper) CreatePool ¶
func (Keeper) DecommissionPool ¶
func (Keeper) DecrementBlockCounter ¶ added in v0.13.0
func (Keeper) DecrementEpochCounter ¶ added in v0.13.0
func (Keeper) DestroyLiquidityProvider ¶
func (Keeper) DistributeDepthRewards ¶ added in v0.13.0
func (Keeper) FinalizeSwap ¶
func (Keeper) GetAllLiquidityProvidersPaginated ¶
func (k Keeper) GetAllLiquidityProvidersPaginated(ctx sdk.Context, pagination *query.PageRequest) ([]*types.LiquidityProvider, *query.PageResponse, error)
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) GetClpWhiteList ¶
func (k Keeper) GetClpWhiteList(ctx sdk.Context) []sdk.AccAddress
func (Keeper) GetCurrentRewardPeriod ¶ added in v0.13.0
func (k Keeper) GetCurrentRewardPeriod(ctx sdk.Context, params *types.RewardParams) *types.RewardPeriod
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) GetMinCreatePoolThreshold ¶
func (Keeper) GetNormalizationFactor ¶
func (Keeper) GetNormalizationFactorFromAsset ¶ added in v0.13.0
func (Keeper) GetPmtpEpoch ¶ added in v0.13.0
func (Keeper) GetPmtpParams ¶ added in v0.13.0
func (k Keeper) GetPmtpParams(ctx sdk.Context) *types.PmtpParams
func (Keeper) GetPmtpRateParams ¶ added in v0.13.0
func (k Keeper) GetPmtpRateParams(ctx sdk.Context) types.PmtpRateParams
func (Keeper) GetPoolMultiplier ¶ added in v0.13.0
func (Keeper) GetPoolsPaginated ¶
func (k Keeper) GetPoolsPaginated(ctx sdk.Context, pagination *query.PageRequest) ([]*types.Pool, *query.PageResponse, error)
func (Keeper) GetRewardsParams ¶ added in v0.13.0
func (k Keeper) GetRewardsParams(ctx sdk.Context) *types.RewardParams
func (Keeper) GetSymmetryRatio ¶ added in v0.13.3
func (Keeper) GetSymmetryThreshold ¶ added in v0.13.1
func (Keeper) HasBalance ¶
func (Keeper) InitiateSwap ¶
func (Keeper) IsInsidePmtpWindow ¶ added in v0.13.0
func (Keeper) ParseToInt ¶
Use strings instead of Unit/Int in between conventions
func (Keeper) PolicyCalculations ¶ added in v0.13.0
func (Keeper) PolicyStart ¶ added in v0.13.0
func (Keeper) PruneUnlockRecords ¶ added in v0.13.0
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) SetBlockCounter ¶ added in v0.13.0
func (Keeper) SetClpWhiteList ¶
func (k Keeper) SetClpWhiteList(ctx sdk.Context, validatorList []sdk.AccAddress)
func (Keeper) SetLiquidityProvider ¶
func (k Keeper) SetLiquidityProvider(ctx sdk.Context, lp *types.LiquidityProvider)
func (Keeper) SetPmtpBlockRate ¶ added in v0.13.0
func (Keeper) SetPmtpCurrentRunningRate ¶ added in v0.13.0
func (Keeper) SetPmtpEpoch ¶ added in v0.13.0
func (Keeper) SetPmtpInterPolicyRate ¶ added in v0.13.0
func (Keeper) SetPmtpParams ¶ added in v0.13.0
func (k Keeper) SetPmtpParams(ctx sdk.Context, params *types.PmtpParams)
func (Keeper) SetPmtpRateParams ¶ added in v0.13.0
func (k Keeper) SetPmtpRateParams(ctx sdk.Context, params types.PmtpRateParams)
func (Keeper) SetRewardParams ¶ added in v0.13.0
func (k Keeper) SetRewardParams(ctx sdk.Context, params *types.RewardParams)
func (Keeper) SetSymmetryThreshold ¶ added in v0.13.1
func (k Keeper) SetSymmetryThreshold(ctx sdk.Context, setThreshold *types.MsgSetSymmetryThreshold)
func (Keeper) UseUnlockedLiquidity ¶ added in v0.13.0
func (Keeper) ValidateAddress ¶
type Migrator ¶ added in v0.13.0
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶ added in v0.13.0
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) 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 ¶ added in v0.13.0
func (k Querier) GetPmtpParams(c context.Context, _ *types.PmtpParamsReq) (*types.PmtpParamsRes, error)
func (Querier) GetRewardParams ¶ added in v0.13.0
func (k Querier) GetRewardParams(c context.Context, _ *types.RewardParamsReq) (*types.RewardParamsRes, error)