keeper

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateTokenToBuy

func CalculateTokenToBuy(swapTokenPair types.SwapTokenPair, sellToken sdk.DecCoin, buyTokenDenom string, params types.Params) sdk.DecCoin

CalculateTokenToBuy calculates the amount to buy

func GetInputPrice

func GetInputPrice(inputAmount, inputReserve, outputReserve, feeRate sdk.Dec) sdk.Dec

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier creates a new querier for swap clients.

Types

type Keeper

type Keeper struct {
	// 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.DecCoins, addr sdk.AccAddress) error

BurnPoolCoinsFromUser sends coins to account module and burns them

func (Keeper) DeleteSwapTokenPair

func (k Keeper) DeleteSwapTokenPair(ctx sdk.Context, tokenPairName string)

DeleteSwapTokenPair deletes the entire SwapTokenPair data struct for a quote token name

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams gets inflation params from the global param store

func (Keeper) GetPoolTokenAmount

func (k Keeper) GetPoolTokenAmount(ctx sdk.Context, poolTokenName string) sdk.Dec

GetPoolTokenAmount gets the amount of the specified poolToken name

func (Keeper) GetPoolTokenInfo

func (k Keeper) GetPoolTokenInfo(ctx sdk.Context, symbol string) (tokentypes.Token, error)

GetPoolTokenInfo gets the token's info

func (Keeper) GetRedeemableAssets

func (k Keeper) GetRedeemableAssets(ctx sdk.Context, baseAmountName string, liquidity sdk.Dec) (baseAmount, quoteAmount sdk.DecCoin, err error)

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

func (k Keeper) GetSwapTokenPairsIterator(ctx sdk.Context) sdk.Iterator

GetSwapTokenPairsIterator get an iterator over all SwapTokenPairs in which the keys are the names and the values are the whois

func (Keeper) GetTokenKeeper

func (k Keeper) GetTokenKeeper() types.TokenKeeper

nolint

func (Keeper) IsTokenExist

func (k Keeper) IsTokenExist(ctx sdk.Context, token string) error

IsTokenExist check token is exist

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MintPoolCoinsToUser

func (k Keeper) MintPoolCoinsToUser(ctx sdk.Context, coins sdk.DecCoins, addr sdk.AccAddress) error

MintPoolCoinsToUser mints coins and send them to the specified user address

func (Keeper) NewPoolToken

func (k Keeper) NewPoolToken(ctx sdk.Context, symbol string)

NewPoolToken new token

func (Keeper) SendCoinsFromPoolToAccount

func (k Keeper) SendCoinsFromPoolToAccount(ctx sdk.Context, coins sdk.DecCoins, addr sdk.AccAddress) error

SendCoinsFromPoolToAccount sends coins from module account to user account

func (Keeper) SendCoinsToPool

func (k Keeper) SendCoinsToPool(ctx sdk.Context, coins sdk.DecCoins, addr sdk.AccAddress) error

SendCoinsToPool sends coins from user account to module account

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets inflation params from the global param store

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL