Competitions contract
Methods
addCompetition
function addCompetition(uint256[] avgDESCWinnerRewards, uint256[] sumDESCWinnerRewards, uint256[] sumASCWinnerRewards, uint256 startTimestamp, uint256 endTimestamp) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| avgDESCWinnerRewards | uint256[] | undefined |
| sumDESCWinnerRewards | uint256[] | undefined |
| sumASCWinnerRewards | uint256[] | undefined |
| startTimestamp | uint256 | undefined |
| endTimestamp | uint256 | undefined |
allCompetitions
function allCompetitions(uint256) external view returns (struct Competitions.WinnersInfo winnersInfo, uint256 startTimestamp, uint256 endTimestamp, uint256 openPredictionsCount, uint256 closedPredictionsCount, uint256 competitorsCount)
Parameters
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| winnersInfo | Competitions.WinnersInfo | undefined |
| startTimestamp | uint256 | undefined |
| endTimestamp | uint256 | undefined |
| openPredictionsCount | uint256 | undefined |
| closedPredictionsCount | uint256 | undefined |
| competitorsCount | uint256 | undefined |
approvePredictionsAddress
function approvePredictionsAddress(address contractAddress, bool approved) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| contractAddress | address | undefined |
| approved | bool | undefined |
avgDESCWinners
function avgDESCWinners(uint256 competitionID, uint256 winnerIndex) external view returns (address winner)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| winnerIndex | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| winner | address | undefined |
changeDurationToClosePredictions
function changeDurationToClosePredictions(uint256 newDurationToClosePredictions) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| newDurationToClosePredictions | uint256 | undefined |
closePredictionInCompetition
function closePredictionInCompetition(address competitor, uint256 predictionID, int256 predictionPerformance) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| competitor | address | undefined |
| predictionID | uint256 | undefined |
| predictionPerformance | int256 | undefined |
competitionByPrediction
function competitionByPrediction(address, uint256) external view returns (uint256)
Parameters
| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |
| _1 | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
competitionsBalance
function competitionsBalance() external view returns (uint256)
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
competitionsCount
function competitionsCount() external view returns (uint256)
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
competitorAvgPerformance
function competitorAvgPerformance(uint256 competitionID, address competitor) external view returns (int256)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| competitor | address | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | int256 | undefined |
competitorClosedPredictionsCount
function competitorClosedPredictionsCount(uint256 competitionID, address competitor) external view returns (uint256)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| competitor | address | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
competitorOpenPredictionsCount
function competitorOpenPredictionsCount(uint256 competitionID, address competitor) external view returns (uint256)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| competitor | address | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
competitorPredictions
function competitorPredictions(uint256 competitionID, address competitor, uint256 competitorPredictionIndex) external view returns (uint256 predictionID)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| competitor | address | undefined |
| competitorPredictionIndex | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| predictionID | uint256 | undefined |
competitorSumPerformance
function competitorSumPerformance(uint256 competitionID, address competitor) external view returns (int256)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| competitor | address | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | int256 | undefined |
currentCompetition
function currentCompetition() external view returns (uint256)
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
durationToClosePredictions
function durationToClosePredictions() external view returns (uint256)
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
getSumOfRewards
function getSumOfRewards(uint256 competitionID) external view returns (uint256)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
getTrustedForwarder
function getTrustedForwarder() external view returns (address)
⚠️ Warning ⚠️ The Forwarder can have a full control over your Recipient. Only trust verified Forwarder.Method is not a required method to allow Recipients to trust multiple Forwarders. Not recommended yet.
Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | The address of the Forwarder contract that is being used. |
isAvgDESCWinnerRewardAlreadySend
function isAvgDESCWinnerRewardAlreadySend(uint256 competitionID, uint256 winnerIndex) external view returns (bool isWinnerRewardAlreadySend)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| winnerIndex | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| isWinnerRewardAlreadySend | bool | undefined |
isCompetitionEnded
function isCompetitionEnded(uint256 competitionID) external view returns (bool)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
isCompetitionNeverStarted
function isCompetitionNeverStarted(uint256 competitionID) external view returns (bool)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
isCompetitionReadyToReward
function isCompetitionReadyToReward(uint256 competitionID) external view returns (bool)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
isPredictionsAddressApproved
function isPredictionsAddressApproved(address) external view returns (bool)
Parameters
| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined |
isSumASCWinnerRewardAlreadySend
function isSumASCWinnerRewardAlreadySend(uint256 competitionID, uint256 winnerIndex) external view returns (bool isWinnerRewardAlreadySend)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| winnerIndex | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| isWinnerRewardAlreadySend | bool | undefined |
isSumDESCWinnerRewardAlreadySend
function isSumDESCWinnerRewardAlreadySend(uint256 competitionID, uint256 winnerIndex) external view returns (bool isWinnerRewardAlreadySend)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| winnerIndex | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| isWinnerRewardAlreadySend | bool | undefined |
isTrustedForwarder
function isTrustedForwarder(address forwarder) external view returns (bool)
⚠️ Warning ⚠️ The Forwarder can have a full control over your Recipient. Only trust verified Forwarder.
Parameters
| Name | Type | Description |
|---|---|---|
| forwarder | address | The address of the Forwarder contract that is being used. |
Returns
| Name | Type | Description |
|---|---|---|
| _0 | bool | isTrustedForwarder true if the Forwarder is trusted to forward relayed transactions by this Recipient. |
l2ERC20SanToken
function l2ERC20SanToken() external view returns (contract IERC20)
Returns
| Name | Type | Description |
|---|---|---|
| _0 | contract IERC20 | undefined |
openPredictionInCompetition
function openPredictionInCompetition(address competitor, uint256 predictionID) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| competitor | address | undefined |
| predictionID | uint256 | undefined |
owner
function owner() external view returns (address)
Returns the address of the current owner.
Returns
| Name | Type | Description |
|---|---|---|
| _0 | address | undefined |
previousCompetition
function previousCompetition() external view returns (uint256)
Returns
| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined |
renounceOwnership
function renounceOwnership() external nonpayable
Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.
setCurrentCompetition
function setCurrentCompetition(uint256 newCurrentCompetition) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| newCurrentCompetition | uint256 | undefined |
setTrustedForwarder
function setTrustedForwarder(address forwarder) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| forwarder | address | undefined |
sumASCWinners
function sumASCWinners(uint256 competitionID, uint256 winnerIndex) external view returns (address winner)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| winnerIndex | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| winner | address | undefined |
sumDESCWinners
function sumDESCWinners(uint256 competitionID, uint256 winnerIndex) external view returns (address winner)
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
| winnerIndex | uint256 | undefined |
Returns
| Name | Type | Description |
|---|---|---|
| winner | address | undefined |
transferOwnership
function transferOwnership(address newOwner) external nonpayable
Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.
Parameters
| Name | Type | Description |
|---|---|---|
| newOwner | address | undefined |
withdrawCompetitionBalance
function withdrawCompetitionBalance(uint256 competitionID) external nonpayable
Parameters
| Name | Type | Description |
|---|---|---|
| competitionID | uint256 | undefined |
Events
CompetitionBalanceWithdrawn
event CompetitionBalanceWithdrawn(uint256 indexed competitionID, uint256 indexed sumOfRewards, address indexed owner)
Parameters
| Name | Type | Description |
|---|---|---|
competitionID indexed | uint256 | undefined |
sumOfRewards indexed | uint256 | undefined |
owner indexed | address | undefined |
NewCompetitor
event NewCompetitor(uint256 indexed competitionID, uint256 predictionID, address indexed competitor)
Parameters
| Name | Type | Description |
|---|---|---|
competitionID indexed | uint256 | undefined |
| predictionID | uint256 | undefined |
competitor indexed | address | undefined |
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)
Parameters
| Name | Type | Description |
|---|---|---|
previousOwner indexed | address | undefined |
newOwner indexed | address | undefined |
PredictionsAddressApproved
event PredictionsAddressApproved(address indexed contractAddress, bool approved)
Parameters
| Name | Type | Description |
|---|---|---|
contractAddress indexed | address | undefined |
| approved | bool | undefined |
Errors
OwnableInvalidOwner
error OwnableInvalidOwner(address owner)
The owner is not a valid owner account. (eg. address(0))
Parameters
| Name | Type | Description |
|---|---|---|
| owner | address | undefined |
OwnableUnauthorizedAccount
error OwnableUnauthorizedAccount(address account)
The caller account is not authorized to perform an operation.
Parameters
| Name | Type | Description |
|---|---|---|
| account | address | undefined |