Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- func NewPoolManagerProposalHandler(k Keeper) govtypes.Handler
- type Keeper
- func (k Keeper) AllPools(ctx sdk.Context) ([]types.PoolI, error)
- func (k Keeper) CreateConcentratedPoolAsPoolManager(ctx sdk.Context, msg types.CreatePoolMsg) (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) GetPool(ctx sdk.Context, poolId uint64) (types.PoolI, error)
- func (k Keeper) GetPoolModule(ctx sdk.Context, poolId uint64) (types.PoolModuleI, error)
- func (k Keeper) GetTotalPoolLiquidity(ctx sdk.Context, poolId uint64) (sdk.Coins, error)
- func (k Keeper) GetTradingPairTakerFee(ctx sdk.Context, denom0, denom1 string) (osmomath.Dec, error)
- func (k Keeper) HandleDenomPairTakerFeeProposal(ctx sdk.Context, p *types.DenomPairTakerFeeProposal) error
- func (k Keeper) InitGenesis(ctx sdk.Context, genState *types.GenesisState)
- func (k Keeper) MultihopEstimateInGivenExactAmountOut(ctx sdk.Context, route []types.SwapAmountOutRoute, tokenOut sdk.Coin) (tokenInAmount osmomath.Int, err error)
- func (k Keeper) MultihopEstimateOutGivenExactAmountIn(ctx sdk.Context, route []types.SwapAmountInRoute, tokenIn sdk.Coin) (tokenOutAmount osmomath.Int, err error)
- func (k Keeper) RouteCalculateSpotPrice(ctx sdk.Context, poolId uint64, quoteAssetDenom string, baseAssetDenom string) (price osmomath.BigDec, err error)
- func (k Keeper) RouteExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, route []types.SwapAmountInRoute, ...) (tokenOutAmount osmomath.Int, err error)
- func (k Keeper) RouteExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, route []types.SwapAmountOutRoute, ...) (tokenInAmount osmomath.Int, err error)
- func (k Keeper) RouteGetPoolDenoms(ctx sdk.Context, poolId uint64) (denoms []string, err error)
- func (k Keeper) SenderValidationSetDenomPairTakerFee(ctx sdk.Context, sender, denom0, denom1 string, takerFee osmomath.Dec) error
- func (k Keeper) SetDenomPairTakerFee(ctx sdk.Context, denom0, denom1 string, takerFee osmomath.Dec)
- func (k Keeper) SetNextPoolId(ctx sdk.Context, poolId uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k *Keeper) SetPoolIncentivesKeeper(poolIncentivesKeeper types.PoolIncentivesKeeperI)
- func (k Keeper) SetPoolRoute(ctx sdk.Context, poolId uint64, poolType types.PoolType)
- func (k Keeper) SplitRouteExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountInSplitRoute, ...) (osmomath.Int, error)
- func (k Keeper) SplitRouteExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, route []types.SwapAmountOutSplitRoute, ...) (osmomath.Int, error)
- func (k Keeper) SwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenIn sdk.Coin, ...) (tokenOutAmount osmomath.Int, err error)
- func (k Keeper) SwapExactAmountInNoTakerFee(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenIn sdk.Coin, ...) (tokenOutAmount osmomath.Int, err error)
- func (k Keeper) TotalLiquidity(ctx sdk.Context) (sdk.Coins, 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, cosmwasmpoolKeeper types.PoolModuleI, bankKeeper types.BankI, accountKeeper types.AccountI, communityPoolKeeper types.CommunityPoolI) *Keeper
func (Keeper) AllPools ¶
AllPools returns all pools sorted by their ids from every pool module registered in the pool manager keeper.
func (Keeper) CreateConcentratedPoolAsPoolManager ¶
func (k Keeper) CreateConcentratedPoolAsPoolManager(ctx sdk.Context, msg types.CreatePoolMsg) (types.PoolI, error)
CreateConcentratedPoolAsPoolManager creates a concentrated liquidity pool from given message without sending any initial liquidity to the pool and paying a creation fee. This is meant to be used for creating the pools internally (such as in the upgrade handler). The creator of the pool must be the poolmanager module account. Returns error if not. Otherwise, functions the same as the regular createPoolZeroLiquidityNoCreationFee.
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) GetTotalPoolLiquidity ¶
GetTotalPoolLiquidity gets the total liquidity for a given poolId.
func (Keeper) GetTradingPairTakerFee ¶
func (k Keeper) GetTradingPairTakerFee(ctx sdk.Context, denom0, denom1 string) (osmomath.Dec, error)
GetTradingPairTakerFee returns the taker fee for the given trading pair. If the trading pair does not exist, it returns the default taker fee.
func (Keeper) HandleDenomPairTakerFeeProposal ¶
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 ¶
func (Keeper) RouteExactAmountIn ¶
func (k Keeper) RouteExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, route []types.SwapAmountInRoute, tokenIn sdk.Coin, tokenOutMinAmount osmomath.Int, ) (tokenOutAmount osmomath.Int, err error)
RouteExactAmountIn processes a swap along the given route using the swap function corresponding to poolID's pool type. It takes in the input denom and amount for the initial swap against the first pool and chains the output as the input for the next routed pool until the last pool is reached. Transaction succeeds if final amount out is greater than tokenOutMinAmount defined and no errors are encountered along the way.
func (Keeper) RouteExactAmountOut ¶
func (k Keeper) RouteExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, route []types.SwapAmountOutRoute, tokenInMaxAmount osmomath.Int, tokenOut sdk.Coin, ) (tokenInAmount osmomath.Int, err error)
RouteExactAmountOut processes a swap along the given route using the swap function corresponding to poolID's pool type. This function is responsible for computing the optimal output amount for a given input amount when swapping tokens, taking into account the current price of the tokens in the pool and any slippage. Transaction succeeds if the calculated tokenInAmount of the first pool is less than the defined tokenInMaxAmount defined.
func (Keeper) RouteGetPoolDenoms ¶
func (Keeper) SenderValidationSetDenomPairTakerFee ¶
func (k Keeper) SenderValidationSetDenomPairTakerFee(ctx sdk.Context, sender, denom0, denom1 string, takerFee osmomath.Dec) error
SenderValidationSetDenomPairTakerFee sets the taker fee for the given trading pair iff the sender's address also exists in the pool manager taker fee admin address list.
func (Keeper) SetDenomPairTakerFee ¶
SetDenomPairTakerFee sets the taker fee for the given trading pair. If the taker fee for this denom pair matches the default taker fee, then it is deleted from state.
func (Keeper) SetNextPoolId ¶
SetNextPoolId sets next pool Id.
func (*Keeper) SetPoolIncentivesKeeper ¶
func (k *Keeper) SetPoolIncentivesKeeper(poolIncentivesKeeper types.PoolIncentivesKeeperI)
SetPoolIncentivesKeeper sets pool incentives keeper
func (Keeper) SetPoolRoute ¶
func (Keeper) SplitRouteExactAmountIn ¶
func (k Keeper) SplitRouteExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountInSplitRoute, tokenInDenom string, tokenOutMinAmount osmomath.Int, ) (osmomath.Int, error)
SplitRouteExactAmountIn routes the swap across multiple multihop paths to get the desired token out. This is useful for achieving the most optimal execution. However, note that the responsibility of determining the optimal split is left to the client. This method simply route the swap across the given route. The route must end with the same token out and begin with the same token in.
It performs the price impact protection check on the combination of tokens out from all multihop paths. The given tokenOutMinAmount is used for comparison.
Returns error if:
- route are empty
- route contain duplicate multihop paths
- last token out denom is not the same for all multihop paths in routeStep
- one of the multihop swaps fails for internal reasons
- final token out computed is not positive
- final token out computed is smaller than tokenOutMinAmount
func (Keeper) SplitRouteExactAmountOut ¶
func (k Keeper) SplitRouteExactAmountOut( ctx sdk.Context, sender sdk.AccAddress, route []types.SwapAmountOutSplitRoute, tokenOutDenom string, tokenInMaxAmount osmomath.Int, ) (osmomath.Int, error)
SplitRouteExactAmountOut route the swap across multiple multihop paths to get the desired token in. This is useful for achieving the most optimal execution. However, note that the responsibility of determining the optimal split is left to the client. This method simply route the swap across the given route. The route must end with the same token out and begin with the same token in.
It performs the price impact protection check on the combination of tokens in from all multihop paths. The given tokenInMaxAmount is used for comparison.
Returns error if:
- route are empty
- route contain duplicate multihop paths
- last token out denom is not the same for all multihop paths in routeStep
- one of the multihop swaps fails for internal reasons
- final token out computed is not positive
- final token out computed is smaller than tokenInMaxAmount
func (Keeper) SwapExactAmountIn ¶
func (k Keeper) SwapExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenIn sdk.Coin, tokenOutDenom string, tokenOutMinAmount osmomath.Int, ) (tokenOutAmount osmomath.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.
func (Keeper) SwapExactAmountInNoTakerFee ¶
func (k Keeper) SwapExactAmountInNoTakerFee( ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenIn sdk.Coin, tokenOutDenom string, tokenOutMinAmount osmomath.Int, ) (tokenOutAmount osmomath.Int, err error)
SwapExactAmountInNoTakerFee 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. This method does NOT charge a taker fee, and should only be used in txfees hooks when swapping taker fees. This prevents us from charging taker fees on top of taker fees.