The RockPaperScissors
contract incorrectly mints new WinningToken
tokens during game cancellation and completion instead of transferring the originally staked tokens. This flaw allows infinite token inflation, undermining the token's economic model.
Root Cause:
In RockPaperScissors::_cancelGame
and RockPaperScissors::_finishGame
, the contract mints new tokens to players (e.g., winningToken.mint(game.playerA, 1)
) rather than transferring the staked tokens held by the contract.
Players initially stake tokens via transferFrom
, which are held by the contract. However, these tokens are never returned—instead, new ones are minted, leaving the original tokens locked in the contract.
Proof of Concept:
Game Creation: Players stake tokens (e.g., 1 each via transferFrom
), increasing the contract’s balance by 2.
Game Resolution:
On cancellation: winningToken.mint
is called for both players (2 new tokens minted).
On completion: winningToken.mint(_winner, 2)
mints 2 new tokens to the winner.
Result: The staked tokens remain in the contract, and the total supply increases by 2 per game.
Permanent Token Inflation: The WinningToken
supply grows indefinitely as staked tokens are never burned or transferred.
Economic Model Breakage: The token’s scarcity is compromised, enabling arbitrary minting through repeated game creation/cancellation.
Funds Locked: Staked tokens accumulate in the contract without utility.
Replace minting with transfers of the staked tokens:
Mints new tokens upon game completion or cancellation for token-based games
Mints new tokens upon game completion or cancellation for token-based games
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.