1
1
// Copyright Immutable Pty Ltd 2018 - 2023
2
2
// SPDX-License-Identifier: Apache 2.0
3
- pragma solidity 0.8.19 ;
3
+ pragma solidity ^ 0.8.24 ;
4
4
5
5
// Access Control
6
6
7
- import {Role} from "../../../Role.sol " ;
7
+ import {Role} from "../../../../src/ Role.sol " ;
8
8
import {OwnableRoles} from "@solady/auth/OwnableRoles.sol " ;
9
9
10
10
// Interfaces
@@ -19,7 +19,7 @@ interface IProxy {
19
19
20
20
}
21
21
22
- interface IERC165 {
22
+ interface ERC165 {
23
23
24
24
function supportsInterface (bytes4 interfaceId ) external view returns (bool );
25
25
@@ -32,7 +32,7 @@ interface IERC165 {
32
32
OperatorAllowlist is not designed to be upgradeable or extended.
33
33
*/
34
34
35
- contract OperatorAllowlist is ERC165 , AccessControl , IOperatorAllowlist {
35
+ contract OperatorAllowlist is ERC165 , OwnableRoles , IOperatorAllowlist {
36
36
37
37
/// @notice Mapping of Allowlisted addresses
38
38
mapping (address aContract = > bool allowed ) private addressAllowlist;
@@ -54,11 +54,11 @@ contract OperatorAllowlist is ERC165, AccessControl, IOperatorAllowlist {
54
54
/// ===== Constructor =====
55
55
56
56
/**
57
- * @notice Grants `_MANAGER_ROLE` to the supplied `admin` address
58
- * @param admin the address to grant `_MANAGER_ROLE` to
57
+ * @notice Grants `Role. _MANAGER_ROLE` to the supplied `admin` address
58
+ * @param admin the address to grant `Role. _MANAGER_ROLE` to
59
59
*/
60
60
constructor (address admin ) {
61
- _grantRoles (admin, _MANAGER_ROLE);
61
+ _grantRoles (admin, Role. _MANAGER_ROLE);
62
62
}
63
63
64
64
/// ===== External functions =====
@@ -67,7 +67,7 @@ contract OperatorAllowlist is ERC165, AccessControl, IOperatorAllowlist {
67
67
* @notice Add a target address to Allowlist
68
68
* @param addressTargets the addresses to be added to the allowlist
69
69
*/
70
- function addAddressToAllowlist (address [] calldata addressTargets ) external onlyRoles (_REGISTRAR_ROLE) {
70
+ function addAddressToAllowlist (address [] calldata addressTargets ) external onlyRoles (Role. _REGISTRAR_ROLE) {
71
71
for (uint256 i; i < addressTargets.length ; i++ ) {
72
72
addressAllowlist[addressTargets[i]] = true ;
73
73
emit AddressAllowlistChanged (addressTargets[i], true );
@@ -78,7 +78,7 @@ contract OperatorAllowlist is ERC165, AccessControl, IOperatorAllowlist {
78
78
* @notice Remove a target address from Allowlist
79
79
* @param addressTargets the addresses to be removed from the allowlist
80
80
*/
81
- function removeAddressFromAllowlist (address [] calldata addressTargets ) external onlyRoles (_REGISTRAR_ROLE) {
81
+ function removeAddressFromAllowlist (address [] calldata addressTargets ) external onlyRoles (Role. _REGISTRAR_ROLE) {
82
82
for (uint256 i; i < addressTargets.length ; i++ ) {
83
83
delete addressAllowlist[addressTargets[i]];
84
84
emit AddressAllowlistChanged (addressTargets[i], false );
@@ -93,7 +93,7 @@ contract OperatorAllowlist is ERC165, AccessControl, IOperatorAllowlist {
93
93
* implementation address allowlist.
94
94
* @param walletAddr the wallet address to be added to the allowlist
95
95
*/
96
- function addWalletToAllowlist (address walletAddr ) external onlyRoles (_REGISTRAR_ROLE) {
96
+ function addWalletToAllowlist (address walletAddr ) external onlyRoles (Role. _REGISTRAR_ROLE) {
97
97
// get bytecode of wallet
98
98
bytes32 codeHash;
99
99
// solhint-disable-next-line no-inline-assembly
@@ -113,7 +113,7 @@ contract OperatorAllowlist is ERC165, AccessControl, IOperatorAllowlist {
113
113
* This will remove the proxy bytecode hash and implementation contract address pair from the allowlist
114
114
* @param walletAddr the wallet address to be removed from the allowlist
115
115
*/
116
- function removeWalletFromAllowlist (address walletAddr ) external onlyRoles (_REGISTRAR_ROLE) {
116
+ function removeWalletFromAllowlist (address walletAddr ) external onlyRoles (Role. _REGISTRAR_ROLE) {
117
117
// get bytecode of wallet
118
118
bytes32 codeHash;
119
119
// solhint-disable-next-line no-inline-assembly
@@ -129,19 +129,19 @@ contract OperatorAllowlist is ERC165, AccessControl, IOperatorAllowlist {
129
129
}
130
130
131
131
/**
132
- * @notice Allows admin to grant `user` `_REGISTRAR_ROLE` role
133
- * @param user the address that `_REGISTRAR_ROLE` will be granted to
132
+ * @notice Allows admin to grant `user` `Role. _REGISTRAR_ROLE` role
133
+ * @param user the address that `Role. _REGISTRAR_ROLE` will be granted to
134
134
*/
135
- function grantRegistrarRole (address user ) external onlyRoles (_MANAGER_ROLE) {
136
- grantRoles (user, _REGISTRAR_ROLE);
135
+ function grantRegistrarRole (address user ) external onlyRoles (Role. _MANAGER_ROLE) {
136
+ grantRoles (user, Role. _REGISTRAR_ROLE);
137
137
}
138
138
139
139
/**
140
- * @notice Allows admin to revoke `_REGISTRAR_ROLE` role from `user`
141
- * @param user the address that `_REGISTRAR_ROLE` will be revoked from
140
+ * @notice Allows admin to revoke `Role. _REGISTRAR_ROLE` role from `user`
141
+ * @param user the address that `Role. _REGISTRAR_ROLE` will be revoked from
142
142
*/
143
- function revokeRegistrarRole (address user ) external onlyRoles (_MANAGER_ROLE) {
144
- revokeRole (user, _REGISTRAR_ROLE);
143
+ function revokeRegistrarRole (address user ) external onlyRoles (Role. _MANAGER_ROLE) {
144
+ revokeRoles (user, Role. _REGISTRAR_ROLE);
145
145
}
146
146
147
147
/// ===== View functions =====
@@ -175,8 +175,8 @@ contract OperatorAllowlist is ERC165, AccessControl, IOperatorAllowlist {
175
175
* @notice ERC-165 interface support
176
176
* @param interfaceId The interface identifier, which is a 4-byte selector.
177
177
*/
178
- function supportsInterface (bytes4 interfaceId ) public view virtual override (ERC165 , AccessControl ) returns (bool ) {
179
- return interfaceId == type (IOperatorAllowlist).interfaceId || super . supportsInterface (interfaceId) ;
178
+ function supportsInterface (bytes4 interfaceId ) public view virtual override (ERC165 ) returns (bool ) {
179
+ return interfaceId == type (IOperatorAllowlist).interfaceId;
180
180
}
181
181
182
182
}
0 commit comments