IGovernorMiniBravo

Git Source

Functions

QUORUM

Returns the needed quorum for a proposal to pass

function QUORUM() external view returns (uint256 _quorum);

Returns

NameTypeDescription
_quorumuint256The needed quorum percentage

votingPower

Returns the voting power of a particular user

function votingPower(address _user) external view returns (uint256 _balance);

Parameters

NameTypeDescription
_useraddressThe user whose voting power will be returned

Returns

NameTypeDescription
_balanceuint256The voting power of the user

totalVotes

Returns the total available votes

function totalVotes() external view returns (uint256 _totalVotes);

Returns

NameTypeDescription
_totalVotesuint256The 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

NameTypeDescription
_methoduint256The method of the proposal

Returns

NameTypeDescription
_availableToExecuteboolTrue if the proposal is executable

executionTimelock

Returns the tome lock to execute transactions

function executionTimelock() external view returns (uint256 _executionTimelock);

Returns

NameTypeDescription
_executionTimelockuint256The time lock to execute transactions

cancelVote

Cancels a vote by a user on a particular method

function cancelVote(uint256 _method) external;

Parameters

NameTypeDescription
_methoduint256The method to subtract the votes

execute

Executes a particular proposal if it reaches quorum

function execute(uint256 _method, bytes memory _parameters) external;

Parameters

NameTypeDescription
_methoduint256The target method
_parametersbytesThe proposal parameters

getLatest

Returns the latest proposal created for a method

function getLatest(uint256 _method) external view returns (Proposal memory _proposal);

Parameters

NameTypeDescription
_methoduint256The target method proposal

Returns

NameTypeDescription
_proposalProposalThe latest proposal for the method

cancelProposal

Cancels a proposal

Admin can only call

function cancelProposal(uint256 _method) external;

Parameters

NameTypeDescription
_methoduint256The method proposal to cancel

queue

Queue a particular proposal if it reaches the required quorum

function queue(uint256 _method, bytes memory _parameters) external;

Parameters

NameTypeDescription
_methoduint256The method to be called when executed
_parametersbytesThe parameters for the proposal

quorumReached

Returns true if proposal reached the required quorum

function quorumReached(uint256 _method) external view returns (bool _quorumReached);

Parameters

NameTypeDescription
_methoduint256The method to be called when executed

Returns

NameTypeDescription
_quorumReachedboolTrue 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;
}