When the game ends and a winner is declared, the GameEnded event should accurately log the amount of ETH won by the current King. This event is critical for off-chain consumers such as frontends, bots, or subgraphs that rely on on-chain data to track game outcomes.
The pot is reset to zero before the event is emitted, causing prizeAmount in the GameEnded event to always be 0, regardless of the actual reward given to the King. This creates inconsistency between the contract’s internal state and emitted logs.
Likelihood:
This will always occur when a player wins the game and someone calls declareWinner().
It affects every round and every winner, since the pot is cleared before logging.
Impact:
Event GameEnded reports incorrect data: prizeAmount == 0, even if the winner received ETH.
Off-chain services, indexers, bots, or explorers that rely on this event will miss or misrepresent the winner's prize, potentially breaking automation, analytics, or payouts.
A player claims the throne and builds up the pot. When declareWinner() is called, the pot is set to zero before emitting GameEnded, causing the event to log a prizeAmount of 0 despite a real payout occurring.
Store the pot value in a local variable before resetting it, and use that variable in the GameEnded event to ensure accurate prize reporting.
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.