Platform: Code4rena
Start Date: 21/04/2022
Pot Size: $100,000 USDC
Total HM: 18
Participants: 60
Period: 7 days
Judge: gzeon
Total Solo HM: 10
Id: 112
League: ETH
Rank: 53/60
Findings: 1
Award: $89.35
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: joestakey
Also found by: 0v3rf10w, 0x1f8b, 0x4non, 0xDjango, 0xNazgul, 0xkatana, 0xmint, Dravee, Funen, IllIllI, MaratCerby, NoamYakov, Tadashi, TerrierLover, Tomio, WatchPug, catchup, defsec, fatherOfBlocks, hake, horsefacts, kenta, oyc_109, pauliax, rayn, rfa, robee, saian, securerodd, simon135, slywaters, sorrynotsorry, tin537, z3s
89.3504 USDC - $89.35
i++
can be replaced with ++i
pre-increment consumes less gas compared to post-increment, if post-increment return value is not used, it can be replaced with pre-increment to save some gas
Replace post-increment with pre-increment
When variables are created it contains default values, initialising with default values is not necessary
Initialising with default values can be avoided
unchecked
to save gasUsing unchecked in expressions that wont overflow/underflow can avoid the default overflow/underflow checks and saves gas
150 require(startingAllowance >= amount, Error.INSUFFICIENT_BALANCE); 153 require(srcTokens >= amount, Error.INSUFFICIENT_BALANCE); 163 uint256 allowanceNew = startingAllowance - amount; 164 uint256 srcTokensNew = srcTokens - amount;
unchecked
can be placed in the expression
Storage variables that are re-read multiple times in a same code block can be cached in a temporary variable and re-used to save gas
token
in function stakeFor
and unstakeFor
_rewardTokens.length()
in
Storage variables can be stored in temporary variables and re-used
> 0
with != 0
to save gas!= 0
is more efficient than > 0
for unsigned integers in require statements with optimizer enabled
>
can be replaced with !=