euler-xyz / euler-price-oracle

Euler Price Oracles, a library of immutable oracle adapters and components

Home Page:https://docs.euler.finance/euler-price-oracle/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChronicleOracle calculates staleness incorrectly

totomanov opened this issue · comments

The IChronicle interface returns uint256 age, the timestamp of the price update, while the adapter code interprets it as staleness.

Location

(uint256 price, uint256 age) = IChronicle(feed).readWithAge();
if (price == 0) revert Errors.PriceOracle_InvalidAnswer();
if (age > maxStaleness) revert Errors.PriceOracle_TooStale(age, maxStaleness);

Fix

uint256 staleness = block.timestamp - age;
if (staleness > maxStaleness) revert Errors.PriceOracle_TooStale(staleness, maxStaleness); 

For example, see this poke transaction, which sets age to 1710916503.

image