PriceOracle

PriceOracle ensures fair pricing by storing historical prices and computing time-weighted average prices (TWAP).

Key Fields:

  • id: Unique identifier for the oracle.

  • price_cumulative: An accumulated total of historical prices used to compute averages.

  • last_update_time: When the oracle last recorded a price sample.

  • price_samples: A vector of recorded prices for computing TWAP.

  • sample_period: The time interval between samples, e.g., hourly.

Role:

  • Provides stable, manipulation-resistant price references.

  • Helps detect abnormal price fluctuations or limit price impact, protecting traders.

  • Integrates with TradingPools to adjust prices or verify trades against TWAP values.

Last updated