The protocol mints new tokens to reward winners in token-based games instead of transferring the originally deposited tokens. This leads to token supply inflation and locks deposited tokens in the contract indefinitely.
Affected Functions:
_finishGame()
_handleTie()
_cancelGame()
Root Cause:
In token-based games (bet == 0), players deposit 1 RPSW token each (total 2 tokens held by the contract).
The current implementation mints new tokens to reward winners/players instead of transferring the deposited tokens:
This results in:
Locked tokens: Original 2 tokens remain stuck in the contract.
Supply inflation: New tokens are minted for every game, violating fixed-supply ERC20 semantics.
Critical economic flaw: Uncontrolled token supply growth.
Deposited tokens become permanently locked in the contract.
Winners receive newly minted tokens instead of the actual staked tokens, breaking game fairness.
Manual code review
Foundry test simulations (token balance tracking)
Modified Functions:
_finishGame():
_handleTie():
_cancelGame():
Key Changes:
Replaced all winningToken.mint() calls with winningToken.transfer() for token-based games.
Ensures the contract transfers deposited tokens instead of creating new ones.
Maintains ETH prize logic (minting 1 token for ETH winners) as originally designed.
Additional Safeguards:
Add balance check before transfers:
Update token approval logic in createGameWithToken()/joinGameWithToken() to ensure proper allowance.
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.