15,000 USDC
View results
Submission Details
Severity: low

Known vulnerabilities of ERC-20 token, contract `DecentralizedStableCoin.sol`

Recommendation:

For the first issue, a robust solution is to reimplement the approve function by comparing current allowance for spender with the current Value:

File: DecentralizedStableCoin.sol
function approve(address spender,
uint256 _currentValue
uint256 amount) public internal override returns (bool) {
if(_allowances[owner][spender] == _currentValue){
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
else {
return false;
}
}

For the second issue, add the following code to the transfer(_to address, ...) function:

File: DecentralizedStableCoin.sol
require( _to != address(this) );

Support

FAQs

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