Skip to content

Commit

Permalink
Merge pull request #313 from chainbound/lore/feat/holesky-symbiotic-s…
Browse files Browse the repository at this point in the history
…cripts

feat(holesky): update README and scripts for Symbiotic integration
  • Loading branch information
mempirate authored Oct 24, 2024
2 parents 295a56a + 146d915 commit 532281a
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 37 deletions.
21 changes: 13 additions & 8 deletions bolt-contracts/config/holesky/deployments.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
{
"bolt": {
"validators": "0x47D2DC1DE1eFEFA5e6944402f2eda3981D36a9c8",
"parameters": "0x20d1cf3A5BD5928dB3118b2CfEF54FDF9fda5c12",
"manager": "0x440202829b493F9FF43E730EB5e8379EEa3678CF"
},
"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",
"0xf427d00c34609053d97167352061DD2F0F27F853"
"0xc79c533a77691641d52ebD5e87E51dCbCaeb0D78",
"0xe5708788c90e971f73D928b7c5A8FD09137010e0",
"0x11c5b9A9cd8269580aDDbeE38857eE451c1CFacd",
"0xC56Ba584929c6f381744fA2d7a028fA927817f2b",
"0xcDdeFfcD2bA579B8801af1d603812fF64c301462",
"0x91e84e12Bb65576C0a6614c5E6EbbB2eA595E10f"
]
},
"eigenLayer": {
Expand All @@ -29,4 +34,4 @@
"0xaccc5A86732BE85b5012e8614AF237801636F8e5"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,79 @@ 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 {
string rpc;
BoltSymbioticMiddlewareV1 symbioticMiddleware;
IOptInService symbioticNetworkOptInService;
address symbioticNetwork;
}

function run() public {
function S01_registerIntoBolt() public {
uint256 operatorSk = vm.envUint("OPERATOR_SK");
string memory rpc = vm.envString("OPERATOR_RPC");

address operator = vm.addr(operatorSk);

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
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");
}
require(
config.symbioticNetworkOptInService.isOptedIn(operator, config.symbioticNetwork),
"Operator must be opted in into Bolt Network"
);

console.log("Registering Symbiotic operator");
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();

(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 operatorAddress = vm.envAddress("OPERATOR_ADDRESS");
console.log("Checking operator registration for address", operatorAddress);

IBoltManagerV1 boltManager = _readBoltManager();
bool isRegistered = boltManager.isOperator(operatorAddress);

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

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"));
}
}
56 changes: 44 additions & 12 deletions testnets/holesky/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -493,29 +497,57 @@ 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 follow these steps:

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 address
in the `OPERATOR_ADDRESS` environment variable and run the following script:

```bash
forge script script/holesky/operators/RegisterSymbioticOperator.s.sol --rpc-url $HOLESKY_RPC -vvvv --broadcast
forge script script/holesky/operators/RegisterSymbioticOperator.s.sol \
--sig "S02_checkOperatorRegistration" \
--rpc-url $HOLESKY_RPC \
-vvvv
```

If all goes well, your Symbiotic operator was registered into Bolt.

### EigenLayer Registration Steps

**External Steps**
Expand Down

0 comments on commit 532281a

Please sign in to comment.