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

Tautology check for address(0) in `mint` function

Summary

In contract DecentralizedStableCoin.sol, tautology expression has been detected. Such
expression is of no use since it is already being evaluated in ERC20 abstract contract
ERC20.sol#L283

Vulnerability Details

Mint function in DecentralizedStableCoin.sol

function mint(address _to, uint256 _amount) external onlyOwner returns (bool) {
if (_to == address(0)) {
revert DecentralizedStableCoin__NotZeroAddress();
}
if (_amount <= 0) {
revert DecentralizedStableCoin__MustBeMoreThanZero();
}
_mint(_to, _amount);
return true;
}

Inherited _mint function in ERC20 abstract contract

function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}

Tools Used

Manual Review

Recommendations

Remove the following lines in DecentralizedStableCoin.sol#L58-L59

if (_to == address(0)) {
revert DecentralizedStableCoin__NotZeroAddress();

Support

FAQs

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