From f863e5c5f38e3f5612c01801f384fe23d5e5f2fd Mon Sep 17 00:00:00 2001 From: Jonas Bostoen Date: Fri, 18 Oct 2024 16:02:42 +0200 Subject: [PATCH] feat(contracts/script): update script directory structure --- bolt-contracts/docs/deploying.md | 8 +++---- bolt-contracts/script/holesky/Upgrade.s.sol | 22 ------------------- .../script/holesky/{ => admin}/Deploy.s.sol | 12 +++++----- .../script/holesky/admin/Upgrade.s.sol | 22 +++++++++++++++++++ .../{ => admin}/helpers/RegisterAVS.s.sol | 2 +- .../{ => admin}/helpers/Symbiotic.s.sol | 0 .../holesky/validators/RegisterOperator.s.sol | 4 ++++ .../validators/RegisterValidators.s.sol | 4 ++++ 8 files changed, 41 insertions(+), 33 deletions(-) delete mode 100644 bolt-contracts/script/holesky/Upgrade.s.sol rename bolt-contracts/script/holesky/{ => admin}/Deploy.s.sol (94%) create mode 100644 bolt-contracts/script/holesky/admin/Upgrade.s.sol rename bolt-contracts/script/holesky/{ => admin}/helpers/RegisterAVS.s.sol (90%) rename bolt-contracts/script/holesky/{ => admin}/helpers/Symbiotic.s.sol (100%) create mode 100644 bolt-contracts/script/holesky/validators/RegisterOperator.s.sol create mode 100644 bolt-contracts/script/holesky/validators/RegisterValidators.s.sol diff --git a/bolt-contracts/docs/deploying.md b/bolt-contracts/docs/deploying.md index 740e73fcb..f92918820 100644 --- a/bolt-contracts/docs/deploying.md +++ b/bolt-contracts/docs/deploying.md @@ -37,7 +37,7 @@ export ADMIN_PRIVATE_KEY=0x... Register a Symbiotic network for Bolt with the Symbiotic `NetworkRegistry`. The private key with which the script is run will determine the network address. This private key will also need to be used later. ```bash -forge script script/holesky/helpers/Symbiotic.s.sol $HOLESKY_RPC --private-key $NETWORK_PRIVATE_KEY --broadcast -vvvv --sig "run(string memory arg)" registerNetwork +forge script script/holesky/admin/helpers/Symbiotic.s.sol $HOLESKY_RPC --private-key $NETWORK_PRIVATE_KEY --broadcast -vvvv --sig "run(string memory arg)" registerNetwork ``` Make sure `deployments.json` contains the correct address for the Symbiotic network. @@ -46,7 +46,7 @@ Make sure `deployments.json` contains the correct address for the Symbiotic netw Run the following script to deploy Bolt V1: ```bash -forge script script/holesky/Deploy.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --broadcast -vvvv +forge script script/holesky/admin/Deploy.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --broadcast -vvvv ``` This will deploy all the contracts. The address corresponding to the private key will be the system admin. @@ -60,12 +60,12 @@ Register the deployed `SymbioticMiddleware` with the Symbiotic `NetworkMiddlewar to be run with the network private key! ```bash -forge script script/holesky/helpers/Symbiotic.s.sol --rpc-url $HOLESKY_RPC --private-key $NETWORK_PRIVATE_KEY --broadcast -vvvv --sig "run(string memory arg)" registerMiddleware +forge script script/holesky/admin/helpers/Symbiotic.s.sol --rpc-url $HOLESKY_RPC --private-key $NETWORK_PRIVATE_KEY --broadcast -vvvv --sig "run(string memory arg)" registerMiddleware ``` Also set the AVS metadata in the EigenLayer AVS Directory, needs to be run with the **admin private key** used at deployment. ```bash -forge script script/holesky/helpers/RegisterAVS.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --broadcast -vvvv +forge script script/holesky/admin/helpers/RegisterAVS.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --broadcast -vvvv ``` diff --git a/bolt-contracts/script/holesky/Upgrade.s.sol b/bolt-contracts/script/holesky/Upgrade.s.sol deleted file mode 100644 index be872b5e2..000000000 --- a/bolt-contracts/script/holesky/Upgrade.s.sol +++ /dev/null @@ -1,22 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.25; - -import {Script, console} from "forge-std/Script.sol"; - -import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; -import {Upgrades} 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 {BoltEigenLayerMiddlewareV1} from "../../src/contracts/BoltEigenLayerMiddlewareV1.sol"; -import {BoltSymbioticMiddlewareV1} from "../../src/contracts/BoltSymbioticMiddlewareV1.sol"; -import {BoltConfig} from "../../src/lib/Config.sol"; - -contract UpgradeBolt is Script { - function run() public { - // TODO: Validate upgrades with Upgrades.validateUpgrade - - // TODO: Upgrade contracts with Upgrades.upgradeProxy - } -} diff --git a/bolt-contracts/script/holesky/Deploy.s.sol b/bolt-contracts/script/holesky/admin/Deploy.s.sol similarity index 94% rename from bolt-contracts/script/holesky/Deploy.s.sol rename to bolt-contracts/script/holesky/admin/Deploy.s.sol index 1e96740ce..554791237 100644 --- a/bolt-contracts/script/holesky/Deploy.s.sol +++ b/bolt-contracts/script/holesky/admin/Deploy.s.sol @@ -10,12 +10,12 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IVault} from "@symbiotic/interfaces/vault/IVault.sol"; import {IStrategy} from "@eigenlayer/src/contracts/interfaces/IStrategy.sol"; -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 {BoltSymbioticMiddlewareV1} from "../../src/contracts/BoltSymbioticMiddlewareV1.sol"; -import {BoltConfig} from "../../src/lib/Config.sol"; +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 {BoltSymbioticMiddlewareV1} from "../../../src/contracts/BoltSymbioticMiddlewareV1.sol"; +import {BoltConfig} from "../../../src/lib/Config.sol"; /// @notice Script to deploy the Bolt contracts. contract DeployBolt is Script { diff --git a/bolt-contracts/script/holesky/admin/Upgrade.s.sol b/bolt-contracts/script/holesky/admin/Upgrade.s.sol new file mode 100644 index 000000000..6ca5b0518 --- /dev/null +++ b/bolt-contracts/script/holesky/admin/Upgrade.s.sol @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.25; + +import {Script, console} from "forge-std/Script.sol"; + +import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol"; +import {Upgrades} 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 {BoltEigenLayerMiddlewareV1} from "../../../src/contracts/BoltEigenLayerMiddlewareV1.sol"; +import {BoltSymbioticMiddlewareV1} from "../../../src/contracts/BoltSymbioticMiddlewareV1.sol"; +import {BoltConfig} from "../../../src/lib/Config.sol"; + +contract UpgradeBolt is Script { + function run() public { + // TODO: Validate upgrades with Upgrades.validateUpgrade + + // TODO: Upgrade contracts with Upgrades.upgradeProxy + } +} diff --git a/bolt-contracts/script/holesky/helpers/RegisterAVS.s.sol b/bolt-contracts/script/holesky/admin/helpers/RegisterAVS.s.sol similarity index 90% rename from bolt-contracts/script/holesky/helpers/RegisterAVS.s.sol rename to bolt-contracts/script/holesky/admin/helpers/RegisterAVS.s.sol index ed994fbd5..a424d721a 100644 --- a/bolt-contracts/script/holesky/helpers/RegisterAVS.s.sol +++ b/bolt-contracts/script/holesky/admin/helpers/RegisterAVS.s.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.25; import {Script, console} from "forge-std/Script.sol"; -import {BoltEigenLayerMiddlewareV1} from "../../../src/contracts/BoltEigenLayerMiddlewareV1.sol"; +import {BoltEigenLayerMiddlewareV1} from "../../../../src/contracts/BoltEigenLayerMiddlewareV1.sol"; contract RegisterAVS is Script { function run() public { diff --git a/bolt-contracts/script/holesky/helpers/Symbiotic.s.sol b/bolt-contracts/script/holesky/admin/helpers/Symbiotic.s.sol similarity index 100% rename from bolt-contracts/script/holesky/helpers/Symbiotic.s.sol rename to bolt-contracts/script/holesky/admin/helpers/Symbiotic.s.sol diff --git a/bolt-contracts/script/holesky/validators/RegisterOperator.s.sol b/bolt-contracts/script/holesky/validators/RegisterOperator.s.sol new file mode 100644 index 000000000..16adbc6d2 --- /dev/null +++ b/bolt-contracts/script/holesky/validators/RegisterOperator.s.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.25; + +import {Script, console} from "forge-std/Script.sol"; diff --git a/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol b/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol new file mode 100644 index 000000000..16adbc6d2 --- /dev/null +++ b/bolt-contracts/script/holesky/validators/RegisterValidators.s.sol @@ -0,0 +1,4 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.25; + +import {Script, console} from "forge-std/Script.sol";