Documentation
¶
Overview ¶
Package types nolint
nolint
Index ¶
- Constants
- Variables
- func CheckUniDenom(uniDenom string) sdk.Error
- func CheckUniId(uniId string) sdk.Error
- func ErrConstraintNotMet(msg string) sdk.Error
- func ErrEqualDenom(msg string) sdk.Error
- func ErrIllegalDenom(msg string) sdk.Error
- func ErrIllegalUniId(msg string) sdk.Error
- func ErrInsufficientFunds(msg string) sdk.Error
- func ErrInvalidDeadline(msg string) sdk.Error
- func ErrNotPositive(msg string) sdk.Error
- func ErrReservePoolNotExists(msg string) sdk.Error
- func GetCoinMinDenomFromUniDenom(uniDenom string) (string, sdk.Error)
- func GetUniCoinType(uniId string) (sdk.CoinType, sdk.Error)
- func GetUniDenom(uniId string) (string, sdk.Error)
- func GetUniId(denom1, denom2 string) (string, sdk.Error)
- func ParamTypeTable() params.TypeTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateParams(p Params) error
- type AuthKeeper
- type BankKeeper
- type Input
- type MsgAddLiquidity
- type MsgRemoveLiquidity
- type MsgSwapOrder
- type Output
- type Params
- func (p *Params) GetParamSpace() string
- func (p *Params) KeyValuePairs() params.KeyValuePairs
- func (p *Params) ReadOnly() bool
- func (p Params) String() string
- func (p *Params) StringFromBytes(cdc *codec.Codec, key string, bytes []byte) (string, error)
- func (p *Params) Validate(key string, value string) (interface{}, sdk.Error)
- type QueryLiquidityParams
- type QueryLiquidityResponse
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = ModuleName CodeReservePoolNotExists sdk.CodeType = 101 CodeEqualDenom sdk.CodeType = 102 CodeInvalidDeadline sdk.CodeType = 103 CodeNotPositive sdk.CodeType = 104 CodeConstraintNotMet sdk.CodeType = 105 CodeIllegalDenom sdk.CodeType = 106 CodeIllegalUniId sdk.CodeType = 107 CodeReservePoolInsufficientFunds sdk.CodeType = 108 )
const ( // ModuleName is the name of the module. ModuleName = "coinswap" // RouterKey is the message route for the coinswap module. RouterKey = ModuleName // StoreKey is the default store key for the coinswap module. StoreKey = ModuleName // QuerierRoute is the querier route for the coinswap module. QuerierRoute = StoreKey MsgTypeAddLiquidity = "add_liquidity" MsgTypeRemoveLiquidity = "remove_liquidity" MsgTypeSwapOrder = "swap_order" )
const ( FormatUniABSPrefix = sdk.FormatUniABSPrefix FormatUniId = FormatUniABSPrefix + "%s" )
const ( // DefaultParamSpace for coinswap DefaultParamSpace = ModuleName MaxFeePrecision = 10 )
const (
// QueryLiquidity liquidity query endpoint supported by the coinswap querier
QueryLiquidity = "liquidity"
)
Variables ¶
var ( TagAmount = "amount" TagSender = "sender" TagRecipient = "recipient" TagIsBuyOrder = "is-buy-order" TagTokenPair = "token-pair" )
var ModuleCdc *codec.Codec
ModuleCdc generic sealed codec to be used throughout module
Functions ¶
func CheckUniDenom ¶
CheckUniDenom returns nil if the uni denom is valid
func CheckUniId ¶
CheckUniId returns nil if the uni id is valid
func ErrConstraintNotMet ¶
func ErrEqualDenom ¶
func ErrIllegalDenom ¶
func ErrIllegalUniId ¶
func ErrInsufficientFunds ¶
func ErrInvalidDeadline ¶
func ErrNotPositive ¶
func ErrReservePoolNotExists ¶
func GetCoinMinDenomFromUniDenom ¶
GetCoinMinDenomFromUniDenom returns the token denom by uni denom
func GetUniCoinType ¶
GetUniCoinType returns the uni coin type
func GetUniDenom ¶
GetUniDenom returns uni denom if the uni id is valid
func GetUniId ¶
GetUniId returns the unique uni id for the provided denominations. The uni id is in the format of 'u-coin-name' which the denomination is not iris-atto.
func ParamTypeTable ¶
ParamTypeTable returns the TypeTable for coinswap module
func RegisterCodec ¶
RegisterCodec registers concrete types on the codec.
Types ¶
type AuthKeeper ¶
type BankKeeper ¶
type BankKeeper interface { SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (sdk.Tags, sdk.Error) AddCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error) SubtractCoins(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coins) (sdk.Coins, sdk.Tags, sdk.Error) }
type Input ¶
type Input struct { Address sdk.AccAddress `json:"address"` Coin sdk.Coin `json:"coin"` }
MsgSwapOrder - struct for swapping a coin Input and Output can either be exact or calculated. An exact coin has the senders desired buy or sell amount. A calculated coin has the desired denomination and bounded amount the sender is willing to buy or sell in this order.
type MsgAddLiquidity ¶
type MsgAddLiquidity struct { MaxToken sdk.Coin `json:"max_token"` // coin to be deposited as liquidity with an upper bound for its amount ExactIrisAmt sdk.Int `json:"exact_iris_amt"` // exact amount of native asset being add to the liquidity pool MinLiquidity sdk.Int `json:"min_liquidity"` // lower bound UNI sender is willing to accept for deposited coins Deadline int64 `json:"deadline"` Sender sdk.AccAddress `json:"sender"` }
MsgAddLiquidity - struct for adding liquidity to a reserve pool
func NewMsgAddLiquidity ¶
func NewMsgAddLiquidity( maxToken sdk.Coin, exactIrisAmt, minLiquidity sdk.Int, deadline int64, sender sdk.AccAddress, ) MsgAddLiquidity
NewMsgAddLiquidity creates a new MsgAddLiquidity object.
func (MsgAddLiquidity) GetSignBytes ¶
func (msg MsgAddLiquidity) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgAddLiquidity) GetSigners ¶
func (msg MsgAddLiquidity) GetSigners() []sdk.AccAddress
GetSigners Implements Msg.
func (MsgAddLiquidity) ValidateBasic ¶
func (msg MsgAddLiquidity) ValidateBasic() sdk.Error
ValidateBasic Implements Msg.
type MsgRemoveLiquidity ¶
type MsgRemoveLiquidity struct { MinToken sdk.Int `json:"min_token"` // coin to be withdrawn with a lower bound for its amount WithdrawLiquidity sdk.Coin `json:"withdraw_liquidity"` // amount of UNI to be burned to withdraw liquidity from a reserve pool MinIrisAmt sdk.Int `json:"min_iris_amt"` // minimum amount of the native asset the sender is willing to accept Deadline int64 `json:"deadline"` Sender sdk.AccAddress `json:"sender"` }
MsgRemoveLiquidity - struct for removing liquidity from a reserve pool
func NewMsgRemoveLiquidity ¶
func NewMsgRemoveLiquidity( minToken sdk.Int, withdrawLiquidity sdk.Coin, minIrisAmt sdk.Int, deadline int64, sender sdk.AccAddress, ) MsgRemoveLiquidity
NewMsgRemoveLiquidity creates a new MsgRemoveLiquidity object
func (MsgRemoveLiquidity) GetSignBytes ¶
func (msg MsgRemoveLiquidity) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgRemoveLiquidity) GetSigners ¶
func (msg MsgRemoveLiquidity) GetSigners() []sdk.AccAddress
GetSigners Implements Msg.
func (MsgRemoveLiquidity) Route ¶
func (msg MsgRemoveLiquidity) Route() string
Route Implements Msg.
func (MsgRemoveLiquidity) ValidateBasic ¶
func (msg MsgRemoveLiquidity) ValidateBasic() sdk.Error
ValidateBasic Implements Msg.
type MsgSwapOrder ¶
type MsgSwapOrder struct { Input Input `json:"input"` // the amount the sender is trading Output Output `json:"output"` // the amount the sender is receiving Deadline int64 `json:"deadline"` // deadline for the transaction to still be considered valid IsBuyOrder bool `json:"is_buy_order"` // boolean indicating whether the order should be treated as a buy or sell }
func NewMsgSwapOrder ¶
func NewMsgSwapOrder( input Input, output Output, deadline int64, isBuyOrder bool, ) MsgSwapOrder
NewMsgSwapOrder creates a new MsgSwapOrder object.
func (MsgSwapOrder) GetSignBytes ¶
func (msg MsgSwapOrder) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgSwapOrder) GetSigners ¶
func (msg MsgSwapOrder) GetSigners() []sdk.AccAddress
GetSigners Implements Msg.
func (MsgSwapOrder) ValidateBasic ¶
func (msg MsgSwapOrder) ValidateBasic() sdk.Error
ValidateBasic Implements Msg.
type Output ¶
type Output struct { Address sdk.AccAddress `json:"address"` Coin sdk.Coin `json:"coin"` }
type Params ¶
Params defines the fee and native denomination for coinswap
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns the default coinswap module parameters
func (*Params) GetParamSpace ¶
GetParamSpace Implements params.ParamStruct
func (*Params) KeyValuePairs ¶
func (p *Params) KeyValuePairs() params.KeyValuePairs
KeyValuePairs Implements params.KeyValuePairs
func (*Params) StringFromBytes ¶
StringFromBytes Implements params.StringFromBytes
type QueryLiquidityParams ¶
type QueryLiquidityParams struct {
Id string
}
QueryLiquidityParams is the query parameters for 'custom/swap/liquidity'