1
1
// SPDX-License-Identifier: MIT
2
2
pragma solidity ^ 0.8.13 ;
3
3
4
- import {Initializable} from "openzeppelin-contracts-upgradeable/proxy/utils/Initializable.sol " ;
5
-
4
+ import {OperatorFiltererUpgradeable} from "./OperatorFiltererUpgradeable.sol " ;
6
5
import {IOperatorFilterRegistry} from "../IOperatorFilterRegistry.sol " ;
7
6
8
-
9
7
/**
10
8
* @title Upgradeable storage layout for UpdatableOperatorFiltererUpgradeable.
11
9
* @author qed.team, abarbatei, balajmarius
@@ -19,7 +17,8 @@ library UpdatableOperatorFiltererUpgradeableStorage {
19
17
}
20
18
21
19
/// @dev The EIP-1967 specific storage slot for the layout
22
- bytes32 internal constant STORAGE_SLOT = bytes32 (uint256 (keccak256 (bytes ("UpdatableOperatorFiltererUpgradeable.contracts.storage " ))) - 1 );
20
+ bytes32 internal constant STORAGE_SLOT =
21
+ bytes32 (uint256 (keccak256 (bytes ("UpdatableOperatorFiltererUpgradeable.contracts.storage " ))) - 1 );
23
22
24
23
/// @dev The layout of the storage.
25
24
function layout () internal pure returns (Layout storage l ) {
@@ -44,12 +43,9 @@ library UpdatableOperatorFiltererUpgradeableStorage {
44
43
* - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods.
45
44
* Use updateOperatorFilterRegistryAddress function to change registry address if needed
46
45
*/
47
- abstract contract UpdatableOperatorFiltererUpgradeable is Initializable {
48
-
46
+ abstract contract UpdatableOperatorFiltererUpgradeable is OperatorFiltererUpgradeable {
49
47
using UpdatableOperatorFiltererUpgradeableStorage for UpdatableOperatorFiltererUpgradeableStorage.Layout;
50
48
51
- /// @notice Emitted when an operator is not allowed.
52
- error OperatorNotAllowed (address operator );
53
49
/// @notice Emitted when someone other than the owner is trying to call an only owner function.
54
50
error OnlyOwner ();
55
51
@@ -64,11 +60,12 @@ abstract contract UpdatableOperatorFiltererUpgradeable is Initializable {
64
60
* imitating/copying blocked addresses and codehashes
65
61
* @param subscribe If to subscribe to the subscriptionOrRegistrantToCopy address or just copy entries from it
66
62
*/
67
- function __UpdatableOperatorFiltererUpgradeable_init (address _registry , address subscriptionOrRegistrantToCopy , bool subscribe )
68
- internal
69
- onlyInitializing
70
- {
71
- UpdatableOperatorFiltererUpgradeableStorage.layout ()._operatorFilterRegistry = _registry;
63
+ function __UpdatableOperatorFiltererUpgradeable_init (
64
+ address _registry ,
65
+ address subscriptionOrRegistrantToCopy ,
66
+ bool subscribe
67
+ ) internal onlyInitializing {
68
+ UpdatableOperatorFiltererUpgradeableStorage.layout ()._operatorFilterRegistry = _registry;
72
69
IOperatorFilterRegistry registry = IOperatorFilterRegistry (_registry);
73
70
// If an inheriting token contract is deployed to a network without the registry deployed, the modifier
74
71
// will not revert, but the contract will need to be registered with the registry once it is deployed in
@@ -86,27 +83,6 @@ abstract contract UpdatableOperatorFiltererUpgradeable is Initializable {
86
83
}
87
84
}
88
85
89
- /**
90
- * @dev A helper modifier to check if the operator is allowed.
91
- */
92
- modifier onlyAllowedOperator (address from ) virtual {
93
- // Allow spending tokens from addresses with balance
94
- // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred
95
- // from an EOA.
96
- if (from != msg .sender ) {
97
- _checkFilterOperator (msg .sender );
98
- }
99
- _;
100
- }
101
-
102
- /**
103
- * @dev A helper modifier to check if the operator approval is allowed.
104
- */
105
- modifier onlyAllowedOperatorApproval (address operator ) virtual {
106
- _checkFilterOperator (operator);
107
- _;
108
- }
109
-
110
86
/**
111
87
* @notice Update the address that the contract will make OperatorFilter checks against. When set to the zero
112
88
* address, checks will be bypassed. OnlyOwner.
@@ -136,8 +112,9 @@ abstract contract UpdatableOperatorFiltererUpgradeable is Initializable {
136
112
/**
137
113
* @dev A helper function to check if the operator is allowed
138
114
*/
139
- function _checkFilterOperator (address operator ) internal view virtual {
140
- IOperatorFilterRegistry registry = IOperatorFilterRegistry (UpdatableOperatorFiltererUpgradeableStorage.layout ()._operatorFilterRegistry);
115
+ function _checkFilterOperator (address operator ) internal view virtual override {
116
+ IOperatorFilterRegistry registry =
117
+ IOperatorFilterRegistry (UpdatableOperatorFiltererUpgradeableStorage.layout ()._operatorFilterRegistry);
141
118
// Check registry code length to facilitate testing in environments without a deployed registry.
142
119
if (address (registry) != address (0 ) && address (registry).code.length > 0 ) {
143
120
// under normal circumstances, this function will revert rather than return false, but inheriting or
0 commit comments