Users can vote for the best MartenitsaToken
NFT, which is listed for sale on the MartenitsaMarketplace
. The MartenitsaVoting::announceWinner
function is used to calculate the winner of the voting event. The winner is the NFT with the most votes. However, the MartenitsaVoting::announceWinner
function does not check if there are no votes, which a participant can receive a HealthToken
even if there are no votes for the winner's NFT, and become the winner.
A participant can become a winner of the event and receive a HealthToken
even if there are no votes for the winner's NFT, leading to unfair results in voting events.
Manual Review
Add this test to MartenitsaVoting.t.sol
:
As we can see from the logs of this test the HealthToken
balance of Chasy is 1. Jack's HealthToken
balance is 0, because he is not the winner.
Consider adding a require
statement to check if maxVotes
, which is declared in Martenitsa::announceWinner
function, is greater than 0:
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.