keeper

package
v0.0.2-0...-13a971e Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

Types

type Keeper

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

Keeper struct for oracle module

func NewKeeper

func NewKeeper(
	storeKey sdk.StoreKey,
	cdc *codec.Codec,
	paramstore params.Subspace,
	codespace sdk.CodespaceType,
) Keeper

NewKeeper returns a new keeper for the oralce module. It handles: - adding oracles - adding/removing assets from the oracle

func (Keeper) AddAsset

func (k Keeper) AddAsset(ctx sdk.Context, nominee string, assetCode string, asset types.Asset) error

AddOracle returns the oracle in the oracle store

func (Keeper) AddOracle

func (k Keeper) AddOracle(ctx sdk.Context, nominee string, assetCode string, address sdk.AccAddress) error

AddOracle returns the oracle in the oracle store

func (Keeper) Codespace

func (k Keeper) Codespace() sdk.CodespaceType

func (Keeper) GetAsset

func (k Keeper) GetAsset(ctx sdk.Context, assetCode string) (types.Asset, bool)

GetAsset returns the asset if it is in the oracle system

func (Keeper) GetAssetParams

func (k Keeper) GetAssetParams(ctx sdk.Context) types.Assets

GetAssetParams get asset params from store

func (Keeper) GetCurrentPrice

func (k Keeper) GetCurrentPrice(ctx sdk.Context, assetCode string) types.CurrentPrice

GetCurrentPrice fetches the current median price of all oracles for a specific asset

func (Keeper) GetNomineeParams

func (k Keeper) GetNomineeParams(ctx sdk.Context) []string

GetNomineeParams get nominee params from store

func (Keeper) GetOracle

func (k Keeper) GetOracle(ctx sdk.Context, assetCode string, address sdk.AccAddress) (types.Oracle, error)

GetOracle returns the oracle from the store or an error if not found

func (Keeper) GetOracles

func (k Keeper) GetOracles(ctx sdk.Context, assetCode string) (types.Oracles, error)

GetOracles returns the oracles in the oracle store

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams gets params from the store

func (Keeper) GetRawPrices

func (k Keeper) GetRawPrices(ctx sdk.Context, assetCode string) []types.PostedPrice

GetRawPrices fetches the set of all prices posted by oracles for an asset

func (Keeper) IsNominee

func (k Keeper) IsNominee(ctx sdk.Context, nominee string) bool

func (Keeper) SetAsset

func (k Keeper) SetAsset(ctx sdk.Context, nominee string, assetCode string, asset types.Asset) error

AddOracle returns the oracle in the oracle store

func (Keeper) SetCurrentPrices

func (k Keeper) SetCurrentPrices(ctx sdk.Context) sdk.Error

SetCurrentPrices updates the price of an asset to the median of all valid oracle inputs

func (Keeper) SetOracles

func (k Keeper) SetOracles(ctx sdk.Context, nominee string, assetCode string, addresses types.Oracles) error

AddOracle returns the oracle in the oracle store

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams updates params in the store

func (Keeper) SetPrice

func (k Keeper) SetPrice(
	ctx sdk.Context,
	oracle sdk.AccAddress,
	assetCode string,
	price sdk.Dec,
	expiry time.Time) (types.PostedPrice, sdk.Error)

SetPrice updates the posted price for a specific oracle

func (Keeper) ValidatePostPrice

func (k Keeper) ValidatePostPrice(ctx sdk.Context, msg types.MsgPostPrice) sdk.Error

ValidatePostPrice makes sure the person posting the price is an oracle

Jump to

Keyboard shortcuts

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