GovernorParameters

GovernorParameters

Abstract contract to handle governance parameters

Based on GovernorVotesQuorumFraction, but without being opinionated on what's the source of voting power, and extended to handle proposal thresholds too. See OpenZeppelin's GovernorVotesQuorumFraction, GovernorVotes and GovernorSettings for reference.

FRACTION_DENOMINATOR

uint256 FRACTION_DENOMINATOR

AVERAGE_BLOCK_TIME_IN_SECONDS

uint64 AVERAGE_BLOCK_TIME_IN_SECONDS

quorumNumerator

uint256 quorumNumerator

proposalThresholdNumerator

uint256 proposalThresholdNumerator

QuorumNumeratorUpdated

event QuorumNumeratorUpdated(uint256 oldQuorumNumerator, uint256 newQuorumNumerator)

ProposalThresholdNumeratorUpdated

event ProposalThresholdNumeratorUpdated(uint256 oldThresholdNumerator, uint256 newThresholdNumerator)

VotingDelaySet

event VotingDelaySet(uint256 oldVotingDelay, uint256 newVotingDelay)

VotingPeriodSet

event VotingPeriodSet(uint256 oldVotingPeriod, uint256 newVotingPeriod)

constructor

constructor(uint256 quorumNumeratorValue, uint256 proposalNumeratorValue, uint256 initialVotingDelay, uint256 initialVotingPeriod) internal

updateQuorumNumerator

function updateQuorumNumerator(uint256 newQuorumNumerator) external virtual

updateProposalThresholdNumerator

function updateProposalThresholdNumerator(uint256 newNumerator) external virtual

setVotingDelay

function setVotingDelay(uint256 newVotingDelay) external virtual

Update the voting delay. This operation can only be performed through a governance proposal. Emits a VotingDelaySet event.

setVotingPeriod

function setVotingPeriod(uint256 newVotingPeriod) external virtual

Update the voting period. This operation can only be performed through a governance proposal. Emits a VotingPeriodSet event.

quorum

function quorum(uint256 blockNumber) public view virtual returns (uint256)

Compute the required amount of voting power to reach quorum

Parameters

NameTypeDescription

blockNumber

uint256

The block number to get the quorum at

proposalThreshold

function proposalThreshold() public view virtual returns (uint256)

Compute the required amount of voting power to create a proposal at the last block height

This function is implemented to comply with Governor API but we we will actually use proposalThreshold(uint256 blockNumber), as in our DAOs the threshold amount changes according to supply.

proposalThreshold

function proposalThreshold(uint256 blockNumber) public view returns (uint256)

Compute the required amount of voting power to create a proposal

Parameters

NameTypeDescription

blockNumber

uint256

The block number to get the proposal threshold at

votingDelay

function votingDelay() public view virtual returns (uint256)

module:user-config

Delay, in number of block, between the proposal is created and the vote starts. This can be increassed to leave time for users to buy voting power, of delegate it, before the voting of a proposal starts.

votingPeriod

function votingPeriod() public view virtual returns (uint256)

module:user-config

Delay, in number of blocks, between the vote start and vote ends.

NOTE: The {votingDelay} can delay the start of the vote. This must be considered when setting the voting duration compared to the voting delay.

_updateQuorumNumerator

function _updateQuorumNumerator(uint256 newQuorumNumerator) internal virtual

_updateProposalThresholdNumerator

function _updateProposalThresholdNumerator(uint256 proposalNumerator) internal virtual

_setVotingDelay

function _setVotingDelay(uint256 newVotingDelay) internal virtual

_setVotingPeriod

function _setVotingPeriod(uint256 newVotingPeriod) internal virtual

_getPastTotalSupply

function _getPastTotalSupply(uint256 blockNumber) internal view virtual returns (uint256)

Compute the past total voting power at a particular block

Parameters

NameTypeDescription

blockNumber

uint256

The block number to get the vote power at

Last updated