IGovernorMiniBravo
Functions
QUORUM
Returns the needed quorum for a proposal to pass
function QUORUM() external view returns (uint256 _quorum);
Returns
Name | Type | Description |
---|---|---|
_quorum | uint256 | The needed quorum percentage |
votingPower
Returns the voting power of a particular user
function votingPower(address _user) external view returns (uint256 _balance);
Parameters
Name | Type | Description |
---|---|---|
_user | address | The user whose voting power will be returned |
Returns
Name | Type | Description |
---|---|---|
_balance | uint256 | The voting power of the user |
totalVotes
Returns the total available votes
function totalVotes() external view returns (uint256 _totalVotes);
Returns
Name | Type | Description |
---|---|---|
_totalVotes | uint256 | The total available votes |
isExecutable
Returns true if the latest proposal for the target method is executable
function isExecutable(uint256 _method) external view returns (bool _availableToExecute);
Parameters
Name | Type | Description |
---|---|---|
_method | uint256 | The method of the proposal |
Returns
Name | Type | Description |
---|---|---|
_availableToExecute | bool | True if the proposal is executable |
executionTimelock
Returns the tome lock to execute transactions
function executionTimelock() external view returns (uint256 _executionTimelock);
Returns
Name | Type | Description |
---|---|---|
_executionTimelock | uint256 | The time lock to execute transactions |
cancelVote
Cancels a vote by a user on a particular method
function cancelVote(uint256 _method) external;
Parameters
Name | Type | Description |
---|---|---|
_method | uint256 | The method to subtract the votes |
execute
Executes a particular proposal if it reaches quorum
function execute(uint256 _method, bytes memory _parameters) external;
Parameters
Name | Type | Description |
---|---|---|
_method | uint256 | The target method |
_parameters | bytes | The proposal parameters |
getLatest
Returns the latest proposal created for a method
function getLatest(uint256 _method) external view returns (Proposal memory _proposal);
Parameters
Name | Type | Description |
---|---|---|
_method | uint256 | The target method proposal |
Returns
Name | Type | Description |
---|---|---|
_proposal | Proposal | The latest proposal for the method |
cancelProposal
Cancels a proposal
Admin can only call
function cancelProposal(uint256 _method) external;
Parameters
Name | Type | Description |
---|---|---|
_method | uint256 | The method proposal to cancel |
queue
Queue a particular proposal if it reaches the required quorum
function queue(uint256 _method, bytes memory _parameters) external;
Parameters
Name | Type | Description |
---|---|---|
_method | uint256 | The method to be called when executed |
_parameters | bytes | The parameters for the proposal |
quorumReached
Returns true if proposal reached the required quorum
function quorumReached(uint256 _method) external view returns (bool _quorumReached);
Parameters
Name | Type | Description |
---|---|---|
_method | uint256 | The method to be called when executed |
Returns
Name | Type | Description |
---|---|---|
_quorumReached | bool | True if the proposal is executable |
Events
NewProposal
Emitted when a new proposal is created
event NewProposal(uint256 _id, uint256 _method, bytes _params);
NewVote
Emitted when a user votes on a proposal
event NewVote(address _voter, uint256 _votes, uint256 _method, uint256 _id);
ProposalCancelled
Emitted when a proposal is canceled
event ProposalCancelled(uint256 _id, uint256 _method, bytes _params);
ProposalExecuted
Emitted when a new proposal is executed
event ProposalExecuted(uint256 _id, uint256 _method, bytes _params);
VoteCancelled
Emitted when a voter cancels their vote
event VoteCancelled(address _voter, uint256 _method, uint256 _id);
ProposalQueued
Emitted when a proposal is queued
event ProposalQueued(uint256 _id, uint256 _method, bytes _params);
Errors
ProposalAlreadyQueued
Thrown when trying to queue a proposal that was already queued
error ProposalAlreadyQueued(uint256 _method, uint256 _id);
QuorumNotReached
Thrown when trying to queue a proposal that has not reached quorum
error QuorumNotReached(uint256 _method, uint256 _id);
ProposalNotExecutable
Thrown when trying to execute a proposal that is canceled or not on quorum
error ProposalNotExecutable(uint256 _method, uint256 _id);
ParametersMismatch
Thrown when parameters inputted do not match the saved parameters
error ParametersMismatch(uint256 _method, bytes _expectedParameters, bytes _actualParameters);
ProposalClosed
Thrown when the proposal is in a closed state
error ProposalClosed(uint256 _method, uint256 _id);
AlreadyVoted
Thrown when the voter already voted
error AlreadyVoted(uint256 _method, uint256 _id);
NoVotes
Thrown when a user tries to cancel their vote with 0 votes
error NoVotes();
Structs
Proposal
A proposal for a particular method call
struct Proposal {
uint256 id;
bytes params;
uint256 forVotes;
bool open;
uint256 timelockExpiry;
}