keeper

package
v2.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

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 BuildPricePrefix(id uint32, denom string, ts time.Time) ([]byte, error)

func DecodeTimestamp

func DecodeTimestamp(buf []byte) (time.Time, error)

DecodeTimestamp parses a 31-byte timestamp buffer back into time.Time.

func EncodeTimestamp

func EncodeTimestamp(t time.Time) []byte

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

func (Querier) Prices

type SetParamsHook

type SetParamsHook func(sdk.Context, types.Params)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL