3min
Oracles
Rage utilizes Chainlink oracle to get spot TWAP price. This is initialized when a new market is added and can be updated if necessary. There are some additional resiliency checks around the oracle.
Validity Checks
Oracle will give an error if any of the conditions are satisfied:
- Arbitrum sequencer is down, due to which price might be stale
- Negative price (price < 0)
- Not enough historical price data to calculate TWAP
Deviation Check
In case there is a large TWAP_SPOT and TWAP_PERP price divergance (currently > 5%) then TWAP_SPOT is used to check for liquidation of accounts otherwise TWAP_PERP is used.
Divergence = |TWAP_PERP - TWAP_SPOT| / TWAP_SPOT
Collateral Oracle
Chainlink oracles would be used for all the supported collateral to get their USD value.
Note: USDC, which is also the settlement token is considered to be = 1USD