Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Functions does not emit events for better tracking.

Summary

Functions that change the state of the contract should emit events for better tracking.

https://github.com/Cyfrin/2024-07-the-predicter/blob/839bfa56fe0066e7f5610197a6b670c26a4c0879/src/ThePredicter.sol#L85

Impact Lack of transparency and difficulty in tracking state changes.

Tools Used Manual Review

Recommendations

Emit an event after a successful prediction.

function makePrediction(
uint256 matchNumber,
ScoreBoard.Result prediction
) public payable {
if (msg.value != predictionFee) {
revert ThePredicter__IncorrectPredictionFee();
}
if (block.timestamp > START_TIME + matchNumber * 86400 - 3600) {
revert ThePredicter__PredictionsAreClosed();
}
require(playersStatus[msg.sender] == Status.Approved, "Player not authorized to predict"); // Added authorization check
scoreBoard.confirmPredictionPayment(msg.sender, matchNumber);
scoreBoard.setPrediction(msg.sender, matchNumber, prediction);
emit PredictionMade(msg.sender, matchNumber, prediction); // Event emission added for transparency
}
event PredictionMade(address indexed player, uint256 matchNumber, ScoreBoard.Result prediction);
Updates

Lead Judging Commences

NightHawK Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.