LateStageGovernor
Inherits: ProposalGovernor, ModifiedGovernorUpgradeable, ILateStageGovernor
Author: Daniel Yamagata & Naveen Ailawadi
A governance contract that is based off of OpenZeppelin's Governor contract. This contract enables the voting of arbitrary on-chain actions, which are represented as proposals. Only 'for-votes' are counted towards the quorum
Many of these contract's functions run in O(n), where n is the number of shares that a treasury has. The maximum number of share classes that a Treasury can have is 15. This contract used a modified version of GovernorUpgradeable to allow access to the the Governor Upgradeable storage internally This is specifically used in propose() and state() to allow for the board of directors to propose and a proposal with a super majority to instantly be executable, respectively.
Functions
constructor
init
Intializes the Governor's state
Parameters
__LateStageGovernor_init
The 'params' argument is maintained in case future versions require additional initialization parameters
propose
Creates a new proposal. Vote starts after the delay specified by votingDelay()
Overridden propose function to add pausable modifier and enable the treasury to make proposals Reference: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/4d9d9073b84f56fe3eea360e5067c6ffd864c43d/contracts/governance/GovernorUpgradeable.sol#L277-L330
Parameters
Returns
cancel
Cancels a proposal. Only callable by the Proposer, the Mezz Hub Owner, or a 'Defender'
Parameters
Returns
execute
Executes a proposal that succeeded.
Parameters
Returns
state
Returns the state of a proposal associated with 'proposalId' as a ProposalState enum
quorum
Changed the following line such that if a super majority is reached before the voting period ends, the proposal is instantly executable. There's no need to check if _quorumReached() or _voteSucceeded(), since a super majority will always have more for-votes than a quorum, and a super majority will always more for-votes than against-votes, since it is a majority of the total votes.
The quorum is not a raw value: it is a percentage of the total votes across all share classes
Parameters
Returns
proposalThreshold
Returns the proposal threshold, which is the minimum number of votes that the sender must have for a proposal to be created
The proposal threshold is not a raw value: it is a percentage of the total votes across all share classes
Returns
superMajority
Returns the nominal value for a super majority at a 'timepoint', which is the number of for-votes needed to execute a proposal instantaneously during the voting period
proposalSnapshot
Returns a proposal's snapshot, which is the time at which votes are counted. Any votes accumulated past this point are not counted towards the proposal
The snapshot is set during the proposal's and is the sum of the voting delay and block.timestamp
Parameters
Returns
proposalDeadline
Returns a proposal's deadline, which is the time at which the proposal can no longer be voted on
The deadline is set during the proposal's creation and is the sum of the voting delay, voting period, and block.timestamp
Parameters
Returns
proposalProposer
Returns the proposer of a proposal
Returns
votingDelay
Returns the voting delay in seconds
Returns
votingPeriod
Returns the voting period
Returns
hasVoted
Returns true if 'account' has voted on a proposal with 'proposalId', false otherwise
Returns
clock
EIP-6372 support
CLOCK_MODE
EIP-6372 support
COUNTING_MODE
Returns a URL-encoded sequence of key-value pairs that each describe one aspect of voting
Mezzanine Proposal Governors use votes in line with Bravo. The quorum also only counts for votes, like in Bravo. Reference: https://docs.openzeppelin.com/contracts/4.x/api/governance#IGovernor-COUNTING_MODE--
Returns
name
Returns the name of the governor
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
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
OZ's GovernorUpgradeable vote casting is used directly here
_countVote
Counts a vote for a given proposal. Sets the receipt in storage. Assumes that weight has already been calculated
_getTotalVotesAtTimepoint
Queries all the shares and returns the summation of the total votes at the given timepoint
_getVotes
Queries all the shares and returns the summation of the votes for the account at the given timepoint
_superMajorityReached
Returns whether or not a super majority has been reached for a given proposal. Only for-votes are counted towards the super majority
Returns
_quorumReached
Returns whether or not the quourum has been reached for a given proposal. Only for-votes are counted towards the quorum
Returns
_voteSucceeded
Returns whether or not the vote succeeded for a given proposal
Returns
eip712Domain
EIP-5267 support. Reference: https://eips.ethereum.org/EIPS/eip-5267
supportsInterface
EIP-165 support. Reference: https://eips.ethereum.org/EIPS/eip-165
Last updated