v0_11

package
v0.15.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// ModuleName name that will be used throughout the module
	ModuleName = "swap"
)

Variables

View Source
var (
	KeyAllowedPools     = []byte("AllowedPools")
	KeySwapFee          = []byte("SwapFee")
	DefaultAllowedPools = AllowedPools{}
	DefaultSwapFee      = sdk.ZeroDec()
	MaxSwapFee          = sdk.OneDec()
)

Parameter keys and default values

Functions

func ParamKeyTable

func ParamKeyTable() params.KeyTable

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

func (Params) String

func (p Params) String() string

String implements fmt.Stringer

func (Params) Validate

func (p Params) Validate() error

Validate checks that the parameters have valid values.

Jump to

Keyboard shortcuts

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