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

0 stars 0 forks source link

MAX_TOTAL_XDEFI_SUPPLY can be constant #176

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

sirhashalot

Vulnerability details

Impact

The MAX_TOTAL_XDEFI_SUPPLY variable can be a constant since it does not and cannot be changed. This is documented in the Solidity docs to save gas: https://docs.soliditylang.org/en/v0.8.11/contracts.html?highlight=gas%20costs#constant-and-immutable-state-variables

Proof of Concept

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

Recommended Mitigation Steps

Make the MAX_TOTAL_XDEFI_SUPPLY variable constant to save gas

deluca-mike commented 2 years ago

Agred. However, due to other changes we will be making due to the aduit, MAX_TOTAL_XDEFI_SUPPLY will be removed.

deluca-mike commented 2 years ago

Duplicate #36