IAUT_EXT_VotingRoles_v1.sol

Git Source

Functions

MAX_VOTING_DURATION

The maximum voting duration.

function MAX_VOTING_DURATION() external view returns (uint);

Returns

Name
Type
Description

<none>

uint256

The maximum voting duration.

MIN_VOTING_DURATION

The minimum voting duration.

function MIN_VOTING_DURATION() external view returns (uint);

Returns

Name
Type
Description

<none>

uint256

The minimum voting duration.

isVoter

Checks whether an address is a voter.

function isVoter(address who) external view returns (bool);

Parameters

Name
Type
Description

who

address

The address to check.

Returns

Name
Type
Description

<none>

bool

Whether the address is a voter.

addVoter

Adds a voter.

Parameters

Name
Type
Description

who

address

The address to add.

addVoterAndUpdateThreshold

Adds a voter and updates the threshold.

Parameters

Name
Type
Description

who

address

The address to add.

newThreshold

uint256

The new threshold.

removeVoter

Removes a voter.

Parameters

Name
Type
Description

who

address

The address to remove.

removeVoterAndUpdateThreshold

Removes a voter and updates the threshold.

Parameters

Name
Type
Description

who

address

The address to remove.

newThreshold

uint256

The new threshold.

motions

Gets the motion data.

Parameters

Name
Type
Description

motionId

bytes32

The ID of the motion.

Returns

Name
Type
Description

<none>

address

target The address of the contract to execute the action on.

<none>

bytes

action The action data to execute on the target contract.

<none>

uint256

startTimestamp The timestamp at which the motion starts.

<none>

uint256

endTimestamp The timestamp at which the motion ends.

<none>

uint256

requiredThreshold The required threshold of votes to pass the motion.

<none>

uint256

forVotes The number of votes in favor of the motion.

<none>

uint256

againstVotes The number of votes against the motion.

<none>

uint256

abstainVotes The number of votes abstaining from the motion.

<none>

uint256

executedAt The timestamp at which the motion was executed.

<none>

bool

executionResult The result of the execution.

<none>

bytes

executionReturnData The return data of the execution.

motionCount

Gets the number of motions.

Returns

Name
Type
Description

<none>

uint256

The number of motions.

voterCount

Gets the number of voters.

Returns

Name
Type
Description

<none>

uint256

The number of voters.

threshold

Gets the threshold.

Returns

Name
Type
Description

<none>

uint256

The threshold.

getReceipt

Gets the receipt of a voter for a motion.

Parameters

Name
Type
Description

_ID

bytes32

The ID of the motion.

voter

address

The address of the voter.

Returns

Name
Type
Description

<none>

Receipt

The receipt of the voter.

voteDuration

Gets the voting duration.

Returns

Name
Type
Description

<none>

uint256

The voting duration.

setThreshold

Sets the threshold.

Parameters

Name
Type
Description

newThreshold

uint256

The new threshold.

setVotingDuration

Sets the voting duration.

Parameters

Name
Type
Description

newVoteDuration

uint256

The new voting duration.

createMotion

Creates a motion.

Parameters

Name
Type
Description

target

address

The address of the contract to execute the action on.

action

bytes

The action data to execute on the target contract.

Returns

Name
Type
Description

<none>

bytes32

The ID of the created motion.

castVote

Casts a vote for a motion.

Parameters

Name
Type
Description

motionId

bytes32

The ID of the motion.

support

uint8

The value that indicates wether the voter supports the motion.

executeMotion

Executes a motion.

Parameters

Name
Type
Description

motionId

bytes32

The ID of the motion.

Events

VoterAdded

Event emitted when a new voter address gets added.

Parameters

Name
Type
Description

who

address

The added address.

VoterRemoved

Event emitted when a voter address gets removed.

Parameters

Name
Type
Description

who

address

The removed address.

ThresholdUpdated

Event emitted when the required threshold changes.

Parameters

Name
Type
Description

oldThreshold

uint256

The old threshold.

newThreshold

uint256

The new threshold.

VoteDurationUpdated

Event emitted when the voting duration changes.

Parameters

Name
Type
Description

oldVotingDuration

uint256

The old voting duration.

newVotingDuration

uint256

The new voting duration.

MotionCreated

Event emitted when a motion is created.

Parameters

Name
Type
Description

motionId

bytes32

The motion ID.

VoteCast

Event emitted when a vote is cast for a motion.

Parameters

Name
Type
Description

motionId

bytes32

The motion ID.

voter

address

The address of a voter.

support

uint8

MotionExecuted

Event emitted when a motion is executed.

Parameters

Name
Type
Description

motionId

bytes32

The motion ID.

Errors

Module__VotingRoleManager__EmptyVoters

The action would leave an empty voter list.

Module__VotingRoleManager__InvalidVoterAddress

The supplied voter address is invalid.

Module__VotingRoleManager__InvalidThreshold

The threshold cannot exceed the amount of voters. or be too low to be considered safe.

Module__VotingRoleManager__InvalidVotingDuration

The supplied voting duration is invalid.

Module__VotingRoleManager__CallerNotVoter

The function can only be called by a voter.

Module__VotingRoleManager__IsAlreadyVoter

The address is already a voter.

Module__VotingRoleManager__InvalidSupport

The value given as vote is invalid.

Module__VotingRoleManager__InvalidMotionId

The supplied ID is referencing a motion that doesn't exist.

Module__VotingRoleManager__AttemptedDoubleVote

A user cannot vote twice.

Module__VotingRoleManager__MotionInVotingPhase

A motion cannot be executed if the voting duration hasn't passed.

Module__VotingRoleManager__MotionVotingPhaseClosed

A motion cannot be voted on if the duration has been exceeded.

Module__VotingRoleManager__MotionAlreadyExecuted

A motion cannot be executed twice.

Module__VotingRoleManager__ThresholdNotReached

A motion cannot be executed if it didn't reach the threshold.

Structs

Motion

A motion is a proposal to execute an action on a target contract.

Properties

Name
Type
Description

target

address

The address of the contract to execute the action on.

action

bytes

The action data to execute on the target contract.

startTimestamp

uint256

The timestamp at which the motion starts.

endTimestamp

uint256

The timestamp at which the motion ends.

requiredThreshold

uint256

The required threshold of votes to pass the motion.

forVotes

uint256

The number of votes in favor of the motion.

againstVotes

uint256

The number of votes against the motion.

abstainVotes

uint256

The number of votes abstaining from the motion.

receipts

mapping(address => Receipt)

The receipts of votes for the motion address => Receipt

executedAt

uint256

The timestamp at which the motion was executed.

executionResult

bool

The result of the execution.

executionReturnData

bytes

The return data of the execution.

Receipt

A receipt is a vote cast for a motion.

Properties

Name
Type
Description

hasVoted

bool

Whether the voter has already voted.

support

uint8

The value that indicates wether the voter supports the motion.

Last updated