PrizeDistributor

The PrizeDistributor contract holds Tickets (captured interest) and distributes tickets to users with winning draw claims. A manager account can indicate the winners that will receive the payment of the prizes.

Write methods description

cancelRandomnessRequest()

Allow anyone to cancel a randomness request if the RNG service timed out.

initialize()

Allows to initialize the contract during the deployment. Initialize PrizeDistributor smart contract.

Parameters:

payWinners()

Pay prizes to winners using current prizes distribution. Only callable by contract manager.

Parameters:

Return:

processRandomness()

Retrieves an array of random numbers that was requested for a draw and processes it. Only callable by contract manager.

Parameters:

Return:

requestRandomness()

Requests an array of random numbers for a draw according to the current prizes distribution length. Only callable by contract manager.

Parameters:

setDistribution()

Set prizes distribution.

Parameters:

setDrawBuffer()

Set a DrawBuffer.

Parameters:

setPrizeDistributionBuffer()

Set a PrizeDistributionBuffer.

Parameters:

withdrawERC20()

Transfer ERC20 tokens out of contract to recipient address. Only callable by contract owner.

Parameters:

Return:

claimOwnership()

Allows the pendingOwner address to claim the owner role. This function is only callable by the pendingOwner.

renounceOwnership()

Leaves the contract without owner. It will not be possible to call the owner's functions anymore. Can only be called by the current owner. The method does not take any parameters. Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

transferOwnership()

Transfers ownership of the contract to a _pendingOwner. Can only be called by the current owner.

Parameters:

setManager()

Allows the owner to give the manager role to an address. The manager role has access to the functions with the modified onlyManager or onlyManagerOrOwner.

Parameters:

setRngService()

Allows to set a RNG service that the PrizeDistributor is connected to. Can only be called by the current owner.

Parameters:

setRngTimeout()

Allows to set an RNG request timeout in seconds. This is the time that must elapse before an RNG request can be canceled. Can only be called by the current owner.

Parameters:

Read methods description

ONE_HUNDRED_PERCENTS()

100% with 2 decimal points (i.s. 10000 == 100.00%).

getDistribution()

Read global prizes distribution. Returns an array with the split percentages in which the prizes will be distributed.

getDrawBuffer()

Read global DrawBuffer address. The DrawBuffer contains information about the draw.

getLastRngRequest()

Read global info about the last RNG request (ID, lock block and timestamp).

getLastUnpaidDrawId()

Read global last unpaid draw ID. It increments when the draw is paid.

getNumberOfWinners()

Read global prizes distribution length.

getPrizeDistributionBuffer()

Read global PrizeDistributionBuffer address.

getRngService()

Read global RNGServiceChainlinkV2 address.

getRngTimeout()

Read global RNG timeout. Timeout is presented in seconds.

getToken()

Read global Ticket address.

isRngCompleted()

Returns whether a random numbers request has been completed.

isRngRequested()

Returns whether a random numbers has been requested.

isRngTimedOut()

Returns whether a random numbers request has been timed out.

owner()

Owner role that can be granted exclusive access to specific functions with the modifier onlyOwner.

manager()

Manager role that can be granted exclusive access to specific functions with the modifier onlyManager or onlyManagerOrOwner.

pendingOwner()

Address that can claim the owner role. It is used to transfer the owner.

Last updated