Skip to content

GovernedBase#

Abstract base class that defines behaviors for governed contracts.

This class is abstract so that specific behaviors can be defined for the constructor. Contracts should not be left ungoverned, but not all contract will have a constructor (for example those pre-defined in genesis).

Events#

GovernanceCallTimelocked#

Defined in GovernedBase (Docs, Source).

event GovernanceCallTimelocked(
    bytes4 selector,
    uint256 allowedAfterTimestamp,
    bytes encodedCall
)

Emitted when a new governance call has been recorded and is now waiting for the time lock to expire.

GovernanceInitialised#

Defined in GovernedBase (Docs, Source).

event GovernanceInitialised(
    address initialGovernance
)

Emitted when the governance address is initialized. This address will be used until production mode is entered (see GovernedProductionModeEntered). At that point the governance address is taken from GovernanceSettings.

GovernedProductionModeEntered#

Defined in GovernedBase (Docs, Source).

event GovernedProductionModeEntered(
    address governanceSettings
)

Emitted when governance is enabled and the governance address cannot be changed anymore (only through a network fork).

TimelockedGovernanceCallCanceled#

Defined in GovernedBase (Docs, Source).

event TimelockedGovernanceCallCanceled(
    bytes4 selector,
    uint256 timestamp
)

Emitted when a timelocked governance call is canceled before execution.

TimelockedGovernanceCallExecuted#

Defined in GovernedBase (Docs, Source).

event TimelockedGovernanceCallExecuted(
    bytes4 selector,
    uint256 timestamp
)

Emitted when a timelocked governance call is executed.

Functions#

cancelGovernanceCall#

Defined in GovernedBase (Docs, Source).

function cancelGovernanceCall(
    bytes4 _selector
) external;

Cancel a timelocked governance call before it has been executed.

Only governance can call this method.

Parameters Type Description
_selector bytes4 The method selector.

executeGovernanceCall#

Defined in GovernedBase (Docs, Source).

function executeGovernanceCall(
    bytes4 _selector
) external;

Execute the timelocked governance calls once the timelock period expires.

Only executor can call this method.

Parameters Type Description
_selector bytes4 The method selector (only one timelocked call per method is stored).

governance#

Defined in GovernedBase (Docs, Source).

function governance(
) public view returns (
    address);

Returns the current effective governance address.

switchToProductionMode#

Defined in GovernedBase (Docs, Source).

function switchToProductionMode(
) external;

Enter the production mode after all the initial governance settings have been set. This enables timelocks and the governance can be obtained afterward by calling governanceSettings.getGovernanceAddress(). Emits GovernedProductionModeEntered.

Modifiers#

onlyGovernance#

Defined in GovernedBase (Docs, Source).

modifier onlyGovernance()

onlyImmediateGovernance#

Defined in GovernedBase (Docs, Source).

modifier onlyImmediateGovernance()

Structures#

TimelockedCall#

Defined in GovernedBase (Docs, Source).

struct TimelockedCall {
  uint256 allowedAfterTimestamp;
  bytes encodedCall;
}

Variables#

governanceSettings#

Defined in GovernedBase (Docs, Source).

    contract IGovernanceSettings governanceSettings

Governance Settings.

productionMode#

Defined in GovernedBase (Docs, Source).

    bool productionMode

When true, governance is enabled and cannot be disabled. See switchToProductionMode.

timelockedCalls#

Defined in GovernedBase (Docs, Source).

    mapping(bytes4 => struct GovernedBase.TimelockedCall) timelockedCalls

List of pending timelocked governance calls.