killRavana
lacks a check to ensure that the function cannot be called multiple times. The issue allows any user to call the function at least twice to transfer all collected fees to the organizer, leaving no reward for the user who selected Ram.
The Dussehra protocol is intended for users to be able to mint NFTs for a fee and battle against other NFTs to select Ram. The user who finally selects Ram is entitled to withdraw 50% of the fees collected by the protocol. This can only be achieved after the killRavana
function has been called and 50% of the fees have been transferred to the organizer.
The problem with the current implementation lies in the fact that the killRavana
function can be called multiple times, sending 50% of the fees collected by the protocol each time. Consequently, after 2 calls, 100% of the fees will be transferred to the organizer and the user who selected Ram will receive no rewards.
Add the following test to the test suite. It shows that after Ram is selected and the killRavana
function is called twice, the organizer gets 100% of the fees.
Note: In order for this test to pass, the increaseValuesOfParticipants
function needs to be fixed by adding isRamSelected = true;
after the lines where the variable selectedRam
is set to the winner's user address.
The organizer could call the killRavana
function twice and withdraw 100% of the collected fees, leaving no rewards for the user who selected Ram.
Manual review.
Prevent the killRavana
function from being called multiple times.
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.