Governor

onlyIfTest() modifier

Reverts if not running in test mode.

onlyRoleHolder(uint256 roleId) modifier

Reverts unless the caller is a member of the specified roleId.

onlyRoleManager(uint256 roleId) modifier

Reverts unless the caller is a member of the manager role for the specified roleId.

onlyExclusive(uint256 roleId) modifier

Reverts unless the roleId represents an initialized, exclusive roleId.

onlyShared(uint256 roleId) modifier

Reverts unless the roleId represents an initialized, shared roleId.

onlyValidRole(uint256 roleId) modifier

Reverts if roleId is not initialized.

onlyInvalidRole(uint256 roleId) modifier

Reverts if roleId is initialized.

constructor(address _finderAddress, bool _isTest) public

Construct the Governor contract.

Parameters:

  • _finderAddress: keeps track of all contracts within the system based on their interfaceName.

  • _isTest: whether this contract is being constructed for the purpose of running automated tests.

propose(struct Governor.Transaction[] transactions) public

Proposes a new governance action. Can only be called by the holder of the Proposer role.

You can create the data portion of each transaction by doing the following:

const truffleContractInstance = await TruffleContract.deployed()
const data = truffleContractInstance.methods.methodToCall(arg1, arg2).encodeABI()

Note: this method must be public because of a solidity limitation that disallows structs arrays to be passed to external functions.

Parameters:

  • transactions: the list of transactions that are being proposed.

  • transactions: array of Transaction which can be voted on.

executeProposal(uint256 id, uint256 transactionIndex) external

Executes a proposed governance action that has been approved by voters.

This can be called by any address.

Parameters:

  • id: unique id for the executed proposal.

  • transactionIndex: unique transaction index for the executed proposal.

numProposals() → uint256 external

Gets the total number of proposals (includes executed and non-executed).

getProposal(uint256 id) → struct Governor.Proposal proposal external

Gets the proposal data for a particular id.

after a proposal is executed, its data will be zeroed out.

Parameters:

  • id: uniquely identify the identity of the proposal.

setCurrentTime(uint256 _time) external

Sets the current time.

Will revert if not running in test mode.

getCurrentTime() → uint256 public

Gets the current time. Will return the last time set in setCurrentTime if running in test mode. Otherwise, it will return the block timestamp.

holdsRole(uint256 roleId, address memberToCheck) → bool public

Whether memberToCheck is a member of roleId.

Reverts if roleId does not correspond to an initialized role.

resetMember(uint256 roleId, address newMember) public

Changes the exclusive role holder of roleId to newMember.

Reverts if the caller is not a member of the managing role for roleId or if roleId is not an initialized, exclusive role.

getMember(uint256 roleId) → address public

Gets the current holder of the exclusive role, roleId.

Reverts if roleId does not represent an initialized, exclusive role.

addMember(uint256 roleId, address newMember) public

Adds newMember to the shared role, roleId.

Reverts if roleId does not represent an initialized, shared role or if the caller is not a member of the managing role for roleId.

removeMember(uint256 roleId, address memberToRemove) public

Removes memberToRemove from the shared role, roleId.

Reverts if roleId does not represent an initialized, shared role or if the caller is not a member of the managing role for roleId.

_createSharedRole(uint256 roleId, uint256 managingRoleId, address[] initialMembers) internal

Internal method to initialize a shared role, roleId, which will be managed by managingRoleId. initialMembers will be immediately added to the role.

Should be called by derived contracts, usually at construction time. Will revert if the role is already initialized.

_createExclusiveRole(uint256 roleId, uint256 managingRoleId, address initialMember) internal

Internal method to initialize a exclusive role, roleId, which will be managed by managingRoleId. initialMembers will be immediately added to the role.

Should be called by derived contracts, usually at construction time. Will revert if the role is already initialized.

NewProposal(uint256 id, struct Governor.Transaction[] transactions) event

EVENTS

==== ProposalExecuted(uint256 id, uint256 transactionIndex) event

© UMA Project 2018-2019