model

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2019 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentPriceKey

func GetCurrentPriceKey() []byte

GetCurrentPriceKey - get current price.

func GetFedPriceKey

func GetFedPriceKey(u linotypes.AccountKey) []byte

GetFedPriceKey - price key.

func GetFeedHistoryKey

func GetFeedHistoryKey() []byte

GetLastValidatorsKey - get last validators.

func GetLastValidatorsKey

func GetLastValidatorsKey() []byte

GetLastValidatorsKey - get last validators.

func GetPriceHistoryKey

func GetPriceHistoryKey() []byte

GetPriceHistoryKey - hourly price.

func NewPriceDumper

func NewPriceDumper(store PriceStorage) *testutils.Dumper

Types

type FedPrice

type FedPrice struct {
	Validator linotypes.AccountKey `json:"validator"`
	Price     linotypes.MiniDollar `json:"price"`
	UpdateAt  int64                `json:"update_at"`
}

FedPrice is record of price fed by validators.

type FedRecord

type FedRecord struct {
	Validator linotypes.AccountKey `json:"validator"`
	Price     linotypes.MiniDollar `json:"price"`
	Power     linotypes.Coin       `json:"power"`
	UpdateAt  int64                `json:"update_at"`
}

FedRecord - power and price.

type FeedHistory

type FeedHistory struct {
	Price    linotypes.MiniDollar `json:"price"`
	Feeded   []FedRecord          `json:"feeded"`
	UpdateAt int64                `json:"update_at"`
}

FeedHistory the history of price feed of one price update. Used by querier for now and governance in future.

type PriceStorage

type PriceStorage struct {
	// contains filtered or unexported fields
}

PriceStorage - price storage

func NewPriceStorage

func NewPriceStorage(key sdk.StoreKey) PriceStorage

NewPriceStorage - returns a new PriceStorage, binary encoded.

func (PriceStorage) GetCurrentPrice

func (ps PriceStorage) GetCurrentPrice(ctx sdk.Context) (*TimePrice, sdk.Error)

GetCurrentPrice - return current price

func (PriceStorage) GetFedPrice

func (ps PriceStorage) GetFedPrice(ctx sdk.Context, val linotypes.AccountKey) (*FedPrice, sdk.Error)

GetFedPrice - get fed price of validator from KVStore

func (PriceStorage) GetFeedHistory

func (ps PriceStorage) GetFeedHistory(ctx sdk.Context) []FeedHistory

func (PriceStorage) GetLastValidators

func (ps PriceStorage) GetLastValidators(ctx sdk.Context) []linotypes.AccountKey

func (PriceStorage) GetPriceHistory

func (ps PriceStorage) GetPriceHistory(ctx sdk.Context) []TimePrice

GetPriceHistory - return price history.

func (PriceStorage) SetCurrentPrice

func (ps PriceStorage) SetCurrentPrice(ctx sdk.Context, price *TimePrice)

func (PriceStorage) SetFedPrice

func (ps PriceStorage) SetFedPrice(ctx sdk.Context, price *FedPrice)

SetFedPrice - set fed price to KVStore

func (PriceStorage) SetFeedHistory

func (ps PriceStorage) SetFeedHistory(ctx sdk.Context, history []FeedHistory)

func (PriceStorage) SetLastValidators

func (ps PriceStorage) SetLastValidators(ctx sdk.Context, last []linotypes.AccountKey)

func (PriceStorage) SetPriceHistory

func (ps PriceStorage) SetPriceHistory(ctx sdk.Context, prices []TimePrice)

SetPriceHistory - set price history.

type TimePrice

type TimePrice struct {
	Price    linotypes.MiniDollar `json:"price"`
	UpdateAt int64                `json:"update_at"`
}

TimePrice is time + price

Jump to

Keyboard shortcuts

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