Documentation ¶
Index ¶
- Constants
- Variables
- func CreateTestMsgs(addr sdk.AccAddress) []sdk.Msg
- func ErrAddressIsRequire(msg string) sdk.EnvelopedErr
- func ErrBaseAmountNameBiggerThanQuoteAmountName() sdk.EnvelopedErr
- func ErrBaseNameEqualQuoteName() sdk.EnvelopedErr
- func ErrBaseTokensAmountBiggerThanMax() sdk.EnvelopedErr
- func ErrBlockTimeBigThanDeadline() sdk.EnvelopedErr
- func ErrBurnPoolTokenFailed(err error) sdk.EnvelopedErr
- func ErrCodeMinCoinsFailed(err error) sdk.EnvelopedErr
- func ErrConvertQuoteTokenAmount(quoteTokenAmount string, err error) sdk.EnvelopedErr
- func ErrConvertSellTokenAmount(sellTokenAmount string, err error) sdk.EnvelopedErr
- func ErrInsufficientPoolToken() sdk.EnvelopedErr
- func ErrInvalidCoins() sdk.EnvelopedErr
- func ErrInvalidTokenPair(swapTokenPair string) sdk.EnvelopedErr
- func ErrIsZeroValue(msg string) sdk.EnvelopedErr
- func ErrLessThan(param1 string, param2 string) sdk.EnvelopedErr
- func ErrMaxBaseAmount() sdk.EnvelopedErr
- func ErrMaxBaseAmountOrQuoteAmountIsNegative() sdk.EnvelopedErr
- func ErrMinBaseAmount() sdk.EnvelopedErr
- func ErrMinBoughtTokenAmount() sdk.EnvelopedErr
- func ErrMinLiquidityIsNegative() sdk.EnvelopedErr
- func ErrMinQuoteAmount() sdk.EnvelopedErr
- func ErrMintPoolTokenFailed(err error) sdk.EnvelopedErr
- func ErrMsgDeadlineLessThanBlockTime() sdk.EnvelopedErr
- func ErrNonExistPoolToken(token string) sdk.EnvelopedErr
- func ErrNonExistSwapTokenPair(tokenPairName string) sdk.EnvelopedErr
- func ErrNotAllowedOriginSymbol() sdk.EnvelopedErr
- func ErrPoolTokenPairExist() sdk.EnvelopedErr
- func ErrQueryParamsAddressIsEmpty() sdk.EnvelopedErr
- func ErrQueryParamsBaseTokenIsEmpty() sdk.EnvelopedErr
- func ErrQueryParamsQuoteTokenAmountIsEmpty() sdk.EnvelopedErr
- func ErrQuoteAmount() sdk.EnvelopedErr
- func ErrSellAmountEqualBuyToken() sdk.EnvelopedErr
- func ErrSellAmountOrBuyTokenIsEmpty() sdk.EnvelopedErr
- func ErrSendCoinsFailed(err error) sdk.EnvelopedErr
- func ErrSendCoinsFromAccountToModule(err error) sdk.EnvelopedErr
- func ErrSendCoinsFromPoolToAccountFailed(msg string) sdk.EnvelopedErr
- func ErrSendCoinsToPoolFailed(msg string) sdk.EnvelopedErr
- func ErrSoldTokenAmount() sdk.EnvelopedErr
- func ErrSoldTokenAmountIsNegative() sdk.EnvelopedErr
- func ErrSwapTokenPairExist() sdk.EnvelopedErr
- func ErrSwapUnknownMsgType() sdk.EnvelopedErr
- func ErrSwapUnknownQueryType() sdk.EnvelopedErr
- func ErrToken0NameEqualToken1Name() sdk.EnvelopedErr
- func ErrTokenNotExist() sdk.EnvelopedErr
- func ErrValidateDenom(tokenName string) sdk.EnvelopedErr
- func ErrValidateSwapAmountName() sdk.EnvelopedErr
- func GetBaseQuoteTokenName(token0, token1 string) (string, string)
- func GetPoolTokenName(token1, token2 string) string
- func GetSwapTokenPairName(token0, token1 string) string
- func GetTokenPairKey(key string) []byte
- func InitPoolToken(poolTokenName string) token.Token
- func IsPoolToken(symbol string) bool
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func SetTestTokens(ctx sdk.Context, tokenKeeper token.Keeper, supplyKeeper supply.Keeper, ...) error
- func SplitPoolToken(symbol string) (token0, token1 string)
- func ValidateBaseAndQuoteAmount(baseAmountName, quoteAmountName string) error
- func ValidateSwapAmountName(amountName string) error
- type BackendKeeper
- type BankKeeper
- type MsgAddLiquidity
- type MsgCreateExchange
- func (msg MsgCreateExchange) GetSignBytes() []byte
- func (msg MsgCreateExchange) GetSigners() []sdk.AccAddress
- func (msg MsgCreateExchange) GetSwapTokenPairName() string
- func (msg MsgCreateExchange) Route() string
- func (msg MsgCreateExchange) Type() string
- func (msg MsgCreateExchange) ValidateBasic() sdk.Error
- type MsgRemoveLiquidity
- func (msg MsgRemoveLiquidity) GetSignBytes() []byte
- func (msg MsgRemoveLiquidity) GetSigners() []sdk.AccAddress
- func (msg MsgRemoveLiquidity) GetSwapTokenPairName() string
- func (msg MsgRemoveLiquidity) Route() string
- func (msg MsgRemoveLiquidity) Type() string
- func (msg MsgRemoveLiquidity) ValidateBasic() sdk.Error
- type MsgTokenToToken
- type ParamSubspace
- type Params
- type QueryBuyAmountParams
- type QuerySwapAddInfoParams
- type QuerySwapBuyInfoParams
- type SupplyKeeper
- type SwapAddInfo
- type SwapBuyInfo
- type SwapTokenPair
- type TokenKeeper
Constants ¶
const ( DefaultCodespace = ModuleName CodeNonExistSwapTokenPair uint32 = 65000 CodeNonExistPoolToken uint32 = 65001 CodeMintCoinsFailed uint32 = 65002 CodeSendCoinsFromAccountToModule uint32 = 65003 CodeBaseAmountNameBiggerThanQuoteAmountName uint32 = 65004 CodeValidateSwapAmountName uint32 = 65005 CodeBaseNameEqualQuoteName uint32 = 65006 CodeValidateDenom uint32 = 65007 CodeNotAllowedOriginSymbol uint32 = 65008 CodeInsufficientPoolToken uint32 = 65009 CodeTokenNotExist uint32 = 65010 CodeInvalidCoins uint32 = 65011 CodeInvalidTokenPair uint32 = 65012 CodeAddressIsRequire uint32 = 65013 CodeIsZeroValue uint32 = 65014 CodeBlockTimeBigThanDeadline uint32 = 65015 CodeLessThan uint32 = 65016 CodeMintPoolTokenFailed uint32 = 65017 CodeSendCoinsFromPoolToAccountFailed uint32 = 65018 CodeBurnPoolTokenFailed uint32 = 65019 CodeSendCoinsToPoolFailed uint32 = 65020 CodeSwapUnknownMsgType uint32 = 65021 CodeSwapUnknownQueryTypes uint32 = 65022 CodeSellAmountOrBuyTokenIsEmpty uint32 = 65023 CodeSellAmountEqualBuyToken uint32 = 65024 CodeQueryParamsAddressIsEmpty uint32 = 65025 CodeQueryParamsQuoteTokenAmountIsEmpty uint32 = 65026 CodeQueryParamsBaseTokenIsEmpty uint32 = 65027 CodeMinLiquidityIsNegative uint32 = 65028 CodeMaxBaseAmountOrQuoteAmountIsNegative uint32 = 65029 CodeMaxBaseAmount uint32 = 65030 CodeQuoteAmount uint32 = 65031 CodeMinBaseAmount uint32 = 65032 CodeMinQuoteAmount uint32 = 65033 CodeSoldTokenAmountIsNegative uint32 = 65034 CodeToken0NameEqualToken1Name uint32 = 65035 CodeSoldTokenAmount uint32 = 65036 CodeMinBoughtTokenAmount uint32 = 65037 CodeConvertSellTokenAmount uint32 = 65038 CodeConvertQuoteTokenAmount uint32 = 65039 CodeSendCoinsFailed uint32 = 65040 CodeMsgDeadlineLessThanBlockTime uint32 = 65041 CodeBaseTokensAmountBiggerThanMax uint32 = 65042 CodeIsSwapTokenPairExist uint32 = 65043 CodeIsPoolTokenPairExist uint32 = 65044 CodeInternalError uint32 = 65045 )
const ( // ModuleName is the name of the module ModuleName = "ammswap" // StoreKey to be used when creating the KVStore StoreKey = ModuleName // RouterKey to be used for routing msgs RouterKey = ModuleName // QuerierRoute to be used for querier msgs QuerierRoute = ModuleName // QuerySwapTokenPair query endpoints supported by the swap Querier QuerySwapTokenPair = "swapTokenPair" QuerySwapTokenPairs = "swapTokenPairs" QueryRedeemableAssets = "queryRedeemableAssets" QueryParams = "params" QueryBuyAmount = "buy" QuerySwapQuoteInfo = "swapQuoteInfo" QuerySwapAddLiquidityQuote = "swapAddLiquidityQuote" )
const ( TypeMsgAddLiquidity = "add_liquidity" TypeMsgTokenSwap = "token_swap" )
PoolSwap message types and routes
const ( DefaultParamspace = ModuleName GenerateTokenType = 2 )
Default parameter namespace
const (
AttributeValueCategory = ModuleName
)
ammswap module event types
const PoolTokenPrefix = "ammswap_"
PoolTokenPrefix defines pool token prefix name
const TestBasePooledToken = "aab"
nolint
const TestBasePooledToken2 = "ccb"
const TestBasePooledToken3 = "ddb"
const TestQuotePooledToken = common.NativeToken
const TestSwapTokenPairName = TestBasePooledToken + "_" + TestQuotePooledToken
Variables ¶
var (
KeyFeeRate = []byte("FeeRate")
)
Parameter store keys
var ModuleCdc *codec.Codec
ModuleCdc defines the module codec
var ( // TokenPairPrefixKey to be used for KVStore TokenPairPrefixKey = []byte{0x01} )
Functions ¶
func CreateTestMsgs ¶
func CreateTestMsgs(addr sdk.AccAddress) []sdk.Msg
func ErrAddressIsRequire ¶
func ErrAddressIsRequire(msg string) sdk.EnvelopedErr
func ErrBaseAmountNameBiggerThanQuoteAmountName ¶
func ErrBaseAmountNameBiggerThanQuoteAmountName() sdk.EnvelopedErr
func ErrBaseNameEqualQuoteName ¶
func ErrBaseNameEqualQuoteName() sdk.EnvelopedErr
func ErrBaseTokensAmountBiggerThanMax ¶
func ErrBaseTokensAmountBiggerThanMax() sdk.EnvelopedErr
func ErrBlockTimeBigThanDeadline ¶
func ErrBlockTimeBigThanDeadline() sdk.EnvelopedErr
func ErrBurnPoolTokenFailed ¶
func ErrBurnPoolTokenFailed(err error) sdk.EnvelopedErr
func ErrCodeMinCoinsFailed ¶
func ErrCodeMinCoinsFailed(err error) sdk.EnvelopedErr
func ErrConvertQuoteTokenAmount ¶
func ErrConvertQuoteTokenAmount(quoteTokenAmount string, err error) sdk.EnvelopedErr
func ErrConvertSellTokenAmount ¶
func ErrConvertSellTokenAmount(sellTokenAmount string, err error) sdk.EnvelopedErr
func ErrInsufficientPoolToken ¶
func ErrInsufficientPoolToken() sdk.EnvelopedErr
func ErrInvalidCoins ¶
func ErrInvalidCoins() sdk.EnvelopedErr
func ErrInvalidTokenPair ¶
func ErrInvalidTokenPair(swapTokenPair string) sdk.EnvelopedErr
func ErrIsZeroValue ¶
func ErrIsZeroValue(msg string) sdk.EnvelopedErr
func ErrLessThan ¶
func ErrLessThan(param1 string, param2 string) sdk.EnvelopedErr
func ErrMaxBaseAmount ¶
func ErrMaxBaseAmount() sdk.EnvelopedErr
func ErrMaxBaseAmountOrQuoteAmountIsNegative ¶
func ErrMaxBaseAmountOrQuoteAmountIsNegative() sdk.EnvelopedErr
func ErrMinBaseAmount ¶
func ErrMinBaseAmount() sdk.EnvelopedErr
func ErrMinBoughtTokenAmount ¶
func ErrMinBoughtTokenAmount() sdk.EnvelopedErr
func ErrMinLiquidityIsNegative ¶
func ErrMinLiquidityIsNegative() sdk.EnvelopedErr
func ErrMinQuoteAmount ¶
func ErrMinQuoteAmount() sdk.EnvelopedErr
func ErrMintPoolTokenFailed ¶
func ErrMintPoolTokenFailed(err error) sdk.EnvelopedErr
func ErrMsgDeadlineLessThanBlockTime ¶
func ErrMsgDeadlineLessThanBlockTime() sdk.EnvelopedErr
func ErrNonExistPoolToken ¶
func ErrNonExistPoolToken(token string) sdk.EnvelopedErr
func ErrNonExistSwapTokenPair ¶
func ErrNonExistSwapTokenPair(tokenPairName string) sdk.EnvelopedErr
func ErrNotAllowedOriginSymbol ¶
func ErrNotAllowedOriginSymbol() sdk.EnvelopedErr
func ErrPoolTokenPairExist ¶
func ErrPoolTokenPairExist() sdk.EnvelopedErr
func ErrQueryParamsAddressIsEmpty ¶
func ErrQueryParamsAddressIsEmpty() sdk.EnvelopedErr
func ErrQueryParamsBaseTokenIsEmpty ¶
func ErrQueryParamsBaseTokenIsEmpty() sdk.EnvelopedErr
func ErrQueryParamsQuoteTokenAmountIsEmpty ¶
func ErrQueryParamsQuoteTokenAmountIsEmpty() sdk.EnvelopedErr
func ErrQuoteAmount ¶
func ErrQuoteAmount() sdk.EnvelopedErr
func ErrSellAmountEqualBuyToken ¶
func ErrSellAmountEqualBuyToken() sdk.EnvelopedErr
func ErrSellAmountOrBuyTokenIsEmpty ¶
func ErrSellAmountOrBuyTokenIsEmpty() sdk.EnvelopedErr
func ErrSendCoinsFailed ¶
func ErrSendCoinsFailed(err error) sdk.EnvelopedErr
func ErrSendCoinsFromAccountToModule ¶
func ErrSendCoinsFromAccountToModule(err error) sdk.EnvelopedErr
func ErrSendCoinsFromPoolToAccountFailed ¶
func ErrSendCoinsFromPoolToAccountFailed(msg string) sdk.EnvelopedErr
func ErrSendCoinsToPoolFailed ¶
func ErrSendCoinsToPoolFailed(msg string) sdk.EnvelopedErr
func ErrSoldTokenAmount ¶
func ErrSoldTokenAmount() sdk.EnvelopedErr
func ErrSoldTokenAmountIsNegative ¶
func ErrSoldTokenAmountIsNegative() sdk.EnvelopedErr
func ErrSwapTokenPairExist ¶
func ErrSwapTokenPairExist() sdk.EnvelopedErr
func ErrSwapUnknownMsgType ¶
func ErrSwapUnknownMsgType() sdk.EnvelopedErr
func ErrSwapUnknownQueryType ¶
func ErrSwapUnknownQueryType() sdk.EnvelopedErr
func ErrToken0NameEqualToken1Name ¶
func ErrToken0NameEqualToken1Name() sdk.EnvelopedErr
func ErrTokenNotExist ¶
func ErrTokenNotExist() sdk.EnvelopedErr
func ErrValidateDenom ¶
func ErrValidateDenom(tokenName string) sdk.EnvelopedErr
func ErrValidateSwapAmountName ¶
func ErrValidateSwapAmountName() sdk.EnvelopedErr
func GetBaseQuoteTokenName ¶
func GetPoolTokenName ¶
func GetSwapTokenPairName ¶
func InitPoolToken ¶
InitPoolToken default pool token
func IsPoolToken ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on codec
func SetTestTokens ¶
func SplitPoolToken ¶
func ValidateSwapAmountName ¶
Types ¶
type BackendKeeper ¶
type BackendKeeper interface { OnSwapToken(ctx sdk.Context, address sdk.AccAddress, swapTokenPair SwapTokenPair, sellAmount sdk.SysCoin, buyAmount sdk.SysCoin) OnSwapCreateExchange(ctx sdk.Context, swapTokenPair SwapTokenPair) }
type BankKeeper ¶
type BankKeeper interface { SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, error) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error }
BankKeeper defines the expected bank interface
type MsgAddLiquidity ¶
type MsgAddLiquidity struct { MinLiquidity sdk.Dec `json:"min_liquidity"` // Minimum number of sender will mint if total pool token supply is greater than 0. MaxBaseAmount sdk.SysCoin `json:"max_base_amount"` // Maximum number of tokens deposited. Deposits max amount if total pool token supply is 0. QuoteAmount sdk.SysCoin `json:"quote_amount"` // Quote token amount Deadline int64 `json:"deadline"` // Time after which this transaction can no longer be executed. Sender sdk.AccAddress `json:"sender"` // Sender }
MsgAddLiquidity Deposit quote_amount and base_amount at current ratio to mint pool tokens.
func NewMsgAddLiquidity ¶
func NewMsgAddLiquidity(minLiquidity sdk.Dec, maxBaseAmount, quoteAmount sdk.SysCoin, deadline int64, sender sdk.AccAddress) MsgAddLiquidity
NewMsgAddLiquidity is a constructor function for MsgAddLiquidity
func (MsgAddLiquidity) GetSignBytes ¶
func (msg MsgAddLiquidity) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgAddLiquidity) GetSigners ¶
func (msg MsgAddLiquidity) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgAddLiquidity) GetSwapTokenPairName ¶
func (msg MsgAddLiquidity) GetSwapTokenPairName() string
GetSwapTokenPair defines token pair
func (MsgAddLiquidity) Route ¶
func (msg MsgAddLiquidity) Route() string
Route should return the name of the module
func (MsgAddLiquidity) Type ¶
func (msg MsgAddLiquidity) Type() string
Type should return the action
func (MsgAddLiquidity) ValidateBasic ¶
func (msg MsgAddLiquidity) ValidateBasic() sdk.Error
ValidateBasic runs stateless checks on the message
type MsgCreateExchange ¶
type MsgCreateExchange struct { Token0Name string `json:"token0_name"` Token1Name string `json:"token1_name"` Sender sdk.AccAddress `json:"sender"` // Sender }
MsgCreateExchange creates a new exchange with token
func NewMsgCreateExchange ¶
func NewMsgCreateExchange(token0Name string, token1Name string, sender sdk.AccAddress) MsgCreateExchange
NewMsgCreateExchange create a new exchange with token
func (MsgCreateExchange) GetSignBytes ¶
func (msg MsgCreateExchange) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgCreateExchange) GetSigners ¶
func (msg MsgCreateExchange) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgCreateExchange) GetSwapTokenPairName ¶
func (msg MsgCreateExchange) GetSwapTokenPairName() string
GetSwapTokenPair defines token pair
func (MsgCreateExchange) Route ¶
func (msg MsgCreateExchange) Route() string
Route should return the name of the module
func (MsgCreateExchange) Type ¶
func (msg MsgCreateExchange) Type() string
Type should return the action
func (MsgCreateExchange) ValidateBasic ¶
func (msg MsgCreateExchange) ValidateBasic() sdk.Error
ValidateBasic runs stateless checks on the message
type MsgRemoveLiquidity ¶
type MsgRemoveLiquidity struct { Liquidity sdk.Dec `json:"liquidity"` // Amount of pool token burned. MinBaseAmount sdk.SysCoin `json:"min_base_amount"` // Minimum base amount. MinQuoteAmount sdk.SysCoin `json:"min_quote_amount"` // Minimum quote amount. Deadline int64 `json:"deadline"` // Time after which this transaction can no longer be executed. Sender sdk.AccAddress `json:"sender"` // Sender }
MsgRemoveLiquidity burns pool tokens to withdraw okt and Tokens at current ratio.
func NewMsgRemoveLiquidity ¶
func NewMsgRemoveLiquidity(liquidity sdk.Dec, minBaseAmount, minQuoteAmount sdk.SysCoin, deadline int64, sender sdk.AccAddress) MsgRemoveLiquidity
NewMsgRemoveLiquidity is a constructor function for MsgAddLiquidity
func (MsgRemoveLiquidity) GetSignBytes ¶
func (msg MsgRemoveLiquidity) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgRemoveLiquidity) GetSigners ¶
func (msg MsgRemoveLiquidity) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgRemoveLiquidity) GetSwapTokenPairName ¶
func (msg MsgRemoveLiquidity) GetSwapTokenPairName() string
GetSwapTokenPair defines token pair
func (MsgRemoveLiquidity) Route ¶
func (msg MsgRemoveLiquidity) Route() string
Route should return the name of the module
func (MsgRemoveLiquidity) Type ¶
func (msg MsgRemoveLiquidity) Type() string
Type should return the action
func (MsgRemoveLiquidity) ValidateBasic ¶
func (msg MsgRemoveLiquidity) ValidateBasic() sdk.Error
ValidateBasic runs stateless checks on the message
type MsgTokenToToken ¶
type MsgTokenToToken struct { SoldTokenAmount sdk.SysCoin `json:"sold_token_amount"` // Amount of Tokens sold. MinBoughtTokenAmount sdk.SysCoin `json:"min_bought_token_amount"` // Minimum token purchased. Deadline int64 `json:"deadline"` // Time after which this transaction can no longer be executed. Recipient sdk.AccAddress `json:"recipient"` // Recipient address,transfer Tokens to recipient.default recipient is sender. Sender sdk.AccAddress `json:"sender"` // Sender }
MsgTokenToToken define the message for swap between token and DefaultBondDenom
func NewMsgTokenToToken ¶
func NewMsgTokenToToken( soldTokenAmount, minBoughtTokenAmount sdk.SysCoin, deadline int64, recipient, sender sdk.AccAddress, ) MsgTokenToToken
NewMsgTokenToToken is a constructor function for MsgTokenOKTSwap
func (MsgTokenToToken) GetSignBytes ¶
func (msg MsgTokenToToken) GetSignBytes() []byte
GetSignBytes encodes the message for signing
func (MsgTokenToToken) GetSigners ¶
func (msg MsgTokenToToken) GetSigners() []sdk.AccAddress
GetSigners defines whose signature is required
func (MsgTokenToToken) GetSwapTokenPairName ¶
func (msg MsgTokenToToken) GetSwapTokenPairName() string
GetSwapTokenPair defines token pair
func (MsgTokenToToken) Route ¶
func (msg MsgTokenToToken) Route() string
Route should return the name of the module
func (MsgTokenToToken) Type ¶
func (msg MsgTokenToToken) Type() string
Type should return the action
func (MsgTokenToToken) ValidateBasic ¶
func (msg MsgTokenToToken) ValidateBasic() sdk.Error
ValidateBasic runs stateless checks on the message
type ParamSubspace ¶
type ParamSubspace interface { WithKeyTable(table params.KeyTable) params.Subspace Get(ctx sdk.Context, key []byte, ptr interface{}) GetParamSet(ctx sdk.Context, ps params.ParamSet) SetParamSet(ctx sdk.Context, ps params.ParamSet) }
ParamSubspace defines the expected Subspace interface
type Params ¶
Params - used for initializing default parameter for swap at genesis
func DefaultParams ¶
func DefaultParams() Params
DefaultParams defines the parameters for this module
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs implements params.ParamSet
type QueryBuyAmountParams ¶
type QuerySwapAddInfoParams ¶
type QuerySwapAddInfoParams struct { QuoteTokenAmount string `json:"quote_token_amount"` BaseToken string `json:"base_token"` }
nolint
func NewQuerySwapAddInfoParams ¶
func NewQuerySwapAddInfoParams(quoteTokenAmount string, baseToken string) QuerySwapAddInfoParams
NewQuerySwapAddInfoParams creates a new instance of QuerySwapAddInfoParams
type QuerySwapBuyInfoParams ¶
type QuerySwapBuyInfoParams struct { SellTokenAmount string `json:"sell_token_amount"` BuyToken string `json:"buy_token"` }
nolint
func NewQuerySwapBuyInfoParams ¶
func NewQuerySwapBuyInfoParams(sellTokenAmount string, buyToken string) QuerySwapBuyInfoParams
NewQuerySwapBuyInfoParams creates a new instance of QuerySwapBuyInfoParams
type SupplyKeeper ¶
type SupplyKeeper interface { GetSupplyByDenom(ctx sdk.Context, denom string) sdk.Dec SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error }
SupplyKeeper defines the expected supply interface
type SwapAddInfo ¶
type SwapBuyInfo ¶
type SwapTokenPair ¶
type SwapTokenPair struct { QuotePooledCoin sdk.SysCoin `json:"quote_pooled_coin"` // The volume of quote token in the token pair exchange pool BasePooledCoin sdk.SysCoin `json:"base_pooled_coin"` // The volume of base token in the token pair exchange pool PoolTokenName string `json:"pool_token_name"` // The name of pool token }
SwapTokenPair defines token pair exchange
func GetTestSwapTokenPair ¶
func GetTestSwapTokenPair() SwapTokenPair
GetTestSwapTokenPair just for test
func NewSwapPair ¶
func NewSwapPair(token0, token1 string) SwapTokenPair
func NewSwapTokenPair ¶
func NewSwapTokenPair(quotePooledCoin sdk.SysCoin, basePooledCoin sdk.SysCoin, poolTokenName string) *SwapTokenPair
NewSwapTokenPair is a constructor function for SwapTokenPair
func (SwapTokenPair) TokenPairName ¶
func (s SwapTokenPair) TokenPairName() string
TokenPairName defines token pair
type TokenKeeper ¶
type TokenKeeper interface { GetTokenInfo(ctx sdk.Context, symbol string) token.Token NewToken(ctx sdk.Context, token token.Token) UpdateToken(ctx sdk.Context, token token.Token) GetCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.SysCoins TokenExist(ctx sdk.Context, symbol string) bool GetTokensInfo(ctx sdk.Context) (tokens []token.Token) }
TokenKeeper defines the expected token interface