11// SPDX-License-Identifier: BUSL-1.1
22pragma solidity ^ 0.8.27 ;
33
4- import {OwnableUpgradeable} from "@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol " ;
5- import {Initializable} from "@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol " ;
64import {IAllocationManager} from
75 "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol " ;
86import {IPermissionController} from
97 "eigenlayer-contracts/src/contracts/interfaces/IPermissionController.sol " ;
108import {IKeyRegistrar} from "eigenlayer-contracts/src/contracts/interfaces/IKeyRegistrar.sol " ;
11- import {AVSRegistrarWithSocket} from
12- "../../middlewareV2/registrar/presets/AVSRegistrarWithSocket.sol " ;
9+ import {OperatorSet} from "eigenlayer-contracts/src/contracts/libraries/OperatorSetLib.sol " ;
10+
11+ import {AVSRegistrar} from "../../middlewareV2/registrar/AVSRegistrar.sol " ;
12+ import {SocketRegistry} from "../../middlewareV2/registrar/modules/SocketRegistry.sol " ;
13+ import {Allowlist} from "../../middlewareV2/registrar/modules/Allowlist.sol " ;
1314import {ITaskAVSRegistrarBase} from "../../interfaces/ITaskAVSRegistrarBase.sol " ;
1415import {TaskAVSRegistrarBaseStorage} from "./TaskAVSRegistrarBaseStorage.sol " ;
1516
@@ -19,9 +20,9 @@ import {TaskAVSRegistrarBaseStorage} from "./TaskAVSRegistrarBaseStorage.sol";
1920 * @notice Abstract AVS Registrar for task-based AVSs
2021 */
2122abstract contract TaskAVSRegistrarBase is
22- Initializable ,
23- OwnableUpgradeable ,
24- AVSRegistrarWithSocket ,
23+ AVSRegistrar ,
24+ SocketRegistry ,
25+ Allowlist ,
2526 TaskAVSRegistrarBaseStorage
2627{
2728 /**
@@ -34,7 +35,7 @@ abstract contract TaskAVSRegistrarBase is
3435 IAllocationManager _allocationManager ,
3536 IKeyRegistrar _keyRegistrar ,
3637 IPermissionController _permissionController
37- ) AVSRegistrarWithSocket (_allocationManager, _keyRegistrar, _permissionController) {
38+ ) AVSRegistrar (_allocationManager, _keyRegistrar) SocketRegistry ( _permissionController) {
3839 _disableInitializers ();
3940 }
4041
@@ -49,9 +50,9 @@ abstract contract TaskAVSRegistrarBase is
4950 address _owner ,
5051 AvsConfig memory _initialConfig
5152 ) internal onlyInitializing {
53+ __Allowlist_init (_owner); // initializes Ownable
5254 __AVSRegistrar_init (_avs);
53- __Ownable_init ();
54- _transferOwnership (_owner);
55+
5556 _setAvsConfig (_initialConfig);
5657 }
5758
@@ -93,4 +94,48 @@ abstract contract TaskAVSRegistrarBase is
9394 avsConfig = config;
9495 emit AvsConfigSet (config.aggregatorOperatorSetId, config.executorOperatorSetIds);
9596 }
97+
98+ /**
99+ * @notice Before registering operator, check if the operator is in the allowlist for the aggregator operator set
100+ * @dev Only the aggregator operator set requires allowlist validation. Executor operator sets do not require allowlist checks.
101+ * @param operator The address of the operator
102+ * @param operatorSetIds The IDs of the operator sets
103+ * @param data The data passed to the operator
104+ */
105+ function _beforeRegisterOperator (
106+ address operator ,
107+ uint32 [] calldata operatorSetIds ,
108+ bytes calldata data
109+ ) internal override {
110+ super ._beforeRegisterOperator (operator, operatorSetIds, data);
111+
112+ for (uint32 i = 0 ; i < operatorSetIds.length ; i++ ) {
113+ if (operatorSetIds[i] == avsConfig.aggregatorOperatorSetId) {
114+ require (
115+ isOperatorAllowed (OperatorSet ({avs: avs, id: operatorSetIds[i]}), operator),
116+ OperatorNotInAllowlist ()
117+ );
118+ }
119+ }
120+ }
121+
122+ /**
123+ * @notice Set the socket for the operator
124+ * @dev This function sets the socket even if the operator is already registered
125+ * @dev Operators should make sure to always provide the socket when registering
126+ * @param operator The address of the operator
127+ * @param operatorSetIds The IDs of the operator sets
128+ * @param data The data passed to the operator
129+ */
130+ function _afterRegisterOperator (
131+ address operator ,
132+ uint32 [] calldata operatorSetIds ,
133+ bytes calldata data
134+ ) internal override {
135+ super ._afterRegisterOperator (operator, operatorSetIds, data);
136+
137+ // Set operator socket
138+ string memory socket = abi.decode (data, (string ));
139+ _setOperatorSocket (operator, socket);
140+ }
96141}
0 commit comments