AUT_EXT_VotingRoles_v1.sol
Inherits: IAUT_EXT_VotingRoles_v1, Module_v1
Author: Inverter Network
Facilitates voting and motion management within the Inverter Network, allowing designated voters to participate in governance through proposals, voting, and execution of decisions.
Supports setting thresholds for decision-making, managing voter lists, creating motions, casting votes, and executing actions based on collective decisions. This structure enhances governance transparency and efficacy.
State Variables
MAX_VOTING_DURATION
The maximum voting duration.
uint public constant MAX_VOTING_DURATION = 2 weeks;MIN_VOTING_DURATION
The minimum voting duration.
uint public constant MIN_VOTING_DURATION = 1 days;isVoter
Checks whether an address is a voter.
mapping(address => bool) public isVoter;motions
Gets the motion data.
motionCount
Gets the number of motions.
voterCount
Gets the number of voters.
threshold
Gets the threshold.
voteDuration
Gets the voting duration.
__gap
Storage gap for future upgrades.
Functions
supportsInterface
See {IERC165-supportsInterface}.
onlySelf
Reverts if caller is not the module itself.
onlyVoter
Reverts if caller is not a voter.
isValidVoterAddress
Reverts if voter address is invalid.
Parameters
voter
address
The address to check.
init
getReceipt
Gets the receipt of a voter for a motion.
Parameters
_ID
bytes32
The ID of the motion.
voter
address
The address of the voter.
Returns
<none>
Receipt
The receipt of the voter.
setThreshold
Sets the threshold.
Parameters
newThreshold
uint256
The new threshold.
setVotingDuration
Sets the voting duration.
Parameters
newVoteDuration
uint256
The new voting duration.
addVoter
Adds a voter.
Parameters
who
address
The address to add.
addVoterAndUpdateThreshold
Adds a voter and updates the threshold.
Parameters
who
address
The address to add.
newThreshold
uint256
The new threshold.
removeVoter
Removes a voter.
Parameters
who
address
The address to remove.
removeVoterAndUpdateThreshold
Removes a voter and updates the threshold.
Parameters
who
address
The address to remove.
newThreshold
uint256
The new threshold.
_removeVoter
Removes a voter from the list of voters.
Parameters
who
address
The address of the voter to remove.
createMotion
Creates a motion.
Parameters
target
address
The address of the contract to execute the action on.
action
bytes
The action data to execute on the target contract.
Returns
<none>
bytes32
The ID of the created motion.
castVote
Casts a vote for a motion.
Parameters
motionId
bytes32
The ID of the motion.
support
uint8
The value that indicates wether the voter supports the motion.
executeMotion
Executes a motion.
Parameters
motionId
bytes32
The ID of the motion.
_validateThreshold
Internal function to validate the threshold.
Parameters
_voters
uint256
The number of voters.
_threshold
uint256
The threshold.
Last updated