Skip to main content

ReEnabler

Git Source

Inherits: IReEnabler, EnablerV2

Title: ReEnabler

An abstract extension of EnablerV2 that adds a parameterless reEnable entry point intended for callers that should be able to return the contract to the enabled state without the calldata payload required by the standard enable.

The extension is intended to allow a caller distinct from the principal enabler, such as a manager that does not hold the admin role, to return the contract to the enabled state after a disable without supplying the calldata payload that the original enable would require. The extension is therefore only meaningful once the contract has been enabled at least once through the standard IEnabler.enable entry point.

Inheriting contracts must override _authorizeReEnable to revert when the caller is not permitted to perform the re-enable.

A successful re-enable updates lastTransitionAt to the current timestamp and emits both the legacy Enabled event and a Transition event with an empty data field, mirroring the behavior of enable aside from the absent payload.

Functions​

constructor​

constructor();

reEnable​

The "never been enabled" check uses lastTransitionAt, which is zero before the first successful enable. On success, the contract is moved to the enabled state, lastTransitionAt is updated to the current timestamp, and both the legacy Enabled event and a Transition event with an empty data field are emitted.

Reverts if:

  • The contract is currently enabled.
  • The contract has never been enabled (lastTransitionAt is zero).
  • _authorizeReEnable rejects the caller.
  • _beforeReEnable reverts.
function reEnable() public virtual override givenDisabled;

_authorizeReEnable​

Validates that the caller is permitted to re-enable the contract.

The function is invoked from reEnable after the state checks pass and before any state mutation.

Reverts if:

  • The caller is not authorized to perform the re-enable.
function _authorizeReEnable() internal view virtual;

_beforeReEnable​

Performs implementation-specific state changes that must run immediately before the contract is moved back to the enabled state.

The function is invoked from reEnable after _authorizeReEnable succeeds and before isEnabled is updated. Implementations that share state-restoration logic with _beforeEnable should factor the common path into a private helper invoked from both hooks, since reEnable does not forward a calldata payload. The default implementation is a no-op.

function _beforeReEnable() internal virtual;

supportsInterface​

The contract advertises support for IEnablerV2, the legacy IEnabler, and any interface advertised by the parent ERC165 implementation. Extension mixins are expected to override this function and add their own interface identifiers.

function supportsInterface(bytes4 interfaceId_) public view virtual override returns (bool);

Parameters

NameTypeDescription
interfaceId_bytes4

Returns

NameTypeDescription
<none>bool