code-423n4 / 2021-07-sherlock-findings

0 stars 0 forks source link

Declare variables as `constant` or `immutable` to save gas #147

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

shw

Vulnerability details

Impact

Declaring state variables in the AaveV2 contract as constant or immutable (whose value is assigned only at the construction time) can save gas.

Proof of Concept

Can be declared as constant: AaveV2.sol#L24

Can be declared as immutable: AaveV2.sol#L26 AaveV2.sol#L29 AaveV2.sol#L31-L32

Recommended Mitigation Steps

Add a constant or immutable keyword in the referenced lines of code.

Evert0x commented 3 years ago

1