Platform: Code4rena
Start Date: 03/05/2022
Pot Size: $75,000 USDC
Total HM: 6
Participants: 55
Period: 7 days
Judge: Albert Chon
Total Solo HM: 2
Id: 116
League: COSMOS
Rank: 27/55
Findings: 2
Award: $205.08
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1337, 0x1f8b, 0xDjango, 0xkatana, AmitN, CertoraInc, Dravee, Funen, GermanKuber, GimelSec, Hawkeye, JC, MaratCerby, WatchPug, Waze, broccolirob, cccz, ch13fd357r0y3r, cryptphi, danb, defsec, delfin454000, dipp, dirk_y, ellahi, gzeon, hake, hubble, ilan, jah, jayjonah8, kebabsec, kirk-baird, m9800, orion, oyc_109, robee, shenwilly, simon135, sorrynotsorry
138.0099 USDC - $138.01
[1] Early exit from function is recommended. Affected code: https://github.com/code-423n4/2022-05-cudos/blob/de39cf3cd1f1e1cf211819b06d4acf6a043acda0/solidity/contracts/Gravity.sol#L248
Recommended code:
if (cumulativePower > _powerThreshold) { return; }
[2] Early exit from function is recommended. Affected code: https://github.com/code-423n4/2022-05-cudos/blob/de39cf3cd1f1e1cf211819b06d4acf6a043acda0/solidity/contracts/Gravity.sol#L595-L609
Recommended code:
if (cumulativePower > _powerThreshold) { return; }
[3] Consider using IERC20 type instead of address. Or IERC20[] type instead of address[].
Affected code:
[4] Uint8-256 / Int8-256 is assigned to zero by default, additional reassignment to zero is unnecessary.
Affected code:
🌟 Selected for report: GermanKuber
Also found by: 0v3rf10w, 0x1f8b, 0xDjango, 0xNazgul, 0xf15ers, 0xkatana, AlleyCat, CertoraInc, Dravee, Funen, GimelSec, IllIllI, JC, MaratCerby, WatchPug, Waze, defsec, delfin454000, ellahi, gzeon, hake, hansfriese, ilan, jonatascm, nahnah, oyc_109, peritoflores, rfa, robee, simon135, slywaters, sorrynotsorry
67.0735 USDC - $67.07
[1] Re-entrancy attack is not applicable here because ERC20 transfers are happening at the end of the code. Affected code:
nonReentrant keyword can be safely removed. It will save at least 5000 gas.
[2] Splitting && conditions into several require statements saves gas.
Affected code:
[3] The value like "10256 - 1" (or "10128 - 1") could be replaced to "type(uint256).max" (or "type(uint128).max") accordingly.
Affected code:
[4] Consider using optimized for-loop and apply the following optimizations:
Affected code: