Documentation ¶
Index ¶
- Variables
- func CalcTakerFeeExactIn(tokenIn sdk.Coin, takerFee osmomath.Dec) (sdk.Coin, sdk.Coin)
- func CalcTakerFeeExactOut(tokenIn sdk.Coin, takerFee osmomath.Dec) (sdk.Coin, sdk.Coin)
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- func NewPoolManagerProposalHandler(k Keeper) govtypesv1.Handler
- type Keeper
- func (k Keeper) AllPools(ctx sdk.Context) ([]types.PoolI, error)
- func (k *Keeper) BeginBlock(ctx sdk.Context)
- 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) DeleteAllTakerFeeShareAccumulatorsForTakerFeeShareDenom(ctx sdk.Context, takerFeeShareDenom string)
- func (k *Keeper) EndBlock(ctx sdk.Context)
- func (k Keeper) EstimateTradeBasedOnPriceImpactBalancerPool(ctx sdk.Context, req queryproto.EstimateTradeBasedOnPriceImpactRequest, ...) (*queryproto.EstimateTradeBasedOnPriceImpactResponse, error)
- func (k Keeper) EstimateTradeBasedOnPriceImpactConcentratedLiquidity(ctx sdk.Context, req queryproto.EstimateTradeBasedOnPriceImpactRequest, ...) (*queryproto.EstimateTradeBasedOnPriceImpactResponse, error)
- func (k Keeper) EstimateTradeBasedOnPriceImpactStableSwapPool(ctx sdk.Context, req queryproto.EstimateTradeBasedOnPriceImpactRequest, ...) (*queryproto.EstimateTradeBasedOnPriceImpactResponse, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllRegisteredAlloyedPools(ctx sdk.Context) ([]types.AlloyContractTakerFeeShareState, error)
- func (k Keeper) GetAllTakerFeeShareAccumulators(ctx sdk.Context) ([]types.TakerFeeSkimAccumulator, error)
- func (k Keeper) GetAllTakerFeesShareAgreements(ctx sdk.Context) ([]types.TakerFeeShareAgreement, error)
- func (k Keeper) GetAllTradingPairTakerFees(ctx sdk.Context) ([]types.DenomPairTakerFee, error)
- func (k *Keeper) GetDefaultTakerFee(ctx sdk.Context) osmomath.Dec
- func (k Keeper) GetLegacyTakerFeeTrackerForCommunityPool(ctx sdk.Context) (currentTakerFeeForCommunityPool sdk.Coins)
- func (k Keeper) GetLegacyTakerFeeTrackerForStakers(ctx sdk.Context) (currentTakerFeeForStakers sdk.Coins)
- func (k Keeper) GetNextPoolId(ctx sdk.Context) uint64
- func (k Keeper) GetOsmoVolumeForPool(ctx sdk.Context, poolId uint64) osmomath.Int
- 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) GetPoolModuleAndPool(ctx sdk.Context, poolId uint64) (swapModule types.PoolModuleI, pool types.PoolI, err error)
- func (k *Keeper) GetPoolType(ctx sdk.Context, poolId uint64) (types.PoolType, error)
- func (k Keeper) GetRegisteredAlloyedPoolFromDenomUNSAFE(alloyedDenom string) (types.AlloyContractTakerFeeShareState, bool)
- func (k Keeper) GetRegisteredAlloyedPoolFromPoolIdUNSAFE(ctx sdk.Context, poolId uint64) (types.AlloyContractTakerFeeShareState, error)
- func (k Keeper) GetTakerFeeShareAgreementFromDenomNoCache(ctx sdk.Context, takerFeeShareDenom string) (types.TakerFeeShareAgreement, bool)
- func (k Keeper) GetTakerFeeShareAgreementFromDenomUNSAFE(takerFeeShareDenom string) (types.TakerFeeShareAgreement, bool)
- func (k Keeper) GetTakerFeeShareDenomsToAccruedValue(ctx sdk.Context, takerFeeShareDenom string, takerFeeChargedDenom string) (osmomath.Int, error)
- func (k Keeper) GetTakerFeeTrackerForCommunityPool(ctx sdk.Context) []sdk.Coin
- func (k Keeper) GetTakerFeeTrackerForCommunityPoolByDenom(ctx sdk.Context, denom string) (sdk.Coin, error)
- func (k Keeper) GetTakerFeeTrackerForStakers(ctx sdk.Context) []sdk.Coin
- func (k Keeper) GetTakerFeeTrackerForStakersByDenom(ctx sdk.Context, denom string) (sdk.Coin, error)
- func (k Keeper) GetTakerFeeTrackerStartHeight(ctx sdk.Context) int64
- func (k Keeper) GetTotalPoolLiquidity(ctx sdk.Context, poolId uint64) (sdk.Coins, error)
- func (k Keeper) GetTotalVolumeForPool(ctx sdk.Context, poolId uint64) sdk.Coins
- func (k Keeper) GetTradingPairTakerFee(ctx sdk.Context, tokenInDenom, tokenOutDenom 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) ListPoolsByDenom(ctx sdk.Context, denom string) ([]types.PoolI, error)
- 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) MultihopEstimateOutGivenExactAmountInNoTakerFee(ctx sdk.Context, route []types.SwapAmountInRoute, tokenIn sdk.Coin) (tokenOutAmount osmomath.Int, err error)
- func (k *Keeper) ResetCaches()
- 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) SetParam(ctx sdk.Context, key []byte, value interface{})
- 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) SetProtorevKeeper(protorevKeeper types.ProtorevKeeper)
- func (k *Keeper) SetStakingKeeper(stakingKeeper types.StakingKeeper)
- func (k *Keeper) SetTakerFeeShareAgreementForDenom(ctx sdk.Context, takerFeeShare types.TakerFeeShareAgreement) error
- func (k Keeper) SetTakerFeeShareDenomsToAccruedValue(ctx sdk.Context, takerFeeShareDenom string, takerFeeChargedDenom string, ...) error
- func (k Keeper) SetTakerFeeTrackerStartHeight(ctx sdk.Context, startHeight int64)
- func (k Keeper) SetVolume(ctx sdk.Context, poolId uint64, totalVolume sdk.Coins)
- func (k *Keeper) SetWasmKeeper(wasmKeeper types.WasmKeeper)
- 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, takerFeeCharged sdk.Coin, 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) TakerFeeSkim(ctx sdk.Context, denomsInvolvedInRoute []string, totalTakerFees sdk.Coins) error
- func (k Keeper) TotalLiquidity(ctx sdk.Context) (sdk.Coins, error)
- func (k Keeper) UpdateTakerFeeTrackerForCommunityPoolByDenom(ctx sdk.Context, denom string, increasedAmt osmomath.Int) error
- func (k Keeper) UpdateTakerFeeTrackerForStakersByDenom(ctx sdk.Context, denom string, increasedAmt osmomath.Int) error
Constants ¶
This section is empty.
Variables ¶
var AlloyedAssetCompositionUpdateRate = int64(700)
AlloyedAssetCompositionUpdateRate is the rate in blocks at which the taker fee share alloy composition is updated in the end block.
Functions ¶
func CalcTakerFeeExactIn ¶
Returns remaining amount in to swap, and takerFeeCoins. returns (1 - takerFee) * tokenIn, takerFee * tokenIn
func CalcTakerFeeExactOut ¶
func NewMsgServerImpl ¶
func NewPoolManagerProposalHandler ¶
func NewPoolManagerProposalHandler(k Keeper) govtypesv1.Handler
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper(storeKey storetypes.StoreKey, paramSpace paramtypes.Subspace, gammKeeper types.PoolModuleI, concentratedKeeper types.ConcentratedI, cosmwasmpoolKeeper types.PoolModuleI, bankKeeper types.BankI, accountKeeper types.AccountI, communityPoolKeeper types.CommunityPoolI, stakingKeeper types.StakingKeeper, protorevKeeper types.ProtorevKeeper, wasmKeeper types.WasmKeeper) *Keeper
func (Keeper) AllPools ¶
AllPools returns all pools sorted by their ids from every pool module registered in the pool manager keeper.
func (*Keeper) BeginBlock ¶
BeginBlock sets the poolmanager caches if they are empty
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) DeleteAllTakerFeeShareAccumulatorsForTakerFeeShareDenom ¶
func (k Keeper) DeleteAllTakerFeeShareAccumulatorsForTakerFeeShareDenom(ctx sdk.Context, takerFeeShareDenom string)
DeleteAllTakerFeeShareAccumulatorsForTakerFeeShareDenom clears the TakerFeeShareAccumulator records for a specific taker fee share denom. Is specifically used after the distributions have been completed after epoch for each denom.
func (*Keeper) EndBlock ¶
EndBlock updates the taker fee share alloy composition for all registered alloyed pools if the current block height is a multiple of the alloyedAssetCompositionUpdateRate.
func (Keeper) EstimateTradeBasedOnPriceImpactBalancerPool ¶
func (k Keeper) EstimateTradeBasedOnPriceImpactBalancerPool( ctx sdk.Context, req queryproto.EstimateTradeBasedOnPriceImpactRequest, spotPrice, adjustedMaxPriceImpact osmomath.Dec, swapModule types.PoolModuleI, poolI types.PoolI, ) (*queryproto.EstimateTradeBasedOnPriceImpactResponse, error)
EstimateTradeBasedOnPriceImpactBalancerPool estimates a trade based on price impact for a balancer pool type. For a balancer pool if an amount entered is greater than the total pool liquidity the trade estimated would be the full liquidity of the other token. If the amount is small it would return a close 1:1 trade of the smallest units.
func (Keeper) EstimateTradeBasedOnPriceImpactConcentratedLiquidity ¶
func (k Keeper) EstimateTradeBasedOnPriceImpactConcentratedLiquidity( ctx sdk.Context, req queryproto.EstimateTradeBasedOnPriceImpactRequest, spotPrice, adjustedMaxPriceImpact osmomath.Dec, swapModule types.PoolModuleI, poolI types.PoolI, ) (*queryproto.EstimateTradeBasedOnPriceImpactResponse, error)
EstimateTradeBasedOnPriceImpactConcentratedLiquidity estimates a trade based on price impact for a concentrated liquidity pool type. For a concentrated liquidity pool if an amount entered is greater than the total pool liquidity the trade estimated would error. If the amount is small it would return tokenOut to be 0 in which case we should return an empty trade. If the estimate returns an error we should ignore it and continue attempting to estimate by halving the input.
func (Keeper) EstimateTradeBasedOnPriceImpactStableSwapPool ¶
func (k Keeper) EstimateTradeBasedOnPriceImpactStableSwapPool( ctx sdk.Context, req queryproto.EstimateTradeBasedOnPriceImpactRequest, spotPrice, adjustedMaxPriceImpact osmomath.Dec, swapModule types.PoolModuleI, poolI types.PoolI, ) (*queryproto.EstimateTradeBasedOnPriceImpactResponse, error)
EstimateTradeBasedOnPriceImpactStableSwapPool estimates a trade based on price impact for a stableswap pool type. For a stableswap pool if an amount entered is greater than the total pool liquidity the trade estimated would `panic`. If the amount is small it would return an error, in the case of a `panic` we should ignore it and keep attempting lower input amounts while if it's a normal error we should return an empty trade.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the poolmanager module's exported genesis.
func (Keeper) GetAllRegisteredAlloyedPools ¶
func (k Keeper) GetAllRegisteredAlloyedPools(ctx sdk.Context) ([]types.AlloyContractTakerFeeShareState, error)
GetAllRegisteredAlloyedPools creates a slice of all registered alloyed pools. Used in the AllRegisteredAlloyedPoolsRequest gRPC query.
func (Keeper) GetAllTakerFeeShareAccumulators ¶
func (k Keeper) GetAllTakerFeeShareAccumulators(ctx sdk.Context) ([]types.TakerFeeSkimAccumulator, error)
GetAllTakerFeeShareAccumulators creates a slice of all taker fee share accumulators. Used in the AllTakerFeeShareAccumulatorsRequest gRPC query.
func (Keeper) GetAllTakerFeesShareAgreements ¶
func (k Keeper) GetAllTakerFeesShareAgreements(ctx sdk.Context) ([]types.TakerFeeShareAgreement, error)
GetAllTakerFeesShareAgreements creates a slice of all taker fee share agreements. Used in the AllTakerFeeShareAgreementsRequest gRPC query.
func (Keeper) GetAllTradingPairTakerFees ¶
GetAllTradingPairTakerFees returns all the custom taker fees for trading pairs.
func (*Keeper) GetDefaultTakerFee ¶
func (Keeper) GetLegacyTakerFeeTrackerForCommunityPool ¶
func (k Keeper) GetLegacyTakerFeeTrackerForCommunityPool(ctx sdk.Context) (currentTakerFeeForCommunityPool sdk.Coins)
GetLegacyTakerFeeTrackerForCommunityPool is the legacy getter, to be used in the v22 upgrade handler and removed in v23.
func (Keeper) GetLegacyTakerFeeTrackerForStakers ¶
func (k Keeper) GetLegacyTakerFeeTrackerForStakers(ctx sdk.Context) (currentTakerFeeForStakers sdk.Coins)
GetLegacyTakerFeeTrackerForStakers is the legacy getter, to be used in the v22 upgrade handler and removed in v23.
func (Keeper) GetNextPoolId ¶
GetNextPoolId returns the next pool id.
func (Keeper) GetOsmoVolumeForPool ¶
GetOsmoVolumeForPool gets the total OSMO-denominated historical volume for a given 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) GetPoolModuleAndPool ¶
func (*Keeper) GetPoolType ¶
func (Keeper) GetRegisteredAlloyedPoolFromDenomUNSAFE ¶
func (k Keeper) GetRegisteredAlloyedPoolFromDenomUNSAFE(alloyedDenom string) (types.AlloyContractTakerFeeShareState, bool)
GetRegisteredAlloyedPoolFromDenomUNSAFE is used to expose an internal method to gRPC query. This method should not be used in other modules, since the cache is not populated in those keepers. Used in the RegisteredAlloyedPoolFromDenomRequest gRPC query.
func (Keeper) GetRegisteredAlloyedPoolFromPoolIdUNSAFE ¶
func (k Keeper) GetRegisteredAlloyedPoolFromPoolIdUNSAFE(ctx sdk.Context, poolId uint64) (types.AlloyContractTakerFeeShareState, error)
GetRegisteredAlloyedPoolFromPoolIdUNSAFE is used to expose an internal method to gRPC query. This method should not be used in other modules, since the cache is not populated in those keepers. Used in the RegisteredAlloyedPoolFromPoolIdRequest gRPC query.
func (Keeper) GetTakerFeeShareAgreementFromDenomNoCache ¶
func (k Keeper) GetTakerFeeShareAgreementFromDenomNoCache(ctx sdk.Context, takerFeeShareDenom string) (types.TakerFeeShareAgreement, bool)
GetTakerFeeShareAgreementFromDenom retrieves a specific taker fee share agreement from the store, bypassing cache.
func (Keeper) GetTakerFeeShareAgreementFromDenomUNSAFE ¶
func (k Keeper) GetTakerFeeShareAgreementFromDenomUNSAFE(takerFeeShareDenom string) (types.TakerFeeShareAgreement, bool)
GetTakerFeeShareAgreementFromDenomUNSAFE is used to expose an internal method to gRPC query. This method should not be used in other modules, since the cache is not populated in those keepers. Used in the TakerFeeShareAgreementFromDenomRequest gRPC query.
func (Keeper) GetTakerFeeShareDenomsToAccruedValue ¶
func (k Keeper) GetTakerFeeShareDenomsToAccruedValue(ctx sdk.Context, takerFeeShareDenom string, takerFeeChargedDenom string) (osmomath.Int, error)
GetTakerFeeShareDenomsToAccruedValue retrieves the accrued value for a specific taker fee share denomination and taker fee charged denomination from the store. Used in the TakerFeeShareDenomsToAccruedValueRequest gRPC query.
func (Keeper) GetTakerFeeTrackerForCommunityPool ¶
GetTakerFeeTrackerForCommunityPool returns the taker fee for community pool tracker for all denoms that has been collected since the accounting height.
func (Keeper) GetTakerFeeTrackerForCommunityPoolByDenom ¶
func (k Keeper) GetTakerFeeTrackerForCommunityPoolByDenom(ctx sdk.Context, denom string) (sdk.Coin, error)
GetTakerFeeTrackerForCommunityPoolByDenom returns the taker fee for community pool tracker for the specified denom that has been collected since the accounting height. If the denom is not found, a zero coin is returned.
func (Keeper) GetTakerFeeTrackerForStakers ¶
GetTakerFeeTrackerForStakers returns the taker fee for stakers tracker for all denoms that has been collected since the accounting height.
func (Keeper) GetTakerFeeTrackerForStakersByDenom ¶
func (k Keeper) GetTakerFeeTrackerForStakersByDenom(ctx sdk.Context, denom string) (sdk.Coin, error)
GetTakerFeeTrackerForStakersByDenom returns the taker fee for stakers tracker for the specified denom that has been collected since the accounting height. If the denom is not found, a zero coin is returned.
func (Keeper) GetTakerFeeTrackerStartHeight ¶
GetTakerFeeTrackerStartHeight gets the height from which we started accounting for taker fees.
func (Keeper) GetTotalPoolLiquidity ¶
GetTotalPoolLiquidity gets the total liquidity for a given poolId.
func (Keeper) GetTotalVolumeForPool ¶
GetTotalVolumeForPool gets the total historical volume in all supported denominations for a given pool ID.
func (Keeper) GetTradingPairTakerFee ¶
func (k Keeper) GetTradingPairTakerFee(ctx sdk.Context, tokenInDenom, tokenOutDenom 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. The order of the trading pair matters.
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) ListPoolsByDenom ¶
ListPoolsByDenom returns all pools by denom sorted by their ids from every pool module registered in the pool manager keeper. N.B. It is possible for incorrectly implemented pools to be skipped
func (Keeper) MultihopEstimateInGivenExactAmountOut ¶
func (Keeper) MultihopEstimateOutGivenExactAmountIn ¶
func (Keeper) MultihopEstimateOutGivenExactAmountInNoTakerFee ¶
func (*Keeper) ResetCaches ¶
func (k *Keeper) ResetCaches()
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) SetParam ¶
SetParam sets a specific poolmanger module's parameter with the provided parameter.
func (*Keeper) SetPoolIncentivesKeeper ¶
func (k *Keeper) SetPoolIncentivesKeeper(poolIncentivesKeeper types.PoolIncentivesKeeperI)
SetPoolIncentivesKeeper sets pool incentives keeper
func (*Keeper) SetPoolRoute ¶
func (*Keeper) SetProtorevKeeper ¶
func (k *Keeper) SetProtorevKeeper(protorevKeeper types.ProtorevKeeper)
SetProtorevKeeper sets protorev keeper
func (*Keeper) SetStakingKeeper ¶
func (k *Keeper) SetStakingKeeper(stakingKeeper types.StakingKeeper)
SetStakingKeeper sets staking keeper
func (*Keeper) SetTakerFeeShareAgreementForDenom ¶
func (k *Keeper) SetTakerFeeShareAgreementForDenom(ctx sdk.Context, takerFeeShare types.TakerFeeShareAgreement) error
SetTakerFeeShareAgreementForDenom is used for setting a specific taker fee share agreement in the store. Used in the MsgSetTakerFeeShareAgreementForDenom, by the gov address only.
func (Keeper) SetTakerFeeShareDenomsToAccruedValue ¶
func (k Keeper) SetTakerFeeShareDenomsToAccruedValue(ctx sdk.Context, takerFeeShareDenom string, takerFeeChargedDenom string, accruedValue osmomath.Int) error
SetTakerFeeShareDenomsToAccruedValue sets the accrued value for a specific taker fee share denomination and taker fee charged denomination in the store.
func (Keeper) SetTakerFeeTrackerStartHeight ¶
SetTakerFeeTrackerStartHeight sets the height from which we started accounting for taker fees.
func (Keeper) SetVolume ¶
SetVolume sets the given volume to the global tracked volume for the given pool ID. Note that this function is exported for cross-module testing purposes and should not be called directly from other modules.
func (*Keeper) SetWasmKeeper ¶
func (k *Keeper) SetWasmKeeper(wasmKeeper types.WasmKeeper)
SetWasmKeeper sets wasm keeper
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, takerFeeCharged sdk.Coin, 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.
func (Keeper) TakerFeeSkim ¶
func (k Keeper) TakerFeeSkim(ctx sdk.Context, denomsInvolvedInRoute []string, totalTakerFees sdk.Coins) error
TakerFeeSkim calculates the taker fee share for each denomination involved in a route and increases the accumulator for the respective denomination pair. The function first sorts the denominations lexicographically and then checks for denomShareAgreement and alloyedAssetShareAgreement denoms. DenomShareAgreement denoms represent a denom that has a taker fee share agreement with the Osmosis protocol, while alloyedAssetShareAgreement denoms represent a registered alloyed asset pool composed of one or more denoms with a denomShareAgreement. If there are one or more denomShareAgreement denoms, the function calculates the percentage of the taker fees that should be skimmed off and increases the accumulator for the denomShareAgreement denom / taker fee denomination pair. If there were no denomShareAgreement denoms but there are one or more alloyedAssetShareAgreement denoms, the function calculates the taker fee share for the alloyed asset for each underlying asset that has a taker fee share agreement. The function returns an error if the total taker fee share percentage is greater than 1.
Parameters: - ctx: The context of the function call. - denomsInvolvedInRoute: A slice of strings representing the denominations involved in the route. - totalTakerFees: The total taker fees from the swap represented as sdk.Coins.
Returns: - An error if the total taker fee share percentage is greater than 1, or if there's an error in increasing the accumulator for the denomination pair.
func (Keeper) TotalLiquidity ¶
TotalLiquidity gets the total liquidity across all pools.
func (Keeper) UpdateTakerFeeTrackerForCommunityPoolByDenom ¶
func (k Keeper) UpdateTakerFeeTrackerForCommunityPoolByDenom(ctx sdk.Context, denom string, increasedAmt osmomath.Int) error
UpdateTakerFeeTrackerForCommunityPoolByDenom increases the take fee for community pool tracker for the specified denom by the specified amount.
func (Keeper) UpdateTakerFeeTrackerForStakersByDenom ¶
func (k Keeper) UpdateTakerFeeTrackerForStakersByDenom(ctx sdk.Context, denom string, increasedAmt osmomath.Int) error
UpdateTakerFeeTrackerForStakersByDenom increases the take fee for stakers tracker for the specified denom by the specified amount.