Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: periphery deployments #311

Merged
merged 24 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8068700
feat(contracts): rm wrong eigenlayer submodule
mempirate Oct 23, 2024
fc2e9f5
forge install: eigenlayer-contracts
mempirate Oct 23, 2024
c98bdfc
feat(contracts): rm wrong symbiotic submodule
mempirate Oct 23, 2024
d6ad4ee
forge install: core
mempirate Oct 23, 2024
f72732a
test(contracts): fix Symbiotic tests with correct version
mempirate Oct 23, 2024
160a6c5
feat(contracts): create BoltEigenLayerMiddlewareV2
mempirate Oct 23, 2024
71c787c
forge install: eigenlayer-middleware
mempirate Oct 23, 2024
333d8dd
feat(contracts): implement IServiceManager
mempirate Oct 23, 2024
d70980c
feat(contracts): tests for BoltEigenLayerMiddlewareV2
mempirate Oct 23, 2024
0edb796
feat(contracts): vault deploy script (wip)
mempirate Oct 23, 2024
4e14a16
feat(contracts): vault deploy script (wip)
mempirate Oct 23, 2024
3c1bb7e
feat(contracts): update Symbiotic deployments (https://docs.symbiotic…
mempirate Oct 23, 2024
1c1ec6e
feat(contracts/script): update script
mempirate Oct 23, 2024
ba501fb
feat(contracts/script): deploy vaults script
mempirate Oct 24, 2024
2cecc7e
feat(contracts/script): update supported vaults script
mempirate Oct 24, 2024
3313126
docs(contracts): nit
mempirate Oct 24, 2024
35c53b0
feat(contracts): upgrade script
mempirate Oct 24, 2024
0eb29b8
docs(contracts): verifying storage layout on upgrades
mempirate Oct 24, 2024
8a5831d
docs(contracts): verifying storage layout on upgrades
mempirate Oct 24, 2024
e0790a5
chore: deploy el middleware upgrade
merklefruit Oct 24, 2024
c66d80a
fix: save el middleware address in deployments
merklefruit Oct 24, 2024
f4b7a30
fix: initialize v2
merklefruit Oct 24, 2024
8df4a6c
chore: update titles
merklefruit Oct 24, 2024
650628a
Merge pull request #314 from chainbound/nico/chore/el-upgrade
merklefruit Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
[submodule "bolt-contracts/lib/openzeppelin-contracts"]
path = bolt-contracts/lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "bolt-contracts/lib/core"]
path = bolt-contracts/lib/core
url = https://github.com/symbioticfi/core
[submodule "bolt-contracts/lib/eigenlayer-contracts"]
path = bolt-contracts/lib/eigenlayer-contracts
url = https://github.com/layr-labs/eigenlayer-contracts
[submodule "bolt-contracts/lib/openzeppelin-contracts-upgradeable"]
path = bolt-contracts/lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "bolt-contracts/lib/openzeppelin-foundry-upgrades"]
path = bolt-contracts/lib/openzeppelin-foundry-upgrades
url = https://github.com/OpenZeppelin/openzeppelin-foundry-upgrades
[submodule "bolt-contracts/lib/eigenlayer-contracts"]
path = bolt-contracts/lib/eigenlayer-contracts
url = https://github.com/layr-labs/eigenlayer-contracts
[submodule "bolt-contracts/lib/core"]
path = bolt-contracts/lib/core
url = https://github.com/symbioticfi/core
[submodule "bolt-contracts/lib/eigenlayer-middleware"]
path = bolt-contracts/lib/eigenlayer-middleware
url = https://github.com/layr-labs/eigenlayer-middleware
19 changes: 12 additions & 7 deletions bolt-contracts/config/holesky/deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@
},
"symbiotic": {
"network": "0xb017002D8024d8c8870A5CECeFCc63887650D2a4",
"operatorRegistry": "0xAdFC41729fF447974cE27DdFa358A0f2096c3F39",
"networkOptInService": "0xF5AFc9FA3Ca63a07E529DDbB6eae55C665cCa83E",
"vaultFactory": "0x18C659a269a7172eF78BBC19Fe47ad2237Be0590",
"networkRegistry": "0xac5acD8A105C8305fb980734a5AD920b5920106A",
"networkMiddlewareService": "0x683F470440964E353b389391CdDDf8df381C282f",
"operatorRegistry": "0x6F75a4ffF97326A00e52662d82EA4FdE86a2C548",
"networkOptInService": "0x58973d16FFA900D11fC22e5e2B6840d9f7e13401",
"vaultFactory": "0x407A039D94948484D356eFB765b3c74382A050B4",
"vaultConfigurator": "0xD2191FE92987171691d552C219b8caEf186eb9cA",
"networkRegistry": "0x7d03b7343BF8d5cEC7C0C27ecE084a20113D15C9",
"networkMiddlewareService": "0x62a1ddfD86b4c1636759d9286D3A0EC722D086e3",
"middleware": "0x04f40d9CaE475E5BaA462acE53E5c58A0DD8D8e8",
"supportedVaults": [
"0x1df2fbfcD600ADd561013f44B2D055E2e974f605",
"0xf427d00c34609053d97167352061DD2F0F27F853"
"0xc79c533a77691641d52ebD5e87E51dCbCaeb0D78",
"0xe5708788c90e971f73D928b7c5A8FD09137010e0",
"0x11c5b9A9cd8269580aDDbeE38857eE451c1CFacd",
"0xC56Ba584929c6f381744fA2d7a028fA927817f2b",
"0xcDdeFfcD2bA579B8801af1d603812fF64c301462",
"0x91e84e12Bb65576C0a6614c5E6EbbB2eA595E10f"
]
},
"eigenLayer": {
Expand Down
26 changes: 26 additions & 0 deletions bolt-contracts/config/holesky/vaults.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x8d09a4502Cc8Cf1547aD300E066060D043f6982D"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x7322c24752f79c05FFD1E2a6FCB97020C1C264F1"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x94373a4919B3240D86eA41593D5eBa789FEF3848"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0x8720095Fa5739Ab051799211B146a2EEE4Dd8B37"
},
{
"admin": "0x20A1305Ec6c13FFE8e5289f98ba1A18Aa262c15E",
"collateral": "0xe3C063B1BEe9de02eb28352b55D49D85514C67FF"
}
]
23 changes: 20 additions & 3 deletions bolt-contracts/docs/admin/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,28 @@ export ADMIN_PRIVATE_KEY=0x...

### Pre-deployment

Register a Symbiotic network for Bolt with the Symbiotic `NetworkRegistry`. The private key with which the script is run will determine the network address. This private key will also need to be used later.
- Register a Symbiotic network for Bolt with the Symbiotic `NetworkRegistry`. The private key with which the script is run will determine the network address. This private key will also need to be used later.

```bash
forge script script/holesky/admin/helpers/Symbiotic.s.sol --rpc-url $HOLESKY_RPC --private-key $NETWORK_PRIVATE_KEY --broadcast -vvvv --sig "run(string memory arg)" registerNetwork
```

Make sure `deployments.json` contains the correct address for the Symbiotic network.
Make sure [`deployments.json`](../../config/holesky/deployments.json) contains the correct address for the Symbiotic network.

- Deploy Bolt-specific Symbiotic Vaults. Vaults will be deployed from the [`vaults.json`](../../config/holesky/vaults.json) configuration file.

```bash
forge script script/holesky/admin/helpers/DeployVaults.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --verify --broadcast -vvvv
```

If vaults with the `(collateral, admin)` combination already exist, they won't be recreated. After these vaults have been created, copy their
addresses into the [`deployments.json`](../../config/holesky/deployments.json) file under `symbiotic.supportedVaults`.

### Deployment

Run the following script to deploy Bolt V1:
```bash
forge script script/holesky/admin/Deploy.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --broadcast -vvvv
forge script script/holesky/admin/Deploy.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --verify --broadcast -vvvv
```

This will deploy all the contracts. The address corresponding to the private key will be the system admin.
Expand All @@ -71,3 +80,11 @@ forge script script/holesky/admin/helpers/RegisterAVS.s.sol --rpc-url $HOLESKY_R
> [!IMPORTANT]
> After the `deployments.json` file has been fully updated with the correct contract addresses, push it to Github.


### Other Scripts

#### Modifying supported Symbiotic Vaults
This script will update supported vaults according to `deployments.json`, and remove any vaults that have been whitelisted but are no longer in the `symbiotic.supportedVaults` list.
```bash
forge script script/holesky/admin/helpers/UpdateSupportedVaults.s.sol --rpc-url $HOLESKY_RPC --private-key $ADMIN_PRIVATE_KEY --broadcast -vvv
```
1 change: 1 addition & 0 deletions bolt-contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ remappings = [
"@relic/=lib/relic-sdk/packages/contracts",
"@symbiotic/=lib/core/src/",
"@eigenlayer/=lib/eigenlayer-contracts/",
"@eigenlayer-middleware/=lib/eigenlayer-middleware/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/",
Expand Down
2 changes: 1 addition & 1 deletion bolt-contracts/lib/core
Submodule core updated 90 files
+2 −2 README.md
+1 −1 package.json
+32 −2 script/deploy/Core.s.sol
+2 −2 script/deploy/OptInService.s.sol
+77 −42 script/deploy/Vault.s.sol
+134 −0 script/deploy/VaultTokenized.s.sol
+10 −0 specs/Vault.md
+8 −20 src/contracts/VaultConfigurator.sol
+1 −1 src/contracts/common/Entity.sol
+31 −4 src/contracts/common/Factory.sol
+17 −15 src/contracts/common/MigratableEntity.sol
+33 −15 src/contracts/common/MigratablesFactory.sol
+6 −1 src/contracts/common/StaticDelegateCallable.sol
+44 −22 src/contracts/delegator/BaseDelegator.sol
+12 −8 src/contracts/delegator/FullRestakeDelegator.sol
+14 −10 src/contracts/delegator/NetworkRestakeDelegator.sol
+155 −0 src/contracts/delegator/OperatorSpecificDelegator.sol
+75 −16 src/contracts/hints/DelegatorHints.sol
+2 −3 src/contracts/hints/Hints.sol
+2 −3 src/contracts/hints/OptInServiceHints.sol
+4 −7 src/contracts/hints/SlasherHints.sol
+3 −9 src/contracts/hints/VaultHints.sol
+16 −8 src/contracts/libraries/Checkpoints.sol
+2 −2 src/contracts/libraries/ERC4626Math.sol
+21 −0 src/contracts/libraries/LICENSE
+2 −2 src/contracts/libraries/Subnetwork.sol
+106 −15 src/contracts/service/OptInService.sol
+89 −13 src/contracts/slasher/BaseSlasher.sol
+22 −15 src/contracts/slasher/Slasher.sol
+53 −41 src/contracts/slasher/VetoSlasher.sol
+123 −56 src/contracts/vault/Vault.sol
+14 −4 src/contracts/vault/VaultStorage.sol
+111 −0 src/contracts/vault/VaultTokenized.sol
+2 −2 src/interfaces/IDelegatorFactory.sol
+2 −2 src/interfaces/INetworkRegistry.sol
+2 −2 src/interfaces/IOperatorRegistry.sol
+2 −2 src/interfaces/ISlasherFactory.sol
+3 −7 src/interfaces/IVaultConfigurator.sol
+2 −2 src/interfaces/IVaultFactory.sol
+21 −0 src/interfaces/LICENSE
+0 −99 src/interfaces/collateral/ICollateral.sol
+4 −2 src/interfaces/common/IEntity.sol
+32 −4 src/interfaces/common/IFactory.sol
+3 −3 src/interfaces/common/IMigratableEntity.sol
+3 −5 src/interfaces/common/IMigratableEntityProxy.sol
+31 −9 src/interfaces/common/IMigratablesFactory.sol
+2 −2 src/interfaces/common/IRegistry.sol
+12 −0 src/interfaces/common/IStaticDelegateCallable.sol
+24 −7 src/interfaces/delegator/IBaseDelegator.sol
+4 −3 src/interfaces/delegator/IDelegatorHook.sol
+2 −1 src/interfaces/delegator/IFullRestakeDelegator.sol
+2 −1 src/interfaces/delegator/INetworkRestakeDelegator.sol
+88 −0 src/interfaces/delegator/IOperatorSpecificDelegator.sol
+2 −2 src/interfaces/service/IMetadataService.sol
+2 −2 src/interfaces/service/INetworkMiddlewareService.sol
+50 −6 src/interfaces/service/IOptInService.sol
+45 −7 src/interfaces/slasher/IBaseSlasher.sol
+13 −0 src/interfaces/slasher/IBurner.sol
+25 −5 src/interfaces/slasher/ISlasher.sol
+26 −10 src/interfaces/slasher/IVetoSlasher.sol
+69 −18 src/interfaces/vault/IVault.sol
+16 −4 src/interfaces/vault/IVaultStorage.sol
+18 −0 src/interfaces/vault/IVaultTokenized.sol
+39 −26 test/DelegatorFactory.t.sol
+27 −0 test/POC.t.sol
+664 −0 test/POCBase.t.sol
+55 −27 test/SlasherFactory.t.sol
+40 −82 test/VaultConfigurator.t.sol
+39 −24 test/VaultFactory.t.sol
+3 −3 test/common/Entity.t.sol
+25 −5 test/common/Factory.t.sol
+7 −32 test/common/MigratableEntity.t.sol
+3 −3 test/common/MigratableEntityProxy.t.sol
+31 −10 test/common/MigratablesFactory.t.sol
+1 −1 test/common/Registry.t.sol
+290 −69 test/delegator/FullRestakeDelegator.t.sol
+317 −71 test/delegator/NetworkRestakeDelegator.t.sol
+1,691 −0 test/delegator/OperatorSpecificDelegator.t.sol
+626 −0 test/libraries/Checkpoints.t.sol
+32 −0 test/mocks/SimpleBurner.sol
+0 −99 test/mocks/SimpleCollateral.sol
+42 −4 test/mocks/SimpleFullRestakeDelegatorHook.sol
+1 −1 test/mocks/SimpleMigratableEntity.sol
+42 −4 test/mocks/SimpleNetworkRestakeDelegatorHook.sol
+20 −0 test/mocks/SimpleOperatorSpecificDelegatorHook.sol
+309 −6 test/service/OptInService.t.sol
+436 −50 test/slasher/Slasher.t.sol
+389 −144 test/slasher/VetoSlasher.t.sol
+774 −411 test/vault/Vault.t.sol
+3,102 −0 test/vault/VaultTokenized.t.sol
2 changes: 1 addition & 1 deletion bolt-contracts/lib/eigenlayer-contracts
Submodule eigenlayer-contracts updated 78 files
+51 −0 .github/workflows/deploy-local.yml
+1 −1 .github/workflows/format.yml
+0 −38 .github/workflows/run-deploy-scripts.yml
+43 −0 .github/workflows/storage-report.yml
+2 −0 .gitignore
+3 −0 Makefile
+4 −5 README.md
+ audits/M4 Mainnet (PEPE) - Certora - Aug 2024.pdf
+45 −0 bin/storage-report.sh
+26 −1 docs/core/RewardsCoordinator.md
+16 −0 docs/storage-report/AVSDirectory.md
+6 −0 docs/storage-report/AVSDirectoryStorage.md
+28 −0 docs/storage-report/BackingEigen.md
+24 −0 docs/storage-report/DelegationManager.md
+14 −0 docs/storage-report/DelegationManagerStorage.md
+30 −0 docs/storage-report/Eigen.md
+21 −0 docs/storage-report/EigenPod.md
+19 −0 docs/storage-report/EigenPodManager.md
+9 −0 docs/storage-report/EigenPodManagerStorage.md
+2 −0 docs/storage-report/EigenPodPausingConstants.md
+17 −0 docs/storage-report/EigenPodStorage.md
+12 −0 docs/storage-report/EigenStrategy.md
+5 −0 docs/storage-report/Pausable.md
+4 −0 docs/storage-report/PauserRegistry.md
+26 −0 docs/storage-report/RewardsCoordinator.md
+16 −0 docs/storage-report/RewardsCoordinatorStorage.md
+10 −0 docs/storage-report/Slasher.md
+10 −0 docs/storage-report/StrategyBase.md
+13 −0 docs/storage-report/StrategyBaseTVLLimits.md
+14 −0 docs/storage-report/StrategyFactory.md
+6 −0 docs/storage-report/StrategyFactoryStorage.md
+24 −0 docs/storage-report/StrategyManager.md
+14 −0 docs/storage-report/StrategyManagerStorage.md
+5 −0 docs/storage-report/UpgradeableSignatureCheckingUtils.md
+216 −1 pkg/bindings/IRewardsCoordinator/binding.go
+217 −2 pkg/bindings/RewardsCoordinator/binding.go
+247 −1 pkg/bindings/RewardsCoordinatorStorage/binding.go
+1 −0 script/.gitignore
+0 −48 script/configs/devnet/M1_deploy_devnet.config.json
+0 −44 script/configs/devnet/M2_deploy_from_scratch.anvil.config.json
+0 −58 script/configs/holesky/Deploy_RewardsCoordinator.holesky.config.json
+5 −0 script/configs/holesky/eigenlayer_addresses_preprod.config.json
+2 −1 script/configs/holesky/eigenlayer_addresses_testnet.config.json
+1 −0 script/configs/holesky/eigenlayer_preprod.config.json
+57 −0 script/configs/holesky/eigenlayer_testnet.config.json
+55 −0 script/configs/local/deploy_from_scratch.anvil.config.json
+0 −61 script/configs/mainnet/M1_deploy_mainnet.config.json
+0 −60 script/configs/mainnet/M2_deploy_from_scratch.mainnet.config.json
+0 −46 script/configs/mainnet/M2_mainnet_upgrade.config.json
+0 −79 script/configs/mainnet/Mainnet_current_deployment.config.json
+80 −0 script/configs/mainnet/mainnet-addresses.config.json
+51 −0 script/configs/mainnet/mainnet-config.config.json
+0 −75 script/configs/mainnet/v0.3.0-eigenlayer-addresses.config.json
+0 −57 script/configs/mainnet/v0.3.0-mainnet-rewards.config.json
+1 −1 script/deploy/holesky/Deploy_Preprod_RewardsCoordinator.s.sol
+38 −3 script/deploy/holesky/Deploy_Test_RewardsCoordinator.s.sol
+113 −0 script/deploy/holesky/longtail-preprod-upgrade.s.sol
+1 −1 script/deploy/holesky/v040-holesky-pepe.s.sol
+0 −69 script/deploy/holesky/v040-rc0-holesky-preprod-pepe.s.sol
+0 −58 script/deploy/holesky/v040-rc1-holesky-preprod-pepe.s.sol
+0 −58 script/deploy/holesky/v040-rc2-holesky-preprod-pepe.s.sol
+0 −58 script/deploy/holesky/v040-rc3-holesky-preprod-pepe.s.sol
+0 −79 script/deploy/holesky/v040-rc5-holesky-preprod-pepe.s.sol
+117 −0 script/deploy/holesky/v042-upgrade_testnet_rewardsCoordinator.s.sol
+35 −7 script/deploy/local/Deploy_From_Scratch.s.sol
+0 −509 script/deploy/mainnet/M1_Deploy.s.sol
+0 −327 script/deploy/mainnet/M2Deploy.s.sol
+36 −31 script/deploy/mainnet/v0.4.2-mainnet-pepe.s.sol
+4 −7 script/output/holesky/Deploy_RewardsCoordinator.holesky.config.json
+0 −40 script/output/mainnet/M1_deployment_mainnet_2023_6_9.json
+0 −35 script/output/mainnet/M2_mainnet_upgrade.output.json
+11 −11 script/utils/ExistingDeploymentParser.sol
+32 −0 src/contracts/core/RewardsCoordinator.sol
+10 −5 src/contracts/core/RewardsCoordinatorStorage.sol
+23 −3 src/contracts/interfaces/IRewardsCoordinator.sol
+7 −0 src/test/events/IRewardsCoordinatorEvents.sol
+1 −1 src/test/integration/IntegrationDeployer.t.sol
+216 −0 src/test/unit/RewardsCoordinatorUnit.t.sol
1 change: 1 addition & 0 deletions bolt-contracts/lib/eigenlayer-middleware
Submodule eigenlayer-middleware added at 48e0ae
145 changes: 145 additions & 0 deletions bolt-contracts/script/holesky/admin/helpers/DeployVaults.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {Script, console} from "forge-std/Script.sol";

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

import {IVault} from "@symbiotic/interfaces/vault/IVault.sol";
import {IOptInService} from "@symbiotic/interfaces/service/IOptInService.sol";
import {IVaultConfigurator} from "@symbiotic/interfaces/IVaultConfigurator.sol";
import {IBaseDelegator} from "@symbiotic/interfaces/delegator/IBaseDelegator.sol";
import {IBaseSlasher} from "@symbiotic/interfaces/slasher/IBaseSlasher.sol";
import {INetworkRestakeDelegator} from "@symbiotic/interfaces/delegator/INetworkRestakeDelegator.sol";
import {IVetoSlasher} from "@symbiotic/interfaces/slasher/IVetoSlasher.sol";
import {IMigratablesFactory} from "@symbiotic/interfaces/common/IMigratablesFactory.sol";

contract DeploySymbioticVaults is Script {
struct VaultConfig {
address admin;
address collateral;
}

function run() public {
IVaultConfigurator vaultConfigurator = _readVaultConfigurator();
VaultConfig[] memory configs = _readVaultConfigs();
uint48 epochDuration = _readEpochDuration();

// TODO: Check if vaults for specific collateral are already deployed!

vm.startBroadcast();

for (uint256 i; i < configs.length; ++i) {
VaultConfig memory config = configs[i];

IMigratablesFactory vaultFactory = IMigratablesFactory(vaultConfigurator.VAULT_FACTORY());

bool exists;

// First check if the vault already exists. We do this by checking for the collateral, and the admin.
// If we need to check for more properties in the future (like version), we can add them here.
for (uint256 j; j < vaultFactory.totalEntities(); ++j) {
address existingVault = vaultFactory.entity(j);

if (
IVault(existingVault).collateral() == config.collateral
&& OwnableUpgradeable(existingVault).owner() == config.admin
) {
console.log(
"Vault for collateral %s already deployed with admin %s", config.collateral, config.admin
);
console.log("Address:", existingVault);
exists = true;

break;
}
}

if (exists) {
continue;
}

address[] memory adminRoleHolders = new address[](1);
adminRoleHolders[0] = config.admin;

IVaultConfigurator.InitParams memory vaultConfiguratorInitParams = IVaultConfigurator.InitParams({
// Use Version 1 for a standard vault (non-tokenized).
version: 1,
owner: config.admin,
vaultParams: abi.encode(
IVault.InitParams({
collateral: config.collateral,
burner: address(0xdead),
epochDuration: epochDuration,
depositWhitelist: false,
isDepositLimit: false,
depositLimit: 0,
defaultAdminRoleHolder: config.admin,
depositWhitelistSetRoleHolder: config.admin,
depositorWhitelistRoleHolder: config.admin,
isDepositLimitSetRoleHolder: config.admin,
depositLimitSetRoleHolder: config.admin
})
),
delegatorIndex: 0, // Use NetworkRestakeDelegator
delegatorParams: abi.encode(
INetworkRestakeDelegator.InitParams({
baseParams: IBaseDelegator.BaseParams({
defaultAdminRoleHolder: config.admin,
hook: address(0), // we don't need a hook
hookSetRoleHolder: config.admin
}),
networkLimitSetRoleHolders: adminRoleHolders,
operatorNetworkSharesSetRoleHolders: adminRoleHolders
})
),
withSlasher: true,
slasherIndex: 1, // Use VetoSlasher
slasherParams: abi.encode(
IVetoSlasher.InitParams({
baseParams: IBaseSlasher.BaseParams({
isBurnerHook: false // ?
}),
// veto duration must be smaller than epoch duration
vetoDuration: uint48(12 hours),
resolverSetEpochsDelay: 3
})
)
});

(address vault, address networkRestakeDelegator, address vetoSlasher) =
vaultConfigurator.create(vaultConfiguratorInitParams);

console.log("Deployed vault with collateral:", config.collateral);
console.log("Vault address:", vault);
console.log("NetworkRestakeDelegator:", networkRestakeDelegator);
console.log("VetoSlasher:", vetoSlasher);
}

vm.stopBroadcast();
}

function _readVaultConfigs() internal view returns (VaultConfig[] memory configs) {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/config/holesky/vaults.json");
string memory json = vm.readFile(path);

configs = abi.decode(vm.parseJson(json), (VaultConfig[]));
}

function _readEpochDuration() internal view returns (uint48) {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/config/holesky/parameters.json");
string memory json = vm.readFile(path);

return uint48(vm.parseJsonUint(json, ".epochDuration"));
}

function _readVaultConfigurator() internal view returns (IVaultConfigurator) {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/config/holesky/deployments.json");
string memory json = vm.readFile(path);

return IVaultConfigurator(vm.parseJsonAddress(json, ".symbiotic.vaultConfigurator"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import {Script, console} from "forge-std/Script.sol";

import {INetworkRegistry} from "@symbiotic/interfaces/INetworkRegistry.sol";
import {INetworkMiddlewareService} from "@symbiotic/interfaces/service/INetworkMiddlewareService.sol";

import {BoltSymbioticMiddlewareV1} from "../../../../src/contracts/BoltSymbioticMiddlewareV1.sol";

contract UpdateSupportedVaults is Script {
function run() public {
BoltSymbioticMiddlewareV1 middleware = _readSymbioticMiddleware();

address[] memory whitelisted = middleware.getWhitelistedVaults();
address[] memory toWhitelist = _readVaultsToWhitelist();

vm.startBroadcast();

// Step 1: Whitelist new vaults
for (uint256 i = 0; i < toWhitelist.length; i++) {
address vault = toWhitelist[i];

bool isWhitelisted = false;
for (uint256 j = 0; j < whitelisted.length; j++) {
if (whitelisted[j] == vault) {
isWhitelisted = true;
break;
}
}

if (!isWhitelisted) {
console.log("Whitelisting vault", vault);
middleware.registerVault(vault);
}
}

// Step 2: Remove vaults from contract that are not in the supported vaults list
for (uint256 i = 0; i < whitelisted.length; i++) {
address vault = whitelisted[i];

bool isSupported = false;
for (uint256 j = 0; j < toWhitelist.length; j++) {
if (toWhitelist[j] == vault) {
isSupported = true;
break;
}
}

if (!isSupported) {
console.log("Removing vault", vault);
middleware.deregisterVault(vault);
}
}

vm.stopBroadcast();
}

function _readVaultsToWhitelist() public view returns (address[] memory) {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/config/holesky/deployments.json");
string memory json = vm.readFile(path);

return vm.parseJsonAddressArray(json, ".symbiotic.supportedVaults");
}

function _readSymbioticMiddleware() public view returns (BoltSymbioticMiddlewareV1) {
string memory root = vm.projectRoot();
string memory path = string.concat(root, "/config/holesky/deployments.json");
string memory json = vm.readFile(path);

return BoltSymbioticMiddlewareV1(vm.parseJsonAddress(json, ".symbiotic.middleware"));
}
}
Loading
Loading