DrawBeacon

Manages pushing draws onto DrawBuffer. The DrawBeacon has 1 major action: creating of a new draw. A user can create a new draw using the startDraw() method which will push the draw onto the DrawBuffer.

Write methods description

initialize()

Allows to initialize the contract during the deployment.

Parameters:

NameTypeDescription

_owner

address

Address of the DrawBeacon owner.

_drawBuffer

address

The address of the draw buffer to push draws to.

_nextDrawId

uint32

Draw ID at which the DrawBeacon should start. Can't be inferior to 1.

_beaconPeriodStart

uint64

The starting timestamp of the beacon period.

_beaconPeriodSeconds

uint32

The duration of the beacon period in seconds.

setBeaconPeriodSeconds()

Allows the owner to set the beacon period in seconds.

Parameters:

NameTypeDescription

_beaconPeriodSeconds

uint32

The new beacon period in seconds. Must be greater than zero.

setDrawBuffer()

Set global DrawBuffer variable. All subsequent draw requests/completions will be pushed to the new DrawBuffer.

Parameters:

NameTypeDescription

_newDrawBuffer

address

DrawBuffer address.

startDraw()

Starts the draw creation process. The previous beacon period must have ended.

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:

NameTypeDescription

_newOwner

address

an account that will become the _pendingOwner.

Read methods description

beaconPeriodEndAt()

Returns the timestamp at which the beacon period ends.

beaconPeriodRemainingSeconds()

Returns the number of seconds remaining until the beacon period can be complete.

calculateNextBeaconPeriodStartTime()

Calculates when the next beacon period will start.

Parameters:

NameTypeDescription

_time

uint64

The timestamp to use as the current time.

calculateNextBeaconPeriodStartTimeFromCurrentTime()

Calculates the next beacon start time, assuming all beacon periods have occurred between the last and now.

canStartDraw()

Returns whether the draw can start. true if the beacon period is over, false otherwise.

getBeaconPeriodSeconds()

Returns beacon period seconds.

getBeaconPeriodStartedAt()

Returns the time when the beacon period started at.

getDrawBuffer()

Returns the address of the DrawBuffer.

getNextDrawId()

Returns the next draw to be processed.

isBeaconPeriodOver()

Returns whether the beacon period is over. true if the beacon period is over, false otherwise.

owner()

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

pendingOwner()

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

Last updated