The winner share calculation accumulates values without resetting the state variable, causing massively inflated denominators and fund loss for winners.
The _getWinnerShares() function should calculate the total shares held by users who selected the winning country.
The function accumulates values into the state variable totalWinnerShares using += but never resets it to zero before calculation. If called multiple times (or even once with existing state), it will keep adding to the previous value.
Likelihood:
Function is called every time setWinner() is executed
State variable persists between calls
Design flaw that will manifest if contract logic changes
Impact:
totalWinnerShares becomes massively inflated
Winners receive far less than they deserve during withdrawal
Withdrawal calculation uses this as denominator
Direct fund loss for all winners
If contract is updated and the new method call _getWinnerShares() as from this name, it only returns the WinnerShares but it actually updating the state, without setting it to 0 initially
This can be fixed by just setting the state to 0 initially
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.