GovernorVotesSuperQuorumFractionUpgradeable
Inherits: Initializable, GovernorVotesQuorumFractionUpgradeable, GovernorSuperQuorumUpgradeable
Extension of {GovernorVotesQuorumFraction} with a super quorum expressed as a
fraction of the total supply. Proposals that meet the super quorum (and have a majority of for votes) advance to
the Succeeded
state before the proposal deadline.
State Variables
GovernorVotesSuperQuorumFractionStorageLocation
bytes32 private constant GovernorVotesSuperQuorumFractionStorageLocation =
0x31eabc8444b313223279a7cb4d22bce9201d463789f695e0a51f91d19ec31000;
Functions
_getGovernorVotesSuperQuorumFractionStorage
function _getGovernorVotesSuperQuorumFractionStorage()
private
pure
returns (GovernorVotesSuperQuorumFractionStorage storage $);
__GovernorVotesSuperQuorumFraction_init
Initialize super quorum as a fraction of the token's total supply. The super quorum is specified as a fraction of the token's total supply and has to be greater than the quorum.
function __GovernorVotesSuperQuorumFraction_init(uint256 superQuorumNumeratorValue) internal onlyInitializing;
__GovernorVotesSuperQuorumFraction_init_unchained
function __GovernorVotesSuperQuorumFraction_init_unchained(uint256 superQuorumNumeratorValue)
internal
onlyInitializing;
superQuorumNumerator
Returns the current super quorum numerator.
function superQuorumNumerator() public view virtual returns (uint256);
superQuorumNumerator
Returns the super quorum numerator at a specific timepoint
.
function superQuorumNumerator(uint256 timepoint) public view virtual returns (uint256);
superQuorum
Returns the super quorum for a timepoint
, in terms of number of votes: supply * numerator / denominator
.
See GovernorSuperQuorum-superQuorum for more details.
function superQuorum(uint256 timepoint) public view virtual override returns (uint256);
updateSuperQuorumNumerator
*Changes the super quorum numerator. Emits a SuperQuorumNumeratorUpdated event. Requirements:
- Must be called through a governance proposal.
- New super quorum numerator must be smaller or equal to the denominator.
- New super quorum numerator must be greater than or equal to the quorum numerator.*
function updateSuperQuorumNumerator(uint256 newSuperQuorumNumerator) public virtual onlyGovernance;
_updateSuperQuorumNumerator
*Changes the super quorum numerator. Emits a SuperQuorumNumeratorUpdated event. Requirements:
- New super quorum numerator must be smaller or equal to the denominator.
- New super quorum numerator must be greater than or equal to the quorum numerator.*
function _updateSuperQuorumNumerator(uint256 newSuperQuorumNumerator) internal virtual;
_updateQuorumNumerator
Overrides GovernorVotesQuorumFraction-_updateQuorumNumerator to ensure the super quorum numerator is greater than or equal to the quorum numerator.
function _updateQuorumNumerator(uint256 newQuorumNumerator) internal virtual override;
state
Overridden version of the {Governor-state} function that checks if the proposal has reached the super quorum. NOTE: If the proposal reaches super quorum but {_voteSucceeded} returns false, eg, assuming the super quorum has been set low enough that both FOR and AGAINST votes have exceeded it and AGAINST votes exceed FOR votes, the proposal continues to be active until {_voteSucceeded} returns true or the proposal deadline is reached. This means that with a low super quorum it is also possible that a vote can succeed prematurely before enough AGAINST voters have a chance to vote. Hence, it is recommended to set a high enough super quorum to avoid these types of scenarios.
function state(uint256 proposalId)
public
view
virtual
override(GovernorUpgradeable, GovernorSuperQuorumUpgradeable)
returns (ProposalState);
Events
SuperQuorumNumeratorUpdated
event SuperQuorumNumeratorUpdated(uint256 oldSuperQuorumNumerator, uint256 newSuperQuorumNumerator);
Errors
GovernorInvalidSuperQuorumFraction
The super quorum set is not valid as it exceeds the quorum denominator.
error GovernorInvalidSuperQuorumFraction(uint256 superQuorumNumerator, uint256 denominator);
GovernorInvalidSuperQuorumTooSmall
The super quorum set is not valid as it is smaller or equal to the quorum.
error GovernorInvalidSuperQuorumTooSmall(uint256 superQuorumNumerator, uint256 quorumNumerator);
GovernorInvalidQuorumTooLarge
The quorum set is not valid as it exceeds the super quorum.
error GovernorInvalidQuorumTooLarge(uint256 quorumNumerator, uint256 superQuorumNumerator);
Structs
GovernorVotesSuperQuorumFractionStorage
Note: storage-location: erc7201:openzeppelin.storage.GovernorVotesSuperQuorumFraction
struct GovernorVotesSuperQuorumFractionStorage {
Checkpoints.Trace208 _superQuorumNumeratorHistory;
}