Governance

This document is better viewed at https://docs.openzeppelin.com/contracts/api/governance

This directory includes extensions and utilities for on-chain governance.

Timelock

TimelockControllerEnumerable

import "@openzeppelin/community-contracts/governance/TimelockControllerEnumerable.sol";

Extends the TimelockController to allow for enumerable operations

Functions
  • schedule(target, value, data, predecessor, salt, delay)

  • scheduleBatch(targets, values, payloads, predecessor, salt, delay)

  • cancel(id)

  • operations()

  • operations(start, end)

  • operationsCount()

  • operation(index)

  • operation(id)

  • operationsBatch()

  • operationsBatch(start, end)

  • operationsBatchCount()

  • operationBatch(index)

  • operationBatch(id)

TimelockController
  • receive()

  • supportsInterface(interfaceId)

  • isOperation(id)

  • isOperationPending(id)

  • isOperationReady(id)

  • isOperationDone(id)

  • getTimestamp(id)

  • getOperationState(id)

  • getMinDelay()

  • hashOperation(target, value, data, predecessor, salt)

  • hashOperationBatch(targets, values, payloads, predecessor, salt)

  • execute(target, value, payload, predecessor, salt)

  • executeBatch(targets, values, payloads, predecessor, salt)

  • _execute(target, value, data)

  • updateDelay(newDelay)

  • _encodeStateBitmap(operationState)

  • PROPOSER_ROLE()

  • EXECUTOR_ROLE()

  • CANCELLER_ROLE()

ERC1155Holder
  • onERC1155Received(, , , , )

  • onERC1155BatchReceived(, , , , )

ERC721Holder
  • onERC721Received(, , , )

AccessControl
  • hasRole(role, account)

  • _checkRole(role)

  • _checkRole(role, account)

  • getRoleAdmin(role)

  • grantRole(role, account)

  • revokeRole(role, account)

  • renounceRole(role, callerConfirmation)

  • _setRoleAdmin(role, adminRole)

  • _grantRole(role, account)

  • _revokeRole(role, account)

  • DEFAULT_ADMIN_ROLE()

Events
TimelockController
  • CallScheduled(id, index, target, value, data, predecessor, delay)

  • CallExecuted(id, index, target, value, data)

  • CallSalt(id, salt)

  • Cancelled(id)

  • MinDelayChange(oldDuration, newDuration)

IAccessControl
  • RoleAdminChanged(role, previousAdminRole, newAdminRole)

  • RoleGranted(role, account, sender)

  • RoleRevoked(role, account, sender)

Errors
  • OperationIndexNotFound(index)

  • OperationIdNotFound(id)

  • OperationBatchIndexNotFound(index)

  • OperationBatchIdNotFound(id)

  • InvalidIndexRange(start, end)

TimelockController
  • TimelockInvalidOperationLength(targets, payloads, values)

  • TimelockInsufficientDelay(delay, minDelay)

  • TimelockUnexpectedOperationState(operationId, expectedStates)

  • TimelockUnexecutedPredecessor(predecessorId)

  • TimelockUnauthorizedCaller(caller)

IAccessControl
  • AccessControlUnauthorizedAccount(account, neededRole)

  • AccessControlBadConfirmation()

schedule(address target, uint256 value, bytes data, bytes32 predecessor, bytes32 salt, uint256 delay) public

Schedule an operation containing a single transaction.

Emits {CallSalt} if salt is nonzero, and {CallScheduled}.

Requirements:

  • the caller must have the 'proposer' role.

scheduleBatch(address[] targets, uint256[] values, bytes[] payloads, bytes32 predecessor, bytes32 salt, uint256 delay) public

Schedule an operation containing a batch of transactions.

Emits {CallSalt} if salt is nonzero, and one {CallScheduled} event per transaction in the batch.

Requirements:

  • the caller must have the 'proposer' role.

cancel(bytes32 id) public

Cancel an operation.

Requirements:

  • the caller must have the 'canceller' role.

operations() → struct TimelockControllerEnumerable.Operation[] operations_ public

Return all scheduled operations WARNING: This is designed for view accessors queried without gas fees. Using it in state-changing functions may become uncallable if the list grows too large.

operations(uint256 start, uint256 end) → struct TimelockControllerEnumerable.Operation[] operations_ public

Return the operations in the given index range

operationsCount() → uint256 operationsCount_ public

Return the number of operations from the set

operation(uint256 index) → struct TimelockControllerEnumerable.Operation operation_ public

Return the operation at the given index

operation(bytes32 id) → struct TimelockControllerEnumerable.Operation operation_ public

Return the operation with the given id

operationsBatch() → struct TimelockControllerEnumerable.OperationBatch[] operationsBatch_ public

Return all scheduled operation batches WARNING: This is designed for view accessors queried without gas fees. Using it in state-changing functions may become uncallable if the list grows too large.

operationsBatch(uint256 start, uint256 end) → struct TimelockControllerEnumerable.OperationBatch[] operationsBatch_ public

Return the operationsBatch in the given index range

operationsBatchCount() → uint256 operationsBatchCount_ public

Return the number of operationsBatch from the set

operationBatch(uint256 index) → struct TimelockControllerEnumerable.OperationBatch operationBatch_ public

Return the operationsBatch at the given index

operationBatch(bytes32 id) → struct TimelockControllerEnumerable.OperationBatch operationBatch_ public

Return the operationsBatch with the given id

OperationIndexNotFound(uint256 index) error

The error when the operation index is not found

OperationIdNotFound(bytes32 id) error

The error when the operation id is not found

OperationBatchIndexNotFound(uint256 index) error

The error when the operation batch index is not found

OperationBatchIdNotFound(bytes32 id) error

The error when the operation batch id is not found

InvalidIndexRange(uint256 start, uint256 end) error

The error when the index range is invalid