15,000 USDC
View results
Submission Details
Severity: low

No Maximum Supply Limit

Summary

No Maximum Supply limit was added in the contract

Vulnerability Details

The contract lacks a mechanism to set a maximum supply limit for the stablecoin, allowing the owner to mint an unlimited number of tokens, which could reduce trust by users.

Impact

Without a maximum supply limit, the owner could potentially mint an excessive number of tokens, which might undermine the trust ofthe stablecoin.

Tools Used

Remix, VsCode

Recommendations

To avoid the risk of excessive token minting, you can set a maximum supply limit for the stablecoin. Here's an example of how you can implement it:

uint256 public constant MAX_SUPPLY = 1000000000000 * 10**18; // Set your supply to 1 trillion
function mint(address _to, uint256 _amount) external onlyOwner returns (bool) {
if (_to == address(0)) {
revert DecentralizedStableCoin__NotZeroAddress();
}
if (_amount <= 0) {
revert DecentralizedStableCoin__MustBeMoreThanZero();
}
require(totalSupply() + _amount <= MAX_SUPPLY, "DecentralizedStableCoin__MaxSupplyExceeded");
_mint(_to, _amount);
return true;
}

In this example, the MAX_SUPPLY constant is set to the desired maximum supply limit. The mint function now checks if the total supply plus the minted amount exceeds this limit before performing the minting operation.

Support

FAQs

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