Description
Dussehra::killRavana allows the protocol to begin the end of the event, sending all of the fees to the organiser. Other half is distributed to selected Ram in an other function. Problem is that this function is callable by any one and multiple time (no check of the boolean isRavanKilled).
Problem is that if this function is call twice, all the fees will be send to the organiser. (50% + 50% = 100%)
Moreover, to follow the tradition, only selected Ram should kill Ravana (and maybe also the organiser if selected Ram do not want to do it).
@> function killRavana() public RamIsSelected {
if (block.timestamp < 1728691069) {
revert Dussehra__MahuratIsNotStart();
}
if (block.timestamp > 1728777669) {
revert Dussehra__MahuratIsFinished();
}
IsRavanKilled = true;
uint256 totalAmountByThePeople = WantToBeLikeRam.length * entranceFee;
totalAmountGivenToRam = (totalAmountByThePeople * 50) / 100;
(bool success, ) = organiser.call{value: totalAmountGivenToRam}("");
require(success, "Failed to send money to organiser");
}
Risk
Likelyhood: High
Impact: High
Recommended Mitigation
- function killRavana() public RamIsSelected {
+ function killRavana() public RamIsSelected {
+ require(!IsRavanKilled);
+ require(choosingRamContract.selectedRam == msg.sender || organiser == msg.sender);
if (block.timestamp < 1728691069) {
revert Dussehra__MahuratIsNotStart();
}
if (block.timestamp > 1728777669) {
revert Dussehra__MahuratIsFinished();
}
IsRavanKilled = true;
uint256 totalAmountByThePeople = WantToBeLikeRam.length * entranceFee;
totalAmountGivenToRam = (totalAmountByThePeople * 50) / 100;
(bool success, ) = organiser.call{value: totalAmountGivenToRam}("");
require(success, "Failed to send money to organiser");
}