Summary
In withdrawPredictionFees
and cancelRegistration
functions, misleading error messages were thrown
Vulnerability Details
function withdrawPredictionFees() public {
if (msg.sender != organizer) {
- revert ThePredicter__NotEligibleForWithdraw();
}
uint256 fees = address(this).balance - players.length * entranceFee;
(bool success, ) = msg.sender.call{value: fees}("");
require(success, "Failed to withdraw");
}
function cancelRegistration() public {
if (playersStatus[msg.sender] == Status.Pending) {
(bool success, ) = msg.sender.call{value: entranceFee}("");
require(success, "Failed to withdraw");
playersStatus[msg.sender] = Status.Canceled;
return;
}
- revert ThePredicter__NotEligibleForWithdraw();//@audit wrong throw==
}
Impact
Tools Used
Recommendations
function withdrawPredictionFees() public {
if (msg.sender != organizer) {
+ revert ThePredicter__UnauthorizedAccess();
}
uint256 fees = address(this).balance - players.length * entranceFee;
(bool success, ) = msg.sender.call{value: fees}("");
require(success, "Failed to withdraw");
}
function cancelRegistration() public {
if (playersStatus[msg.sender] == Status.Pending) {
(bool success, ) = msg.sender.call{value: entranceFee}("");
require(success, "Failed to withdraw");
playersStatus[msg.sender] = Status.Canceled;
return;
}
+ revert ("Not_Allowed_To_CancelRegistration");
}