3.2 PredictableCompetition

The PredictableCompetition contract builds upon the base Competition contract and allows users to register and create 'bracket predictions.' Participants can acquire points by accurately predicting match outcomes, enhancing user engagement and fostering a competitive environment.

Function 1: createBracketPrediction

function createBracketPrediction(address _registrant, uint8[] calldata _matchPredictions) public virtual whenNotLive

This function allows a user to submit their bracket predictions for the competition.

NameTypeDescription

_registrant

address

The address of the user submitting the prediction.

_matchPredictions

uint8[] calldata

An array containing the user's predictions for each match.

Function 2: getUserBracketPrediction

function getUserBracketPrediction(address _user) public view returns(uint8[] memory bracketPrediction_)

This function retrieves a user's bracket predictions for the competition.

NameTypeDescription

_user

address

The address of the user whose predictions are to be fetched.

Function 3: hasUserRegistered

function hasUserRegistered(address _user) public view returns(bool isRegistered_)

This function checks whether a user has registered for the competition or not.

NameTypeDescription

_user

address

The address of the user whose registration status is to be checked.

Function 4: getTotalScore

function getTotalScore() external view returns(uint256 totalScore_)

This function calculates and returns the total score of the competition.

Function 5: getUserScorePercent

function getUserScorePercent(address _user) external view returns(uint256 scorePercent_)

This function calculates and returns the user's score as a percentage of the total possible score.

NameTypeDescription

_user

address

The address of the user whose score percentage is to be calculated.

Function 6: getUserBracketScore

function getUserBracketScore(address _user) public view returns(uint256 score_)

This function calculates and returns the user's bracket score based on their predictions.

NameTypeDescription

_user

address

The address of the user whose bracket score is to be calculated.

Last updated