oracle

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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