Documentation ¶
Index ¶
Constants ¶
const (
// ModuleName name that will be used throughout the module
ModuleName = "swap"
)
Variables ¶
var ( KeyAllowedPools = []byte("AllowedPools") KeySwapFee = []byte("SwapFee") DefaultAllowedPools = AllowedPools{} DefaultSwapFee = sdk.ZeroDec() MaxSwapFee = sdk.OneDec() )
Parameter keys and default values
Functions ¶
func ParamKeyTable ¶
ParamKeyTable Key declaration for parameters
Types ¶
type AllowedPool ¶
type AllowedPool struct { TokenA string `json:"token_a" yaml:"token_a"` TokenB string `json:"token_b" yaml:"token_b"` }
AllowedPool defines a tradable pool
func NewAllowedPool ¶
func NewAllowedPool(tokenA, tokenB string) AllowedPool
NewAllowedPool returns a new AllowedPool object
func (AllowedPool) Name ¶
func (p AllowedPool) Name() string
Name returns a unique name for a allowedPool in alphabetical order
func (AllowedPool) String ¶
func (p AllowedPool) String() string
String pretty prints the allowedPool
func (AllowedPool) Validate ¶
func (p AllowedPool) Validate() error
Validate validates allowedPool attributes and returns an error if invalid
type AllowedPools ¶
type AllowedPools []AllowedPool
AllowedPools is a slice of AllowedPool
func NewAllowedPools ¶
func NewAllowedPools(allowedPools ...AllowedPool) AllowedPools
NewAllowedPools returns AllowedPools from the provided values
func (AllowedPools) Validate ¶
func (p AllowedPools) Validate() error
Validate validates each allowedPool and returns an error if there are any duplicates
type GenesisState ¶
type GenesisState struct {
Params Params `json:"params" yaml:"params"`
}
GenesisState is the state that must be provided at genesis.
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default genesis state
func NewGenesisState ¶
func NewGenesisState(params Params) GenesisState
NewGenesisState creates a new genesis state.
func (GenesisState) Validate ¶
func (gs GenesisState) Validate() error
Validate validates the module's genesis state
type Params ¶
type Params struct { AllowedPools AllowedPools `json:"allowed_pools" yaml:"allowed_pools"` SwapFee sdk.Dec `json:"swap_fee" yaml:"swap_fee"` }
Params are governance parameters for the swap module
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns default params for swap module
func NewParams ¶
func NewParams(pairs AllowedPools, swapFee sdk.Dec) Params
NewParams returns a new params object
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
ParamSetPairs implements the ParamSet interface and returns all the key/value pairs