StandardGovernor
Inherits: IStandardGovernor, BatchGovernor
Author: M^0 Labs
State Variables
emergencyGovernor
Returns the address of the Emergency Governor.
registrar
Returns the address of the Registrar.
vault
Returns the address of the Vault.
zeroGovernor
Returns the address of the Zero Governor.
zeroToken
Returns the address of the Zero Token.
maxTotalZeroRewardPerActiveEpoch
Returns the maximum amount of Zero Token that can be rewarded to all vote casters per active epoch.
cashToken
Returns the address of the Cash Token.
proposalFee
Returns the required amount of cashToken it costs an account to create a proposal.
_proposalFees
The proposal fee info per proposal ID.
numberOfProposalsAt
The amount of proposals per epoch.
numberOfProposalsVotedOnAt
The amount of proposals a voter has voted on per epoch.
Functions
onlyZeroGovernor
Revert if the caller is not the Zero Governor.
onlySelfOrEmergencyGovernor
Revert if the caller is not the Standard Governor nor the Emergency Governor.
constructor
Constructs a new StandardGovernor contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the Vote Token contract. |
|
| The address of the Emergency Governor contract. |
|
| The address of the Zero Governor contract. |
|
| The address of the Cash Token contract. |
|
| The address of the Registrar contract. |
|
| The address of the Vault contract. |
|
| The address of the Zero Token contract. |
|
| The proposal fee. |
|
| The maximum amount of zero tokens to reward per active epoch. |
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. |
setCashToken
Set the cash token and proposal fee to be used to create proposals going forward.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
|
sendProposalFeeToVault
Sends the proposal fee for proposal proposalId
to the vault, if it is Defeated or Expired.
Parameters
Name | Type | Description |
---|---|---|
|
|
addToList
One of the valid proposals. Adds account
to list
at the Registrar.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
|
removeFromList
One of the valid proposals. Removes account
to list
at the Registrar.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
|
removeFromAndAddToList
One of the valid proposals. Removes accountToRemove
and adds accountToAdd
to list
at the Registrar.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
| |
|
|
setKey
One of the valid proposals. Sets key
to value
at the Registrar.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
|
setProposalFee
One of the valid proposals. Sets the proposal fee of the Standard Governor.
Parameters
Name | Type | Description |
---|---|---|
|
|
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 the proposal details for 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 number of votes required to meet quorum. |
getProposalFee
Returns the proposal fee information.
Parameters
Name | Type | Description |
---|---|---|
|
|
Returns
Name | Type | Description |
---|---|---|
|
| cashToken The address of the cash token for this particular proposal fee. |
|
| amount The amount of cash token of the proposal fee. |
hasVotedOnAllProposals
Returns whether voter
has voted on all proposals in epoch
.
Parameters
Name | Type | Description |
---|---|---|
|
| |
|
|
Returns
Name | Type | Description |
---|---|---|
|
| Whether |
quorum
Returns the minimum number of eligible (COUNTING_MODE) votes for a proposal to succeed.
state
Returns the state of a proposal with identifier proposalId
.
Parameters
Name | Type | Description |
---|---|---|
|
|
Returns
Name | Type | Description |
---|---|---|
|
| The state of the proposal. |
_castVotes
Cast votes on several proposals for voter_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the voter. |
|
| The unique identifiers of the proposals. |
|
| The type of support to cast for each proposal. |
|
| The list of reason per proposal IDs to cast. |
Returns
Name | Type | Description |
---|---|---|
|
| The number of votes the voter cast on each proposal. |
_addToList
Adds account
to list
at the Registrar.
Parameters
Name | Type | Description |
---|---|---|
|
| The key for some list. |
|
| The address of some account to be added. |
_castVote
Cast weight_
votes on a proposal with id proposalId_
for voter_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the voter. |
|
| The number of votes the voter is casting. |
|
| The unique identifier of the proposal. |
|
| The type of support to cast for the proposal. |
|
| The reason for which the caller casts their vote, if any. |
_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. |
_removeFromList
Removes account_
from list_
at the Registrar.
Parameters
Name | Type | Description |
---|---|---|
|
| The key for some list. |
|
| The address of some account to be removed. |
_setCashToken
Set cash token to newCashToken_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the new cash token. |
_setProposalFee
Set proposal fee to newProposalFee_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The new proposal fee. |
_transfer
Transfer amount_
of token_
to to_
.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the token to transfer. |
|
| The address of the recipient. |
|
| The amount of tokens to transfer. |
_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. |
_revertIfInvalidCalldata
All proposals target this contract itself, and must call one of the listed functions to be valid.
Parameters
Name | Type | Description |
---|---|---|
|
| The call data to check. |
_votingPeriod
Returns the number of clock values between the vote start and vote end.
Returns
Name | Type | Description |
---|---|---|
|
| The voting period. |
Structs
ProposalFeeInfo
The proposal fee info.
Properties
Name | Type | Description |
---|---|---|
|
| The address of the cash token used to pay the fee. |
|
| The amount of the fee per proposal. |