price

package
v0.6.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler added in v0.4.0

func NewHandler(pm PriceKeeper) sdk.Handler

NewHandler - Handle all "price" type messages.

func NewQuerier added in v0.4.0

func NewQuerier(pm PriceKeeper) sdk.Querier

creates a querier for price REST endpoints

Types

type FeedPriceMsg added in v0.4.0

type FeedPriceMsg = types.FeedPriceMsg

type PriceKeeper

type PriceKeeper interface {
	// set initial price of LINO
	InitGenesis(ctx sdk.Context, initPrice linotypes.MiniDollar) sdk.Error

	// feed price.
	FeedPrice(ctx sdk.Context, validator linotypes.AccountKey, price linotypes.MiniDollar) sdk.Error

	// UpdatePrice is the hourly event.
	UpdatePrice(ctx sdk.Context) sdk.Error

	// CoinToMiniDollar - convert minidollar to coin
	// since internally, every coin have a price of minidollar, so any amount of coin
	// can all be converted into minidollar.
	CoinToMiniDollar(ctx sdk.Context, coin linotypes.Coin) (bought linotypes.MiniDollar, err sdk.Error)

	// MiniDollarToCoin - return the maximum coins that @p dollar can buy and
	// the amount of dollar used. The returned value is a pair of (new token, used previous token).
	// As there is a minimum price of coin, for dollars that are less than price of one coin
	// they are not used.
	MiniDollarToCoin(ctx sdk.Context, dollar linotypes.MiniDollar) (bought linotypes.Coin, used linotypes.MiniDollar, err sdk.Error)

	// Getters
	CurrPrice(ctx sdk.Context) (linotypes.MiniDollar, sdk.Error)
	HistoryPrice(ctx sdk.Context) []model.FeedHistory
	LastFeed(ctx sdk.Context, validator linotypes.AccountKey) (*model.FedPrice, sdk.Error)
}

PriceKeeper - conversion between Coin/MiniDollar at current consensus price.

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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