Comment on page
DrawBuffer
The DrawBuffer provides historical lookups of Draws via a circular ring buffer. Historical Draws can be accessed on-chain using a Draw ID to calculate ring buffer storage slots. The Draw settings can be created by manager/owner and existing Draws can only be updated by the owner. Once a starting Draw has been added to the ring buffer, all following draws must have a sequential Draw ID.
A DrawBuffer stores a limited number of Draws before beginning to overwrite (managed via the cardinality) previous Draws. Mainnet DrawBuffer is updated directly from a DrawBeacon.
Allows to initialize the contract during the deployment.
Parameters:
Name | Type | Description |
---|---|---|
_owner | address | Address of the owner of the DrawBuffer. |
_cardinality | uint8 | Draw ring buffer cardinality. |
Mark a draw as paid. It means that the winners of the draw were paid and the draw can not be paid again.
Parameters:
Name | Type | Description |
---|---|---|
_drawId | uint32 | An ID of a draw that should be marked as paid. |
Push draw onto draws ring buffer history. Push new draw onto draws history via authorized manager or owner.
Parameters:
Name | Type | Description |
---|---|---|
_draw | IDrawBeacon.Draw | Draw information that was pushed. |
Set existing draw in draws ring buffer with new parameters. Push new draw onto draws history via authorized manager or owner.
Parameters:
Name | Type | Description |
---|---|---|
_draw | IDrawBeacon.Draw | Draw to set. |
Return:
Name | Type | Description |
---|---|---|
_drawId | uint32 | Draw ID. |
Set a new PrizeDistributor contract address.
Parameters:
Name | Type | Description |
---|---|---|
_prizeDistributor | address | A new PrizeDistributor contract address |
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. |
Ring buffer max length.
Read a ring buffer cardinality.
Read a draw from the draws ring buffer. Read a draw using the
draw.drawId
to calculate position in the draws ring buffer.Parameters:
Name | Type | Description |
---|---|---|
_drawId | uint32 | The draw ID to retrieve the draw data from. |
Gets the number of draws held in the draw ring buffer. If no draws have been pushed, it will return 0. If the ring buffer is full, it will return the cardinality. Otherwise, it will return the newest draw index + 1.
Return:
Name | Type | Description |
---|---|---|
_count | uint32 | Number of draws held in the draw ring buffer. |
Read multiple draws from the draws ring buffer. Read multiple draws using each
draw.drawId
to calculate position in the draws ring buffer. Parameters:
Name | Type | Description |
---|---|---|
_drawIds | uint32[] | Array of draw IDs. |
Return:
Name | Type | Description |
---|---|---|
_draws | IDrawBeacon.Draw[] | Array with the draw information of the requested draw IDs. |
Read newest draw from draws ring buffer. Uses the
nextDrawIndex
to calculate the most recently added draw.Read oldest draw from draws ring buffer. Finds the oldest draw by comparing and/or diffing
totalDraws
with the cardinality.Read a PrizeDistributor contract address.
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