Description
The function ScoreBoard::setPrediction has a incorret verification of deadline to set prediction
Impact
The players may not be able to set predictions and the platform will not receive the predictions
Proof Of Concept
let time = 1723752000 + 0 * 68400 - 68400
let date = new Date(time * 1000);
let time = 1723752000 + 1 * 68400 - 68400
let date = new Date(time * 1000);
Recommended Mitigation
Fix the check in the ScoreBoard::setPrediction:
function setPrediction(
address player,
uint256 matchNumber,
Result result
) public {
+ if (block.timestamp <= START_TIME + matchNumber * 86400 - 3600)
+ playersPredictions[player].predictions[matchNumber] = result;
- if (block.timestamp <= START_TIME + matchNumber * 68400 - 68400)
- playersPredictions[player].predictions[matchNumber] = result;
playersPredictions[player].predictionsCount = 0;
for (uint256 i = 0; i < NUM_MATCHES; ++i) {
if (
playersPredictions[player].predictions[i] != Result.Pending &&
playersPredictions[player].isPaid[i]
) ++playersPredictions[player].predictionsCount;
}
}