From b87eb13b9e1cc57330a313287380e7c194ef2bf5 Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Wed, 23 Oct 2024 16:08:38 +0200 Subject: [PATCH 1/5] feat(holesky): update scripts + README for Symbiotic integration --- .../operators/RegisterSymbioticOperator.s.sol | 37 +++++++++++----- testnets/holesky/README.md | 43 +++++++++++++++---- 2 files changed, 61 insertions(+), 19 deletions(-) diff --git a/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol b/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol index 0089432c0..f2728c85b 100644 --- a/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol +++ b/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol @@ -4,7 +4,10 @@ pragma solidity 0.8.25; import {Script, console} from "forge-std/Script.sol"; import {BoltSymbioticMiddlewareV1} from "../../../src/contracts/BoltSymbioticMiddlewareV1.sol"; +import {IBoltManagerV1} from "../../../src/interfaces/IBoltManagerV1.sol"; + import {IOptInService} from "@symbiotic/interfaces/service/IOptInService.sol"; +import {IVault} from "@symbiotic/interfaces/vault/IVault.sol"; contract RegisterSymbioticOperator is Script { struct Config { @@ -14,7 +17,7 @@ contract RegisterSymbioticOperator is Script { address symbioticNetwork; } - function run() public { + function S01_registerIntoBolt() public { uint256 operatorSk = vm.envUint("OPERATOR_SK"); address operator = vm.addr(operatorSk); @@ -22,15 +25,12 @@ contract RegisterSymbioticOperator is Script { Config memory config = _readConfig(); // First, make sure the operator is opted into the network - if (!config.symbioticNetworkOptInService.isOptedIn(operator, config.symbioticNetwork)) { - console.log("Operator is not opted into the network yet. Opting in..."); - vm.startBroadcast(operatorSk); - config.symbioticNetworkOptInService.optIn(config.symbioticNetwork); - vm.stopBroadcast(); - console.log("Operator successfully opted into the network"); - } - - console.log("Registering Symbiotic operator"); + require( + config.symbioticNetworkOptInService.isOptedIn(operator, config.symbioticNetwork), + "Operator must be opted in into Bolt Network" + ); + + console.log("Registering Symbiotic operator into Bolt"); console.log("Operator address:", operator); console.log("Operator RPC:", config.rpc); @@ -41,6 +41,16 @@ contract RegisterSymbioticOperator is Script { vm.stopBroadcast(); } + function S02_checkOperatorRegistration() public view { + address operatorPublicKey = vm.envAddress("OPERATOR_PK"); + console.log("Checking operator registration for address", operatorPublicKey); + + IBoltManagerV1 boltManager = _readBoltManager(); + bool isRegistered = boltManager.isOperator(operatorPublicKey); + console.log("Operator is registered:", isRegistered); + require(isRegistered, "Operator is not registered"); + } + function _readConfig() public view returns (Config memory) { string memory root = vm.projectRoot(); string memory path = string.concat(root, "/config/holesky/deployments.json"); @@ -56,4 +66,11 @@ contract RegisterSymbioticOperator is Script { symbioticNetworkOptInService: IOptInService(vm.parseJsonAddress(json, ".symbiotic.networkOptInService")) }); } + + function _readBoltManager() public view returns (IBoltManagerV1) { + string memory root = vm.projectRoot(); + string memory path = string.concat(root, "/config/holesky/deployments.json"); + string memory json = vm.readFile(path); + return IBoltManagerV1(vm.parseJsonAddress(json, ".bolt.manager")); + } } diff --git a/testnets/holesky/README.md b/testnets/holesky/README.md index 524d64335..b15e25fc0 100644 --- a/testnets/holesky/README.md +++ b/testnets/holesky/README.md @@ -493,28 +493,53 @@ directory. As an operator, you will need to opt-in to the Bolt Network and any Vault that trusts you to provide commitments on their behalf. -The opt-in process requires the following steps: - **External Steps** > [!NOTE] > The network and supported vault addresses can be found in > [`deployments.json`](../../bolt-contracts/config/holesky/deployments.json). -1. register in Symbiotic with `OperatorRegistry.registerOperator()`. -2. opt-in to the Bolt network with - `OperatorNetworkOptInService.optIn(networkAddress)`. -3. opt-in to any vault with `OperatorVaultOptInService.optIn(vaultAddress)`. +Make sure you have installed the [Symbiotic +CLI](https://docs.symbiotic.fi/guides/cli/). + +The opt-in process requires the following steps: + +1. if you haven't done it already, register as a Symbiotic Operator with the + [`register-operator`](https://docs.symbiotic.fi/guides/cli/#register-operator) + command; +2. opt-in to the Bolt network with the + [`opt-in-network`](https://docs.symbiotic.fi/guides/cli/#opt-in-network) + command; +3. opt-in to any vault using the + [`opt-in-vault`](https://docs.symbiotic.fi/guides/cli/#opt-in-vault) command; +4. deposit collateral into the vault using the + [`deposit`](https://docs.symbiotic.fi/guides/cli/#deposit) command. **Internal Steps** -Run the provided Forge script to register a Symbiotic operator: +After having deposited collateral into a vault you need to register into +Bolt as a Symbiotic operator. We've provided a script to facilitate the +procedure. If you want to use it, please set the operator private key to an +`OPERATOR_SK` environment variable, and then run the following Forge script from +the `bolt-contracts` directory: ```bash -forge script script/holesky/operators/RegisterSymbioticOperator.s.sol --rpc-url $HOLESKY_RPC -vvvv --broadcast +forge script script/holesky/operators/RegisterSymbioticOperator.s.sol \ + --sig "S01_registerIntoBolt" \ + --rpc-url $HOLESKY_RPC \ + -vvvv \ + --broadcast ``` -If all goes well, your Symbiotic operator was registered into Bolt. +To check if your operator is correctly registered, set the operator public key +in the `OPERATOR_PK` environment variable and run the following script: + +```bash +forge script script/holesky/operators/RegisterSymbioticOperator.s.sol \ + --sig "S02_checkOperatorRegistration" \ + --rpc-url $HOLESKY_RPC \ + -vvvv +``` ### EigenLayer Registration Steps From eaa231491d0a2b878667e73324f5cf3665fa29f6 Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Thu, 24 Oct 2024 11:13:17 +0200 Subject: [PATCH 2/5] fix(holesky): config options for Symbiotic guide Don't use operators.json file but provide the RPC URL using an enviroment value --- .../operators/RegisterSymbioticOperator.s.sol | 5 ++-- testnets/holesky/README.md | 23 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol b/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol index f2728c85b..b5a6d46d8 100644 --- a/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol +++ b/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol @@ -19,6 +19,7 @@ contract RegisterSymbioticOperator is Script { function S01_registerIntoBolt() public { uint256 operatorSk = vm.envUint("OPERATOR_SK"); + string memory rpc = vm.envString("OPERATOR_RPC"); address operator = vm.addr(operatorSk); @@ -32,10 +33,10 @@ contract RegisterSymbioticOperator is Script { console.log("Registering Symbiotic operator into Bolt"); console.log("Operator address:", operator); - console.log("Operator RPC:", config.rpc); + console.log("Operator RPC:", rpc); vm.startBroadcast(operatorSk); - config.symbioticMiddleware.registerOperator(config.rpc); + config.symbioticMiddleware.registerOperator(rpc); console.log("Successfully registered Symbiotic operator"); vm.stopBroadcast(); diff --git a/testnets/holesky/README.md b/testnets/holesky/README.md index b15e25fc0..154328429 100644 --- a/testnets/holesky/README.md +++ b/testnets/holesky/README.md @@ -519,17 +519,20 @@ The opt-in process requires the following steps: After having deposited collateral into a vault you need to register into Bolt as a Symbiotic operator. We've provided a script to facilitate the -procedure. If you want to use it, please set the operator private key to an -`OPERATOR_SK` environment variable, and then run the following Forge script from -the `bolt-contracts` directory: +procedure. If you want to use it, please follow these steps: -```bash -forge script script/holesky/operators/RegisterSymbioticOperator.s.sol \ - --sig "S01_registerIntoBolt" \ - --rpc-url $HOLESKY_RPC \ - -vvvv \ - --broadcast -``` +1. set the operator private key to the `OPERATOR_SK` environment variable; +2. set the operator RPC URL which supports the Commitments API to the + `OPERATOR_RPC` environment variable; +3. run the following Forge script from the `bolt-contracts` directory: + + ```bash + forge script script/holesky/operators/RegisterSymbioticOperator.s.sol \ + --sig "S01_registerIntoBolt" \ + --rpc-url $HOLESKY_RPC \ + -vvvv \ + --broadcast + ``` To check if your operator is correctly registered, set the operator public key in the `OPERATOR_PK` environment variable and run the following script: From 146699b1331c97320922a5900af47c080625fb28 Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Thu, 24 Oct 2024 13:41:41 +0200 Subject: [PATCH 3/5] chore(holesky): upgrade vault addresses for Symbiotic --- testnets/holesky/README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testnets/holesky/README.md b/testnets/holesky/README.md index 154328429..6574cb06d 100644 --- a/testnets/holesky/README.md +++ b/testnets/holesky/README.md @@ -354,8 +354,12 @@ EigenLayer protocol. Bolt is compatible with the following ETH derivative tokens on Holesky: - [Symbiotic Vaults](https://docs.symbiotic.fi/deployments#vaults) - - [`wstETH`](https://holesky.etherscan.io/address/0x8d09a4502Cc8Cf1547aD300E066060D043f6982D) - - [`rETH`](https://holesky.etherscan.io/address/0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1) + - [`wstETH`](https://holesky.etherscan.io/address/0xc79c533a77691641d52ebD5e87E51dCbCaeb0D78) + - [`rETH`](https://holesky.etherscan.io/address/0xe5708788c90e971f73D928b7c5A8FD09137010e0) + - [`stETH`](https://holesky.etherscan.io/address/0x11c5b9A9cd8269580aDDbeE38857eE451c1CFacd) + - [`WETH`](https://holesky.etherscan.io/address/0xC56Ba584929c6f381744fA2d7a028fA927817f2b) + - [`cbETH`](https://holesky.etherscan.io/address/0xcDdeFfcD2bA579B8801af1d603812fF64c301462) + - [`mETH`](https://holesky.etherscan.io/address/0x91e84e12Bb65576C0a6614c5E6EbbB2eA595E10f) - [EigenLayer Strategies](https://github.com/Layr-Labs/eigenlayer-contracts#current-testnet-deployment) - [`stETH`](https://holesky.etherscan.io/address/0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034) - [`rETH`](https://holesky.etherscan.io/address/0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1) From 1818d690d13f50057767c12c605cc76732b61cdc Mon Sep 17 00:00:00 2001 From: Jonas Bostoen Date: Thu, 24 Oct 2024 14:45:07 +0200 Subject: [PATCH 4/5] fix(contracts/scripts): register Symbiotic operator script --- .../config/holesky/deployments.json | 12 ++++----- .../operators/RegisterSymbioticOperator.s.sol | 25 +++++++++++-------- testnets/holesky/README.md | 4 +-- 3 files changed, 23 insertions(+), 18 deletions(-) diff --git a/bolt-contracts/config/holesky/deployments.json b/bolt-contracts/config/holesky/deployments.json index 8b028dbec..72ab97309 100644 --- a/bolt-contracts/config/holesky/deployments.json +++ b/bolt-contracts/config/holesky/deployments.json @@ -5,11 +5,11 @@ }, "symbiotic": { "network": "0xb017002D8024d8c8870A5CECeFCc63887650D2a4", - "operatorRegistry": "0xAdFC41729fF447974cE27DdFa358A0f2096c3F39", - "networkOptInService": "0xF5AFc9FA3Ca63a07E529DDbB6eae55C665cCa83E", - "vaultFactory": "0x18C659a269a7172eF78BBC19Fe47ad2237Be0590", - "networkRegistry": "0xac5acD8A105C8305fb980734a5AD920b5920106A", - "networkMiddlewareService": "0x683F470440964E353b389391CdDDf8df381C282f", + "operatorRegistry": "0x6F75a4ffF97326A00e52662d82EA4FdE86a2C548", + "networkOptInService": "0x58973d16FFA900D11fC22e5e2B6840d9f7e13401", + "vaultFactory": "0x407A039D94948484D356eFB765b3c74382A050B4", + "networkRegistry": "0x7d03b7343BF8d5cEC7C0C27ecE084a20113D15C9", + "networkMiddlewareService": "0x62a1ddfD86b4c1636759d9286D3A0EC722D086e3", "middleware": "0x04f40d9CaE475E5BaA462acE53E5c58A0DD8D8e8", "supportedVaults": [ "0x1df2fbfcD600ADd561013f44B2D055E2e974f605", @@ -29,4 +29,4 @@ "0xaccc5A86732BE85b5012e8614AF237801636F8e5" ] } -} +} \ No newline at end of file diff --git a/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol b/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol index b5a6d46d8..d57902e9b 100644 --- a/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol +++ b/bolt-contracts/script/holesky/operators/RegisterSymbioticOperator.s.sol @@ -11,7 +11,6 @@ import {IVault} from "@symbiotic/interfaces/vault/IVault.sol"; contract RegisterSymbioticOperator is Script { struct Config { - string rpc; BoltSymbioticMiddlewareV1 symbioticMiddleware; IOptInService symbioticNetworkOptInService; address symbioticNetwork; @@ -25,14 +24,15 @@ contract RegisterSymbioticOperator is Script { Config memory config = _readConfig(); + console.log("Registering Symbiotic operator into Bolt"); + console.log("Operator address:", operator); + // First, make sure the operator is opted into the network require( config.symbioticNetworkOptInService.isOptedIn(operator, config.symbioticNetwork), "Operator must be opted in into Bolt Network" ); - console.log("Registering Symbiotic operator into Bolt"); - console.log("Operator address:", operator); console.log("Operator RPC:", rpc); vm.startBroadcast(operatorSk); @@ -40,14 +40,23 @@ contract RegisterSymbioticOperator is Script { console.log("Successfully registered Symbiotic operator"); vm.stopBroadcast(); + + (address[] memory tokens, uint256[] memory amounts) = + config.symbioticMiddleware.getOperatorCollaterals(operator); + + console.log("Operator collateral:"); + for (uint256 i; i < tokens.length; ++i) { + console.log("Collateral:", tokens[i], "Amount:", amounts[i]); + } } function S02_checkOperatorRegistration() public view { - address operatorPublicKey = vm.envAddress("OPERATOR_PK"); - console.log("Checking operator registration for address", operatorPublicKey); + address operatorAddress = vm.envAddress("OPERATOR_ADDRESS"); + console.log("Checking operator registration for address", operatorAddress); IBoltManagerV1 boltManager = _readBoltManager(); - bool isRegistered = boltManager.isOperator(operatorPublicKey); + bool isRegistered = boltManager.isOperator(operatorAddress); + console.log("Operator is registered:", isRegistered); require(isRegistered, "Operator is not registered"); } @@ -57,11 +66,7 @@ contract RegisterSymbioticOperator is Script { string memory path = string.concat(root, "/config/holesky/deployments.json"); string memory json = vm.readFile(path); - string memory operatorPath = string.concat(root, "/config/holesky/operator.json"); - string memory operatorJson = vm.readFile(operatorPath); - return Config({ - rpc: vm.parseJsonString(operatorJson, ".rpc"), symbioticNetwork: vm.parseJsonAddress(json, ".symbiotic.network"), symbioticMiddleware: BoltSymbioticMiddlewareV1(vm.parseJsonAddress(json, ".symbiotic.middleware")), symbioticNetworkOptInService: IOptInService(vm.parseJsonAddress(json, ".symbiotic.networkOptInService")) diff --git a/testnets/holesky/README.md b/testnets/holesky/README.md index 6574cb06d..5ddfb7a3f 100644 --- a/testnets/holesky/README.md +++ b/testnets/holesky/README.md @@ -538,8 +538,8 @@ procedure. If you want to use it, please follow these steps: --broadcast ``` -To check if your operator is correctly registered, set the operator public key -in the `OPERATOR_PK` environment variable and run the following script: +To check if your operator is correctly registered, set the operator address +in the `OPERATOR_ADDRESS` environment variable and run the following script: ```bash forge script script/holesky/operators/RegisterSymbioticOperator.s.sol \ From 146d915405eba0fea7709f8a8e1ae0dbbb6a377c Mon Sep 17 00:00:00 2001 From: Jonas Bostoen Date: Thu, 24 Oct 2024 14:50:09 +0200 Subject: [PATCH 5/5] fix(contracts): update deployments --- bolt-contracts/config/holesky/deployments.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bolt-contracts/config/holesky/deployments.json b/bolt-contracts/config/holesky/deployments.json index 72ab97309..09dad75cc 100644 --- a/bolt-contracts/config/holesky/deployments.json +++ b/bolt-contracts/config/holesky/deployments.json @@ -1,6 +1,7 @@ { "bolt": { "validators": "0x47D2DC1DE1eFEFA5e6944402f2eda3981D36a9c8", + "parameters": "0x20d1cf3A5BD5928dB3118b2CfEF54FDF9fda5c12", "manager": "0x440202829b493F9FF43E730EB5e8379EEa3678CF" }, "symbiotic": { @@ -12,8 +13,12 @@ "networkMiddlewareService": "0x62a1ddfD86b4c1636759d9286D3A0EC722D086e3", "middleware": "0x04f40d9CaE475E5BaA462acE53E5c58A0DD8D8e8", "supportedVaults": [ - "0x1df2fbfcD600ADd561013f44B2D055E2e974f605", - "0xf427d00c34609053d97167352061DD2F0F27F853" + "0xc79c533a77691641d52ebD5e87E51dCbCaeb0D78", + "0xe5708788c90e971f73D928b7c5A8FD09137010e0", + "0x11c5b9A9cd8269580aDDbeE38857eE451c1CFacd", + "0xC56Ba584929c6f381744fA2d7a028fA927817f2b", + "0xcDdeFfcD2bA579B8801af1d603812fF64c301462", + "0x91e84e12Bb65576C0a6614c5E6EbbB2eA595E10f" ] }, "eigenLayer": {