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
voteToken_
address
The address of the Vote Token contract.
emergencyGovernor_
address
The address of the Emergency Governor contract.
zeroGovernor_
address
The address of the Zero Governor contract.
cashToken_
address
The address of the Cash Token contract.
registrar_
address
The address of the Registrar contract.
vault_
address
The address of the Vault contract.
zeroToken_
address
The address of the Zero Token contract.
proposalFee_
uint256
The proposal fee.
maxTotalZeroRewardPerActiveEpoch_
uint256
The maximum amount of zero tokens to reward per active epoch.
execute
Allows the caller to execute a proposal.
Parameters
targets_
address[]
values_
uint256[]
callDatas_
bytes[]
<none>
bytes32
Returns
proposalId_
uint256
proposalId The unique identifier for the proposal.
propose
Allows the caller to create a proposal.
Parameters
targets_
address[]
values_
uint256[]
callDatas_
bytes[]
description_
string
Returns
proposalId_
uint256
proposalId The unique identifier for the proposal.
setCashToken
Set the cash token and proposal fee to be used to create proposals going forward.
Parameters
newCashToken_
address
newProposalFee_
uint256
sendProposalFeeToVault
Sends the proposal fee for proposal proposalId
to the vault, if it is Defeated or Expired.
Parameters
proposalId_
uint256
addToList
One of the valid proposals. Adds account
to list
at the Registrar.
Parameters
list_
bytes32
account_
address
removeFromList
One of the valid proposals. Removes account
to list
at the Registrar.
Parameters
list_
bytes32
account_
address
removeFromAndAddToList
One of the valid proposals. Removes accountToRemove
and adds accountToAdd
to list
at the Registrar.
Parameters
list_
bytes32
accountToRemove_
address
accountToAdd_
address
setKey
One of the valid proposals. Sets key
to value
at the Registrar.
Parameters
key_
bytes32
value_
bytes32
setProposalFee
One of the valid proposals. Sets the proposal fee of the Standard Governor.
Parameters
newProposalFee_
uint256
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
proposalId_
uint256
Returns
voteStart_
uint48
voteStart The first clock value when voting on the proposal is allowed.
voteEnd_
uint48
voteEnd The last clock value when voting on the proposal is allowed.
state_
ProposalState
state The state of the proposal.
noVotes_
uint256
noVotes The amount of votes cast against the proposal.
yesVotes_
uint256
yesVotes The amount of votes cast for the proposal.
proposer_
address
proposer The address of the account that created the proposal.
quorum_
uint256
quorum The number of votes required to meet quorum.
getProposalFee
Returns the proposal fee information.
Parameters
proposalId_
uint256
Returns
cashToken_
address
cashToken The address of the cash token for this particular proposal fee.
fee_
uint256
amount The amount of cash token of the proposal fee.
hasVotedOnAllProposals
Returns whether voter
has voted on all proposals in epoch
.
Parameters
voter_
address
epoch_
uint256
Returns
<none>
bool
Whether voter
has voted on all proposals in epoch
.
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
proposalId_
uint256
Returns
<none>
ProposalState
The state of the proposal.
_castVotes
Cast votes on several proposals for voter_
.
Parameters
voter_
address
The address of the voter.
proposalIds_
uint256[]
The unique identifiers of the proposals.
supportList_
uint8[]
The type of support to cast for each proposal.
reasonList_
string[]
The list of reason per proposal IDs to cast.
Returns
weight_
uint256
The number of votes the voter cast on each proposal.
_addToList
Adds account
to list
at the Registrar.
Parameters
list_
bytes32
The key for some list.
account_
address
The address of some account to be added.
_castVote
Cast weight_
votes on a proposal with id proposalId_
for voter_
.
Parameters
voter_
address
The address of the voter.
weight_
uint256
The number of votes the voter is casting.
proposalId_
uint256
The unique identifier of the proposal.
support_
uint8
The type of support to cast for the proposal.
reason_
string
The reason for which the caller casts their vote, if any.
_createProposal
Creates a new proposal with the given parameters.
Parameters
proposalId_
uint256
The unique identifier of the proposal.
voteStart_
uint16
The epoch at which the proposal will start collecting votes.
_removeFromList
Removes account_
from list_
at the Registrar.
Parameters
list_
bytes32
The key for some list.
account_
address
The address of some account to be removed.
_setCashToken
Set cash token to newCashToken_
.
Parameters
newCashToken_
address
The address of the new cash token.
_setProposalFee
Set proposal fee to newProposalFee_
.
Parameters
newProposalFee_
uint256
The new proposal fee.
_transfer
Transfer amount_
of token_
to to_
.
Parameters
token_
address
The address of the token to transfer.
to_
address
The address of the recipient.
amount_
uint256
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
<none>
uint16
The voting delay.
_revertIfInvalidCalldata
All proposals target this contract itself, and must call one of the listed functions to be valid.
Parameters
callData_
bytes
The call data to check.
_votingPeriod
Returns the number of clock values between the vote start and vote end.
Returns
<none>
uint16
The voting period.
Structs
ProposalFeeInfo
The proposal fee info.
Properties
cashToken
address
The address of the cash token used to pay the fee.
fee
uint256
The amount of the fee per proposal.