Oracles

Drift Protocol has a number of resiliency checks around new oracle data as well as updates an oracle TWAP for its margin risk engine. Each market tracks the last seen oracle values and updates an EMA of TWAP for both 1 hr (funding period) and 5 min intervals.

Drift utilises as an oracle source. The protocol has the flexibility to update and customize as necessary on a per-market basis.

Validity Checks

For robustness, Drift's program checks oracle validity. The validity is evaluated on a per-check and action basis to determine whether to block actions. See Protocol Guard Rails for more details.

1

Stale (ForAmm / ForMargin)

Last slot update too far behind the current slot — 10 / 120 slots.

2

InvalidPrice

Negative price (any price field < 0).

3

TooVolatile

TWAP / price ratio out of bounds — 5x or 1/5x.

4

TooUncertain

Confidence interval is too large (confidence is a very large percentage of the price) — >10%.

For the duration of the invalid period, on-chain oracle TWAP calculation aims to shrink toward mark TWAP to avoid erroneous funding payment magnitudes.