oracle

package
v2.1.0-a9 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PriceFeeder

type PriceFeeder struct {
	// contains filtered or unexported fields
}

PriceFeeder is a test utility that manages oracle price feeds for testing

func NewPriceFeeder

func NewPriceFeeder(keeper oraclekeeper.Keeper, sourceAddress sdk.AccAddress) *PriceFeeder

NewPriceFeeder creates a new price feeder for testing It sets up the oracle with a test source and initializes default prices

func SetupPriceFeeder

func SetupPriceFeeder(ctx sdk.Context, keeper oraclekeeper.Keeper, t ...interface{}) (*PriceFeeder, error)

SetupPriceFeeder initializes the oracle module with a test price source and registers the source. This should be called during test setup.

func (*PriceFeeder) AdvanceBlockAndFeed

func (pf *PriceFeeder) AdvanceBlockAndFeed(ctx sdk.Context, blocks int64) (sdk.Context, error)

AdvanceBlockAndFeed advances the block height and re-feeds prices This is useful for testing price staleness and TWAP calculations

func (*PriceFeeder) FeedPrice

func (pf *PriceFeeder) FeedPrice(ctx sdk.Context, denom string) error

FeedPrice submits a price for a specific denom to the oracle This adds the price entry and directly sets aggregated price and health for immediate availability

func (*PriceFeeder) FeedPrices

func (pf *PriceFeeder) FeedPrices(ctx sdk.Context) error

FeedPrices feeds all configured prices to the oracle This is a convenience method to feed all default prices at once

func (*PriceFeeder) SetPrice

func (pf *PriceFeeder) SetPrice(denom string, priceUSD sdkmath.LegacyDec)

SetPrice sets a custom price for a denom (in USD)

func (*PriceFeeder) UpdatePrice

func (pf *PriceFeeder) UpdatePrice(ctx sdk.Context, denom string, priceUSD sdkmath.LegacyDec) error

UpdatePrice updates an existing price and feeds it to the oracle

Jump to

Keyboard shortcuts

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