Documentation ¶
Index ¶
- Variables
- func AllInvariants(k Keeper) sdk.Invariant
- func BurningPoolCoinsInvariant(...)
- func DepositInvariant(lastReserveCoinA, lastReserveCoinB, depositCoinA, depositCoinB, ... sdk.Int)
- func ImmutablePoolPriceAfterWithdrawInvariant(...)
- func LiquidityPoolsEscrowAmountInvariant(k Keeper) sdk.Invariant
- func MintingPoolCoinsInvariant(poolCoinTotalSupply, mintPoolCoin, depositCoinA, depositCoinB, ... sdk.Int)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func WithdrawAmountInvariant(...)
- func WithdrawReserveCoinsInvariant(...)
- type Keeper
- func (k Keeper) CreatePool(ctx sdk.Context, msg *types.MsgCreatePool) (types.Pool, error)
- func (k Keeper) DeleteAllReadyPoolBatchDepositMsgStates(ctx sdk.Context, poolBatch types.PoolBatch)
- func (k Keeper) DeleteAllReadyPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch)
- func (k Keeper) DeleteAllReadyPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch)
- func (k Keeper) DeleteAndInitPoolBatches(ctx sdk.Context)
- func (k Keeper) DeletePool(ctx sdk.Context, pool types.Pool)
- func (k Keeper) DeletePoolBatch(ctx sdk.Context, poolBatch types.PoolBatch)
- func (k Keeper) DeletePoolBatchSwapMsgState(ctx sdk.Context, poolID uint64, msgIndex uint64)
- func (k Keeper) DepositWithinBatch(ctx sdk.Context, msg *types.MsgDepositWithinBatch) (types.DepositMsgState, error)
- func (k Keeper) ExecuteDeposit(ctx sdk.Context, msg types.DepositMsgState, batch types.PoolBatch) error
- func (k Keeper) ExecutePoolBatches(ctx sdk.Context)
- func (k Keeper) ExecuteWithdrawal(ctx sdk.Context, msg types.WithdrawMsgState, batch types.PoolBatch) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllDepositMsgStates(ctx sdk.Context) (states []types.DepositMsgState)
- func (k Keeper) GetAllNotProcessedPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.SwapMsgState)
- func (k Keeper) GetAllPoolBatchDepositMsgStatesNotToBeDeleted(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.DepositMsgState)
- func (k Keeper) GetAllPoolBatchDepositMsgs(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.DepositMsgState)
- func (k Keeper) GetAllPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.SwapMsgState)
- func (k Keeper) GetAllPoolBatchSwapMsgStatesAsPointer(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.SwapMsgState)
- func (k Keeper) GetAllPoolBatchSwapMsgStatesNotToBeDeleted(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.SwapMsgState)
- func (k Keeper) GetAllPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.WithdrawMsgState)
- func (k Keeper) GetAllPoolBatchWithdrawMsgStatesNotToBeDeleted(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.WithdrawMsgState)
- func (k Keeper) GetAllPoolBatches(ctx sdk.Context) (poolBatches []types.PoolBatch)
- func (k Keeper) GetAllPools(ctx sdk.Context) (pools []types.Pool)
- func (k Keeper) GetAllRemainingPoolBatchDepositMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.DepositMsgState)
- func (k Keeper) GetAllRemainingPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.SwapMsgState)
- func (k Keeper) GetAllRemainingPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.WithdrawMsgState)
- func (k Keeper) GetAllSwapMsgStates(ctx sdk.Context) (states []types.SwapMsgState)
- func (k Keeper) GetAllWithdrawMsgStates(ctx sdk.Context) (states []types.WithdrawMsgState)
- func (k Keeper) GetCircuitBreakerEnabled(ctx sdk.Context) (enabled bool)
- func (k Keeper) GetNextPoolID(ctx sdk.Context) uint64
- func (k Keeper) GetNextPoolIDWithUpdate(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPool(ctx sdk.Context, poolID uint64) (pool types.Pool, found bool)
- func (k Keeper) GetPoolBatch(ctx sdk.Context, poolID uint64) (poolBatch types.PoolBatch, found bool)
- func (k Keeper) GetPoolBatchDepositMsgState(ctx sdk.Context, poolID, msgIndex uint64) (state types.DepositMsgState, found bool)
- func (k Keeper) GetPoolBatchSwapMsgState(ctx sdk.Context, poolID, msgIndex uint64) (state types.SwapMsgState, found bool)
- func (k Keeper) GetPoolBatchWithdrawMsgState(ctx sdk.Context, poolID, msgIndex uint64) (state types.WithdrawMsgState, found bool)
- func (k Keeper) GetPoolByReserveAccIndex(ctx sdk.Context, reserveAcc sdk.AccAddress) (pool types.Pool, found bool)
- func (k Keeper) GetPoolCoinTotal(ctx sdk.Context, pool types.Pool) sdk.Coin
- func (k Keeper) GetPoolCoinTotalSupply(ctx sdk.Context, pool types.Pool) sdk.Int
- func (k Keeper) GetPoolMetaData(ctx sdk.Context, pool types.Pool) types.PoolMetadata
- func (k Keeper) GetPoolRecord(ctx sdk.Context, pool types.Pool) (types.PoolRecord, bool)
- func (k Keeper) GetReserveCoins(ctx sdk.Context, pool types.Pool) (reserveCoins sdk.Coins)
- func (k Keeper) HoldEscrow(ctx sdk.Context, depositor sdk.AccAddress, depositCoins sdk.Coins) error
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) InitNextPoolBatch(ctx sdk.Context, poolBatch types.PoolBatch) error
- func (k Keeper) IsDepletedPool(ctx sdk.Context, pool types.Pool) bool
- func (k Keeper) IsPoolCoinDenom(ctx sdk.Context, denom string) bool
- func (k Keeper) IterateAllDepositMsgStates(ctx sdk.Context, cb func(state types.DepositMsgState) (stop bool))
- func (k Keeper) IterateAllPoolBatchDepositMsgStates(ctx sdk.Context, poolBatch types.PoolBatch, ...)
- func (k Keeper) IterateAllPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch, ...)
- func (k Keeper) IterateAllPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch, ...)
- func (k Keeper) IterateAllPoolBatches(ctx sdk.Context, cb func(poolBatch types.PoolBatch) (stop bool))
- func (k Keeper) IterateAllPools(ctx sdk.Context, cb func(pool types.Pool) (stop bool))
- func (k Keeper) IterateAllSwapMsgStates(ctx sdk.Context, cb func(state types.SwapMsgState) (stop bool))
- func (k Keeper) IterateAllWithdrawMsgStates(ctx sdk.Context, cb func(state types.WithdrawMsgState) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintAndSendPoolCoin(ctx sdk.Context, pool types.Pool, srcAddr, creatorAddr sdk.AccAddress, ...) (sdk.Coin, error)
- func (k Keeper) RefundDeposit(ctx sdk.Context, batchMsg types.DepositMsgState, batch types.PoolBatch) error
- func (k Keeper) RefundWithdrawal(ctx sdk.Context, batchMsg types.WithdrawMsgState, batch types.PoolBatch) error
- func (k Keeper) ReleaseEscrow(ctx sdk.Context, withdrawer sdk.AccAddress, withdrawCoins sdk.Coins) error
- func (k Keeper) ReleaseEscrowForMultiSend(withdrawer sdk.AccAddress, withdrawCoins sdk.Coins) (banktypes.Input, banktypes.Output, error)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)
- func (k Keeper) SetPoolAtomic(ctx sdk.Context, pool types.Pool) types.Pool
- func (k Keeper) SetPoolBatch(ctx sdk.Context, poolBatch types.PoolBatch)
- func (k Keeper) SetPoolBatchDepositMsgState(ctx sdk.Context, poolID uint64, state types.DepositMsgState)
- func (k Keeper) SetPoolBatchDepositMsgStates(ctx sdk.Context, poolID uint64, states []types.DepositMsgState)
- func (k Keeper) SetPoolBatchDepositMsgStatesByPointer(ctx sdk.Context, poolID uint64, states []*types.DepositMsgState)
- func (k Keeper) SetPoolBatchSwapMsgState(ctx sdk.Context, poolID uint64, state types.SwapMsgState)
- func (k Keeper) SetPoolBatchSwapMsgStates(ctx sdk.Context, poolID uint64, states []types.SwapMsgState)
- func (k Keeper) SetPoolBatchSwapMsgStatesByPointer(ctx sdk.Context, poolID uint64, states []*types.SwapMsgState)
- func (k Keeper) SetPoolBatchWithdrawMsgState(ctx sdk.Context, poolID uint64, state types.WithdrawMsgState)
- func (k Keeper) SetPoolBatchWithdrawMsgStates(ctx sdk.Context, poolID uint64, states []types.WithdrawMsgState)
- func (k Keeper) SetPoolBatchWithdrawMsgStatesByPointer(ctx sdk.Context, poolID uint64, states []*types.WithdrawMsgState)
- func (k Keeper) SetPoolByReserveAccIndex(ctx sdk.Context, pool types.Pool)
- func (k Keeper) SetPoolRecord(ctx sdk.Context, record types.PoolRecord) types.PoolRecord
- func (k Keeper) ValidateGenesis(ctx sdk.Context, genState types.GenesisState) error
- func (k Keeper) ValidateMsgCreatePool(ctx sdk.Context, msg *types.MsgCreatePool) error
- func (k Keeper) ValidateMsgDepositWithinBatch(ctx sdk.Context, msg types.MsgDepositWithinBatch) error
- func (k Keeper) ValidateMsgWithdrawWithinBatch(ctx sdk.Context, msg types.MsgWithdrawWithinBatch) error
- func (k Keeper) ValidatePool(ctx sdk.Context, pool *types.Pool) error
- func (k Keeper) ValidatePoolMetadata(ctx sdk.Context, pool *types.Pool, metaData *types.PoolMetadata) error
- func (k Keeper) ValidatePoolRecord(ctx sdk.Context, record types.PoolRecord) error
- func (k Keeper) WithdrawWithinBatch(ctx sdk.Context, msg *types.MsgWithdrawWithinBatch) (types.WithdrawMsgState, error)
- type Migrator
- type Querier
- func (k Querier) LiquidityPool(c context.Context, req *types.QueryLiquidityPoolRequest) (*types.QueryLiquidityPoolResponse, error)
- func (k Querier) LiquidityPoolBatch(c context.Context, req *types.QueryLiquidityPoolBatchRequest) (*types.QueryLiquidityPoolBatchResponse, error)
- func (k Querier) LiquidityPoolByPoolCoinDenom(c context.Context, req *types.QueryLiquidityPoolByPoolCoinDenomRequest) (*types.QueryLiquidityPoolResponse, error)
- func (k Querier) LiquidityPoolByReserveAcc(c context.Context, req *types.QueryLiquidityPoolByReserveAccRequest) (*types.QueryLiquidityPoolResponse, error)
- func (k Querier) LiquidityPools(c context.Context, req *types.QueryLiquidityPoolsRequest) (*types.QueryLiquidityPoolsResponse, error)
- func (k Querier) MakeQueryLiquidityPoolResponse(pool types.Pool) (*types.QueryLiquidityPoolResponse, error)
- func (k Querier) MakeQueryLiquidityPoolsResponse(pools types.Pools) (*[]types.QueryLiquidityPoolResponse, error)
- func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) PoolBatchDepositMsg(c context.Context, req *types.QueryPoolBatchDepositMsgRequest) (*types.QueryPoolBatchDepositMsgResponse, error)
- func (k Querier) PoolBatchDepositMsgs(c context.Context, req *types.QueryPoolBatchDepositMsgsRequest) (*types.QueryPoolBatchDepositMsgsResponse, error)
- func (k Querier) PoolBatchSwapMsg(c context.Context, req *types.QueryPoolBatchSwapMsgRequest) (*types.QueryPoolBatchSwapMsgResponse, error)
- func (k Querier) PoolBatchSwapMsgs(c context.Context, req *types.QueryPoolBatchSwapMsgsRequest) (*types.QueryPoolBatchSwapMsgsResponse, error)
- func (k Querier) PoolBatchWithdrawMsg(c context.Context, req *types.QueryPoolBatchWithdrawMsgRequest) (*types.QueryPoolBatchWithdrawMsgResponse, error)
- func (k Querier) PoolBatchWithdrawMsgs(c context.Context, req *types.QueryPoolBatchWithdrawMsgsRequest) (*types.QueryPoolBatchWithdrawMsgsResponse, error)
Constants ¶
This section is empty.
Variables ¶
var (
BatchLogicInvariantCheckFlag = false // It is only used at the development stage, and is disabled at the product level.
)
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the liquidity module.
func BurningPoolCoinsInvariant ¶
func BurningPoolCoinsInvariant(burnedPoolCoin, withdrawCoinA, withdrawCoinB, reserveCoinA, reserveCoinB, lastPoolCoinSupply sdk.Int, withdrawFeeCoins sdk.Coins)
BurningPoolCoinsInvariant checks the correct burning amount of pool coins.
func DepositInvariant ¶
func DepositInvariant(lastReserveCoinA, lastReserveCoinB, depositCoinA, depositCoinB, afterReserveCoinA, afterReserveCoinB, refundedCoinA, refundedCoinB sdk.Int)
DepositInvariant checks after deposit amounts.
func ImmutablePoolPriceAfterWithdrawInvariant ¶
func ImmutablePoolPriceAfterWithdrawInvariant(reserveCoinA, reserveCoinB, withdrawCoinA, withdrawCoinB, afterReserveCoinA, afterReserveCoinB sdk.Int)
ImmutablePoolPriceAfterWithdrawInvariant checks the immutable pool price after withdrawing coins.
func LiquidityPoolsEscrowAmountInvariant ¶
LiquidityPoolsEscrowAmountInvariant checks that outstanding unwithdrawn fees are never negative.
func MintingPoolCoinsInvariant ¶
func MintingPoolCoinsInvariant(poolCoinTotalSupply, mintPoolCoin, depositCoinA, depositCoinB, lastReserveCoinA, lastReserveCoinB, refundedCoinA, refundedCoinB sdk.Int)
MintingPoolCoinsInvariant checks the correct ratio of minting amount of pool coins.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the distribution MsgServer interface for the provided Keeper.
func NewQuerier ¶
func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
NewQuerier creates a querier for liquidity REST endpoints
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all liquidity invariants.
func WithdrawAmountInvariant ¶
func WithdrawAmountInvariant(withdrawCoinA, withdrawCoinB, reserveCoinA, reserveCoinB, burnedPoolCoin, poolCoinSupply sdk.Int, withdrawFeeRate sdk.Dec)
WithdrawAmountInvariant checks the correct ratio of withdraw coin amounts.
func WithdrawReserveCoinsInvariant ¶
func WithdrawReserveCoinsInvariant(withdrawCoinA, withdrawCoinB, reserveCoinA, reserveCoinB, afterReserveCoinA, afterReserveCoinB, afterPoolCoinTotalSupply, lastPoolCoinSupply, burnedPoolCoin sdk.Int)
WithdrawReserveCoinsInvariant checks the after withdraw amounts.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the liquidity store
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramstypes.Subspace, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, distrKeeper types.DistributionKeeper) Keeper
NewKeeper returns a liquidity keeper. It handles: - creating new ModuleAccounts for each pool ReserveAccount - sending to and from ModuleAccounts - minting, burning PoolCoins
func (Keeper) CreatePool ¶
func (Keeper) DeleteAllReadyPoolBatchDepositMsgStates ¶
delete deposit batch msgs of the liquidity pool batch which has state ToBeDeleted
func (Keeper) DeleteAllReadyPoolBatchSwapMsgStates ¶
delete swap batch msgs of the liquidity pool batch which has state ToBeDeleted
func (Keeper) DeleteAllReadyPoolBatchWithdrawMsgStates ¶
func (k Keeper) DeleteAllReadyPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch)
delete withdraw batch msgs of the liquidity pool batch which has state ToBeDeleted
func (Keeper) DeleteAndInitPoolBatches ¶
DeleteAndInitPoolBatches resets batch msg states that were previously executed and deletes msg states that were marked to be deleted.
func (Keeper) DeletePool ¶
delete from kvstore a specific liquidityPool
func (Keeper) DeletePoolBatch ¶
DeletePoolBatch deletes batch of the pool, it used for test case
func (Keeper) DeletePoolBatchSwapMsgState ¶
Delete swap batch msg of the liquidity pool batch, it used for test case
func (Keeper) DepositWithinBatch ¶
func (k Keeper) DepositWithinBatch(ctx sdk.Context, msg *types.MsgDepositWithinBatch) (types.DepositMsgState, error)
In order to deal with the batch at the same time, the coins of msgs are deposited in escrow.
func (Keeper) ExecuteDeposit ¶
func (Keeper) ExecutePoolBatches ¶
ExecutePoolBatches executes the accumulated msgs in the batch. The order is (1)swap, (2)deposit, (3)withdraw.
func (Keeper) ExecuteWithdrawal ¶
func (k Keeper) ExecuteWithdrawal(ctx sdk.Context, msg types.WithdrawMsgState, batch types.PoolBatch) error
ExecuteWithdrawal withdraws pool coin from the liquidity pool
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the liquidity module's genesis state.
func (Keeper) GetAllDepositMsgStates ¶
func (k Keeper) GetAllDepositMsgStates(ctx sdk.Context) (states []types.DepositMsgState)
GetAllDepositMsgStates returns all BatchDepositMsgs for all batches.
func (Keeper) GetAllNotProcessedPoolBatchSwapMsgStates ¶
func (k Keeper) GetAllNotProcessedPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.SwapMsgState)
GetAllNotProcessedPoolBatchSwapMsgStates returns All only not processed swap msgs, not executed with not succeed and not toDelete BatchSwapMsgs indexed by the liquidityPoolBatch
func (Keeper) GetAllPoolBatchDepositMsgStatesNotToBeDeleted ¶
func (k Keeper) GetAllPoolBatchDepositMsgStatesNotToBeDeleted(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.DepositMsgState)
GetAllPoolBatchDepositMsgStatesNotToBeDeleted returns all Not toDelete BatchDepositMsgs indexed by the liquidityPoolBatch
func (Keeper) GetAllPoolBatchDepositMsgs ¶
func (k Keeper) GetAllPoolBatchDepositMsgs(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.DepositMsgState)
GetAllPoolBatchDepositMsgs returns all BatchDepositMsgs indexed by the pool batch
func (Keeper) GetAllPoolBatchSwapMsgStates ¶
func (k Keeper) GetAllPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.SwapMsgState)
GetAllPoolBatchSwapMsgStates returns all BatchSwapMsgs indexed by the liquidityPoolBatch
func (Keeper) GetAllPoolBatchSwapMsgStatesAsPointer ¶
func (k Keeper) GetAllPoolBatchSwapMsgStatesAsPointer(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.SwapMsgState)
GetAllPoolBatchSwapMsgStatesAsPointer returns all BatchSwapMsgs pointer indexed by the liquidityPoolBatch
func (Keeper) GetAllPoolBatchSwapMsgStatesNotToBeDeleted ¶
func (k Keeper) GetAllPoolBatchSwapMsgStatesNotToBeDeleted(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.SwapMsgState)
GetAllPoolBatchSwapMsgStatesNotToBeDeleted returns All only not to delete swap msgs
func (Keeper) GetAllPoolBatchWithdrawMsgStates ¶
func (k Keeper) GetAllPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.WithdrawMsgState)
GetAllPoolBatchWithdrawMsgStates returns all BatchWithdrawMsgs indexed by the liquidityPoolBatch
func (Keeper) GetAllPoolBatchWithdrawMsgStatesNotToBeDeleted ¶
func (k Keeper) GetAllPoolBatchWithdrawMsgStatesNotToBeDeleted(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.WithdrawMsgState)
GetAllPoolBatchWithdrawMsgStatesNotToBeDeleted returns all Not to delete BatchWithdrawMsgs indexed by the liquidityPoolBatch
func (Keeper) GetAllPoolBatches ¶
GetAllPoolBatches returns all batches of the all existed liquidity pools
func (Keeper) GetAllPools ¶
GetAllPools returns all liquidityPools used during genesis dump
func (Keeper) GetAllRemainingPoolBatchDepositMsgStates ¶
func (k Keeper) GetAllRemainingPoolBatchDepositMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.DepositMsgState)
GetAllRemainingPoolBatchDepositMsgStates returns all remaining DepositMsgStates after endblock, which are executed but not to be deleted
func (Keeper) GetAllRemainingPoolBatchSwapMsgStates ¶
func (k Keeper) GetAllRemainingPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.SwapMsgState)
GetAllRemainingPoolBatchSwapMsgStates returns All only remaining after endblock swap msgs, executed but not toDelete
func (Keeper) GetAllRemainingPoolBatchWithdrawMsgStates ¶
func (k Keeper) GetAllRemainingPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []*types.WithdrawMsgState)
GetAllRemainingPoolBatchWithdrawMsgStates returns All only remaining BatchWithdrawMsgs after endblock, executed but not toDelete
func (Keeper) GetAllSwapMsgStates ¶
func (k Keeper) GetAllSwapMsgStates(ctx sdk.Context) (states []types.SwapMsgState)
GetAllSwapMsgStates returns all BatchSwapMsgs of all batches
func (Keeper) GetAllWithdrawMsgStates ¶
func (k Keeper) GetAllWithdrawMsgStates(ctx sdk.Context) (states []types.WithdrawMsgState)
GetAllWithdrawMsgStates returns all BatchWithdrawMsgs for all batches
func (Keeper) GetCircuitBreakerEnabled ¶
GetCircuitBreakerEnabled returns circuit breaker enabled param from the paramspace.
func (Keeper) GetNextPoolID ¶
GetNextPoolID returns next pool id for new pool, using index of latest pool id
func (Keeper) GetNextPoolIDWithUpdate ¶
GetNextPoolIDWithUpdate returns and increments the global Pool ID counter. If the global account number is not set, it initializes it with value 0.
func (Keeper) GetPoolBatch ¶
func (k Keeper) GetPoolBatch(ctx sdk.Context, poolID uint64) (poolBatch types.PoolBatch, found bool)
GetPoolBatch returns a specific pool batch
func (Keeper) GetPoolBatchDepositMsgState ¶
func (k Keeper) GetPoolBatchDepositMsgState(ctx sdk.Context, poolID, msgIndex uint64) (state types.DepositMsgState, found bool)
GetPoolBatchDepositMsgState returns a specific DepositMsgState
func (Keeper) GetPoolBatchSwapMsgState ¶
func (k Keeper) GetPoolBatchSwapMsgState(ctx sdk.Context, poolID, msgIndex uint64) (state types.SwapMsgState, found bool)
return a specific SwapMsgState given the pool_id with the msg_index
func (Keeper) GetPoolBatchWithdrawMsgState ¶
func (k Keeper) GetPoolBatchWithdrawMsgState(ctx sdk.Context, poolID, msgIndex uint64) (state types.WithdrawMsgState, found bool)
return a specific liquidityPoolBatchWithdrawMsg
func (Keeper) GetPoolByReserveAccIndex ¶
func (k Keeper) GetPoolByReserveAccIndex(ctx sdk.Context, reserveAcc sdk.AccAddress) (pool types.Pool, found bool)
GetPoolByReserveAccIndex reads from kvstore and return a specific liquidityPool indexed by given reserve account
func (Keeper) GetPoolCoinTotal ¶
GetPoolCoinTotal returns total supply of pool coin of the pool in form of sdk.Coin
func (Keeper) GetPoolCoinTotalSupply ¶
GetPoolCoinTotalSupply returns total supply of pool coin of the pool in form of sdk.Int
func (Keeper) GetPoolMetaData ¶
GetPoolMetaData returns metadata of the pool
func (Keeper) GetPoolRecord ¶
GetPoolRecord returns the liquidity pool record with the given pool information
func (Keeper) GetReserveCoins ¶
GetReserveCoins returns reserve coins from the liquidity pool
func (Keeper) HoldEscrow ¶
HoldEscrow sends coins to the module account for an escrow.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
InitGenesis initializes the liquidity module's state from a given genesis state.
func (Keeper) InitNextPoolBatch ¶
InitNextPoolBatch re-initializes the batch and increases the batch index.
func (Keeper) IsDepletedPool ¶
IsDepletedPool returns true if the pool is depleted.
func (Keeper) IsPoolCoinDenom ¶
IsPoolCoinDenom returns true if the denom is a valid pool coin denom.
func (Keeper) IterateAllDepositMsgStates ¶
func (k Keeper) IterateAllDepositMsgStates(ctx sdk.Context, cb func(state types.DepositMsgState) (stop bool))
IterateAllDepositMsgStates iterate through all of the DepositMsgState of all batches
func (Keeper) IterateAllPoolBatchDepositMsgStates ¶
func (k Keeper) IterateAllPoolBatchDepositMsgStates(ctx sdk.Context, poolBatch types.PoolBatch, cb func(state types.DepositMsgState) (stop bool))
IterateAllPoolBatchDepositMsgStates iterate through all of the DepositMsgStates in the batch
func (Keeper) IterateAllPoolBatchSwapMsgStates ¶
func (k Keeper) IterateAllPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch, cb func(state types.SwapMsgState) (stop bool))
IterateAllPoolBatchSwapMsgStates iterate through all of the LiquidityPoolBatchSwapMsgs
func (Keeper) IterateAllPoolBatchWithdrawMsgStates ¶
func (k Keeper) IterateAllPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch, cb func(state types.WithdrawMsgState) (stop bool))
IterateAllPoolBatchWithdrawMsgStates iterate through all of the LiquidityPoolBatchWithdrawMsgs
func (Keeper) IterateAllPoolBatches ¶
func (k Keeper) IterateAllPoolBatches(ctx sdk.Context, cb func(poolBatch types.PoolBatch) (stop bool))
IterateAllPoolBatches iterate through all of the pool batches
func (Keeper) IterateAllPools ¶
IterateAllPools iterate through all of the liquidityPools
func (Keeper) IterateAllSwapMsgStates ¶
func (k Keeper) IterateAllSwapMsgStates(ctx sdk.Context, cb func(state types.SwapMsgState) (stop bool))
IterateAllSwapMsgStates iterate through all of the SwapMsgState of all batches
func (Keeper) IterateAllWithdrawMsgStates ¶
func (k Keeper) IterateAllWithdrawMsgStates(ctx sdk.Context, cb func(state types.WithdrawMsgState) (stop bool))
IterateAllWithdrawMsgStates iterate through all of the WithdrawMsgState of all batches
func (Keeper) MintAndSendPoolCoin ¶
func (Keeper) RefundDeposit ¶
func (k Keeper) RefundDeposit(ctx sdk.Context, batchMsg types.DepositMsgState, batch types.PoolBatch) error
RefundDeposit refunds deposit amounts to the depositor
func (Keeper) RefundWithdrawal ¶
func (k Keeper) RefundWithdrawal(ctx sdk.Context, batchMsg types.WithdrawMsgState, batch types.PoolBatch) error
RefundWithdrawal refunds pool coin of the liquidity pool to the withdrawer
func (Keeper) ReleaseEscrow ¶
func (k Keeper) ReleaseEscrow(ctx sdk.Context, withdrawer sdk.AccAddress, withdrawCoins sdk.Coins) error
If batch messages have expired or have not been processed, coins that were deposited with this function are refunded to the escrow.
func (Keeper) ReleaseEscrowForMultiSend ¶
func (k Keeper) ReleaseEscrowForMultiSend(withdrawer sdk.AccAddress, withdrawCoins sdk.Coins) ( banktypes.Input, banktypes.Output, error)
Generate inputs and outputs to treat escrow refunds atomically.
func (Keeper) SetPoolAtomic ¶
SetPoolAtomic sets pool with set global pool id index +1 and index by reserveAcc
func (Keeper) SetPoolBatch ¶
SetPoolBatch sets batch of the pool, with current state
func (Keeper) SetPoolBatchDepositMsgState ¶
func (k Keeper) SetPoolBatchDepositMsgState(ctx sdk.Context, poolID uint64, state types.DepositMsgState)
SetPoolBatchDepositMsgState sets deposit msg state of the pool batch, with current state
func (Keeper) SetPoolBatchDepositMsgStates ¶
func (k Keeper) SetPoolBatchDepositMsgStates(ctx sdk.Context, poolID uint64, states []types.DepositMsgState)
SetPoolBatchDepositMsgStates sets deposit batch msgs of the pool batch, with current state
func (Keeper) SetPoolBatchDepositMsgStatesByPointer ¶
func (k Keeper) SetPoolBatchDepositMsgStatesByPointer(ctx sdk.Context, poolID uint64, states []*types.DepositMsgState)
SetPoolBatchDepositMsgStatesByPointer sets deposit batch msgs of the pool batch, with current state using pointers
func (Keeper) SetPoolBatchSwapMsgState ¶
set swap batch msg of the liquidity pool batch, with current state
func (Keeper) SetPoolBatchSwapMsgStates ¶
func (k Keeper) SetPoolBatchSwapMsgStates(ctx sdk.Context, poolID uint64, states []types.SwapMsgState)
set swap batch msgs of the liquidity pool batch, with current state
func (Keeper) SetPoolBatchSwapMsgStatesByPointer ¶
func (k Keeper) SetPoolBatchSwapMsgStatesByPointer(ctx sdk.Context, poolID uint64, states []*types.SwapMsgState)
set swap batch msgs of the liquidity pool batch, with current state using pointers
func (Keeper) SetPoolBatchWithdrawMsgState ¶
func (k Keeper) SetPoolBatchWithdrawMsgState(ctx sdk.Context, poolID uint64, state types.WithdrawMsgState)
set withdraw batch msg of the liquidity pool batch, with current state
func (Keeper) SetPoolBatchWithdrawMsgStates ¶
func (k Keeper) SetPoolBatchWithdrawMsgStates(ctx sdk.Context, poolID uint64, states []types.WithdrawMsgState)
set withdraw batch msgs of the pool batch, with current state
func (Keeper) SetPoolBatchWithdrawMsgStatesByPointer ¶
func (k Keeper) SetPoolBatchWithdrawMsgStatesByPointer(ctx sdk.Context, poolID uint64, states []*types.WithdrawMsgState)
set withdraw batch msgs of the liquidity pool batch, with current state using pointers
func (Keeper) SetPoolByReserveAccIndex ¶
SetPoolByReserveAccIndex sets Index by ReserveAcc for pool duplication check
func (Keeper) SetPoolRecord ¶
func (k Keeper) SetPoolRecord(ctx sdk.Context, record types.PoolRecord) types.PoolRecord
SetPoolRecord stores liquidity pool states
func (Keeper) ValidateGenesis ¶
ValidateGenesis validates the liquidity module's genesis state.
func (Keeper) ValidateMsgCreatePool ¶
func (Keeper) ValidateMsgDepositWithinBatch ¶
func (k Keeper) ValidateMsgDepositWithinBatch(ctx sdk.Context, msg types.MsgDepositWithinBatch) error
ValidateMsgDepositWithinBatch validates MsgDepositWithinBatch
func (Keeper) ValidateMsgWithdrawWithinBatch ¶
func (k Keeper) ValidateMsgWithdrawWithinBatch(ctx sdk.Context, msg types.MsgWithdrawWithinBatch) error
ValidateMsgWithdrawWithinBatch validates MsgWithdrawWithinBatch
func (Keeper) ValidatePool ¶
ValidatePool validates logic for liquidity pool after set or before export
func (Keeper) ValidatePoolMetadata ¶
func (k Keeper) ValidatePoolMetadata(ctx sdk.Context, pool *types.Pool, metaData *types.PoolMetadata) error
ValidatePoolMetadata validates logic for liquidity pool metadata
func (Keeper) ValidatePoolRecord ¶
ValidatePoolRecord validates liquidity pool record after init or after export
func (Keeper) WithdrawWithinBatch ¶
func (k Keeper) WithdrawWithinBatch(ctx sdk.Context, msg *types.MsgWithdrawWithinBatch) (types.WithdrawMsgState, error)
In order to deal with the batch at the same time, the coins of msgs are deposited in escrow.
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
Migrator is a struct for handling in-place store migrations.
type Querier ¶
type Querier struct {
Keeper
}
Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper.
func (Querier) LiquidityPool ¶
func (k Querier) LiquidityPool(c context.Context, req *types.QueryLiquidityPoolRequest) (*types.QueryLiquidityPoolResponse, error)
LiquidityPool queries a liquidity pool with the given pool id.
func (Querier) LiquidityPoolBatch ¶
func (k Querier) LiquidityPoolBatch(c context.Context, req *types.QueryLiquidityPoolBatchRequest) (*types.QueryLiquidityPoolBatchResponse, error)
LiquidityPoolBatch queries a liquidity pool batch with the given pool id.
func (Querier) LiquidityPoolByPoolCoinDenom ¶
func (k Querier) LiquidityPoolByPoolCoinDenom(c context.Context, req *types.QueryLiquidityPoolByPoolCoinDenomRequest) (*types.QueryLiquidityPoolResponse, error)
LiquidityPool queries a liquidity pool with the given pool coin denom.
func (Querier) LiquidityPoolByReserveAcc ¶
func (k Querier) LiquidityPoolByReserveAcc(c context.Context, req *types.QueryLiquidityPoolByReserveAccRequest) (*types.QueryLiquidityPoolResponse, error)
LiquidityPool queries a liquidity pool with the given reserve account address.
func (Querier) LiquidityPools ¶
func (k Querier) LiquidityPools(c context.Context, req *types.QueryLiquidityPoolsRequest) (*types.QueryLiquidityPoolsResponse, error)
Pools queries all liquidity pools currently existed with each liquidity pool with batch and metadata.
func (Querier) MakeQueryLiquidityPoolResponse ¶
func (k Querier) MakeQueryLiquidityPoolResponse(pool types.Pool) (*types.QueryLiquidityPoolResponse, error)
MakeQueryLiquidityPoolResponse wraps MakeQueryLiquidityPoolResponse.
func (Querier) MakeQueryLiquidityPoolsResponse ¶
func (k Querier) MakeQueryLiquidityPoolsResponse(pools types.Pools) (*[]types.QueryLiquidityPoolResponse, error)
MakeQueryLiquidityPoolsResponse wraps a list of QueryLiquidityPoolResponses.
func (Querier) Params ¶
func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries params of liquidity module.
func (Querier) PoolBatchDepositMsg ¶
func (k Querier) PoolBatchDepositMsg(c context.Context, req *types.QueryPoolBatchDepositMsgRequest) (*types.QueryPoolBatchDepositMsgResponse, error)
PoolBatchDepositMsg queries the pool batch deposit message with the msg_index of the liquidity pool.
func (Querier) PoolBatchDepositMsgs ¶
func (k Querier) PoolBatchDepositMsgs(c context.Context, req *types.QueryPoolBatchDepositMsgsRequest) (*types.QueryPoolBatchDepositMsgsResponse, error)
PoolBatchDepositMsgs queries all pool batch deposit messages of the liquidity pool.
func (Querier) PoolBatchSwapMsg ¶
func (k Querier) PoolBatchSwapMsg(c context.Context, req *types.QueryPoolBatchSwapMsgRequest) (*types.QueryPoolBatchSwapMsgResponse, error)
PoolBatchSwapMsg queries the pool batch swap message with the message index of the liquidity pool.
func (Querier) PoolBatchSwapMsgs ¶
func (k Querier) PoolBatchSwapMsgs(c context.Context, req *types.QueryPoolBatchSwapMsgsRequest) (*types.QueryPoolBatchSwapMsgsResponse, error)
PoolBatchSwapMsgs queries all pool batch swap messages of the liquidity pool.
func (Querier) PoolBatchWithdrawMsg ¶
func (k Querier) PoolBatchWithdrawMsg(c context.Context, req *types.QueryPoolBatchWithdrawMsgRequest) (*types.QueryPoolBatchWithdrawMsgResponse, error)
PoolBatchWithdrawMsg queries the pool batch withdraw message with the msg_index of the liquidity pool.
func (Querier) PoolBatchWithdrawMsgs ¶
func (k Querier) PoolBatchWithdrawMsgs(c context.Context, req *types.QueryPoolBatchWithdrawMsgsRequest) (*types.QueryPoolBatchWithdrawMsgsResponse, error)
PoolBatchWithdrawMsgs queries all pool batch withdraw messages of the liquidity pool.