Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- type Keeper
- func (k Keeper) AllPools(ctx sdk.Context) ([]types.PoolI, error)
- func (k Keeper) CreatePool(ctx sdk.Context, msg types.CreatePoolMsg) (uint64, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetNextPoolId(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPoolModule(ctx sdk.Context, poolId uint64) (types.PoolModuleI, error)
- func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState)
- func (k Keeper) MultihopEstimateInGivenExactAmountOut(ctx sdk.Context, routes []types.SwapAmountOutRoute, tokenOut sdk.Coin) (tokenInAmount sdk.Int, err error)
- func (k Keeper) MultihopEstimateOutGivenExactAmountIn(ctx sdk.Context, routes []types.SwapAmountInRoute, tokenIn sdk.Coin) (tokenOutAmount sdk.Int, err error)
- func (k Keeper) RouteCalculateSpotPrice(ctx sdk.Context, poolId uint64, quoteAssetDenom string, baseAssetDenom string) (price sdk.Dec, err error)
- func (k Keeper) RouteExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountInRoute, ...) (tokenOutAmount sdk.Int, err error)
- func (k Keeper) RouteExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountOutRoute, ...) (tokenInAmount sdk.Int, err error)
- func (k Keeper) RouteGetPoolDenoms(ctx sdk.Context, poolId uint64) (denoms []string, err error)
- func (k Keeper) RoutePool(ctx sdk.Context, poolId uint64) (types.PoolI, error)
- func (k Keeper) SetNextPoolId(ctx sdk.Context, poolId uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k *Keeper) SetPoolCreationListeners(listeners types.PoolCreationListeners) *Keeper
- func (k *Keeper) SetPoolIncentivesKeeper(poolIncentivesKeeper types.PoolIncentivesKeeperI)
- func (k Keeper) SetPoolRoute(ctx sdk.Context, poolId uint64, poolType types.PoolType)
- func (k Keeper) SwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenIn sdk.Coin, ...) (tokenOutAmount sdk.Int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, gammKeeper types.PoolModuleI, concentratedKeeper types.PoolModuleI, bankKeeper types.BankI, accountKeeper types.AccountI, communityPoolKeeper types.CommunityPoolI) *Keeper
func (Keeper) AllPools ¶ added in v15.3.0
AllPools returns all pools sorted by their ids from every pool module registered in the pool manager keeper.
func (Keeper) CreatePool ¶
CreatePool attempts to create a pool returning the newly created pool ID or an error upon failure. The pool creation fee is used to fund the community pool. It will create a dedicated module account for the pool and sends the initial liquidity to the created module account.
After the initial liquidity is sent to the pool's account, this function calls an InitializePool function from the source module. That module is responsible for: - saving the pool into its own state - Minting LP shares to pool creator - Setting metadata for the shares
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the poolmanager module's exported genesis.
func (Keeper) GetNextPoolId ¶
GetNextPoolId returns the next pool id.
func (Keeper) GetPoolModule ¶
GetPoolModule returns the swap module for the given pool ID. Returns error if: - any database error occurs. - fails to find a pool with the given id. - the swap module of the type corresponding to the pool id is not registered in poolmanager's keeper constructor. TODO: unexport after concentrated-liqudity upgrade. Currently, it is exported for the upgrade handler logic and tests.
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState)
InitGenesis initializes the poolmanager module's state from a provided genesis state.
func (Keeper) MultihopEstimateInGivenExactAmountOut ¶
func (Keeper) MultihopEstimateOutGivenExactAmountIn ¶
func (Keeper) RouteCalculateSpotPrice ¶ added in v15.3.0
func (Keeper) RouteExactAmountIn ¶
func (k Keeper) RouteExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountInRoute, tokenIn sdk.Coin, tokenOutMinAmount sdk.Int, ) (tokenOutAmount sdk.Int, err error)
RouteExactAmountIn defines the input denom and input amount for the first pool, the output of the first pool is chained as the input for the next routed pool transaction succeeds when final amount out is greater than tokenOutMinAmount defined.
func (Keeper) RouteExactAmountOut ¶
func (k Keeper) RouteExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountOutRoute, tokenInMaxAmount sdk.Int, tokenOut sdk.Coin, ) (tokenInAmount sdk.Int, err error)
MultihopSwapExactAmountOut defines the output denom and output amount for the last pool. Calculation starts by providing the tokenOutAmount of the final pool to calculate the required tokenInAmount the calculated tokenInAmount is used as defined tokenOutAmount of the previous pool, calculating in reverse order of the swap Transaction succeeds if the calculated tokenInAmount of the first pool is less than the defined tokenInMaxAmount defined.
func (Keeper) RouteGetPoolDenoms ¶ added in v15.3.0
func (Keeper) SetNextPoolId ¶
SetNextPoolId sets next pool Id.
func (*Keeper) SetPoolCreationListeners ¶
func (k *Keeper) SetPoolCreationListeners(listeners types.PoolCreationListeners) *Keeper
SetPoolCreationListeners sets the pool creation listeners.
func (*Keeper) SetPoolIncentivesKeeper ¶
func (k *Keeper) SetPoolIncentivesKeeper(poolIncentivesKeeper types.PoolIncentivesKeeperI)
SetPoolIncentivesKeeper sets pool incentives keeper
func (Keeper) SetPoolRoute ¶
func (Keeper) SwapExactAmountIn ¶
func (k Keeper) SwapExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenIn sdk.Coin, tokenOutDenom string, tokenOutMinAmount sdk.Int, ) (tokenOutAmount sdk.Int, err error)
SwapExactAmountIn is an API for swapping an exact amount of tokens as input to a pool to get a minimum amount of the desired token out. The method succeeds when tokenOutAmount is greater than tokenOutMinAmount defined. Errors otherwise. Also, errors if the pool id is invalid, if tokens do not belong to the pool with given id or if sender does not have the swapped-in tokenIn.