Open code423n4 opened 2 years ago
Agree with the finding, for the sake of visibility the sponsor may decide to keep the assignment as a comment, but this is effectually paying for assigning the same value to a storage slot (should be 3 due to int types) which should cost 800 per assignment (2.4k gas in total)
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2022-01-elasticswap/blob/d107a198c0d10fbe254d69ffe5be3e40894ff078/elasticswap/src/contracts/Exchange.sol#L27-L28
Initialize
internalBalances
to the default state is redundant.Change to
MathLib.InternalBalances public internalBalances;
can make the code simpler and save some gas.