keeper

package
v0.0.0-...-17765ca Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 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.SysCoin, buyTokenDenom string, params types.Params) sdk.SysCoin

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 {
	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

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, quoteAmountName string, liquidity sdk.Dec) (baseAmount, quoteAmount sdk.SysCoin, 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.SysCoins, 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) OnCreateExchange

func (k Keeper) OnCreateExchange(ctx sdk.Context, swapTokenPair types.SwapTokenPair)

func (Keeper) OnSwapToken

func (k Keeper) OnSwapToken(ctx sdk.Context, address sdk.AccAddress, swapTokenPair types.SwapTokenPair, sellAmount sdk.SysCoin, buyAmount sdk.SysCoin)

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

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

SendCoinsToPool sends coins from user account to module account

func (*Keeper) SetObserverKeeper

func (k *Keeper) SetObserverKeeper(bk types.BackendKeeper)

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