Platform: Code4rena
Start Date: 07/04/2022
Pot Size: $100,000 USDC
Total HM: 20
Participants: 62
Period: 7 days
Judge: LSDan
Total Solo HM: 11
Id: 107
League: ETH
Rank: 59/62
Findings: 1
Award: $80.65
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Dravee
Also found by: 0v3rf10w, 0x1f8b, 0xDjango, 0xNazgul, 0xkatana, Cityscape, Cr4ckM3, FSchmoede, Foundation, Funen, Hawkeye, IllIllI, JMukesh, Meta0xNull, PPrieditis, Picodes, TerrierLover, Tomio, WatchPug, berndartmueller, catchup, delfin454000, dirk_y, ellahi, hickuphh3, ilan, kebabsec, kenta, nahnah, rayn, rfa, robee, rokinot, saian, securerodd, slywaters, sorrynotsorry
80.65 USDC - $80.65
Through my review of this repo I have found 1 instance where gas usage can be significantly reduced. In Controller.sol
the setStrategy
method here can be improved by reverting when setting the strategy for a token to the same strategy that is already active. This can be achieved by adding the following line to the start of that function:
require(strategies[_token] != _strategy, "Strategy already active")
By reverting early you are reducing unnecessary calls and gas usage in the case that a user with STRATEGIST_ROLE
accidentally sets the strategy to the same strategy that is already active.