15,000 USDC
View results
Submission Details
Severity: gas
Valid

Unnecessary check for negative numbers in `burn` and `mint` functions

Summary

Even though the gas cost for comparison operations such as <= or != is the same, it is recommended to abstrain from the check for negative numbers in a uint type variable as they can never be less than zero.
Source: soliditylang

Vulnerability Details

Unnecessary check for negative numbers in burn and mint functions of DecentralizedStableCoin.sol.
Variable _amount cannot be less than 0 because passing negative numbers to uint variables is not possible.

Tools Used

Manual Review

Recommendations

Replace _amount <= 0 with _amount == 0 in DecentralizedStableCoin.sol#L48 and DecentralizedStableCoin.sol#L61.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.