code-423n4 / 2022-01-trader-joe-findings

2 stars 0 forks source link

Saving more gas by using immutable for `floorprice` #268

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

Funen

Vulnerability details

Proof of Concept

https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L60 the floor price used to be read-only, so immutable can saving more gas

Tools Used

Manual Review

Recommended Mitigation Steps

https://github.com/code-423n4/2022-01-trader-joe/blob/main/contracts/LaunchEvent.sol#L60

uint256 public floorPrice;

changed into

uint256 public immunable floorPrice;

cryptofish7 commented 2 years ago

We are using initialize method, immutable variables can only be set in constructor.

dmvt commented 2 years ago

Sponsor is correct. This is invalid.