Skip to content
Documentation

Price Oracle

The whole model stands on the mark price. This is the most sensitive part of the protocol.

The problem

The spot price of a small token can be moved with little capital. A manipulated price would let an attacker open positions cheaply, or push honest traders into liquidation. An oracle for emerging tokens has to make that expensive.

Current design

The beta uses signed prices, published on-chain in two ways.

  • With every trade. The trader's transaction submits a freshly signed price just before opening or closing.
  • By the keeper. While a market has open positions, a keeper publishes its price at least every 120 seconds, and immediately when the price moves by more than 0.5% from the last published one.

A market with no open position is not refreshed in between: its next trade brings its own fresh price.

Validation before signing

A price is signed only when all of these hold. Otherwise no price is signed, and the trade or liquidation that needed it does not happen.

Check Rule
Liquidity The token's pool holds at least $25,000.
Second source An independent reading of the same pool agrees within 2%.
Recent average The price is within 15% of its average over the last 5 minutes, so a single spike cannot be used.

The signature also covers the token, a timestamp, the chain and the contract: it cannot be reused elsewhere.

Freshness

The contracts refuse any price older than 150 seconds. This applies to opening, closing and liquidating alike: nothing is settled, and nobody is liquidated, on a stale price.

The terminal shows the live market price, which is indicative, next to the oracle price confirmed on-chain, with the time of its last update. If the oracle becomes stale on a market where you hold a position, a warning is displayed.

Liquidations

The keeper checks open positions every few seconds against the validated price. When a position is past its level, it publishes a fresh price and calls the liquidation; the contract verifies eligibility itself.

Limits of this design