Cache storage variables in the stack can save gas #117
Labels
bug
Something isn't working
G (Gas Optimization)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
WatchPug
Vulnerability details
For the storage variables that will be accessed multiple times, cache them in the stack can save ~100 gas from each extra read (
SLOAD
after Berlin).For example:
wethGateway
inAaveYield#_withdrawETH()
https://github.com/code-423n4/2021-12-sublime/blob/9df1b7c4247f8631647c7627a8da9bdc16db8b11/contracts/yield/AaveYield.sol#L307-L312
The text was updated successfully, but these errors were encountered: