diff --git a/bolt-contracts/script/holesky/admin/Upgrade.s.sol b/bolt-contracts/script/holesky/admin/Upgrade.s.sol index e549a53d4..9f75f7e08 100644 --- a/bolt-contracts/script/holesky/admin/Upgrade.s.sol +++ b/bolt-contracts/script/holesky/admin/Upgrade.s.sol @@ -10,6 +10,7 @@ import {BoltParametersV1} from "../../../src/contracts/BoltParametersV1.sol"; import {BoltValidatorsV1} from "../../../src/contracts/BoltValidatorsV1.sol"; import {BoltManagerV1} from "../../../src/contracts/BoltManagerV1.sol"; import {BoltEigenLayerMiddlewareV1} from "../../../src/contracts/BoltEigenLayerMiddlewareV1.sol"; +import {BoltEigenLayerMiddlewareV2} from "../../../src/contracts/BoltEigenLayerMiddlewareV2.sol"; import {BoltSymbioticMiddlewareV1} from "../../../src/contracts/BoltSymbioticMiddlewareV1.sol"; import {BoltSymbioticMiddlewareV2} from "../../../src/contracts/BoltSymbioticMiddlewareV2.sol"; import {BoltConfig} from "../../../src/lib/Config.sol"; @@ -27,12 +28,13 @@ contract UpgradeBolt is Script { address eigenLayerAVSDirectory; address eigenLayerDelegationManager; address eigenLayerStrategyManager; + address eigenLayerMiddleware; address[] supportedStrategies; } - function run() public { + function upgradeSymbioticMiddleware() public { address admin = msg.sender; - console.log("Upgrading with admin", admin); + console.log("Upgrading Symbiotic middleware with admin", admin); // TODO: Validate upgrades with Upgrades.validateUpgrade Options memory opts; @@ -67,6 +69,40 @@ contract UpgradeBolt is Script { // TODO: Upgrade contracts with Upgrades.upgradeProxy } + function upgradeEigenLayerMiddleware() public { + address admin = msg.sender; + console.log("Upgrading EigenLayer middleware with admin", admin); + // TODO: Validate upgrades with Upgrades.validateUpgrade + + Options memory opts; + opts.unsafeSkipAllChecks = true; + opts.referenceContract = "BoltEigenLayerMiddlewareV1.sol"; + + string memory upgradeTo = "BoltEigenLayerMiddlewareV2.sol"; + + Deployments memory deployments = _readDeployments(); + + bytes memory initEigenLayerMiddleware = abi.encodeCall( + BoltEigenLayerMiddlewareV2.initializeV2, + ( + admin, + deployments.boltParameters, + deployments.boltManager, + deployments.eigenLayerAVSDirectory, + deployments.eigenLayerDelegationManager, + deployments.eigenLayerStrategyManager + ) + ); + + vm.startBroadcast(admin); + + Upgrades.upgradeProxy(deployments.eigenLayerMiddleware, upgradeTo, initEigenLayerMiddleware, opts); + + vm.stopBroadcast(); + + console.log("BoltSymbioticMiddleware proxy upgraded from %s to %s", opts.referenceContract, upgradeTo); + } + function _readDeployments() public view returns (Deployments memory) { string memory root = vm.projectRoot(); string memory path = string.concat(root, "/config/holesky/deployments.json"); @@ -84,6 +120,7 @@ contract UpgradeBolt is Script { eigenLayerAVSDirectory: vm.parseJsonAddress(json, ".eigenLayer.avsDirectory"), eigenLayerDelegationManager: vm.parseJsonAddress(json, ".eigenLayer.delegationManager"), eigenLayerStrategyManager: vm.parseJsonAddress(json, ".eigenLayer.strategyManager"), + eigenLayerMiddleware: vm.parseJsonAddress(json, ".eigenLayer.middleware"), supportedStrategies: vm.parseJsonAddressArray(json, ".eigenLayer.supportedStrategies") }); } diff --git a/bolt-contracts/src/contracts/BoltEigenLayerMiddlewareV1.sol b/bolt-contracts/src/contracts/BoltEigenLayerMiddlewareV1.sol index 750501777..34d4b1b9a 100644 --- a/bolt-contracts/src/contracts/BoltEigenLayerMiddlewareV1.sol +++ b/bolt-contracts/src/contracts/BoltEigenLayerMiddlewareV1.sol @@ -23,7 +23,7 @@ import {AVSDirectoryStorage} from "@eigenlayer/src/contracts/core/AVSDirectorySt import {DelegationManagerStorage} from "@eigenlayer/src/contracts/core/DelegationManagerStorage.sol"; import {StrategyManagerStorage} from "@eigenlayer/src/contracts/core/StrategyManagerStorage.sol"; -/// @title Bolt Manager +/// @title Bolt EigenLayer Middleware contract. /// @notice This contract is responsible for interfacing with the EigenLayer restaking protocol. /// @dev This contract is upgradeable using the UUPSProxy pattern. Storage layout remains fixed across upgrades /// with the use of storage gaps. diff --git a/bolt-contracts/src/contracts/BoltEigenLayerMiddlewareV2.sol b/bolt-contracts/src/contracts/BoltEigenLayerMiddlewareV2.sol index 3b3c435fb..a73921f37 100644 --- a/bolt-contracts/src/contracts/BoltEigenLayerMiddlewareV2.sol +++ b/bolt-contracts/src/contracts/BoltEigenLayerMiddlewareV2.sol @@ -24,7 +24,7 @@ import {AVSDirectoryStorage} from "@eigenlayer/src/contracts/core/AVSDirectorySt import {DelegationManagerStorage} from "@eigenlayer/src/contracts/core/DelegationManagerStorage.sol"; import {StrategyManagerStorage} from "@eigenlayer/src/contracts/core/StrategyManagerStorage.sol"; -/// @title Bolt Manager +/// @title Bolt EigenLayer Middleware contract. /// @notice This contract is responsible for interfacing with the EigenLayer restaking protocol. /// @dev This contract is upgradeable using the UUPSProxy pattern. Storage layout remains fixed across upgrades /// with the use of storage gaps. @@ -107,6 +107,25 @@ contract BoltEigenLayerMiddlewareV2 is IBoltMiddlewareV1, IServiceManager, Ownab NAME_HASH = keccak256("EIGENLAYER"); } + function initializeV2( + address _owner, + address _parameters, + address _manager, + address _eigenlayerAVSDirectory, + address _eigenlayerDelegationManager, + address _eigenlayerStrategyManager + ) public reinitializer(2) { + __Ownable_init(_owner); + parameters = IBoltParametersV1(_parameters); + manager = IBoltManagerV1(_manager); + START_TIMESTAMP = Time.timestamp(); + + AVS_DIRECTORY = IAVSDirectory(_eigenlayerAVSDirectory); + DELEGATION_MANAGER = DelegationManagerStorage(_eigenlayerDelegationManager); + STRATEGY_MANAGER = StrategyManagerStorage(_eigenlayerStrategyManager); + NAME_HASH = keccak256("EIGENLAYER"); + } + function _authorizeUpgrade( address newImplementation ) internal override onlyOwner {}