Skip to content

Commit

Permalink
chore: upgrade manager script
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed Oct 29, 2024
1 parent 240a2bd commit 6f4ed59
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion bolt-contracts/script/holesky/admin/Upgrade.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 6f4ed59

Please sign in to comment.