Platform: Code4rena
Start Date: 27/05/2022
Pot Size: $75,000 USDC
Total HM: 20
Participants: 58
Period: 7 days
Judge: GalloDaSballo
Total Solo HM: 15
Id: 131
League: ETH
Rank: 51/58
Findings: 1
Award: $73.63
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x29A, 0xKitsune, 0xNazgul, 0xf15ers, 0xkatana, Chom, Dravee, Fitraldys, Funen, Kaiziron, MiloTruck, Picodes, Randyyy, RoiEvenHaim, SecureZeroX, Sm4rty, SmartSek, StyxRave, Tadashi, Tomio, Waze, asutorufos, berndartmueller, c3phas, catchup, csanuragjain, defsec, delfin454000, djxploit, fatherOfBlocks, gzeon, hake, hansfriese, oyc_109, robee, sach1r0, sashik_eth, scaraven, simon135
73.6341 USDC - $73.63
Details: The checks on L575, L589 and L602 of CrvDepositor.sol can be removed since the variables totalKeeperPoolWeight
, totalLpPoolWeight
and totalAmmTokenWeight
are uint256
and the unchecked versions of add and sub are not used before these lines.
Details: Some variables in the contract are of the type uint256
and will never be strictly negative. Thus, to check if these variables are not strictly positive you only need to check if they are equal to 0 — this will economize gas because EVM instruction set does not have an opcode for the condition "less than or eq", only for "less than" and "equal" opcodes.
In view of this it is suggested to perform the following simplifications:
Since amount
in L62 of AmmGauge.sol is uint256
, the if condition at L63 can be simplified to
if (amount == 0) return 0;
Since the variables amount
, crvAmount
and crxAmount
in L70-72 of AmmConvexGauge.sol are uint256
, the if condition at L73 can be simplified to
if (amount == 0 && crvAmount == 0 && cvxAmount == 0) return 0;
Since the variable amount
in L58 of LpGauge.sol is uint256
, the if condition at L59 can be simplified to
if (amount == 0) return 0;
Details: Consider changing L59 and L98 of KeeperGauge.sol to ++epoch;
. For more information, see G012 of c4-common-issues.
Details: ScaledMath
is added to uint256
in BkdToken.sol, but its functions are not used. Consider removing it.
#0 - GalloDaSballo
2022-06-18T01:39:59Z
Saves 100 gas per instance -> 300
3
3 * 3 = 9
3
5 gas per instance = 10
Removed by the compiler
Total Gas Saved 325