code-423n4 / 2022-01-xdefi-findings

0 stars 0 forks source link

`MAX_TOTAL_XDEFI_SUPPLY` Use constant variable can save gas #124

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

https://github.com/XDeFi-tech/xdefi-distribution/blob/3856a42df295183b40c6eee89307308f196612fe/contracts/XDEFIDistribution.sol#L14-L14

uint88 internal MAX_TOTAL_XDEFI_SUPPLY = uint88(240_000_000_000_000_000_000_000_000);

Considering that MAX_TOTAL_XDEFI_SUPPLY will never change, changing it to constant variable instead of storage variable can save gas.

deluca-mike commented 2 years ago

Agreed. It should have been constant. In any case, due to other recommendations, MAX_TOTAL_XDEFI_SUPPLY is being removed entirely now.

deluca-mike commented 2 years ago

Duplicate #36