View Source: contracts/modules/Checkpoint/Voting/PLCR/PLCRVotingCheckpoint.sol
↗ Extends: PLCRVotingCheckpointStorage, VotingCheckpoint
PLCRVotingCheckpoint
Events
event VoteCommit(address indexed _voter, uint256 _weight, uint256 indexed _ballotId, bytes32 _secretVote);event VoteRevealed(address indexed _voter, uint256 _weight, uint256 indexed _ballotId, uint256 _choiceOfProposal, uint256 _salt, bytes32 _secretVote);event BallotCreated(uint256 indexed _ballotId, uint256 indexed _checkpointId, uint256 _startTime, uint256 _commitDuration, uint256 _revealDuration, uint256 _noOfProposals, uint256 _quorumPercentage);event BallotStatusChanged(uint256 indexed _ballotId, bool _newStatus);event ChangedBallotExemptedVotersList(uint256 indexed _ballotId, address indexed _voter, bool _exempt);
function (address _securityToken, address _polyAddress) public nonpayable Module
Arguments
Name | Type | Description |
_securityToken | address | |
_polyAddress | address | |
Use to create the ballot
function createBallot(uint256 _commitDuration, uint256 _revealDuration, uint256 _noOfProposals, uint256 _quorumPercentage) external nonpayable withPerm
Arguments
Name | Type | Description |
_commitDuration | uint256 | Unix time period till the voters commit there vote |
_revealDuration | uint256 | Unix time period till the voters reveal there vote starts when commit duration ends |
_noOfProposals | uint256 | Total number of proposal used in the ballot. In general it is 2 (For & Against) |
_quorumPercentage | uint256 | Minimum number of weight vote percentage requires to win a election. |
Use to create the ballot
function createCustomBallot(uint256 _commitDuration, uint256 _revealDuration, uint256 _noOfProposals, uint256 _quorumPercentage, uint256 _checkpointId, uint256 _startTime) external nonpayable withPerm
Arguments
Name | Type | Description |
_commitDuration | uint256 | Unix time period till the voters commit there vote |
_revealDuration | uint256 | Unix time period till the voters reveal there vote starts when commit duration ends |
_noOfProposals | uint256 | Total number of proposal used in the ballot. In general it is 2 (For & Against) |
_quorumPercentage | uint256 | Minimum number of weight vote percentage requires to win a election. |
_checkpointId | uint256 | Valid checkpoint Id |
_startTime | uint256 | startTime of the ballot |
function _createBallotWithCheckpoint(uint256 _commitDuration, uint256 _revealDuration, uint256 _noOfProposals, uint256 _quorumPercentage, uint256 _checkpointId, uint256 _startTime) internal nonpayable
Arguments
Name | Type | Description |
_commitDuration | uint256 | |
_revealDuration | uint256 | |
_noOfProposals | uint256 | |
_quorumPercentage | uint256 | |
_checkpointId | uint256 | |
_startTime | uint256 | |
Used to commit the vote
function commitVote(uint256 _ballotId, bytes32 _secretVote) external nonpayable
Arguments
Name | Type | Description |
_ballotId | uint256 | Given ballot Id |
_secretVote | bytes32 | It is secret hash value (hashed offchain) |
Used to reveal the vote
function revealVote(uint256 _ballotId, uint256 _choiceOfProposal, uint256 _salt) external nonpayable
Arguments
Name | Type | Description |
_ballotId | uint256 | Given ballot Id |
_choiceOfProposal | uint256 | Proposal chossed by the voter. It varies from (1 to totalProposals) |
_salt | uint256 | used salt for hashing (unique for each user) |
function changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) external nonpayable withPerm
Arguments
Name | Type | Description |
_ballotId | uint256 | Given ballot Id |
_voter | address | Address of the voter |
_exempt | bool | Whether it is exempted or not |
function changeBallotExemptedVotersListMulti(uint256 _ballotId, address[] _voters, bool[] _exempts) external nonpayable withPerm
Arguments
Name | Type | Description |
_ballotId | uint256 | Given ballot Id |
_voters | address[] | Address of the voter |
_exempts | bool[] | Whether it is exempted or not |
function _changeBallotExemptedVotersList(uint256 _ballotId, address _voter, bool _exempt) internal nonpayable
Arguments
Name | Type | Description |
_ballotId | uint256 | |
_voter | address | |
_exempt | bool | |
function isVoterAllowed(uint256 _ballotId, address _voter) public viewreturns(bool)
Returns
bool
Arguments
Name | Type | Description |
_ballotId | uint256 | The index of the target ballot |
_voter | address | Address of the voter |
⤾ overrides IVoting.changeBallotStatus
Allows the token issuer to set the active stats of a ballot
function changeBallotStatus(uint256 _ballotId, bool _isActive) external nonpayable withPerm
Arguments
Name | Type | Description |
_ballotId | uint256 | The index of the target ballot |
_isActive | bool | The bool value of the active stats of the ballot |
Used to get the current stage of the ballot
function getCurrentBallotStage(uint256 _ballotId) public viewreturns(enum PLCRVotingCheckpointStorage.Stage)
Arguments
Name | Type | Description |
_ballotId | uint256 | Given ballot Id |
⤾ overrides IVoting.getBallotResults
Queries the result of a given ballot
function getBallotResults(uint256 _ballotId) external viewreturns(voteWeighting uint256[], tieWith uint256[], winningProposal uint256, isVotingSucceed bool, totalVotes uint256)
Returns
uint256 voteWeighting
Arguments
Name | Type | Description |
_ballotId | uint256 | Id of the target ballot |
⤾ overrides IVoting.getSelectedProposal
Get the voted proposal
function getSelectedProposal(uint256 _ballotId, address _voter) external viewreturns(proposalId uint256)
Arguments
Name | Type | Description |
_ballotId | uint256 | Id of the ballot |
_voter | address | Address of the voter |
⤾ overrides IVoting.getBallotDetails
Get the details of the ballot
function getBallotDetails(uint256 _ballotId) external viewreturns(uint256, uint256, uint256, uint256, uint256, uint256, uint256, bool)
Returns
uint256 quorum
Arguments
Name | Type | Description |
_ballotId | uint256 | The index of the target ballot |
function getBallotCommitRevealDuration(uint256 _ballotId) external viewreturns(uint256, uint256)
Arguments
Name | Type | Description |
_ballotId | uint256 | Id of a ballot |
⤾ overrides IModule.getInitFunction
This function returns the signature of configure function
function getInitFunction() external purereturns(bytes4)
Arguments
Name | Type | Description |
⤾ overrides IModule.getPermissions
Return the permissions flag that are associated with CountTransferManager
function getPermissions() external viewreturns(bytes32[])
Arguments
Name | Type | Description |
function _isGreaterThanZero(uint256 _value) internal pure
Arguments
Name | Type | Description |
_value | uint256 | |
function _checkIndexOutOfBound(uint256 _ballotId) internal view
Arguments
Name | Type | Description |
_ballotId | uint256 | |
function _checkValidStage(uint256 _ballotId, enum PLCRVotingCheckpointStorage.Stage _stage) internal view
Arguments
Name | Type | Description |
_ballotId | uint256 | |
_stage | enum PLCRVotingCheckpointStorage.Stage | |