Documentation ¶
Index ¶
- func AllInvariants(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- func NewBalancerMsgServerImpl(keeper *Keeper) balancer.MsgServer
- func NewMsgServerImpl(keeper *Keeper) types.MsgServer
- func NewStableswapMsgServerImpl(keeper *Keeper) stableswap.MsgServer
- func PoolAccountInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper, bk types.BankKeeper)
- type Keeper
- func (k Keeper) BurnPoolShareFromAccount(ctx sdk.Context, pool poolmanagertypes.PoolI, addr sdk.AccAddress, ...) error
- func (k Keeper) CalcInAmtGivenOut(ctx sdk.Context, poolI poolmanagertypes.PoolI, tokenOut sdk.Coin, ...) (tokenIn sdk.Coin, err error)
- func (k Keeper) CalcOutAmtGivenIn(ctx sdk.Context, poolI poolmanagertypes.PoolI, tokenIn sdk.Coin, ...) (tokenOut sdk.Coin, err error)
- func (k Keeper) CalculateSpotPrice(ctx sdk.Context, poolID uint64, quoteAssetDenom string, baseAssetDenom string) (spotPrice osmomath.BigDec, err error)
- func (k Keeper) CreateCanonicalConcentratedLiquidityPoolAndMigrationLink(ctx sdk.Context, cfmmPoolId uint64, desiredDenom0 string, ...) (poolmanagertypes.PoolI, error)
- func (k Keeper) CreateConcentratedPoolFromCFMM(ctx sdk.Context, cfmmPoolIdToLinkWith uint64, desiredDenom0 string, ...) (poolmanagertypes.PoolI, error)
- func (k Keeper) DeletePool(ctx sdk.Context, poolId uint64) error
- func (k Keeper) ExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, ...) (exitCoins sdk.Coins, err error)
- func (k Keeper) ExitSwapExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenOut sdk.Coin, ...) (shareInAmount osmomath.Int, err error)
- func (k Keeper) ExitSwapShareAmountIn(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenOutDenom string, ...) (tokenOutAmount osmomath.Int, err error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllMigrationInfo(ctx sdk.Context) (gammmigration.MigrationRecords, error)
- func (k Keeper) GetCFMMPool(ctx sdk.Context, poolId uint64) (types.CFMMPoolI, error)
- func (k Keeper) GetDenomLiquidity(ctx sdk.Context, denom string) osmomath.Int
- func (k Keeper) GetLinkedBalancerPoolID(ctx sdk.Context, concentratedPoolId uint64) (uint64, error)
- func (k Keeper) GetLinkedConcentratedPoolID(ctx sdk.Context, balancerPoolId uint64) (uint64, error)
- func (k Keeper) GetNextPoolId(ctx sdk.Context) uint64deprecated
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (poolmanagertypes.PoolI, error)
- func (k Keeper) GetPoolAndPoke(ctx sdk.Context, poolId uint64) (types.CFMMPoolI, error)
- func (k Keeper) GetPoolDenoms(ctx sdk.Context, poolId uint64) ([]string, error)
- func (k Keeper) GetPoolType(ctx sdk.Context, poolId uint64) (poolmanagertypes.PoolType, error)
- func (k Keeper) GetPools(ctx sdk.Context) ([]poolmanagertypes.PoolI, error)
- func (k Keeper) GetPoolsAndPoke(ctx sdk.Context) (res []types.CFMMPoolI, err error)
- func (k Keeper) GetTotalLiquidity(ctx sdk.Context) (sdk.Coins, error)
- func (k Keeper) GetTotalPoolLiquidity(ctx sdk.Context, poolId uint64) (sdk.Coins, error)
- func (k Keeper) GetTotalPoolShares(ctx sdk.Context, poolId uint64) (osmomath.Int, error)
- func (k Keeper) GetTradingPairTakerFee(ctx sdk.Context, denom0, denom1 string) (osmomath.Dec, error)
- func (k Keeper) HandleReplaceMigrationRecordsProposal(ctx sdk.Context, p *types.ReplaceMigrationRecordsProposal) error
- func (k Keeper) HandleSetScalingFactorControllerProposal(ctx sdk.Context, p *types.SetScalingFactorControllerProposal) error
- func (k Keeper) HandleUpdateMigrationRecordsProposal(ctx sdk.Context, p *types.UpdateMigrationRecordsProposal) error
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState, unpacker codectypes.AnyUnpacker)
- func (k Keeper) InitializePool(ctx sdk.Context, pool poolmanagertypes.PoolI, sender sdk.AccAddress) (err error)
- func (k Keeper) IterateDenomLiquidity(ctx sdk.Context, cb func(sdk.Coin) bool)
- func (k Keeper) JoinPoolNoSwap(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, ...) (tokenIn sdk.Coins, sharesOut osmomath.Int, err error)
- func (k Keeper) JoinSwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokensIn sdk.Coins, ...) (sharesOut osmomath.Int, err error)
- func (k Keeper) JoinSwapShareAmountOut(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenInDenom string, ...) (tokenInAmount osmomath.Int, err error)
- func (k Keeper) MarshalPool(pool poolmanagertypes.PoolI) ([]byte, error)
- func (k Keeper) MigrateUnlockedPositionFromBalancerToConcentrated(ctx sdk.Context, sender sdk.AccAddress, sharesToMigrate sdk.Coin, ...) (cltypes.CreateFullRangePositionData, superfluidtypes.MigrationPoolIDs, error)
- func (k Keeper) MintPoolShareToAccount(ctx sdk.Context, pool poolmanagertypes.PoolI, addr sdk.AccAddress, ...) error
- func (k Keeper) OverwriteMigrationRecords(ctx sdk.Context, migrationInfo gammmigration.MigrationRecords) error
- func (k Keeper) OverwritePoolV15MigrationUnsafe(ctx sdk.Context, pool poolmanagertypes.PoolI) error
- func (k Keeper) RecordTotalLiquidityDecrease(ctx sdk.Context, coins sdk.Coins)
- func (k Keeper) RecordTotalLiquidityIncrease(ctx sdk.Context, coins sdk.Coins)
- func (k Keeper) ReplaceMigrationRecords(ctx sdk.Context, records []gammmigration.BalancerToConcentratedPoolLink) error
- func (k *Keeper) SetHooks(gh types.GammHooks) *Keeper
- func (k *Keeper) SetIncentivesKeeper(incentivesKeeper types.IncentivesKeeper)
- func (k Keeper) SetMigrationRecords(ctx sdk.Context, migrationInfo gammmigration.MigrationRecords)
- func (k Keeper) SetParam(ctx sdk.Context, key []byte, value interface{})
- func (k *Keeper) SetPoolIncentivesKeeper(poolIncentivesKeeper types.PoolIncentivesKeeper)
- func (k *Keeper) SetPoolManager(poolManager types.PoolManager)
- func (k Keeper) SwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, pool poolmanagertypes.PoolI, ...) (tokenOutAmount osmomath.Int, err error)
- func (k Keeper) SwapExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, pool poolmanagertypes.PoolI, ...) (tokenInAmount osmomath.Int, err error)
- func (k Keeper) UnmarshalPool(bz []byte) (types.CFMMPoolI, error)
- func (k Keeper) UpdateMigrationRecords(ctx sdk.Context, records []gammmigration.BalancerToConcentratedPoolLink) error
- type Querier
- func (q Querier) CFMMConcentratedPoolLinks(ctx context.Context, req *types.QueryCFMMConcentratedPoolLinksRequest) (*types.QueryCFMMConcentratedPoolLinksResponse, error)
- func (q Querier) CalcExitPoolCoinsFromShares(ctx context.Context, req *types.QueryCalcExitPoolCoinsFromSharesRequest) (*types.QueryCalcExitPoolCoinsFromSharesResponse, error)
- func (q Querier) CalcJoinPoolNoSwapShares(ctx context.Context, req *types.QueryCalcJoinPoolNoSwapSharesRequest) (*types.QueryCalcJoinPoolNoSwapSharesResponse, error)
- func (q Querier) CalcJoinPoolShares(ctx context.Context, req *types.QueryCalcJoinPoolSharesRequest) (*types.QueryCalcJoinPoolSharesResponse, error)
- func (q Querier) ConcentratedPoolIdLinkFromCFMM(ctx context.Context, req *types.QueryConcentratedPoolIdLinkFromCFMMRequest) (*types.QueryConcentratedPoolIdLinkFromCFMMResponse, error)
- func (q Querier) EstimateSwapExactAmountIn(ctx context.Context, req *types.QuerySwapExactAmountInRequest) (*types.QuerySwapExactAmountInResponse, error)
- func (q Querier) EstimateSwapExactAmountOut(ctx context.Context, req *types.QuerySwapExactAmountOutRequest) (*types.QuerySwapExactAmountOutResponse, error)
- func (q Querier) NumPools(ctx context.Context, _ *types.QueryNumPoolsRequest) (*types.QueryNumPoolsResponse, error)
- func (q Querier) Pool(ctx context.Context, req *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
- func (q Querier) PoolParams(ctx context.Context, req *types.QueryPoolParamsRequest) (*types.QueryPoolParamsResponse, error)
- func (q Querier) PoolType(ctx context.Context, req *types.QueryPoolTypeRequest) (*types.QueryPoolTypeResponse, error)
- func (q Querier) Pools(ctx context.Context, req *types.QueryPoolsRequest) (*types.QueryPoolsResponse, error)
- func (q Querier) PoolsWithFilter(ctx context.Context, req *types.QueryPoolsWithFilterRequest) (*types.QueryPoolsWithFilterResponse, error)
- func (q Querier) SpotPrice(ctx context.Context, req *types.QuerySpotPriceRequest) (*types.QuerySpotPriceResponse, error)
- func (q Querier) TotalLiquidity(ctx context.Context, _ *types.QueryTotalLiquidityRequest) (*types.QueryTotalLiquidityResponse, error)
- func (q Querier) TotalPoolLiquidity(ctx context.Context, req *types.QueryTotalPoolLiquidityRequest) (*types.QueryTotalPoolLiquidityResponse, error)
- func (q Querier) TotalShares(ctx context.Context, req *types.QueryTotalSharesRequest) (*types.QueryTotalSharesResponse, error)
- type QuerierV2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
func AllInvariants(keeper Keeper, bk types.BankKeeper) sdk.Invariant
AllInvariants runs all invariants of the gamm module
func NewMsgServerImpl ¶
func NewStableswapMsgServerImpl ¶
func NewStableswapMsgServerImpl(keeper *Keeper) stableswap.MsgServer
func PoolAccountInvariant ¶
func PoolAccountInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant
PoolAccountInvariant checks that the pool account balance reflects the sum of pool assets
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper, bk types.BankKeeper)
RegisterInvariants registers all gamm invariants.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, storeKey sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, communityPoolKeeper types.CommunityPoolKeeper, concentratedLiquidityKeeper types.ConcentratedLiquidityKeeper, poolIncentivesKeeper types.PoolIncentivesKeeper, incentivesKeeper types.IncentivesKeeper) Keeper
func (Keeper) BurnPoolShareFromAccount ¶
func (k Keeper) BurnPoolShareFromAccount(ctx sdk.Context, pool poolmanagertypes.PoolI, addr sdk.AccAddress, amount osmomath.Int) error
BurnPoolShareFromAccount burns `amount` of the given pools shares held by `addr`.
func (Keeper) CalcInAmtGivenOut ¶
func (k Keeper) CalcInAmtGivenOut( ctx sdk.Context, poolI poolmanagertypes.PoolI, tokenOut sdk.Coin, tokenInDenom string, spreadFactor osmomath.Dec, ) (tokenIn sdk.Coin, err error)
CalcInAmtGivenOut calculates the amount of tokenIn given tokenOut and the pool's current state. Returns error if the given pool is not a CFMM pool. Returns error on internal calculations.
func (Keeper) CalcOutAmtGivenIn ¶
func (k Keeper) CalcOutAmtGivenIn( ctx sdk.Context, poolI poolmanagertypes.PoolI, tokenIn sdk.Coin, tokenOutDenom string, spreadFactor osmomath.Dec, ) (tokenOut sdk.Coin, err error)
CalcOutAmtGivenIn calculates the amount of tokenOut given tokenIn and the pool's current state. Returns error if the given pool is not a CFMM pool. Returns error on internal calculations.
func (Keeper) CalculateSpotPrice ¶
func (k Keeper) CalculateSpotPrice( ctx sdk.Context, poolID uint64, quoteAssetDenom string, baseAssetDenom string, ) (spotPrice osmomath.BigDec, err error)
CalculateSpotPrice returns the spot price of the quote asset in terms of the base asset, using the specified pool. E.g. if pool 1 trades 2 atom for 3 osmo, the quote asset was atom, and the base asset was osmo, this would return 1.5. (Meaning that 1 atom costs 1.5 osmo)
This function is guaranteed to not panic, but may return an error if: * An internal error within the pool occurs for calculating the spot price * The returned spot price is greater than max spot price
func (Keeper) CreateCanonicalConcentratedLiquidityPoolAndMigrationLink ¶
func (k Keeper) CreateCanonicalConcentratedLiquidityPoolAndMigrationLink(ctx sdk.Context, cfmmPoolId uint64, desiredDenom0 string, spreadFactor osmomath.Dec, tickSpacing uint64) (poolmanagertypes.PoolI, error)
createCanonicalConcentratedLiquidityPoolAndMigrationLink creates a new concentrated liquidity pool from an existing CFMM pool. This method calls OverwriteMigrationRecords, which creates a migration link between the CFMM/CL pool as well as migrates the gauges and distribution records from the CFMM pool to the new CL pool. Returns error if fails to create concentrated liquidity pool from CFMM pool.
func (Keeper) CreateConcentratedPoolFromCFMM ¶
func (k Keeper) CreateConcentratedPoolFromCFMM(ctx sdk.Context, cfmmPoolIdToLinkWith uint64, desiredDenom0 string, spreadFactor osmomath.Dec, tickSpacing uint64) (poolmanagertypes.PoolI, error)
createConcentratedPoolFromCFMM creates a new concentrated liquidity pool with the desiredDenom0 token as the token 0, links it with an existing CFMM pool, and returns the created pool. It uses pool manager module account as the creator of the pool. Returns error if desired denom 0 is not in associated with the CFMM pool. Returns error if CFMM pool does not have exactly 2 denoms. Returns error if pool creation fails.
func (Keeper) ExitSwapExactAmountOut ¶
func (Keeper) ExitSwapShareAmountIn ¶
func (k Keeper) ExitSwapShareAmountIn( ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenOutDenom string, shareInAmount osmomath.Int, tokenOutMinAmount osmomath.Int, ) (tokenOutAmount osmomath.Int, err error)
ExitSwapShareAmountIn is an Exit Pool transaction, that will exit all of the provided LP shares, and then swap it all against the pool into tokenOutDenom. If the amount of tokens gotten out after the swap is less than tokenOutMinAmount, return an error.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the capability module's exported genesis.
func (Keeper) GetAllMigrationInfo ¶
func (k Keeper) GetAllMigrationInfo(ctx sdk.Context) (gammmigration.MigrationRecords, error)
GetAllMigrationInfo gets all existing links between Balancer Pool and Concentrated Pool, wraps and returns them in `MigrationRecords`.
func (Keeper) GetCFMMPool ¶
GetCFMMPool gets CFMMPool and checks if the pool is active, i.e. allowed to be swapped against. The difference from GetPools is that this function returns an error if the pool is inactive. Additionally, it returns x/gamm specific CFMMPool type.
func (Keeper) GetDenomLiquidity ¶
func (Keeper) GetLinkedBalancerPoolID ¶
GetLinkedConcentratedPoolID returns the Balancer pool Id linked for the given concentrated pool Id. Returns error if link for the given pool id does not exist.
func (Keeper) GetLinkedConcentratedPoolID ¶
GetLinkedConcentratedPoolID returns the concentrated pool Id linked for the given balancer pool Id. Returns error if link for the given pool id does not exist.
func (Keeper) GetNextPoolId
deprecated
func (Keeper) GetPoolAndPoke ¶
GetPoolAndPoke returns a PoolI based on it's identifier if one exists. If poolId corresponds to a pool with weights (e.g. balancer), the weights of the pool are updated via PokePool prior to returning. TODO: Consider rename to GetPool due to downstream API confusion.
func (Keeper) GetPoolDenoms ¶
GetPoolDenom retrieves the pool based on PoolId and returns the coin denoms that it holds.
func (Keeper) GetPoolType ¶
func (Keeper) GetPoolsAndPoke ¶
func (Keeper) GetTotalLiquidity ¶
func (Keeper) GetTotalPoolLiquidity ¶
GetTotalPoolLiquidity returns the coins in the pool owned by all LPs
func (Keeper) GetTotalPoolShares ¶
GetTotalPoolShares returns the total number of pool shares for the given pool.
func (Keeper) GetTradingPairTakerFee ¶
func (k Keeper) GetTradingPairTakerFee(ctx sdk.Context, denom0, denom1 string) (osmomath.Dec, error)
GetTradingPairTakerFee is a wrapper for poolmanager's GetTradingPairTakerFee, and is solely used to get access to this method for use in sim_msgs.go for the GAMM module.
func (Keeper) HandleReplaceMigrationRecordsProposal ¶
func (Keeper) HandleSetScalingFactorControllerProposal ¶
func (Keeper) HandleUpdateMigrationRecordsProposal ¶
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState, unpacker codectypes.AnyUnpacker)
InitGenesis initializes the x/gamm module's state from a provided genesis state, which includes the current live pools, global pool parameters (e.g. pool creation fee), next pool id etc.
func (Keeper) InitializePool ¶
func (k Keeper) InitializePool(ctx sdk.Context, pool poolmanagertypes.PoolI, sender sdk.AccAddress) (err error)
This function: - saves the pool to state - Mints LP shares to the pool creator - Sets bank metadata for the LP denom - Records total liquidity increase - Calls the AfterPoolCreated hook
func (Keeper) IterateDenomLiquidity ¶
func (Keeper) JoinPoolNoSwap ¶
func (k Keeper) JoinPoolNoSwap( ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareOutAmount osmomath.Int, tokenInMaxs sdk.Coins, ) (tokenIn sdk.Coins, sharesOut osmomath.Int, err error)
JoinPoolNoSwap aims to LP exactly enough to pool #{poolId} to get shareOutAmount number of LP shares. If the required tokens is greater than tokenInMaxs, returns an error & the message reverts. Leftover tokens that weren't LP'd (due to being at inexact ratios) remain in the sender account.
JoinPoolNoSwap determines the maximum amount that can be LP'd without any swap, by looking at the ratio of the total LP'd assets. (e.g. 2 osmo : 1 atom) It then finds the maximal amount that can be LP'd.
func (Keeper) JoinSwapExactAmountIn ¶
func (k Keeper) JoinSwapExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokensIn sdk.Coins, shareOutMinAmount osmomath.Int, ) (sharesOut osmomath.Int, err error)
JoinSwapExactAmountIn is an LP transaction, that will LP all of the provided tokensIn coins. The underlying pool is responsible for swapping any non-even LP proportions to the correct ratios. An error is returned if the amount of LP shares obtained at the end is less than shareOutMinAmount. Otherwise, we return the total amount of shares outgoing from joining the pool.
func (Keeper) JoinSwapShareAmountOut ¶
func (Keeper) MarshalPool ¶
func (k Keeper) MarshalPool(pool poolmanagertypes.PoolI) ([]byte, error)
func (Keeper) MigrateUnlockedPositionFromBalancerToConcentrated ¶
func (k Keeper) MigrateUnlockedPositionFromBalancerToConcentrated(ctx sdk.Context, sender sdk.AccAddress, sharesToMigrate sdk.Coin, tokenOutMins sdk.Coins, ) (cltypes.CreateFullRangePositionData, superfluidtypes.MigrationPoolIDs, error)
MigrateUnlockedPositionFromBalancerToConcentrated migrates unlocked lp tokens from a balancer pool to a concentrated liquidity pool. Fails if the lp tokens are locked (must instead utilize UnlockAndMigrate function in the superfluid module)
func (Keeper) MintPoolShareToAccount ¶
func (k Keeper) MintPoolShareToAccount(ctx sdk.Context, pool poolmanagertypes.PoolI, addr sdk.AccAddress, amount osmomath.Int) error
MintPoolShareToAccount attempts to mint shares of a GAMM denomination to the specified address returning an error upon failure. Shares are minted using the x/gamm module account.
func (Keeper) OverwriteMigrationRecords ¶
func (k Keeper) OverwriteMigrationRecords(ctx sdk.Context, migrationInfo gammmigration.MigrationRecords) error
OverwriteMigrationRecords sets the balancer to gamm pool migration info to the store and deletes all existing records migrationInfo in state is completely overwritten by the given migrationInfo.
func (Keeper) OverwritePoolV15MigrationUnsafe ¶
OverwritePoolV15MigrationUnsafe is a temporary method for calling from the v15 upgrade handler for balancer to stableswap pool migration. Do not use for other purposes.
func (Keeper) RecordTotalLiquidityDecrease ¶
func (Keeper) RecordTotalLiquidityIncrease ¶
func (Keeper) ReplaceMigrationRecords ¶
func (k Keeper) ReplaceMigrationRecords(ctx sdk.Context, records []gammmigration.BalancerToConcentratedPoolLink) error
ReplaceMigrationRecords gets the current migration records and replaces it in its entirety with the provided records. It is checked for no err when a proposal is made, and executed when a proposal passes.
func (*Keeper) SetIncentivesKeeper ¶
func (k *Keeper) SetIncentivesKeeper(incentivesKeeper types.IncentivesKeeper)
Set the incentives keeper.
func (Keeper) SetMigrationRecords ¶
func (k Keeper) SetMigrationRecords(ctx sdk.Context, migrationInfo gammmigration.MigrationRecords)
SetMigrationRecords is used in initGenesis, setting the balancer to gamm pool migration info in store.
func (Keeper) SetParam ¶
SetParam sets a specific gamm module's parameter with the provided parameter.
func (*Keeper) SetPoolIncentivesKeeper ¶
func (k *Keeper) SetPoolIncentivesKeeper(poolIncentivesKeeper types.PoolIncentivesKeeper)
Set the pool incentives keeper.
func (*Keeper) SetPoolManager ¶
func (k *Keeper) SetPoolManager(poolManager types.PoolManager)
func (Keeper) SwapExactAmountIn ¶
func (k Keeper) SwapExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, pool poolmanagertypes.PoolI, tokenIn sdk.Coin, tokenOutDenom string, tokenOutMinAmount osmomath.Int, spreadFactor osmomath.Dec, ) (tokenOutAmount osmomath.Int, err error)
swapExactAmountIn is an internal method for swapping an exact amount of tokens as input to a pool, using the provided spreadFactor. This is intended to allow different spread factors as determined by multi-hops, or when recovering from chain liveness failures. TODO: investigate if spreadFactor can be unexported https://github.com/osmosis-labs/osmosis/issues/3130
func (Keeper) SwapExactAmountOut ¶
func (k Keeper) SwapExactAmountOut( ctx sdk.Context, sender sdk.AccAddress, pool poolmanagertypes.PoolI, tokenInDenom string, tokenInMaxAmount osmomath.Int, tokenOut sdk.Coin, spreadFactor osmomath.Dec, ) (tokenInAmount osmomath.Int, err error)
SwapExactAmountOut is a method for swapping to get an exact number of tokens out of a pool, using the provided spreadFactor. This is intended to allow different spread factors as determined by multi-hops, or when recovering from chain liveness failures.
func (Keeper) UpdateMigrationRecords ¶
func (k Keeper) UpdateMigrationRecords(ctx sdk.Context, records []gammmigration.BalancerToConcentratedPoolLink) error
UpdateMigrationRecords gets the current migration records and only updates the records that are provided. It is checked for no err when a proposal is made, and executed when a proposal passes.
type Querier ¶
type Querier struct {
Keeper
}
Querier defines a wrapper around the x/gamm keeper providing gRPC method handlers.
func NewQuerier ¶
func (Querier) CFMMConcentratedPoolLinks ¶
func (q Querier) CFMMConcentratedPoolLinks(ctx context.Context, req *types.QueryCFMMConcentratedPoolLinksRequest) (*types.QueryCFMMConcentratedPoolLinksResponse, error)
func (Querier) CalcExitPoolCoinsFromShares ¶
func (q Querier) CalcExitPoolCoinsFromShares(ctx context.Context, req *types.QueryCalcExitPoolCoinsFromSharesRequest) (*types.QueryCalcExitPoolCoinsFromSharesResponse, error)
CalcExitPoolCoinsFromShares queries the amount of tokens you get by exiting a specific amount of shares
func (Querier) CalcJoinPoolNoSwapShares ¶
func (q Querier) CalcJoinPoolNoSwapShares(ctx context.Context, req *types.QueryCalcJoinPoolNoSwapSharesRequest) (*types.QueryCalcJoinPoolNoSwapSharesResponse, error)
CalcJoinPoolNoSwapShares returns the amount of shares you'd get if joined a pool without a swap and tokens which need to be provided
func (Querier) CalcJoinPoolShares ¶
func (q Querier) CalcJoinPoolShares(ctx context.Context, req *types.QueryCalcJoinPoolSharesRequest) (*types.QueryCalcJoinPoolSharesResponse, error)
CalcJoinPoolShares queries the amount of shares you get by providing specific amount of tokens
func (Querier) ConcentratedPoolIdLinkFromCFMM ¶
func (q Querier) ConcentratedPoolIdLinkFromCFMM(ctx context.Context, req *types.QueryConcentratedPoolIdLinkFromCFMMRequest) (*types.QueryConcentratedPoolIdLinkFromCFMMResponse, error)
ConcentratedPoolIdLinkFromCFMM queries the concentrated pool id linked to a cfmm pool id.
func (Querier) EstimateSwapExactAmountIn ¶
func (q Querier) EstimateSwapExactAmountIn(ctx context.Context, req *types.QuerySwapExactAmountInRequest) (*types.QuerySwapExactAmountInResponse, error)
EstimateSwapExactAmountIn estimates input token amount for a swap. This query is deprecated and has been moved to poolmanager module. nolint: staticcheck
func (Querier) EstimateSwapExactAmountOut ¶
func (q Querier) EstimateSwapExactAmountOut(ctx context.Context, req *types.QuerySwapExactAmountOutRequest) (*types.QuerySwapExactAmountOutResponse, error)
EstimateSwapExactAmountOut estimates token output amount for a swap. This query is deprecated and has been moved to poolmanager module. nolint: staticcheck
func (Querier) NumPools ¶
func (q Querier) NumPools(ctx context.Context, _ *types.QueryNumPoolsRequest) (*types.QueryNumPoolsResponse, error)
This query has been deprecated and has been moved to poolmanager module. nolint: staticcheck
func (Querier) Pool ¶
func (q Querier) Pool( ctx context.Context, req *types.QueryPoolRequest, ) (*types.QueryPoolResponse, error)
Pool checks if a pool exists and their respective poolWeights. Deprecated: use x/poolmanager's Pool query. nolint: staticcheck
func (Querier) PoolParams ¶
func (q Querier) PoolParams(ctx context.Context, req *types.QueryPoolParamsRequest) (*types.QueryPoolParamsResponse, error)
PoolParams queries a specified pool for its params.
func (Querier) PoolType ¶
func (q Querier) PoolType(ctx context.Context, req *types.QueryPoolTypeRequest) (*types.QueryPoolTypeResponse, error)
func (Querier) Pools ¶
func (q Querier) Pools( ctx context.Context, req *types.QueryPoolsRequest, ) (*types.QueryPoolsResponse, error)
Pools checks existence of multiple pools and their poolWeights
func (Querier) PoolsWithFilter ¶
func (q Querier) PoolsWithFilter(ctx context.Context, req *types.QueryPoolsWithFilterRequest) (*types.QueryPoolsWithFilterResponse, error)
PoolsWithFilter query allows to query pools with specific parameters
func (Querier) SpotPrice ¶
func (q Querier) SpotPrice(ctx context.Context, req *types.QuerySpotPriceRequest) (*types.QuerySpotPriceResponse, error)
SpotPrice returns target pool asset prices on base and quote assets. nolint: staticcheck
func (Querier) TotalLiquidity ¶
func (q Querier) TotalLiquidity(ctx context.Context, _ *types.QueryTotalLiquidityRequest) (*types.QueryTotalLiquidityResponse, error)
TotalLiquidity returns total liquidity across all gamm pools.
func (Querier) TotalPoolLiquidity ¶
func (q Querier) TotalPoolLiquidity(ctx context.Context, req *types.QueryTotalPoolLiquidityRequest) (*types.QueryTotalPoolLiquidityResponse, error)
TotalPoolLiquidity returns total liquidity in pool. Deprecated: please use the alternative in x/poolmanager nolint: staticcheck
func (Querier) TotalShares ¶
func (q Querier) TotalShares(ctx context.Context, req *types.QueryTotalSharesRequest) (*types.QueryTotalSharesResponse, error)
TotalShares returns total pool shares.
type QuerierV2 ¶
type QuerierV2 struct {
Keeper
}
QuerierV2 defines a wrapper around the x/gamm keeper providing gRPC method handlers for v2 queries.
func NewV2Querier ¶
func (QuerierV2) SpotPrice ¶
func (q QuerierV2) SpotPrice(ctx context.Context, req *v2types.QuerySpotPriceRequest) (*v2types.QuerySpotPriceResponse, error)
Deeprecated: use alternate in x/poolmanager nolint: staticcheck