Platform: Code4rena
Start Date: 31/01/2023
Pot Size: $90,500 USDC
Total HM: 47
Participants: 169
Period: 7 days
Judge: LSDan
Total Solo HM: 9
Id: 211
League: ETH
Rank: 88/169
Findings: 1
Award: $69.82
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: c3phas
Also found by: 0xSmartContract, 0xackermann, 0xdaydream, Aymen0909, CodingNameKiki, Dewaxindo, Diana, IllIllI, Madalad, NoamYakov, Pheonix, Polaris_tow, ReyAdmirado, Rolezn, arialblack14, atharvasama, cryptostellar5, descharre, eyexploit, lukris02, saneryee
69.8247 USDC - $69.82
function accruedPerformanceFee() public view returns (uint256) { uint256 highWaterMark_ = highWaterMark; uint256 shareValue = convertToAssets(1e18); uint256 performanceFee = fees.performance; return performanceFee > 0 && shareValue > highWaterMark ? performanceFee.mulDiv( (shareValue - highWaterMark) * totalSupply(), 1e36, Math.Rounding.Down ) : 0; }
Above state variable highWaterMark
is cached into highWaterMark_
but not used anywhere in the function. Each read from storage is expensive and cost 100 gas, caching it to the local variable can save good amount of gas.
Gas per sload = 100 Total gas on n sload = 100n where n, is times of state variable used.
Gas that could be saved by caching = 100(n-1)
Recommendation : Consider using the highWaterMark_
#0 - c4-judge
2023-03-01T00:09:26Z
dmvt marked the issue as grade-b