CompoundVotingMachine
CompoundVotingMachine based on Compound's governance with a few differences.
The differences between CompoundVotingMachine and Compound's governance:
no timelock, once vote has passed it stays open for 'queuePeriod' (2 days by default), if vote decision has changed, execution will be delayed so at least 24 hours are left to vote;
execution modified to support DAOStack Avatar/Controller.
The contract based on GovernorAlpha.
Events
ProposalCreated
An event emitted when a new proposal is created.
id
The ID of the proposal.
proposer
The address of the proposer.
targets
The targets list of contracts to be executed on.
values
The list of native token value to be used in each contract call.
signatures
The list of functions signatures to execute on targets
.
calldatas
The list of parameters to pass to each function in signatures
.
startBlock
Starting block number of voting.
endBlock
Ending block number of voting.
description
Short description of the proposal.
ProposalSucceeded
An event emitted when using blockchain proposal bridge.
id
The ID of the proposal.
proposer
The address of the proposer.
targets
The targets list of contracts to be executed on.
values
The list of native token value to be used in each contract call.
signatures
The list of functions signatures to execute on targets
.
calldatas
The list of parameters to pass to each function in signatures
.
startBlock
Starting block number of voting.
endBlock
Ending block number of voting.
forBlockchain
The chain ID.
eta
An exact time of the proposal bridging.
forVotes
An amount of vote power "FOR".
againstVotes
An amount of vote power "AGAINST".
ProposalBridge
Emitted when proposal made for a different blockchain.
id
The ID of the proposal.
forBlockchain
The chain ID of the blockchain proposal made for.
VoteCast
An event emitted when a vote has been cast on a proposal.
voter
The voter address.
proposalId
The proposal ID for which the vote was cast.
support
Check whether the vote cast was "FOR" or "AGAINST".
votes
The amount of voting power for the vote cast.
ProposalCanceled
An event emitted when a proposal has been canceled.
id
The ID of the proposal.
ProposalQueued
An event emitted when a proposal has been queued.
id
The ID of the proposal.
eta
The timestamp of the queueing.
ProposalExecuted
An event emitted when a proposal has been executed.
id
The ID of the proposal.
ProposalExecutionResult
An event emitted when a proposal call has been executed.
id
The ID of the proposal.
index
The index of the target contract from proposal.
ok
The status of the proposal call.
result
The result of the proposal call.
GuardianSet
An event emitted when a new guardian set.
newGuardian
The new guardian address.
ParametersSet
An event emitted when a new voting parameters set.
params
The voting parameters.
Here's the per index description of each parameter.
0
The default voting period.
1
The default quorum percentage.
2
The proposal percentage.
3
The proposal max operations.
4
The delay in blocks before the newly created proposal would work.
5
The duration of time (in seconds) after proposal passed thershold before it can be executed.
6
The duration of time (in seconds) after proposal passed with absolute majority before it can be executed.
7
During the queue period if vote decision has changed, the queue period time duration is extended so that at least this amount of time in seconds is left.
8
The duration of time (in seconds) a succeeded proposal has to be executed on the blockchain.
propose
The function creates a proposal to be voted on.
targets
The address of the contracts on which proposal actions should be executed.
values
The amounts of native tokens that should be sent to the targets
addresses.
signatures
The function selectors (signatures) that should be called as proposals actions should a proposal succeed.
calldatas
The call arguments for the signatures
.
description
The short description of a proposal.
Returns: the ID of a newly created proposal.
Also here's an overloaded variant of the function with additional parameter forBlockchain
. The parameter is used to create a proposal in a specific sidechain.
execute
The function is to execute the proposal list of transactions.
proposalId
The ID of the proposal that should be executed.
Anyone can call this once it's ETA has arrived.
cancel
The function is to cancel a proposal. In case if a proposer are no longer hold the votes that were required to propose.
proposalId
The ID of the proposal that should be canceled.
state
The function is to get the current status of a proposal.
proposalId
The ID of the proposal that should be canceled.
The ProposalState
enum is:
Pending
The proposal is pending.
Active
The proposal is pending and voters can vote now.
ActiveTimelock
The proposal is pending and passed quorum, time lock of 2 days activated, still open for voting.
Canceled
The proposal is canceled.
Defeated
The voters voted against.
Succeded
The voters voted for.
Expired
The proposal time has passed. And it's no longer votable for.
Executed
The proposal transactions has been executed.
castVote
The function is to cast the users vote on a proposal.
proposalId
The ID of the proposal.
support
Is the vote "FOR" or "AGAINST".
getChainId
The function is to return the chain ID on which the contract was deployed.
emitSucceeded
The function allows anyone to emit details about proposal that passed. Can be used for cross-chain proposals using blockheader proofs.
proposalId
The ID of the proposal.
Last updated