Oracle Program
The oracle program is responsible for several tasks:
- Maintaining the set of price feeds.
- Storing the contributions of data providers to each price feed.
- Combining the individual data providers' prices into a single aggregate price and confidence interval.
- Performing any additional stateful computations on the resulting price series, such as computing moving averages.
The oracle solves these problems by maintaining a collection of SVM accounts to represent the set of price feeds.
Each feed has two accounts: a product account to store metadata and a price account.
The price account stores a list of authorized data providers for this specific price feed, and allocates storage space for each data provider's price.
The oracle program exposes an instruction called upd_price
that enables an authorized data provider to update the price account with their current estimate of the price and confidence interval.
Additionally, the first time that upd_price
is called in a slot, it will aggregate the individual data provider's prices into an aggregate price and confidence interval.
Only the aggregate price and confidence are made available for use in downstream applications; the individual data providers prices are internal state of the oracle program.
Finally, the oracle program computes an exponentially-weighted moving average of the oracle price.