Platform: Code4rena
Start Date: 19/04/2022
Pot Size: $30,000 USDC
Total HM: 10
Participants: 43
Period: 3 days
Judges: moose-code, JasoonS
Total Solo HM: 7
Id: 90
League: ETH
Rank: 42/43
Findings: 1
Award: $22.05
🌟 Selected for report: 0
🚀 Solo Findings: 0
22.0499 USDC - $22.05
https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/ChainlinkPriceOracle.sol#L83 https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/ChainlinkPriceOracle.sol#L84
In ChainlinkPriceOracle.sol
, latestRoundData()
is used but there is no check if the return value indicates stale data. This could lead to stale prices according to the Chainlink documentation:
ChainlinkPriceOracle.sol#L83
ChainlinkPriceOracle.sol#L84
Manual review
Additionally to the already existing check require(basePrice > 0 && quotePrice > 0, "ChainlinkPriceOracle: NEGATIVE");
consider adding checks for stale data.
(uint80 basePriceRoundID, int basePrice, , uint256 basePriceTimestamp, uint80 basePriceAnsweredInRound) = baseAggregator.latestRoundData(); (uint80 quotePriceRoundID, int quotePrice, , uint256 quotePriceTimestamp, uint80 quotePriceAnsweredInRound) = assetInfo.aggregator.latestRoundData(); require(basePrice > 0 && quotePrice > 0, "ChainlinkPriceOracle: NEGATIVE"); require(basePriceAnsweredInRound >= basePriceRoundID && quotePriceAnsweredInRound >= quotePriceRoundID, "ChainlinkPriceOracle: STALE PRICE"); // @audit-info add stale check require(basePriceTimestamp != 0 && quotePriceTimestamp != 0, "ChainlinkPriceOracle: ROUND INCOMPLETE"); // @audit-info add round incomplete check
#0 - olivermehr
2022-05-02T20:24:09Z
duplicate of issue #1