The mechanism of this game is: if no one pays more fees than you during the gracePeriod
, you will win the pot prize as the last currentKing
.
If player1
pays a higher fee (0.4 ether) to claim the throne and increase his chances of staying king, and then player2
comes afterward and wants to claim the throne, the required claim fee becomes only (0.11 ether). He pays it and becomes the currentKing
instead of player1
.
But before running the test, you need to correct this issue in claimThrone()
:
Then, add this test to Game.t.sol
:
Then run:
forge test --match-test testclaimThrone3 -vv
And this will pass
You need to update the claim fee to depend on how much the currentKing
paid,
rather than using a constant percentage increase.
or
just prevent user to claimThrone with extra fee
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.