Use Case & Applications
Ensures oracle data is fresh and updated within an acceptable time window, preventing the use of stale price data that could lead to incorrect valuations and financial losses. Critical for lending protocols (collateral valuation, liquidations), DEXs (price discovery, arbitrage detection), yield farming protocols (reward calculations), insurance protocols (premium calculations), and options/derivatives protocols (settlement). Stale oracle data can indicate service disruption or attacks on oracle infrastructure, potentially leading to significant protocol vulnerabilities.Related Hacks
- Loopscale: Hack caused by a stale oracle. It was on Solana, so not relevant to Credible Layer, but the same idea applies.
Explanation
Monitors oracle timestamp updates when critical protocol functions are called:forkPostState()
: Check oracle’s last update time after transactionregisterCallTrigger()
: Trigger on functions that rely on oracle data (e.g., DEX swaps)- Verify oracle’s last update time is within defined maximum time window
Code Example
Note: Full examples with tests available in the Phylax Assertion Examples Repository.