keeper

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 17 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BatchLogicInvariantCheckFlag = false // It is only used at the development stage, and is disabled at the product level.

)

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

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

func LiquidityPoolsEscrowAmountInvariant(k Keeper) sdk.Invariant

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

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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.BinaryCodec, 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 (k Keeper) CreatePool(ctx sdk.Context, msg *types.MsgCreatePool) (types.Pool, error)

func (Keeper) DeleteAllReadyPoolBatchDepositMsgStates added in v1.2.1

func (k Keeper) DeleteAllReadyPoolBatchDepositMsgStates(ctx sdk.Context, poolBatch types.PoolBatch)

delete deposit batch msgs of the liquidity pool batch which has state ToBeDeleted

func (Keeper) DeleteAllReadyPoolBatchSwapMsgStates added in v1.2.1

func (k Keeper) DeleteAllReadyPoolBatchSwapMsgStates(ctx sdk.Context, poolBatch types.PoolBatch)

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

func (k Keeper) DeleteAndInitPoolBatches(ctx sdk.Context)

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

func (k Keeper) DeletePool(ctx sdk.Context, pool types.Pool)

delete from kvstore a specific liquidityPool

func (Keeper) DeletePoolBatch added in v1.2.1

func (k Keeper) DeletePoolBatch(ctx sdk.Context, poolBatch types.PoolBatch)

DeletePoolBatch deletes batch of the pool, it used for test case

func (Keeper) DeletePoolBatchSwapMsgState added in v1.2.1

func (k Keeper) DeletePoolBatchSwapMsgState(ctx sdk.Context, poolID uint64, msgIndex uint64)

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 (k Keeper) ExecuteDeposit(ctx sdk.Context, msg types.DepositMsgState, batch types.PoolBatch) error

func (Keeper) ExecutePoolBatches added in v1.2.6

func (k Keeper) ExecutePoolBatches(ctx sdk.Context)

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

func (k Keeper) GetAllPoolBatches(ctx sdk.Context) (poolBatches []types.PoolBatch)

GetAllPoolBatches returns all batches of the all existed liquidity pools

func (Keeper) GetAllPools added in v1.2.1

func (k Keeper) GetAllPools(ctx sdk.Context) (pools []types.Pool)

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

func (k Keeper) GetCircuitBreakerEnabled(ctx sdk.Context) (enabled bool)

GetCircuitBreakerEnabled returns circuit breaker enabled param from the paramspace.

func (Keeper) GetNextPoolID added in v1.2.6

func (k Keeper) GetNextPoolID(ctx sdk.Context) uint64

GetNextPoolID returns next pool id for new pool, using index of latest pool id

func (Keeper) GetNextPoolIDWithUpdate added in v1.2.6

func (k Keeper) GetNextPoolIDWithUpdate(ctx sdk.Context) uint64

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) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams gets the parameters for the liquidity module.

func (Keeper) GetPool added in v1.2.1

func (k Keeper) GetPool(ctx sdk.Context, poolID uint64) (pool types.Pool, found bool)

GetPool reads from kvstore and returns a specific pool

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) 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

func (k Keeper) GetPoolCoinTotal(ctx sdk.Context, pool types.Pool) sdk.Coin

GetPoolCoinTotal returns total supply of pool coin of the pool in form of sdk.Coin

func (Keeper) GetPoolCoinTotalSupply

func (k Keeper) GetPoolCoinTotalSupply(ctx sdk.Context, pool types.Pool) sdk.Int

GetPoolCoinTotalSupply returns total supply of pool coin of the pool in form of sdk.Int

func (Keeper) GetPoolMetaData

func (k Keeper) GetPoolMetaData(ctx sdk.Context, pool types.Pool) types.PoolMetadata

GetPoolMetaData returns metadata of the pool

func (Keeper) GetPoolRecord added in v1.2.1

func (k Keeper) GetPoolRecord(ctx sdk.Context, pool types.Pool) (types.PoolRecord, bool)

GetPoolRecord returns the liquidity pool record with the given pool information

func (Keeper) GetReserveCoins

func (k Keeper) GetReserveCoins(ctx sdk.Context, pool types.Pool) (reserveCoins sdk.Coins)

GetReserveCoins returns reserve coins from the liquidity pool

func (Keeper) HoldEscrow

func (k Keeper) HoldEscrow(ctx sdk.Context, depositor sdk.AccAddress, depositCoins sdk.Coins) error

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

func (k Keeper) InitNextPoolBatch(ctx sdk.Context, poolBatch types.PoolBatch) error

InitNextPoolBatch re-initializes the batch and increases the batch index.

func (Keeper) IsDepletedPool added in v1.2.6

func (k Keeper) IsDepletedPool(ctx sdk.Context, pool types.Pool) bool

IsDepletedPool returns true if the pool is depleted.

func (Keeper) IsPoolCoinDenom added in v1.2.2

func (k Keeper) IsPoolCoinDenom(ctx sdk.Context, denom string) bool

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

func (k Keeper) IterateAllPools(ctx sdk.Context, cb func(pool types.Pool) (stop bool))

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) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MintAndSendPoolCoin added in v1.2.6

func (k Keeper) MintAndSendPoolCoin(ctx sdk.Context, pool types.Pool, srcAddr, creatorAddr sdk.AccAddress, depositCoins sdk.Coins) (sdk.Coin, error)

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 (k Keeper) RefundSwaps(ctx sdk.Context, pool types.Pool, swapMsgStates []*types.SwapMsgState) error

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) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the parameters for the liquidity module.

func (Keeper) SetPool added in v1.2.1

func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)

SetPool sets to kvstore a specific pool

func (Keeper) SetPoolAtomic added in v1.2.1

func (k Keeper) SetPoolAtomic(ctx sdk.Context, pool types.Pool) types.Pool

SetPoolAtomic sets pool with set global pool id index +1 and index by reserveAcc

func (Keeper) SetPoolBatch added in v1.2.1

func (k Keeper) SetPoolBatch(ctx sdk.Context, poolBatch types.PoolBatch)

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) SetPoolBatchSwapMsgState added in v1.2.1

func (k Keeper) SetPoolBatchSwapMsgState(ctx sdk.Context, poolID uint64, state types.SwapMsgState)

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

func (k Keeper) SetPoolByReserveAccIndex(ctx sdk.Context, pool types.Pool)

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

func (k Keeper) SwapExecution(ctx sdk.Context, poolBatch types.PoolBatch) (uint64, error)

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

func (k Keeper) ValidateGenesis(ctx sdk.Context, genState types.GenesisState) error

ValidateGenesis validates the liquidity module's genesis state.

func (Keeper) ValidateMsgCreatePool added in v1.2.1

func (k Keeper) ValidateMsgCreatePool(ctx sdk.Context, msg *types.MsgCreatePool) error

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

func (k Keeper) ValidateMsgSwapWithinBatch(ctx sdk.Context, msg types.MsgSwapWithinBatch, pool types.Pool) error

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

func (k Keeper) ValidatePool(ctx sdk.Context, pool *types.Pool) error

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

func (k Keeper) ValidatePoolRecord(ctx sdk.Context, record types.PoolRecord) error

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 Migrator added in v1.3.0

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v1.3.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v1.3.0

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

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

LiquidityPool queries a liquidity pool with the given pool id.

func (Querier) LiquidityPoolBatch added in v1.2.1

LiquidityPoolBatch queries a liquidity pool batch with the given pool id.

func (Querier) LiquidityPoolByPoolCoinDenom added in v1.2.6

LiquidityPool queries a liquidity pool with the given pool coin denom.

func (Querier) LiquidityPoolByReserveAcc added in v1.2.6

LiquidityPool queries a liquidity pool with the given reserve account address.

func (Querier) LiquidityPools added in v1.2.1

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

Params queries params of liquidity module.

func (Querier) PoolBatchDepositMsg added in v1.2.1

PoolBatchDepositMsg queries the pool batch deposit message with the msg_index of the liquidity pool.

func (Querier) PoolBatchDepositMsgs added in v1.2.1

PoolBatchDepositMsgs queries all pool batch deposit messages of the liquidity pool.

func (Querier) PoolBatchSwapMsg added in v1.2.1

PoolBatchSwapMsg queries the pool batch swap message with the message index of the liquidity pool.

func (Querier) PoolBatchSwapMsgs added in v1.2.1

PoolBatchSwapMsgs queries all pool batch swap messages of the liquidity pool.

func (Querier) PoolBatchWithdrawMsg added in v1.2.1

PoolBatchWithdrawMsg queries the pool batch withdraw message with the msg_index of the liquidity pool.

func (Querier) PoolBatchWithdrawMsgs added in v1.2.1

PoolBatchWithdrawMsgs queries all pool batch withdraw messages of the liquidity pool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL