Finalization should divide the finalized vault assets among winners using a stable denominator equal to the aggregate winner shares at the exact moment of finalization. That denominator must reflect the same notion of “shares” that will be used at withdrawal time to avoid residuals or under/over‑payments.
The contract snapshots each user’s shares at joinEvent() into userSharesToCountry[user][countryId], but users’ actual share balances can change later (e.g., via cancelParticipation() burning shares, or transfers if shares were transferable). At setWinner(), _getWinnerShares() sums the old snapshots into totalWinnerShares, while withdraw() uses the current balanceOf(msg.sender) in the numerator. This mismatch (stale denominator vs. fresh numerator) causes denominator drift, leading to under‑payments and stranded assets.
Likelihood: Medium
Participants commonly cancel or adjust positions before eventStartDate. Because joinEvent() can be called early and snapshots shares once, any later burns or changes will desynchronize the denominator.
The test suite includes cancelParticipation() which burns all shares and refunds stake; users can call joinEvent() before canceling, creating a realistic drift scenario.
Impact: Medium
Under‑payment of winners: The denominator (totalWinnerShares) is larger than the sum of winners’ actual shares at withdrawal time, so each withdrawal returns less than intended.
Residual funds stuck: Because payouts are computed with a too‑large denominator, leftover assets remain in the vault with no sweep mechanism, effectively locking funds.
A user joining, then canceling to burn shares.
The stale snapshot still contributes to totalWinnerShares, causing denominator drift and reduced payouts for the remaining winners.
Freeze share transfers / burns during the event window
CancelParticipation burns shares but leaves the address inside usersAddress and keeps userSharesToCountry populated.
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.