Oracle
A blockchain cannot observe an exchange rate on its own. CRX reads its rates from an oracle, a price feed published on-chain, and every number a position uses after the trade price comes from it.
What is Pyth?
The oracle CRX reads is Pyth, a network where exchanges, market makers, and trading firms publish their own prices first-hand. The network aggregates each pair's publishers into a single rate and tags it with a confidence band, a measure of how closely they agree.
CRX reads that rate as its EMA, an exponentially weighted moving average of the feed over roughly the past hour, weighting newer and tighter-confidence prints more heavily. A single print cannot move an hour's average, and a thin or mispriced quote carries little weight. One rate marks and settles every position.
What is the oracle used for?
Every number a position reads after the trade price comes from the oracle: the mark the margin engine runs on, the prices that value posted collateral, and the settlement rate at maturity. CRX reads one feed for the currency pair and one for each collateral asset's USD price. The eligible collateral set is covered in Collateral (~3 min).
The trade price is the one exception. It is the quote CRX signs and the taker accepts before the position binds, fixed once at that moment rather than read from the oracle. See Requesting a Quote (~2 min).
What keeps a bad price out?
Every read is gated. Two checks run on each price:
| Check | What it does |
|---|---|
| Staleness | the contract rejects any price observed more than 30 seconds ago; anyone can attach a fresh Pyth update in the same transaction for a small fee |
| Confidence band | the contract rejects a price whose band is too wide for its publishers to be trusted |
A price that fails either check is not used. The action reverts rather than run on a bad number. The diagram shows the gate in order:
The oracle contracts, with their interfaces and parameters, are in the contract reference (~3 min).
Next: Requesting a quote (~2 min). How a request becomes a firm price on a pair, a tenor, and a size.