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 SwapMatchingInvariants(xToY, yToX []*types.SwapMsgState, ...)
- func SwapMsgStatesInvariants(matchResultXtoY, matchResultYtoX []types.MatchResult, ...)
- func SwapOrdersExecutionStateInvariants(matchResultMap map[uint64]types.MatchResult, ...)
- func SwapPriceDirectionInvariants(currentPoolPrice sdk.Dec, batchResult types.BatchResult)
- func SwapPriceInvariants(matchResultXtoY, matchResultYtoX []types.MatchResult, ...)
- 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) GetNextPoolBatchIndexWithUpdate(ctx sdk.Context, poolID uint64) (batchIndex uint64)
- 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) GetPoolBatchIndex(ctx sdk.Context, poolID uint64) uint64
- 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) RefundSwaps(ctx sdk.Context, pool types.Pool, swapMsgStates []*types.SwapMsgState) 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) SetPoolBatchIndex(ctx sdk.Context, poolID, batchIndex uint64)
- 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) SwapExecution(ctx sdk.Context, poolBatch types.PoolBatch) (uint64, error)
- func (k Keeper) SwapWithinBatch(ctx sdk.Context, msg *types.MsgSwapWithinBatch, orderExpirySpanHeight int64) (*types.SwapMsgState, error)
- func (k Keeper) TransactAndRefundSwapLiquidityPool(ctx sdk.Context, swapMsgStates []*types.SwapMsgState, ...) error
- 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) ValidateMsgSwapWithinBatch(ctx sdk.Context, msg types.MsgSwapWithinBatch) 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 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 ¶ added in v1.2.1
func BurningPoolCoinsInvariant(burnedPoolCoin, withdrawCoinA, withdrawCoinB, reserveCoinA, reserveCoinB, lastPoolCoinSupply sdk.Int, withdrawFeeCoins sdk.Coins)
BurningPoolCoinsInvariant checks the correct burning amount of pool coins.
func DepositInvariant ¶ added in v1.2.6
func DepositInvariant(lastReserveCoinA, lastReserveCoinB, depositCoinA, depositCoinB, afterReserveCoinA, afterReserveCoinB, refundedCoinA, refundedCoinB sdk.Int)
DepositInvariant checks after deposit amounts.
func ImmutablePoolPriceAfterWithdrawInvariant ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 SwapMatchingInvariants ¶ added in v1.2.3
func SwapMatchingInvariants(xToY, yToX []*types.SwapMsgState, matchResultXtoY, matchResultYtoX []types.MatchResult)
SwapMatchingInvariants checks swap matching results of both X to Y and Y to X cases.
func SwapMsgStatesInvariants ¶ added in v1.2.3
func SwapMsgStatesInvariants(matchResultXtoY, matchResultYtoX []types.MatchResult, matchResultMap map[uint64]types.MatchResult, swapMsgStates []*types.SwapMsgState, xToY, yToX []*types.SwapMsgState)
SwapMsgStatesInvariants checks swap match result states invariants.
func SwapOrdersExecutionStateInvariants ¶ added in v1.2.3
func SwapOrdersExecutionStateInvariants(matchResultMap map[uint64]types.MatchResult, swapMsgStates []*types.SwapMsgState, batchResult types.BatchResult, denomX string)
SwapOrdersExecutionStateInvariants checks all executed orders have order price which is not "executable" or not "unexecutable".
func SwapPriceDirectionInvariants ¶ added in v1.2.6
func SwapPriceDirectionInvariants(currentPoolPrice sdk.Dec, batchResult types.BatchResult)
SwapPriceDirectionInvariants checks whether the calculated swap price is increased, decreased, or stayed from the last pool price.
func SwapPriceInvariants ¶ added in v1.2.1
func SwapPriceInvariants(matchResultXtoY, matchResultYtoX []types.MatchResult, poolXDelta, poolYDelta, poolXDelta2, poolYDelta2 sdk.Dec, result types.BatchResult)
SwapPriceInvariants checks swap price invariants.
func WithdrawAmountInvariant ¶ added in v1.2.5
func WithdrawAmountInvariant(withdrawCoinA, withdrawCoinB, reserveCoinA, reserveCoinB, burnedPoolCoin, poolCoinSupply sdk.Int, withdrawFeeRate sdk.Dec)
WithdrawAmountInvariant checks the correct ratio of withdraw coin amounts.
func WithdrawReserveCoinsInvariant ¶ added in v1.2.1
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.Marshaler, key sdk.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 ¶ added in v1.2.1
func (Keeper) DeleteAllReadyPoolBatchDepositMsgStates ¶ added in v1.2.1
delete deposit batch msgs of the liquidity pool batch which has state ToBeDeleted
func (Keeper) DeleteAllReadyPoolBatchSwapMsgStates ¶ added in v1.2.1
delete swap batch msgs of the liquidity pool batch which has state ToBeDeleted
func (Keeper) DeleteAllReadyPoolBatchWithdrawMsgStates ¶ added in v1.2.1
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 ¶ added in v1.2.6
DeleteAndInitPoolBatches resets batch msg states that were previously executed and deletes msg states that were marked to be deleted.
func (Keeper) DeletePool ¶ added in v1.2.1
delete from kvstore a specific liquidityPool
func (Keeper) DeletePoolBatch ¶ added in v1.2.1
DeletePoolBatch deletes batch of the pool, it used for test case
func (Keeper) DeletePoolBatchSwapMsgState ¶ added in v1.2.1
Delete swap batch msg of the liquidity pool batch, it used for test case
func (Keeper) DepositWithinBatch ¶ added in v1.2.6
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 ¶ added in v1.2.6
func (Keeper) ExecutePoolBatches ¶ added in v1.2.6
ExecutePoolBatches executes the accumulated msgs in the batch. The order is (1)swap, (2)deposit, (3)withdraw.
func (Keeper) ExecuteWithdrawal ¶ added in v1.2.6
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 ¶ added in v1.2.1
func (k Keeper) GetAllDepositMsgStates(ctx sdk.Context) (states []types.DepositMsgState)
GetAllDepositMsgStates returns all BatchDepositMsgs for all batches.
func (Keeper) GetAllNotProcessedPoolBatchSwapMsgStates ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
func (k Keeper) GetAllPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.SwapMsgState)
GetAllPoolBatchSwapMsgStates returns all BatchSwapMsgs indexed by the liquidityPoolBatch
func (Keeper) GetAllPoolBatchSwapMsgStatesAsPointer ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
func (k Keeper) GetAllPoolBatchWithdrawMsgStates(ctx sdk.Context, poolBatch types.PoolBatch) (states []types.WithdrawMsgState)
GetAllPoolBatchWithdrawMsgStates returns all BatchWithdrawMsgs indexed by the liquidityPoolBatch
func (Keeper) GetAllPoolBatchWithdrawMsgStatesNotToBeDeleted ¶ added in v1.2.1
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 ¶ added in v1.2.1
GetAllPoolBatches returns all batches of the all existed liquidity pools
func (Keeper) GetAllPools ¶ added in v1.2.1
GetAllPools returns all liquidityPools used during genesis dump
func (Keeper) GetAllRemainingPoolBatchDepositMsgStates ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
func (k Keeper) GetAllSwapMsgStates(ctx sdk.Context) (states []types.SwapMsgState)
GetAllSwapMsgStates returns all BatchSwapMsgs of all batches
func (Keeper) GetAllWithdrawMsgStates ¶ added in v1.2.1
func (k Keeper) GetAllWithdrawMsgStates(ctx sdk.Context) (states []types.WithdrawMsgState)
GetAllWithdrawMsgStates returns all BatchWithdrawMsgs for all batches
func (Keeper) GetCircuitBreakerEnabled ¶ added in v1.2.6
GetCircuitBreakerEnabled returns circuit breaker enabled param from the paramspace.
func (Keeper) GetNextPoolBatchIndexWithUpdate ¶ added in v1.2.1
GetNextPoolBatchIndexWithUpdate returns next batch index, with set index increased
func (Keeper) GetNextPoolID ¶ added in v1.2.6
GetNextPoolID returns next pool id for new pool, using index of latest pool id
func (Keeper) GetNextPoolIDWithUpdate ¶ added in v1.2.6
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 ¶ added in v1.2.1
func (k Keeper) GetPoolBatch(ctx sdk.Context, poolID uint64) (poolBatch types.PoolBatch, found bool)
GetPoolBatch returns a specific pool batch
func (Keeper) GetPoolBatchDepositMsgState ¶ added in v1.2.1
func (k Keeper) GetPoolBatchDepositMsgState(ctx sdk.Context, poolID, msgIndex uint64) (state types.DepositMsgState, found bool)
GetPoolBatchDepositMsgState returns a specific DepositMsgState
func (Keeper) GetPoolBatchIndex ¶ added in v1.2.1
GetPoolBatchIndex returns the pool's latest batch index
func (Keeper) GetPoolBatchSwapMsgState ¶ added in v1.2.1
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 ¶ added in v1.2.1
func (k Keeper) GetPoolBatchWithdrawMsgState(ctx sdk.Context, poolID, msgIndex uint64) (state types.WithdrawMsgState, found bool)
return a specific liquidityPoolBatchWithdrawMsg
func (Keeper) GetPoolByReserveAccIndex ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.6
InitNextPoolBatch re-initializes the batch and increases the batch index.
func (Keeper) IsDepletedPool ¶ added in v1.2.6
IsDepletedPool returns true if the pool is depleted.
func (Keeper) IsPoolCoinDenom ¶ added in v1.2.2
IsPoolCoinDenom returns true if the denom is a valid pool coin denom.
func (Keeper) IterateAllDepositMsgStates ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
IterateAllPools iterate through all of the liquidityPools
func (Keeper) IterateAllSwapMsgStates ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.6
func (Keeper) RefundDeposit ¶ added in v1.2.6
func (k Keeper) RefundDeposit(ctx sdk.Context, batchMsg types.DepositMsgState, batch types.PoolBatch) error
RefundDeposit refunds deposit amounts to the depositor
func (Keeper) RefundSwaps ¶ added in v1.2.3
func (Keeper) RefundWithdrawal ¶ added in v1.2.6
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 ¶ added in v1.2.1
SetPoolAtomic sets pool with set global pool id index +1 and index by reserveAcc
func (Keeper) SetPoolBatch ¶ added in v1.2.1
SetPoolBatch sets batch of the pool, with current state
func (Keeper) SetPoolBatchDepositMsgState ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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) SetPoolBatchIndex ¶ added in v1.2.1
SetPoolBatchIndex sets index for pool batch, it should be increase after batch executed
func (Keeper) SetPoolBatchSwapMsgState ¶ added in v1.2.1
set swap batch msg of the liquidity pool batch, with current state
func (Keeper) SetPoolBatchSwapMsgStates ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
SetPoolByReserveAccIndex sets Index by ReserveAcc for pool duplication check
func (Keeper) SetPoolRecord ¶ added in v1.2.1
func (k Keeper) SetPoolRecord(ctx sdk.Context, record types.PoolRecord) types.PoolRecord
SetPoolRecord stores liquidity pool states
func (Keeper) SwapExecution ¶
Execute Swap of the pool batch, Collect swap messages in batch for transact the same price for each batch and run them on endblock.
func (Keeper) SwapWithinBatch ¶ added in v1.2.6
func (k Keeper) SwapWithinBatch(ctx sdk.Context, msg *types.MsgSwapWithinBatch, orderExpirySpanHeight int64) (*types.SwapMsgState, error)
In order to deal with the batch at the same time, the coins of msgs are deposited in escrow.
func (Keeper) TransactAndRefundSwapLiquidityPool ¶
func (k Keeper) TransactAndRefundSwapLiquidityPool(ctx sdk.Context, swapMsgStates []*types.SwapMsgState, matchResultMap map[uint64]types.MatchResult, pool types.Pool, batchResult types.BatchResult) error
TransactAndRefundSwapLiquidityPool transacts, refunds, expires, sends coins with escrow, update state by TransactAndRefundSwapLiquidityPool
func (Keeper) ValidateGenesis ¶
ValidateGenesis validates the liquidity module's genesis state.
func (Keeper) ValidateMsgCreatePool ¶ added in v1.2.1
func (Keeper) ValidateMsgDepositWithinBatch ¶ added in v1.2.6
func (k Keeper) ValidateMsgDepositWithinBatch(ctx sdk.Context, msg types.MsgDepositWithinBatch) error
ValidateMsgDepositWithinBatch validates MsgDepositWithinBatch
func (Keeper) ValidateMsgSwapWithinBatch ¶ added in v1.2.1
ValidateMsgSwapWithinBatch validates MsgSwapWithinBatch.
func (Keeper) ValidateMsgWithdrawWithinBatch ¶ added in v1.2.6
func (k Keeper) ValidateMsgWithdrawWithinBatch(ctx sdk.Context, msg types.MsgWithdrawWithinBatch) error
ValidateMsgWithdrawWithinBatch validates MsgWithdrawWithinBatch
func (Keeper) ValidatePool ¶ added in v1.2.1
ValidatePool validates logic for liquidity pool after set or before export
func (Keeper) ValidatePoolMetadata ¶ added in v1.2.1
func (k Keeper) ValidatePoolMetadata(ctx sdk.Context, pool *types.Pool, metaData *types.PoolMetadata) error
ValidatePoolMetadata validates logic for liquidity pool metadata
func (Keeper) ValidatePoolRecord ¶ added in v1.2.1
ValidatePoolRecord validates liquidity pool record after init or after export
func (Keeper) WithdrawWithinBatch ¶ added in v1.2.6
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 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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.6
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 ¶ added in v1.2.6
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
func (k Querier) MakeQueryLiquidityPoolResponse(pool types.Pool) (*types.QueryLiquidityPoolResponse, error)
MakeQueryLiquidityPoolResponse wraps MakeQueryLiquidityPoolResponse.
func (Querier) MakeQueryLiquidityPoolsResponse ¶ added in v1.2.1
func (k Querier) MakeQueryLiquidityPoolsResponse(pools types.Pools) (*[]types.QueryLiquidityPoolResponse, error)
MakeQueryLiquidityPoolsResponse wraps a list of QueryLiquidityPoolResponses.
func (Querier) Params ¶ added in v1.2.1
func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries params of liquidity module.
func (Querier) PoolBatchDepositMsg ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
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 ¶ added in v1.2.1
func (k Querier) PoolBatchWithdrawMsgs(c context.Context, req *types.QueryPoolBatchWithdrawMsgsRequest) (*types.QueryPoolBatchWithdrawMsgsResponse, error)
PoolBatchWithdrawMsgs queries all pool batch withdraw messages of the liquidity pool.