Documentation ¶
Index ¶
- func AssetsValue(ctx sdk.Context, oracleKeeper types.OracleKeeper, ...) (sdk.Dec, sdk.Dec, error)
- func LiquidityRatioFromPriceDepth(depth sdk.Dec) sdk.Dec
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func PortionCoins(coins sdk.Coins, portion sdk.Dec) sdk.Coins
- type Keeper
- func (k Keeper) AllSlippageTracks(ctx sdk.Context) []types.OraclePoolSlippageTrack
- func (k Keeper) ApplyExitPoolStateChange(ctx sdk.Context, pool types.Pool, exiter sdk.AccAddress, numShares math.Int, ...) error
- func (k Keeper) ApplySwapRequest(ctx sdk.Context, msg sdk.Msg) error
- func (k Keeper) Balance(goCtx context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error)
- func (k Keeper) BurnPoolShareFromAccount(ctx sdk.Context, pool types.Pool, addr sdk.AccAddress, amount math.Int) error
- func (k Keeper) CalcInAmtGivenOut(ctx sdk.Context, poolId uint64, oracle types.OracleKeeper, ...) (tokenIn sdk.Coin, slippage sdk.Dec, err error)
- func (k Keeper) CalcInRouteByDenom(ctx sdk.Context, denomIn string, denomOut string, baseCurrency string) ([]*types.SwapAmountInRoute, error)
- func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes []*types.SwapAmountInRoute, ...) (sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, ...)
- func (k Keeper) CalcOutAmtGivenIn(ctx sdk.Context, poolId uint64, oracle types.OracleKeeper, ...) (sdk.Coin, sdk.Dec, error)
- func (k Keeper) CalcOutRouteByDenom(ctx sdk.Context, denomOut string, denomIn string, baseCurrency string) ([]*types.SwapAmountOutRoute, error)
- func (k Keeper) CalcOutRouteSpotPrice(ctx sdk.Context, tokenOut sdk.Coin, routes []*types.SwapAmountOutRoute, ...) (sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, ...)
- func (k Keeper) CalcSwapEstimationByDenom(ctx sdk.Context, amount sdk.Coin, denomIn string, denomOut string, ...) (inRoute []*types.SwapAmountInRoute, outRoute []*types.SwapAmountOutRoute, ...)
- func (k Keeper) ClearOutdatedSlippageTrack(ctx sdk.Context)
- func (k Keeper) CreatePool(ctx sdk.Context, msg *types.MsgCreatePool) (uint64, error)
- func (k Keeper) DecreaseDenomLiquidity(ctx sdk.Context, denom string, amount math.Int) error
- func (k Keeper) DeleteSlippageTrack(ctx sdk.Context, track types.OraclePoolSlippageTrack)
- func (k Keeper) DeleteSwapExactAmountInRequest(ctx sdk.Context, msg *types.MsgSwapExactAmountIn, index uint64)
- func (k Keeper) DeleteSwapExactAmountOutRequest(ctx sdk.Context, msg *types.MsgSwapExactAmountOut, index uint64)
- func (k Keeper) DeleteSwapRequest(ctx sdk.Context, msg sdk.Msg, index uint64)
- func (k Keeper) DenomLiquidity(goCtx context.Context, req *types.QueryGetDenomLiquidityRequest) (*types.QueryGetDenomLiquidityResponse, error)
- func (k Keeper) DenomLiquidityAll(goCtx context.Context, req *types.QueryAllDenomLiquidityRequest) (*types.QueryAllDenomLiquidityResponse, error)
- func (k Keeper) EndBlocker(ctx sdk.Context)
- func (k Keeper) EstimatePrice(ctx sdk.Context, tokenInDenom, baseCurrency string) math.LegacyDec
- func (k Keeper) ExecuteSwapRequests(ctx sdk.Context) []sdk.Msg
- func (k Keeper) ExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareInAmount math.Int, ...) (exitCoins sdk.Coins, err error)
- func (k Keeper) ExitPoolEst(ctx sdk.Context, poolId uint64, shareInAmount math.Int, tokenOutDenom string) (exitCoins sdk.Coins, weightBalanceBonus math.LegacyDec, err error)
- func (k Keeper) ExitPoolEstimation(goCtx context.Context, req *types.QueryExitPoolEstimationRequest) (*types.QueryExitPoolEstimationResponse, error)
- func (k Keeper) FirstPoolId(msg sdk.Msg) uint64
- func (k Keeper) GetAllDenomLiquidity(ctx sdk.Context) (list []types.DenomLiquidity)
- func (k Keeper) GetAllPool(ctx sdk.Context) (list []types.Pool)
- func (k Keeper) GetAllSwapExactAmountInRequests(ctx sdk.Context) (list []types.MsgSwapExactAmountIn)
- func (k Keeper) GetAllSwapExactAmountOutRequests(ctx sdk.Context) (list []types.MsgSwapExactAmountOut)
- func (k Keeper) GetBestPoolWithDenoms(ctx sdk.Context, denoms []string) (pool types.Pool, found bool)
- func (k Keeper) GetDenomLiquidity(ctx sdk.Context, denom string) (val types.DenomLiquidity, found bool)
- func (k Keeper) GetEdenDenomPrice(ctx sdk.Context, baseCurrency string) math.LegacyDec
- func (k Keeper) GetFirstSlippageTrack(ctx sdk.Context, poolId uint64) types.OraclePoolSlippageTrack
- func (k Keeper) GetFirstSwapExactAmountInRequest(ctx sdk.Context, sprefix []byte) (*types.MsgSwapExactAmountIn, uint64)
- func (k Keeper) GetFirstSwapExactAmountOutRequest(ctx sdk.Context, sprefix []byte) (*types.MsgSwapExactAmountOut, uint64)
- func (k Keeper) GetLastSlippageTrack(ctx sdk.Context, poolId uint64) types.OraclePoolSlippageTrack
- func (k Keeper) GetLastSwapRequestIndex(ctx sdk.Context) uint64
- func (k Keeper) GetLatestPool(ctx sdk.Context) (val types.Pool, found bool)
- 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) (val types.Pool, found bool)
- func (k Keeper) GetPoolSnapshotOrSet(ctx sdk.Context, pool types.Pool) (val types.Pool)
- func (k Keeper) GetSlippageTrack(ctx sdk.Context, poolId uint64, timestamp uint64) types.OraclePoolSlippageTrack
- func (k Keeper) GetStackedSlippage(ctx sdk.Context, poolId uint64) sdk.Dec
- func (k Keeper) GetTokenPrice(ctx sdk.Context, tokenInDenom, baseCurrency string) math.LegacyDec
- func (k Keeper) GetTrackedSlippageDiff(ctx sdk.Context, poolId uint64) sdk.Coins
- func (k Keeper) InRouteByDenom(goCtx context.Context, req *types.QueryInRouteByDenomRequest) (*types.QueryInRouteByDenomResponse, error)
- func (k Keeper) IncreaseDenomLiquidity(ctx sdk.Context, denom string, amount math.Int) error
- func (k Keeper) InitializePool(ctx sdk.Context, pool *types.Pool, sender sdk.AccAddress) (err error)
- func (k Keeper) IterateLiquidityPools(ctx sdk.Context, handlerFn func(pool types.Pool) (stop bool))
- func (k Keeper) JoinPoolEst(ctx sdk.Context, poolId uint64, tokenInMaxs sdk.Coins) (tokensIn sdk.Coins, sharesOut math.Int, slippage sdk.Dec, ...)
- func (k Keeper) JoinPoolEstimation(goCtx context.Context, req *types.QueryJoinPoolEstimationRequest) (*types.QueryJoinPoolEstimationResponse, error)
- func (k Keeper) JoinPoolNoSwap(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareOutAmount math.Int, ...) (tokenIn sdk.Coins, sharesOut math.Int, err error)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintPoolShareToAccount(ctx sdk.Context, pool types.Pool, addr sdk.AccAddress, amount math.Int) error
- func (k Keeper) OnCollectFee(ctx sdk.Context, pool types.Pool, fee sdk.Coins) error
- func (k Keeper) OutRouteByDenom(goCtx context.Context, req *types.QueryOutRouteByDenomRequest) (*types.QueryOutRouteByDenomResponse, error)
- func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) Pool(goCtx context.Context, req *types.QueryGetPoolRequest) (*types.QueryGetPoolResponse, error)
- func (k Keeper) PoolAll(goCtx context.Context, req *types.QueryAllPoolRequest) (*types.QueryAllPoolResponse, error)
- func (k Keeper) PoolExists(ctx sdk.Context, poolId uint64) bool
- func (k Keeper) PoolExtraInfo(ctx sdk.Context, pool types.Pool) types.PoolExtraInfo
- func (k Keeper) RecordTotalLiquidityDecrease(ctx sdk.Context, coins sdk.Coins)
- func (k Keeper) RecordTotalLiquidityIncrease(ctx sdk.Context, coins sdk.Coins)
- func (k Keeper) RemoveDenomLiquidity(ctx sdk.Context, denom string)
- func (k Keeper) RemovePool(ctx sdk.Context, poolId uint64)
- func (k Keeper) RouteExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, ...) (tokenOutAmount math.Int, totalDiscountedSwapFee sdk.Dec, discountOut sdk.Dec, ...)
- func (k Keeper) RouteExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, ...) (tokenInAmount math.Int, totalDiscountedSwapFee sdk.Dec, discountOut sdk.Dec, ...)
- func (k Keeper) SelectOneSwapRequest(ctx sdk.Context, sprefix []byte) (sdk.Msg, uint64)
- func (k Keeper) SelectReverseSwapRequest(ctx sdk.Context, msg sdk.Msg) (sdk.Msg, uint64)
- func (k Keeper) SetDenomLiquidity(ctx sdk.Context, denomLiquidity types.DenomLiquidity)
- func (k *Keeper) SetHooks(gh types.AmmHooks) *Keeper
- func (k Keeper) SetLastSwapRequestIndex(ctx sdk.Context, index uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool) error
- func (k Keeper) SetSlippageTrack(ctx sdk.Context, track types.OraclePoolSlippageTrack)
- func (k Keeper) SetSwapExactAmountInRequests(ctx sdk.Context, msg *types.MsgSwapExactAmountIn, index uint64)
- func (k Keeper) SetSwapExactAmountOutRequests(ctx sdk.Context, msg *types.MsgSwapExactAmountOut, index uint64)
- func (k Keeper) SlippageTrack(goCtx context.Context, req *types.QuerySlippageTrackRequest) (*types.QuerySlippageTrackResponse, error)
- func (k Keeper) SlippageTrackAll(goCtx context.Context, req *types.QuerySlippageTrackAllRequest) (*types.QuerySlippageTrackAllResponse, error)
- func (k Keeper) SwapEstimation(goCtx context.Context, req *types.QuerySwapEstimationRequest) (*types.QuerySwapEstimationResponse, error)
- func (k Keeper) SwapEstimationByDenom(goCtx context.Context, req *types.QuerySwapEstimationByDenomRequest) (*types.QuerySwapEstimationByDenomResponse, error)
- func (k Keeper) SwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, ...) (tokenOutAmount math.Int, err error)
- func (k Keeper) SwapExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, ...) (tokenInAmount math.Int, err error)
- func (k Keeper) SwapFeesToRevenueToken(ctx sdk.Context, pool types.Pool, fee sdk.Coins) error
- func (k Keeper) SwapInAmtGivenOut(ctx sdk.Context, poolId uint64, oracleKeeper types.OracleKeeper, ...) (tokenIn sdk.Coin, slippage, slippageAmount sdk.Dec, weightBalanceBonus sdk.Dec, ...)
- func (k Keeper) SwapOutAmtGivenIn(ctx sdk.Context, poolId uint64, oracleKeeper types.OracleKeeper, ...) (tokenOut sdk.Coin, slippage sdk.Dec, slippageAmount sdk.Dec, ...)
- func (k Keeper) TrackSlippage(ctx sdk.Context, poolId uint64, amount sdk.Coin)
- func (k Keeper) UpdatePoolForSwap(ctx sdk.Context, pool types.Pool, sender sdk.AccAddress, ...) (math.Int, error)
- func (k Keeper) UpdatePoolParams(ctx sdk.Context, poolId uint64, poolParams types.PoolParams) (uint64, types.PoolParams, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetsValue ¶ added in v0.12.0
func LiquidityRatioFromPriceDepth ¶ added in v0.12.0
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeKey, transientStoreKey storetypes.StoreKey, authority string, parameterKeeper *pkeeper.Keeper, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, oracleKeeper types.OracleKeeper, commitmentKeeper *commitmentkeeper.Keeper, assetProfileKeeper types.AssetProfileKeeper, accountedPoolKeeper types.AccountedPoolKeeper, ) *Keeper
func (Keeper) AllSlippageTracks ¶ added in v0.13.0
func (k Keeper) AllSlippageTracks(ctx sdk.Context) []types.OraclePoolSlippageTrack
func (Keeper) ApplyExitPoolStateChange ¶ added in v0.14.0
func (Keeper) ApplySwapRequest ¶ added in v0.11.0
func (Keeper) Balance ¶ added in v0.14.0
func (k Keeper) Balance(goCtx context.Context, req *types.QueryBalanceRequest) (*types.QueryBalanceResponse, error)
func (Keeper) BurnPoolShareFromAccount ¶
func (k Keeper) BurnPoolShareFromAccount(ctx sdk.Context, pool types.Pool, addr sdk.AccAddress, amount math.Int) error
BurnPoolShareFromAccount burns `amount` of the given pool's shares held by `addr`.
func (Keeper) CalcInAmtGivenOut ¶ added in v0.11.0
func (k Keeper) CalcInAmtGivenOut( ctx sdk.Context, poolId uint64, oracle types.OracleKeeper, snapshot *types.Pool, tokensOut sdk.Coins, tokenInDenom string, swapFee sdk.Dec) ( tokenIn sdk.Coin, slippage sdk.Dec, err error, )
CalcInAmtGivenOut calculates token to be provided, fee added, given the swapped out amount, using solveConstantFunctionInvariant.
func (Keeper) CalcInRouteByDenom ¶ added in v0.16.0
func (k Keeper) CalcInRouteByDenom(ctx sdk.Context, denomIn string, denomOut string, baseCurrency string) ([]*types.SwapAmountInRoute, error)
CalcInRouteByDenom calculates the in route by denom
func (Keeper) CalcInRouteSpotPrice ¶ added in v0.16.0
func (k Keeper) CalcInRouteSpotPrice(ctx sdk.Context, tokenIn sdk.Coin, routes []*types.SwapAmountInRoute, discount sdk.Dec, overrideSwapFee sdk.Dec, ) (sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, error)
CalcInRouteSpotPrice calculates the spot price of the given token and in route
func (Keeper) CalcOutAmtGivenIn ¶ added in v0.11.0
func (k Keeper) CalcOutAmtGivenIn( ctx sdk.Context, poolId uint64, oracle types.OracleKeeper, snapshot *types.Pool, tokensIn sdk.Coins, tokenOutDenom string, swapFee sdk.Dec, ) (sdk.Coin, sdk.Dec, error)
CalcOutAmtGivenIn calculates tokens to be swapped out given the provided amount and fee deducted, using solveConstantFunctionInvariant.
func (Keeper) CalcOutRouteByDenom ¶ added in v0.16.0
func (k Keeper) CalcOutRouteByDenom(ctx sdk.Context, denomOut string, denomIn string, baseCurrency string) ([]*types.SwapAmountOutRoute, error)
CalcOutRouteByDenom calculates the out route by denom
func (Keeper) CalcOutRouteSpotPrice ¶ added in v0.16.0
func (k Keeper) CalcOutRouteSpotPrice(ctx sdk.Context, tokenOut sdk.Coin, routes []*types.SwapAmountOutRoute, discount sdk.Dec, overrideSwapFee sdk.Dec) (sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, sdk.Coin, sdk.Dec, sdk.Dec, error)
CalcOutRouteSpotPrice calculates the spot price of the given token and out route
func (Keeper) CalcSwapEstimationByDenom ¶ added in v0.16.0
func (k Keeper) CalcSwapEstimationByDenom( ctx sdk.Context, amount sdk.Coin, denomIn string, denomOut string, baseCurrency string, discount sdk.Dec, overrideSwapFee sdk.Dec, decimals uint64, ) ( inRoute []*types.SwapAmountInRoute, outRoute []*types.SwapAmountOutRoute, outAmount sdk.Coin, spotPrice sdk.Dec, swapFeeOut sdk.Dec, discountOut sdk.Dec, availableLiquidity sdk.Coin, slippage sdk.Dec, weightBonus sdk.Dec, priceImpact sdk.Dec, err error, )
CalcSwapEstimationByDenom calculates the swap estimation by denom
func (Keeper) ClearOutdatedSlippageTrack ¶ added in v0.13.0
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) DecreaseDenomLiquidity ¶
DecreaseDenomLiquidity decreases the liquidity of a denom by a certain amount
func (Keeper) DeleteSlippageTrack ¶ added in v0.13.0
func (k Keeper) DeleteSlippageTrack(ctx sdk.Context, track types.OraclePoolSlippageTrack)
func (Keeper) DeleteSwapExactAmountInRequest ¶ added in v0.11.0
func (k Keeper) DeleteSwapExactAmountInRequest(ctx sdk.Context, msg *types.MsgSwapExactAmountIn, index uint64)
DeleteSwapExactAmountInRequest removes a swap exact amount in request
func (Keeper) DeleteSwapExactAmountOutRequest ¶ added in v0.11.0
func (k Keeper) DeleteSwapExactAmountOutRequest(ctx sdk.Context, msg *types.MsgSwapExactAmountOut, index uint64)
DeleteSwapExactAmountOutRequest deletes a swap exact amount out request
func (Keeper) DeleteSwapRequest ¶ added in v0.11.0
func (Keeper) DenomLiquidity ¶
func (k Keeper) DenomLiquidity(goCtx context.Context, req *types.QueryGetDenomLiquidityRequest) (*types.QueryGetDenomLiquidityResponse, error)
func (Keeper) DenomLiquidityAll ¶
func (k Keeper) DenomLiquidityAll(goCtx context.Context, req *types.QueryAllDenomLiquidityRequest) (*types.QueryAllDenomLiquidityResponse, error)
func (Keeper) EndBlocker ¶ added in v0.11.0
EndBlocker of amm module
func (Keeper) EstimatePrice ¶ added in v0.29.31
Estimate the price : eg, 1 Eden -> x usdc
func (Keeper) ExecuteSwapRequests ¶ added in v0.11.0
func (Keeper) ExitPoolEst ¶ added in v0.33.0
func (Keeper) ExitPoolEstimation ¶ added in v0.29.22
func (k Keeper) ExitPoolEstimation(goCtx context.Context, req *types.QueryExitPoolEstimationRequest) (*types.QueryExitPoolEstimationResponse, error)
func (Keeper) GetAllDenomLiquidity ¶
func (k Keeper) GetAllDenomLiquidity(ctx sdk.Context) (list []types.DenomLiquidity)
GetAllDenomLiquidity returns all denomLiquidity
func (Keeper) GetAllPool ¶
GetAllPool returns all pool
func (Keeper) GetAllSwapExactAmountInRequests ¶ added in v0.11.0
func (k Keeper) GetAllSwapExactAmountInRequests(ctx sdk.Context) (list []types.MsgSwapExactAmountIn)
GetAllSwapExactAmountInRequests returns all SwapExactAmountIn requests
func (Keeper) GetAllSwapExactAmountOutRequests ¶ added in v0.11.0
func (k Keeper) GetAllSwapExactAmountOutRequests(ctx sdk.Context) (list []types.MsgSwapExactAmountOut)
GetAllSwapExactAmountOutRequests returns all SwapExactAmountOut requests
func (Keeper) GetBestPoolWithDenoms ¶ added in v0.29.0
func (k Keeper) GetBestPoolWithDenoms(ctx sdk.Context, denoms []string) (pool types.Pool, found bool)
GetBestPoolWithDenoms returns the first pool id that contains all specified denominations
func (Keeper) GetDenomLiquidity ¶
func (k Keeper) GetDenomLiquidity(ctx sdk.Context, denom string) (val types.DenomLiquidity, found bool)
GetDenomLiquidity returns a denomLiquidity from its index
func (Keeper) GetEdenDenomPrice ¶ added in v0.29.31
func (Keeper) GetFirstSlippageTrack ¶ added in v0.13.0
func (Keeper) GetFirstSwapExactAmountInRequest ¶ added in v0.11.0
func (Keeper) GetFirstSwapExactAmountOutRequest ¶ added in v0.11.0
func (Keeper) GetLastSlippageTrack ¶ added in v0.13.0
func (Keeper) GetLastSwapRequestIndex ¶ added in v0.11.0
func (Keeper) GetLatestPool ¶
GetLatestPool retrieves the latest pool item from the list of pools
func (Keeper) GetNextPoolId ¶
GetNextPoolId returns the next pool id.
func (Keeper) GetPoolSnapshotOrSet ¶ added in v0.11.0
GetPoolSnapshotOrSet returns a pool snapshot or set the snapshot
func (Keeper) GetSlippageTrack ¶ added in v0.13.0
func (Keeper) GetStackedSlippage ¶ added in v0.11.0
func (Keeper) GetTokenPrice ¶ added in v0.31.0
func (Keeper) GetTrackedSlippageDiff ¶ added in v0.13.0
func (Keeper) InRouteByDenom ¶ added in v0.16.0
func (k Keeper) InRouteByDenom(goCtx context.Context, req *types.QueryInRouteByDenomRequest) (*types.QueryInRouteByDenomResponse, error)
func (Keeper) IncreaseDenomLiquidity ¶
IncreaseDenomLiquidity increases the liquidity of a denom by a certain amount
func (Keeper) InitializePool ¶
func (k Keeper) InitializePool(ctx sdk.Context, pool *types.Pool, 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) IterateLiquidityPools ¶
IterateLiquidty iterates over all LiquidityPools and performs a callback.
func (Keeper) JoinPoolEst ¶ added in v0.33.0
func (Keeper) JoinPoolEstimation ¶ added in v0.29.22
func (k Keeper) JoinPoolEstimation(goCtx context.Context, req *types.QueryJoinPoolEstimationRequest) (*types.QueryJoinPoolEstimationResponse, error)
func (Keeper) JoinPoolNoSwap ¶
func (k Keeper) JoinPoolNoSwap( ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareOutAmount math.Int, tokenInMaxs sdk.Coins, ) (tokenIn sdk.Coins, sharesOut math.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) MintPoolShareToAccount ¶
func (k Keeper) MintPoolShareToAccount(ctx sdk.Context, pool types.Pool, addr sdk.AccAddress, amount math.Int) error
MintPoolShareToAccount attempts to mint shares of a AMM denomination to the specified address returning an error upon failure. Shares are minted using the x/amm module account.
func (Keeper) OnCollectFee ¶
func (Keeper) OutRouteByDenom ¶ added in v0.16.0
func (k Keeper) OutRouteByDenom(goCtx context.Context, req *types.QueryOutRouteByDenomRequest) (*types.QueryOutRouteByDenomResponse, error)
func (Keeper) Params ¶
func (k Keeper) Params(goCtx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) Pool ¶
func (k Keeper) Pool(goCtx context.Context, req *types.QueryGetPoolRequest) (*types.QueryGetPoolResponse, error)
func (Keeper) PoolAll ¶
func (k Keeper) PoolAll(goCtx context.Context, req *types.QueryAllPoolRequest) (*types.QueryAllPoolResponse, error)
func (Keeper) PoolExists ¶
PoolExists checks if a pool with the given poolId exists in the list of pools
func (Keeper) PoolExtraInfo ¶ added in v0.29.31
func (Keeper) RecordTotalLiquidityDecrease ¶
func (Keeper) RecordTotalLiquidityIncrease ¶
func (Keeper) RemoveDenomLiquidity ¶
RemoveDenomLiquidity removes a denomLiquidity from the store
func (Keeper) RemovePool ¶
RemovePool removes a pool from the store
func (Keeper) RouteExactAmountIn ¶
func (k Keeper) RouteExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, routes []types.SwapAmountInRoute, tokenIn sdk.Coin, tokenOutMinAmount math.Int, discount sdk.Dec, ) (tokenOutAmount math.Int, totalDiscountedSwapFee sdk.Dec, discountOut sdk.Dec, 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, recipient sdk.AccAddress, routes []types.SwapAmountOutRoute, tokenInMaxAmount math.Int, tokenOut sdk.Coin, discount sdk.Dec, ) (tokenInAmount math.Int, totalDiscountedSwapFee sdk.Dec, discountOut sdk.Dec, 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) SelectOneSwapRequest ¶ added in v0.11.0
func (Keeper) SelectReverseSwapRequest ¶ added in v0.11.0
func (Keeper) SetDenomLiquidity ¶
func (k Keeper) SetDenomLiquidity(ctx sdk.Context, denomLiquidity types.DenomLiquidity)
SetDenomLiquidity sets a specific denomLiquidity in the store from its index
func (Keeper) SetLastSwapRequestIndex ¶ added in v0.11.0
func (Keeper) SetSlippageTrack ¶ added in v0.13.0
func (k Keeper) SetSlippageTrack(ctx sdk.Context, track types.OraclePoolSlippageTrack)
func (Keeper) SetSwapExactAmountInRequests ¶ added in v0.11.0
func (k Keeper) SetSwapExactAmountInRequests(ctx sdk.Context, msg *types.MsgSwapExactAmountIn, index uint64)
SetSwapExactAmountInRequests stores swap exact amount in request
func (Keeper) SetSwapExactAmountOutRequests ¶ added in v0.11.0
func (k Keeper) SetSwapExactAmountOutRequests(ctx sdk.Context, msg *types.MsgSwapExactAmountOut, index uint64)
SetSwapExactAmountInRequests stores swap exact amount out request
func (Keeper) SlippageTrack ¶ added in v0.13.0
func (k Keeper) SlippageTrack(goCtx context.Context, req *types.QuerySlippageTrackRequest) (*types.QuerySlippageTrackResponse, error)
func (Keeper) SlippageTrackAll ¶ added in v0.13.0
func (k Keeper) SlippageTrackAll(goCtx context.Context, req *types.QuerySlippageTrackAllRequest) (*types.QuerySlippageTrackAllResponse, error)
func (Keeper) SwapEstimation ¶ added in v0.13.0
func (k Keeper) SwapEstimation(goCtx context.Context, req *types.QuerySwapEstimationRequest) (*types.QuerySwapEstimationResponse, error)
func (Keeper) SwapEstimationByDenom ¶ added in v0.16.0
func (k Keeper) SwapEstimationByDenom(goCtx context.Context, req *types.QuerySwapEstimationByDenomRequest) (*types.QuerySwapEstimationByDenomResponse, error)
func (Keeper) SwapExactAmountIn ¶
func (k Keeper) SwapExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, pool types.Pool, tokenIn sdk.Coin, tokenOutDenom string, tokenOutMinAmount math.Int, swapFee sdk.Dec, ) (tokenOutAmount math.Int, err error)
SwapExactAmountIn is an internal method for swapping an exact amount of tokens as input to a pool, using the provided swapFee. This is intended to allow different swap fees as determined by multi-hops, or when recovering from chain liveness failures. TODO: investigate if swapFee can be unexported https://github.com/osmosis-labs/osmosis/issues/3130
func (Keeper) SwapExactAmountOut ¶
func (k Keeper) SwapExactAmountOut( ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, pool types.Pool, tokenInDenom string, tokenInMaxAmount math.Int, tokenOut sdk.Coin, swapFee sdk.Dec, ) (tokenInAmount math.Int, err error)
SwapExactAmountOut is a method for swapping to get an exact number of tokens out of a pool, using the provided swapFee. This is intended to allow different swap fees as determined by multi-hops, or when recovering from chain liveness failures.
func (Keeper) SwapFeesToRevenueToken ¶
No fee management required when doing swap from fees to revenue token
func (Keeper) SwapInAmtGivenOut ¶ added in v0.11.0
func (k Keeper) SwapInAmtGivenOut( ctx sdk.Context, poolId uint64, oracleKeeper types.OracleKeeper, snapshot *types.Pool, tokensOut sdk.Coins, tokenInDenom string, swapFee sdk.Dec) ( tokenIn sdk.Coin, slippage, slippageAmount sdk.Dec, weightBalanceBonus sdk.Dec, err error, )
SwapInAmtGivenOut is a mutative method for CalcOutAmtGivenIn, which includes the actual swap.
func (Keeper) SwapOutAmtGivenIn ¶ added in v0.11.0
func (k Keeper) SwapOutAmtGivenIn( ctx sdk.Context, poolId uint64, oracleKeeper types.OracleKeeper, snapshot *types.Pool, tokensIn sdk.Coins, tokenOutDenom string, swapFee sdk.Dec, ) (tokenOut sdk.Coin, slippage sdk.Dec, slippageAmount sdk.Dec, weightBalanceBonus sdk.Dec, err error)
SwapOutAmtGivenIn is a mutative method for CalcOutAmtGivenIn, which includes the actual swap.
func (Keeper) TrackSlippage ¶ added in v0.13.0
func (Keeper) UpdatePoolForSwap ¶
func (k Keeper) UpdatePoolForSwap( ctx sdk.Context, pool types.Pool, sender sdk.AccAddress, recipient sdk.AccAddress, tokenIn sdk.Coin, tokenOut sdk.Coin, swapFeeIn sdk.Dec, swapFeeOut sdk.Dec, weightBalanceBonus sdk.Dec, ) (math.Int, error)
UpdatePoolForSwap takes a pool, sender, and tokenIn, tokenOut amounts It then updates the pool's balances to the new reserve amounts, and sends the in tokens from the sender to the pool, and the out tokens from the pool to the sender.
func (Keeper) UpdatePoolParams ¶ added in v0.18.0
func (k Keeper) UpdatePoolParams(ctx sdk.Context, poolId uint64, poolParams types.PoolParams) (uint64, types.PoolParams, error)
UpdatePoolParams updates the pool params
Source Files ¶
- abci.go
- apply_exit_pool_state_change.go
- apply_join_pool_state_change.go
- batch_processing.go
- calc_in_amt_given_out.go
- calc_in_route_by_denom.go
- calc_in_route_spot_price.go
- calc_out_amt_given_in.go
- calc_out_route_by_denom.go
- calc_out_route_spot_price.go
- calc_swap_estimation_by_denom.go
- create_elys_multihop_expected_swap_outs.go
- create_multihop_expected_swap_outs.go
- denom_liquidity.go
- elys_routed_multihop.go
- estimate_price.go
- fee.go
- keeper.go
- keeper_create_pool.go
- keeper_exit_pool.go
- keeper_join_pool_no_swap.go
- keeper_swap_exact_amount_in.go
- keeper_swap_exact_amount_out.go
- msg_server.go
- msg_server_create_pool.go
- msg_server_exit_pool.go
- msg_server_feed_multiple_external_liquidity.go
- msg_server_join_pool.go
- msg_server_swap_by_denom.go
- msg_server_swap_exact_amount_in.go
- msg_server_swap_exact_amount_out.go
- msg_server_update_params.go
- msg_server_update_pool_params.go
- oracle_pool_slippage_track.go
- params.go
- pool.go
- pool_share.go
- query.go
- query_balance.go
- query_denom_liquidity.go
- query_exit_pool_estimation.go
- query_in_route_by_denom.go
- query_join_pool_estimation.go
- query_out_route_by_denom.go
- query_pool.go
- query_slippage_track.go
- query_swap_estimation.go
- query_swap_estimation_by_denom.go
- route_exact_amount_in.go
- route_exact_amount_out.go
- swap_in_amt_given_out.go
- swap_out_amt_given_in.go
- update_pool_for_swap.go