-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathIActivationRegistry.sol
More file actions
83 lines (67 loc) · 3.62 KB
/
Copy pathIActivationRegistry.sol
File metadata and controls
83 lines (67 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.20 <0.9.0;
/// @title IActivationRegistry
/// @notice Singleton precompile that gates Base-native features behind an activation admin. Each feature
/// is identified by an opaque `bytes32` id and is either active or inactive.
interface IActivationRegistry {
/*//////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
/// @notice Caller is not the activation admin.
error Unauthorized(address caller);
/// @notice Feature is already activated.
error AlreadyActivated(bytes32 feature);
/// @notice Feature is not activated.
error FeatureNotActivated(bytes32 feature);
/// @notice The precompile was invoked via `DELEGATECALL` or `CALLCODE`.
error DelegateCallNotAllowed();
/// @notice A state-mutating entry point was invoked from a `STATICCALL` frame.
error StaticCallNotAllowed();
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
/// @notice Emitted when `feature` is activated.
event FeatureActivated(bytes32 indexed feature, address indexed caller);
/// @notice Emitted when `feature` is deactivated.
event FeatureDeactivated(bytes32 indexed feature, address indexed caller);
/*//////////////////////////////////////////////////////////////
ACTIVATION QUERIES
//////////////////////////////////////////////////////////////*/
/// @notice Whether `feature` is currently activated. Never reverts.
///
/// @param feature Feature to query.
///
/// @return Whether `feature` is activated.
function isActivated(bytes32 feature) external view returns (bool);
/// @notice Reverts with `FeatureNotActivated(feature)` if `feature` is not currently activated.
/// A pure assertion entry point so callers don't have to redefine the error.
///
/// @dev Reverts with `FeatureNotActivated` when `feature` is not activated.
///
/// @param feature Feature to assert is active.
function checkActivated(bytes32 feature) external view;
/// @notice The address authorized to call `activate` and `deactivate`.
/// @return Current activation admin.
function admin() external view returns (address);
/*//////////////////////////////////////////////////////////////
ACTIVATION CONTROL
//////////////////////////////////////////////////////////////*/
/// @notice Activates `feature`. Emits `FeatureActivated`.
///
/// @dev Reverts with `DelegateCallNotAllowed` when invoked via `DELEGATECALL` or `CALLCODE`.
/// @dev Reverts with `StaticCallNotAllowed` when invoked under `STATICCALL`.
/// @dev Reverts with `Unauthorized` when the caller is not the activation admin.
/// @dev Reverts with `AlreadyActivated` when `feature` is already activated.
///
/// @param feature Feature to activate.
function activate(bytes32 feature) external;
/// @notice Deactivates `feature`. Emits `FeatureDeactivated`.
///
/// @dev Reverts with `DelegateCallNotAllowed` when invoked via `DELEGATECALL` or `CALLCODE`.
/// @dev Reverts with `StaticCallNotAllowed` when invoked under `STATICCALL`.
/// @dev Reverts with `Unauthorized` when the caller is not the activation admin.
/// @dev Reverts with `AlreadyDeactivated` when `feature` is already deactivated.
///
/// @param feature Feature to deactivate.
function deactivate(bytes32 feature) external;
}