Oracle System
Conservative Pricing
For every position, the oracle provides two prices: the spot price (current orderbook midpoint) and a TWAP (time-weighted average price). The final price used for collateral valuation is always the minimum of the two.
finalPrice = min(spotPrice, twapPrice)
Why minimum?
├── If spot is pumped → TWAP is lower, protects lenders
├── If TWAP lags during crash → spot is lower, reflects reality
└── Attackers must sustain manipulation over time to affect TWAP Staleness Checks
| Parameter | Default | Effect |
|---|---|---|
| Max staleness | 15 minutes | Prices older than this are considered stale |
| Stale behavior | Block new borrows/withdrawals | Protects against acting on outdated data |
| Grace period | Configurable | After oracle recovery, delays liquidation briefly |
Liquidity Validation
The oracle also checks orderbook depth. Positions in markets with less than $10,000 orderbook depth cannot be used as collateral — even if they have a valid price. This prevents use of thinly-traded markets that could be easily manipulated.
Data Sources
Polymarket (Polygon)
Opinion (BSC)
Borrow Power vs Liquidation Behavior
The oracle applies different rules for borrowing and liquidation — this distinction protects borrowers during oracle outages:
| Context | Stale price behavior | Rationale |
|---|---|---|
| Borrowing / accounting | Unavailable price → that collateral = $0 borrow power | Prevents borrowing against stale (potentially inflated) values |
| Liquidation | Liquidation is blocked if any non-zero collateral has an unavailable price | Prevents unfair liquidation during oracle outages |
| After oracle recovery | Grace period (default 5 min) before liquidation is allowed | Gives borrowers time to react after prices come back |
Manual Invalidation
Governance can manually invalidate a position via an emergency kill switch. When a position is invalidated:
| Effect | Detail |
|---|---|
| Borrowing | That collateral = $0 — cannot be used to borrow against |
| Liquidation | Liquidators can still obtain a price — prevents bad debt from becoming unresolvable |
Resolved Markets
After a prediction market resolves, special oracle rules apply:
| Outcome | Oracle behavior |
|---|---|
| Binary (0% or 100%) | Allowed to be "stale forever" — no continuous updates needed since the outcome is final |
| Fractional (e.g., 50/50) | Requires explicit finalization by governance to set the canonical price |
Security Properties
| Attack Vector | Mitigation |
|---|---|
| Spot price pump | min(spot, TWAP) — TWAP unaffected by short-term manipulation |
| Flash loan attack | TWAP spans multiple blocks, single-block manipulation ineffective |
| Oracle downtime | Staleness check blocks risky operations; grace period protects users |
| Thin market manipulation | Liquidity threshold ($10K min depth) rejects illiquid markets |
Timing Parameters
These are protocol defaults, all configurable by governance:
| Parameter | Default | Range |
|---|---|---|
| Max staleness | 15 minutes | 1 min – 1 day |
| Liquidation grace period | 5 minutes | 0 – 1 hour |
| Early-closure window | 7 days | 0 – 90 days |
| Min orderbook depth | $10,000 | Governance-set |