Appearance
Oracles and Mark Price
Oracle Implementation
Perpetuity utilizes a dedicated Atlas oracle program that aggregates price data from three trusted sources:
- Switchboard
- Chaos Labs
- Pyth
The oracle program updates price feeds at the beginning of each new block to ensure fresh price data. To enhance security and reliability:
- Each price feed includes confidence intervals to measure price uncertainty
- Multiple oracle sources are used to prevent manipulation and ensure price accuracy
- The system validates oracle accounts and their ownership before processing any transactions
- Price feeds include both current and previous prices for enhanced stability
Mark Price Calculation
The mark price is a sophisticated weighted average that combines multiple price inputs to create a fair and manipulation-resistant reference price. It incorporates:
- Last traded price from the orderbook
- Mid price (average of best bid and ask)
- Index price from the oracle feed
- Confidence intervals from price feeds
This composite approach helps:
- Prevent market manipulation
- Reduce the impact of temporary price spikes
- Provide a more stable reference for funding rates and liquidations
- Better reflect true market conditions by considering both on-chain and off-chain price sources
Price Impact Protection
The system implements several protective measures:
- Impact price calculations that simulate large orders to prevent manipulation
- Price bias checks that compare orderbook prices against oracle prices
- Confidence interval thresholds that must be met for price acceptance
The mark price serves as a key component in:
- Determining liquidation thresholds
- Setting fair prices for order execution
- Computing position values for margin requirements