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

Redundant checks and error inside DecentralizedStableCoin

Summary

The checks if (_amount <= 0) in the burn and mint function of the DecentralizedStableCoin, as well as the DecentralizedStableCoin__MustBeMoreThanZero error used by them, are redundant. The reason for this is that the conditions are already checked inside DSCEngine before calling the functions, and the DSCEngine is the only one allowed to call these functions.

Also a == operator would be more appropriate than a <= operator as uints are not able to be smaller than zero.

Recommendations

Remove the redundant checks to save gas.

Support

FAQs

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