Code repeated to check conditions to require certain things can be put in modifier
Code in DecentralizedStableCoin.sol lines 48-50 is repeated in lines 61-63 to check amount is not less than or equal to zero. This can be put into a modifer instead
Informational: Avoid code duplication. Improve code quality. Improve code readability. Reduce chances of error that duplicated code in one place is repeated but with error in another. Improve code maintainability, auditability
Manual Analysis
It is recommended to add these checks into a modifier that can be reused on relevant functions
modifier onlyAmountsAboveZero() {
if (_amount <= 0) { // remember earlier finding to change this to (_amount == 0) as _amount cant be negative
revert DecentralizedStableCoin__MustBeMoreThanZero();
}
-;
}
function mint(address _to, uint256 _amount) external onlyOwner onlyAmountsAboveZero returns (bool) {....
function burn(uint256 _amount) public override onlyOwner onlyAmountsAboveZero {....
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.