Documentation
¶
Index ¶
- type PriceFeeder
- func (pf *PriceFeeder) AdvanceBlockAndFeed(ctx sdk.Context, blocks int64) (sdk.Context, error)
- func (pf *PriceFeeder) FeedPrice(ctx sdk.Context, denom string) error
- func (pf *PriceFeeder) FeedPrices(ctx sdk.Context) error
- func (pf *PriceFeeder) SetPrice(denom string, priceUSD sdkmath.LegacyDec)
- func (pf *PriceFeeder) UpdatePrice(ctx sdk.Context, denom string, priceUSD sdkmath.LegacyDec) error
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 ¶
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 ¶
UpdatePrice updates an existing price and feeds it to the oracle