keeper

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: GPL-3.0 Imports: 11 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,
	vmKeeper common_vm.VMStorage,
) 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

AddAsset adds non-existing asset to the store

func (Keeper) AddOracle

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

AddOracle adds the oracle to the oracle store for specific assetCode

func (Keeper) CheckPriceReceivedAtTimestamp

func (k Keeper) CheckPriceReceivedAtTimestamp(ctx sdk.Context, receivedAt time.Time) sdk.Error

Check PostPrice's ReceivedAt timestamp (algorithm depends on module params)

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 for specific assetCode

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) GetPostPriceParams

func (k Keeper) GetPostPriceParams(ctx sdk.Context) types.PostPriceParams

GetPostPriceParams get nominee params from store

func (Keeper) GetRawPrices

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

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

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

SetAsset overwrites existing asset for specific assetCode

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 and cleans up previous inputs

func (Keeper) SetOracles

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

SetOracles sets the oracle store for specific assetCode

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.Int,
	receivedAt 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