The declareWinner()
function contains a logic error in the order of operations that causes the GameEnded
event to emit incorrect prize amount data.
The sequence of operations is:
Add pot amount to winner's pending winnings
Reset pot to 0
Emit event with the now-zero pot value
This means the GameEnded
event will always log prizeAmount = 0
instead of the actual prize amount that was won, regardless of how much ETH was actually in the pot.
Example:
Pot contains 10 ETH when grace period expires
Winner should receive 10 ETH prize
Event emits: GameEnded(winner, 0, timestamp, round)
instead of GameEnded(winner, 10, timestamp, round)
External monitoring systems receive false prize amount information
Store the pot amount before resetting it, then emit the event with the correct prize value:
This ensures the event accurately reflects the actual prize amount won, maintaining data integrity for all external systems monitoring the contract.
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.