From 78f22a6d2c4504df36561c86da1053e8deadefa6 Mon Sep 17 00:00:00 2001 From: Jonas Bostoen Date: Thu, 24 Oct 2024 14:45:07 +0200 Subject: [PATCH] fix(contracts/scripts): register Symbiotic operator script --- .../operators/RegisterSymbioticOperator.s.sol | 25 +++++++++++-------- testnets/holesky/README.md | 4 +-- 2 files changed, 17 insertions(+), 12 deletions(-) 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 \