v0_13

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyMarkets     = []byte("Markets")
	DefaultMarkets = Markets{}
)

Parameter keys

Functions

This section is empty.

Types

type CurrentPrice

type CurrentPrice struct {
	MarketID string  `json:"market_id" yaml:"market_id"`
	Price    sdk.Dec `json:"price" yaml:"price"`
}

CurrentPrice struct that contains the metadata of a current price for a particular market in the pricefeed module.

func NewCurrentPrice

func NewCurrentPrice(marketID string, price sdk.Dec) CurrentPrice

NewCurrentPrice returns an instance of CurrentPrice

type CurrentPrices

type CurrentPrices []CurrentPrice

CurrentPrices type for an array of CurrentPrice

type GenesisState

type GenesisState struct {
	Params       Params       `json:"params" yaml:"params"`
	PostedPrices PostedPrices `json:"posted_prices" yaml:"posted_prices"`
}

GenesisState - pricefeed state that must be provided at genesis

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState defines default GenesisState for pricefeed

func NewGenesisState

func NewGenesisState(p Params, pp []PostedPrice) GenesisState

NewGenesisState creates a new genesis state for the pricefeed module

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic validation of genesis data returning an error for any failed validation criteria.

type Market

type Market struct {
	MarketID   string           `json:"market_id" yaml:"market_id"`
	BaseAsset  string           `json:"base_asset" yaml:"base_asset"`
	QuoteAsset string           `json:"quote_asset" yaml:"quote_asset"`
	Oracles    []sdk.AccAddress `json:"oracles" yaml:"oracles"`
	Active     bool             `json:"active" yaml:"active"`
}

Market an asset in the pricefeed

func NewMarket

func NewMarket(id, base, quote string, oracles []sdk.AccAddress, active bool) Market

NewMarket returns a new Market

func (Market) Validate

func (m Market) Validate() error

Validate performs a basic validation of the market params

type Markets

type Markets []Market

Markets array type for oracle

func (Markets) Validate

func (ms Markets) Validate() error

Validate checks if all the markets are valid and there are no duplicated entries.

type Params

type Params struct {
	Markets Markets `json:"markets" yaml:"markets"` //  Array containing the markets supported by the pricefeed
}

Params params for pricefeed. Can be altered via governance

func DefaultParams

func DefaultParams() Params

DefaultParams default params for pricefeed

func NewParams

func NewParams(markets Markets) Params

NewParams creates a new AssetParams object

func (Params) Validate

func (p Params) Validate() error

Validate ensure that params have valid values

type PostedPrice

type PostedPrice struct {
	MarketID      string         `json:"market_id" yaml:"market_id"`
	OracleAddress sdk.AccAddress `json:"oracle_address" yaml:"oracle_address"`
	Price         sdk.Dec        `json:"price" yaml:"price"`
	Expiry        time.Time      `json:"expiry" yaml:"expiry"`
}

PostedPrice price for market posted by a specific oracle

func NewPostedPrice

func NewPostedPrice(marketID string, oracle sdk.AccAddress, price sdk.Dec, expiry time.Time) PostedPrice

NewPostedPrice returns a new PostedPrice

func (PostedPrice) Validate

func (pp PostedPrice) Validate() error

Validate performs a basic check of a PostedPrice params.

type PostedPrices

type PostedPrices []PostedPrice

PostedPrices type for an array of PostedPrice

func (PostedPrices) Validate

func (pps PostedPrices) Validate() error

Validate checks if all the posted prices are valid and there are no duplicated entries.

Jump to

Keyboard shortcuts

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