Fees not collected for games that are cancelled
The internal function RockPaperScissors::_cancelGame()
implements core logic behind cancelling games.It starts with transition to final state GameState.Cancelled
and further handles the refund of users, sending required ETH amount or minting winner tokens for each participating opponent in the game. But no calculation of ETH fee and further collection is implemented for games with ETH bets.
Мissing fee collection leads to:
protocol requirements are not fulfilled, since the documentation says: 10% protocol fee on all ETH games
inconsistent implementation with the other functions RockPaperScissors::_finishGame()
and RockPaperScissors::_handleTie()
, already implementing calculation and collection of the 10% fee from ETH games
lost profits for the game contract and more precise his creator/owner
Manual review
Foundry
Add the following test to RockPaperScissors.t.sol
.
Implement missing protocol fee collection for cancelled games with ETH bets in function RockPaperScissors::_cancelGame()
in order to fulfill the protocol requirements.
ETH sent directly to the contract via the receive function or after a canceled game becomes permanently locked
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.