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) 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) GetRawPrices(ctx sdk.Context, assetCode string) []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.Dec, ...) (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, ) 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) 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
func (Keeper) GetOracles ¶
GetOracles returns the oracles in the oracle store
func (Keeper) GetRawPrices ¶
GetRawPrices fetches the set of all prices posted by oracles for an asset
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 ¶
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) 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 ¶
ValidatePostPrice makes sure the person posting the price is an oracle