Platform: Code4rena
Start Date: 20/01/2022
Pot Size: $80,000 USDC
Total HM: 5
Participants: 37
Period: 7 days
Judge: Jack the Pug
Total Solo HM: 1
Id: 76
League: ETH
Rank: 28/37
Findings: 2
Award: $37.91
🌟 Selected for report: 0
🚀 Solo Findings: 0
11.8662 USDC - $11.87
p4st13r4
In sweepTokens()
of SherBuy.sol
, the variable i
is incremented using i++
. It is known that using ++i costs less gas per iteration than i++.
Editor
Replace i++
with ++i
#0 - jack-the-pug
2022-03-15T01:09:59Z
Dup #111
🌟 Selected for report: RamiRond
Also found by: Dravee, Ruhum, kirk-baird, p4st13r4
26.0437 USDC - $26.04
p4st13r4
Starting from updateSherDistributionManager()
and up to updateYieldStrategy()
, all the functions are implemented so that the affected state variables is read twice from the storage. In order to consume less gas avoiding one of the two storage reads, the variable could be cached
The affected functions could be implemented like that:
function updateSherDistributionManager(ISherDistributionManager newSherDistributionManager) external override onlyOwner { ISherDistributionManager memory oldSherDistributionManager = sherDistributionManager; if (address(newSherDistributionManager) == address(0)) revert ZeroArgument(); if (oldSherDistributionManager == newSherDistributionManager) revert InvalidArgument(); emit SherDistributionManagerUpdated(oldSherDistributionManager, newSherDistributionManager); sherDistributionManager = newSherDistributionManager; }
Editor
As explained in the example above
#0 - jack-the-pug
2022-03-26T13:21:49Z
Dup #77