Use existing memory version of state variables #102
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Handle
ye0lde
Vulnerability details
Impact
Using existing local variables instead of reading state variables will save gas by converting SLOADs to MLOADs.
Proof of Concept
_nstReserve can be used here:
https://github.com/code-423n4/2021-11-nested/blob/5d113967cdf7c9ee29802e1ecb176c656386fe9b/contracts/NestedBuybacker.sol#L69
_feeSplitter can be used here:
https://github.com/code-423n4/2021-11-nested/blob/5d113967cdf7c9ee29802e1ecb176c656386fe9b/contracts/NestedBuybacker.sol#L76
_burnPercentage can be used here:
https://github.com/code-423n4/2021-11-nested/blob/5d113967cdf7c9ee29802e1ecb176c656386fe9b/contracts/NestedBuybacker.sol#L84
_maxHoldingsCount can be used here:
https://github.com/code-423n4/2021-11-nested/blob/5d113967cdf7c9ee29802e1ecb176c656386fe9b/contracts/NestedRecords.sol#L173
Tools Used
Visual Studio Code, Remix
Recommended Mitigation Steps
See Proof of Concept
The text was updated successfully, but these errors were encountered: