Documentation ¶
Index ¶
- func AllInvariants(keeper Keeper, bk types.BankKeeper) sdk.Invariant
- 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) CreatePool(ctx sdk.Context, sender sdk.AccAddress, poolParams types.PoolParams, ...) (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) GetNextPoolNumber(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) 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) SetHooks(gh types.GammHooks) *Keeper
- 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.BinaryMarshaler, 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) CreatePool ¶
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) GetNextPoolNumber ¶
GetNextPoolNumber returns the next pool number
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) 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)