pricefeed

package
v0.13.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package pricefeed allows a group of white-listed oracles to post price information of specific markets that are tracked by the system. For each market, the module computes the median of all posted prices by white-listed oracles and takes that as the current price value.

Index

Constants

View Source
const (
	AttributeExpiry             = types.AttributeExpiry
	AttributeMarketID           = types.AttributeMarketID
	AttributeMarketPrice        = types.AttributeMarketPrice
	AttributeOracle             = types.AttributeOracle
	AttributeValueCategory      = types.AttributeValueCategory
	DefaultParamspace           = types.DefaultParamspace
	EventTypeMarketPriceUpdated = types.EventTypeMarketPriceUpdated
	EventTypeNoValidPrices      = types.EventTypeNoValidPrices
	EventTypeOracleUpdatedPrice = types.EventTypeOracleUpdatedPrice
	MaxExpiry                   = types.MaxExpiry
	ModuleName                  = types.ModuleName
	QuerierRoute                = types.QuerierRoute
	QueryGetParams              = types.QueryGetParams
	QueryMarkets                = types.QueryMarkets
	QueryOracles                = types.QueryOracles
	QueryPrice                  = types.QueryPrice
	QueryRawPrices              = types.QueryRawPrices
	RouterKey                   = types.RouterKey
	StoreKey                    = types.StoreKey
	TypeMsgPostPrice            = types.TypeMsgPostPrice
)

Variables

View Source
var (
	// function aliases
	NewKeeper                  = keeper.NewKeeper
	NewQuerier                 = keeper.NewQuerier
	CurrentPriceKey            = types.CurrentPriceKey
	DefaultGenesisState        = types.DefaultGenesisState
	DefaultParams              = types.DefaultParams
	NewCurrentPrice            = types.NewCurrentPrice
	NewGenesisState            = types.NewGenesisState
	NewMarket                  = types.NewMarket
	NewMsgPostPrice            = types.NewMsgPostPrice
	NewParams                  = types.NewParams
	NewPostedPrice             = types.NewPostedPrice
	NewQueryWithMarketIDParams = types.NewQueryWithMarketIDParams
	ParamKeyTable              = types.ParamKeyTable
	RawPriceKey                = types.RawPriceKey
	RegisterCodec              = types.RegisterCodec

	// variable aliases
	CurrentPricePrefix = types.CurrentPricePrefix
	DefaultMarkets     = types.DefaultMarkets
	ErrAssetNotFound   = types.ErrAssetNotFound
	ErrEmptyInput      = types.ErrEmptyInput
	ErrExpired         = types.ErrExpired
	ErrInvalidMarket   = types.ErrInvalidMarket
	ErrInvalidOracle   = types.ErrInvalidOracle
	ErrNoValidPrice    = types.ErrNoValidPrice
	KeyMarkets         = types.KeyMarkets
	ModuleCdc          = types.ModuleCdc
	RawPriceFeedPrefix = types.RawPriceFeedPrefix
)

Functions

func EndBlocker

func EndBlocker(ctx sdk.Context, k Keeper)

EndBlocker updates the current pricefeed

func HandleMsgPostPrice

func HandleMsgPostPrice(
	ctx sdk.Context,
	k Keeper,
	msg MsgPostPrice) (*sdk.Result, error)

HandleMsgPostPrice handles prices posted by oracles

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper Keeper, gs GenesisState)

InitGenesis sets distribution information for genesis.

func NewHandler

func NewHandler(k Keeper) sdk.Handler

NewHandler handles all pricefeed type messages

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule app module type

func NewAppModule

func NewAppModule(keeper Keeper, accountKeeper auth.AccountKeeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)

BeginBlock module begin-block

func (AppModule) EndBlock

EndBlock module end-block

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

ExportGenesis module export genesis

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis module init-genesis

func (AppModule) Name

func (AppModule) Name() string

Name module name

func (AppModule) NewHandler

func (am AppModule) NewHandler() sdk.Handler

NewHandler module handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler module querier

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute module querier route name

func (AppModule) RegisterInvariants

func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

RegisterInvariants register module invariants

func (AppModule) Route

func (AppModule) Route() string

Route module message route name

func (AppModule) WeightedOperations added in v0.8.0

func (am AppModule) WeightedOperations(simState module.SimulationState) []sim.WeightedOperation

WeightedOperations returns the all the price feed module operations with their respective weights.

type AppModuleBasic

type AppModuleBasic struct{}

AppModuleBasic app module basics object

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

DefaultGenesis default genesis state

func (AppModuleBasic) GenerateGenesisState added in v0.8.0

func (AppModuleBasic) GenerateGenesisState(simState *module.SimulationState)

GenerateGenesisState creates a randomized GenState of the price feed module

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

GetQueryCmd get the root query command of this module

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

GetTxCmd get the root tx command of this module

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name get module name

func (AppModuleBasic) ProposalContents added in v0.8.0

ProposalContents doesn't return any content functions for governance proposals.

func (AppModuleBasic) RandomizedParams added in v0.8.0

func (AppModuleBasic) RandomizedParams(r *rand.Rand) []sim.ParamChange

RandomizedParams returns nil because price feed has no params.

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

RegisterCodec register module codec

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

RegisterRESTRoutes register rest routes

func (AppModuleBasic) RegisterStoreDecoder added in v0.8.0

func (AppModuleBasic) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder for price feed module's types

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

ValidateGenesis module validate genesis

type CurrentPrice

type CurrentPrice = types.CurrentPrice

type CurrentPrices added in v0.11.0

type CurrentPrices = types.CurrentPrices

type GenesisState

type GenesisState = types.GenesisState

func ExportGenesis

func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState

ExportGenesis returns a GenesisState for a given context and keeper.

type Keeper

type Keeper = keeper.Keeper

type Market

type Market = types.Market

type Markets

type Markets = types.Markets

type MsgPostPrice

type MsgPostPrice = types.MsgPostPrice

type Params

type Params = types.Params

type PostedPrice

type PostedPrice = types.PostedPrice

type PostedPrices added in v0.8.0

type PostedPrices = types.PostedPrices

type QueryWithMarketIDParams

type QueryWithMarketIDParams = types.QueryWithMarketIDParams

type SortDecs

type SortDecs = types.SortDecs

Directories

Path Synopsis
client
cli
legacy

Jump to

Keyboard shortcuts

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