In case when there are votes "for" and "against" the reward is calculated incorrectly, as a result voters "for" receive less reward part than they should and part of the reward is stuck on the voting contract.
The reward for a vote should be distributed among those who voted in favor, instead the payout is based on the total number of votes ("for" and "against"). Example: vote for 5 voters, payout is 1 ETH, 2 votes in favor and 1 against, quorum is reached and voting ends, those voters in favor expect to get 0.5 ETH each, but they will get 1/3 ETH each and rest 1/3 ETH will stuck on the contract forever.
Voters receive less reward that they should, part of reward stuck on the contract.
Visual Studio Code, Foundry test
Fix the _distributeRewards
function as follows:
replace line https://github.com/Cyfrin/2023-12-Voting-Booth/blob/a3241b1c530529a4f739f9462f720e8561ad45ca/src/VotingBooth.sol#L192
with
replace line https://github.com/Cyfrin/2023-12-Voting-Booth/blob/a3241b1c530529a4f739f9462f720e8561ad45ca/src/VotingBooth.sol#L207
with
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.