Project

One World
NFTDeFi
15,000 USDC
View results
Submission Details
Severity: low
Invalid

save `_whitelistedCurrencies.length` in a local variable to optimize storage reads

Vulnerability Details

_whitelistedCurrencies.length in currencymanager.sol is read from storage when trying to access function viewWhitelistedCurrencies . we can save gas by assigning it to memory

https://github.com/Cyfrin/2024-11-one-world/blob/1e872c7ab393c380010a507398d4b4caca1ae32b/contracts/dao/CurrencyManager.sol#L92

Impact

more gas cost

Tools Used

manual view

Recommendations

assign _whitelistedCurrencies.length to a local variable
example
uint256 totalCurrencies = _whitelistedCurrencies.length();

Updates

Lead Judging Commences

0xbrivan2 Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
0xbrivan2 Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.