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:

NameTypeDescription

_owner

address

Address of the DrawCalculator owner.

setTimelock()

Set the Timelock struct. Only callable by the contract owner.

Parameters:

NameTypeDescription

_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:

NameTypeDescription

_drawId

uint32

Draw ID to lock.

_timestamp

uint64

Epoch timestamp to unlock the draw.

Return:

NameTypeDescription

_locked

bool

true if operation was successful.

transferOwnership()

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

Parameters:

NameTypeDescription

_newOwner

address

An account that will become the _pendingOwner.

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:

NameTypeDescription

_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:

NameTypeDescription

_elapsed

bool

true if timelockDuration, since last time lock has elapsed, false otherwise.

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