Skip to main content
A swap depends on a price that may not have been updated recently. OracleLivenessAssertion registers swap(address,address,uint256) and requires the oracle’s reported update time to be no more than 600 seconds old.
The reviewed upstream example needs correction before production use. The limitation below is present in the linked source; the imported code is preserved for comparison.

Source limitation

The example creates a post-transaction fork identifier but does not use it for its oracle reads. It calls oracle() and lastUpdated() directly. Creating a ForkId does not select that state for subsequent Solidity calls.

Adaptation requirements

A complete adapter must read the oracle actually used by the covered operation, at the relevant call snapshot. Use ph.staticcallAt or _readUintAt with that fork, bind the expected oracle, and reject future timestamps explicitly. Set maximum age from the feed’s update policy. A 600-second limit is an example, not a universal feed requirement.

Scenarios

These outcomes describe the timestamp comparison once the read is bound to the correct snapshot. Direct getter calls in the isolated assertion runtime can revert before the comparison. Use oracle checks on risk-increasing calls for an independent reference comparison. Protocols with in-transaction price updates need a check on the consumed price, as in the Aave oracle examples.

Legacy source

Reviewed source. See running and adapting examples for the pinned library revision.