Documentation ¶
Index ¶
- func AllInvariants(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- func NewBalancerMsgServerImpl(keeper Keeper) balancer.MsgServer
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func PoolAccountInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- func PoolProductConstantInvariant(keeper Keeper) sdk.Invariant
- func PoolTotalWeightInvariant(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 types.PoolI, addr sdk.AccAddress, amount sdk.Int) error
- func (k Keeper) CalculateSpotPrice(ctx sdk.Context, poolId uint64, tokenInDenom, tokenOutDenom string) (sdk.Dec, error)
- func (k Keeper) CalculateSpotPriceWithSwapFee(ctx sdk.Context, poolId uint64, tokenInDenom, tokenOutDenom string) (sdk.Dec, error)
- func (k Keeper) CleanupBalancerPool(ctx sdk.Context, poolIds []uint64, excludedModules []string) (err error)
- func (k Keeper) CreateBalancerPool(ctx sdk.Context, sender sdk.AccAddress, ...) (uint64, error)
- func (k Keeper) DeleteLegacyTotalLiquidity(ctx sdk.Context)
- func (k Keeper) DeletePool(ctx sdk.Context, poolId uint64) error
- func (k Keeper) EstimateSwapExactAmountIn(ctx context.Context, req *types.QuerySwapExactAmountInRequest) (*types.QuerySwapExactAmountInResponse, error)
- func (k Keeper) EstimateSwapExactAmountOut(ctx context.Context, req *types.QuerySwapExactAmountOutRequest) (*types.QuerySwapExactAmountOutResponse, error)
- func (k Keeper) ExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareInAmount sdk.Int, ...) (err error)
- func (k Keeper) ExitSwapExternAmountOut(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenOut sdk.Coin, ...) (shareInAmount sdk.Int, err error)
- func (k Keeper) ExitSwapShareAmountIn(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenOutDenom string, ...) (tokenOutAmount sdk.Int, err error)
- func (k Keeper) GetDenomLiquidity(ctx sdk.Context, denom string) sdk.Int
- func (k Keeper) GetLegacyTotalLiquidity(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetNextPoolNumberAndIncrement(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (types.PoolI, error)
- func (k Keeper) GetPools(ctx sdk.Context) (res []types.PoolI, err error)
- func (k Keeper) GetTotalLiquidity(ctx sdk.Context) sdk.Coins
- func (k Keeper) IterateDenomLiquidity(ctx sdk.Context, cb func(sdk.Coin) bool)
- func (k Keeper) JoinPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareOutAmount sdk.Int, ...) (err error)
- func (k Keeper) JoinSwapExternAmountIn(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenIn sdk.Coin, ...) (shareOutAmount sdk.Int, err error)
- func (k Keeper) JoinSwapShareAmountOut(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenInDenom string, ...) (tokenInAmount sdk.Int, err error)
- func (k Keeper) MarshalPool(pool types.PoolI) ([]byte, error)
- func (k Keeper) MintPoolShareToAccount(ctx sdk.Context, pool types.PoolI, addr sdk.AccAddress, amount sdk.Int) error
- func (k Keeper) MultihopSwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountInRoute, ...) (tokenOutAmount sdk.Int, err error)
- func (k Keeper) MultihopSwapExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountOutRoute, ...) (tokenInAmount sdk.Int, err error)
- func (k Keeper) NumPools(ctx context.Context, req *types.QueryNumPoolsRequest) (*types.QueryNumPoolsResponse, error)
- func (k Keeper) Pool(ctx context.Context, req *types.QueryPoolRequest) (*types.QueryPoolResponse, error)
- func (k Keeper) PoolAssets(ctx context.Context, req *types.QueryPoolAssetsRequest) (*types.QueryPoolAssetsResponse, error)
- func (k Keeper) PoolParams(ctx context.Context, req *types.QueryPoolParamsRequest) (*types.QueryPoolParamsResponse, error)
- func (k Keeper) Pools(ctx context.Context, req *types.QueryPoolsRequest) (*types.QueryPoolsResponse, error)
- func (k Keeper) RecordTotalLiquidityDecrease(ctx sdk.Context, coins sdk.Coins)
- func (k Keeper) RecordTotalLiquidityIncrease(ctx sdk.Context, coins sdk.Coins)
- func (k Keeper) SetDenomLiquidity(ctx sdk.Context, denom string, amount sdk.Int)
- func (k *Keeper) SetHooks(gh types.GammHooks) *Keeper
- func (k Keeper) SetLegacyTotalLiquidity(ctx sdk.Context, coins sdk.Coins)
- func (k Keeper) SetNextPoolNumber(ctx sdk.Context, poolNumber uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPool(ctx sdk.Context, pool types.PoolI) error
- func (k Keeper) SetTotalLiquidity(ctx sdk.Context, coins sdk.Coins)
- func (k Keeper) SpotPrice(ctx context.Context, req *types.QuerySpotPriceRequest) (*types.QuerySpotPriceResponse, error)
- func (k Keeper) SwapExactAmountIn(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenIn sdk.Coin, ...) (tokenOutAmount sdk.Int, spotPriceAfter sdk.Dec, err error)
- func (k Keeper) SwapExactAmountOut(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, tokenInDenom string, ...) (tokenInAmount sdk.Int, spotPriceAfter sdk.Dec, err error)
- func (k Keeper) TotalLiquidity(ctx context.Context, req *types.QueryTotalLiquidityRequest) (*types.QueryTotalLiquidityResponse, error)
- func (k Keeper) TotalShares(ctx context.Context, req *types.QueryTotalSharesRequest) (*types.QueryTotalSharesResponse, error)
- func (k Keeper) UnmarshalPool(bz []byte) (types.PoolI, error)
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 PoolAccountInvariant ¶
func PoolAccountInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant
PoolAccountInvariant checks that the pool account balance reflects the sum of pool assets
func PoolProductConstantInvariant ¶
PoolProductContantInvariant chekcs that the pool constant invariant V where V = product([asset_balance_n^asset_weight_n]) holds. The invariant increases with positive swap fee, and decresed upon liquidity removal.
func PoolTotalWeightInvariant ¶
func PoolTotalWeightInvariant(keeper Keeper, bk types.BankKeeper) sdk.Invariant
PoolTotalWeightInvariant checks that the pool total weight reflect the sum of pool weights
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, keeper Keeper, bk types.BankKeeper)
RegisterInvariants registers all governance 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, distrKeeper types.DistrKeeper) Keeper
func (Keeper) BurnPoolShareFromAccount ¶
func (k Keeper) BurnPoolShareFromAccount(ctx sdk.Context, pool types.PoolI, addr sdk.AccAddress, amount sdk.Int) error
BurnPoolShareFromAccount burns `amount` of the given pools shares held by `addr`.
func (Keeper) CalculateSpotPrice ¶
func (Keeper) CalculateSpotPriceWithSwapFee ¶
func (Keeper) CleanupBalancerPool ¶
func (k Keeper) CleanupBalancerPool(ctx sdk.Context, poolIds []uint64, excludedModules []string) (err error)
CleanupBalancerPool destructs a pool and refund all the assets according to the shares held by the accounts. CleanupBalancerPool should not be called during the chain execution time, as it iterates the entire account balances. TODO: once SDK v0.46.0, use https://github.com/cosmos/cosmos-sdk/pull/9611
All locks on this pool share must be unlocked prior to execution. Use LockupKeeper.ForceUnlock on remaining locks before calling this function.
func (Keeper) CreateBalancerPool ¶
func (Keeper) DeleteLegacyTotalLiquidity ¶
func (Keeper) EstimateSwapExactAmountIn ¶
func (k Keeper) EstimateSwapExactAmountIn(ctx context.Context, req *types.QuerySwapExactAmountInRequest) (*types.QuerySwapExactAmountInResponse, error)
func (Keeper) EstimateSwapExactAmountOut ¶
func (k Keeper) EstimateSwapExactAmountOut(ctx context.Context, req *types.QuerySwapExactAmountOutRequest) (*types.QuerySwapExactAmountOutResponse, error)
func (Keeper) ExitSwapExternAmountOut ¶
func (Keeper) ExitSwapShareAmountIn ¶
func (Keeper) GetDenomLiquidity ¶
func (Keeper) GetLegacyTotalLiquidity ¶
func (Keeper) GetNextPoolNumberAndIncrement ¶
GetNextPoolNumberAndIncrement returns the next pool number, and increments the corresponding state entry
func (Keeper) IterateDenomLiquidity ¶
func (Keeper) JoinSwapExternAmountIn ¶
func (Keeper) JoinSwapShareAmountOut ¶
func (Keeper) MintPoolShareToAccount ¶
func (Keeper) MultihopSwapExactAmountIn ¶
func (k Keeper) MultihopSwapExactAmountIn( ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountInRoute, tokenIn sdk.Coin, tokenOutMinAmount sdk.Int, ) (tokenOutAmount sdk.Int, err error)
MultihopSwapExactAmountIn 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) MultihopSwapExactAmountOut ¶
func (k Keeper) MultihopSwapExactAmountOut( ctx sdk.Context, sender sdk.AccAddress, routes []types.SwapAmountOutRoute, tokenInMaxAmount sdk.Int, tokenOut sdk.Coin, ) (tokenInAmount sdk.Int, 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) NumPools ¶
func (k Keeper) NumPools( ctx context.Context, req *types.QueryNumPoolsRequest, ) (*types.QueryNumPoolsResponse, error)
func (Keeper) Pool ¶
func (k Keeper) Pool( ctx context.Context, req *types.QueryPoolRequest, ) (*types.QueryPoolResponse, error)
func (Keeper) PoolAssets ¶
func (k Keeper) PoolAssets(ctx context.Context, req *types.QueryPoolAssetsRequest) (*types.QueryPoolAssetsResponse, error)
func (Keeper) PoolParams ¶
func (k Keeper) PoolParams(ctx context.Context, req *types.QueryPoolParamsRequest) (*types.QueryPoolParamsResponse, error)
func (Keeper) Pools ¶
func (k Keeper) Pools( ctx context.Context, req *types.QueryPoolsRequest, ) (*types.QueryPoolsResponse, error)
func (Keeper) RecordTotalLiquidityDecrease ¶
func (Keeper) RecordTotalLiquidityIncrease ¶
func (Keeper) SetDenomLiquidity ¶
func (Keeper) SetLegacyTotalLiquidity ¶
func (Keeper) SetNextPoolNumber ¶
SetNextPoolNumber sets next pool number
func (Keeper) SetTotalLiquidity ¶
func (Keeper) SpotPrice ¶
func (k Keeper) SpotPrice(ctx context.Context, req *types.QuerySpotPriceRequest) (*types.QuerySpotPriceResponse, error)
func (Keeper) SwapExactAmountIn ¶
func (Keeper) SwapExactAmountOut ¶
func (Keeper) TotalLiquidity ¶
func (k Keeper) TotalLiquidity(ctx context.Context, req *types.QueryTotalLiquidityRequest) (*types.QueryTotalLiquidityResponse, error)
func (Keeper) TotalShares ¶
func (k Keeper) TotalShares(ctx context.Context, req *types.QueryTotalSharesRequest) (*types.QueryTotalSharesResponse, error)