DeFi oracle spot-price safeguards
A spot quote reflects current liquidity and can move within one transaction. Using it as a collateral reference couples borrowing power to transient state.
Risk assessment
A spot quote reflects current liquidity and can move within one transaction. Using it as a collateral reference couples borrowing power to transient state.
Mitigation
Use a reviewed time-weighted or independent feed. Validate freshness, decimals, confidence and circuit-breaker bounds.
Solidity mitigation excerpt
require(price > 0 && updatedAt > 0 && updatedAt <= block.timestamp, InvalidPrice());
require(block.timestamp - updatedAt <= maxAge, StalePrice());Foundry · Regression check
Use a mock feed to assert stale or out-of-band quotes stop new borrowing and leave collateral balances intact.
Mitigation
Related topics
What should I verify first?
Use a mock feed to assert stale or out-of-band quotes stop new borrowing and leave collateral balances intact.