keeper

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants returns a combined invariant of the liquidity module.

func DepositCoinsEscrowInvariant

func DepositCoinsEscrowInvariant(k Keeper) sdk.Invariant

DepositCoinsEscrowInvariant checks that the amount of coins in the global escrow address is greater or equal than remaining deposit coins in all deposit requests.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

func PoolCoinEscrowInvariant

func PoolCoinEscrowInvariant(k Keeper) sdk.Invariant

PoolCoinEscrowInvariant checks that the amount of coins in the global escrow address is greater or equal than remaining withdrawing pool coins in all withdrawal requests.

func PoolStatusInvariant

func PoolStatusInvariant(k Keeper) sdk.Invariant

PoolStatusInvariant checks that the pools with zero pool coin supply have been marked as disabled.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all liquidity module invariants.

func RemainingOfferCoinEscrowInvariant

func RemainingOfferCoinEscrowInvariant(k Keeper) sdk.Invariant

RemainingOfferCoinEscrowInvariant checks that the amount of coins in each pair's escrow address is greater or equal than remaining offer coins in the pair's orders.

Types

type Keeper

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

Keeper of the liquidity store.

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey sdk.StoreKey,
	paramSpace paramstypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
) Keeper

NewKeeper creates a new liquidity Keeper instance.

func (Keeper) ApplyMatchResult

func (k Keeper) ApplyMatchResult(ctx sdk.Context, pair types.Pair, orders []amm.Order, quoteCoinDust sdk.Int) error

func (Keeper) CancelAllOrders

func (k Keeper) CancelAllOrders(ctx sdk.Context, msg *types.MsgCancelAllOrders) error

CancelAllOrders handles types.MsgCancelAllOrders and cancels all orders.

func (Keeper) CancelOrder

func (k Keeper) CancelOrder(ctx sdk.Context, msg *types.MsgCancelOrder) error

CancelOrder handles types.MsgCancelOrder and cancels an order.

func (Keeper) CreatePair

func (k Keeper) CreatePair(ctx sdk.Context, msg *types.MsgCreatePair) (types.Pair, error)

CreatePair handles types.MsgCreatePair and creates a pair.

func (Keeper) CreatePool

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

CreatePool handles types.MsgCreatePool and creates a pool.

func (Keeper) DeleteDepositRequest

func (k Keeper) DeleteDepositRequest(ctx sdk.Context, req types.DepositRequest)

DeleteDepositRequest deletes a deposit request.

func (Keeper) DeleteDepositRequestIndex

func (k Keeper) DeleteDepositRequestIndex(ctx sdk.Context, req types.DepositRequest)

func (Keeper) DeleteOrder

func (k Keeper) DeleteOrder(ctx sdk.Context, order types.Order)

DeleteOrder deletes an order.

func (Keeper) DeleteOrderIndex

func (k Keeper) DeleteOrderIndex(ctx sdk.Context, order types.Order)

func (Keeper) DeleteOutdatedRequests

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

DeleteOutdatedRequests deletes outdated(should be deleted) requests. Determining if a request should be deleted is based on its status.

func (Keeper) DeleteWithdrawRequest

func (k Keeper) DeleteWithdrawRequest(ctx sdk.Context, req types.WithdrawRequest)

DeleteWithdrawRequest deletes a withdraw request.

func (Keeper) DeleteWithdrawRequestIndex

func (k Keeper) DeleteWithdrawRequestIndex(ctx sdk.Context, req types.WithdrawRequest)

func (Keeper) Deposit

func (k Keeper) Deposit(ctx sdk.Context, msg *types.MsgDeposit) (types.DepositRequest, error)

Deposit handles types.MsgDeposit and stores the request.

func (Keeper) ExecuteDepositRequest

func (k Keeper) ExecuteDepositRequest(ctx sdk.Context, req types.DepositRequest) error

ExecuteDepositRequest executes a deposit request.

func (Keeper) ExecuteMatching

func (k Keeper) ExecuteMatching(ctx sdk.Context, pair types.Pair) error

func (Keeper) ExecuteRequests

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

ExecuteRequests executes all orders, deposit requests and withdraw requests. ExecuteRequests also handles order expiration.

func (Keeper) ExecuteWithdrawRequest

func (k Keeper) ExecuteWithdrawRequest(ctx sdk.Context, req types.WithdrawRequest) error

ExecuteWithdrawRequest executes a withdraw request.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the capability module's exported genesis.

func (Keeper) FinishDepositRequest

func (k Keeper) FinishDepositRequest(ctx sdk.Context, req types.DepositRequest, status types.RequestStatus) error

FinishDepositRequest refunds unhandled deposit coins and set request status.

func (Keeper) FinishOrder

func (k Keeper) FinishOrder(ctx sdk.Context, order types.Order, status types.OrderStatus) error

func (Keeper) FinishWithdrawRequest

func (k Keeper) FinishWithdrawRequest(ctx sdk.Context, req types.WithdrawRequest, status types.RequestStatus) error

FinishWithdrawRequest refunds unhandled pool coin and set request status.

func (Keeper) GetAllDepositRequests

func (k Keeper) GetAllDepositRequests(ctx sdk.Context) (reqs []types.DepositRequest)

GetAllDepositRequests returns all deposit requests in the store.

func (Keeper) GetAllOrders

func (k Keeper) GetAllOrders(ctx sdk.Context) (orders []types.Order)

GetAllOrders returns all orders in the store.

func (Keeper) GetAllPairs

func (k Keeper) GetAllPairs(ctx sdk.Context) (pairs []types.Pair)

GetAllPairs returns all pairs in the store.

func (Keeper) GetAllPools

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

GetAllPools returns all pools in the store.

func (Keeper) GetAllWithdrawRequests

func (k Keeper) GetAllWithdrawRequests(ctx sdk.Context) (reqs []types.WithdrawRequest)

GetAllWithdrawRequests returns all withdraw requests in the store.

func (Keeper) GetDepositRequest

func (k Keeper) GetDepositRequest(ctx sdk.Context, poolId, id uint64) (req types.DepositRequest, found bool)

GetDepositRequest returns the particular deposit request.

func (Keeper) GetDepositRequestsByDepositor

func (k Keeper) GetDepositRequestsByDepositor(ctx sdk.Context, depositor sdk.AccAddress) (reqs []types.DepositRequest)

GetDepositRequestsByDepositor returns deposit requests by the depositor.

func (Keeper) GetLastPairId

func (k Keeper) GetLastPairId(ctx sdk.Context) (id uint64)

GetLastPairId returns the last pair id.

func (Keeper) GetLastPoolId

func (k Keeper) GetLastPoolId(ctx sdk.Context) (id uint64)

GetLastPoolId returns the last pool id.

func (Keeper) GetOrder

func (k Keeper) GetOrder(ctx sdk.Context, pairId, id uint64) (order types.Order, found bool)

GetOrder returns the particular order.

func (Keeper) GetOrdersByOrderer

func (k Keeper) GetOrdersByOrderer(ctx sdk.Context, orderer sdk.AccAddress) (orders []types.Order)

GetOrdersByOrderer returns orders by the orderer.

func (Keeper) GetOrdersByPair

func (k Keeper) GetOrdersByPair(ctx sdk.Context, pairId uint64) (orders []types.Order)

GetOrdersByPair returns orders within the pair.

func (Keeper) GetPair

func (k Keeper) GetPair(ctx sdk.Context, id uint64) (pair types.Pair, found bool)

GetPair returns pair object for the given pair id.

func (Keeper) GetPairByDenoms

func (k Keeper) GetPairByDenoms(ctx sdk.Context, baseCoinDenom, quoteCoinDenom string) (pair types.Pair, found bool)

GetPairByDenoms returns a types.Pair for given denoms.

func (Keeper) GetParams

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

GetParams returns the parameters for the liquidity module.

func (Keeper) GetPool

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

GetPool returns pool object for the given pool id.

func (Keeper) GetPoolBalances

func (k Keeper) GetPoolBalances(ctx sdk.Context, pool types.Pool) (rx sdk.Coin, ry sdk.Coin)

GetPoolBalances returns the balances of the pool.

func (Keeper) GetPoolByReserveAddress

func (k Keeper) GetPoolByReserveAddress(ctx sdk.Context, reserveAddr sdk.AccAddress) (pool types.Pool, found bool)

GetPoolByReserveAddress returns pool object for the given reserve account address.

func (Keeper) GetPoolCoinSupply

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

GetPoolCoinSupply returns total pool coin supply of the pool.

func (Keeper) GetPoolsByPair

func (k Keeper) GetPoolsByPair(ctx sdk.Context, pairId uint64) (pools []types.Pool)

GetPoolsByPair returns pools within the pair.

func (Keeper) GetWithdrawRequest

func (k Keeper) GetWithdrawRequest(ctx sdk.Context, poolId, id uint64) (req types.WithdrawRequest, found bool)

GetWithdrawRequest returns the particular withdraw request.

func (Keeper) GetWithdrawRequestsByWithdrawer

func (k Keeper) GetWithdrawRequestsByWithdrawer(ctx sdk.Context, withdrawer sdk.AccAddress) (reqs []types.WithdrawRequest)

GetWithdrawRequestsByWithdrawer returns withdraw requests by the withdrawer.

func (Keeper) InitGenesis

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

InitGenesis initializes the capability module's state from a provided genesis state.

func (Keeper) IterateAllDepositRequests

func (k Keeper) IterateAllDepositRequests(ctx sdk.Context, cb func(req types.DepositRequest) (stop bool, err error)) error

IterateAllDepositRequests iterates through all deposit requests in the store and call cb for each request.

func (Keeper) IterateAllOrders

func (k Keeper) IterateAllOrders(ctx sdk.Context, cb func(order types.Order) (stop bool, err error)) error

IterateAllOrders iterates through all orders in the store and all cb for each order.

func (Keeper) IterateAllPairs

func (k Keeper) IterateAllPairs(ctx sdk.Context, cb func(pair types.Pair) (stop bool, err error)) error

IterateAllPairs iterates over all the stored pairs and performs a callback function. Stops iteration when callback returns true.

func (Keeper) IterateAllPools

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

IterateAllPools iterates over all the stored pools and performs a callback function. Stops iteration when callback returns true.

func (Keeper) IterateAllWithdrawRequests

func (k Keeper) IterateAllWithdrawRequests(ctx sdk.Context, cb func(req types.WithdrawRequest) (stop bool, err error)) error

IterateAllWithdrawRequests iterates through all withdraw requests in the store and call cb for each request.

func (Keeper) IterateDepositRequestsByDepositor

func (k Keeper) IterateDepositRequestsByDepositor(ctx sdk.Context, depositor sdk.AccAddress, cb func(req types.DepositRequest) (stop bool, err error)) error

IterateDepositRequestsByDepositor iterates through deposit requests in the store by a depositor and call cb on each order.

func (Keeper) IterateOrdersByOrderer

func (k Keeper) IterateOrdersByOrderer(ctx sdk.Context, orderer sdk.AccAddress, cb func(order types.Order) (stop bool, err error)) error

IterateOrdersByOrderer iterates through orders in the store by an orderer and call cb on each order.

func (Keeper) IterateOrdersByPair

func (k Keeper) IterateOrdersByPair(ctx sdk.Context, pairId uint64, cb func(order types.Order) (stop bool, err error)) error

IterateOrdersByPair iterates through all the orders within the pair and call cb for each order.

func (Keeper) IteratePoolsByPair

func (k Keeper) IteratePoolsByPair(ctx sdk.Context, pairId uint64, cb func(pool types.Pool) (stop bool, err error)) error

IteratePoolsByPair iterates over all the stored pools by the pair and performs a callback function. Stops iteration when callback returns true.

func (Keeper) IterateWithdrawRequestsByWithdrawer

func (k Keeper) IterateWithdrawRequestsByWithdrawer(ctx sdk.Context, withdrawer sdk.AccAddress, cb func(req types.WithdrawRequest) (stop bool, err error)) error

IterateWithdrawRequestsByWithdrawer iterates through withdraw requests in the store by a withdrawer and call cb on each order.

func (Keeper) LimitOrder

func (k Keeper) LimitOrder(ctx sdk.Context, msg *types.MsgLimitOrder) (types.Order, error)

LimitOrder handles types.MsgLimitOrder and stores types.Order.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MarkPoolAsDisabled

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

MarkPoolAsDisabled marks a pool as disabled.

func (Keeper) MarketOrder

func (k Keeper) MarketOrder(ctx sdk.Context, msg *types.MsgMarketOrder) (types.Order, error)

MarketOrder handles types.MsgMarketOrder and stores types.Order.

func (Keeper) SetDepositRequest

func (k Keeper) SetDepositRequest(ctx sdk.Context, req types.DepositRequest)

SetDepositRequest stores deposit request for the batch execution.

func (Keeper) SetDepositRequestIndex

func (k Keeper) SetDepositRequestIndex(ctx sdk.Context, req types.DepositRequest)

func (Keeper) SetLastPairId

func (k Keeper) SetLastPairId(ctx sdk.Context, id uint64)

SetLastPairId stores the last pair id.

func (Keeper) SetLastPoolId

func (k Keeper) SetLastPoolId(ctx sdk.Context, id uint64)

SetLastPoolId stores the last pool id.

func (Keeper) SetOrder

func (k Keeper) SetOrder(ctx sdk.Context, order types.Order)

SetOrder stores an order for the batch execution.

func (Keeper) SetOrderIndex

func (k Keeper) SetOrderIndex(ctx sdk.Context, order types.Order)

func (Keeper) SetPair

func (k Keeper) SetPair(ctx sdk.Context, pair types.Pair)

SetPair stores the particular pair.

func (Keeper) SetPairIndex

func (k Keeper) SetPairIndex(ctx sdk.Context, baseCoinDenom, quoteCoinDenom string, pairId uint64)

SetPairIndex stores a pair index.

func (Keeper) SetPairLookupIndex

func (k Keeper) SetPairLookupIndex(ctx sdk.Context, denomA string, denomB string, pairId uint64)

SetPairLookupIndex stores a pair lookup index for given denoms.

func (Keeper) SetParams

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

SetParams sets the parameters for the liquidity module.

func (Keeper) SetPool

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

SetPool stores the particular pool.

func (Keeper) SetPoolByReserveIndex

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

SetPoolByReserveIndex stores a pool by reserve account index key.

func (Keeper) SetPoolsByPairIndex

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

SetPoolsByPairIndex stores a pool by pair index key.

func (Keeper) SetWithdrawRequest

func (k Keeper) SetWithdrawRequest(ctx sdk.Context, req types.WithdrawRequest)

SetWithdrawRequest stores withdraw request for the batch execution.

func (Keeper) SetWithdrawRequestIndex

func (k Keeper) SetWithdrawRequestIndex(ctx sdk.Context, req types.WithdrawRequest)

func (Keeper) ValidateMsgCancelOrder

func (k Keeper) ValidateMsgCancelOrder(ctx sdk.Context, msg *types.MsgCancelOrder) (order types.Order, err error)

ValidateMsgCancelOrder validates types.MsgCancelOrder and returns the order.

func (Keeper) ValidateMsgCreatePair

func (k Keeper) ValidateMsgCreatePair(ctx sdk.Context, msg *types.MsgCreatePair) error

ValidateMsgCreatePair validates types.MsgCreatePair.

func (Keeper) ValidateMsgCreatePool

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

ValidateMsgCreatePool validates types.MsgCreatePool.

func (Keeper) ValidateMsgDeposit

func (k Keeper) ValidateMsgDeposit(ctx sdk.Context, msg *types.MsgDeposit) error

ValidateMsgDeposit validates types.MsgDeposit.

func (Keeper) ValidateMsgLimitOrder

func (k Keeper) ValidateMsgLimitOrder(ctx sdk.Context, msg *types.MsgLimitOrder) (offerCoin sdk.Coin, price sdk.Dec, err error)

ValidateMsgLimitOrder validates types.MsgLimitOrder with state and returns calculated offer coin and price that is fit into ticks.

func (Keeper) ValidateMsgMarketOrder

func (k Keeper) ValidateMsgMarketOrder(ctx sdk.Context, msg *types.MsgMarketOrder) (offerCoin sdk.Coin, price sdk.Dec, err error)

ValidateMsgMarketOrder validates types.MsgMarketOrder with state and returns calculated offer coin and price.

func (Keeper) ValidateMsgWithdraw

func (k Keeper) ValidateMsgWithdraw(ctx sdk.Context, msg *types.MsgWithdraw) error

ValidateMsgWithdraw validates types.MsgWithdraw.

func (Keeper) Withdraw

func (k Keeper) Withdraw(ctx sdk.Context, msg *types.MsgWithdraw) (types.WithdrawRequest, error)

Withdraw handles types.MsgWithdraw and stores the request.

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

DepositRequest queries the specific deposit request.

func (Querier) DepositRequests

DepositRequests queries all deposit requests.

func (Querier) Order

Order queries the specific order.

func (Querier) Orders

Orders queries all orders.

func (Querier) OrdersByOrderer

OrdersByOrderer returns orders made by an orderer.

func (Querier) Pair

Pair queries the specific pair.

func (Querier) Pairs

Pairs queries all pairs.

func (Querier) Params

Params queries the parameters of the liquidity module.

func (Querier) Pool

Pool queries the specific pool.

func (Querier) PoolByPoolCoinDenom

PoolByPoolCoinDenom queries the specific pool by the pool coin denomination.

func (Querier) PoolByReserveAddress

PoolByReserveAddress queries the specific pool by the reserve account address.

func (Querier) Pools

Pools queries all pools.

func (Querier) WithdrawRequest

WithdrawRequest queries the specific withdraw request.

func (Querier) WithdrawRequests

WithdrawRequests queries all withdraw requests.

Jump to

Keyboard shortcuts

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