From 901046e61f9dddd3eee8483a6eb7c69fbb442291 Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Wed, 23 Oct 2024 16:08:38 +0200 Subject: [PATCH] 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 cfdf062da..4aaf78691 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 the +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