creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "lib/eigenlayer-middleware/src/RegistryCoordinator.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.8.12;\n\nimport {IPauserRegistry} from \"eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol\";\nimport {ISignatureUtils} from \"eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol\";\nimport {ISocketUpdater} from \"./interfaces/ISocketUpdater.sol\";\nimport {IBLSApkRegistry} from \"./interfaces/IBLSApkRegistry.sol\";\nimport {IStakeRegistry} from \"./interfaces/IStakeRegistry.sol\";\nimport {IIndexRegistry} from \"./interfaces/IIndexRegistry.sol\";\nimport {IServiceManager} from \"./interfaces/IServiceManager.sol\";\nimport {IRegistryCoordinator} from \"./interfaces/IRegistryCoordinator.sol\";\n\nimport {EIP1271SignatureUtils} from \"eigenlayer-contracts/src/contracts/libraries/EIP1271SignatureUtils.sol\";\nimport {BitmapUtils} from \"./libraries/BitmapUtils.sol\";\nimport {BN254} from \"./libraries/BN254.sol\";\n\nimport {OwnableUpgradeable} from \"@openzeppelin-upgrades/contracts/access/OwnableUpgradeable.sol\";\nimport {Initializable} from \"@openzeppelin-upgrades/contracts/proxy/utils/Initializable.sol\";\nimport {EIP712} from \"@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol\";\n\nimport {Pausable} from \"eigenlayer-contracts/src/contracts/permissions/Pausable.sol\";\nimport {RegistryCoordinatorStorage} from \"./RegistryCoordinatorStorage.sol\";\n\n/**\n * @title A `RegistryCoordinator` that has three registries:\n *      1) a `StakeRegistry` that keeps track of operators' stakes\n *      2) a `BLSApkRegistry` that keeps track of operators' BLS public keys and aggregate BLS public keys for each quorum\n *      3) an `IndexRegistry` that keeps track of an ordered list of operators for each quorum\n * \n * @author Layr Labs, Inc.\n */\ncontract RegistryCoordinator is \n    EIP712, \n    Initializable, \n    Pausable,\n    OwnableUpgradeable,\n    RegistryCoordinatorStorage, \n    ISocketUpdater, \n    ISignatureUtils\n{\n    using BitmapUtils for *;\n    using BN254 for BN254.G1Point;\n\n    modifier onlyEjector {\n        require(msg.sender == ejector, \"RegistryCoordinator.onlyEjector: caller is not the ejector\");\n        _;\n    }\n\n    /// @dev Checks that `quorumNumber` corresponds to a quorum that has been created\n    /// via `initialize` or `createQuorum`\n    modifier quorumExists(uint8 quorumNumber) {\n        require(\n            quorumNumber < quorumCount, \n            \"RegistryCoordinator.quorumExists: quorum does not exist\"\n        );\n        _;\n    }\n\n    constructor(\n        IServiceManager _serviceManager,\n        IStakeRegistry _stakeRegistry,\n        IBLSApkRegistry _blsApkRegistry,\n        IIndexRegistry _indexRegistry\n    ) \n        RegistryCoordinatorStorage(_serviceManager, _stakeRegistry, _blsApkRegistry, _indexRegistry)\n        EIP712(\"AVSRegistryCoordinator\", \"v0.0.1\") \n    {\n        _disableInitializers();\n    }\n\n    /**\n     * @param _initialOwner will hold the owner role\n     * @param _churnApprover will hold the churnApprover role, which authorizes registering with churn\n     * @param _ejector will hold the ejector role, which can force-eject operators from quorums\n     * @param _pauserRegistry a registry of addresses that can pause the contract\n     * @param _initialPausedStatus pause status after calling initialize\n     * Config for initial quorums (see `createQuorum`):\n     * @param _operatorSetParams max operator count and operator churn parameters\n     * @param _minimumStakes minimum stake weight to allow an operator to register\n     * @param _strategyParams which Strategies/multipliers a quorum considers when calculating stake weight\n     */\n    function initialize(\n        address _initialOwner,\n        address _churnApprover,\n        address _ejector,\n        IPauserRegistry _pauserRegistry,\n        uint256 _initialPausedStatus,\n        OperatorSetParam[] memory _operatorSetParams,\n        uint96[] memory _minimumStakes,\n        IStakeRegistry.StrategyParams[][] memory _strategyParams\n    ) external initializer {\n        require(\n            _operatorSetParams.length == _minimumStakes.length && _minimumStakes.length == _strategyParams.length,\n            \"RegistryCoordinator.initialize: input length mismatch\"\n        );\n        \n        // Initialize roles\n        _transferOwnership(_initialOwner);\n        _initializePauser(_pauserRegistry, _initialPausedStatus);\n        _setChurnApprover(_churnApprover);\n        _setEjector(_ejector);\n\n        // Add registry contracts to the registries array\n        registries.push(address(stakeRegistry));\n        registries.push(address(blsApkRegistry));\n        registries.push(address(indexRegistry));\n\n        // Create quorums\n        for (uint256 i = 0; i < _operatorSetParams.length; i++) {\n            _createQuorum(_operatorSetParams[i], _minimumStakes[i], _strategyParams[i]);\n        }\n    }\n\n    /*******************************************************************************\n                            EXTERNAL FUNCTIONS \n    *******************************************************************************/\n\n    /**\n     * @notice Registers msg.sender as an operator for one or more quorums. If any quorum exceeds its maximum\n     * operator capacity after the operator is registered, this method will fail.\n     * @param quorumNumbers is an ordered byte array containing the quorum numbers being registered for\n     * @param socket is the socket of the operator (typically an IP address)\n     * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership\n     * @param operatorSignature is the signature of the operator used by the AVS to register the operator in the delegation manager\n     * @dev `params` is ignored if the caller has previously registered a public key\n     * @dev `operatorSignature` is ignored if the operator's status is already REGISTERED\n     */\n    function registerOperator(\n        bytes calldata quorumNumbers,\n        string calldata socket,\n        IBLSApkRegistry.PubkeyRegistrationParams calldata params,\n        SignatureWithSaltAndExpiry memory operatorSignature\n    ) external onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR) {\n        /**\n         * If the operator has NEVER registered a pubkey before, use `params` to register\n         * their pubkey in blsApkRegistry\n         *\n         * If the operator HAS registered a pubkey, `params` is ignored and the pubkey hash\n         * (operatorId) is fetched instead\n         */\n        bytes32 operatorId = _getOrCreateOperatorId(msg.sender, params);\n\n        // Register the operator in each of the registry contracts and update the operator's\n        // quorum bitmap and registration status\n        uint32[] memory numOperatorsPerQuorum = _registerOperator({\n            operator: msg.sender, \n            operatorId: operatorId,\n            quorumNumbers: quorumNumbers, \n            socket: socket,\n            operatorSignature: operatorSignature\n        }).numOperatorsPerQuorum;\n\n        // For each quorum, validate that the new operator count does not exceed the maximum\n        // (If it does, an operator needs to be replaced -- see `registerOperatorWithChurn`)\n        for (uint256 i = 0; i < quorumNumbers.length; i++) {\n            uint8 quorumNumber = uint8(quorumNumbers[i]);\n\n            require(\n                numOperatorsPerQuorum[i] <= _quorumParams[quorumNumber].maxOperatorCount,\n                \"RegistryCoordinator.registerOperator: operator count exceeds maximum\"\n            );\n        }\n    }\n\n    /**\n     * @notice Registers msg.sender as an operator for one or more quorums. If any quorum reaches its maximum operator\n     * capacity, `operatorKickParams` is used to replace an old operator with the new one.\n     * @param quorumNumbers is an ordered byte array containing the quorum numbers being registered for\n     * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership\n     * @param operatorKickParams used to determine which operator is removed to maintain quorum capacity as the\n     * operator registers for quorums\n     * @param churnApproverSignature is the signature of the churnApprover over the `operatorKickParams`\n     * @param operatorSignature is the signature of the operator used by the AVS to register the operator in the delegation manager\n     * @dev `params` is ignored if the caller has previously registered a public key\n     * @dev `operatorSignature` is ignored if the operator's status is already REGISTERED\n     */\n    function registerOperatorWithChurn(\n        bytes calldata quorumNumbers, \n        string calldata socket,\n        IBLSApkRegistry.PubkeyRegistrationParams calldata params,\n        OperatorKickParam[] calldata operatorKickParams,\n        SignatureWithSaltAndExpiry memory churnApproverSignature,\n        SignatureWithSaltAndExpiry memory operatorSignature\n    ) external onlyWhenNotPaused(PAUSED_REGISTER_OPERATOR) {\n        require(operatorKickParams.length == quorumNumbers.length, \"RegistryCoordinator.registerOperatorWithChurn: input length mismatch\");\n        \n        /**\n         * If the operator has NEVER registered a pubkey before, use `params` to register\n         * their pubkey in blsApkRegistry\n         *\n         * If the operator HAS registered a pubkey, `params` is ignored and the pubkey hash\n         * (operatorId) is fetched instead\n         */\n        bytes32 operatorId = _getOrCreateOperatorId(msg.sender, params);\n\n        // Verify the churn approver's signature for the registering operator and kick params\n        _verifyChurnApproverSignature({\n            registeringOperator: msg.sender,\n            registeringOperatorId: operatorId,\n            operatorKickParams: operatorKickParams,\n            churnApproverSignature: churnApproverSignature\n        });\n\n        // Register the operator in each of the registry contracts and update the operator's\n        // quorum bitmap and registration status\n        RegisterResults memory results = _registerOperator({\n            operator: msg.sender,\n            operatorId: operatorId,\n            quorumNumbers: quorumNumbers,\n            socket: socket,\n            operatorSignature: operatorSignature\n        });\n\n        // Check that each quorum's operator count is below the configured maximum. If the max\n        // is exceeded, use `operatorKickParams` to deregister an existing operator to make space\n        for (uint256 i = 0; i < quorumNumbers.length; i++) {\n            OperatorSetParam memory operatorSetParams = _quorumParams[uint8(quorumNumbers[i])];\n            \n            /**\n             * If the new operator count for any quorum exceeds the maximum, validate\n             * that churn can be performed, then deregister the specified operator\n             */\n            if (results.numOperatorsPerQuorum[i] > operatorSetParams.maxOperatorCount) {\n                _validateChurn({\n                    quorumNumber: uint8(quorumNumbers[i]),\n                    totalQuorumStake: results.totalStakes[i],\n                    newOperator: msg.sender,\n                    newOperatorStake: results.operatorStakes[i],\n                    kickParams: operatorKickParams[i],\n                    setParams: operatorSetParams\n                });\n\n                _deregisterOperator(operatorKickParams[i].operator, quorumNumbers[i:i+1]);\n            }\n        }\n    }\n\n    /**\n     * @notice Deregisters the caller from one or more quorums\n     * @param quorumNumbers is an ordered byte array containing the quorum numbers being deregistered from\n     */\n    function deregisterOperator(\n        bytes calldata quorumNumbers\n    ) external onlyWhenNotPaused(PAUSED_DEREGISTER_OPERATOR) {\n        _deregisterOperator({\n            operator: msg.sender, \n            quorumNumbers: quorumNumbers\n        });\n    }\n\n    /**\n     * @notice Updates the StakeRegistry's view of one or more operators' stakes. If any operator\n     * is found to be below the minimum stake for the quorum, they are deregistered.\n     * @dev stakes are queried from the Eigenlayer core DelegationManager contract\n     * @param operators a list of operator addresses to update\n     */\n    function updateOperators(address[] calldata operators) external onlyWhenNotPaused(PAUSED_UPDATE_OPERATOR) {\n        for (uint256 i = 0; i < operators.length; i++) {\n            address operator = operators[i];\n            OperatorInfo memory operatorInfo = _operatorInfo[operator];\n            bytes32 operatorId = operatorInfo.operatorId;\n\n            // Update the operator's stake for their active quorums\n            uint192 currentBitmap = _currentOperatorBitmap(operatorId);\n            bytes memory quorumsToUpdate = BitmapUtils.bitmapToBytesArray(currentBitmap);\n            _updateOperator(operator, operatorInfo, quorumsToUpdate);\n        }\n    }\n\n    /**\n     * @notice For each quorum in `quorumNumbers`, updates the StakeRegistry's view of ALL its registered operators' stakes.\n     * Each quorum's `quorumUpdateBlockNumber` is also updated, which tracks the most recent block number when ALL registered\n     * operators were updated.\n     * @dev stakes are queried from the Eigenlayer core DelegationManager contract\n     * @param operatorsPerQuorum for each quorum in `quorumNumbers`, this has a corresponding list of operators to update.\n     * @dev Each list of operator addresses MUST be sorted in ascending order\n     * @dev Each list of operator addresses MUST represent the entire list of registered operators for the corresponding quorum\n     * @param quorumNumbers is an ordered byte array containing the quorum numbers being updated\n     * @dev invariant: Each list of `operatorsPerQuorum` MUST be a sorted version of `IndexRegistry.getOperatorListAtBlockNumber`\n     * for the corresponding quorum.\n     * @dev note on race condition: if an operator registers/deregisters for any quorum in `quorumNumbers` after a txn to \n     * this method is broadcast (but before it is executed), the method will fail\n     */\n    function updateOperatorsForQuorum(\n        address[][] calldata operatorsPerQuorum,\n        bytes calldata quorumNumbers\n    ) external onlyWhenNotPaused(PAUSED_UPDATE_OPERATOR) {\n        // Input validation \n        // - all quorums should exist (checked against `quorumCount` in orderedBytesArrayToBitmap)\n        // - there should be no duplicates in `quorumNumbers`\n        // - there should be one list of operators per quorum\n        uint192 quorumBitmap = uint192(BitmapUtils.orderedBytesArrayToBitmap(quorumNumbers, quorumCount));\n        require(\n            operatorsPerQuorum.length == quorumNumbers.length,\n            \"RegistryCoordinator.updateOperatorsForQuorum: input length mismatch\"\n        );\n\n        // For each quorum, update ALL registered operators\n        for (uint256 i = 0; i < quorumNumbers.length; ++i) {\n            uint8 quorumNumber = uint8(quorumNumbers[i]);\n\n            // Ensure we've passed in the correct number of operators for this quorum\n            address[] calldata currQuorumOperators = operatorsPerQuorum[i];\n            require(\n                currQuorumOperators.length == indexRegistry.totalOperatorsForQuorum(quorumNumber),\n                \"RegistryCoordinator.updateOperatorsForQuorum: number of updated operators does not match quorum total\"\n            );\n\n            address prevOperatorAddress = address(0);\n            // For each operator:\n            // - check that they are registered for this quorum\n            // - check that their address is strictly greater than the last operator\n            // ... then, update their stakes\n            for (uint256 j = 0; j < currQuorumOperators.length; ++j) {\n                address operator = currQuorumOperators[j];\n                \n                OperatorInfo memory operatorInfo = _operatorInfo[operator];\n                bytes32 operatorId = operatorInfo.operatorId;\n                \n                {\n                    uint192 currentBitmap = _currentOperatorBitmap(operatorId);\n                    // Check that the operator is registered\n                    require(\n                        BitmapUtils.isSet(currentBitmap, quorumNumber),\n                        \"RegistryCoordinator.updateOperatorsForQuorum: operator not in quorum\"\n                    );\n                    // Prevent duplicate operators\n                    require(\n                        operator > prevOperatorAddress,\n                        \"RegistryCoordinator.updateOperatorsForQuorum: operators array must be sorted in ascending address order\"\n                    );\n                }\n                \n                // Update the operator\n                _updateOperator(operator, operatorInfo, quorumNumbers[i:i+1]);\n                prevOperatorAddress = operator;\n            }\n\n            // Update timestamp that all operators in quorum have been updated all at once\n            quorumUpdateBlockNumber[quorumNumber] = block.number;\n            emit QuorumBlockNumberUpdated(quorumNumber, block.number);\n        }\n    }\n\n    /**\n     * @notice Updates the socket of the msg.sender given they are a registered operator\n     * @param socket is the new socket of the operator\n     */\n    function updateSocket(string memory socket) external {\n        require(_operatorInfo[msg.sender].status == OperatorStatus.REGISTERED, \"RegistryCoordinator.updateSocket: operator is not registered\");\n        emit OperatorSocketUpdate(_operatorInfo[msg.sender].operatorId, socket);\n    }\n\n    /*******************************************************************************\n                            EXTERNAL FUNCTIONS - EJECTOR\n    *******************************************************************************/\n\n    /**\n     * @notice Forcibly deregisters an operator from one or more quorums\n     * @param operator the operator to eject\n     * @param quorumNumbers the quorum numbers to eject the operator from\n     */\n    function ejectOperator(\n        address operator, \n        bytes calldata quorumNumbers\n    ) external onlyEjector {\n        _deregisterOperator({\n            operator: operator, \n            quorumNumbers: quorumNumbers\n        });\n    }\n\n    /*******************************************************************************\n                            EXTERNAL FUNCTIONS - OWNER\n    *******************************************************************************/\n\n    /**\n     * @notice Creates a quorum and initializes it in each registry contract\n     * @param operatorSetParams configures the quorum's max operator count and churn parameters\n     * @param minimumStake sets the minimum stake required for an operator to register or remain\n     * registered\n     * @param strategyParams a list of strategies and multipliers used by the StakeRegistry to\n     * calculate an operator's stake weight for the quorum\n     */\n    function createQuorum(\n        OperatorSetParam memory operatorSetParams,\n        uint96 minimumStake,\n        IStakeRegistry.StrategyParams[] memory strategyParams\n    ) external virtual onlyOwner {\n        _createQuorum(operatorSetParams, minimumStake, strategyParams);\n    }\n\n    /**\n     * @notice Updates an existing quorum's configuration with a new max operator count\n     * and operator churn parameters\n     * @param quorumNumber the quorum number to update\n     * @param operatorSetParams the new config\n     * @dev only callable by the owner\n     */\n    function setOperatorSetParams(\n        uint8 quorumNumber, \n        OperatorSetParam memory operatorSetParams\n    ) external onlyOwner quorumExists(quorumNumber) {\n        _setOperatorSetParams(quorumNumber, operatorSetParams);\n    }\n\n    /**\n     * @notice Sets the churnApprover, which approves operator registration with churn\n     * (see `registerOperatorWithChurn`)\n     * @param _churnApprover the new churn approver\n     * @dev only callable by the owner\n     */\n    function setChurnApprover(address _churnApprover) external onlyOwner {\n        _setChurnApprover(_churnApprover);\n    }\n\n    /**\n     * @notice Sets the ejector, which can force-deregister operators from quorums\n     * @param _ejector the new ejector\n     * @dev only callable by the owner\n     */\n    function setEjector(address _ejector) external onlyOwner {\n        _setEjector(_ejector);\n    }\n\n    /*******************************************************************************\n                            INTERNAL FUNCTIONS\n    *******************************************************************************/\n\n    struct RegisterResults {\n        uint32[] numOperatorsPerQuorum;\n        uint96[] operatorStakes;\n        uint96[] totalStakes;\n    }\n\n    /** \n     * @notice Register the operator for one or more quorums. This method updates the\n     * operator's quorum bitmap, socket, and status, then registers them with each registry.\n     */\n    function _registerOperator(\n        address operator, \n        bytes32 operatorId,\n        bytes calldata quorumNumbers,\n        string memory socket,\n        SignatureWithSaltAndExpiry memory operatorSignature\n    ) internal virtual returns (RegisterResults memory results) {\n        /**\n         * Get bitmap of quorums to register for and operator's current bitmap. Validate that:\n         * - we're trying to register for at least 1 quorum\n         * - the quorums we're registering for exist (checked against `quorumCount` in orderedBytesArrayToBitmap)\n         * - the operator is not currently registered for any quorums we're registering for\n         * Then, calculate the operator's new bitmap after registration\n         */\n        uint192 quorumsToAdd = uint192(BitmapUtils.orderedBytesArrayToBitmap(quorumNumbers, quorumCount));\n        uint192 currentBitmap = _currentOperatorBitmap(operatorId);\n        require(!quorumsToAdd.isEmpty(), \"RegistryCoordinator._registerOperator: bitmap cannot be 0\");\n        require(quorumsToAdd.noBitsInCommon(currentBitmap), \"RegistryCoordinator._registerOperator: operator already registered for some quorums being registered for\");\n        uint192 newBitmap = uint192(currentBitmap.plus(quorumsToAdd));\n\n        /**\n         * Update operator's bitmap, socket, and status. Only update operatorInfo if needed:\n         * if we're `REGISTERED`, the operatorId and status are already correct.\n         */\n        _updateOperatorBitmap({\n            operatorId: operatorId,\n            newBitmap: newBitmap\n        });\n\n        emit OperatorSocketUpdate(operatorId, socket);\n\n        // If the operator wasn't registered for any quorums, update their status\n        // and register them with this AVS in EigenLayer core (DelegationManager)\n        if (_operatorInfo[operator].status != OperatorStatus.REGISTERED) {\n            _operatorInfo[operator] = OperatorInfo({\n                operatorId: operatorId,\n                status: OperatorStatus.REGISTERED\n            });\n\n            // Register the operator with the EigenLayer core contracts via this AVS's ServiceManager\n            serviceManager.registerOperatorToAVS(operator, operatorSignature);\n\n            emit OperatorRegistered(operator, operatorId);\n        }\n\n        // Register the operator with the BLSApkRegistry, StakeRegistry, and IndexRegistry\n        blsApkRegistry.registerOperator(operator, quorumNumbers);\n        (results.operatorStakes, results.totalStakes) = \n            stakeRegistry.registerOperator(operator, operatorId, quorumNumbers);\n        results.numOperatorsPerQuorum = indexRegistry.registerOperator(operatorId, quorumNumbers);\n\n        return results;\n    }\n\n    /**\n     * @notice Fetches an operator's pubkey hash from the BLSApkRegistry. If the\n     * operator has not registered a pubkey, attempts to register a pubkey using\n     * `params`\n     * @param operator the operator whose pubkey to query from the BLSApkRegistry\n     * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership\n     * @dev `params` can be empty if the operator has already registered a pubkey in the BLSApkRegistry\n     */\n    function _getOrCreateOperatorId(\n        address operator,\n        IBLSApkRegistry.PubkeyRegistrationParams calldata params\n    ) internal returns (bytes32 operatorId) {\n        operatorId = blsApkRegistry.getOperatorId(operator);\n        if (operatorId == 0) {\n            operatorId = blsApkRegistry.registerBLSPublicKey(operator, params, pubkeyRegistrationMessageHash(operator));\n        }\n        return operatorId;\n    }\n\n    /**\n     * @notice Validates that an incoming operator is eligible to replace an existing\n     * operator based on the stake of both\n     * @dev In order to churn, the incoming operator needs to have more stake than the\n     * existing operator by a proportion given by `kickBIPsOfOperatorStake`\n     * @dev In order to be churned out, the existing operator needs to have a proportion\n     * of the total quorum stake less than `kickBIPsOfTotalStake`\n     * @param quorumNumber `newOperator` is trying to replace an operator in this quorum\n     * @param totalQuorumStake the total stake of all operators in the quorum, after the\n     * `newOperator` registers\n     * @param newOperator the incoming operator\n     * @param newOperatorStake the incoming operator's stake\n     * @param kickParams the quorum number and existing operator to replace\n     * @dev the existing operator's registration to this quorum isn't checked here, but\n     * if we attempt to deregister them, this will be checked in `_deregisterOperator`\n     * @param setParams config for this quorum containing `kickBIPsX` stake proportions\n     * mentioned above\n     */\n    function _validateChurn(\n        uint8 quorumNumber, \n        uint96 totalQuorumStake,\n        address newOperator, \n        uint96 newOperatorStake,\n        OperatorKickParam memory kickParams, \n        OperatorSetParam memory setParams\n    ) internal view {\n        address operatorToKick = kickParams.operator;\n        bytes32 idToKick = _operatorInfo[operatorToKick].operatorId;\n        require(newOperator != operatorToKick, \"RegistryCoordinator._validateChurn: cannot churn self\");\n        require(kickParams.quorumNumber == quorumNumber, \"RegistryCoordinator._validateChurn: quorumNumber not the same as signed\");\n\n        // Get the target operator's stake and check that it is below the kick thresholds\n        uint96 operatorToKickStake = stakeRegistry.getCurrentStake(idToKick, quorumNumber);\n        require(\n            newOperatorStake > _individualKickThreshold(operatorToKickStake, setParams),\n            \"RegistryCoordinator._validateChurn: incoming operator has insufficient stake for churn\"\n        );\n        require(\n            operatorToKickStake < _totalKickThreshold(totalQuorumStake, setParams),\n            \"RegistryCoordinator._validateChurn: cannot kick operator with more than kickBIPsOfTotalStake\"\n        );\n    }\n\n    /**\n     * @dev Deregister the operator from one or more quorums\n     * This method updates the operator's quorum bitmap and status, then deregisters\n     * the operator with the BLSApkRegistry, IndexRegistry, and StakeRegistry\n     */\n    function _deregisterOperator(\n        address operator, \n        bytes memory quorumNumbers\n    ) internal virtual {\n        // Fetch the operator's info and ensure they are registered\n        OperatorInfo storage operatorInfo = _operatorInfo[operator];\n        bytes32 operatorId = operatorInfo.operatorId;\n        require(operatorInfo.status == OperatorStatus.REGISTERED, \"RegistryCoordinator._deregisterOperator: operator is not registered\");\n        \n        /**\n         * Get bitmap of quorums to deregister from and operator's current bitmap. Validate that:\n         * - we're trying to deregister from at least 1 quorum\n         * - the quorums we're deregistering from exist (checked against `quorumCount` in orderedBytesArrayToBitmap)\n         * - the operator is currently registered for any quorums we're trying to deregister from\n         * Then, calculate the operator's new bitmap after deregistration\n         */\n        uint192 quorumsToRemove = uint192(BitmapUtils.orderedBytesArrayToBitmap(quorumNumbers, quorumCount));\n        uint192 currentBitmap = _currentOperatorBitmap(operatorId);\n        require(!quorumsToRemove.isEmpty(), \"RegistryCoordinator._deregisterOperator: bitmap cannot be 0\");\n        require(quorumsToRemove.isSubsetOf(currentBitmap), \"RegistryCoordinator._deregisterOperator: operator is not registered for specified quorums\");\n        uint192 newBitmap = uint192(currentBitmap.minus(quorumsToRemove));\n\n        // Update operator's bitmap and status\n        _updateOperatorBitmap({\n            operatorId: operatorId,\n            newBitmap: newBitmap\n        });\n\n        // If the operator is no longer registered for any quorums, update their status and deregister \n        // them from the AVS via the EigenLayer core contracts\n        if (newBitmap.isEmpty()) {\n            operatorInfo.status = OperatorStatus.DEREGISTERED;\n            serviceManager.deregisterOperatorFromAVS(operator);\n            emit OperatorDeregistered(operator, operatorId);\n        }\n\n        // Deregister operator with each of the registry contracts\n        blsApkRegistry.deregisterOperator(operator, quorumNumbers);\n        stakeRegistry.deregisterOperator(operatorId, quorumNumbers);\n        indexRegistry.deregisterOperator(operatorId, quorumNumbers);\n    }\n\n    /**\n     * @notice Updates the StakeRegistry's view of the operator's stake in one or more quorums.\n     * For any quorums where the StakeRegistry finds the operator is under the configured minimum\n     * stake, `quorumsToRemove` is returned and used to deregister the operator from those quorums\n     * @dev does nothing if operator is not registered for any quorums.\n     */\n    function _updateOperator(\n        address operator,\n        OperatorInfo memory operatorInfo,\n        bytes memory quorumsToUpdate\n    ) internal {\n        if (operatorInfo.status != OperatorStatus.REGISTERED) {\n            return;\n        }\n        bytes32 operatorId = operatorInfo.operatorId;\n        uint192 quorumsToRemove = stakeRegistry.updateOperatorStake(operator, operatorId, quorumsToUpdate);\n\n        if (!quorumsToRemove.isEmpty()) {\n            _deregisterOperator({\n                operator: operator,\n                quorumNumbers: BitmapUtils.bitmapToBytesArray(quorumsToRemove)\n            });    \n        }\n    }\n\n    /**\n     * @notice Returns the stake threshold required for an incoming operator to replace an existing operator\n     * The incoming operator must have more stake than the return value.\n     */\n    function _individualKickThreshold(uint96 operatorStake, OperatorSetParam memory setParams) internal pure returns (uint96) {\n        return operatorStake * setParams.kickBIPsOfOperatorStake / BIPS_DENOMINATOR;\n    }\n\n    /**\n     * @notice Returns the total stake threshold required for an operator to remain in a quorum.\n     * The operator must have at least the returned stake amount to keep their position.\n     */\n    function _totalKickThreshold(uint96 totalStake, OperatorSetParam memory setParams) internal pure returns (uint96) {\n        return totalStake * setParams.kickBIPsOfTotalStake / BIPS_DENOMINATOR;\n    }\n\n    /// @notice verifies churnApprover's signature on operator churn approval and increments the churnApprover nonce\n    function _verifyChurnApproverSignature(\n        address registeringOperator,\n        bytes32 registeringOperatorId, \n        OperatorKickParam[] memory operatorKickParams, \n        SignatureWithSaltAndExpiry memory churnApproverSignature\n    ) internal {\n        // make sure the salt hasn't been used already\n        require(!isChurnApproverSaltUsed[churnApproverSignature.salt], \"RegistryCoordinator._verifyChurnApproverSignature: churnApprover salt already used\");\n        require(churnApproverSignature.expiry >= block.timestamp, \"RegistryCoordinator._verifyChurnApproverSignature: churnApprover signature expired\");   \n\n        // set salt used to true\n        isChurnApproverSaltUsed[churnApproverSignature.salt] = true;    \n\n        // check the churnApprover's signature \n        EIP1271SignatureUtils.checkSignature_EIP1271(\n            churnApprover, \n            calculateOperatorChurnApprovalDigestHash(registeringOperator, registeringOperatorId, operatorKickParams, churnApproverSignature.salt, churnApproverSignature.expiry), \n            churnApproverSignature.signature\n        );\n    }\n\n    /**\n     * @notice Creates a quorum and initializes it in each registry contract\n     * @param operatorSetParams configures the quorum's max operator count and churn parameters\n     * @param minimumStake sets the minimum stake required for an operator to register or remain\n     * registered\n     * @param strategyParams a list of strategies and multipliers used by the StakeRegistry to\n     * calculate an operator's stake weight for the quorum\n     */\n    function _createQuorum(\n        OperatorSetParam memory operatorSetParams,\n        uint96 minimumStake,\n        IStakeRegistry.StrategyParams[] memory strategyParams\n    ) internal {\n        // Increment the total quorum count. Fails if we're already at the max\n        uint8 prevQuorumCount = quorumCount;\n        require(prevQuorumCount < MAX_QUORUM_COUNT, \"RegistryCoordinator.createQuorum: max quorums reached\");\n        quorumCount = prevQuorumCount + 1;\n        \n        // The previous count is the new quorum's number\n        uint8 quorumNumber = prevQuorumCount;\n\n        // Initialize the quorum here and in each registry\n        _setOperatorSetParams(quorumNumber, operatorSetParams);\n        stakeRegistry.initializeQuorum(quorumNumber, minimumStake, strategyParams);\n        indexRegistry.initializeQuorum(quorumNumber);\n        blsApkRegistry.initializeQuorum(quorumNumber);\n    }\n\n    /**\n     * @notice Record an update to an operator's quorum bitmap.\n     * @param newBitmap is the most up-to-date set of bitmaps the operator is registered for\n     */\n    function _updateOperatorBitmap(bytes32 operatorId, uint192 newBitmap) internal {\n\n        uint256 historyLength = _operatorBitmapHistory[operatorId].length;\n\n        if (historyLength == 0) {\n            // No prior bitmap history - push our first entry\n            _operatorBitmapHistory[operatorId].push(QuorumBitmapUpdate({\n                updateBlockNumber: uint32(block.number),\n                nextUpdateBlockNumber: 0,\n                quorumBitmap: newBitmap\n            }));\n        } else {\n            // We have prior history - fetch our last-recorded update\n            QuorumBitmapUpdate storage lastUpdate = _operatorBitmapHistory[operatorId][historyLength - 1];\n\n            /**\n             * If the last update was made in the current block, update the entry.\n             * Otherwise, push a new entry and update the previous entry's \"next\" field\n             */\n            if (lastUpdate.updateBlockNumber == uint32(block.number)) {\n                lastUpdate.quorumBitmap = newBitmap;\n            } else {\n                lastUpdate.nextUpdateBlockNumber = uint32(block.number);\n                _operatorBitmapHistory[operatorId].push(QuorumBitmapUpdate({\n                    updateBlockNumber: uint32(block.number),\n                    nextUpdateBlockNumber: 0,\n                    quorumBitmap: newBitmap\n                }));\n            }\n        }\n    }\n\n    /// @notice Get the most recent bitmap for the operator, returning an empty bitmap if\n    /// the operator is not registered.\n    function _currentOperatorBitmap(bytes32 operatorId) internal view returns (uint192) {\n        uint256 historyLength = _operatorBitmapHistory[operatorId].length;\n        if (historyLength == 0) {\n            return 0;\n        } else {\n            return _operatorBitmapHistory[operatorId][historyLength - 1].quorumBitmap;\n        }\n    }\n\n    /**\n     * @notice Returns the index of the quorumBitmap for the provided `operatorId` at the given `blockNumber`\n     * @dev Reverts if the operator had not yet (ever) registered at `blockNumber`\n     * @dev This function is designed to find proper inputs to the `getQuorumBitmapAtBlockNumberByIndex` function\n     */\n    function _getQuorumBitmapIndexAtBlockNumber(\n        uint32 blockNumber, \n        bytes32 operatorId\n    ) internal view returns (uint32 index) {\n        uint256 length = _operatorBitmapHistory[operatorId].length;\n\n        // Traverse the operator's bitmap history in reverse, returning the first index\n        // corresponding to an update made before or at `blockNumber`\n        for (uint256 i = 0; i < length; i++) {\n            index = uint32(length - i - 1);\n\n            if (_operatorBitmapHistory[operatorId][index].updateBlockNumber <= blockNumber) {\n                return index;\n            }\n        }\n\n        revert(\n            \"RegistryCoordinator.getQuorumBitmapIndexAtBlockNumber: no bitmap update found for operatorId at block number\"\n        );\n    }\n\n    function _setOperatorSetParams(uint8 quorumNumber, OperatorSetParam memory operatorSetParams) internal {\n        _quorumParams[quorumNumber] = operatorSetParams;\n        emit OperatorSetParamsUpdated(quorumNumber, operatorSetParams);\n    }\n    \n    function _setChurnApprover(address newChurnApprover) internal {\n        emit ChurnApproverUpdated(churnApprover, newChurnApprover);\n        churnApprover = newChurnApprover;\n    }\n\n    function _setEjector(address newEjector) internal {\n        emit EjectorUpdated(ejector, newEjector);\n        ejector = newEjector;\n    }\n\n    /*******************************************************************************\n                            VIEW FUNCTIONS\n    *******************************************************************************/\n\n    /// @notice Returns the operator set params for the given `quorumNumber`\n    function getOperatorSetParams(uint8 quorumNumber) external view returns (OperatorSetParam memory) {\n        return _quorumParams[quorumNumber];\n    }\n\n    /// @notice Returns the operator struct for the given `operator`\n    function getOperator(address operator) external view returns (OperatorInfo memory) {\n        return _operatorInfo[operator];\n    }\n\n    /// @notice Returns the operatorId for the given `operator`\n    function getOperatorId(address operator) external view returns (bytes32) {\n        return _operatorInfo[operator].operatorId;\n    }\n\n    /// @notice Returns the operator address for the given `operatorId`\n    function getOperatorFromId(bytes32 operatorId) external view returns (address) {\n        return blsApkRegistry.getOperatorFromPubkeyHash(operatorId);\n    }\n\n    /// @notice Returns the status for the given `operator`\n    function getOperatorStatus(address operator) external view returns (IRegistryCoordinator.OperatorStatus) {\n        return _operatorInfo[operator].status;\n    }\n\n    /**\n     * @notice Returns the indices of the quorumBitmaps for the provided `operatorIds` at the given `blockNumber`\n     * @dev Reverts if any of the `operatorIds` was not (yet) registered at `blockNumber`\n     * @dev This function is designed to find proper inputs to the `getQuorumBitmapAtBlockNumberByIndex` function\n     */\n    function getQuorumBitmapIndicesAtBlockNumber(\n        uint32 blockNumber, \n        bytes32[] memory operatorIds\n    ) external view returns (uint32[] memory) {\n        uint32[] memory indices = new uint32[](operatorIds.length);\n        for (uint256 i = 0; i < operatorIds.length; i++) {\n            indices[i] = _getQuorumBitmapIndexAtBlockNumber(blockNumber, operatorIds[i]);\n        }\n        return indices;\n    }\n\n    /**\n     * @notice Returns the quorum bitmap for the given `operatorId` at the given `blockNumber` via the `index`,\n     * reverting if `index` is incorrect\n     * @dev This function is meant to be used in concert with `getQuorumBitmapIndicesAtBlockNumber`, which\n     * helps off-chain processes to fetch the correct `index` input\n     */ \n    function getQuorumBitmapAtBlockNumberByIndex(\n        bytes32 operatorId, \n        uint32 blockNumber, \n        uint256 index\n    ) external view returns (uint192) {\n        QuorumBitmapUpdate memory quorumBitmapUpdate = _operatorBitmapHistory[operatorId][index];\n        \n        /**\n         * Validate that the update is valid for the given blockNumber:\n         * - blockNumber should be >= the update block number\n         * - the next update block number should be either 0 or strictly greater than blockNumber\n         */\n        require(\n            blockNumber >= quorumBitmapUpdate.updateBlockNumber, \n            \"RegistryCoordinator.getQuorumBitmapAtBlockNumberByIndex: quorumBitmapUpdate is from after blockNumber\"\n        );\n        require(\n            quorumBitmapUpdate.nextUpdateBlockNumber == 0 || blockNumber < quorumBitmapUpdate.nextUpdateBlockNumber,\n            \"RegistryCoordinator.getQuorumBitmapAtBlockNumberByIndex: quorumBitmapUpdate is from before blockNumber\"\n        );\n\n        return quorumBitmapUpdate.quorumBitmap;\n    }\n\n    /// @notice Returns the `index`th entry in the operator with `operatorId`'s bitmap history\n    function getQuorumBitmapUpdateByIndex(\n        bytes32 operatorId, \n        uint256 index\n    ) external view returns (QuorumBitmapUpdate memory) {\n        return _operatorBitmapHistory[operatorId][index];\n    }\n\n    /// @notice Returns the current quorum bitmap for the given `operatorId` or 0 if the operator is not registered for any quorum\n    function getCurrentQuorumBitmap(bytes32 operatorId) external view returns (uint192) {\n        return _currentOperatorBitmap(operatorId);\n    }\n\n    /// @notice Returns the length of the quorum bitmap history for the given `operatorId`\n    function getQuorumBitmapHistoryLength(bytes32 operatorId) external view returns (uint256) {\n        return _operatorBitmapHistory[operatorId].length;\n    }\n\n    /// @notice Returns the number of registries\n    function numRegistries() external view returns (uint256) {\n        return registries.length;\n    }\n\n    /**\n     * @notice Public function for the the churnApprover signature hash calculation when operators are being kicked from quorums\n     * @param registeringOperatorId The id of the registering operator \n     * @param operatorKickParams The parameters needed to kick the operator from the quorums that have reached their caps\n     * @param salt The salt to use for the churnApprover's signature\n     * @param expiry The desired expiry time of the churnApprover's signature\n     */\n    function calculateOperatorChurnApprovalDigestHash(\n        address registeringOperator,\n        bytes32 registeringOperatorId,\n        OperatorKickParam[] memory operatorKickParams,\n        bytes32 salt,\n        uint256 expiry\n    ) public view returns (bytes32) {\n        // calculate the digest hash\n        return _hashTypedDataV4(keccak256(abi.encode(OPERATOR_CHURN_APPROVAL_TYPEHASH, registeringOperator, registeringOperatorId, operatorKickParams, salt, expiry)));\n    }\n\n    /**\n     * @notice Returns the message hash that an operator must sign to register their BLS public key.\n     * @param operator is the address of the operator registering their BLS public key\n     */\n    function pubkeyRegistrationMessageHash(address operator) public view returns (BN254.G1Point memory) {\n        return BN254.hashToG1(\n            _hashTypedDataV4(\n                keccak256(abi.encode(PUBKEY_REGISTRATION_TYPEHASH, operator))\n            )\n        );\n    }\n\n    /// @dev need to override function here since its defined in both these contracts\n    function owner()\n        public\n        view\n        override(OwnableUpgradeable, IRegistryCoordinator)\n        returns (address)\n    {\n        return OwnableUpgradeable.owner();\n    }\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IPauserRegistry.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\n/**\n * @title Interface for the `PauserRegistry` contract.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n */\ninterface IPauserRegistry {\n    event PauserStatusChanged(address pauser, bool canPause);\n\n    event UnpauserChanged(address previousUnpauser, address newUnpauser);\n    \n    /// @notice Mapping of addresses to whether they hold the pauser role.\n    function isPauser(address pauser) external view returns (bool);\n\n    /// @notice Unique address that holds the unpauser role. Capable of changing *both* the pauser and unpauser addresses.\n    function unpauser() external view returns (address);\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\n/**\n * @title The interface for common signature utilities.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n */\ninterface ISignatureUtils {\n    // @notice Struct that bundles together a signature and an expiration time for the signature. Used primarily for stack management.\n    struct SignatureWithExpiry {\n        // the signature itself, formatted as a single bytes object\n        bytes signature;\n        // the expiration timestamp (UTC) of the signature\n        uint256 expiry;\n    }\n\n    // @notice Struct that bundles together a signature, a salt for uniqueness, and an expiration time for the signature. Used primarily for stack management.\n    struct SignatureWithSaltAndExpiry {\n        // the signature itself, formatted as a single bytes object\n        bytes signature;\n        // the salt used to generate the signature\n        bytes32 salt;\n        // the expiration timestamp (UTC) of the signature\n        uint256 expiry;\n    }\n}"
      },
      "lib/eigenlayer-middleware/src/interfaces/ISocketUpdater.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.8.12;\n\n/**\n * @title Interface for an `ISocketUpdater` where operators can update their sockets.\n * @author Layr Labs, Inc.\n */\ninterface ISocketUpdater {\n    // EVENTS\n\n    event OperatorSocketUpdate(bytes32 indexed operatorId, string socket);\n\n    // FUNCTIONS\n    \n    /**\n     * @notice Updates the socket of the msg.sender given they are a registered operator\n     * @param socket is the new socket of the operator\n     */\n    function updateSocket(string memory socket) external;\n}\n"
      },
      "lib/eigenlayer-middleware/src/interfaces/IBLSApkRegistry.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.8.12;\n\nimport {IRegistry} from \"./IRegistry.sol\";\n\nimport {BN254} from \"../libraries/BN254.sol\";\n\n/**\n * @title Minimal interface for a registry that keeps track of aggregate operator public keys across many quorums.\n * @author Layr Labs, Inc.\n */\ninterface IBLSApkRegistry is IRegistry {\n    // STRUCTS\n    /// @notice Data structure used to track the history of the Aggregate Public Key of all operators\n    struct ApkUpdate {\n        // first 24 bytes of keccak256(apk_x0, apk_x1, apk_y0, apk_y1)\n        bytes24 apkHash;\n        // block number at which the update occurred\n        uint32 updateBlockNumber;\n        // block number at which the next update occurred\n        uint32 nextUpdateBlockNumber;\n    }\n\n    /**\n     * @notice Struct used when registering a new public key\n     * @param pubkeyRegistrationSignature is the registration message signed by the private key of the operator\n     * @param pubkeyG1 is the corresponding G1 public key of the operator \n     * @param pubkeyG2 is the corresponding G2 public key of the operator\n     */     \n    struct PubkeyRegistrationParams {\n        BN254.G1Point pubkeyRegistrationSignature;\n        BN254.G1Point pubkeyG1;\n        BN254.G2Point pubkeyG2;\n    }\n\n    // EVENTS\n    /// @notice Emitted when `operator` registers with the public keys `pubkeyG1` and `pubkeyG2`.\n    event NewPubkeyRegistration(address indexed operator, BN254.G1Point pubkeyG1, BN254.G2Point pubkeyG2);\n\n    // @notice Emitted when a new operator pubkey is registered for a set of quorums\n    event OperatorAddedToQuorums(\n        address operator,\n        bytes32 operatorId,\n        bytes quorumNumbers\n    );\n\n    // @notice Emitted when an operator pubkey is removed from a set of quorums\n    event OperatorRemovedFromQuorums(\n        address operator, \n        bytes32 operatorId,\n        bytes quorumNumbers\n    );\n\n    /**\n     * @notice Registers the `operator`'s pubkey for the specified `quorumNumbers`.\n     * @param operator The address of the operator to register.\n     * @param quorumNumbers The quorum numbers the operator is registering for, where each byte is an 8 bit integer quorumNumber.\n     * @dev access restricted to the RegistryCoordinator\n     * @dev Preconditions (these are assumed, not validated in this contract):\n     *         1) `quorumNumbers` has no duplicates\n     *         2) `quorumNumbers.length` != 0\n     *         3) `quorumNumbers` is ordered in ascending order\n     *         4) the operator is not already registered\n     */\n    function registerOperator(address operator, bytes calldata quorumNumbers) external;\n\n    /**\n     * @notice Deregisters the `operator`'s pubkey for the specified `quorumNumbers`.\n     * @param operator The address of the operator to deregister.\n     * @param quorumNumbers The quorum numbers the operator is deregistering from, where each byte is an 8 bit integer quorumNumber.\n     * @dev access restricted to the RegistryCoordinator\n     * @dev Preconditions (these are assumed, not validated in this contract):\n     *         1) `quorumNumbers` has no duplicates\n     *         2) `quorumNumbers.length` != 0\n     *         3) `quorumNumbers` is ordered in ascending order\n     *         4) the operator is not already deregistered\n     *         5) `quorumNumbers` is a subset of the quorumNumbers that the operator is registered for\n     */ \n    function deregisterOperator(address operator, bytes calldata quorumNumbers) external;\n    \n    /**\n     * @notice Initializes a new quorum by pushing its first apk update\n     * @param quorumNumber The number of the new quorum\n     */\n    function initializeQuorum(uint8 quorumNumber) external;\n\n    /**\n     * @notice mapping from operator address to pubkey hash.\n     * Returns *zero* if the `operator` has never registered, and otherwise returns the hash of the public key of the operator.\n     */\n    function operatorToPubkeyHash(address operator) external view returns (bytes32);\n\n    /**\n     * @notice mapping from pubkey hash to operator address.\n     * Returns *zero* if no operator has ever registered the public key corresponding to `pubkeyHash`,\n     * and otherwise returns the (unique) registered operator who owns the BLS public key that is the preimage of `pubkeyHash`.\n     */\n    function pubkeyHashToOperator(bytes32 pubkeyHash) external view returns (address);\n\n    /**\n     * @notice Called by the RegistryCoordinator register an operator as the owner of a BLS public key.\n     * @param operator is the operator for whom the key is being registered\n     * @param params contains the G1 & G2 public keys of the operator, and a signature proving their ownership\n     * @param pubkeyRegistrationMessageHash is a hash that the operator must sign to prove key ownership\n     */\n    function registerBLSPublicKey(\n        address operator,\n        PubkeyRegistrationParams calldata params,\n        BN254.G1Point calldata pubkeyRegistrationMessageHash\n    ) external returns (bytes32 operatorId);\n\n    /**\n     * @notice Returns the pubkey and pubkey hash of an operator\n     * @dev Reverts if the operator has not registered a valid pubkey\n     */\n    function getRegisteredPubkey(address operator) external view returns (BN254.G1Point memory, bytes32);\n\n    /// @notice Returns the current APK for the provided `quorumNumber `\n    function getApk(uint8 quorumNumber) external view returns (BN254.G1Point memory);\n\n    /// @notice Returns the index of the quorumApk index at `blockNumber` for the provided `quorumNumber`\n    function getApkIndicesAtBlockNumber(bytes calldata quorumNumbers, uint256 blockNumber) external view returns(uint32[] memory);\n\n    /// @notice Returns the `ApkUpdate` struct at `index` in the list of APK updates for the `quorumNumber`\n    function getApkUpdateAtIndex(uint8 quorumNumber, uint256 index) external view returns (ApkUpdate memory);\n\n    /// @notice Returns the operator address for the given `pubkeyHash`\n    function getOperatorFromPubkeyHash(bytes32 pubkeyHash) external view returns (address);\n\n    /**\n     * @notice get 24 byte hash of the apk of `quorumNumber` at `blockNumber` using the provided `index`;\n     * called by checkSignatures in BLSSignatureChecker.sol.\n     * @param quorumNumber is the quorum whose ApkHash is being retrieved\n     * @param blockNumber is the number of the block for which the latest ApkHash will be retrieved\n     * @param index is the index of the apkUpdate being retrieved from the list of quorum apkUpdates in storage\n     */\n    function getApkHashAtBlockNumberAndIndex(uint8 quorumNumber, uint32 blockNumber, uint256 index) external view returns (bytes24);\n\n    /// @notice returns the ID used to identify the `operator` within this AVS.\n    /// @dev Returns zero in the event that the `operator` has never registered for the AVS\n    function getOperatorId(address operator) external view returns (bytes32);\n}\n"
      },
      "lib/eigenlayer-middleware/src/interfaces/IStakeRegistry.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.8.12;\n\nimport {IDelegationManager} from \"eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol\";\nimport {IStrategy} from \"eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol\";\n\nimport {IRegistry} from \"./IRegistry.sol\";\n\n/**\n * @title Interface for a `Registry` that keeps track of stakes of operators for up to 256 quorums.\n * @author Layr Labs, Inc.\n */\ninterface IStakeRegistry is IRegistry {\n    \n    // DATA STRUCTURES\n\n    /// @notice struct used to store the stakes of an individual operator or the sum of all operators' stakes, for storage\n    struct StakeUpdate {\n        // the block number at which the stake amounts were updated and stored\n        uint32 updateBlockNumber;\n        // the block number at which the *next update* occurred.\n        /// @notice This entry has the value **0** until another update takes place.\n        uint32 nextUpdateBlockNumber;\n        // stake weight for the quorum\n        uint96 stake;\n    }\n\n    /**\n     * @notice In weighing a particular strategy, the amount of underlying asset for that strategy is\n     * multiplied by its multiplier, then divided by WEIGHTING_DIVISOR\n     */\n    struct StrategyParams {\n        IStrategy strategy;\n        uint96 multiplier;\n    }\n\n    // EVENTS\n\n    /// @notice emitted whenever the stake of `operator` is updated\n    event OperatorStakeUpdate(\n        bytes32 indexed operatorId,\n        uint8 quorumNumber,\n        uint96 stake\n    );\n    /// @notice emitted when the minimum stake for a quorum is updated\n    event MinimumStakeForQuorumUpdated(uint8 indexed quorumNumber, uint96 minimumStake);\n    /// @notice emitted when a new quorum is created\n    event QuorumCreated(uint8 indexed quorumNumber);\n    /// @notice emitted when `strategy` has been added to the array at `strategyParams[quorumNumber]`\n    event StrategyAddedToQuorum(uint8 indexed quorumNumber, IStrategy strategy);\n    /// @notice emitted when `strategy` has removed from the array at `strategyParams[quorumNumber]`\n    event StrategyRemovedFromQuorum(uint8 indexed quorumNumber, IStrategy strategy);\n    /// @notice emitted when `strategy` has its `multiplier` updated in the array at `strategyParams[quorumNumber]`\n    event StrategyMultiplierUpdated(uint8 indexed quorumNumber, IStrategy strategy, uint256 multiplier);\n\n    /**\n     * @notice Registers the `operator` with `operatorId` for the specified `quorumNumbers`.\n     * @param operator The address of the operator to register.\n     * @param operatorId The id of the operator to register.\n     * @param quorumNumbers The quorum numbers the operator is registering for, where each byte is an 8 bit integer quorumNumber.\n     * @return The operator's current stake for each quorum, and the total stake for each quorum\n     * @dev access restricted to the RegistryCoordinator\n     * @dev Preconditions (these are assumed, not validated in this contract):\n     *         1) `quorumNumbers` has no duplicates\n     *         2) `quorumNumbers.length` != 0\n     *         3) `quorumNumbers` is ordered in ascending order\n     *         4) the operator is not already registered\n     */\n    function registerOperator(\n        address operator, \n        bytes32 operatorId, \n        bytes memory quorumNumbers\n    ) external returns (uint96[] memory, uint96[] memory);\n\n    /**\n     * @notice Deregisters the operator with `operatorId` for the specified `quorumNumbers`.\n     * @param operatorId The id of the operator to deregister.\n     * @param quorumNumbers The quorum numbers the operator is deregistering from, where each byte is an 8 bit integer quorumNumber.\n     * @dev access restricted to the RegistryCoordinator\n     * @dev Preconditions (these are assumed, not validated in this contract):\n     *         1) `quorumNumbers` has no duplicates\n     *         2) `quorumNumbers.length` != 0\n     *         3) `quorumNumbers` is ordered in ascending order\n     *         4) the operator is not already deregistered\n     *         5) `quorumNumbers` is a subset of the quorumNumbers that the operator is registered for\n     */\n    function deregisterOperator(bytes32 operatorId, bytes memory quorumNumbers) external;\n\n    /**\n     * @notice Initialize a new quorum created by the registry coordinator by setting strategies, weights, and minimum stake\n     */\n    function initializeQuorum(uint8 quorumNumber, uint96 minimumStake, StrategyParams[] memory strategyParams) external;\n\n    /// @notice Adds new strategies and the associated multipliers to the @param quorumNumber.\n    function addStrategies(\n        uint8 quorumNumber,\n        StrategyParams[] memory strategyParams\n    ) external;\n\n    /**\n     * @notice This function is used for removing strategies and their associated weights from the\n     * mapping strategyParams for a specific @param quorumNumber.\n     * @dev higher indices should be *first* in the list of @param indicesToRemove, since otherwise\n     * the removal of lower index entries will cause a shift in the indices of the other strategiesToRemove\n     */\n    function removeStrategies(uint8 quorumNumber, uint256[] calldata indicesToRemove) external;\n\n    /**\n     * @notice This function is used for modifying the weights of strategies that are already in the\n     * mapping strategyParams for a specific\n     * @param quorumNumber is the quorum number to change the strategy for\n     * @param strategyIndices are the indices of the strategies to change\n     * @param newMultipliers are the new multipliers for the strategies\n     */\n    function modifyStrategyParams(\n        uint8 quorumNumber,\n        uint256[] calldata strategyIndices,\n        uint96[] calldata newMultipliers\n    ) external;\n\n    /// @notice Constant used as a divisor in calculating weights.\n    function WEIGHTING_DIVISOR() external pure returns (uint256);\n\n    /// @notice Returns the EigenLayer delegation manager contract.\n    function delegation() external view returns (IDelegationManager);\n\n    /// @notice In order to register for a quorum i, an operator must have at least `minimumStakeForQuorum[i]`\n    function minimumStakeForQuorum(uint8 quorumNumber) external view returns (uint96);\n\n    /// @notice Returns the length of the dynamic array stored in `strategyParams[quorumNumber]`.\n    function strategyParamsLength(uint8 quorumNumber) external view returns (uint256);\n\n    /// @notice Returns the strategy and weight multiplier for the `index`'th strategy in the quorum `quorumNumber`\n    function strategyParamsByIndex(\n        uint8 quorumNumber,\n        uint256 index\n    ) external view returns (StrategyParams memory);\n\n    /**\n     * @notice This function computes the total weight of the @param operator in the quorum @param quorumNumber.\n     * @dev reverts in the case that `quorumNumber` is greater than or equal to `quorumCount`\n     */\n    function weightOfOperatorForQuorum(uint8 quorumNumber, address operator) external view returns (uint96);\n\n    /**\n     * @notice Returns the entire `operatorIdToStakeHistory[operatorId][quorumNumber]` array.\n     * @param operatorId The id of the operator of interest.\n     * @param quorumNumber The quorum number to get the stake for.\n     */\n    function getStakeHistory(bytes32 operatorId, uint8 quorumNumber) external view returns (StakeUpdate[] memory);\n\n    function getTotalStakeHistoryLength(uint8 quorumNumber) external view returns (uint256);\n\n    /**\n     * @notice Returns the `index`-th entry in the dynamic array of total stake, `totalStakeHistory` for quorum `quorumNumber`.\n     * @param quorumNumber The quorum number to get the stake for.\n     * @param index Array index for lookup, within the dynamic array `totalStakeHistory[quorumNumber]`.\n     */\n    function getTotalStakeUpdateAtIndex(uint8 quorumNumber, uint256 index) external view returns (StakeUpdate memory);\n\n    /// @notice Returns the indices of the operator stakes for the provided `quorumNumber` at the given `blockNumber`\n    function getStakeUpdateIndexAtBlockNumber(bytes32 operatorId, uint8 quorumNumber, uint32 blockNumber)\n        external\n        view\n        returns (uint32);\n\n    /// @notice Returns the indices of the total stakes for the provided `quorumNumbers` at the given `blockNumber`\n    function getTotalStakeIndicesAtBlockNumber(uint32 blockNumber, bytes calldata quorumNumbers) external view returns(uint32[] memory) ;\n\n    /**\n     * @notice Returns the `index`-th entry in the `operatorIdToStakeHistory[operatorId][quorumNumber]` array.\n     * @param quorumNumber The quorum number to get the stake for.\n     * @param operatorId The id of the operator of interest.\n     * @param index Array index for lookup, within the dynamic array `operatorIdToStakeHistory[operatorId][quorumNumber]`.\n     * @dev Function will revert if `index` is out-of-bounds.\n     */\n    function getStakeUpdateAtIndex(uint8 quorumNumber, bytes32 operatorId, uint256 index)\n        external\n        view\n        returns (StakeUpdate memory);\n\n    /**\n     * @notice Returns the most recent stake weight for the `operatorId` for a certain quorum\n     * @dev Function returns an StakeUpdate struct with **every entry equal to 0** in the event that the operator has no stake history\n     */\n    function getLatestStakeUpdate(bytes32 operatorId, uint8 quorumNumber) external view returns (StakeUpdate memory);\n\n    /**\n     * @notice Returns the stake weight corresponding to `operatorId` for quorum `quorumNumber`, at the\n     * `index`-th entry in the `operatorIdToStakeHistory[operatorId][quorumNumber]` array if the entry \n     * corresponds to the operator's stake at `blockNumber`. Reverts otherwise.\n     * @param quorumNumber The quorum number to get the stake for.\n     * @param operatorId The id of the operator of interest.\n     * @param index Array index for lookup, within the dynamic array `operatorIdToStakeHistory[operatorId][quorumNumber]`.\n     * @param blockNumber Block number to make sure the stake is from.\n     * @dev Function will revert if `index` is out-of-bounds.\n     * @dev used the BLSSignatureChecker to get past stakes of signing operators\n     */\n    function getStakeAtBlockNumberAndIndex(uint8 quorumNumber, uint32 blockNumber, bytes32 operatorId, uint256 index)\n        external\n        view\n        returns (uint96);\n\n    /**\n     * @notice Returns the total stake weight for quorum `quorumNumber`, at the `index`-th entry in the \n     * `totalStakeHistory[quorumNumber]` array if the entry corresponds to the total stake at `blockNumber`. \n     * Reverts otherwise.\n     * @param quorumNumber The quorum number to get the stake for.\n     * @param index Array index for lookup, within the dynamic array `totalStakeHistory[quorumNumber]`.\n     * @param blockNumber Block number to make sure the stake is from.\n     * @dev Function will revert if `index` is out-of-bounds.\n     * @dev used the BLSSignatureChecker to get past stakes of signing operators\n     */\n    function getTotalStakeAtBlockNumberFromIndex(uint8 quorumNumber, uint32 blockNumber, uint256 index) external view returns (uint96);\n\n    /**\n     * @notice Returns the most recent stake weight for the `operatorId` for quorum `quorumNumber`\n     * @dev Function returns weight of **0** in the event that the operator has no stake history\n     */\n    function getCurrentStake(bytes32 operatorId, uint8 quorumNumber) external view returns (uint96);\n\n    /// @notice Returns the stake of the operator for the provided `quorumNumber` at the given `blockNumber`\n    function getStakeAtBlockNumber(bytes32 operatorId, uint8 quorumNumber, uint32 blockNumber)\n        external\n        view\n        returns (uint96);\n\n    /**\n     * @notice Returns the stake weight from the latest entry in `_totalStakeHistory` for quorum `quorumNumber`.\n     * @dev Will revert if `_totalStakeHistory[quorumNumber]` is empty.\n     */\n    function getCurrentTotalStake(uint8 quorumNumber) external view returns (uint96);\n\n    /**\n     * @notice Called by the registry coordinator to update an operator's stake for one\n     * or more quorums.\n     *\n     * If the operator no longer has the minimum stake required for a quorum, they are\n     * added to the\n     * @return A bitmap of quorums where the operator no longer meets the minimum stake\n     * and should be deregistered.\n     */\n    function updateOperatorStake(\n        address operator, \n        bytes32 operatorId, \n        bytes calldata quorumNumbers\n    ) external returns (uint192);\n}"
      },
      "lib/eigenlayer-middleware/src/interfaces/IIndexRegistry.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.8.12;\n\nimport {IRegistry} from \"./IRegistry.sol\";\n\n/**\n * @title Interface for a `Registry`-type contract that keeps track of an ordered list of operators for up to 256 quorums.\n * @author Layr Labs, Inc.\n */\ninterface IIndexRegistry is IRegistry {\n    // EVENTS\n    \n    // emitted when an operator's index in the ordered operator list for the quorum with number `quorumNumber` is updated\n    event QuorumIndexUpdate(bytes32 indexed operatorId, uint8 quorumNumber, uint32 newOperatorIndex);\n\n    // DATA STRUCTURES\n\n    // struct used to give definitive ordering to operators at each blockNumber. \n    struct OperatorUpdate {\n        // blockNumber number from which `operatorIndex` was the operators index\n        // the operator's index is the first entry such that `blockNumber >= entry.fromBlockNumber`\n        uint32 fromBlockNumber;\n        // the operator at this index\n        bytes32 operatorId;\n    }\n\n    // struct used to denote the number of operators in a quorum at a given blockNumber\n    struct QuorumUpdate {\n        // The total number of operators at a `blockNumber` is the first entry such that `blockNumber >= entry.fromBlockNumber`\n        uint32 fromBlockNumber;\n        // The number of operators at `fromBlockNumber`\n        uint32 numOperators;\n    }\n\n    /**\n     * @notice Registers the operator with the specified `operatorId` for the quorums specified by `quorumNumbers`.\n     * @param operatorId is the id of the operator that is being registered\n     * @param quorumNumbers is the quorum numbers the operator is registered for\n     * @return numOperatorsPerQuorum is a list of the number of operators (including the registering operator) in each of the quorums the operator is registered for\n     * @dev access restricted to the RegistryCoordinator\n     * @dev Preconditions (these are assumed, not validated in this contract):\n     *         1) `quorumNumbers` has no duplicates\n     *         2) `quorumNumbers.length` != 0\n     *         3) `quorumNumbers` is ordered in ascending order\n     *         4) the operator is not already registered\n     */\n    function registerOperator(bytes32 operatorId, bytes calldata quorumNumbers) external returns(uint32[] memory);\n\n    /**\n     * @notice Deregisters the operator with the specified `operatorId` for the quorums specified by `quorumNumbers`.\n     * @param operatorId is the id of the operator that is being deregistered\n     * @param quorumNumbers is the quorum numbers the operator is deregistered for\n     * @dev access restricted to the RegistryCoordinator\n     * @dev Preconditions (these are assumed, not validated in this contract):\n     *         1) `quorumNumbers` has no duplicates\n     *         2) `quorumNumbers.length` != 0\n     *         3) `quorumNumbers` is ordered in ascending order\n     *         4) the operator is not already deregistered\n     *         5) `quorumNumbers` is a subset of the quorumNumbers that the operator is registered for\n     */\n    function deregisterOperator(bytes32 operatorId, bytes calldata quorumNumbers) external;\n\n    /**\n     * @notice Initialize a quorum by pushing its first quorum update\n     * @param quorumNumber The number of the new quorum\n     */\n    function initializeQuorum(uint8 quorumNumber) external;\n\n    /// @notice Returns the OperatorUpdate entry for the specified `operatorIndex` and `quorumNumber` at the specified `arrayIndex`\n    function getOperatorUpdateAtIndex(\n        uint8 quorumNumber,\n        uint32 operatorIndex,\n        uint32 arrayIndex\n    ) external view returns (OperatorUpdate memory);\n\n    /// @notice Returns the QuorumUpdate entry for the specified `quorumNumber` at the specified `quorumIndex`\n    function getQuorumUpdateAtIndex(uint8 quorumNumber, uint32 quorumIndex) external view returns (QuorumUpdate memory);\n\n    /// @notice Returns the most recent OperatorUpdate entry for the specified quorumNumber and operatorIndex\n    function getLatestOperatorUpdate(uint8 quorumNumber, uint32 operatorIndex) external view returns (OperatorUpdate memory);\n\n    /// @notice Returns the most recent QuorumUpdate entry for the specified quorumNumber\n    function getLatestQuorumUpdate(uint8 quorumNumber) external view returns (QuorumUpdate memory);\n\n    /// @notice Returns the current number of operators of this service for `quorumNumber`.\n    function totalOperatorsForQuorum(uint8 quorumNumber) external view returns (uint32);\n\n    /// @notice Returns an ordered list of operators of the services for the given `quorumNumber` at the given `blockNumber`\n    function getOperatorListAtBlockNumber(uint8 quorumNumber, uint32 blockNumber) external view returns (bytes32[] memory);\n}"
      },
      "lib/eigenlayer-middleware/src/interfaces/IServiceManager.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport {ISignatureUtils} from \"eigenlayer-contracts/src/contracts/interfaces/ISignatureUtils.sol\";\nimport {IDelegationManager} from \"eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol\";\n\n/**\n * @title Minimal interface for a ServiceManager-type contract that forms the single point for an AVS to push updates to EigenLayer\n * @author Layr Labs, Inc.\n */\ninterface IServiceManager {\n    /**\n     * @notice Updates the metadata URI for the AVS\n     * @param _metadataURI is the metadata URI for the AVS\n     */\n    function updateAVSMetadataURI(string memory _metadataURI) external;\n\n    /**\n     * @notice Forwards a call to EigenLayer's DelegationManager contract to confirm operator registration with the AVS\n     * @param operator The address of the operator to register.\n     * @param operatorSignature The signature, salt, and expiry of the operator's signature.\n     */\n    function registerOperatorToAVS(\n        address operator,\n        ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature\n    ) external;\n\n    /**\n     * @notice Forwards a call to EigenLayer's DelegationManager contract to confirm operator deregistration from the AVS\n     * @param operator The address of the operator to deregister.\n     */\n    function deregisterOperatorFromAVS(address operator) external;\n\n    /**\n     * @notice Returns the list of strategies that the operator has potentially restaked on the AVS\n     * @param operator The address of the operator to get restaked strategies for\n     * @dev This function is intended to be called off-chain\n     * @dev No guarantee is made on whether the operator has shares for a strategy in a quorum or uniqueness \n     *      of each element in the returned array. The off-chain service should do that validation separately\n     */\n    function getOperatorRestakedStrategies(address operator) external view returns (address[] memory);\n\n    /**\n     * @notice Returns the list of strategies that the AVS supports for restaking\n     * @dev This function is intended to be called off-chain\n     * @dev No guarantee is made on uniqueness of each element in the returned array. \n     *      The off-chain service should do that validation separately\n     */\n    function getRestakeableStrategies() external view returns (address[] memory);\n\n    /// @notice Returns the EigenLayer AVSDirectory contract.\n    function avsDirectory() external view returns (address);\n}\n"
      },
      "lib/eigenlayer-middleware/src/interfaces/IRegistryCoordinator.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.8.12;\n\nimport {IBLSApkRegistry} from \"./IBLSApkRegistry.sol\";\nimport {IStakeRegistry} from \"./IStakeRegistry.sol\";\nimport {IIndexRegistry} from \"./IIndexRegistry.sol\";\nimport {BN254} from \"../libraries/BN254.sol\";\n\n/**\n * @title Interface for a contract that coordinates between various registries for an AVS.\n * @author Layr Labs, Inc.\n */\ninterface IRegistryCoordinator {\n    // EVENTS\n\n    /// Emits when an operator is registered\n    event OperatorRegistered(address indexed operator, bytes32 indexed operatorId);\n\n    /// Emits when an operator is deregistered\n    event OperatorDeregistered(address indexed operator, bytes32 indexed operatorId);\n\n    event OperatorSetParamsUpdated(uint8 indexed quorumNumber, OperatorSetParam operatorSetParams);\n\n    event ChurnApproverUpdated(address prevChurnApprover, address newChurnApprover);\n\n    event EjectorUpdated(address prevEjector, address newEjector);\n\n    /// @notice emitted when all the operators for a quorum are updated at once\n    event QuorumBlockNumberUpdated(uint8 indexed quorumNumber, uint256 blocknumber);\n\n    // DATA STRUCTURES\n    enum OperatorStatus\n    {\n        // default is NEVER_REGISTERED\n        NEVER_REGISTERED,\n        REGISTERED,\n        DEREGISTERED\n    }\n\n    // STRUCTS\n\n    /**\n     * @notice Data structure for storing info on operators\n     */\n    struct OperatorInfo {\n        // the id of the operator, which is likely the keccak256 hash of the operator's public key if using BLSRegistry\n        bytes32 operatorId;\n        // indicates whether the operator is actively registered for serving the middleware or not\n        OperatorStatus status;\n    }\n\n    /**\n     * @notice Data structure for storing info on quorum bitmap updates where the `quorumBitmap` is the bitmap of the \n     * quorums the operator is registered for starting at (inclusive)`updateBlockNumber` and ending at (exclusive) `nextUpdateBlockNumber`\n     * @dev nextUpdateBlockNumber is initialized to 0 for the latest update\n     */\n    struct QuorumBitmapUpdate {\n        uint32 updateBlockNumber;\n        uint32 nextUpdateBlockNumber;\n        uint192 quorumBitmap;\n    }\n\n    /**\n     * @notice Data structure for storing operator set params for a given quorum. Specifically the \n     * `maxOperatorCount` is the maximum number of operators that can be registered for the quorum,\n     * `kickBIPsOfOperatorStake` is the basis points of a new operator needs to have of an operator they are trying to kick from the quorum,\n     * and `kickBIPsOfTotalStake` is the basis points of the total stake of the quorum that an operator needs to be below to be kicked.\n     */ \n     struct OperatorSetParam {\n        uint32 maxOperatorCount;\n        uint16 kickBIPsOfOperatorStake;\n        uint16 kickBIPsOfTotalStake;\n    }\n\n    /**\n     * @notice Data structure for the parameters needed to kick an operator from a quorum with number `quorumNumber`, used during registration churn.\n     * `operator` is the address of the operator to kick\n     */\n    struct OperatorKickParam {\n        uint8 quorumNumber;\n        address operator;\n    }\n\n    /// @notice Returns the operator set params for the given `quorumNumber`\n    function getOperatorSetParams(uint8 quorumNumber) external view returns (OperatorSetParam memory);\n    /// @notice the Stake registry contract that will keep track of operators' stakes\n    function stakeRegistry() external view returns (IStakeRegistry);\n    /// @notice the BLS Aggregate Pubkey Registry contract that will keep track of operators' BLS aggregate pubkeys per quorum\n    function blsApkRegistry() external view returns (IBLSApkRegistry);\n    /// @notice the index Registry contract that will keep track of operators' indexes\n    function indexRegistry() external view returns (IIndexRegistry);\n\n    /**\n     * @notice Ejects the provided operator from the provided quorums from the AVS\n     * @param operator is the operator to eject\n     * @param quorumNumbers are the quorum numbers to eject the operator from\n     */\n    function ejectOperator(\n        address operator, \n        bytes calldata quorumNumbers\n    ) external;\n\n    /// @notice Returns the number of quorums the registry coordinator has created\n    function quorumCount() external view returns (uint8);\n\n    /// @notice Returns the operator struct for the given `operator`\n    function getOperator(address operator) external view returns (OperatorInfo memory);\n\n    /// @notice Returns the operatorId for the given `operator`\n    function getOperatorId(address operator) external view returns (bytes32);\n\n    /// @notice Returns the operator address for the given `operatorId`\n    function getOperatorFromId(bytes32 operatorId) external view returns (address operator);\n\n    /// @notice Returns the status for the given `operator`\n    function getOperatorStatus(address operator) external view returns (IRegistryCoordinator.OperatorStatus);\n\n    /// @notice Returns the indices of the quorumBitmaps for the provided `operatorIds` at the given `blockNumber`\n    function getQuorumBitmapIndicesAtBlockNumber(uint32 blockNumber, bytes32[] memory operatorIds) external view returns (uint32[] memory);\n\n    /**\n     * @notice Returns the quorum bitmap for the given `operatorId` at the given `blockNumber` via the `index`\n     * @dev reverts if `index` is incorrect \n     */ \n    function getQuorumBitmapAtBlockNumberByIndex(bytes32 operatorId, uint32 blockNumber, uint256 index) external view returns (uint192);\n\n    /// @notice Returns the `index`th entry in the operator with `operatorId`'s bitmap history\n    function getQuorumBitmapUpdateByIndex(bytes32 operatorId, uint256 index) external view returns (QuorumBitmapUpdate memory);\n\n    /// @notice Returns the current quorum bitmap for the given `operatorId`\n    function getCurrentQuorumBitmap(bytes32 operatorId) external view returns (uint192);\n\n    /// @notice Returns the length of the quorum bitmap history for the given `operatorId`\n    function getQuorumBitmapHistoryLength(bytes32 operatorId) external view returns (uint256);\n\n    /// @notice Returns the registry at the desired index\n    function registries(uint256) external view returns (address);\n\n    /// @notice Returns the number of registries\n    function numRegistries() external view returns (uint256);\n\n    /**\n     * @notice Returns the message hash that an operator must sign to register their BLS public key.\n     * @param operator is the address of the operator registering their BLS public key\n     */\n    function pubkeyRegistrationMessageHash(address operator) external view returns (BN254.G1Point memory);\n\n    /// @notice returns the blocknumber the quorum was last updated all at once for all operators\n    function quorumUpdateBlockNumber(uint8 quorumNumber) external view returns (uint256);\n\n    /// @notice The owner of the registry coordinator\n    function owner() external view returns (address);\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/libraries/EIP1271SignatureUtils.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.8.12;\n\nimport \"@openzeppelin/contracts/interfaces/IERC1271.sol\";\nimport \"@openzeppelin/contracts/utils/Address.sol\";\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\n/**\n * @title Library of utilities for making EIP1271-compliant signature checks.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n */\nlibrary EIP1271SignatureUtils {\n    // bytes4(keccak256(\"isValidSignature(bytes32,bytes)\")\n    bytes4 internal constant EIP1271_MAGICVALUE = 0x1626ba7e;\n\n    /**\n     * @notice Checks @param signature is a valid signature of @param digestHash from @param signer.\n     * If the `signer` contains no code -- i.e. it is not (yet, at least) a contract address, then checks using standard ECDSA logic\n     * Otherwise, passes on the signature to the signer to verify the signature and checks that it returns the `EIP1271_MAGICVALUE`.\n     */\n    function checkSignature_EIP1271(address signer, bytes32 digestHash, bytes memory signature) internal view {\n        /**\n         * check validity of signature:\n         * 1) if `signer` is an EOA, then `signature` must be a valid ECDSA signature from `signer`,\n         * indicating their intention for this action\n         * 2) if `signer` is a contract, then `signature` must will be checked according to EIP-1271\n         */\n        if (Address.isContract(signer)) {\n            require(\n                IERC1271(signer).isValidSignature(digestHash, signature) == EIP1271_MAGICVALUE,\n                \"EIP1271SignatureUtils.checkSignature_EIP1271: ERC1271 signature verification failed\"\n            );\n        } else {\n            require(\n                ECDSA.recover(digestHash, signature) == signer,\n                \"EIP1271SignatureUtils.checkSignature_EIP1271: signature not from signer\"\n            );\n        }\n    }\n}\n"
      },
      "lib/eigenlayer-middleware/src/libraries/BitmapUtils.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity =0.8.12;\n\n/**\n * @title Library for Bitmap utilities such as converting between an array of bytes and a bitmap and finding the number of 1s in a bitmap.\n * @author Layr Labs, Inc.\n */\nlibrary BitmapUtils {\n    /**\n     * @notice Byte arrays are meant to contain unique bytes.\n     * If the array length exceeds 256, then it's impossible for all entries to be unique.\n     * This constant captures the max allowed array length (inclusive, i.e. 256 is allowed).\n     */\n    uint256 internal constant MAX_BYTE_ARRAY_LENGTH = 256;\n\n    /**\n     * @notice Converts an ordered array of bytes into a bitmap.\n     * @param orderedBytesArray The array of bytes to convert/compress into a bitmap. Must be in strictly ascending order.\n     * @return The resulting bitmap.\n     * @dev Each byte in the input is processed as indicating a single bit to flip in the bitmap.\n     * @dev This function will eventually revert in the event that the `orderedBytesArray` is not properly ordered (in ascending order).\n     * @dev This function will also revert if the `orderedBytesArray` input contains any duplicate entries (i.e. duplicate bytes).\n     */\n    function orderedBytesArrayToBitmap(bytes memory orderedBytesArray) internal pure returns (uint256) {\n        // sanity-check on input. a too-long input would fail later on due to having duplicate entry(s)\n        require(orderedBytesArray.length <= MAX_BYTE_ARRAY_LENGTH,\n            \"BitmapUtils.orderedBytesArrayToBitmap: orderedBytesArray is too long\");\n\n        // return empty bitmap early if length of array is 0\n        if (orderedBytesArray.length == 0) {\n            return uint256(0);\n        }\n\n        // initialize the empty bitmap, to be built inside the loop\n        uint256 bitmap;\n        // initialize an empty uint256 to be used as a bitmask inside the loop\n        uint256 bitMask;\n\n        // perform the 0-th loop iteration with the ordering check *omitted* (since it is unnecessary / will always pass)\n        // construct a single-bit mask from the numerical value of the 0th byte of the array, and immediately add it to the bitmap\n        bitmap = uint256(1 << uint8(orderedBytesArray[0]));\n\n        // loop through each byte in the array to construct the bitmap\n        for (uint256 i = 1; i < orderedBytesArray.length; ++i) {\n            // construct a single-bit mask from the numerical value of the next byte of the array\n            bitMask = uint256(1 << uint8(orderedBytesArray[i]));\n            // check strictly ascending array ordering by comparing the mask to the bitmap so far (revert if mask isn't greater than bitmap)\n            require(bitMask > bitmap, \"BitmapUtils.orderedBytesArrayToBitmap: orderedBytesArray is not ordered\");\n            // add the entry to the bitmap\n            bitmap = (bitmap | bitMask);\n        }\n        return bitmap;\n    }\n\n    /**\n     * @notice Converts an ordered byte array to a bitmap, validating that all bits are less than `bitUpperBound`\n     * @param orderedBytesArray The array to convert to a bitmap; must be in strictly ascending order\n     * @param bitUpperBound The exclusive largest bit. Each bit must be strictly less than this value.\n     * @dev Reverts if bitmap contains a bit greater than or equal to `bitUpperBound`\n     */\n    function orderedBytesArrayToBitmap(bytes memory orderedBytesArray, uint8 bitUpperBound) internal pure returns (uint256) {\n        uint256 bitmap = orderedBytesArrayToBitmap(orderedBytesArray);\n\n        require((1 << bitUpperBound) > bitmap, \n            \"BitmapUtils.orderedBytesArrayToBitmap: bitmap exceeds max value\"\n        );\n\n        return bitmap;\n    }\n\n    /**\n     * @notice Utility function for checking if a bytes array is strictly ordered, in ascending order.\n     * @param bytesArray the bytes array of interest\n     * @return Returns 'true' if the array is ordered in strictly ascending order, and 'false' otherwise.\n     * @dev This function returns 'true' for the edge case of the `bytesArray` having zero length.\n     * It also returns 'false' early for arrays with length in excess of MAX_BYTE_ARRAY_LENGTH (i.e. so long that they cannot be strictly ordered)\n     */\n    function isArrayStrictlyAscendingOrdered(bytes calldata bytesArray) internal pure returns (bool) {\n        // Return early if the array is too long, or has a length of 0\n        if (bytesArray.length > MAX_BYTE_ARRAY_LENGTH) {\n            return false;\n        }\n\n        if (bytesArray.length == 0) {\n            return true;\n        }\n\n        // Perform the 0-th loop iteration by pulling the 0th byte out of the array\n        bytes1 singleByte = bytesArray[0];\n\n        // For each byte, validate that each entry is *strictly greater than* the previous\n        // If it isn't, return false as the array is not ordered\n        for (uint256 i = 1; i < bytesArray.length; ++i) {\n            if (uint256(uint8(bytesArray[i])) <= uint256(uint8(singleByte))) {\n                return false;\n            }\n            \n            // Pull the next byte out of the array\n            singleByte = bytesArray[i];\n        }\n        \n        return true;\n    }\n\n    /**\n     * @notice Converts a bitmap into an array of bytes.\n     * @param bitmap The bitmap to decompress/convert to an array of bytes.\n     * @return bytesArray The resulting bitmap array of bytes.\n     * @dev Each byte in the input is processed as indicating a single bit to flip in the bitmap\n     */\n    function bitmapToBytesArray(uint256 bitmap) internal pure returns (bytes memory /*bytesArray*/) {\n        // initialize an empty uint256 to be used as a bitmask inside the loop\n        uint256 bitMask;\n        // allocate only the needed amount of memory\n        bytes memory bytesArray = new bytes(countNumOnes(bitmap));\n        // track the array index to assign to\n        uint256 arrayIndex = 0;\n        /**\n         * loop through each index in the bitmap to construct the array,\n         * but short-circuit the loop if we reach the number of ones and thus are done\n         * assigning to memory\n         */\n        for (uint256 i = 0; (arrayIndex < bytesArray.length) && (i < 256); ++i) {\n            // construct a single-bit mask for the i-th bit\n            bitMask = uint256(1 << i);\n            // check if the i-th bit is flipped in the bitmap\n            if (bitmap & bitMask != 0) {\n                // if the i-th bit is flipped, then add a byte encoding the value 'i' to the `bytesArray`\n                bytesArray[arrayIndex] = bytes1(uint8(i));\n                // increment the bytesArray slot since we've assigned one more byte of memory\n                unchecked{ ++arrayIndex; }\n            }\n        }\n        return bytesArray;\n    }\n\n    /// @return count number of ones in binary representation of `n`\n    function countNumOnes(uint256 n) internal pure returns (uint16) {\n        uint16 count = 0;\n        while (n > 0) {\n            n &= (n - 1); // Clear the least significant bit (turn off the rightmost set bit).\n            count++; // Increment the count for each cleared bit (each one encountered).\n        }\n        return count; // Return the total count of ones in the binary representation of n.\n    }\n\n    /// @notice Returns `true` if `bit` is in `bitmap`. Returns `false` otherwise.\n    function isSet(uint256 bitmap, uint8 bit) internal pure returns (bool) {\n        return 1 == ((bitmap >> bit) & 1);\n    }\n    \n    /**\n     * @notice Returns a copy of `bitmap` with `bit` set. \n     * @dev IMPORTANT: we're dealing with stack values here, so this doesn't modify\n     * the original bitmap. Using this correctly requires an assignment statement:\n     * `bitmap = bitmap.setBit(bit);`\n     */\n    function setBit(uint256 bitmap, uint8 bit) internal pure returns (uint256) {\n        return bitmap | (1 << bit);\n    }\n\n    /**\n     * @notice Returns true if `bitmap` has no set bits\n     */\n    function isEmpty(uint256 bitmap) internal pure returns (bool) {\n        return bitmap == 0;\n    }\n\n    /**\n     * @notice Returns true if `a` and `b` have no common set bits\n     */\n    function noBitsInCommon(uint256 a, uint256 b) internal pure returns (bool) {\n        return a & b == 0;\n    }\n\n    /**\n     * @notice Returns true if `a` is a subset of `b`: ALL of the bits in `a` are also in `b`\n     */\n    function isSubsetOf(uint256 a, uint256 b) internal pure returns (bool) {\n        return a & b == a;\n    }\n\n    /**\n     * @notice Returns a new bitmap that contains all bits set in either `a` or `b`\n     * @dev Result is the union of `a` and `b`\n     */\n    function plus(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a | b;\n    }\n\n    /**\n     * @notice Returns a new bitmap that clears all set bits of `b` from `a`\n     * @dev Negates `b` and returns the intersection of the result with `a`\n     */\n    function minus(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a & ~b;\n    }\n}"
      },
      "lib/eigenlayer-middleware/src/libraries/BN254.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// several functions are taken or adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol (MIT license):\n// Copyright 2017 Christian Reitwiessner\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n\n// The remainder of the code in this library is written by LayrLabs Inc. and is also under an MIT license\n\npragma solidity =0.8.12;\n\n/**\n * @title Library for operations on the BN254 elliptic curve.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice Contains BN254 parameters, common operations (addition, scalar mul, pairing), and BLS signature functionality.\n */\nlibrary BN254 {\n    // modulus for the underlying field F_p of the elliptic curve\n    uint256 internal constant FP_MODULUS =\n        21888242871839275222246405745257275088696311157297823662689037894645226208583;\n    // modulus for the underlying field F_r of the elliptic curve\n    uint256 internal constant FR_MODULUS =\n        21888242871839275222246405745257275088548364400416034343698204186575808495617;\n\n    struct G1Point {\n        uint256 X;\n        uint256 Y;\n    }\n\n    // Encoding of field elements is: X[1] * i + X[0]\n    struct G2Point {\n        uint256[2] X;\n        uint256[2] Y;\n    }\n\n    function generatorG1() internal pure returns (G1Point memory) {\n        return G1Point(1, 2);\n    }\n\n    // generator of group G2\n    /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1).\n    uint256 internal constant G2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n    uint256 internal constant G2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n    uint256 internal constant G2y1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;\n    uint256 internal constant G2y0 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;\n\n    /// @notice returns the G2 generator\n    /// @dev mind the ordering of the 1s and 0s!\n    ///      this is because of the (unknown to us) convention used in the bn254 pairing precompile contract\n    ///      \"Elements a * i + b of F_p^2 are encoded as two elements of F_p, (a, b).\"\n    ///      https://github.com/ethereum/EIPs/blob/master/EIPS/eip-197.md#encoding\n    function generatorG2() internal pure returns (G2Point memory) {\n        return G2Point([G2x1, G2x0], [G2y1, G2y0]);\n    }\n\n    // negation of the generator of group G2\n    /// @dev Generator point in F_q2 is of the form: (x0 + ix1, y0 + iy1).\n    uint256 internal constant nG2x1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;\n    uint256 internal constant nG2x0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;\n    uint256 internal constant nG2y1 = 17805874995975841540914202342111839520379459829704422454583296818431106115052;\n    uint256 internal constant nG2y0 = 13392588948715843804641432497768002650278120570034223513918757245338268106653;\n\n    function negGeneratorG2() internal pure returns (G2Point memory) {\n        return G2Point([nG2x1, nG2x0], [nG2y1, nG2y0]);\n    }\n\n    bytes32 internal constant powersOfTauMerkleRoot =\n        0x22c998e49752bbb1918ba87d6d59dd0e83620a311ba91dd4b2cc84990b31b56f;\n\n    /**\n     * @param p Some point in G1.\n     * @return The negation of `p`, i.e. p.plus(p.negate()) should be zero.\n     */\n    function negate(G1Point memory p) internal pure returns (G1Point memory) {\n        // The prime q in the base field F_q for G1\n        if (p.X == 0 && p.Y == 0) {\n            return G1Point(0, 0);\n        } else {\n            return G1Point(p.X, FP_MODULUS - (p.Y % FP_MODULUS));\n        }\n    }\n\n    /**\n     * @return r the sum of two points of G1\n     */\n    function plus(G1Point memory p1, G1Point memory p2) internal view returns (G1Point memory r) {\n        uint256[4] memory input;\n        input[0] = p1.X;\n        input[1] = p1.Y;\n        input[2] = p2.X;\n        input[3] = p2.Y;\n        bool success;\n\n        // solium-disable-next-line security/no-inline-assembly\n        assembly {\n            success := staticcall(sub(gas(), 2000), 6, input, 0x80, r, 0x40)\n            // Use \"invalid\" to make gas estimation work\n            switch success\n            case 0 {\n                invalid()\n            }\n        }\n\n        require(success, \"ec-add-failed\");\n    }\n\n    /**\n     * @notice an optimized ecMul implementation that takes O(log_2(s)) ecAdds\n     * @param p the point to multiply\n     * @param s the scalar to multiply by\n     * @dev this function is only safe to use if the scalar is 9 bits or less\n     */ \n    function scalar_mul_tiny(BN254.G1Point memory p, uint16 s) internal view returns (BN254.G1Point memory) {\n        require(s < 2**9, \"scalar-too-large\");\n\n        // if s is 1 return p\n        if(s == 1) {\n            return p;\n        }\n\n        // the accumulated product to return\n        BN254.G1Point memory acc = BN254.G1Point(0, 0);\n        // the 2^n*p to add to the accumulated product in each iteration\n        BN254.G1Point memory p2n = p;\n        // value of most significant bit\n        uint16 m = 1;\n        // index of most significant bit\n        uint8 i = 0;\n\n        //loop until we reach the most significant bit\n        while(s >= m){\n            unchecked {\n                // if the  current bit is 1, add the 2^n*p to the accumulated product\n                if ((s >> i) & 1 == 1) {\n                    acc = plus(acc, p2n);\n                }\n                // double the 2^n*p for the next iteration\n                p2n = plus(p2n, p2n);\n\n                // increment the index and double the value of the most significant bit\n                m <<= 1;\n                ++i;\n            }\n        }\n        \n        // return the accumulated product\n        return acc;\n    }\n\n    /**\n     * @return r the product of a point on G1 and a scalar, i.e.\n     *         p == p.scalar_mul(1) and p.plus(p) == p.scalar_mul(2) for all\n     *         points p.\n     */\n    function scalar_mul(G1Point memory p, uint256 s) internal view returns (G1Point memory r) {\n        uint256[3] memory input;\n        input[0] = p.X;\n        input[1] = p.Y;\n        input[2] = s;\n        bool success;\n        // solium-disable-next-line security/no-inline-assembly\n        assembly {\n            success := staticcall(sub(gas(), 2000), 7, input, 0x60, r, 0x40)\n            // Use \"invalid\" to make gas estimation work\n            switch success\n            case 0 {\n                invalid()\n            }\n        }\n        require(success, \"ec-mul-failed\");\n    }\n\n    /**\n     *  @return The result of computing the pairing check\n     *         e(p1[0], p2[0]) *  .... * e(p1[n], p2[n]) == 1\n     *         For example,\n     *         pairing([P1(), P1().negate()], [P2(), P2()]) should return true.\n     */\n    function pairing(\n        G1Point memory a1,\n        G2Point memory a2,\n        G1Point memory b1,\n        G2Point memory b2\n    ) internal view returns (bool) {\n        G1Point[2] memory p1 = [a1, b1];\n        G2Point[2] memory p2 = [a2, b2];\n\n        uint256[12] memory input;\n\n        for (uint256 i = 0; i < 2; i++) {\n            uint256 j = i * 6;\n            input[j + 0] = p1[i].X;\n            input[j + 1] = p1[i].Y;\n            input[j + 2] = p2[i].X[0];\n            input[j + 3] = p2[i].X[1];\n            input[j + 4] = p2[i].Y[0];\n            input[j + 5] = p2[i].Y[1];\n        }\n\n        uint256[1] memory out;\n        bool success;\n\n        // solium-disable-next-line security/no-inline-assembly\n        assembly {\n            success := staticcall(sub(gas(), 2000), 8, input, mul(12, 0x20), out, 0x20)\n            // Use \"invalid\" to make gas estimation work\n            switch success\n            case 0 {\n                invalid()\n            }\n        }\n\n        require(success, \"pairing-opcode-failed\");\n\n        return out[0] != 0;\n    }\n\n    /**\n     * @notice This function is functionally the same as pairing(), however it specifies a gas limit\n     *         the user can set, as a precompile may use the entire gas budget if it reverts.\n     */\n    function safePairing(\n        G1Point memory a1,\n        G2Point memory a2,\n        G1Point memory b1,\n        G2Point memory b2,\n        uint256 pairingGas\n    ) internal view returns (bool, bool) {\n        G1Point[2] memory p1 = [a1, b1];\n        G2Point[2] memory p2 = [a2, b2];\n\n        uint256[12] memory input;\n\n        for (uint256 i = 0; i < 2; i++) {\n            uint256 j = i * 6;\n            input[j + 0] = p1[i].X;\n            input[j + 1] = p1[i].Y;\n            input[j + 2] = p2[i].X[0];\n            input[j + 3] = p2[i].X[1];\n            input[j + 4] = p2[i].Y[0];\n            input[j + 5] = p2[i].Y[1];\n        }\n\n        uint256[1] memory out;\n        bool success;\n\n        // solium-disable-next-line security/no-inline-assembly\n        assembly {\n            success := staticcall(pairingGas, 8, input, mul(12, 0x20), out, 0x20)\n        }\n\n        //Out is the output of the pairing precompile, either 0 or 1 based on whether the two pairings are equal.\n        //Success is true if the precompile actually goes through (aka all inputs are valid)\n\n        return (success, out[0] != 0);\n    }\n\n    /// @return hashedG1 the keccak256 hash of the G1 Point\n    /// @dev used for BLS signatures\n    function hashG1Point(BN254.G1Point memory pk) internal pure returns (bytes32 hashedG1) {\n        assembly {\n            mstore(0, mload(pk))\n            mstore(0x20, mload(add(0x20, pk)))\n            hashedG1 := keccak256(0, 0x40)\n        }\n    }\n\n    /// @return the keccak256 hash of the G2 Point\n    /// @dev used for BLS signatures\n    function hashG2Point(\n        BN254.G2Point memory pk\n    ) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(pk.X[0], pk.X[1], pk.Y[0], pk.Y[1]));\n    }\n\n    /**\n     * @notice adapted from https://github.com/HarryR/solcrypto/blob/master/contracts/altbn128.sol\n     */\n    function hashToG1(bytes32 _x) internal view returns (G1Point memory) {\n        uint256 beta = 0;\n        uint256 y = 0;\n\n        uint256 x = uint256(_x) % FP_MODULUS;\n\n        while (true) {\n            (beta, y) = findYFromX(x);\n\n            // y^2 == beta\n            if( beta == mulmod(y, y, FP_MODULUS) ) {\n                return G1Point(x, y);\n            }\n\n            x = addmod(x, 1, FP_MODULUS);\n        }\n        return G1Point(0, 0);\n    }\n\n    /**\n     * Given X, find Y\n     *\n     *   where y = sqrt(x^3 + b)\n     *\n     * Returns: (x^3 + b), y\n     */\n    function findYFromX(uint256 x) internal view returns (uint256, uint256) {\n        // beta = (x^3 + b) % p\n        uint256 beta = addmod(mulmod(mulmod(x, x, FP_MODULUS), x, FP_MODULUS), 3, FP_MODULUS);\n\n        // y^2 = x^3 + b\n        // this acts like: y = sqrt(beta) = beta^((p+1) / 4)\n        uint256 y = expMod(beta, 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52, FP_MODULUS);\n\n        return (beta, y);\n    }\n\n    function expMod(uint256 _base, uint256 _exponent, uint256 _modulus) internal view returns (uint256 retval) {\n        bool success;\n        uint256[1] memory output;\n        uint[6] memory input;\n        input[0] = 0x20; // baseLen = new(big.Int).SetBytes(getData(input, 0, 32))\n        input[1] = 0x20; // expLen  = new(big.Int).SetBytes(getData(input, 32, 32))\n        input[2] = 0x20; // modLen  = new(big.Int).SetBytes(getData(input, 64, 32))\n        input[3] = _base;\n        input[4] = _exponent;\n        input[5] = _modulus;\n        assembly {\n            success := staticcall(sub(gas(), 2000), 5, input, 0xc0, output, 0x20)\n            // Use \"invalid\" to make gas estimation work\n            switch success\n            case 0 {\n                invalid()\n            }\n        }\n        require(success, \"BN254.expMod: call failure\");\n        return output[0];\n    }\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    function __Ownable_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable_init_unchained() internal onlyInitializing {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions anymore. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby removing any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\n        );\n        _initialized = 1;\n        if (isTopLevelCall) {\n            _initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            _initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n     * initialization step. This is essential to configure modules that are added through upgrades and that require\n     * initialization.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n        _initialized = version;\n        _initializing = true;\n        _;\n        _initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     */\n    function _disableInitializers() internal virtual {\n        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized < type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/cryptography/draft-EIP712.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n    /* solhint-disable var-name-mixedcase */\n    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n    // invalidate the cached domain separator if the chain id changes.\n    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n    uint256 private immutable _CACHED_CHAIN_ID;\n    address private immutable _CACHED_THIS;\n\n    bytes32 private immutable _HASHED_NAME;\n    bytes32 private immutable _HASHED_VERSION;\n    bytes32 private immutable _TYPE_HASH;\n\n    /* solhint-enable var-name-mixedcase */\n\n    /**\n     * @dev Initializes the domain separator and parameter caches.\n     *\n     * The meaning of `name` and `version` is specified in\n     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n     *\n     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n     * - `version`: the current major version of the signing domain.\n     *\n     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n     * contract upgrade].\n     */\n    constructor(string memory name, string memory version) {\n        bytes32 hashedName = keccak256(bytes(name));\n        bytes32 hashedVersion = keccak256(bytes(version));\n        bytes32 typeHash = keccak256(\n            \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n        );\n        _HASHED_NAME = hashedName;\n        _HASHED_VERSION = hashedVersion;\n        _CACHED_CHAIN_ID = block.chainid;\n        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n        _CACHED_THIS = address(this);\n        _TYPE_HASH = typeHash;\n    }\n\n    /**\n     * @dev Returns the domain separator for the current chain.\n     */\n    function _domainSeparatorV4() internal view returns (bytes32) {\n        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n            return _CACHED_DOMAIN_SEPARATOR;\n        } else {\n            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n        }\n    }\n\n    function _buildDomainSeparator(\n        bytes32 typeHash,\n        bytes32 nameHash,\n        bytes32 versionHash\n    ) private view returns (bytes32) {\n        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n    }\n\n    /**\n     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n     * function returns the hash of the fully encoded EIP712 message for this domain.\n     *\n     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n     *\n     * ```solidity\n     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n     *     keccak256(\"Mail(address to,string contents)\"),\n     *     mailTo,\n     *     keccak256(bytes(mailContents))\n     * )));\n     * address signer = ECDSA.recover(digest, signature);\n     * ```\n     */\n    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n    }\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/permissions/Pausable.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity =0.8.12;\n\nimport \"../interfaces/IPausable.sol\";\n\n/**\n * @title Adds pausability to a contract, with pausing & unpausing controlled by the `pauser` and `unpauser` of a PauserRegistry contract.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice Contracts that inherit from this contract may define their own `pause` and `unpause` (and/or related) functions.\n * These functions should be permissioned as \"onlyPauser\" which defers to a `PauserRegistry` for determining access control.\n * @dev Pausability is implemented using a uint256, which allows up to 256 different single bit-flags; each bit can potentially pause different functionality.\n * Inspiration for this was taken from the NearBridge design here https://etherscan.io/address/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873#code.\n * For the `pause` and `unpause` functions we've implemented, if you pause, you can only flip (any number of) switches to on/1 (aka \"paused\"), and if you unpause,\n * you can only flip (any number of) switches to off/0 (aka \"paused\").\n * If you want a pauseXYZ function that just flips a single bit / \"pausing flag\", it will:\n * 1) 'bit-wise and' (aka `&`) a flag with the current paused state (as a uint256)\n * 2) update the paused state to this new value\n * @dev We note as well that we have chosen to identify flags by their *bit index* as opposed to their numerical value, so, e.g. defining `DEPOSITS_PAUSED = 3`\n * indicates specifically that if the *third bit* of `_paused` is flipped -- i.e. it is a '1' -- then deposits should be paused\n */\ncontract Pausable is IPausable {\n    /// @notice Address of the `PauserRegistry` contract that this contract defers to for determining access control (for pausing).\n    IPauserRegistry public pauserRegistry;\n\n    /// @dev whether or not the contract is currently paused\n    uint256 private _paused;\n\n    uint256 internal constant UNPAUSE_ALL = 0;\n    uint256 internal constant PAUSE_ALL = type(uint256).max;\n\n    /// @notice\n    modifier onlyPauser() {\n        require(pauserRegistry.isPauser(msg.sender), \"msg.sender is not permissioned as pauser\");\n        _;\n    }\n\n    modifier onlyUnpauser() {\n        require(msg.sender == pauserRegistry.unpauser(), \"msg.sender is not permissioned as unpauser\");\n        _;\n    }\n\n    /// @notice Throws if the contract is paused, i.e. if any of the bits in `_paused` is flipped to 1.\n    modifier whenNotPaused() {\n        require(_paused == 0, \"Pausable: contract is paused\");\n        _;\n    }\n\n    /// @notice Throws if the `indexed`th bit of `_paused` is 1, i.e. if the `index`th pause switch is flipped.\n    modifier onlyWhenNotPaused(uint8 index) {\n        require(!paused(index), \"Pausable: index is paused\");\n        _;\n    }\n\n    /// @notice One-time function for setting the `pauserRegistry` and initializing the value of `_paused`.\n    function _initializePauser(IPauserRegistry _pauserRegistry, uint256 initPausedStatus) internal {\n        require(\n            address(pauserRegistry) == address(0) && address(_pauserRegistry) != address(0),\n            \"Pausable._initializePauser: _initializePauser() can only be called once\"\n        );\n        _paused = initPausedStatus;\n        emit Paused(msg.sender, initPausedStatus);\n        _setPauserRegistry(_pauserRegistry);\n    }\n\n    /**\n     * @notice This function is used to pause an EigenLayer contract's functionality.\n     * It is permissioned to the `pauser` address, which is expected to be a low threshold multisig.\n     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.\n     * @dev This function can only pause functionality, and thus cannot 'unflip' any bit in `_paused` from 1 to 0.\n     */\n    function pause(uint256 newPausedStatus) external onlyPauser {\n        // verify that the `newPausedStatus` does not *unflip* any bits (i.e. doesn't unpause anything, all 1 bits remain)\n        require((_paused & newPausedStatus) == _paused, \"Pausable.pause: invalid attempt to unpause functionality\");\n        _paused = newPausedStatus;\n        emit Paused(msg.sender, newPausedStatus);\n    }\n\n    /**\n     * @notice Alias for `pause(type(uint256).max)`.\n     */\n    function pauseAll() external onlyPauser {\n        _paused = type(uint256).max;\n        emit Paused(msg.sender, type(uint256).max);\n    }\n\n    /**\n     * @notice This function is used to unpause an EigenLayer contract's functionality.\n     * It is permissioned to the `unpauser` address, which is expected to be a high threshold multisig or governance contract.\n     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.\n     * @dev This function can only unpause functionality, and thus cannot 'flip' any bit in `_paused` from 0 to 1.\n     */\n    function unpause(uint256 newPausedStatus) external onlyUnpauser {\n        // verify that the `newPausedStatus` does not *flip* any bits (i.e. doesn't pause anything, all 0 bits remain)\n        require(\n            ((~_paused) & (~newPausedStatus)) == (~_paused),\n            \"Pausable.unpause: invalid attempt to pause functionality\"\n        );\n        _paused = newPausedStatus;\n        emit Unpaused(msg.sender, newPausedStatus);\n    }\n\n    /// @notice Returns the current paused status as a uint256.\n    function paused() public view virtual returns (uint256) {\n        return _paused;\n    }\n\n    /// @notice Returns 'true' if the `indexed`th bit of `_paused` is 1, and 'false' otherwise\n    function paused(uint8 index) public view virtual returns (bool) {\n        uint256 mask = 1 << index;\n        return ((_paused & mask) == mask);\n    }\n\n    /// @notice Allows the unpauser to set a new pauser registry\n    function setPauserRegistry(IPauserRegistry newPauserRegistry) external onlyUnpauser {\n        _setPauserRegistry(newPauserRegistry);\n    }\n\n    /// internal function for setting pauser registry\n    function _setPauserRegistry(IPauserRegistry newPauserRegistry) internal {\n        require(\n            address(newPauserRegistry) != address(0),\n            \"Pausable._setPauserRegistry: newPauserRegistry cannot be the zero address\"\n        );\n        emit PauserRegistrySet(pauserRegistry, newPauserRegistry);\n        pauserRegistry = newPauserRegistry;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[48] private __gap;\n}\n"
      },
      "lib/eigenlayer-middleware/src/RegistryCoordinatorStorage.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity =0.8.12;\n\nimport {IBLSApkRegistry} from \"./interfaces/IBLSApkRegistry.sol\";\nimport {IStakeRegistry} from \"./interfaces/IStakeRegistry.sol\";\nimport {IIndexRegistry} from \"./interfaces/IIndexRegistry.sol\";\nimport {IServiceManager} from \"./interfaces/IServiceManager.sol\";\nimport {IRegistryCoordinator} from \"./interfaces/IRegistryCoordinator.sol\";\n\nabstract contract RegistryCoordinatorStorage is IRegistryCoordinator {\n\n    /*******************************************************************************\n                               CONSTANTS AND IMMUTABLES \n    *******************************************************************************/\n\n    /// @notice The EIP-712 typehash for the `DelegationApproval` struct used by the contract\n    bytes32 public constant OPERATOR_CHURN_APPROVAL_TYPEHASH =\n        keccak256(\"OperatorChurnApproval(address registeringOperator,bytes32 registeringOperatorId,OperatorKickParam[] operatorKickParams,bytes32 salt,uint256 expiry)OperatorKickParam(uint8 quorumNumber,address operator)\");\n    /// @notice The EIP-712 typehash used for registering BLS public keys\n    bytes32 public constant PUBKEY_REGISTRATION_TYPEHASH = keccak256(\"BN254PubkeyRegistration(address operator)\");\n    /// @notice The maximum value of a quorum bitmap\n    uint256 internal constant MAX_QUORUM_BITMAP = type(uint192).max;\n    /// @notice The basis point denominator\n    uint16 internal constant BIPS_DENOMINATOR = 10000;\n    /// @notice Index for flag that pauses operator registration\n    uint8 internal constant PAUSED_REGISTER_OPERATOR = 0;\n    /// @notice Index for flag that pauses operator deregistration\n    uint8 internal constant PAUSED_DEREGISTER_OPERATOR = 1;\n    /// @notice Index for flag pausing operator stake updates\n    uint8 internal constant PAUSED_UPDATE_OPERATOR = 2;\n    /// @notice The maximum number of quorums this contract supports\n    uint8 internal constant MAX_QUORUM_COUNT = 192;\n\n    /// @notice the ServiceManager for this AVS, which forwards calls onto EigenLayer's core contracts\n    IServiceManager public immutable serviceManager;\n    /// @notice the BLS Aggregate Pubkey Registry contract that will keep track of operators' aggregate BLS public keys per quorum\n    IBLSApkRegistry public immutable blsApkRegistry;\n    /// @notice the Stake Registry contract that will keep track of operators' stakes\n    IStakeRegistry public immutable stakeRegistry;\n    /// @notice the Index Registry contract that will keep track of operators' indexes\n    IIndexRegistry public immutable indexRegistry;\n\n    /*******************************************************************************\n                                       STATE \n    *******************************************************************************/\n\n    /// @notice the current number of quorums supported by the registry coordinator\n    uint8 public quorumCount;\n    /// @notice maps quorum number => operator cap and kick params\n    mapping(uint8 => OperatorSetParam) internal _quorumParams;\n    /// @notice maps operator id => historical quorums they registered for\n    mapping(bytes32 => QuorumBitmapUpdate[]) internal _operatorBitmapHistory;\n    /// @notice maps operator address => operator id and status\n    mapping(address => OperatorInfo) internal _operatorInfo;\n    /// @notice whether the salt has been used for an operator churn approval\n    mapping(bytes32 => bool) public isChurnApproverSaltUsed;\n    /// @notice mapping from quorum number to the latest block that all quorums were updated all at once\n    mapping(uint8 => uint256) public quorumUpdateBlockNumber;\n\n    /// @notice the dynamic-length array of the registries this coordinator is coordinating\n    address[] public registries;\n    /// @notice the address of the entity allowed to sign off on operators getting kicked out of the AVS during registration\n    address public churnApprover;\n    /// @notice the address of the entity allowed to eject operators from the AVS\n    address public ejector;\n\n    constructor(\n        IServiceManager _serviceManager,\n        IStakeRegistry _stakeRegistry,\n        IBLSApkRegistry _blsApkRegistry,\n        IIndexRegistry _indexRegistry\n    ) {\n        serviceManager = _serviceManager;\n        stakeRegistry = _stakeRegistry;\n        blsApkRegistry = _blsApkRegistry;\n        indexRegistry = _indexRegistry;\n    }\n\n    // storage gap for upgradeability\n    // slither-disable-next-line shadowing-state\n    uint256[41] private __GAP;\n}"
      },
      "lib/eigenlayer-middleware/src/interfaces/IRegistry.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\n/**\n * @title Minimal interface for a `Registry`-type contract.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice Functions related to the registration process itself have been intentionally excluded\n * because their function signatures may vary significantly.\n */\ninterface IRegistry {\n    function registryCoordinator() external view returns (address);\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport \"./IStrategy.sol\";\nimport \"./ISignatureUtils.sol\";\nimport \"./IStrategyManager.sol\";\n\n/**\n * @title DelegationManager\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice  This is the contract for delegation in EigenLayer. The main functionalities of this contract are\n * - enabling anyone to register as an operator in EigenLayer\n * - allowing operators to specify parameters related to stakers who delegate to them\n * - enabling any staker to delegate its stake to the operator of its choice (a given staker can only delegate to a single operator at a time)\n * - enabling a staker to undelegate its assets from the operator it is delegated to (performed as part of the withdrawal process, initiated through the StrategyManager)\n */\ninterface IDelegationManager is ISignatureUtils {\n    // @notice Struct used for storing information about a single operator who has registered with EigenLayer\n    struct OperatorDetails {\n        // @notice address to receive the rewards that the operator earns via serving applications built on EigenLayer.\n        address earningsReceiver;\n        /**\n         * @notice Address to verify signatures when a staker wishes to delegate to the operator, as well as controlling \"forced undelegations\".\n         * @dev Signature verification follows these rules:\n         * 1) If this address is left as address(0), then any staker will be free to delegate to the operator, i.e. no signature verification will be performed.\n         * 2) If this address is an EOA (i.e. it has no code), then we follow standard ECDSA signature verification for delegations to the operator.\n         * 3) If this address is a contract (i.e. it has code) then we forward a call to the contract and verify that it returns the correct EIP-1271 \"magic value\".\n         */\n        address delegationApprover;\n        /**\n         * @notice A minimum delay -- measured in blocks -- enforced between:\n         * 1) the operator signalling their intent to register for a service, via calling `Slasher.optIntoSlashing`\n         * and\n         * 2) the operator completing registration for the service, via the service ultimately calling `Slasher.recordFirstStakeUpdate`\n         * @dev note that for a specific operator, this value *cannot decrease*, i.e. if the operator wishes to modify their OperatorDetails,\n         * then they are only allowed to either increase this value or keep it the same.\n         */\n        uint32 stakerOptOutWindowBlocks;\n    }\n\n    /**\n     * @notice Abstract struct used in calculating an EIP712 signature for a staker to approve that they (the staker themselves) delegate to a specific operator.\n     * @dev Used in computing the `STAKER_DELEGATION_TYPEHASH` and as a reference in the computation of the stakerDigestHash in the `delegateToBySignature` function.\n     */\n    struct StakerDelegation {\n        // the staker who is delegating\n        address staker;\n        // the operator being delegated to\n        address operator;\n        // the staker's nonce\n        uint256 nonce;\n        // the expiration timestamp (UTC) of the signature\n        uint256 expiry;\n    }\n\n    /**\n     * @notice Abstract struct used in calculating an EIP712 signature for an operator's delegationApprover to approve that a specific staker delegate to the operator.\n     * @dev Used in computing the `DELEGATION_APPROVAL_TYPEHASH` and as a reference in the computation of the approverDigestHash in the `_delegate` function.\n     */\n    struct DelegationApproval {\n        // the staker who is delegating\n        address staker;\n        // the operator being delegated to\n        address operator;\n        // the operator's provided salt\n        bytes32 salt;\n        // the expiration timestamp (UTC) of the signature\n        uint256 expiry;\n    }\n\n    /**\n     * Struct type used to specify an existing queued withdrawal. Rather than storing the entire struct, only a hash is stored.\n     * In functions that operate on existing queued withdrawals -- e.g. completeQueuedWithdrawal`, the data is resubmitted and the hash of the submitted\n     * data is computed by `calculateWithdrawalRoot` and checked against the stored hash in order to confirm the integrity of the submitted data.\n     */\n    struct Withdrawal {\n        // The address that originated the Withdrawal\n        address staker;\n        // The address that the staker was delegated to at the time that the Withdrawal was created\n        address delegatedTo;\n        // The address that can complete the Withdrawal + will receive funds when completing the withdrawal\n        address withdrawer;\n        // Nonce used to guarantee that otherwise identical withdrawals have unique hashes\n        uint256 nonce;\n        // Block number when the Withdrawal was created\n        uint32 startBlock;\n        // Array of strategies that the Withdrawal contains\n        IStrategy[] strategies;\n        // Array containing the amount of shares in each Strategy in the `strategies` array\n        uint256[] shares;\n    }\n\n    struct QueuedWithdrawalParams {\n        // Array of strategies that the QueuedWithdrawal contains\n        IStrategy[] strategies;\n        // Array containing the amount of shares in each Strategy in the `strategies` array\n        uint256[] shares;\n        // The address of the withdrawer\n        address withdrawer;\n    }\n\n    // @notice Emitted when a new operator registers in EigenLayer and provides their OperatorDetails.\n    event OperatorRegistered(address indexed operator, OperatorDetails operatorDetails);\n\n    /// @notice Emitted when an operator updates their OperatorDetails to @param newOperatorDetails\n    event OperatorDetailsModified(address indexed operator, OperatorDetails newOperatorDetails);\n\n    /**\n     * @notice Emitted when @param operator indicates that they are updating their MetadataURI string\n     * @dev Note that these strings are *never stored in storage* and are instead purely emitted in events for off-chain indexing\n     */\n    event OperatorMetadataURIUpdated(address indexed operator, string metadataURI);\n\n    /// @notice Emitted whenever an operator's shares are increased for a given strategy. Note that shares is the delta in the operator's shares.\n    event OperatorSharesIncreased(address indexed operator, address staker, IStrategy strategy, uint256 shares);\n\n    /// @notice Emitted whenever an operator's shares are decreased for a given strategy. Note that shares is the delta in the operator's shares.\n    event OperatorSharesDecreased(address indexed operator, address staker, IStrategy strategy, uint256 shares);\n\n    /// @notice Emitted when @param staker delegates to @param operator.\n    event StakerDelegated(address indexed staker, address indexed operator);\n\n    /// @notice Emitted when @param staker undelegates from @param operator.\n    event StakerUndelegated(address indexed staker, address indexed operator);\n\n    /// @notice Emitted when @param staker is undelegated via a call not originating from the staker themself\n    event StakerForceUndelegated(address indexed staker, address indexed operator);\n\n    /**\n     * @notice Emitted when a new withdrawal is queued.\n     * @param withdrawalRoot Is the hash of the `withdrawal`.\n     * @param withdrawal Is the withdrawal itself.\n     */\n    event WithdrawalQueued(bytes32 withdrawalRoot, Withdrawal withdrawal);\n\n    /// @notice Emitted when a queued withdrawal is completed\n    event WithdrawalCompleted(bytes32 withdrawalRoot);\n\n    /// @notice Emitted when a queued withdrawal is *migrated* from the StrategyManager to the DelegationManager\n    event WithdrawalMigrated(bytes32 oldWithdrawalRoot, bytes32 newWithdrawalRoot);\n    \n    /// @notice Emitted when the `minWithdrawalDelayBlocks` variable is modified from `previousValue` to `newValue`.\n    event MinWithdrawalDelayBlocksSet(uint256 previousValue, uint256 newValue);\n\n    /// @notice Emitted when the `strategyWithdrawalDelayBlocks` variable is modified from `previousValue` to `newValue`.\n    event StrategyWithdrawalDelayBlocksSet(IStrategy strategy, uint256 previousValue, uint256 newValue);\n\n    /**\n     * @notice Registers the caller as an operator in EigenLayer.\n     * @param registeringOperatorDetails is the `OperatorDetails` for the operator.\n     * @param metadataURI is a URI for the operator's metadata, i.e. a link providing more details on the operator.\n     *\n     * @dev Once an operator is registered, they cannot 'deregister' as an operator, and they will forever be considered \"delegated to themself\".\n     * @dev This function will revert if the caller attempts to set their `earningsReceiver` to address(0).\n     * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event\n     */\n    function registerAsOperator(\n        OperatorDetails calldata registeringOperatorDetails,\n        string calldata metadataURI\n    ) external;\n\n    /**\n     * @notice Updates an operator's stored `OperatorDetails`.\n     * @param newOperatorDetails is the updated `OperatorDetails` for the operator, to replace their current OperatorDetails`.\n     *\n     * @dev The caller must have previously registered as an operator in EigenLayer.\n     * @dev This function will revert if the caller attempts to set their `earningsReceiver` to address(0).\n     */\n    function modifyOperatorDetails(OperatorDetails calldata newOperatorDetails) external;\n\n    /**\n     * @notice Called by an operator to emit an `OperatorMetadataURIUpdated` event indicating the information has updated.\n     * @param metadataURI The URI for metadata associated with an operator\n     * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `OperatorMetadataURIUpdated` event\n     */\n    function updateOperatorMetadataURI(string calldata metadataURI) external;\n\n    /**\n     * @notice Caller delegates their stake to an operator.\n     * @param operator The account (`msg.sender`) is delegating its assets to for use in serving applications built on EigenLayer.\n     * @param approverSignatureAndExpiry Verifies the operator approves of this delegation\n     * @param approverSalt A unique single use value tied to an individual signature.\n     * @dev The approverSignatureAndExpiry is used in the event that:\n     *          1) the operator's `delegationApprover` address is set to a non-zero value.\n     *                  AND\n     *          2) neither the operator nor their `delegationApprover` is the `msg.sender`, since in the event that the operator\n     *             or their delegationApprover is the `msg.sender`, then approval is assumed.\n     * @dev In the event that `approverSignatureAndExpiry` is not checked, its content is ignored entirely; it's recommended to use an empty input\n     * in this case to save on complexity + gas costs\n     */\n    function delegateTo(\n        address operator,\n        SignatureWithExpiry memory approverSignatureAndExpiry,\n        bytes32 approverSalt\n    ) external;\n\n    /**\n     * @notice Caller delegates a staker's stake to an operator with valid signatures from both parties.\n     * @param staker The account delegating stake to an `operator` account\n     * @param operator The account (`staker`) is delegating its assets to for use in serving applications built on EigenLayer.\n     * @param stakerSignatureAndExpiry Signed data from the staker authorizing delegating stake to an operator\n     * @param approverSignatureAndExpiry is a parameter that will be used for verifying that the operator approves of this delegation action in the event that:\n     * @param approverSalt Is a salt used to help guarantee signature uniqueness. Each salt can only be used once by a given approver.\n     *\n     * @dev If `staker` is an EOA, then `stakerSignature` is verified to be a valid ECDSA stakerSignature from `staker`, indicating their intention for this action.\n     * @dev If `staker` is a contract, then `stakerSignature` will be checked according to EIP-1271.\n     * @dev the operator's `delegationApprover` address is set to a non-zero value.\n     * @dev neither the operator nor their `delegationApprover` is the `msg.sender`, since in the event that the operator or their delegationApprover\n     * is the `msg.sender`, then approval is assumed.\n     * @dev This function will revert if the current `block.timestamp` is equal to or exceeds the expiry\n     * @dev In the case that `approverSignatureAndExpiry` is not checked, its content is ignored entirely; it's recommended to use an empty input\n     * in this case to save on complexity + gas costs\n     */\n    function delegateToBySignature(\n        address staker,\n        address operator,\n        SignatureWithExpiry memory stakerSignatureAndExpiry,\n        SignatureWithExpiry memory approverSignatureAndExpiry,\n        bytes32 approverSalt\n    ) external;\n\n    /**\n     * @notice Undelegates the staker from the operator who they are delegated to. Puts the staker into the \"undelegation limbo\" mode of the EigenPodManager\n     * and queues a withdrawal of all of the staker's shares in the StrategyManager (to the staker), if necessary.\n     * @param staker The account to be undelegated.\n     * @return withdrawalRoot The root of the newly queued withdrawal, if a withdrawal was queued. Otherwise just bytes32(0).\n     *\n     * @dev Reverts if the `staker` is also an operator, since operators are not allowed to undelegate from themselves.\n     * @dev Reverts if the caller is not the staker, nor the operator who the staker is delegated to, nor the operator's specified \"delegationApprover\"\n     * @dev Reverts if the `staker` is already undelegated.\n     */\n    function undelegate(address staker) external returns (bytes32[] memory withdrawalRoot);\n\n    /**\n     * Allows a staker to withdraw some shares. Withdrawn shares/strategies are immediately removed\n     * from the staker. If the staker is delegated, withdrawn shares/strategies are also removed from\n     * their operator.\n     *\n     * All withdrawn shares/strategies are placed in a queue and can be fully withdrawn after a delay.\n     */\n    function queueWithdrawals(\n        QueuedWithdrawalParams[] calldata queuedWithdrawalParams\n    ) external returns (bytes32[] memory);\n\n    /**\n     * @notice Used to complete the specified `withdrawal`. The caller must match `withdrawal.withdrawer`\n     * @param withdrawal The Withdrawal to complete.\n     * @param tokens Array in which the i-th entry specifies the `token` input to the 'withdraw' function of the i-th Strategy in the `withdrawal.strategies` array.\n     * This input can be provided with zero length if `receiveAsTokens` is set to 'false' (since in that case, this input will be unused)\n     * @param middlewareTimesIndex is the index in the operator that the staker who triggered the withdrawal was delegated to's middleware times array\n     * @param receiveAsTokens If true, the shares specified in the withdrawal will be withdrawn from the specified strategies themselves\n     * and sent to the caller, through calls to `withdrawal.strategies[i].withdraw`. If false, then the shares in the specified strategies\n     * will simply be transferred to the caller directly.\n     * @dev middlewareTimesIndex should be calculated off chain before calling this function by finding the first index that satisfies `slasher.canWithdraw`\n     * @dev beaconChainETHStrategy shares are non-transferrable, so if `receiveAsTokens = false` and `withdrawal.withdrawer != withdrawal.staker`, note that\n     * any beaconChainETHStrategy shares in the `withdrawal` will be _returned to the staker_, rather than transferred to the withdrawer, unlike shares in\n     * any other strategies, which will be transferred to the withdrawer.\n     */\n    function completeQueuedWithdrawal(\n        Withdrawal calldata withdrawal,\n        IERC20[] calldata tokens,\n        uint256 middlewareTimesIndex,\n        bool receiveAsTokens\n    ) external;\n\n    /**\n     * @notice Array-ified version of `completeQueuedWithdrawal`.\n     * Used to complete the specified `withdrawals`. The function caller must match `withdrawals[...].withdrawer`\n     * @param withdrawals The Withdrawals to complete.\n     * @param tokens Array of tokens for each Withdrawal. See `completeQueuedWithdrawal` for the usage of a single array.\n     * @param middlewareTimesIndexes One index to reference per Withdrawal. See `completeQueuedWithdrawal` for the usage of a single index.\n     * @param receiveAsTokens Whether or not to complete each withdrawal as tokens. See `completeQueuedWithdrawal` for the usage of a single boolean.\n     * @dev See `completeQueuedWithdrawal` for relevant dev tags\n     */\n    function completeQueuedWithdrawals(\n        Withdrawal[] calldata withdrawals,\n        IERC20[][] calldata tokens,\n        uint256[] calldata middlewareTimesIndexes,\n        bool[] calldata receiveAsTokens\n    ) external;\n\n    /**\n     * @notice Increases a staker's delegated share balance in a strategy.\n     * @param staker The address to increase the delegated shares for their operator.\n     * @param strategy The strategy in which to increase the delegated shares.\n     * @param shares The number of shares to increase.\n     *\n     * @dev *If the staker is actively delegated*, then increases the `staker`'s delegated shares in `strategy` by `shares`. Otherwise does nothing.\n     * @dev Callable only by the StrategyManager or EigenPodManager.\n     */\n    function increaseDelegatedShares(\n        address staker,\n        IStrategy strategy,\n        uint256 shares\n    ) external;\n\n    /**\n     * @notice Decreases a staker's delegated share balance in a strategy.\n     * @param staker The address to increase the delegated shares for their operator.\n     * @param strategy The strategy in which to decrease the delegated shares.\n     * @param shares The number of shares to decrease.\n     *\n     * @dev *If the staker is actively delegated*, then decreases the `staker`'s delegated shares in `strategy` by `shares`. Otherwise does nothing.\n     * @dev Callable only by the StrategyManager or EigenPodManager.\n     */\n    function decreaseDelegatedShares(\n        address staker,\n        IStrategy strategy,\n        uint256 shares\n    ) external;\n\n    /**\n     * @notice returns the address of the operator that `staker` is delegated to.\n     * @notice Mapping: staker => operator whom the staker is currently delegated to.\n     * @dev Note that returning address(0) indicates that the staker is not actively delegated to any operator.\n     */\n    function delegatedTo(address staker) external view returns (address);\n\n    /**\n     * @notice Returns the OperatorDetails struct associated with an `operator`.\n     */\n    function operatorDetails(address operator) external view returns (OperatorDetails memory);\n\n    /*\n     * @notice Returns the earnings receiver address for an operator\n     */\n    function earningsReceiver(address operator) external view returns (address);\n\n    /**\n     * @notice Returns the delegationApprover account for an operator\n     */\n    function delegationApprover(address operator) external view returns (address);\n\n    /**\n     * @notice Returns the stakerOptOutWindowBlocks for an operator\n     */\n    function stakerOptOutWindowBlocks(address operator) external view returns (uint256);\n\n    /**\n     * @notice Given array of strategies, returns array of shares for the operator\n     */\n    function getOperatorShares(\n        address operator,\n        IStrategy[] memory strategies\n    ) external view returns (uint256[] memory);\n\n    /**\n     * @notice Given a list of strategies, return the minimum number of blocks that must pass to withdraw\n     * from all the inputted strategies. Return value is >= minWithdrawalDelayBlocks as this is the global min withdrawal delay.\n     * @param strategies The strategies to check withdrawal delays for\n     */\n    function getWithdrawalDelay(IStrategy[] calldata strategies) external view returns (uint256);\n\n    /**\n     * @notice returns the total number of shares in `strategy` that are delegated to `operator`.\n     * @notice Mapping: operator => strategy => total number of shares in the strategy delegated to the operator.\n     * @dev By design, the following invariant should hold for each Strategy:\n     * (operator's shares in delegation manager) = sum (shares above zero of all stakers delegated to operator)\n     * = sum (delegateable shares of all stakers delegated to the operator)\n     */\n    function operatorShares(address operator, IStrategy strategy) external view returns (uint256);\n\n    /**\n     * @notice Returns 'true' if `staker` *is* actively delegated, and 'false' otherwise.\n     */\n    function isDelegated(address staker) external view returns (bool);\n\n    /**\n     * @notice Returns true is an operator has previously registered for delegation.\n     */\n    function isOperator(address operator) external view returns (bool);\n\n    /// @notice Mapping: staker => number of signed delegation nonces (used in `delegateToBySignature`) from the staker that the contract has already checked\n    function stakerNonce(address staker) external view returns (uint256);\n\n    /**\n     * @notice Mapping: delegationApprover => 32-byte salt => whether or not the salt has already been used by the delegationApprover.\n     * @dev Salts are used in the `delegateTo` and `delegateToBySignature` functions. Note that these functions only process the delegationApprover's\n     * signature + the provided salt if the operator being delegated to has specified a nonzero address as their `delegationApprover`.\n     */\n    function delegationApproverSaltIsSpent(address _delegationApprover, bytes32 salt) external view returns (bool);\n\n    /**\n     * @notice Minimum delay enforced by this contract for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner,\n     * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced).\n     * Note that strategies each have a separate withdrawal delay, which can be greater than this value. So the minimum number of blocks that must pass\n     * to withdraw a strategy is MAX(minWithdrawalDelayBlocks, strategyWithdrawalDelayBlocks[strategy])\n     */\n    function minWithdrawalDelayBlocks() external view returns (uint256);\n\n    /**\n     * @notice Minimum delay enforced by this contract per Strategy for completing queued withdrawals. Measured in blocks, and adjustable by this contract's owner,\n     * up to a maximum of `MAX_WITHDRAWAL_DELAY_BLOCKS`. Minimum value is 0 (i.e. no delay enforced).\n     */\n    function strategyWithdrawalDelayBlocks(IStrategy strategy) external view returns (uint256);\n\n    /**\n     * @notice Calculates the digestHash for a `staker` to sign to delegate to an `operator`\n     * @param staker The signing staker\n     * @param operator The operator who is being delegated to\n     * @param expiry The desired expiry time of the staker's signature\n     */\n    function calculateCurrentStakerDelegationDigestHash(\n        address staker,\n        address operator,\n        uint256 expiry\n    ) external view returns (bytes32);\n\n    /**\n     * @notice Calculates the digest hash to be signed and used in the `delegateToBySignature` function\n     * @param staker The signing staker\n     * @param _stakerNonce The nonce of the staker. In practice we use the staker's current nonce, stored at `stakerNonce[staker]`\n     * @param operator The operator who is being delegated to\n     * @param expiry The desired expiry time of the staker's signature\n     */\n    function calculateStakerDelegationDigestHash(\n        address staker,\n        uint256 _stakerNonce,\n        address operator,\n        uint256 expiry\n    ) external view returns (bytes32);\n\n    /**\n     * @notice Calculates the digest hash to be signed by the operator's delegationApprove and used in the `delegateTo` and `delegateToBySignature` functions.\n     * @param staker The account delegating their stake\n     * @param operator The account receiving delegated stake\n     * @param _delegationApprover the operator's `delegationApprover` who will be signing the delegationHash (in general)\n     * @param approverSalt A unique and single use value associated with the approver signature.\n     * @param expiry Time after which the approver's signature becomes invalid\n     */\n    function calculateDelegationApprovalDigestHash(\n        address staker,\n        address operator,\n        address _delegationApprover,\n        bytes32 approverSalt,\n        uint256 expiry\n    ) external view returns (bytes32);\n\n    /// @notice The EIP-712 typehash for the contract's domain\n    function DOMAIN_TYPEHASH() external view returns (bytes32);\n\n    /// @notice The EIP-712 typehash for the StakerDelegation struct used by the contract\n    function STAKER_DELEGATION_TYPEHASH() external view returns (bytes32);\n\n    /// @notice The EIP-712 typehash for the DelegationApproval struct used by the contract\n    function DELEGATION_APPROVAL_TYPEHASH() external view returns (bytes32);\n\n    /**\n     * @notice Getter function for the current EIP-712 domain separator for this contract.\n     *\n     * @dev The domain separator will change in the event of a fork that changes the ChainID.\n     * @dev By introducing a domain separator the DApp developers are guaranteed that there can be no signature collision.\n     * for more detailed information please read EIP-712.\n     */\n    function domainSeparator() external view returns (bytes32);\n    \n    /// @notice Mapping: staker => cumulative number of queued withdrawals they have ever initiated.\n    /// @dev This only increments (doesn't decrement), and is used to help ensure that otherwise identical withdrawals have unique hashes.\n    function cumulativeWithdrawalsQueued(address staker) external view returns (uint256);\n\n    /// @notice Returns the keccak256 hash of `withdrawal`.\n    function calculateWithdrawalRoot(Withdrawal memory withdrawal) external pure returns (bytes32);\n\n    function migrateQueuedWithdrawals(IStrategyManager.DeprecatedStruct_QueuedWithdrawal[] memory withdrawalsToQueue) external;\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IStrategy.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title Minimal interface for an `Strategy` contract.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice Custom `Strategy` implementations may expand extensively on this interface.\n */\ninterface IStrategy {\n    /**\n     * @notice Used to deposit tokens into this Strategy\n     * @param token is the ERC20 token being deposited\n     * @param amount is the amount of token being deposited\n     * @dev This function is only callable by the strategyManager contract. It is invoked inside of the strategyManager's\n     * `depositIntoStrategy` function, and individual share balances are recorded in the strategyManager as well.\n     * @return newShares is the number of new shares issued at the current exchange ratio.\n     */\n    function deposit(IERC20 token, uint256 amount) external returns (uint256);\n\n    /**\n     * @notice Used to withdraw tokens from this Strategy, to the `recipient`'s address\n     * @param recipient is the address to receive the withdrawn funds\n     * @param token is the ERC20 token being transferred out\n     * @param amountShares is the amount of shares being withdrawn\n     * @dev This function is only callable by the strategyManager contract. It is invoked inside of the strategyManager's\n     * other functions, and individual share balances are recorded in the strategyManager as well.\n     */\n    function withdraw(address recipient, IERC20 token, uint256 amountShares) external;\n\n    /**\n     * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy.\n     * @notice In contrast to `sharesToUnderlyingView`, this function **may** make state modifications\n     * @param amountShares is the amount of shares to calculate its conversion into the underlying token\n     * @return The amount of underlying tokens corresponding to the input `amountShares`\n     * @dev Implementation for these functions in particular may vary significantly for different strategies\n     */\n    function sharesToUnderlying(uint256 amountShares) external returns (uint256);\n\n    /**\n     * @notice Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy.\n     * @notice In contrast to `underlyingToSharesView`, this function **may** make state modifications\n     * @param amountUnderlying is the amount of `underlyingToken` to calculate its conversion into strategy shares\n     * @return The amount of underlying tokens corresponding to the input `amountShares`\n     * @dev Implementation for these functions in particular may vary significantly for different strategies\n     */\n    function underlyingToShares(uint256 amountUnderlying) external returns (uint256);\n\n    /**\n     * @notice convenience function for fetching the current underlying value of all of the `user`'s shares in\n     * this strategy. In contrast to `userUnderlyingView`, this function **may** make state modifications\n     */\n    function userUnderlying(address user) external returns (uint256);\n\n    /**\n     * @notice convenience function for fetching the current total shares of `user` in this strategy, by\n     * querying the `strategyManager` contract\n     */\n    function shares(address user) external view returns (uint256);\n\n    /**\n     * @notice Used to convert a number of shares to the equivalent amount of underlying tokens for this strategy.\n     * @notice In contrast to `sharesToUnderlying`, this function guarantees no state modifications\n     * @param amountShares is the amount of shares to calculate its conversion into the underlying token\n     * @return The amount of shares corresponding to the input `amountUnderlying`\n     * @dev Implementation for these functions in particular may vary significantly for different strategies\n     */\n    function sharesToUnderlyingView(uint256 amountShares) external view returns (uint256);\n\n    /**\n     * @notice Used to convert an amount of underlying tokens to the equivalent amount of shares in this strategy.\n     * @notice In contrast to `underlyingToShares`, this function guarantees no state modifications\n     * @param amountUnderlying is the amount of `underlyingToken` to calculate its conversion into strategy shares\n     * @return The amount of shares corresponding to the input `amountUnderlying`\n     * @dev Implementation for these functions in particular may vary significantly for different strategies\n     */\n    function underlyingToSharesView(uint256 amountUnderlying) external view returns (uint256);\n\n    /**\n     * @notice convenience function for fetching the current underlying value of all of the `user`'s shares in\n     * this strategy. In contrast to `userUnderlying`, this function guarantees no state modifications\n     */\n    function userUnderlyingView(address user) external view returns (uint256);\n\n    /// @notice The underlying token for shares in this Strategy\n    function underlyingToken() external view returns (IERC20);\n\n    /// @notice The total number of extant shares in this Strategy\n    function totalShares() external view returns (uint256);\n\n    /// @notice Returns either a brief string explaining the strategy's goal & purpose, or a link to metadata that explains in more detail.\n    function explanation() external view returns (string memory);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/interfaces/IERC1271.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271 {\n    /**\n     * @dev Should return whether the signature provided is valid for the provided data\n     * @param hash      Hash of the data to be signed\n     * @param signature Signature byte array associated with _data\n     */\n    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(isContract(target), \"Address: delegate call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n                /// @solidity memory-safe-assembly\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n    enum RecoverError {\n        NoError,\n        InvalidSignature,\n        InvalidSignatureLength,\n        InvalidSignatureS,\n        InvalidSignatureV\n    }\n\n    function _throwError(RecoverError error) private pure {\n        if (error == RecoverError.NoError) {\n            return; // no error: do nothing\n        } else if (error == RecoverError.InvalidSignature) {\n            revert(\"ECDSA: invalid signature\");\n        } else if (error == RecoverError.InvalidSignatureLength) {\n            revert(\"ECDSA: invalid signature length\");\n        } else if (error == RecoverError.InvalidSignatureS) {\n            revert(\"ECDSA: invalid signature 's' value\");\n        } else if (error == RecoverError.InvalidSignatureV) {\n            revert(\"ECDSA: invalid signature 'v' value\");\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature` or error string. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     *\n     * Documentation for signature generation:\n     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n        // Check the signature length\n        // - case 65: r,s,v signature (standard)\n        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n        if (signature.length == 65) {\n            bytes32 r;\n            bytes32 s;\n            uint8 v;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            /// @solidity memory-safe-assembly\n            assembly {\n                r := mload(add(signature, 0x20))\n                s := mload(add(signature, 0x40))\n                v := byte(0, mload(add(signature, 0x60)))\n            }\n            return tryRecover(hash, v, r, s);\n        } else if (signature.length == 64) {\n            bytes32 r;\n            bytes32 vs;\n            // ecrecover takes the signature parameters, and the only way to get them\n            // currently is to use assembly.\n            /// @solidity memory-safe-assembly\n            assembly {\n                r := mload(add(signature, 0x20))\n                vs := mload(add(signature, 0x40))\n            }\n            return tryRecover(hash, r, vs);\n        } else {\n            return (address(0), RecoverError.InvalidSignatureLength);\n        }\n    }\n\n    /**\n     * @dev Returns the address that signed a hashed message (`hash`) with\n     * `signature`. This address can then be used for verification purposes.\n     *\n     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n     * this function rejects them by requiring the `s` value to be in the lower\n     * half order, and the `v` value to be either 27 or 28.\n     *\n     * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n     * verification to be secure: it is possible to craft signatures that\n     * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n     * this is by receiving a hash of the original message (which may otherwise\n     * be too long), and then calling {toEthSignedMessageHash} on it.\n     */\n    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, signature);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n     *\n     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address, RecoverError) {\n        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n        uint8 v = uint8((uint256(vs) >> 255) + 27);\n        return tryRecover(hash, v, r, s);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n     *\n     * _Available since v4.2._\n     */\n    function recover(\n        bytes32 hash,\n        bytes32 r,\n        bytes32 vs\n    ) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     *\n     * _Available since v4.3._\n     */\n    function tryRecover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address, RecoverError) {\n        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n        // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n        //\n        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n        // these malleable signatures as well.\n        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n            return (address(0), RecoverError.InvalidSignatureS);\n        }\n        if (v != 27 && v != 28) {\n            return (address(0), RecoverError.InvalidSignatureV);\n        }\n\n        // If the signature is valid (and not malleable), return the signer address\n        address signer = ecrecover(hash, v, r, s);\n        if (signer == address(0)) {\n            return (address(0), RecoverError.InvalidSignature);\n        }\n\n        return (signer, RecoverError.NoError);\n    }\n\n    /**\n     * @dev Overload of {ECDSA-recover} that receives the `v`,\n     * `r` and `s` signature fields separately.\n     */\n    function recover(\n        bytes32 hash,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal pure returns (address) {\n        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n        _throwError(error);\n        return recovered;\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n        // 32 is the length in bytes of hash,\n        // enforced by the type signature above\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Message, created from `s`. This\n     * produces hash corresponding to the one signed with the\n     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n     * JSON-RPC method as part of EIP-191.\n     *\n     * See {recover}.\n     */\n    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n    }\n\n    /**\n     * @dev Returns an Ethereum Signed Typed Data, created from a\n     * `domainSeparator` and a `structHash`. This produces hash corresponding\n     * to the one signed with the\n     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n     * JSON-RPC method as part of EIP-712.\n     *\n     * See {recover}.\n     */\n    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n        return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n    }\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/utils/ContextUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "lib/openzeppelin-contracts-upgradeable/contracts/utils/AddressUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n                /// @solidity memory-safe-assembly\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IPausable.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport \"../interfaces/IPauserRegistry.sol\";\n\n/**\n * @title Adds pausability to a contract, with pausing & unpausing controlled by the `pauser` and `unpauser` of a PauserRegistry contract.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice Contracts that inherit from this contract may define their own `pause` and `unpause` (and/or related) functions.\n * These functions should be permissioned as \"onlyPauser\" which defers to a `PauserRegistry` for determining access control.\n * @dev Pausability is implemented using a uint256, which allows up to 256 different single bit-flags; each bit can potentially pause different functionality.\n * Inspiration for this was taken from the NearBridge design here https://etherscan.io/address/0x3FEFc5A4B1c02f21cBc8D3613643ba0635b9a873#code.\n * For the `pause` and `unpause` functions we've implemented, if you pause, you can only flip (any number of) switches to on/1 (aka \"paused\"), and if you unpause,\n * you can only flip (any number of) switches to off/0 (aka \"paused\").\n * If you want a pauseXYZ function that just flips a single bit / \"pausing flag\", it will:\n * 1) 'bit-wise and' (aka `&`) a flag with the current paused state (as a uint256)\n * 2) update the paused state to this new value\n * @dev We note as well that we have chosen to identify flags by their *bit index* as opposed to their numerical value, so, e.g. defining `DEPOSITS_PAUSED = 3`\n * indicates specifically that if the *third bit* of `_paused` is flipped -- i.e. it is a '1' -- then deposits should be paused\n */\n\ninterface IPausable {\n    /// @notice Emitted when the `pauserRegistry` is set to `newPauserRegistry`.\n    event PauserRegistrySet(IPauserRegistry pauserRegistry, IPauserRegistry newPauserRegistry);\n\n    /// @notice Emitted when the pause is triggered by `account`, and changed to `newPausedStatus`.\n    event Paused(address indexed account, uint256 newPausedStatus);\n\n    /// @notice Emitted when the pause is lifted by `account`, and changed to `newPausedStatus`.\n    event Unpaused(address indexed account, uint256 newPausedStatus);\n    \n    /// @notice Address of the `PauserRegistry` contract that this contract defers to for determining access control (for pausing).\n    function pauserRegistry() external view returns (IPauserRegistry);\n\n    /**\n     * @notice This function is used to pause an EigenLayer contract's functionality.\n     * It is permissioned to the `pauser` address, which is expected to be a low threshold multisig.\n     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.\n     * @dev This function can only pause functionality, and thus cannot 'unflip' any bit in `_paused` from 1 to 0.\n     */\n    function pause(uint256 newPausedStatus) external;\n\n    /**\n     * @notice Alias for `pause(type(uint256).max)`.\n     */\n    function pauseAll() external;\n\n    /**\n     * @notice This function is used to unpause an EigenLayer contract's functionality.\n     * It is permissioned to the `unpauser` address, which is expected to be a high threshold multisig or governance contract.\n     * @param newPausedStatus represents the new value for `_paused` to take, which means it may flip several bits at once.\n     * @dev This function can only unpause functionality, and thus cannot 'flip' any bit in `_paused` from 0 to 1.\n     */\n    function unpause(uint256 newPausedStatus) external;\n\n    /// @notice Returns the current paused status as a uint256.\n    function paused() external view returns (uint256);\n\n    /// @notice Returns 'true' if the `indexed`th bit of `_paused` is 1, and 'false' otherwise\n    function paused(uint8 index) external view returns (bool);\n\n    /// @notice Allows the unpauser to set a new pauser registry\n    function setPauserRegistry(IPauserRegistry newPauserRegistry) external;\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport \"./IStrategy.sol\";\nimport \"./ISlasher.sol\";\nimport \"./IDelegationManager.sol\";\nimport \"./IEigenPodManager.sol\";\n\n/**\n * @title Interface for the primary entrypoint for funds into EigenLayer.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice See the `StrategyManager` contract itself for implementation details.\n */\ninterface IStrategyManager {\n    /**\n     * @notice Emitted when a new deposit occurs on behalf of `staker`.\n     * @param staker Is the staker who is depositing funds into EigenLayer.\n     * @param strategy Is the strategy that `staker` has deposited into.\n     * @param token Is the token that `staker` deposited.\n     * @param shares Is the number of new shares `staker` has been granted in `strategy`.\n     */\n    event Deposit(address staker, IERC20 token, IStrategy strategy, uint256 shares);\n\n    /// @notice Emitted when `thirdPartyTransfersForbidden` is updated for a strategy and value by the owner\n    event UpdatedThirdPartyTransfersForbidden(IStrategy strategy, bool value);\n\n    /// @notice Emitted when the `strategyWhitelister` is changed\n    event StrategyWhitelisterChanged(address previousAddress, address newAddress);\n\n    /// @notice Emitted when a strategy is added to the approved list of strategies for deposit\n    event StrategyAddedToDepositWhitelist(IStrategy strategy);\n\n    /// @notice Emitted when a strategy is removed from the approved list of strategies for deposit\n    event StrategyRemovedFromDepositWhitelist(IStrategy strategy);\n\n    /**\n     * @notice Deposits `amount` of `token` into the specified `strategy`, with the resultant shares credited to `msg.sender`\n     * @param strategy is the specified strategy where deposit is to be made,\n     * @param token is the denomination in which the deposit is to be made,\n     * @param amount is the amount of token to be deposited in the strategy by the staker\n     * @return shares The amount of new shares in the `strategy` created as part of the action.\n     * @dev The `msg.sender` must have previously approved this contract to transfer at least `amount` of `token` on their behalf.\n     * @dev Cannot be called by an address that is 'frozen' (this function will revert if the `msg.sender` is frozen).\n     *\n     * WARNING: Depositing tokens that allow reentrancy (eg. ERC-777) into a strategy is not recommended.  This can lead to attack vectors\n     *          where the token balance and corresponding strategy shares are not in sync upon reentrancy.\n     */\n    function depositIntoStrategy(IStrategy strategy, IERC20 token, uint256 amount) external returns (uint256 shares);\n\n    /**\n     * @notice Used for depositing an asset into the specified strategy with the resultant shares credited to `staker`,\n     * who must sign off on the action.\n     * Note that the assets are transferred out/from the `msg.sender`, not from the `staker`; this function is explicitly designed\n     * purely to help one address deposit 'for' another.\n     * @param strategy is the specified strategy where deposit is to be made,\n     * @param token is the denomination in which the deposit is to be made,\n     * @param amount is the amount of token to be deposited in the strategy by the staker\n     * @param staker the staker that the deposited assets will be credited to\n     * @param expiry the timestamp at which the signature expires\n     * @param signature is a valid signature from the `staker`. either an ECDSA signature if the `staker` is an EOA, or data to forward\n     * following EIP-1271 if the `staker` is a contract\n     * @return shares The amount of new shares in the `strategy` created as part of the action.\n     * @dev The `msg.sender` must have previously approved this contract to transfer at least `amount` of `token` on their behalf.\n     * @dev A signature is required for this function to eliminate the possibility of griefing attacks, specifically those\n     * targeting stakers who may be attempting to undelegate.\n     * @dev Cannot be called if thirdPartyTransfersForbidden is set to true for this strategy\n     *\n     *  WARNING: Depositing tokens that allow reentrancy (eg. ERC-777) into a strategy is not recommended.  This can lead to attack vectors\n     *          where the token balance and corresponding strategy shares are not in sync upon reentrancy\n     */\n    function depositIntoStrategyWithSignature(\n        IStrategy strategy,\n        IERC20 token,\n        uint256 amount,\n        address staker,\n        uint256 expiry,\n        bytes memory signature\n    ) external returns (uint256 shares);\n\n    /// @notice Used by the DelegationManager to remove a Staker's shares from a particular strategy when entering the withdrawal queue\n    function removeShares(address staker, IStrategy strategy, uint256 shares) external;\n\n    /// @notice Used by the DelegationManager to award a Staker some shares that have passed through the withdrawal queue\n    function addShares(address staker, IERC20 token, IStrategy strategy, uint256 shares) external;\n    \n    /// @notice Used by the DelegationManager to convert withdrawn shares to tokens and send them to a recipient\n    function withdrawSharesAsTokens(address recipient, IStrategy strategy, uint256 shares, IERC20 token) external;\n\n    /// @notice Returns the current shares of `user` in `strategy`\n    function stakerStrategyShares(address user, IStrategy strategy) external view returns (uint256 shares);\n\n    /**\n     * @notice Get all details on the staker's deposits and corresponding shares\n     * @return (staker's strategies, shares in these strategies)\n     */\n    function getDeposits(address staker) external view returns (IStrategy[] memory, uint256[] memory);\n\n    /// @notice Simple getter function that returns `stakerStrategyList[staker].length`.\n    function stakerStrategyListLength(address staker) external view returns (uint256);\n\n    /**\n     * @notice Owner-only function that adds the provided Strategies to the 'whitelist' of strategies that stakers can deposit into\n     * @param strategiesToWhitelist Strategies that will be added to the `strategyIsWhitelistedForDeposit` mapping (if they aren't in it already)\n     * @param thirdPartyTransfersForbiddenValues bool values to set `thirdPartyTransfersForbidden` to for each strategy\n     */\n    function addStrategiesToDepositWhitelist(\n        IStrategy[] calldata strategiesToWhitelist,\n        bool[] calldata thirdPartyTransfersForbiddenValues\n    ) external;\n\n    /**\n     * @notice Owner-only function that removes the provided Strategies from the 'whitelist' of strategies that stakers can deposit into\n     * @param strategiesToRemoveFromWhitelist Strategies that will be removed to the `strategyIsWhitelistedForDeposit` mapping (if they are in it)\n     */\n    function removeStrategiesFromDepositWhitelist(IStrategy[] calldata strategiesToRemoveFromWhitelist) external;\n\n    /// @notice Returns the single, central Delegation contract of EigenLayer\n    function delegation() external view returns (IDelegationManager);\n\n    /// @notice Returns the single, central Slasher contract of EigenLayer\n    function slasher() external view returns (ISlasher);\n\n    /// @notice Returns the EigenPodManager contract of EigenLayer\n    function eigenPodManager() external view returns (IEigenPodManager);\n\n    /// @notice Returns the address of the `strategyWhitelister`\n    function strategyWhitelister() external view returns (address);\n\n    /**\n     * @notice Returns bool for whether or not `strategy` enables credit transfers. i.e enabling\n     * depositIntoStrategyWithSignature calls or queueing withdrawals to a different address than the staker.\n     */\n    function thirdPartyTransfersForbidden(IStrategy strategy) external view returns (bool);\n\n// LIMITED BACKWARDS-COMPATIBILITY FOR DEPRECATED FUNCTIONALITY\n    // packed struct for queued withdrawals; helps deal with stack-too-deep errors\n    struct DeprecatedStruct_WithdrawerAndNonce {\n        address withdrawer;\n        uint96 nonce;\n    }\n\n    /**\n     * Struct type used to specify an existing queued withdrawal. Rather than storing the entire struct, only a hash is stored.\n     * In functions that operate on existing queued withdrawals -- e.g. `startQueuedWithdrawalWaitingPeriod` or `completeQueuedWithdrawal`,\n     * the data is resubmitted and the hash of the submitted data is computed by `calculateWithdrawalRoot` and checked against the\n     * stored hash in order to confirm the integrity of the submitted data.\n     */\n    struct DeprecatedStruct_QueuedWithdrawal {\n        IStrategy[] strategies;\n        uint256[] shares;\n        address staker;\n        DeprecatedStruct_WithdrawerAndNonce withdrawerAndNonce;\n        uint32 withdrawalStartBlock;\n        address delegatedAddress;\n    }\n\n    function migrateQueuedWithdrawal(DeprecatedStruct_QueuedWithdrawal memory queuedWithdrawal) external returns (bool, bytes32);\n\n    function calculateWithdrawalRoot(DeprecatedStruct_QueuedWithdrawal memory queuedWithdrawal) external pure returns (bytes32);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/Strings.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n    bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n    uint8 private constant _ADDRESS_LENGTH = 20;\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        // Inspired by OraclizeAPI's implementation - MIT licence\n        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n        if (value == 0) {\n            return \"0\";\n        }\n        uint256 temp = value;\n        uint256 digits;\n        while (temp != 0) {\n            digits++;\n            temp /= 10;\n        }\n        bytes memory buffer = new bytes(digits);\n        while (value != 0) {\n            digits -= 1;\n            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n            value /= 10;\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        if (value == 0) {\n            return \"0x00\";\n        }\n        uint256 temp = value;\n        uint256 length = 0;\n        while (temp != 0) {\n            length++;\n            temp >>= 8;\n        }\n        return toHexString(value, length);\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _HEX_SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n     */\n    function toHexString(address addr) internal pure returns (string memory) {\n        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n    }\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/ISlasher.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport \"./IStrategyManager.sol\";\nimport \"./IDelegationManager.sol\";\n\n/**\n * @title Interface for the primary 'slashing' contract for EigenLayer.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice See the `Slasher` contract itself for implementation details.\n */\ninterface ISlasher {\n    // struct used to store information about the current state of an operator's obligations to middlewares they are serving\n    struct MiddlewareTimes {\n        // The update block for the middleware whose most recent update was earliest, i.e. the 'stalest' update out of all middlewares the operator is serving\n        uint32 stalestUpdateBlock;\n        // The latest 'serveUntilBlock' from all of the middleware that the operator is serving\n        uint32 latestServeUntilBlock;\n    }\n\n    // struct used to store details relevant to a single middleware that an operator has opted-in to serving\n    struct MiddlewareDetails {\n        // the block at which the contract begins being able to finalize the operator's registration with the service via calling `recordFirstStakeUpdate`\n        uint32 registrationMayBeginAtBlock;\n        // the block before which the contract is allowed to slash the user\n        uint32 contractCanSlashOperatorUntilBlock;\n        // the block at which the middleware's view of the operator's stake was most recently updated\n        uint32 latestUpdateBlock;\n    }\n\n    /// @notice Emitted when a middleware times is added to `operator`'s array.\n    event MiddlewareTimesAdded(\n        address operator,\n        uint256 index,\n        uint32 stalestUpdateBlock,\n        uint32 latestServeUntilBlock\n    );\n\n    /// @notice Emitted when `operator` begins to allow `contractAddress` to slash them.\n    event OptedIntoSlashing(address indexed operator, address indexed contractAddress);\n\n    /// @notice Emitted when `contractAddress` signals that it will no longer be able to slash `operator` after the `contractCanSlashOperatorUntilBlock`.\n    event SlashingAbilityRevoked(\n        address indexed operator,\n        address indexed contractAddress,\n        uint32 contractCanSlashOperatorUntilBlock\n    );\n\n    /**\n     * @notice Emitted when `slashingContract` 'freezes' the `slashedOperator`.\n     * @dev The `slashingContract` must have permission to slash the `slashedOperator`, i.e. `canSlash(slasherOperator, slashingContract)` must return 'true'.\n     */\n    event OperatorFrozen(address indexed slashedOperator, address indexed slashingContract);\n\n    /// @notice Emitted when `previouslySlashedAddress` is 'unfrozen', allowing them to again move deposited funds within EigenLayer.\n    event FrozenStatusReset(address indexed previouslySlashedAddress);\n\n    /**\n     * @notice Gives the `contractAddress` permission to slash the funds of the caller.\n     * @dev Typically, this function must be called prior to registering for a middleware.\n     */\n    function optIntoSlashing(address contractAddress) external;\n\n    /**\n     * @notice Used for 'slashing' a certain operator.\n     * @param toBeFrozen The operator to be frozen.\n     * @dev Technically the operator is 'frozen' (hence the name of this function), and then subject to slashing pending a decision by a human-in-the-loop.\n     * @dev The operator must have previously given the caller (which should be a contract) the ability to slash them, through a call to `optIntoSlashing`.\n     */\n    function freezeOperator(address toBeFrozen) external;\n\n    /**\n     * @notice Removes the 'frozen' status from each of the `frozenAddresses`\n     * @dev Callable only by the contract owner (i.e. governance).\n     */\n    function resetFrozenStatus(address[] calldata frozenAddresses) external;\n\n    /**\n     * @notice this function is a called by middlewares during an operator's registration to make sure the operator's stake at registration\n     *         is slashable until serveUntil\n     * @param operator the operator whose stake update is being recorded\n     * @param serveUntilBlock the block until which the operator's stake at the current block is slashable\n     * @dev adds the middleware's slashing contract to the operator's linked list\n     */\n    function recordFirstStakeUpdate(address operator, uint32 serveUntilBlock) external;\n\n    /**\n     * @notice this function is a called by middlewares during a stake update for an operator (perhaps to free pending withdrawals)\n     *         to make sure the operator's stake at updateBlock is slashable until serveUntil\n     * @param operator the operator whose stake update is being recorded\n     * @param updateBlock the block for which the stake update is being recorded\n     * @param serveUntilBlock the block until which the operator's stake at updateBlock is slashable\n     * @param insertAfter the element of the operators linked list that the currently updating middleware should be inserted after\n     * @dev insertAfter should be calculated offchain before making the transaction that calls this. this is subject to race conditions,\n     *      but it is anticipated to be rare and not detrimental.\n     */\n    function recordStakeUpdate(\n        address operator,\n        uint32 updateBlock,\n        uint32 serveUntilBlock,\n        uint256 insertAfter\n    ) external;\n\n    /**\n     * @notice this function is a called by middlewares during an operator's deregistration to make sure the operator's stake at deregistration\n     *         is slashable until serveUntil\n     * @param operator the operator whose stake update is being recorded\n     * @param serveUntilBlock the block until which the operator's stake at the current block is slashable\n     * @dev removes the middleware's slashing contract to the operator's linked list and revokes the middleware's (i.e. caller's) ability to\n     * slash `operator` once `serveUntil` is reached\n     */\n    function recordLastStakeUpdateAndRevokeSlashingAbility(address operator, uint32 serveUntilBlock) external;\n\n    /// @notice The StrategyManager contract of EigenLayer\n    function strategyManager() external view returns (IStrategyManager);\n\n    /// @notice The DelegationManager contract of EigenLayer\n    function delegation() external view returns (IDelegationManager);\n\n    /**\n     * @notice Used to determine whether `staker` is actively 'frozen'. If a staker is frozen, then they are potentially subject to\n     * slashing of their funds, and cannot cannot deposit or withdraw from the strategyManager until the slashing process is completed\n     * and the staker's status is reset (to 'unfrozen').\n     * @param staker The staker of interest.\n     * @return Returns 'true' if `staker` themselves has their status set to frozen, OR if the staker is delegated\n     * to an operator who has their status set to frozen. Otherwise returns 'false'.\n     */\n    function isFrozen(address staker) external view returns (bool);\n\n    /// @notice Returns true if `slashingContract` is currently allowed to slash `toBeSlashed`.\n    function canSlash(address toBeSlashed, address slashingContract) external view returns (bool);\n\n    /// @notice Returns the block until which `serviceContract` is allowed to slash the `operator`.\n    function contractCanSlashOperatorUntilBlock(\n        address operator,\n        address serviceContract\n    ) external view returns (uint32);\n\n    /// @notice Returns the block at which the `serviceContract` last updated its view of the `operator`'s stake\n    function latestUpdateBlock(address operator, address serviceContract) external view returns (uint32);\n\n    /// @notice A search routine for finding the correct input value of `insertAfter` to `recordStakeUpdate` / `_updateMiddlewareList`.\n    function getCorrectValueForInsertAfter(address operator, uint32 updateBlock) external view returns (uint256);\n\n    /**\n     * @notice Returns 'true' if `operator` can currently complete a withdrawal started at the `withdrawalStartBlock`, with `middlewareTimesIndex` used\n     * to specify the index of a `MiddlewareTimes` struct in the operator's list (i.e. an index in `operatorToMiddlewareTimes[operator]`). The specified\n     * struct is consulted as proof of the `operator`'s ability (or lack thereof) to complete the withdrawal.\n     * This function will return 'false' if the operator cannot currently complete a withdrawal started at the `withdrawalStartBlock`, *or* in the event\n     * that an incorrect `middlewareTimesIndex` is supplied, even if one or more correct inputs exist.\n     * @param operator Either the operator who queued the withdrawal themselves, or if the withdrawing party is a staker who delegated to an operator,\n     * this address is the operator *who the staker was delegated to* at the time of the `withdrawalStartBlock`.\n     * @param withdrawalStartBlock The block number at which the withdrawal was initiated.\n     * @param middlewareTimesIndex Indicates an index in `operatorToMiddlewareTimes[operator]` to consult as proof of the `operator`'s ability to withdraw\n     * @dev The correct `middlewareTimesIndex` input should be computable off-chain.\n     */\n    function canWithdraw(\n        address operator,\n        uint32 withdrawalStartBlock,\n        uint256 middlewareTimesIndex\n    ) external returns (bool);\n\n    /**\n     * operator =>\n     *  [\n     *      (\n     *          the least recent update block of all of the middlewares it's serving/served,\n     *          latest time that the stake bonded at that update needed to serve until\n     *      )\n     *  ]\n     */\n    function operatorToMiddlewareTimes(\n        address operator,\n        uint256 arrayIndex\n    ) external view returns (MiddlewareTimes memory);\n\n    /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator].length`\n    function middlewareTimesLength(address operator) external view returns (uint256);\n\n    /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator][index].stalestUpdateBlock`.\n    function getMiddlewareTimesIndexStalestUpdateBlock(address operator, uint32 index) external view returns (uint32);\n\n    /// @notice Getter function for fetching `operatorToMiddlewareTimes[operator][index].latestServeUntil`.\n    function getMiddlewareTimesIndexServeUntilBlock(address operator, uint32 index) external view returns (uint32);\n\n    /// @notice Getter function for fetching `_operatorToWhitelistedContractsByUpdate[operator].size`.\n    function operatorWhitelistedContractsLinkedListSize(address operator) external view returns (uint256);\n\n    /// @notice Getter function for fetching a single node in the operator's linked list (`_operatorToWhitelistedContractsByUpdate[operator]`).\n    function operatorWhitelistedContractsLinkedListEntry(\n        address operator,\n        address node\n    ) external view returns (bool, uint256, uint256);\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport \"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\";\nimport \"./IETHPOSDeposit.sol\";\nimport \"./IStrategyManager.sol\";\nimport \"./IEigenPod.sol\";\nimport \"./IBeaconChainOracle.sol\";\nimport \"./IPausable.sol\";\nimport \"./ISlasher.sol\";\nimport \"./IStrategy.sol\";\n\n/**\n * @title Interface for factory that creates and manages solo staking pods that have their withdrawal credentials pointed to EigenLayer.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n */\n\ninterface IEigenPodManager is IPausable {\n    /// @notice Emitted to notify the update of the beaconChainOracle address\n    event BeaconOracleUpdated(address indexed newOracleAddress);\n\n    /// @notice Emitted to notify the deployment of an EigenPod\n    event PodDeployed(address indexed eigenPod, address indexed podOwner);\n\n    /// @notice Emitted to notify a deposit of beacon chain ETH recorded in the strategy manager\n    event BeaconChainETHDeposited(address indexed podOwner, uint256 amount);\n\n    /// @notice Emitted when the balance of an EigenPod is updated\n    event PodSharesUpdated(address indexed podOwner, int256 sharesDelta);\n\n    /// @notice Emitted when a withdrawal of beacon chain ETH is completed\n    event BeaconChainETHWithdrawalCompleted(\n        address indexed podOwner,\n        uint256 shares,\n        uint96 nonce,\n        address delegatedAddress,\n        address withdrawer,\n        bytes32 withdrawalRoot\n    );\n\n    event DenebForkTimestampUpdated(uint64 newValue);\n\n    /**\n     * @notice Creates an EigenPod for the sender.\n     * @dev Function will revert if the `msg.sender` already has an EigenPod.\n     * @dev Returns EigenPod address \n     */\n    function createPod() external returns (address);\n\n    /**\n     * @notice Stakes for a new beacon chain validator on the sender's EigenPod.\n     * Also creates an EigenPod for the sender if they don't have one already.\n     * @param pubkey The 48 bytes public key of the beacon chain validator.\n     * @param signature The validator's signature of the deposit data.\n     * @param depositDataRoot The root/hash of the deposit data for the validator's deposit.\n     */\n    function stake(bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot) external payable;\n\n    /**\n     * @notice Changes the `podOwner`'s shares by `sharesDelta` and performs a call to the DelegationManager\n     * to ensure that delegated shares are also tracked correctly\n     * @param podOwner is the pod owner whose balance is being updated.\n     * @param sharesDelta is the change in podOwner's beaconChainETHStrategy shares\n     * @dev Callable only by the podOwner's EigenPod contract.\n     * @dev Reverts if `sharesDelta` is not a whole Gwei amount\n     */\n    function recordBeaconChainETHBalanceUpdate(address podOwner, int256 sharesDelta) external;\n\n    /**\n     * @notice Updates the oracle contract that provides the beacon chain state root\n     * @param newBeaconChainOracle is the new oracle contract being pointed to\n     * @dev Callable only by the owner of this contract (i.e. governance)\n     */\n    function updateBeaconChainOracle(IBeaconChainOracle newBeaconChainOracle) external;\n\n    /// @notice Returns the address of the `podOwner`'s EigenPod if it has been deployed.\n    function ownerToPod(address podOwner) external view returns (IEigenPod);\n\n    /// @notice Returns the address of the `podOwner`'s EigenPod (whether it is deployed yet or not).\n    function getPod(address podOwner) external view returns (IEigenPod);\n\n    /// @notice The ETH2 Deposit Contract\n    function ethPOS() external view returns (IETHPOSDeposit);\n\n    /// @notice Beacon proxy to which the EigenPods point\n    function eigenPodBeacon() external view returns (IBeacon);\n\n    /// @notice Oracle contract that provides updates to the beacon chain's state\n    function beaconChainOracle() external view returns (IBeaconChainOracle);\n\n    /// @notice Returns the beacon block root at `timestamp`. Reverts if the Beacon block root at `timestamp` has not yet been finalized.\n    function getBlockRootAtTimestamp(uint64 timestamp) external view returns (bytes32);\n\n    /// @notice EigenLayer's StrategyManager contract\n    function strategyManager() external view returns (IStrategyManager);\n\n    /// @notice EigenLayer's Slasher contract\n    function slasher() external view returns (ISlasher);\n\n    /// @notice Returns 'true' if the `podOwner` has created an EigenPod, and 'false' otherwise.\n    function hasPod(address podOwner) external view returns (bool);\n\n    /// @notice Returns the number of EigenPods that have been created\n    function numPods() external view returns (uint256);\n\n    /**\n     * @notice Mapping from Pod owner owner to the number of shares they have in the virtual beacon chain ETH strategy.\n     * @dev The share amount can become negative. This is necessary to accommodate the fact that a pod owner's virtual beacon chain ETH shares can\n     * decrease between the pod owner queuing and completing a withdrawal.\n     * When the pod owner's shares would otherwise increase, this \"deficit\" is decreased first _instead_.\n     * Likewise, when a withdrawal is completed, this \"deficit\" is decreased and the withdrawal amount is decreased; We can think of this\n     * as the withdrawal \"paying off the deficit\".\n     */\n    function podOwnerShares(address podOwner) external view returns (int256);\n\n    /// @notice returns canonical, virtual beaconChainETH strategy\n    function beaconChainETHStrategy() external view returns (IStrategy);\n\n    /**\n     * @notice Used by the DelegationManager to remove a pod owner's shares while they're in the withdrawal queue.\n     * Simply decreases the `podOwner`'s shares by `shares`, down to a minimum of zero.\n     * @dev This function reverts if it would result in `podOwnerShares[podOwner]` being less than zero, i.e. it is forbidden for this function to\n     * result in the `podOwner` incurring a \"share deficit\". This behavior prevents a Staker from queuing a withdrawal which improperly removes excessive\n     * shares from the operator to whom the staker is delegated.\n     * @dev Reverts if `shares` is not a whole Gwei amount\n     */\n    function removeShares(address podOwner, uint256 shares) external;\n\n    /**\n     * @notice Increases the `podOwner`'s shares by `shares`, paying off deficit if possible.\n     * Used by the DelegationManager to award a pod owner shares on exiting the withdrawal queue\n     * @dev Returns the number of shares added to `podOwnerShares[podOwner]` above zero, which will be less than the `shares` input\n     * in the event that the podOwner has an existing shares deficit (i.e. `podOwnerShares[podOwner]` starts below zero)\n     * @dev Reverts if `shares` is not a whole Gwei amount\n     */\n    function addShares(address podOwner, uint256 shares) external returns (uint256);\n\n    /**\n     * @notice Used by the DelegationManager to complete a withdrawal, sending tokens to some destination address\n     * @dev Prioritizes decreasing the podOwner's share deficit, if they have one\n     * @dev Reverts if `shares` is not a whole Gwei amount\n     */\n    function withdrawSharesAsTokens(address podOwner, address destination, uint256 shares) external;\n\n    /**\n     * @notice the deneb hard fork timestamp used to determine which proof path to use for proving a withdrawal\n     */\n    function denebForkTimestamp() external view returns (uint64);\n\n     /**\n     * setting the deneb hard fork timestamp by the eigenPodManager owner\n     * @dev this function is designed to be called twice.  Once, it is set to type(uint64).max \n     * prior to the actual deneb fork timestamp being set, and then the second time it is set \n     * to the actual deneb fork timestamp.\n     */\n    function setDenebForkTimestamp(uint64 newDenebForkTimestamp) external;\n\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n    /**\n     * @dev Must return an address that can be used as a delegate call target.\n     *\n     * {BeaconProxy} will check that this address is a contract.\n     */\n    function implementation() external view returns (address);\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IETHPOSDeposit.sol": {
        "content": "// ┏━━━┓━┏┓━┏┓━━┏━━━┓━━┏━━━┓━━━━┏━━━┓━━━━━━━━━━━━━━━━━━━┏┓━━━━━┏━━━┓━━━━━━━━━┏┓━━━━━━━━━━━━━━┏┓━\n// ┃┏━━┛┏┛┗┓┃┃━━┃┏━┓┃━━┃┏━┓┃━━━━┗┓┏┓┃━━━━━━━━━━━━━━━━━━┏┛┗┓━━━━┃┏━┓┃━━━━━━━━┏┛┗┓━━━━━━━━━━━━┏┛┗┓\n// ┃┗━━┓┗┓┏┛┃┗━┓┗┛┏┛┃━━┃┃━┃┃━━━━━┃┃┃┃┏━━┓┏━━┓┏━━┓┏━━┓┏┓┗┓┏┛━━━━┃┃━┗┛┏━━┓┏━┓━┗┓┏┛┏━┓┏━━┓━┏━━┓┗┓┏┛\n// ┃┏━━┛━┃┃━┃┏┓┃┏━┛┏┛━━┃┃━┃┃━━━━━┃┃┃┃┃┏┓┃┃┏┓┃┃┏┓┃┃━━┫┣┫━┃┃━━━━━┃┃━┏┓┃┏┓┃┃┏┓┓━┃┃━┃┏┛┗━┓┃━┃┏━┛━┃┃━\n// ┃┗━━┓━┃┗┓┃┃┃┃┃┃┗━┓┏┓┃┗━┛┃━━━━┏┛┗┛┃┃┃━┫┃┗┛┃┃┗┛┃┣━━┃┃┃━┃┗┓━━━━┃┗━┛┃┃┗┛┃┃┃┃┃━┃┗┓┃┃━┃┗┛┗┓┃┗━┓━┃┗┓\n// ┗━━━┛━┗━┛┗┛┗┛┗━━━┛┗┛┗━━━┛━━━━┗━━━┛┗━━┛┃┏━┛┗━━┛┗━━┛┗┛━┗━┛━━━━┗━━━┛┗━━┛┗┛┗┛━┗━┛┗┛━┗━━━┛┗━━┛━┗━┛\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┃┃━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┗┛━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n// SPDX-License-Identifier: CC0-1.0\n\npragma solidity >=0.5.0;\n\n// This interface is designed to be compatible with the Vyper version.\n/// @notice This is the Ethereum 2.0 deposit contract interface.\n/// For more information see the Phase 0 specification under https://github.com/ethereum/eth2.0-specs\ninterface IETHPOSDeposit {\n    /// @notice A processed deposit event.\n    event DepositEvent(bytes pubkey, bytes withdrawal_credentials, bytes amount, bytes signature, bytes index);\n\n    /// @notice Submit a Phase 0 DepositData object.\n    /// @param pubkey A BLS12-381 public key.\n    /// @param withdrawal_credentials Commitment to a public key for withdrawals.\n    /// @param signature A BLS12-381 signature.\n    /// @param deposit_data_root The SHA-256 hash of the SSZ-encoded DepositData object.\n    /// Used as a protection against malformed input.\n    function deposit(\n        bytes calldata pubkey,\n        bytes calldata withdrawal_credentials,\n        bytes calldata signature,\n        bytes32 deposit_data_root\n    ) external payable;\n\n    /// @notice Query the current deposit root hash.\n    /// @return The deposit root hash.\n    function get_deposit_root() external view returns (bytes32);\n\n    /// @notice Query the current deposit count.\n    /// @return The deposit count encoded as a little endian 64-bit number.\n    function get_deposit_count() external view returns (bytes memory);\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IEigenPod.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\nimport \"../libraries/BeaconChainProofs.sol\";\nimport \"./IEigenPodManager.sol\";\nimport \"./IBeaconChainOracle.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/**\n * @title The implementation contract used for restaking beacon chain ETH on EigenLayer\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n * @notice The main functionalities are:\n * - creating new ETH validators with their withdrawal credentials pointed to this contract\n * - proving from beacon chain state roots that withdrawal credentials are pointed to this contract\n * - proving from beacon chain state roots the balances of ETH validators with their withdrawal credentials\n *   pointed to this contract\n * - updating aggregate balances in the EigenPodManager\n * - withdrawing eth when withdrawals are initiated\n * @dev Note that all beacon chain balances are stored as gwei within the beacon chain datastructures. We choose\n *   to account balances in terms of gwei in the EigenPod contract and convert to wei when making calls to other contracts\n */\ninterface IEigenPod {\n    enum VALIDATOR_STATUS {\n        INACTIVE, // doesnt exist\n        ACTIVE, // staked on ethpos and withdrawal credentials are pointed to the EigenPod\n        WITHDRAWN // withdrawn from the Beacon Chain\n    }\n\n    struct ValidatorInfo {\n        // index of the validator in the beacon chain\n        uint64 validatorIndex;\n        // amount of beacon chain ETH restaked on EigenLayer in gwei\n        uint64 restakedBalanceGwei;\n        //timestamp of the validator's most recent balance update\n        uint64 mostRecentBalanceUpdateTimestamp;\n        // status of the validator\n        VALIDATOR_STATUS status;\n    }\n\n    /**\n     * @notice struct used to store amounts related to proven withdrawals in memory. Used to help\n     * manage stack depth and optimize the number of external calls, when batching withdrawal operations.\n     */\n    struct VerifiedWithdrawal {\n        // amount to send to a podOwner from a proven withdrawal\n        uint256 amountToSendGwei;\n        // difference in shares to be recorded in the eigenPodManager, as a result of the withdrawal\n        int256 sharesDeltaGwei;\n    }\n\n\n    enum PARTIAL_WITHDRAWAL_CLAIM_STATUS {\n        REDEEMED,\n        PENDING,\n        FAILED\n    }\n\n    /// @notice Emitted when an ETH validator stakes via this eigenPod\n    event EigenPodStaked(bytes pubkey);\n\n    /// @notice Emitted when an ETH validator's withdrawal credentials are successfully verified to be pointed to this eigenPod\n    event ValidatorRestaked(uint40 validatorIndex);\n\n    /// @notice Emitted when an ETH validator's  balance is proven to be updated.  Here newValidatorBalanceGwei\n    //  is the validator's balance that is credited on EigenLayer.\n    event ValidatorBalanceUpdated(uint40 validatorIndex, uint64 balanceTimestamp, uint64 newValidatorBalanceGwei);\n\n    /// @notice Emitted when an ETH validator is prove to have withdrawn from the beacon chain\n    event FullWithdrawalRedeemed(\n        uint40 validatorIndex,\n        uint64 withdrawalTimestamp,\n        address indexed recipient,\n        uint64 withdrawalAmountGwei\n    );\n\n    /// @notice Emitted when a partial withdrawal claim is successfully redeemed\n    event PartialWithdrawalRedeemed(\n        uint40 validatorIndex,\n        uint64 withdrawalTimestamp,\n        address indexed recipient,\n        uint64 partialWithdrawalAmountGwei\n    );\n\n    /// @notice Emitted when restaked beacon chain ETH is withdrawn from the eigenPod.\n    event RestakedBeaconChainETHWithdrawn(address indexed recipient, uint256 amount);\n\n    /// @notice Emitted when podOwner enables restaking\n    event RestakingActivated(address indexed podOwner);\n\n    /// @notice Emitted when ETH is received via the `receive` fallback\n    event NonBeaconChainETHReceived(uint256 amountReceived);\n\n    /// @notice Emitted when ETH that was previously received via the `receive` fallback is withdrawn\n    event NonBeaconChainETHWithdrawn(address indexed recipient, uint256 amountWithdrawn);\n\n\n    /// @notice The max amount of eth, in gwei, that can be restaked per validator\n    function MAX_RESTAKED_BALANCE_GWEI_PER_VALIDATOR() external view returns (uint64);\n\n    /// @notice the amount of execution layer ETH in this contract that is staked in EigenLayer (i.e. withdrawn from beaconchain but not EigenLayer),\n    function withdrawableRestakedExecutionLayerGwei() external view returns (uint64);\n\n    /// @notice any ETH deposited into the EigenPod contract via the `receive` fallback function\n    function nonBeaconChainETHBalanceWei() external view returns (uint256);\n\n    /// @notice Used to initialize the pointers to contracts crucial to the pod's functionality, in beacon proxy construction from EigenPodManager\n    function initialize(address owner) external;\n\n    /// @notice Called by EigenPodManager when the owner wants to create another ETH validator.\n    function stake(bytes calldata pubkey, bytes calldata signature, bytes32 depositDataRoot) external payable;\n\n    /**\n     * @notice Transfers `amountWei` in ether from this contract to the specified `recipient` address\n     * @notice Called by EigenPodManager to withdrawBeaconChainETH that has been added to the EigenPod's balance due to a withdrawal from the beacon chain.\n     * @dev The podOwner must have already proved sufficient withdrawals, so that this pod's `withdrawableRestakedExecutionLayerGwei` exceeds the\n     * `amountWei` input (when converted to GWEI).\n     * @dev Reverts if `amountWei` is not a whole Gwei amount\n     */\n    function withdrawRestakedBeaconChainETH(address recipient, uint256 amount) external;\n\n    /// @notice The single EigenPodManager for EigenLayer\n    function eigenPodManager() external view returns (IEigenPodManager);\n\n    /// @notice The owner of this EigenPod\n    function podOwner() external view returns (address);\n\n    /// @notice an indicator of whether or not the podOwner has ever \"fully restaked\" by successfully calling `verifyCorrectWithdrawalCredentials`.\n    function hasRestaked() external view returns (bool);\n\n    /**\n     * @notice The latest timestamp at which the pod owner withdrew the balance of the pod, via calling `withdrawBeforeRestaking`.\n     * @dev This variable is only updated when the `withdrawBeforeRestaking` function is called, which can only occur before `hasRestaked` is set to true for this pod.\n     * Proofs for this pod are only valid against Beacon Chain state roots corresponding to timestamps after the stored `mostRecentWithdrawalTimestamp`.\n     */\n    function mostRecentWithdrawalTimestamp() external view returns (uint64);\n\n    /// @notice Returns the validatorInfo struct for the provided pubkeyHash\n    function validatorPubkeyHashToInfo(bytes32 validatorPubkeyHash) external view returns (ValidatorInfo memory);\n\n    /// @notice Returns the validatorInfo struct for the provided pubkey\n    function validatorPubkeyToInfo(bytes calldata validatorPubkey) external view returns (ValidatorInfo memory);\n\n    ///@notice mapping that tracks proven withdrawals\n    function provenWithdrawal(bytes32 validatorPubkeyHash, uint64 slot) external view returns (bool);\n\n    /// @notice This returns the status of a given validator\n    function validatorStatus(bytes32 pubkeyHash) external view returns (VALIDATOR_STATUS);\n\n    /// @notice This returns the status of a given validator pubkey\n    function validatorStatus(bytes calldata validatorPubkey) external view returns (VALIDATOR_STATUS);\n\n    /**\n     * @notice This function verifies that the withdrawal credentials of validator(s) owned by the podOwner are pointed to\n     * this contract. It also verifies the effective balance  of the validator.  It verifies the provided proof of the ETH validator against the beacon chain state\n     * root, marks the validator as 'active' in EigenLayer, and credits the restaked ETH in Eigenlayer.\n     * @param oracleTimestamp is the Beacon Chain timestamp whose state root the `proof` will be proven against.\n     * @param validatorIndices is the list of indices of the validators being proven, refer to consensus specs\n     * @param withdrawalCredentialProofs is an array of proofs, where each proof proves each ETH validator's balance and withdrawal credentials\n     * against a beacon chain state root\n     * @param validatorFields are the fields of the \"Validator Container\", refer to consensus specs\n     * for details: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator\n     */\n    function verifyWithdrawalCredentials(\n        uint64 oracleTimestamp,\n        BeaconChainProofs.StateRootProof calldata stateRootProof,\n        uint40[] calldata validatorIndices,\n        bytes[] calldata withdrawalCredentialProofs,\n        bytes32[][] calldata validatorFields\n    )\n        external;\n\n    /**\n     * @notice This function records an update (either increase or decrease) in the pod's balance in the StrategyManager.  \n               It also verifies a merkle proof of the validator's current beacon chain balance.  \n     * @param oracleTimestamp The oracleTimestamp whose state root the `proof` will be proven against.\n     *        Must be within `VERIFY_BALANCE_UPDATE_WINDOW_SECONDS` of the current block.\n     * @param validatorIndices is the list of indices of the validators being proven, refer to consensus specs \n     * @param validatorFieldsProofs proofs against the `beaconStateRoot` for each validator in `validatorFields`\n     * @param validatorFields are the fields of the \"Validator Container\", refer to consensus specs\n     * @dev For more details on the Beacon Chain spec, see: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator\n     */\n    function verifyBalanceUpdates(\n        uint64 oracleTimestamp,\n        uint40[] calldata validatorIndices,\n        BeaconChainProofs.StateRootProof calldata stateRootProof,\n        bytes[] calldata validatorFieldsProofs,\n        bytes32[][] calldata validatorFields\n    ) external;\n\n    /**\n     * @notice This function records full and partial withdrawals on behalf of one of the Ethereum validators for this EigenPod\n     * @param oracleTimestamp is the timestamp of the oracle slot that the withdrawal is being proven against\n     * @param withdrawalProofs is the information needed to check the veracity of the block numbers and withdrawals being proven\n     * @param validatorFieldsProofs is the proof of the validator's fields' in the validator tree\n     * @param withdrawalFields are the fields of the withdrawals being proven\n     * @param validatorFields are the fields of the validators being proven\n     */\n    function verifyAndProcessWithdrawals(\n        uint64 oracleTimestamp,\n        BeaconChainProofs.StateRootProof calldata stateRootProof,\n        BeaconChainProofs.WithdrawalProof[] calldata withdrawalProofs,\n        bytes[] calldata validatorFieldsProofs,\n        bytes32[][] calldata validatorFields,\n        bytes32[][] calldata withdrawalFields\n    ) external;\n\n    /**\n     * @notice Called by the pod owner to activate restaking by withdrawing\n     * all existing ETH from the pod and preventing further withdrawals via\n     * \"withdrawBeforeRestaking()\"\n     */\n    function activateRestaking() external;\n\n    /// @notice Called by the pod owner to withdraw the balance of the pod when `hasRestaked` is set to false\n    function withdrawBeforeRestaking() external;\n\n    /// @notice Called by the pod owner to withdraw the nonBeaconChainETHBalanceWei\n    function withdrawNonBeaconChainETHBalanceWei(address recipient, uint256 amountToWithdraw) external;\n\n    /// @notice called by owner of a pod to remove any ERC20s deposited in the pod\n    function recoverTokens(IERC20[] memory tokenList, uint256[] memory amountsToWithdraw, address recipient) external;\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/interfaces/IBeaconChainOracle.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity >=0.5.0;\n\n/**\n * @title Interface for the BeaconStateOracle contract.\n * @author Layr Labs, Inc.\n * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service\n */\ninterface IBeaconChainOracle {\n    /// @notice The block number to state root mapping.\n    function timestampToBlockRoot(uint256 timestamp) external view returns (bytes32);\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/libraries/BeaconChainProofs.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.0;\n\nimport \"./Merkle.sol\";\nimport \"../libraries/Endian.sol\";\n\n//Utility library for parsing and PHASE0 beacon chain block headers\n//SSZ Spec: https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md#merkleization\n//BeaconBlockHeader Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader\n//BeaconState Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconstate\nlibrary BeaconChainProofs {\n    // constants are the number of fields and the heights of the different merkle trees used in merkleizing beacon chain containers\n    uint256 internal constant BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT = 3;\n\n    uint256 internal constant BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT = 4;\n\n    uint256 internal constant BEACON_STATE_FIELD_TREE_HEIGHT = 5;\n\n    uint256 internal constant VALIDATOR_FIELD_TREE_HEIGHT = 3;\n\n    //Note: changed in the deneb hard fork from 4->5\n    uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB = 5;\n    uint256 internal constant EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA = 4;\n\n    // SLOTS_PER_HISTORICAL_ROOT = 2**13, so tree height is 13\n    uint256 internal constant BLOCK_ROOTS_TREE_HEIGHT = 13;\n\n    //HISTORICAL_ROOTS_LIMIT = 2**24, so tree height is 24\n    uint256 internal constant HISTORICAL_SUMMARIES_TREE_HEIGHT = 24;\n\n    //Index of block_summary_root in historical_summary container\n    uint256 internal constant BLOCK_SUMMARY_ROOT_INDEX = 0;\n\n    // tree height for hash tree of an individual withdrawal container\n    uint256 internal constant WITHDRAWAL_FIELD_TREE_HEIGHT = 2;\n\n    uint256 internal constant VALIDATOR_TREE_HEIGHT = 40;\n\n    // MAX_WITHDRAWALS_PER_PAYLOAD = 2**4, making tree height = 4\n    uint256 internal constant WITHDRAWALS_TREE_HEIGHT = 4;\n\n    //in beacon block body https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconblockbody\n    uint256 internal constant EXECUTION_PAYLOAD_INDEX = 9;\n\n    // in beacon block header https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#beaconblockheader\n    uint256 internal constant SLOT_INDEX = 0;\n    uint256 internal constant STATE_ROOT_INDEX = 3;\n    uint256 internal constant BODY_ROOT_INDEX = 4;\n    // in beacon state https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconstate\n    uint256 internal constant VALIDATOR_TREE_ROOT_INDEX = 11;\n    uint256 internal constant HISTORICAL_SUMMARIES_INDEX = 27;\n\n    // in validator https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#validator\n    uint256 internal constant VALIDATOR_PUBKEY_INDEX = 0;\n    uint256 internal constant VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX = 1;\n    uint256 internal constant VALIDATOR_BALANCE_INDEX = 2;\n    uint256 internal constant VALIDATOR_WITHDRAWABLE_EPOCH_INDEX = 7;\n\n    // in execution payload header\n    uint256 internal constant TIMESTAMP_INDEX = 9;\n\n    //in execution payload\n    uint256 internal constant WITHDRAWALS_INDEX = 14;\n\n    // in withdrawal\n    uint256 internal constant WITHDRAWAL_VALIDATOR_INDEX_INDEX = 1;\n    uint256 internal constant WITHDRAWAL_VALIDATOR_AMOUNT_INDEX = 3;\n\n    //Misc Constants\n\n    /// @notice The number of slots each epoch in the beacon chain\n    uint64 internal constant SLOTS_PER_EPOCH = 32;\n\n    /// @notice The number of seconds in a slot in the beacon chain\n    uint64 internal constant SECONDS_PER_SLOT = 12;\n\n    /// @notice Number of seconds per epoch: 384 == 32 slots/epoch * 12 seconds/slot \n    uint64 internal constant SECONDS_PER_EPOCH = SLOTS_PER_EPOCH * SECONDS_PER_SLOT;\n\n    bytes8 internal constant UINT64_MASK = 0xffffffffffffffff;\n\n    /// @notice This struct contains the merkle proofs and leaves needed to verify a partial/full withdrawal\n    struct WithdrawalProof {\n        bytes withdrawalProof;\n        bytes slotProof;\n        bytes executionPayloadProof;\n        bytes timestampProof;\n        bytes historicalSummaryBlockRootProof;\n        uint64 blockRootIndex;\n        uint64 historicalSummaryIndex;\n        uint64 withdrawalIndex;\n        bytes32 blockRoot;\n        bytes32 slotRoot;\n        bytes32 timestampRoot;\n        bytes32 executionPayloadRoot;\n    }\n\n    /// @notice This struct contains the root and proof for verifying the state root against the oracle block root\n    struct StateRootProof {\n        bytes32 beaconStateRoot;\n        bytes proof;\n    }\n\n    /**\n     * @notice This function verifies merkle proofs of the fields of a certain validator against a beacon chain state root\n     * @param validatorIndex the index of the proven validator\n     * @param beaconStateRoot is the beacon chain state root to be proven against.\n     * @param validatorFieldsProof is the data used in proving the validator's fields\n     * @param validatorFields the claimed fields of the validator\n     */\n    function verifyValidatorFields(\n        bytes32 beaconStateRoot,\n        bytes32[] calldata validatorFields,\n        bytes calldata validatorFieldsProof,\n        uint40 validatorIndex\n    ) internal view {\n        require(\n            validatorFields.length == 2 ** VALIDATOR_FIELD_TREE_HEIGHT,\n            \"BeaconChainProofs.verifyValidatorFields: Validator fields has incorrect length\"\n        );\n\n        /**\n         * Note: the length of the validator merkle proof is BeaconChainProofs.VALIDATOR_TREE_HEIGHT + 1.\n         * There is an additional layer added by hashing the root with the length of the validator list\n         */\n        require(\n            validatorFieldsProof.length == 32 * ((VALIDATOR_TREE_HEIGHT + 1) + BEACON_STATE_FIELD_TREE_HEIGHT),\n            \"BeaconChainProofs.verifyValidatorFields: Proof has incorrect length\"\n        );\n        uint256 index = (VALIDATOR_TREE_ROOT_INDEX << (VALIDATOR_TREE_HEIGHT + 1)) | uint256(validatorIndex);\n        // merkleize the validatorFields to get the leaf to prove\n        bytes32 validatorRoot = Merkle.merkleizeSha256(validatorFields);\n\n        // verify the proof of the validatorRoot against the beaconStateRoot\n        require(\n            Merkle.verifyInclusionSha256({\n                proof: validatorFieldsProof,\n                root: beaconStateRoot,\n                leaf: validatorRoot,\n                index: index\n            }),\n            \"BeaconChainProofs.verifyValidatorFields: Invalid merkle proof\"\n        );\n    }\n\n    /**\n     * @notice This function verifies the latestBlockHeader against the state root. the latestBlockHeader is\n     * a tracked in the beacon state.\n     * @param beaconStateRoot is the beacon chain state root to be proven against.\n     * @param stateRootProof is the provided merkle proof\n     * @param latestBlockRoot is hashtree root of the latest block header in the beacon state\n     */\n    function verifyStateRootAgainstLatestBlockRoot(\n        bytes32 latestBlockRoot,\n        bytes32 beaconStateRoot,\n        bytes calldata stateRootProof\n    ) internal view {\n        require(\n            stateRootProof.length == 32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT),\n            \"BeaconChainProofs.verifyStateRootAgainstLatestBlockRoot: Proof has incorrect length\"\n        );\n        //Next we verify the slot against the blockRoot\n        require(\n            Merkle.verifyInclusionSha256({\n                proof: stateRootProof,\n                root: latestBlockRoot,\n                leaf: beaconStateRoot,\n                index: STATE_ROOT_INDEX\n            }),\n            \"BeaconChainProofs.verifyStateRootAgainstLatestBlockRoot: Invalid latest block header root merkle proof\"\n        );\n    }\n\n    /**\n     * @notice This function verifies the slot and the withdrawal fields for a given withdrawal\n     * @param withdrawalProof is the provided set of merkle proofs\n     * @param withdrawalFields is the serialized withdrawal container to be proven\n     */\n    function verifyWithdrawal(\n        bytes32 beaconStateRoot,\n        bytes32[] calldata withdrawalFields,\n        WithdrawalProof calldata withdrawalProof,\n        uint64 denebForkTimestamp\n    ) internal view {\n        require(\n            withdrawalFields.length == 2 ** WITHDRAWAL_FIELD_TREE_HEIGHT,\n            \"BeaconChainProofs.verifyWithdrawal: withdrawalFields has incorrect length\"\n        );\n\n        require(\n            withdrawalProof.blockRootIndex < 2 ** BLOCK_ROOTS_TREE_HEIGHT,\n            \"BeaconChainProofs.verifyWithdrawal: blockRootIndex is too large\"\n        );\n        require(\n            withdrawalProof.withdrawalIndex < 2 ** WITHDRAWALS_TREE_HEIGHT,\n            \"BeaconChainProofs.verifyWithdrawal: withdrawalIndex is too large\"\n        );\n\n        require(\n            withdrawalProof.historicalSummaryIndex < 2 ** HISTORICAL_SUMMARIES_TREE_HEIGHT,\n            \"BeaconChainProofs.verifyWithdrawal: historicalSummaryIndex is too large\"\n        );\n\n        //Note: post deneb hard fork, the number of exection payload header fields increased from 15->17, adding an extra level to the tree height\n        uint256 executionPayloadHeaderFieldTreeHeight = (getWithdrawalTimestamp(withdrawalProof) < denebForkTimestamp) ? EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_CAPELLA : EXECUTION_PAYLOAD_HEADER_FIELD_TREE_HEIGHT_DENEB;\n        require(\n            withdrawalProof.withdrawalProof.length ==\n                32 * (executionPayloadHeaderFieldTreeHeight + WITHDRAWALS_TREE_HEIGHT + 1),\n            \"BeaconChainProofs.verifyWithdrawal: withdrawalProof has incorrect length\"\n        );\n        require(\n            withdrawalProof.executionPayloadProof.length ==\n                32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT + BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT),\n            \"BeaconChainProofs.verifyWithdrawal: executionPayloadProof has incorrect length\"\n        );\n        require(\n            withdrawalProof.slotProof.length == 32 * (BEACON_BLOCK_HEADER_FIELD_TREE_HEIGHT),\n            \"BeaconChainProofs.verifyWithdrawal: slotProof has incorrect length\"\n        );\n        require(\n            withdrawalProof.timestampProof.length == 32 * (executionPayloadHeaderFieldTreeHeight),\n            \"BeaconChainProofs.verifyWithdrawal: timestampProof has incorrect length\"\n        );\n\n        require(\n            withdrawalProof.historicalSummaryBlockRootProof.length ==\n                32 *\n                    (BEACON_STATE_FIELD_TREE_HEIGHT +\n                        (HISTORICAL_SUMMARIES_TREE_HEIGHT + 1) +\n                        1 +\n                        (BLOCK_ROOTS_TREE_HEIGHT)),\n            \"BeaconChainProofs.verifyWithdrawal: historicalSummaryBlockRootProof has incorrect length\"\n        );\n        /**\n         * Note: Here, the \"1\" in \"1 + (BLOCK_ROOTS_TREE_HEIGHT)\" signifies that extra step of choosing the \"block_root_summary\" within the individual\n         * \"historical_summary\". Everywhere else it signifies merkelize_with_mixin, where the length of an array is hashed with the root of the array,\n         * but not here.\n         */\n        uint256 historicalBlockHeaderIndex = (HISTORICAL_SUMMARIES_INDEX <<\n            ((HISTORICAL_SUMMARIES_TREE_HEIGHT + 1) + 1 + (BLOCK_ROOTS_TREE_HEIGHT))) |\n            (uint256(withdrawalProof.historicalSummaryIndex) << (1 + (BLOCK_ROOTS_TREE_HEIGHT))) |\n            (BLOCK_SUMMARY_ROOT_INDEX << (BLOCK_ROOTS_TREE_HEIGHT)) |\n            uint256(withdrawalProof.blockRootIndex);\n\n        require(\n            Merkle.verifyInclusionSha256({\n                proof: withdrawalProof.historicalSummaryBlockRootProof,\n                root: beaconStateRoot,\n                leaf: withdrawalProof.blockRoot,\n                index: historicalBlockHeaderIndex\n            }),\n            \"BeaconChainProofs.verifyWithdrawal: Invalid historicalsummary merkle proof\"\n        );\n\n        //Next we verify the slot against the blockRoot\n        require(\n            Merkle.verifyInclusionSha256({\n                proof: withdrawalProof.slotProof,\n                root: withdrawalProof.blockRoot,\n                leaf: withdrawalProof.slotRoot,\n                index: SLOT_INDEX\n            }),\n            \"BeaconChainProofs.verifyWithdrawal: Invalid slot merkle proof\"\n        );\n\n        {\n            // Next we verify the executionPayloadRoot against the blockRoot\n            uint256 executionPayloadIndex = (BODY_ROOT_INDEX << (BEACON_BLOCK_BODY_FIELD_TREE_HEIGHT)) |\n                EXECUTION_PAYLOAD_INDEX;\n            require(\n                Merkle.verifyInclusionSha256({\n                    proof: withdrawalProof.executionPayloadProof,\n                    root: withdrawalProof.blockRoot,\n                    leaf: withdrawalProof.executionPayloadRoot,\n                    index: executionPayloadIndex\n                }),\n                \"BeaconChainProofs.verifyWithdrawal: Invalid executionPayload merkle proof\"\n            );\n        }\n\n        // Next we verify the timestampRoot against the executionPayload root\n        require(\n            Merkle.verifyInclusionSha256({\n                proof: withdrawalProof.timestampProof,\n                root: withdrawalProof.executionPayloadRoot,\n                leaf: withdrawalProof.timestampRoot,\n                index: TIMESTAMP_INDEX\n            }),\n            \"BeaconChainProofs.verifyWithdrawal: Invalid timestamp merkle proof\"\n        );\n\n        {\n            /**\n             * Next we verify the withdrawal fields against the executionPayloadRoot:\n             * First we compute the withdrawal_index, then we merkleize the \n             * withdrawalFields container to calculate the withdrawalRoot.\n             *\n             * Note: Merkleization of the withdrawals root tree uses MerkleizeWithMixin, i.e., the length of the array is hashed with the root of\n             * the array.  Thus we shift the WITHDRAWALS_INDEX over by WITHDRAWALS_TREE_HEIGHT + 1 and not just WITHDRAWALS_TREE_HEIGHT.\n             */\n            uint256 withdrawalIndex = (WITHDRAWALS_INDEX << (WITHDRAWALS_TREE_HEIGHT + 1)) |\n                uint256(withdrawalProof.withdrawalIndex);\n            bytes32 withdrawalRoot = Merkle.merkleizeSha256(withdrawalFields);\n            require(\n                Merkle.verifyInclusionSha256({\n                    proof: withdrawalProof.withdrawalProof,\n                    root: withdrawalProof.executionPayloadRoot,\n                    leaf: withdrawalRoot,\n                    index: withdrawalIndex\n                }),\n                \"BeaconChainProofs.verifyWithdrawal: Invalid withdrawal merkle proof\"\n            );\n        }\n    }\n\n    /**\n     * @notice This function replicates the ssz hashing of a validator's pubkey, outlined below:\n     *  hh := ssz.NewHasher()\n     *  hh.PutBytes(validatorPubkey[:])\n     *  validatorPubkeyHash := hh.Hash()\n     *  hh.Reset()\n     */\n    function hashValidatorBLSPubkey(bytes memory validatorPubkey) internal pure returns (bytes32 pubkeyHash) {\n        require(validatorPubkey.length == 48, \"Input should be 48 bytes in length\");\n        return sha256(abi.encodePacked(validatorPubkey, bytes16(0)));\n    }\n\n    /**\n     * @dev Retrieve the withdrawal timestamp\n     */\n    function getWithdrawalTimestamp(WithdrawalProof memory withdrawalProof) internal pure returns (uint64) {\n        return\n            Endian.fromLittleEndianUint64(withdrawalProof.timestampRoot);\n    }\n\n    /**\n     * @dev Converts the withdrawal's slot to an epoch\n     */\n    function getWithdrawalEpoch(WithdrawalProof memory withdrawalProof) internal pure returns (uint64) {\n        return\n            Endian.fromLittleEndianUint64(withdrawalProof.slotRoot) / SLOTS_PER_EPOCH;\n    }\n\n    /**\n     * Indices for validator fields (refer to consensus specs):\n     * 0: pubkey\n     * 1: withdrawal credentials\n     * 2: effective balance\n     * 3: slashed?\n     * 4: activation elligibility epoch\n     * 5: activation epoch\n     * 6: exit epoch\n     * 7: withdrawable epoch\n     */\n\n    /**\n     * @dev Retrieves a validator's pubkey hash\n     */\n    function getPubkeyHash(bytes32[] memory validatorFields) internal pure returns (bytes32) {\n        return \n            validatorFields[VALIDATOR_PUBKEY_INDEX];\n    }\n\n    function getWithdrawalCredentials(bytes32[] memory validatorFields) internal pure returns (bytes32) {\n        return\n            validatorFields[VALIDATOR_WITHDRAWAL_CREDENTIALS_INDEX];\n    }\n\n    /**\n     * @dev Retrieves a validator's effective balance (in gwei)\n     */\n    function getEffectiveBalanceGwei(bytes32[] memory validatorFields) internal pure returns (uint64) {\n        return \n            Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_BALANCE_INDEX]);\n    }\n\n    /**\n     * @dev Retrieves a validator's withdrawable epoch\n     */\n    function getWithdrawableEpoch(bytes32[] memory validatorFields) internal pure returns (uint64) {\n        return \n            Endian.fromLittleEndianUint64(validatorFields[VALIDATOR_WITHDRAWABLE_EPOCH_INDEX]);\n    }\n\n    /**\n     * Indices for withdrawal fields (refer to consensus specs):\n     * 0: withdrawal index\n     * 1: validator index\n     * 2: execution address\n     * 3: withdrawal amount\n     */\n\n    /**\n     * @dev Retrieves a withdrawal's validator index\n     */\n    function getValidatorIndex(bytes32[] memory withdrawalFields) internal pure returns (uint40) {\n        return \n            uint40(Endian.fromLittleEndianUint64(withdrawalFields[WITHDRAWAL_VALIDATOR_INDEX_INDEX]));\n    }\n\n    /**\n     * @dev Retrieves a withdrawal's withdrawal amount (in gwei)\n     */\n    function getWithdrawalAmountGwei(bytes32[] memory withdrawalFields) internal pure returns (uint64) {\n        return\n            Endian.fromLittleEndianUint64(withdrawalFields[WITHDRAWAL_VALIDATOR_AMOUNT_INDEX]);\n    }\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/libraries/Merkle.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// Adapted from OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\n */\nlibrary Merkle {\n    /**\n     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n     * hash matches the root of the tree. The tree is built assuming `leaf` is\n     * the 0 indexed `index`'th leaf from the bottom left of the tree.\n     *\n     * Note this is for a Merkle tree using the keccak/sha3 hash function\n     */\n    function verifyInclusionKeccak(\n        bytes memory proof,\n        bytes32 root,\n        bytes32 leaf,\n        uint256 index\n    ) internal pure returns (bool) {\n        return processInclusionProofKeccak(proof, leaf, index) == root;\n    }\n\n    /**\n     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n     * hash matches the root of the tree. The tree is built assuming `leaf` is\n     * the 0 indexed `index`'th leaf from the bottom left of the tree.\n     *\n     * _Available since v4.4._\n     *\n     * Note this is for a Merkle tree using the keccak/sha3 hash function\n     */\n    function processInclusionProofKeccak(\n        bytes memory proof,\n        bytes32 leaf,\n        uint256 index\n    ) internal pure returns (bytes32) {\n        require(\n            proof.length != 0 && proof.length % 32 == 0,\n            \"Merkle.processInclusionProofKeccak: proof length should be a non-zero multiple of 32\"\n        );\n        bytes32 computedHash = leaf;\n        for (uint256 i = 32; i <= proof.length; i += 32) {\n            if (index % 2 == 0) {\n                // if ith bit of index is 0, then computedHash is a left sibling\n                assembly {\n                    mstore(0x00, computedHash)\n                    mstore(0x20, mload(add(proof, i)))\n                    computedHash := keccak256(0x00, 0x40)\n                    index := div(index, 2)\n                }\n            } else {\n                // if ith bit of index is 1, then computedHash is a right sibling\n                assembly {\n                    mstore(0x00, mload(add(proof, i)))\n                    mstore(0x20, computedHash)\n                    computedHash := keccak256(0x00, 0x40)\n                    index := div(index, 2)\n                }\n            }\n        }\n        return computedHash;\n    }\n\n    /**\n     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n     * hash matches the root of the tree. The tree is built assuming `leaf` is\n     * the 0 indexed `index`'th leaf from the bottom left of the tree.\n     *\n     * Note this is for a Merkle tree using the sha256 hash function\n     */\n    function verifyInclusionSha256(\n        bytes memory proof,\n        bytes32 root,\n        bytes32 leaf,\n        uint256 index\n    ) internal view returns (bool) {\n        return processInclusionProofSha256(proof, leaf, index) == root;\n    }\n\n    /**\n     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n     * hash matches the root of the tree. The tree is built assuming `leaf` is\n     * the 0 indexed `index`'th leaf from the bottom left of the tree.\n     *\n     * _Available since v4.4._\n     *\n     * Note this is for a Merkle tree using the sha256 hash function\n     */\n    function processInclusionProofSha256(\n        bytes memory proof,\n        bytes32 leaf,\n        uint256 index\n    ) internal view returns (bytes32) {\n        require(\n            proof.length != 0 && proof.length % 32 == 0,\n            \"Merkle.processInclusionProofSha256: proof length should be a non-zero multiple of 32\"\n        );\n        bytes32[1] memory computedHash = [leaf];\n        for (uint256 i = 32; i <= proof.length; i += 32) {\n            if (index % 2 == 0) {\n                // if ith bit of index is 0, then computedHash is a left sibling\n                assembly {\n                    mstore(0x00, mload(computedHash))\n                    mstore(0x20, mload(add(proof, i)))\n                    if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) {\n                        revert(0, 0)\n                    }\n                    index := div(index, 2)\n                }\n            } else {\n                // if ith bit of index is 1, then computedHash is a right sibling\n                assembly {\n                    mstore(0x00, mload(add(proof, i)))\n                    mstore(0x20, mload(computedHash))\n                    if iszero(staticcall(sub(gas(), 2000), 2, 0x00, 0x40, computedHash, 0x20)) {\n                        revert(0, 0)\n                    }\n                    index := div(index, 2)\n                }\n            }\n        }\n        return computedHash[0];\n    }\n\n    /**\n     @notice this function returns the merkle root of a tree created from a set of leaves using sha256 as its hash function\n     @param leaves the leaves of the merkle tree\n     @return The computed Merkle root of the tree.\n     @dev A pre-condition to this function is that leaves.length is a power of two.  If not, the function will merkleize the inputs incorrectly.\n     */\n    function merkleizeSha256(bytes32[] memory leaves) internal pure returns (bytes32) {\n        //there are half as many nodes in the layer above the leaves\n        uint256 numNodesInLayer = leaves.length / 2;\n        //create a layer to store the internal nodes\n        bytes32[] memory layer = new bytes32[](numNodesInLayer);\n        //fill the layer with the pairwise hashes of the leaves\n        for (uint256 i = 0; i < numNodesInLayer; i++) {\n            layer[i] = sha256(abi.encodePacked(leaves[2 * i], leaves[2 * i + 1]));\n        }\n        //the next layer above has half as many nodes\n        numNodesInLayer /= 2;\n        //while we haven't computed the root\n        while (numNodesInLayer != 0) {\n            //overwrite the first numNodesInLayer nodes in layer with the pairwise hashes of their children\n            for (uint256 i = 0; i < numNodesInLayer; i++) {\n                layer[i] = sha256(abi.encodePacked(layer[2 * i], layer[2 * i + 1]));\n            }\n            //the next layer above has half as many nodes\n            numNodesInLayer /= 2;\n        }\n        //the first node in the layer is the root\n        return layer[0];\n    }\n}\n"
      },
      "lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/contracts/libraries/Endian.sol": {
        "content": "// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.0;\n\nlibrary Endian {\n    /**\n     * @notice Converts a little endian-formatted uint64 to a big endian-formatted uint64\n     * @param lenum little endian-formatted uint64 input, provided as 'bytes32' type\n     * @return n The big endian-formatted uint64\n     * @dev Note that the input is formatted as a 'bytes32' type (i.e. 256 bits), but it is immediately truncated to a uint64 (i.e. 64 bits)\n     * through a right-shift/shr operation.\n     */\n    function fromLittleEndianUint64(bytes32 lenum) internal pure returns (uint64 n) {\n        // the number needs to be stored in little-endian encoding (ie in bytes 0-8)\n        n = uint64(uint256(lenum >> 192));\n        return\n            (n >> 56) |\n            ((0x00FF000000000000 & n) >> 40) |\n            ((0x0000FF0000000000 & n) >> 24) |\n            ((0x000000FF00000000 & n) >> 8) |\n            ((0x00000000FF000000 & n) << 8) |\n            ((0x0000000000FF0000 & n) << 24) |\n            ((0x000000000000FF00 & n) << 40) |\n            ((0x00000000000000FF & n) << 56);\n    }\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/",
        "@openzeppelin/=lib/openzeppelin-contracts/",
        "eigenlayer-middleware/=lib/eigenlayer-middleware/src/",
        "eigenlayer-core/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/",
        "eigenlayer-scripts/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/script/",
        "forge-std/=lib/forge-std/src/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "eigenlayer-contracts/=lib/eigenlayer-middleware/lib/eigenlayer-contracts/",
        "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs"
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "london",
      "viaIR": false,
      "libraries": {}
    }
  }}