Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: medium
Invalid

Missing Initial Supply and Lack of Supply Cap

Summary

The WinningToken contract does not mint any initial token supply at deployment and lacks a maximum supply cap. While the mint() function is restricted to the contract owner, this design introduces potential operational pitfalls and economic risks. The absence of a maximum supply constraint allows for indefinite minting, which may undermine user trust, compromise tokenomics, and increase the likelihood of accidental or malicious over-minting.


Vulnerability Details

constructor() ERC20("Rock Paper Scissors Winner Token", "RPSW") Ownable(msg.sender) {
// @audit-issue No initial supply minted at deployment — this requires additional post-deployment action and may lead to inconsistent environments
@> // No initial supply
}
function mint(address to, uint256 amount) external onlyOwner {
// @audit-issue Missing supply cap allows unlimited minting, leading to potential abuse or unintentional inflation
@> _mint(to, amount);
}

Issue Explanation

There are two major issues with the current design:

  1. No Initial Supply Minted at Deployment
    The constructor lacks logic to mint tokens, requiring a manual mint() call post-deployment. If omitted, this could cause dependent contracts or frontends to break due to a zero totalSupply(). It also introduces inconsistency in automated deployments and testnets.

  2. No Maximum Supply Cap Defined
    The mint() function allows unbounded minting. Without a hard cap, the total supply can grow indefinitely, which:

    • Undermines the economic model of the token

    • Breaks trust in the scarcity and value of the token

    • Introduces risks if the owner key is compromised or misused


Impact

  • Loss of Trust: Users and integrators cannot be assured of token scarcity or supply integrity.

  • Tokenomics Breakdown: Without a hard cap, it's impossible to define a predictable economic model.

  • Potential Over-Minting: Future developers or compromised owners could mint excessive tokens, leading to dilution or economic collapse of the token system.


Tools Used

  • Manual Code Review


Recommendations

To resolve both issues and ensure robustness:

  1. Define a constant MAX_SUPPLY to restrict total mintable tokens.

  2. Enforce the supply cap within mint().

  3. Optionally mint an initial supply in the constructor for immediate utility.

uint256 public immutable maxSupply;
constructor(uint256 _maxSupply) ERC20("Rock Paper Scissors Winner Token", "RPSW") Ownable(msg.sender) {
maxSupply = _maxSupply;
}
function mint(address to, uint256 amount) external onlyOwner {
require(totalSupply() + amount <= maxSupply, "Max supply exceeded");
_mint(to, amount);
}

Updates

Appeal created

m3dython Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational

Code suggestions or observations that do not pose a direct security risk.

m3dython Lead Judge about 2 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

Informational

Code suggestions or observations that do not pose a direct security risk.

Support

FAQs

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