Comment on page
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.
Allow anyone to cancel a randomness request if the RNG service timed out.
Allows to initialize the contract during the deployment. Initialize PrizeDistributor smart contract.
Parameters:
Name | Type | Description |
---|---|---|
_owner | address | Owner address. |
_token | address | Token address. |
_drawBuffer | address | DrawBuffer address. |
_prizeDistributionBuffer | address | PrizeDistributionBuffer address. |
_rngService | address | RNG service address. |
_distribution | uint16[] | Initial array with distribution percentages. |
_rngTimeout | uint32 | RNG request timeout in seconds. |
Pay prizes to winners using current prizes distribution. Only callable by contract manager.
Parameters:
Name | Type | Description |
---|---|---|
_drawId | uint32 | An ID of a draw to pay prizes for. |
_winners | address[] | Winners of a draw. |
Return:
Name | Type | Description |
---|---|---|
_success | bool | true if operation is successful. |
Retrieves an array of random numbers that was requested for a draw and processes it. Only callable by contract manager.
Parameters:
Name | Type | Description |
---|---|---|
_drawId | uint32 | An ID of a draw to retrieve random numbers for. |
Return:
Name | Type | Description |
---|---|---|
_randomness | uint256[] | An array of random numbers for a draw. |
Requests an array of random numbers for a draw according to the current prizes distribution length. Only callable by contract manager.
Parameters:
Name | Type | Description |
---|---|---|
_drawId | uint32 | An ID of a draw to request random numbers for. |
_picksNumber | uint256 | A number of picks (participants) in a draw. |
_participantsHash | bytes | An IPFS hash that links to a list of participants in a draw. |
_isEmptyDraw | bool | A flag that indicates if a draw has no participants. |
Set prizes distribution.
Parameters:
Name | Type | Description |
---|---|---|
_distribution | uint16[] | Prizes distribution to set up. |
Set a DrawBuffer.
Parameters:
Name | Type | Description |
---|---|---|
_drawBuffer | address | A new DrawBuffer to set up. |
Set a PrizeDistributionBuffer.
Parameters:
Name | Type | Description |
---|---|---|
_prizeDistributionBuffer | address | A new PrizeDistributionBuffer to set up. |
Transfer ERC20 tokens out of contract to recipient address. Only callable by contract owner.
Parameters:
Name | Type | Description |
---|---|---|
_token | address | IERC20Upgradeable token to transfer. |
_to | address | Recipient of the tokens. |
_amount | uint256 | Amount of tokens to transfer. |
Return:
Name | Type | Description |
---|---|---|
_success | bool | true if operation is successful. |
Allows the
pendingOwner
address to claim the owner role. This function is only callable by the pendingOwner
.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.
Transfers ownership of the contract to a
_pendingOwner
. Can only be called by the current owner. Parameters:
Name | Type | Description |
---|---|---|
_newOwner | address | an account that will become the _pendingOwner . |
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:
Name | Type | Description |
---|---|---|
_newManager | address | An account that will become the new manager. |
Allows to set a RNG service that the PrizeDistributor is connected to. Can only be called by the current owner.
Parameters:
Name | Type | Description |
---|---|---|
_rngService | IRNGServiceChainlinkV2 | The address of the new RNG service interface. |
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:
Name | Type | Description |
---|---|---|
_rngTimeout | uint32 | An RNG request timeout in seconds. |
100% with 2 decimal points (i.s. 10000 == 100.00%).
Read global prizes distribution. Returns an array with the split percentages in which the prizes will be distributed.
Read global DrawBuffer address. The DrawBuffer contains information about the draw.
Read global info about the last RNG request (ID, lock block and timestamp).
Read global last unpaid draw ID. It increments when the draw is paid.
Read global prizes distribution length.
Read global PrizeDistributionBuffer address.
Read global RNGServiceChainlinkV2 address.
Read global RNG timeout. Timeout is presented in seconds.
Read global Ticket address.
Returns whether a random numbers request has been completed.
Returns whether a random numbers has been requested.
Returns whether a random numbers request has been timed out.
Owner role that can be granted exclusive access to specific functions with the modifier
onlyOwner
.Manager role that can be granted exclusive access to specific functions with the modifier
onlyManager
or onlyManagerOrOwner
.Address that can claim the owner role. It is used to transfer the owner.
Last modified 6mo ago