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

Redundant checks in DecentralizedStableCoin.sol

Summary

Both burn() and mint() uses in DecentralizedStableCoin.sol uses redundant checks that are already being checked in the Openzeppelin ERC20 implementation, therefore can be removed to save gas.

Openzeppelin links : 1. burn()
2. mint()

Vulnerability Details

function burn(uint256 _amount) public override onlyOwner {
...
// Redundant checks
if (balance < _amount) {
revert DecentralizedStableCoin__BurnAmountExceedsBalance();
}
function mint(address _to, uint256 _amount) external onlyOwner returns (bool) {
// Redundant checks
if (_to == address(0)) {
revert DecentralizedStableCoin__NotZeroAddress();
}

Impact

Extra gas usage

Tools Used

Manual Review

Recommendations

Both checks are present in openzeppelin v4.8.0 implementation, hence can be safe to remove to save gas.

Support

FAQs

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