ProposalGovernor
Inherits: ContextUpgradeable, MezzGovernor, MezzEIP712, NoncesUpgradeable, IProposalGovernor
Author: Daniel Yamagata
A base class that provides functionality for on-chain proposals and voting. This contract does not implement the execution of proposals
This contract is heavily inspired by OpenZeppelin's Governor contract.
State Variables
_BALLOT_TYPEHASH
_EXTENDED_BALLOT_TYPEHASH
SUPER_MAJORITY_PERCENTAGE
ProposalGovernorStorageLocation
Functions
_getProposalGovernorStorage
__ProposalGovernor_init
setQuorumPercentage
Sets a new quourm percentage
Only callable via governance itself
Parameters
setProposalThresholdPercentage
Sets a new proposal threshold percentage
Only callable via governance itself
Parameters
setVotingDelay
Sets a new voting delay
Only callable via governance itself
Parameters
setVotingPeriod
Sets a new voting period
Only callable via governance itself
Parameters
castVote
Casts the caller's votes towards the proposal associated with 'proposalId' There are three different vote types defined by the following enum:
0: Against
1: For
2: Abstain
A voter can only vote once and cannot revoke or change their vote. Votes are calculated from the proposal's snapshot and the counting of votes is bespoke and must be implemented by the inheritor
Parameters
Returns
castVoteWithReason
Casts the caller's votes with a 'reason' towards the proposal associated with 'proposalId'
The 'reason' is not stored on-chain but, rather, emitted in an event
Parameters
Returns
castVoteWithReasonAndParams
Casts the caller's votes with a 'reason' and 'params' towards the proposal associated with 'proposalId'
'params' are bespoke, abi-encoded arguments that could be used for casting a vote
Parameters
Returns
castVoteBySig
Casts the votes of 'voter' towards the proposal associated with 'proposalId' via an EIP-712 signature
Reference: https://eips.ethereum.org/EIPS/eip-712
Parameters
Returns
castVoteWithReasonAndParamsBySig
Casts the votes of 'voter' towards the proposal associated with 'proposalId' via an EIP-712 signature
Reference: https://eips.ethereum.org/EIPS/eip-712
'params' are bespoke, abi-encoded arguments that could be used for casting a vote
Parameters
Returns
_castVote
_castVote
Overridden by inheriting contracts. Inheritors should query votes and count them towards a proposal
state
Returns the state of a proposal associated with 'proposalId' as a ProposalState enum
hasVoted
Returns true if 'account' has voted on a proposal with 'proposalId', false otherwise
Returns
getReceipt
Returns the voting receipt of 'account' for the proposal with 'proposalId'
Returns
getProposalVotes
Returns the total votes for the proposal with 'proposalId'
Returns
votingDelay
Returns the voting delay in seconds
Returns
votingPeriod
Returns the voting period
Returns
quorumPercentage
Returns the quorum percentage
Returns
proposalThresholdPercentage
Returns the proposal threshold percentage
Returns
getBallotTransactionHash
Returns the ballot transaction hash, which is used in casting votes by signature
The returned transaction hash should be signed by the voter to create a valid signature Reference: https://eips.ethereum.org/EIPS/eip-712
getBallotStructHash
Return the ballot struct hash
Reference: https://eips.ethereum.org/EIPS/eip-712
getExtendedBallotTransactionHash
Returns the extended ballot transaction hash, which is used in casting votes with reasons and params by signature
The returned transaction hash should be signed by the voter to create a valid signature Reference: https://eips.ethereum.org/EIPS/eip-712
getExtendedBallotStructHash
Returns the extended ballot struct hash
Reference: https://eips.ethereum.org/EIPS/eip-712
coreId
Returns the coreId of the implementation as a bytes32
The core ID is the keccak256 hash of the contract name followed by a version under the following syntax: "mezzanine.coreId.ContractName.vX" For example, the core ID of the 2nd version of the Treasury would be the following: keccak256(abi.encodePacked("mezzanine.coreId.Treasury.v2"))
version
Returns the version of the implementation as a uint256
clock
EIP-6372 support
CLOCK_MODE
EIP-6372 support
_countVote
Counts a vote for a given proposal. Sets the receipt in storage Assumes that the weight has already been calculated
_voteSucceeded
Returns whether or not the vote succeeded for a given proposal
Returns
supportsInterface
EIP-165 support. Reference: https://eips.ethereum.org/EIPS/eip-165
Structs
ProposalGovernorStorage
Last updated