code-423n4 / 2021-11-vader-findings

0 stars 0 forks source link

Store VaderPoolV2 address as immutable in LPWrapper #224

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

TomFrench

Vulnerability details

Impact

Gas costs on deploying LPTokens

Proof of Concept

The address of VaderPoolV2 is stored implicitly as the owner of the LPWrappet contract.

https://github.com/code-423n4/2021-11-vader/blob/607d2b9e253d59c782e921bfc2951184d3f65825/contracts/dex-v2/wrapper/LPWrapper.sol#L31

As we are using the Ownable contract which allows transfering ownership this involves an SLOAD to get VaderPoolV2's address. As we never are going to transfer ownership of this contract we could store it in an immutable variable which will save gas costs.

Recommended Mitigation Steps

Remove Ownable dependency and store address in immutable variable.