In token-based games, the RockPaperScissors contract collects WinningTokens from players through transferFrom
but never returns these tokens back to players. Instead, the contract mints new tokens when refunding players or awarding winners. This permanently locks the original tokens in the contract, causing players to lose their tokens and artificially inflating the token supply.
When players join a token-based game, they transfer tokens to the contract:
However, when refunding players or awarding winners, the contract mints new tokens instead of transferring the collected ones:
This creates two problems:
The original tokens transferred to the contract are never returned and remain locked
New tokens are minted, leading to token inflation
As shown in the POC:
PlayerA and PlayerB each transfer 1 token to the contract
When the game is cancelled, 2 new tokens are minted (1 for each player)
The original 2 tokens remain locked in the contract
The total token supply increases by 2
Every time a token-based game is played, tokens accumulate in the contract with no mechanism to retrieve them, and the total supply increases.
The impact of this vulnerability is significant:
Players permanently lose their original tokens when participating in token-based games
The token supply continually inflates as more games are played, potentially devaluing the token
The contract accumulates tokens that cannot be recovered
The token economics are fundamentally unsound and unsustainable
This undermines the token economy and creates a hidden cost for players using token-based games.
Manual code review
Foundry for POC validation
Instead of minting new tokens, the contract should transfer the existing tokens back to players:
If additional tokens should be awarded to winners, that should be a separate design decision clearly stated in the documentation.
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.