Voting-Checkpoint-Modules
VotingCheckpoint (Transparent & PLCR voting module)
Introduced in: 3.0.0
Contract name: VotingCheckpoint
Type: Voting module
How it works
It is a voting module that used to create governance on a given agenda by the board of directors of the securityToken. It will allow investors to vote to elect one of the proposals of the agenda.
VotingCheckpoint
It is the common base class that is inherited by the Voting modules (aka WeightedVoteCheckpoint & PLCRVoteCheckpoint).
Key functionalities (as defined in the Smart Contract)
Initialization
No initialization needed for this module
Change default exempted voters list
This function is used to add/remove the address from the default exemption list. Default exemption list is the list of addresses that are not allowed to take participation in all given ballots of the voting module.
Change default exempted voters list (Multi)
It will allow adding multiple addresses to remove/add in once.
Get default exemption voter list
WeightedVoteCheckpoint
Introduced in: 3.0.0
Contract name: WeightedVoteCheckpoint
Type: Voting module
How it works
This module allows investors to vote corresponds to there token balance. A proposal will only win when it has total weight more than the given quorum of the ballot. Every investor can take participate in the voting besides who have zero token balance at a given checkpoint or present in the exemption list. Each ballot is created with a snapshot of balances of the token holders so it will allow investors to transact their tokens freely as well as it will not spoil the voting results with the double voting effect.
Key functionalities (as defined in the Smart Contract)
Initialization
No initialization needed for this module
Create Ballot
This function allows issuer or authorized a delegate to create a new ballot by giving no. of proposals in a ballot, how long the voting will run & what will be the desired quorum to chose a winning proposal.
Required Checks:-
_duration
should be greater than zero._noOfProposals
should be greater than 1. It means 0th proposal id is not entertained as the proposal to vote._proposedQuorum
should be less than100 * 10 ** 16
(100 % of the totalSupply) and should be more than 0.
Create a custom ballot
This function also allows issuer or authorized a delegate to create a ballot but with custom settings. An issuer can provide the desired start time, end time & the valid checkpoint as well.
Required Checks:-
_duration
should be greater than zero._noOfProposals
should be greater than 1. It means 0th proposal id is not entertained as the proposal to vote._proposedQuorum
should be less than100 * 10 ** 16
(100 % of the totalSupply) and should be more than 0._startTime
should be greater than or equal to now._endTime
should be greater than_startTime
.valid checkpoint Id.
Cast Vote
This function allows the investors to vote for a given ballotId by passing chosen proposalId of the ballot.
Required Checks:-
Should be a valid ballotId. It means given ballotId should be less than ballot array length.
Given ballot should be in the active state and current time respects the bound of start and end time of the ballot.
msg.sender
should have a balance greater than 0 at the ballotId checkpoint.msg.sender
should not be in the default or in the ballot exemption list.msg.sender
should not already vote for the given ballotId.Should be a valid proposal id.
Add/Remove address from the ballot exemption list
Similar to the default exemption list ballot has its own exemption list which will be used to restrict the addresses to vote for a particular ballot.
Change ballot status
It is used to switch on/off the given ballot. Can be called by the issuer or the authorised delegate.
Required checks:-
Not allowed to call this function when ballot is expired.
Only changeable state is allowed i.e
active = true
then_isActive
should befalse
or vice versa.
Getters
Get ballot results
This function is used to get the conclusion of the given ballotId after or during the ballot.
Get selected proposal
It returns the selected proposal by the given voter for a given ballotId.
Get the ballot details
It is used to get the ballot details.
Check whether is voter allowed or not
To check whether the voter is allowed to vote or not
PLCRVotingCheckpoint
Introduced in: 3.0.0
Contract name: PLCRVotingCheckpoint
Type: Voting module
How it works
Addition to the summarization of WeightedVoteCheckpoint
. It kept the vote of investor hidden until the commit
stage is over. This will lead to unaffected results of the voting.
Key functionalities (as defined in the Smart Contract)
Initialization
No initialization needed for this module.
Create a ballot
This function allows issuer or authorized a delegate to create a new ballot by giving no. of proposals in a ballot, how long the commit & reveal stage will run & what will be the desired quorum to chose a winning proposal.
Required Checks:-
_commitDuration
&_revealDuration
should be greater than zero._noOfProposals
should be greater than 1. It means 0th proposal id is not entertained as the proposal to vote._proposedQuorum
should be less than100 * 10 ** 16
(100 % of the totalSupply) and should be more than 0.
Create a custom ballot
This function also allows issuer or authorized a delegate to create a ballot but with custom settings. An issuer can provide the desired start time & the valid checkpoint as well.
Required Checks:-
_commitDuration
&_revealDuration
should be greater than zero._noOfProposals
should be greater than 1. It means 0th proposal id is not entertained as the proposal to vote._proposedQuorum
should be less than100 * 10 ** 16
(100 % of the totalSupply) and should be more than 0._startTime
should be greater than or equal tonow
.Should be a valid checkpointId.
Commit Vote
Used to vote secretly by an investor. The investor will pass the hashed version of its vote with the help of some unique salt.
Required checks:-
Valid ballot Id. Not more than or equal to the length of the ballots array.
msg.sender
should have a balance greater than 0 at the ballotId checkpoint.msg.sender
should not be in the default or in the ballot exemption list.msg.sender
should not already commit the vote for the given ballotId.Given ballot should be in the active state and current time respects the bound of the
commit
stage of the ballot._secretVote
should not be zero.
Reveal Vote
This function is used to reveal the vote. If the voter doesn’t call this function after the commit stage ends then voter votes don’t count in the tally.
Required checks:-
Given ballot should be in the active state and current time respects the bound of the
commit
stage of the ballot.msg.sender
did take participate during the commit stage.Valid proposal & ballot id.
msg.sender
should pass the correct salt and proposal id that will give the same secret hash that was passed during the commit stage.
Add/Remove address from the ballot exemption list
Similar to the default exemption list ballot has its own exemption list which will be used to restrict the addresses to vote for a particular ballot.
Change ballot status
It is used to switch on/off the given ballot. Can be called by the issuer or the authorized delegate.
Required checks:- 1. Not allowed to call this function when the ballot is expired. 2. Only changeable state is allowed i.e active = true
then _isActive
should be false
or vice versa.
Getters
Get ballot results
This function is used to get the conclusion of the given ballotId after or during the ballot.
Get selected proposal
It returns the selected proposal by the given voter for a given ballotId.
Get the ballot details
It is used to get the ballot details.
Get the commit & reveal duration of the ballot
Used to get the commit and reveal duration of the given ballot id.
Get the ballot stage
Used to get the current stage of the ballot.
Check whether is voter allowed or not
To check whether the voter is allowed to vote or not
Special considerations / notes
All batch expected to fail because of out of gas error. They will allow 70 - 80 investors in a single batch (approximately not tested).
Need to add the functionality where ballot exemption list trumps the default exemption list for better switching of investors within different ballots.
Last updated
Was this helpful?