Open code423n4 opened 2 years ago
Funen
https://github.com/code-423n4/2022-01-yield/blob/main/contracts/ConvexStakingWrapper.sol#L94-L95
IERC20(curveToken).approve(convexBooster, 0); IERC20(curveToken).approve(convexBooster, type(uint256).max);
curveToken was called mutiple times, caching it in memory , it can cost less gas
curveToken
memory
Agree with the finding, anytime you're reading from storage even just more than once, it's always cheaper to store in a memory variable
Handle
Funen
Vulnerability details
https://github.com/code-423n4/2022-01-yield/blob/main/contracts/ConvexStakingWrapper.sol#L94-L95
curveToken
was called mutiple times, caching it inmemory
, it can cost less gas