11// SPDX-License-Identifier: BUSL-1.1
22pragma solidity ^ 0.8.27 ;
33
4+ import {Initializable} from "@openzeppelin-upgrades-v5/contracts/proxy/utils/Initializable.sol " ;
5+ import {ContextUpgradeable} from "@openzeppelin-upgrades-v5/contracts/utils/ContextUpgradeable.sol " ;
6+
47import {
58 IAllocationManager,
69 OperatorSet
710} from "eigenlayer-contracts/src/contracts/interfaces/IAllocationManager.sol " ;
811
912import {AVSRegistrar} from "./AVSRegistrar.sol " ;
1013import {ECDSARegistrarStorage} from "./ECDSARegistrarStorage.sol " ;
14+ import {IECDSARegistrar} from "./interfaces/IECDSARegistrar.sol " ;
1115
12- abstract contract ECDSARegistrar is ECDSARegistrarStorage , AVSRegistrar {
13-
14- constructor (address _allocationManager , address _avs ) AVSRegistrar (_allocationManager, _avs) {}
15-
16- /// @inheritdoc AVSRegistrar
17- function registerOperator (
18- address operator ,
19- address avs ,
20- uint32 [] calldata operatorSetIds ,
21- bytes calldata data
22- ) external virtual override onlyAllocationManager {
23- ECDSARegistrarStorageStruct storage $ = _getECDSARegistrarStorage ();
24- $._operatorMetadata[operator] = OperatorMetadata ({
25- signingKey: data.signingKey
26- });
16+ abstract contract ECDSARegistrar is AVSRegistrar , ECDSARegistrarStorage {
17+ function __ECDSARegistrar_init (uint256 startIndex , uint256 endIndex ) public initializer {
18+ __ECDSARegistrar_init_unchained (startIndex, endIndex);
19+ }
2720
28- _afterRegisterOperator (operator, avs, operatorSetIds, data);
21+ function __ECDSARegistrar_init_unchained (
22+ uint256 startIndex ,
23+ uint256 endIndex
24+ ) internal onlyInitializing {
25+ _getECDSARegistrarStorage ().startIndex = startIndex;
26+ _getECDSARegistrarStorage ().endIndex = endIndex;
2927 }
3028
29+ /**
30+ * @notice Overrides the afterRegisterOperator function to set the signing key for an operator
31+ * @param operator The operator to set the signing key for
32+ * @param data The data to set the signing key for
33+ */
3134 function _afterRegisterOperator (
3235 address operator ,
33- address avs ,
34- uint32 [] calldata operatorSetIds ,
3536 bytes calldata data
36- ) internal virtual {}
37+ ) internal virtual override {
38+ super ._afterRegisterOperator (operator, data);
39+
40+ address signingKey = abi.decode (_parseRegistrationData (data), (address ));
41+ _getECDSARegistrarStorage ()._operatorSigningKey[operator] = signingKey;
42+ }
3743
44+ /**
45+ * @notice Overrides the afterDeregisterOperator function to clear the signing key for an operator
46+ * @param operator The operator to clear the signing key for
47+ */
3848 function _afterDeregisterOperator (
39- address operator ,
40- address avs ,
41- uint32 [] calldata operatorSetIds
42- ) internal virtual {}
43- }
49+ address operator
50+ ) internal virtual override {
51+ super ._afterDeregisterOperator (operator);
52+
53+ _getECDSARegistrarStorage ()._operatorSigningKey[operator] = address (0 );
54+ }
55+
56+ /// @inheritdoc IECDSARegistrar
57+ function getSigningKey (
58+ address operator
59+ ) external view returns (address ) {
60+ return _getECDSARegistrarStorage ()._operatorSigningKey[operator];
61+ }
62+
63+ function _parseRegistrationData (
64+ bytes calldata data
65+ ) internal virtual view override returns (bytes memory ) {
66+ return data[_getECDSARegistrarStorage ().startIndex:_getECDSARegistrarStorage ().endIndex];
67+ }
68+ }
0 commit comments