Documentation
¶
Index ¶
- Constants
- Variables
- func BuildPricePrefix(id uint32, denom string, ts time.Time) ([]byte, error)
- func DecodeTimestamp(buf []byte) (time.Time, error)
- func EncodeTimestamp(t time.Time) []byte
- func EpochHooksFor(k Keeper) epochstypes.EpochHooks
- type Keeper
- type Querier
- func (k Querier) AggregatedPrice(ctx context.Context, req *types.QueryAggregatedPriceRequest) (*types.QueryAggregatedPriceResponse, error)
- func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) Prices(ctx context.Context, req *types.QueryPricesRequest) (*types.QueryPricesResponse, error)
- type SetParamsHook
Constants ¶
View Source
const TimestampEncodedSize = 31
Variables ¶
View Source
var ( PriceDataIDKey codec.KeyCodec[types.PriceDataID] = priceDataIDCodec{} DataIDKey codec.KeyCodec[types.DataID] = dataIDCodec{} PriceDataRecordIDKey codec.KeyCodec[types.PriceDataRecordID] = priceDataRecordIDCodec{} PriceDataRecordIDKeyLegacy codec.KeyCodec[types.PriceDataRecordID] = priceDataRecordIDLegacyCodec{} )
PriceDataRecordIDKey is the codec instance to use when creating a Map
View Source
var ( PricesPrefixLegacy = collections.NewPrefix([]byte{0x11, 0x00}) LatestPriceIDPrefix = collections.NewPrefix([]byte{0x11, 0x01}) AggregatedPricesPrefix = collections.NewPrefix([]byte{0x11, 0x02}) PricesHealthPrefix = collections.NewPrefix([]byte{0x11, 0x03}) PricesPrefix = collections.NewPrefix([]byte{0x11, 0x05}) SourcesSeqPrefix = collections.NewPrefix([]byte{0x12, 0x00}) PricesSeqPrefix = collections.NewPrefix([]byte{0x12, 0x01}) SourcesIDPrefix = collections.NewPrefix([]byte{0x12, 0x02}) ParamsKey = collections.NewPrefix(0x09) // key for oracle module params )
Functions ¶
func BuildPricePrefix ¶
func DecodeTimestamp ¶
DecodeTimestamp parses a 31-byte timestamp buffer back into time.Time.
func EncodeTimestamp ¶
EncodeTimestamp writes a time.Time as a 31-byte fixed-size string in the format YYYY.MM.DD.HH.MM.SS.MMM.UUU.NNN (UTC). This encoding preserves lexicographic ordering == chronological ordering.
func EpochHooksFor ¶
func EpochHooksFor(k Keeper) epochstypes.EpochHooks
EpochHooksFor returns an EpochHooks wrapper suitable for passing to epochs.SetHooks via MultiEpochHooks.
Types ¶
type Keeper ¶
type Keeper interface {
Schema() collections.Schema
StoreKey() storetypes.StoreKey
Codec() codec.BinaryCodec
GetAuthority() string
NewQuerier() Querier
BeginBlocker(ctx context.Context) error
EndBlocker(ctx context.Context) error
GetParams(sdk.Context) (types.Params, error)
SetParams(sdk.Context, types.Params) error
AddPriceEntry(ctx sdk.Context, source sdk.Address, id types.DataID, price sdkmath.LegacyDec, timestamp time.Time) error
GetAggregatedPrice(ctx sdk.Context, denom string) (sdkmath.LegacyDec, error)
SetAggregatedPrice(sdk.Context, types.DataID, types.AggregatedPrice) error
SetPriceHealth(sdk.Context, types.DataID, types.PriceHealth) error
InitGenesis(ctx sdk.Context, data *types.GenesisState)
ExportGenesis(ctx sdk.Context) *types.GenesisState
}
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, skey *storetypes.KVStoreKey, tkey *storetypes.TransientStoreKey, authority string) Keeper
NewKeeper creates and returns an instance of take keeper
type Querier ¶
type Querier struct {
Keeper
}
Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper
func (Querier) AggregatedPrice ¶
func (k Querier) AggregatedPrice(ctx context.Context, req *types.QueryAggregatedPriceRequest) (*types.QueryAggregatedPriceResponse, error)
func (Querier) Params ¶
func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Querier) Prices ¶
func (k Querier) Prices(ctx context.Context, req *types.QueryPricesRequest) (*types.QueryPricesResponse, error)
Click to show internal directories.
Click to hide internal directories.