Rock Paper Scissors

First Flight #38
Beginner FriendlySolidity
100 EXP
View results
Submission Details
Severity: low
Valid

Unlimited Token Inflation via Centralized Minting Authority in `mint()` function in `WinningToken.sol`

πŸͺ™ Finding: Unlimited Token Inflation via Centralized Minting Authority

πŸ“Œ Summary

The WinningToken.sol contract used in the RockPaperScissors.sol DApp includes a mint() function that is protected by the Ownable modifier. However, there is no cap or supply limitation in the contract, allowing the owner to mint unlimited tokens. This introduces a centralized control point that can break the integrity and fairness of the game reward mechanism.


πŸ” Vulnerable Code

File: WinningToken.sol

contract WinningToken is ERC20, ERC20Burnable, Ownable {
...
function mint(address to, uint256 amount) external onlyOwner {
_mint(to, amount); // ❗ No max supply restriction
}
}
  • The mint() function can be called by the owner at any time with any amount.

  • There is no maxSupply constraint or governance mechanism to limit its usage.


πŸ’₯ Impact

  • The admin (initially the RockPaperScissors contract or its deployer) can arbitrarily issue an unlimited number of winner tokens.

  • Undermines the value of the token as a symbol of winning or rarity.

  • Allows for manipulated access to token-based games, where fake tokens could be minted and reused.

  • Violates the decentralization principle stated in the project documentation.


πŸ”’ Recommendation

To mitigate the risk of inflation and abuse:

  1. Introduce a max supply constraint:

uint256 public constant MAX_SUPPLY = 10000;
​
function mint(address to, uint256 amount) external onlyOwner {
require(totalSupply() + amount <= MAX_SUPPLY, "Exceeds max supply");
_mint(to, amount);
}
  1. Alternatively, replace Ownable with AccessControl and restrict minting only to the RockPaperScissors contract:

bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
​
constructor() {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(MINTER_ROLE, msg.sender);
}
​
function mint(address to, uint256 amount) external onlyRole(MINTER_ROLE) {
_mint(to, amount);
}
  1. Document the intended supply model in the contract or project documentation.


βœ… Conclusion

Unlimited minting without restrictions introduces a centralization and inflation risk that contradicts the protocol’s stated goal of fairness and decentralization. Implementing simple supply constraints or access controls ensures trustless reward distribution and enhances the protocol's integrity.

βœ… Tool Used

Manual Review

Updates

Appeal created

m3dython Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Minting Instead of Transferring Staked Tokens

Mints new tokens upon game completion or cancellation for token-based games

m3dython Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Minting Instead of Transferring Staked Tokens

Mints new tokens upon game completion or cancellation for token-based games

Support

FAQs

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