From 6f4ed595f2a01d1a5e3333a816abb4a565f8a7c2 Mon Sep 17 00:00:00 2001 From: nicolas <48695862+merklefruit@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:54:02 +0100 Subject: [PATCH] chore: upgrade manager script --- .../script/holesky/admin/Upgrade.s.sol | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/bolt-contracts/script/holesky/admin/Upgrade.s.sol b/bolt-contracts/script/holesky/admin/Upgrade.s.sol index bc6611dd7..2776e93ef 100644 --- a/bolt-contracts/script/holesky/admin/Upgrade.s.sol +++ b/bolt-contracts/script/holesky/admin/Upgrade.s.sol @@ -9,6 +9,7 @@ import {Upgrades, Options} from "@openzeppelin-foundry-upgrades/src/Upgrades.sol import {BoltParametersV1} from "../../../src/contracts/BoltParametersV1.sol"; import {BoltValidatorsV1} from "../../../src/contracts/BoltValidatorsV1.sol"; import {BoltManagerV1} from "../../../src/contracts/BoltManagerV1.sol"; +import {BoltManagerV2} from "../../../src/contracts/BoltManagerV2.sol"; import {BoltEigenLayerMiddlewareV1} from "../../../src/contracts/BoltEigenLayerMiddlewareV1.sol"; import {BoltEigenLayerMiddlewareV2} from "../../../src/contracts/BoltEigenLayerMiddlewareV2.sol"; import {BoltSymbioticMiddlewareV1} from "../../../src/contracts/BoltSymbioticMiddlewareV1.sol"; @@ -125,12 +126,37 @@ contract UpgradeBolt is Script { vm.startBroadcast(admin); Upgrades.upgradeProxy(deployments.boltValidators, upgradeTo, initBoltValidators, opts); - + vm.stopBroadcast(); console.log("BoltValidators proxy upgraded from %s to %s", opts.referenceContract, upgradeTo); } + function upgradeBoltManager() public { + address admin = msg.sender; + console.log("Upgrading BoltManager with admin", admin); + // TODO: Validate upgrades with Upgrades.validateUpgrade + + Options memory opts; + opts.unsafeSkipAllChecks = true; + opts.referenceContract = "BoltManagerV1.sol"; + string memory upgradeTo = "BoltManagerV2.sol"; + + Deployments memory deployments = _readDeployments(); + bytes memory initManager = abi.encodeCall( + BoltManagerV2.initializeV2, + (admin, deployments.boltParameters, deployments.boltValidators) + ); + + vm.startBroadcast(admin); + + Upgrades.upgradeProxy(deployments.boltManager, upgradeTo, initManager, opts); + + vm.stopBroadcast(); + + console.log("BoltManager 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");