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: 16/43
Findings: 3
Award: $122.96
🌟 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-L84
You check only the answer(The price) after calling the chainlink Chainlink Price feeds in the following lines. In addition, you need to check whether the data is really updated.
https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/ChainlinkPriceOracle.sol#L83-L84
code review
Please add the following validations.
(uint80 baseRoundID, int basePrice, ,uint256 baseUpdatedAt , uint80 baseAnsweredInRound ) = baseAggregator.latestRoundData(); (uint80 quoteRoundID, int quotePrice, ,uint256 quoteUpdatedAt , uint80 quoteAnsweredInRound ) = assetInfo.aggregator.latestRoundData();
require(basePrice > 0 && quotePrice > 0, "ChainlinkPriceOracle: NEGATIVE"); require(baseAnsweredInRound >= baseRoundID && quoteAnsweredInRound >= quoteRoundID , "error message"); require(baseUpdatedAt > 0 && quoteUpdatedAt > 0, "error message");
#0 - olivermehr
2022-05-02T20:24:32Z
duplicate of issue #1
#1 - olivermehr
2022-05-02T20:25:04Z
duplicate issue #1
🌟 Selected for report: IllIllI
Also found by: 0v3rf10w, 0xDjango, 0xkatana, Dravee, Kenshin, Tadashi, TerrierLover, abhinavmir, defsec, ellahi, fatima_naz, foobar, gzeon, hyh, joestakey, kebabsec, kenta, minhquanym, oyc_109, rayn, robee, sseefried, xpriment626, z3s
69.53 USDC - $69.53
2022-04-phuture
https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/TrackedIndex.sol#L25-L27
You can add the following require statement.
require(_assets.length == _capitalizations.length, “error message”);
pragma solidity 0.8.7;
https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/libraries/NAV.sol#L22
require(_amount != 0, “error message”);
🌟 Selected for report: IllIllI
Also found by: 0v3rf10w, 0xDjango, 0xNazgul, 0xkatana, Dravee, Kenshin, MaratCerby, Tadashi, TerrierLover, Tomio, TrungOre, defsec, ellahi, fatherOfBlocks, fatima_naz, gzeon, joestakey, kenta, minhquanym, oyc_109, rayn, rfa, robee, simon135, slywaters, windhustler, z3s
31.3783 USDC - $31.38
2022-04-phuture gas optimization
https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/libraries/NAV.sol#L49 https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/ManagedIndexReweightingLogic.sol#L61 https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/ManagedIndexReweightingLogic.sol#L98 https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/PhutureIndex.sol#L56 https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/PhutureIndex.sol#L64
if (i != 0) {} if (newWeight != 0) { if (shares != 0) {}
https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/libraries/NAV.sol#L56
require(_balance != 0, “error message”);
https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/TrackedIndex.sol#L50-L52
if (totalWeight < IndexLibrary.MAX_WEIGHT) { unchecked { weightOf[maxCapitalizationAsset] += IndexLibrary.MAX_WEIGHT - totalWeight; } }
https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/TrackedIndex.sol#L50-L53
uint8 _weigtOf = IndexLibrary.MAX_WEIGHT - totalWeight; if (totalWeight < IndexLibrary.MAX_WEIGHT) { weightOf[maxCapitalizationAsset] += _weightOf; } emit UpdateAnatomy(maxCapitalizationAsset, _weightOf);