Open code423n4 opened 2 years ago
Immutable variables cannot be read during contract creation time. Making the suggested variables immutable would lead to https://github.com/code-423n4/2022-01-yield/blob/e946f40239b33812e54fafc700eb2298df1a2579/contracts/ConvexStakingWrapper.sol#L77-L78 to fail.
While you can't read immutable variables at creation time, you can use the input from the constructor _curveToken
instead of the "storage / immutable" curveToken
Inlining the approvals and using the constructor parameters would solve and save the gas.
I don't mind a nofix from the developer, (although believe there's gas to be saved) but I think the finding is valid
@GalloDaSballo Good point. Let me talk to the team
Handle
0x1f8b
Vulnerability details
Impact
Gas saving.
Proof of Concept
It's possible to avoid storage access a save gas using
immutable
keyword for the following variables:ConvexStakingWrapper:
ConvexYieldWrapper:
Tools Used
Gas saving
Recommended Mitigation Steps
Use immutable.