In the `declareWinner()` function, the `GameEnded` event is emitted after the pot is reset to 0. As a result, the pot value logged in the event is always 0, even though the winner has received the actual prize internally through the pendingWinnings mapping. This creates a discrepancy between the internal state and the emitted event data.
*Impact*
The emitted event data misrepresents the amount won by the declared winner. Off-chain services (e.g., indexers, frontends, analytics tools) that rely on event logs for tracking the game's outcome will be misled, showing zero winnings instead of the actual prize. This does not affect the correctness of the contract’s internal logic, but it can confuse users and reduce transparency.
Store the pot value in a local variable before resetting it, and use that in the event emission:
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.