Documentation ¶
Index ¶
- func CalculateTokenToBuy(swapTokenPair types.SwapTokenPair, sellToken sdk.SysCoin, buyTokenDenom string, ...) sdk.SysCoin
- func GetInputPrice(inputAmount, inputReserve, outputReserve, feeRate sdk.Dec) sdk.Dec
- func NewQuerier(k Keeper) sdk.Querier
- type Keeper
- func (k Keeper) BurnPoolCoinsFromUser(ctx sdk.Context, coins sdk.SysCoins, addr sdk.AccAddress) error
- func (k Keeper) DeleteSwapTokenPair(ctx sdk.Context, tokenPairName string)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPoolTokenAmount(ctx sdk.Context, poolTokenName string) sdk.Dec
- func (k Keeper) GetPoolTokenInfo(ctx sdk.Context, symbol string) (tokentypes.Token, error)
- func (k Keeper) GetRedeemableAssets(ctx sdk.Context, baseAmountName, quoteAmountName string, liquidity sdk.Dec) (baseAmount, quoteAmount sdk.SysCoin, err error)
- func (k Keeper) GetSwapTokenPair(ctx sdk.Context, tokenPairName string) (types.SwapTokenPair, error)
- func (k Keeper) GetSwapTokenPairs(ctx sdk.Context) []types.SwapTokenPair
- func (k Keeper) GetSwapTokenPairsIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetTokenKeeper() types.TokenKeeper
- func (k Keeper) IsTokenExist(ctx sdk.Context, token string) error
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MintPoolCoinsToUser(ctx sdk.Context, coins sdk.SysCoins, addr sdk.AccAddress) error
- func (k Keeper) NewPoolToken(ctx sdk.Context, symbol string)
- func (k Keeper) OnCreateExchange(ctx sdk.Context, swapTokenPair types.SwapTokenPair)
- func (k Keeper) OnSwapToken(ctx sdk.Context, address sdk.AccAddress, swapTokenPair types.SwapTokenPair, ...)
- func (k Keeper) SendCoinsFromPoolToAccount(ctx sdk.Context, coins sdk.SysCoins, addr sdk.AccAddress) error
- func (k Keeper) SendCoinsToPool(ctx sdk.Context, coins sdk.SysCoins, addr sdk.AccAddress) error
- func (k *Keeper) SetObserverKeeper(bk types.BackendKeeper)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetSwapTokenPair(ctx sdk.Context, tokenPairName string, swapTokenPair types.SwapTokenPair)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateTokenToBuy ¶
func CalculateTokenToBuy(swapTokenPair types.SwapTokenPair, sellToken sdk.SysCoin, buyTokenDenom string, params types.Params) sdk.SysCoin
CalculateTokenToBuy calculates the amount to buy
func GetInputPrice ¶
func NewQuerier ¶
NewQuerier creates a new querier for swap clients.
Types ¶
type Keeper ¶
type Keeper struct { ObserverKeeper []types.BackendKeeper // contains filtered or unexported fields }
Keeper of the swap store
func NewKeeper ¶
func NewKeeper(supplyKeeper types.SupplyKeeper, tokenKeeper types.TokenKeeper, cdc *codec.Codec, key sdk.StoreKey, paramspace types.ParamSubspace) Keeper
NewKeeper creates a swap keeper
func (Keeper) BurnPoolCoinsFromUser ¶
func (k Keeper) BurnPoolCoinsFromUser(ctx sdk.Context, coins sdk.SysCoins, addr sdk.AccAddress) error
BurnPoolCoinsFromUser sends coins to account module and burns them
func (Keeper) DeleteSwapTokenPair ¶
DeleteSwapTokenPair deletes the entire SwapTokenPair data struct for a quote token name
func (Keeper) GetPoolTokenAmount ¶
GetPoolTokenAmount gets the amount of the specified poolToken name
func (Keeper) GetPoolTokenInfo ¶
GetPoolTokenInfo gets the token's info
func (Keeper) GetRedeemableAssets ¶
func (Keeper) GetSwapTokenPair ¶
func (k Keeper) GetSwapTokenPair(ctx sdk.Context, tokenPairName string) (types.SwapTokenPair, error)
GetSwapTokenPair gets SwapTokenPair with quote token name
func (Keeper) GetSwapTokenPairs ¶
func (k Keeper) GetSwapTokenPairs(ctx sdk.Context) []types.SwapTokenPair
func (Keeper) GetSwapTokenPairsIterator ¶
GetSwapTokenPairsIterator get an iterator over all SwapTokenPairs in which the keys are the names and the values are the whois
func (Keeper) IsTokenExist ¶
IsTokenExist check token is exist
func (Keeper) MintPoolCoinsToUser ¶
MintPoolCoinsToUser mints coins and send them to the specified user address
func (Keeper) NewPoolToken ¶
NewPoolToken new token
func (Keeper) OnCreateExchange ¶ added in v0.13.0
func (k Keeper) OnCreateExchange(ctx sdk.Context, swapTokenPair types.SwapTokenPair)
func (Keeper) OnSwapToken ¶ added in v0.13.0
func (Keeper) SendCoinsFromPoolToAccount ¶
func (k Keeper) SendCoinsFromPoolToAccount(ctx sdk.Context, coins sdk.SysCoins, addr sdk.AccAddress) error
SendCoinsFromPoolToAccount sends coins from module account to user account
func (Keeper) SendCoinsToPool ¶
SendCoinsToPool sends coins from user account to module account
func (*Keeper) SetObserverKeeper ¶ added in v0.13.0
func (k *Keeper) SetObserverKeeper(bk types.BackendKeeper)
func (Keeper) SetSwapTokenPair ¶
func (k Keeper) SetSwapTokenPair(ctx sdk.Context, tokenPairName string, swapTokenPair types.SwapTokenPair)
SetSwapTokenPair sets the entire SwapTokenPair data struct for a quote token name