types

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName   = "pricefeed"
	StoreKey     = ModuleName
	RouterKey    = ModuleName
	QuerierRoute = ModuleName

	MsgTypeSetPrice  = "setPrice"
	MsgTypeAddOracle = "addOracle"

	QueryGetCurrentPrice  = "price"
	QueryGetCurrentPrices = "prices"
	QueryGetOracles       = "oracles"

	AssetsStoreKey = StoreKey + ":assets:"

	CurrentPricesPrefix = StoreKey + ":currentPrices:"
	RawPricesPrefix     = StoreKey + ":rawPrices:"

	OraclePrefix = StoreKey + ":oracles:"
)

Variables

View Source
var ModuleCdc *codec.Codec

Functions

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on wire codec

Types

type MsgAddOracle

type MsgAddOracle struct {
	Signer sdk.AccAddress `json:"signer"`
	Oracle sdk.AccAddress `json:"oracle"`
}

func NewMsgAddOracle

func NewMsgAddOracle(signer sdk.AccAddress, oracle sdk.AccAddress) MsgAddOracle

func (MsgAddOracle) GetSignBytes

func (msg MsgAddOracle) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgAddOracle) GetSigners

func (msg MsgAddOracle) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgAddOracle) Route

func (msg MsgAddOracle) Route() string

Route Implements Msg.

func (MsgAddOracle) Type

func (msg MsgAddOracle) Type() string

Type Implements Msg.

func (MsgAddOracle) ValidateBasic

func (msg MsgAddOracle) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type MsgSetPrice

type MsgSetPrice struct {
	Oracle sdk.AccAddress `json:"oracle"`
	Price  Price          `json:"price"`
}

func NewMsgSetPrice

func NewMsgSetPrice(price Price, oracle sdk.AccAddress) MsgSetPrice

func (MsgSetPrice) GetSignBytes

func (msg MsgSetPrice) GetSignBytes() []byte

GetSignBytes Implements Msg.

func (MsgSetPrice) GetSigners

func (msg MsgSetPrice) GetSigners() []sdk.AccAddress

GetSigners Implements Msg.

func (MsgSetPrice) Route

func (msg MsgSetPrice) Route() string

Route Implements Msg.

func (MsgSetPrice) Type

func (msg MsgSetPrice) Type() string

Type Implements Msg.

func (MsgSetPrice) ValidateBasic

func (msg MsgSetPrice) ValidateBasic() sdk.Error

ValidateBasic Implements Msg.

type Price added in v1.3.2

type Price struct {
	AssetName string  `json:"asset_name"`
	Value     sdk.Dec `json:"value"`
	Expiry    sdk.Int `json:"expiry"` // Block height after which the price is to be considered invalid
}

Price represents the price of an asset that has been set from an oracle

func EmptyPrice added in v1.3.2

func EmptyPrice() Price

func NewPrice added in v1.3.2

func NewPrice(assetName string, price sdk.Dec, expiry sdk.Int) Price

func (Price) Equals added in v1.3.2

func (currentPrice Price) Equals(cp Price) bool

Implements equatable

func (Price) String added in v1.3.2

func (currentPrice Price) String() string

implements Stringer

type Prices added in v1.3.2

type Prices []Price

Prices represents a slice of Price objects

func (Prices) AppendIfMissing added in v1.3.2

func (prices Prices) AppendIfMissing(price Price) (Prices, bool)

AppendIfMissing appends the given price to the prices slice, returning the new slice as well as a boolean telling if the appending was successful

type RawPrice

type RawPrice struct {
	Oracle  sdk.AccAddress `json:"oracle"`
	Price   Price          `json:"price"`
	Created sdk.Int        `json:"created"`
}

RawPrice represents a raw price

func (RawPrice) Equals

func (rawPrice RawPrice) Equals(rp RawPrice) bool

type RawPrices

type RawPrices []RawPrice

func (RawPrices) UpdatePriceOrAppendIfMissing

func (rawPrices RawPrices) UpdatePriceOrAppendIfMissing(rp RawPrice) (RawPrices, bool)

Jump to

Keyboard shortcuts

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