Protocol

TWAP oracle

TangentOracle keeps, per perp index, a ring buffer of up to 512 (timestamp, pxE8) observations appended on every post. Anyone can read a time-weighted average over a configurable window:

twap(perpIndex, windowSec) → (pxE8, coveredSec)

The last observation is carried forward to now; partial coverage is allowed and reported in coveredSec. If the buffer does not reach back at least windowSec / 2 the call reverts InsufficientHistory(perpIndex, windowSec). observationCount(perpIndex) and observation(perpIndex, i) (oldest-first) expose the raw buffer. The Transparency page shows the 1 h and 24 h TWAP next to the spot oracle price (— while history is insufficient), and /api/oracle returns twap1h / twap24h as { pxE8, coveredSec, windowSec } or null. Other Elysium contracts can use this as a free, manipulation-resistant reference price.