Oracle System
Conservative Pricing
For every position, the oracle provides two prices: the spot price (current orderbook midpoint) and a 1-hour TWAP (time-weighted average price) computed by the oracle service from recent price history. When no history is available, the current midpoint is used as the TWAP. 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 TWAPStaleness 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. When a market falls below $10,000 orderbook depth, its positions keep full LTV for a grace period (24h / 12h / 6h for Conservative / Moderate / Risk), then their LTV decays linearly to zero over 7 days. If liquidity recovers during the grace period, no reduction applies. This limits exposure to 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 |
Specific cases keep a usable price: resolved and finalized positions don't need fresh updates, and manually invalidated or low-liquidity positions remain priced so liquidations can proceed.
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 | Low-liquidity LTV decay below $10K depth |
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 |
| Low-liquidity grace period | 24h / 12h / 6h (by tier) | Up to 7 days |
| Low-liquidity decay | 7 days | Up to 14 days |