Keeper
The oracle module currently provides three different exported keeper interfaces which can be passed to other modules which need to read price feeds. Modules should use the least-permissive interface which provides the functionality they require.
Oracle Module ViewKeeper
The oracle module ViewKeeper provides the ability to obtain price data as well as cumulative price data for any supported oracle type and oracle pair.
type ViewKeeper interface {
GetPrice(ctx sdk.Context, oracletype types.OracleType, base string, quote string) *math.LegacyDec // Returns the price for a given pair for a given oracle type.
GetCumulativePrice(ctx sdk.Context, oracleType types.OracleType, base string, quote string) *math.LegacyDec // Returns the cumulative price for a given pair for a given oracle type.
}Note that the GetPrice for Coinbase oracles returns the 5 minute TWAP price.
Band
The BandKeeper provides the ability to create/modify/read/delete BandPricefeed and BandRelayer.
type BandKeeper interface {
GetBandPriceState(ctx sdk.Context, symbol string) *types.BandPriceState
SetBandPriceState(ctx sdk.Context, symbol string, priceState types.BandPriceState)
GetAllBandPriceStates(ctx sdk.Context) []types.BandPriceState
GetBandReferencePrice(ctx sdk.Context, base string, quote string) *math.LegacyDec
IsBandRelayer(ctx sdk.Context, relayer sdk.AccAddress) bool
GetAllBandRelayers(ctx sdk.Context) []string
SetBandRelayer(ctx sdk.Context, relayer sdk.AccAddress)
DeleteBandRelayer(ctx sdk.Context, relayer sdk.AccAddress)
}Band IBC
The BandIBCKeeper provides the ability to create/modify/read/delete BandIBCOracleRequest, BandIBCPriceState, BandIBCLatestClientID and BandIBCCallDataRecord.
Coinbase
The CoinbaseKeeper provides the ability to create, modify and read CoinbasePricefeed data.
The GetCoinbasePrice returns the 5 minute TWAP price of the CoinbasePriceState based off the CoinbasePriceState.Timestamp values provided by Coinbase.
PriceFeeder
The PriceFeederKeeper provides the ability to create/modify/read/delete PriceFeedPrice and PriceFeedRelayer.
Stork
The StorkKeeper provides the ability to create/modify/read StorkPricefeed and StorkPublishers data.
The GetStorkPrice returns the price(value) of the StorkPriceState.
Last updated
