There are redundant checks in the burn and mint functions.
In the burn
function, it checks _amount <= 0
and balance < _amount
, and in the mint
function, it checks _to == address(0)
and _amount <= 0
. These checks are unnecessary because similar checks are already performed in _burn
and _mint
functions, making them redundant. Below is the code from OpenZeppelin:
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/19293f3ecdb20a7f44d54279b5c1ddbb84de4a2e/contracts/token/ERC20/ERC20.sol#L297-L302
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/19293f3ecdb20a7f44d54279b5c1ddbb84de4a2e/contracts/token/ERC20/ERC20.sol#L282-L287
https://github.com/OpenZeppelin/openzeppelin-contracts/blob/19293f3ecdb20a7f44d54279b5c1ddbb84de4a2e/contracts/token/ERC20/ERC20.sol#L244-L272
Redundant checks result in unnecessary computations and gas consumption
Manual review
It is advisable to remove these redundant checks.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.