ThresholdGovernor
Inherits: IThresholdGovernor, BatchGovernor
Author: M^0 Labs
State Variables
_MIN_THRESHOLD_RATIO
The minimum allowed threshold ratio.
ONE
Returns the value used as 100%, to be used to correctly ascertain the threshold ratio.
thresholdRatio
Returns the threshold ratio to be applied to determine the success threshold for a proposal.
For all intents and purposes, this is the same as quorumNumerator
.
Functions
constructor
Construct a new ThresholdGovernor contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The name of the contract. Used to compute EIP712 domain separator. |
|
| The address of the token used to vote. |
|
| The ratio of yes votes votes required for a proposal to meet quorum and succeed. |
execute
Allows the caller to execute a proposal.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
|
Returns
Name | Type | Description |
---|---|---|
|
| proposalId The unique identifier for the proposal. |
propose
Allows the caller to create a proposal.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
|
Returns
Name | Type | Description |
---|---|---|
|
| proposalId The unique identifier for the proposal. |
COUNTING_MODE
module:voting
A description of the possible "support" values for castVote and the way these votes are counted, meant to be consumed by UIs to show correct vote options and interpret the results. The string is a URL-encoded sequence of key-value pairs that each describe one aspect, for example support=for,against&quorum=for
. The string can be decoded by the standard URLSearchParams JavaScript class.
getProposal
Returns all data of a proposal with identifier proposalId
.
Parameters
Name | Type | Description |
---|---|---|
|
|
Returns
Name | Type | Description |
---|---|---|
|
| voteStart The first clock value when voting on the proposal is allowed. |
|
| voteEnd The last clock value when voting on the proposal is allowed. |
|
| state The state of the proposal. |
|
| noVotes The amount of votes cast against the proposal. |
|
| yesVotes The amount of votes cast for the proposal. |
|
| proposer The address of the account that created the proposal. |
|
| quorum The threshold/quorum of yes votes required for the proposal to succeed. |
|
| quorumNumerator The threshold/quorum numerator used to calculate the quorum. |
proposalQuorum
Returns the quorum of yes votes needed for a specific proposal to succeed.
Parameters
Name | Type | Description |
---|---|---|
|
| The unique identifier for the proposal. |
Returns
Name | Type | Description |
---|---|---|
|
| The quorum of yes votes needed for the proposal to succeed. |
quorum
Returns the minimum number of eligible (COUNTING_MODE) votes for a proposal to succeed.
quorumNumerator
Returns the quorum numerator used to determine the quorum for a proposal.
For all intents and purposes, this is the same as thresholdRatio
.
quorumDenominator
Returns the quorum denominator used to determine the quorum for a proposal.
state
Returns the state of a proposal with identifier proposalId
.
Parameters
Name | Type | Description |
---|---|---|
|
|
Returns
Name | Type | Description |
---|---|---|
|
| The state of the proposal. |
_createProposal
Creates a new proposal with the given parameters.
Parameters
Name | Type | Description |
---|---|---|
|
| The unique identifier of the proposal. |
|
| The epoch at which the proposal will start collecting votes. |
_setThresholdRatio
Set the threshold ratio to be applied to determine the threshold/quorum for a proposal.
Parameters
Name | Type | Description |
---|---|---|
|
| The new threshold ratio. |
_getQuorum
Returns the quorum given a snapshot and quorum numerator.
Parameters
Name | Type | Description |
---|---|---|
|
| The epoch at which the proposal will start collecting votes. |
|
| The quorum numerator. |
Returns
Name | Type | Description |
---|---|---|
|
| The quorum of yes voted needed for a successful proposal. |
_votingDelay
Returns the number of clock values that must elapse before voting begins for a newly created proposal.
Returns
Name | Type | Description |
---|---|---|
|
| The voting delay. |
_votingPeriod
Returns the number of clock values between the vote start and vote end.
Returns
Name | Type | Description |
---|---|---|
|
| The voting period. |