Skip to content

Commit

Permalink
feat(holesky): update scripts + README for Symbiotic integration
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Oct 24, 2024
1 parent 3925ccb commit 84e0504
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -14,23 +17,20 @@ contract RegisterSymbioticOperator is Script {
address symbioticNetwork;
}

function run() public {
function S01_registerIntoBolt() public {
uint256 operatorSk = vm.envUint("OPERATOR_SK");

address operator = vm.addr(operatorSk);

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);

Expand All @@ -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");
Expand All @@ -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"));
}
}
43 changes: 34 additions & 9 deletions testnets/holesky/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 84e0504

Please sign in to comment.