Documentation ¶
Index ¶
- func LiquidityRatioFromPriceDepth(depth sdkmath.LegacyDec) sdkmath.LegacyDec
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func PortionCoins(coins sdk.Coins, portion sdkmath.LegacyDec) sdk.Coins
- type Keeper
- func (k Keeper) AddToPoolBalance(ctx sdk.Context, pool *types.Pool, addShares sdkmath.Int, coins sdk.Coins) error
- func (k Keeper) AllSlippageTracks(ctx sdk.Context) []types.OraclePoolSlippageTrack
- func (k Keeper) ApplyExitPoolStateChange(ctx sdk.Context, pool types.Pool, exiter sdk.AccAddress, numShares sdkmath.Int, ...) error
- func (k Keeper) ApplyJoinPoolStateChange(ctx sdk.Context, pool types.Pool, joiner 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 sdkmath.LegacyDec, 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, ...) (sdkmath.LegacyDec, sdkmath.LegacyDec, sdk.Coin, sdkmath.LegacyDec, ...)
- func (k Keeper) CalcOutAmtGivenIn(ctx sdk.Context, poolId uint64, oracle types.OracleKeeper, ...) (sdk.Coin, sdkmath.LegacyDec, 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, ...) (sdkmath.LegacyDec, sdkmath.LegacyDec, sdk.Coin, sdkmath.LegacyDec, ...)
- func (k Keeper) CalcSwapEstimationByDenom(ctx sdk.Context, amount sdk.Coin, denomIn string, denomOut string, ...) (inRoute []*types.SwapAmountInRoute, outRoute []*types.SwapAmountOutRoute, ...)
- func (k Keeper) CheckBaseAssetExist(ctx sdk.Context, denom string) bool
- 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) GetAccountKeeper() types.AccountKeeper
- func (k Keeper) GetAccountedPoolSnapshotOrSet(ctx sdk.Context, pool types.Pool) (val types.Pool)
- func (k Keeper) GetAllDenomLiquidity(ctx sdk.Context) (list []types.DenomLiquidity)
- func (k Keeper) GetAllLegacyPool(ctx sdk.Context) (list []types.LegacyPool)
- 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) GetAssetProfileKeeper() types.AssetProfileKeeper
- func (k Keeper) GetBankKeeper() types.BankKeeper
- func (k Keeper) GetBestPoolWithDenoms(ctx sdk.Context, denoms []string, usesOracle bool) (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) GetExternalLiquidityRatio(ctx sdk.Context, pool types.Pool, amountDepthInfo []types.AssetAmountDepth) ([]types.PoolAsset, error)
- 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) sdkmath.LegacyDec
- func (k *Keeper) GetTierKeeper() *tierkeeper.Keeper
- 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) InternalSwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, ...) (tokenOutAmount math.Int, err error)
- func (k Keeper) InternalSwapExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, ...) (tokenInAmount math.Int, 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 math.LegacyDec, ...)
- 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, ...) (tokenIn sdk.Coins, sharesOut sdkmath.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) error
- func (k Keeper) RecordTotalLiquidityIncrease(ctx sdk.Context, coins sdk.Coins) error
- func (k Keeper) RemoveDenomLiquidity(ctx sdk.Context, denom string)
- func (k Keeper) RemoveFromPoolBalance(ctx sdk.Context, pool *types.Pool, removeShares sdkmath.Int, coins sdk.Coins) error
- 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 math.LegacyDec, ...)
- func (k Keeper) RouteExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, ...) (tokenInAmount math.Int, totalDiscountedSwapFee math.LegacyDec, ...)
- 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) SetLegacyPool(ctx sdk.Context, pool types.LegacyPool)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)
- 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) SetTierKeeper(tk *tierkeeper.Keeper)
- 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) SwapByDenom(ctx sdk.Context, msg *types.MsgSwapByDenom) (*types.MsgSwapByDenomResponse, 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, msg *types.MsgSwapExactAmountIn) (*types.MsgSwapExactAmountInResponse, error)
- func (k Keeper) SwapExactAmountOut(ctx sdk.Context, msg *types.MsgSwapExactAmountOut) (*types.MsgSwapExactAmountOutResponse, 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 math.LegacyDec, ...)
- func (k Keeper) SwapOutAmtGivenIn(ctx sdk.Context, poolId uint64, oracleKeeper types.OracleKeeper, ...) (tokenOut sdk.Coin, slippage sdkmath.LegacyDec, ...)
- 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, ...) (sdkmath.Int, error)
- func (k Keeper) UpdatePoolParams(ctx sdk.Context, poolId uint64, poolParams types.PoolParams) (uint64, types.PoolParams, error)
- func (k Keeper) V8Migrate(ctx sdk.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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, storeService store.KVStoreService, 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, tierKeeper *tierkeeper.Keeper, ) *Keeper
func (Keeper) AddToPoolBalance ¶ added in v0.48.0
func (k Keeper) AddToPoolBalance(ctx sdk.Context, pool *types.Pool, addShares sdkmath.Int, coins sdk.Coins) error
AddToPoolBalance Used in perpetual balance changes
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) ApplyJoinPoolStateChange ¶ added in v0.49.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 sdkmath.LegacyDec) ( tokenIn sdk.Coin, slippage sdkmath.LegacyDec, 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 sdkmath.LegacyDec, overrideSwapFee sdkmath.LegacyDec, ) (sdkmath.LegacyDec, sdkmath.LegacyDec, sdk.Coin, sdkmath.LegacyDec, sdkmath.LegacyDec, sdk.Coin, sdkmath.LegacyDec, sdkmath.LegacyDec, 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 sdkmath.LegacyDec, ) (sdk.Coin, sdkmath.LegacyDec, 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 sdkmath.LegacyDec, overrideSwapFee sdkmath.LegacyDec) (sdkmath.LegacyDec, sdkmath.LegacyDec, sdk.Coin, sdkmath.LegacyDec, sdkmath.LegacyDec, sdk.Coin, sdkmath.LegacyDec, sdkmath.LegacyDec, 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, address string, overrideSwapFee sdkmath.LegacyDec, decimals uint64, ) ( inRoute []*types.SwapAmountInRoute, outRoute []*types.SwapAmountOutRoute, outAmount sdk.Coin, spotPrice sdkmath.LegacyDec, swapFeeOut sdkmath.LegacyDec, discountOut sdkmath.LegacyDec, availableLiquidity sdk.Coin, slippage sdkmath.LegacyDec, weightBonus sdkmath.LegacyDec, priceImpact sdkmath.LegacyDec, err error, )
CalcSwapEstimationByDenom calculates the swap estimation by denom
func (Keeper) CheckBaseAssetExist ¶ added in v0.52.0
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) GetAccountKeeper ¶ added in v0.52.0
func (k Keeper) GetAccountKeeper() types.AccountKeeper
func (Keeper) GetAccountedPoolSnapshotOrSet ¶ added in v0.49.4
Gets the pool snapshot and updates the pool balance with accounted pool balance
func (Keeper) GetAllDenomLiquidity ¶
func (k Keeper) GetAllDenomLiquidity(ctx sdk.Context) (list []types.DenomLiquidity)
GetAllDenomLiquidity returns all denomLiquidity
func (Keeper) GetAllLegacyPool ¶ added in v0.49.0
func (k Keeper) GetAllLegacyPool(ctx sdk.Context) (list []types.LegacyPool)
GetAllLegacyPool returns all legacy pool
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) GetAssetProfileKeeper ¶ added in v0.52.0
func (k Keeper) GetAssetProfileKeeper() types.AssetProfileKeeper
func (Keeper) GetBankKeeper ¶ added in v0.52.0
func (k Keeper) GetBankKeeper() types.BankKeeper
func (Keeper) GetBestPoolWithDenoms ¶ added in v0.29.0
func (k Keeper) GetBestPoolWithDenoms(ctx sdk.Context, denoms []string, usesOracle bool) (pool types.Pool, found bool)
GetBestPoolWithDenoms returns the first highest TVL 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) GetExternalLiquidityRatio ¶ added in v0.49.3
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) GetTierKeeper ¶ added in v0.51.0
func (k *Keeper) GetTierKeeper() *tierkeeper.Keeper
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) InternalSwapExactAmountIn ¶ added in v0.46.0
func (k Keeper) InternalSwapExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, pool types.Pool, tokenIn sdk.Coin, tokenOutDenom string, tokenOutMinAmount math.Int, swapFee math.LegacyDec, ) (tokenOutAmount math.Int, err error)
InternalSwapExactAmountIn 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) InternalSwapExactAmountOut ¶ added in v0.46.0
func (k Keeper) InternalSwapExactAmountOut( ctx sdk.Context, sender sdk.AccAddress, recipient sdk.AccAddress, pool types.Pool, tokenInDenom string, tokenInMaxAmount math.Int, tokenOut sdk.Coin, swapFee math.LegacyDec, ) (tokenInAmount math.Int, err error)
InternalSwapExactAmountOut 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) 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 sdkmath.Int, tokenInMaxs sdk.Coins, ) (tokenIn sdk.Coins, sharesOut sdkmath.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) RemoveFromPoolBalance ¶ added in v0.48.0
func (k Keeper) RemoveFromPoolBalance(ctx sdk.Context, pool *types.Pool, removeShares sdkmath.Int, coins sdk.Coins) error
RemoveFromPoolBalance Used in perpetual balance changes
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, ) (tokenOutAmount math.Int, totalDiscountedSwapFee math.LegacyDec, discountOut math.LegacyDec, 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, ) (tokenInAmount math.Int, totalDiscountedSwapFee math.LegacyDec, discountOut math.LegacyDec, 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) SetLegacyPool ¶ added in v0.52.0
func (k Keeper) SetLegacyPool(ctx sdk.Context, pool types.LegacyPool)
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) SetTierKeeper ¶ added in v0.51.0
func (k *Keeper) SetTierKeeper(tk *tierkeeper.Keeper)
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) SwapByDenom ¶ added in v0.46.0
func (k Keeper) SwapByDenom(ctx sdk.Context, msg *types.MsgSwapByDenom) (*types.MsgSwapByDenomResponse, 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, msg *types.MsgSwapExactAmountIn) (*types.MsgSwapExactAmountInResponse, error)
func (Keeper) SwapExactAmountOut ¶
func (k Keeper) SwapExactAmountOut(ctx sdk.Context, msg *types.MsgSwapExactAmountOut) (*types.MsgSwapExactAmountOutResponse, error)
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 math.LegacyDec, weightBreakingFeePerpetualFactor math.LegacyDec) ( tokenIn sdk.Coin, slippage, slippageAmount math.LegacyDec, weightBalanceBonus math.LegacyDec, err error, )
SwapInAmtGivenOut is a mutative method for CalcOutAmtGivenIn, which includes the actual swap. weightBreakingFeePerpetualFactor should be 1 if perpetual is not the one calling this function
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 sdkmath.LegacyDec, weightBreakingFeePerpetualFactor sdkmath.LegacyDec, ) (tokenOut sdk.Coin, slippage sdkmath.LegacyDec, slippageAmount sdkmath.LegacyDec, weightBalanceBonus sdkmath.LegacyDec, 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 (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
- get_internal_keepers.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