Documentation ¶
Index ¶
- func NewQuerier(keeper Keeper) sdk.Querier
- type Keeper
- func (k Keeper) AddAsset(ctx sdk.Context, nominee string, assetCode string, asset types.Asset) error
- func (k Keeper) AddOracle(ctx sdk.Context, nominee string, assetCode string, address sdk.AccAddress) error
- func (k Keeper) CheckPriceReceivedAtTimestamp(ctx sdk.Context, receivedAt time.Time) sdk.Error
- func (k Keeper) Codespace() sdk.CodespaceType
- func (k Keeper) GetAsset(ctx sdk.Context, assetCode string) (types.Asset, bool)
- func (k Keeper) GetAssetParams(ctx sdk.Context) types.Assets
- func (k Keeper) GetCurrentPrice(ctx sdk.Context, assetCode string) types.CurrentPrice
- func (k Keeper) GetNomineeParams(ctx sdk.Context) []string
- func (k Keeper) GetOracle(ctx sdk.Context, assetCode string, address sdk.AccAddress) (types.Oracle, error)
- func (k Keeper) GetOracles(ctx sdk.Context, assetCode string) (types.Oracles, error)
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPostPriceParams(ctx sdk.Context) types.PostPriceParams
- func (k Keeper) GetRawPrices(ctx sdk.Context, assetCode string, blockHeight int64) []types.PostedPrice
- func (k Keeper) IsNominee(ctx sdk.Context, nominee string) bool
- func (k Keeper) SetAsset(ctx sdk.Context, nominee string, assetCode string, asset types.Asset) error
- func (k Keeper) SetCurrentPrices(ctx sdk.Context) sdk.Error
- func (k Keeper) SetOracles(ctx sdk.Context, nominee string, assetCode string, addresses types.Oracles) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPrice(ctx sdk.Context, oracle sdk.AccAddress, assetCode string, price sdk.Int, ...) (types.PostedPrice, sdk.Error)
- func (k Keeper) ValidatePostPrice(ctx sdk.Context, msg types.MsgPostPrice) sdk.Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewQuerier ¶
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 ¶
Check PostPrice's ReceivedAt timestamp (algorithm depends on module params)
func (Keeper) Codespace ¶
func (k Keeper) Codespace() sdk.CodespaceType
func (Keeper) GetAssetParams ¶
GetAssetParams get asset params from store
func (Keeper) GetCurrentPrice ¶
GetCurrentPrice fetches the current median price of all oracles for a specific asset
func (Keeper) GetNomineeParams ¶
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 ¶
GetOracles returns the oracles in the oracle 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) 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 ¶
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) 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 ¶
ValidatePostPrice makes sure the person posting the price is an oracle