Freezable

Git Source

Author: mortimr @ Kiln

The Freezable contract is used to add a freezing capability to admin related actions. The goal would be to ossify an implementation after a certain amount of time.

Unstructured Storage Friendly

State Variables

_FREEZE_TIMESTAMP_SLOT

This is the keccak-256 hash of "freezable.freeze_timestamp" subtracted by 1.

bytes32 private constant _FREEZE_TIMESTAMP_SLOT = 0x04b06dd5becaad633b58f99e01f1e05103eff5a573d10d18c9baf1bc4e6bfd3a;

Functions

onlyFreezer

Only callable by the freezer account.

modifier onlyFreezer();

notFrozen

Only callable when not frozen.

modifier notFrozen();

_getFreezer

Override and set it to return the address to consider as the freezer.

function _getFreezer() internal view virtual returns (address);

Returns

NameTypeDescription
<none>addressThe freezer address

_isFrozen

Retrieve the freeze status.

function _isFrozen() internal view returns (bool);

Returns

NameTypeDescription
<none>boolTrue if contract is frozen

_freezeTime

Retrieve the freeze timestamp.

function _freezeTime() internal view returns (uint256);

Returns

NameTypeDescription
<none>uint256The freeze timestamp

_setFreezeTime

Internal utility to set the freeze timestamp.

function _setFreezeTime(uint256 freezeTime) internal;

Parameters

NameTypeDescription
freezeTimeuint256The new freeze timestamp

_onlyFreezer

Internal utility to revert if caller is not freezer.

function _onlyFreezer() internal view;

_notFrozen

Internal utility to revert if contract is frozen.

function _notFrozen() internal view;

_freeze

Internal utility to start the freezing procedure.

function _freeze(uint256 freezeTimeout) internal;

Parameters

NameTypeDescription
freezeTimeoutuint256Timeout to add to current timestamp to define freeze timestamp

_cancelFreeze

Internal utility to cancel the freezing procedure.

function _cancelFreeze() internal;

Events

SetFreezeTime

Emitted when the freeze timeout is changed.

event SetFreezeTime(uint256 freezeTime);

Errors

Frozen

Thrown when a call happened while it was forbidden when frozen.

error Frozen();

FreezeTimeoutTooLow

Thrown when the provided timeout value is lower than 100 days.

error FreezeTimeoutTooLow(uint256 providedValue, uint256 minimumValue);