DrawCalculatorTimelock
The DrawCalculatorTimelock is responsible for pushing Draws to a DrawBuffer and routing claim requests from a PrizeDistributor to a DrawCalculator. The primary objective is to include a "cooldown" period for all new Draws. Allowing the correction of a maliciously set Draw in the unfortunate event an Owner is compromised.
Write methods description
initialize()
Allows to initialize the contract during the deployment.
Parameters:
Name | Type | Description |
---|---|---|
_owner | address | Address of the DrawCalculator owner. |
setTimelock()
Set the Timelock
struct. Only callable by the contract owner.
Parameters:
Name | Type | Description |
---|---|---|
_timelock | Timelock | Timelock struct to set. Includes values: timestamp, drawId. |
lock()
Lock passed draw ID for timelockDuration
seconds. Restricts new draws by forcing a push timelock.
Parameters:
Name | Type | Description |
---|---|---|
_drawId | uint32 | Draw ID to lock. |
_timestamp | uint64 | Epoch timestamp to unlock the draw. |
Return:
Name | Type | Description |
---|---|---|
_locked | bool |
|
transferOwnership()
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 |
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.
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:
Name | Type | Description |
---|---|---|
_newManager | address | An account that will become the new manager. |
Read methods description
getTimelock()
Read internal Timelock struct. Includes values: timestamp, drawId.
hasElapsed()
Returns bool for timelockDuration
elapsing.
Return:
Name | Type | Description |
---|---|---|
_elapsed | bool |
|
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()
The address that can claim the owner role. It is used to transfer the owner.
Last updated