To find the winner of the voting, the announceWinner
function scan the _tokenIds
to find the tokenId that received more votes.
If the _tokenIds
is empty the winnerTokenId
will not be initialized, thus emitting a WinnerAnnounced
event with a token Id of 0 and transfering the HealthToken to the seller of the token with Id 0
The producer of the token 0 has an unfair advantage.
Proof of Concept:
Add this test to MartenitsaVoting.t.sol
Foundry
In announceWinner
check if there are no votes
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.