Rock Paper Scissors

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

Token Minting on Tie/Cancellation Leads to Inflation

Summary

The game contract incorrectly mints new winningToken instances to players when token-based games conclude with a tie (_handleTie) or are cancelled (_cancelGame). Instead of transferring back the tokens that players likely staked to enter the game, this logic increases the total supply of the winningToken, resulting in potential inflation.

Vulnerability Details

function _handleTie(uint256 _gameId) internal {
//...
// Return tokens for token games
if (game.bet == 0) {
@> winningToken.mint(game.playerA, 1);
@> winningToken.mint(game.playerB, 1);
}
// Since in a tie scenario, the total prize is split equally
emit GameFinished(_gameId, address(0), 0);
}
function _cancelGame(uint256 _gameId) internal {
//...
// Return tokens for token games
if (game.bet == 0) {
if (game.playerA != address(0)) {
@> winningToken.mint(game.playerA, 1);
}
if (game.playerB != address(0)) {
@> winningToken.mint(game.playerB, 1);
}
}
emit GameCancelled(_gameId);
}

Impact

This issue leads to uncontrolled inflation of the winningToken supply.

Tools Used

Recommendations

Using transfer instead of mint.

Updates

Appeal created

m3dython Lead Judge 10 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.

Give us feedback!