Skip to content

Commit

Permalink
Merge pull request #5 from symbioticfi/new-architecture
Browse files Browse the repository at this point in the history
New architecture
  • Loading branch information
1kresh authored Jul 1, 2024
2 parents ad30e24 + c66ee3a commit 20c8603
Show file tree
Hide file tree
Showing 98 changed files with 3,477 additions and 6,817 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/permit2"]
path = lib/permit2
url = https://github.com/Uniswap/permit2
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/OpenZeppelin/openzeppelin-contracts
Expand Down
1 change: 0 additions & 1 deletion lib/permit2
Submodule permit2 deleted from cc56ad
1 change: 0 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
forge-std/=lib/forge-std/src/
permit2/=lib/permit2/
@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
85 changes: 42 additions & 43 deletions script/deploy/Core.s.sol
Original file line number Diff line number Diff line change
@@ -1,49 +1,48 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
// // SPDX-License-Identifier: UNLICENSED
// pragma solidity 0.8.25;

import "forge-std/Script.sol";
// import "forge-std/Script.sol";

import {MetadataService} from "src/contracts/MetadataService.sol";
import {NetworkMiddlewareService} from "src/contracts/NetworkMiddlewareService.sol";
import {NetworkOptInService} from "src/contracts/NetworkOptInService.sol";
import {NetworkRegistry} from "src/contracts/NetworkRegistry.sol";
import {OperatorOptInService} from "src/contracts/OperatorOptInService.sol";
import {OperatorRegistry} from "src/contracts/OperatorRegistry.sol";
import {VaultFactory} from "src/contracts/VaultFactory.sol";
import {Vault} from "src/contracts/vault/v1/Vault.sol";
// import {MetadataService} from "src/contracts/service/MetadataService.sol";
// import {NetworkMiddlewareService} from "src/contracts/service/NetworkMiddlewareService.sol";
// import {NetworkRegistry} from "src/contracts/NetworkRegistry.sol";
// import {OptInService} from "src/contracts/service/OptInService.sol";
// import {OperatorRegistry} from "src/contracts/OperatorRegistry.sol";
// import {VaultFactory} from "src/contracts/VaultFactory.sol";
// import {Vault} from "src/contracts/vault/Vault.sol";

contract CoreScript is Script {
function run(address owner) public {
vm.startBroadcast();
(,, address deployer) = vm.readCallers();
// contract CoreScript is Script {
// function run(address owner) public {
// vm.startBroadcast();
// (,, address deployer) = vm.readCallers();

VaultFactory vaultFactory = new VaultFactory(deployer);
NetworkRegistry networkRegistry = new NetworkRegistry();
OperatorRegistry operatorRegistry = new OperatorRegistry();
MetadataService operatorMetadataService = new MetadataService(address(operatorRegistry));
MetadataService networkMetadataService = new MetadataService(address(networkRegistry));
NetworkMiddlewareService networkMiddlewareService = new NetworkMiddlewareService(address(networkRegistry));
NetworkOptInService networkVaultOptInService =
new NetworkOptInService(address(networkRegistry), address(vaultFactory));
OperatorOptInService operatorVaultOptInService =
new OperatorOptInService(address(operatorRegistry), address(vaultFactory));
OperatorOptInService operatorNetworkOptInService =
new OperatorOptInService(address(operatorRegistry), address(networkRegistry));
// VaultFactory vaultFactory = new VaultFactory(deployer);
// NetworkRegistry networkRegistry = new NetworkRegistry();
// OperatorRegistry operatorRegistry = new OperatorRegistry();
// MetadataService operatorMetadataService = new MetadataService(address(operatorRegistry));
// MetadataService networkMetadataService = new MetadataService(address(networkRegistry));
// NetworkMiddlewareService networkMiddlewareService = new NetworkMiddlewareService(address(networkRegistry));
// OptInService networkVaultOptInService =
// new OptInService(address(networkRegistry), address(vaultFactory));
// OptInService operatorVaultOptInService =
// new OptInService(address(operatorRegistry), address(vaultFactory));
// OptInService operatorNetworkOptInService =
// new OptInService(address(operatorRegistry), address(networkRegistry));

vaultFactory.whitelist(
address(
new Vault(
address(vaultFactory),
address(networkRegistry),
address(networkMiddlewareService),
address(networkVaultOptInService),
address(operatorVaultOptInService),
address(operatorNetworkOptInService)
)
)
);
vaultFactory.transferOwnership(owner);
// vaultFactory.whitelist(
// address(
// new Vault(
// address(vaultFactory),
// address(networkRegistry),
// address(networkMiddlewareService),
// address(networkVaultOptInService),
// address(operatorVaultOptInService),
// address(operatorNetworkOptInService)
// )
// )
// );
// vaultFactory.transferOwnership(owner);

vm.stopBroadcast();
}
}
// vm.stopBroadcast();
// }
// }
2 changes: 1 addition & 1 deletion script/deploy/MetadataService.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {MetadataService} from "src/contracts/MetadataService.sol";
import {MetadataService} from "src/contracts/service/MetadataService.sol";

contract MetadataServiceScript is Script {
function run(address registry) public {
Expand Down
2 changes: 1 addition & 1 deletion script/deploy/NetworkMiddlewareService.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {NetworkMiddlewareService} from "src/contracts/NetworkMiddlewareService.sol";
import {NetworkMiddlewareService} from "src/contracts/service/NetworkMiddlewareService.sol";

contract NetworkMiddlewareServiceScript is Script {
function run(address networkRegistry) public {
Expand Down
16 changes: 0 additions & 16 deletions script/deploy/NetworkOptInService.s.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ pragma solidity 0.8.25;

import "forge-std/Script.sol";

import {OperatorOptInService} from "src/contracts/OperatorOptInService.sol";
import {OptInService} from "src/contracts/service/OptInService.sol";

contract OperatorOptInServiceScript is Script {
function run(address operatorRegistry, address whereRegistry) public {
vm.startBroadcast();

new OperatorOptInService(operatorRegistry, whereRegistry);
new OptInService(operatorRegistry, whereRegistry);

vm.stopBroadcast();
}
Expand Down
72 changes: 36 additions & 36 deletions script/deploy/Vault.s.sol
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;
// // SPDX-License-Identifier: UNLICENSED
// pragma solidity 0.8.25;

import "forge-std/Script.sol";
// import "forge-std/Script.sol";

import {IMigratablesFactory} from "src/interfaces/base/IMigratablesFactory.sol";
import {IVault} from "src/interfaces/vault/v1/IVault.sol";
// import {IMigratablesFactory} from "src/interfaces/base/IMigratablesFactory.sol";
// import {IVault} from "src/interfaces/vault/IVault.sol";

contract VaultScript is Script {
function run(
address vaultFactory,
address owner,
address collateral,
uint48 epochDuration,
uint48 vetoDuration,
uint48 executeDuration,
address rewardsDistributor,
uint256 adminFee,
bool depositWhitelist
) public {
vm.startBroadcast();
// contract VaultScript is Script {
// function run(
// address vaultFactory,
// address owner,
// address collateral,
// uint48 epochDuration,
// uint48 vetoDuration,
// uint48 executeDuration,
// address stakerRewardsDistributor,
// uint256 adminFee,
// bool depositWhitelist
// ) public {
// vm.startBroadcast();

IMigratablesFactory(vaultFactory).create(
IMigratablesFactory(vaultFactory).lastVersion(),
owner,
abi.encode(
IVault.InitParams({
collateral: collateral,
epochDuration: epochDuration,
vetoDuration: vetoDuration,
executeDuration: executeDuration,
rewardsDistributor: rewardsDistributor,
adminFee: adminFee,
depositWhitelist: depositWhitelist
})
)
);
// IMigratablesFactory(vaultFactory).create(
// IMigratablesFactory(vaultFactory).lastVersion(),
// owner,
// abi.encode(
// IVault.InitParams({
// collateral: collateral,
// epochDuration: epochDuration,
// vetoDuration: vetoDuration,
// executeDuration: executeDuration,
// stakerRewardsDistributor: stakerRewardsDistributor,
// adminFee: adminFee,
// depositWhitelist: depositWhitelist
// })
// )
// );

vm.stopBroadcast();
}
}
// vm.stopBroadcast();
// }
// }

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions specs/Network.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ forge script script/deploy/NetworkMiddlewareService.s.sol:NetworkMiddlewareServi

#### Deploy opt-in service

Deployment script: [click](../script/deploy/NetworkOptInService.s.sol)
Deployment script: [click](../script/deploy/OptInService.s.sol)

```shell
forge script script/deploy/NetworkOptInService.s.sol:NetworkOptInServiceScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
forge script script/deploy/OptInService.s.sol:OptInServiceScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
```
4 changes: 2 additions & 2 deletions specs/Operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ forge script script/deploy/MetadataService.s.sol:MetadataServiceScript 0x0000000

#### Deploy opt-in service

Deployment script: [click](../script/deploy/OperatorOptInService.s.sol)
Deployment script: [click](../script/deploy/OptInService.s.sol)

```shell
forge script script/deploy/OperatorOptInService.s.sol:OperatorOptInServiceScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
forge script script/deploy/OptInService.s.sol:OperatorOptInServiceScript 0x0000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000 --sig "run(address,address)" --broadcast --rpc-url=$ETH_RPC_URL
```
38 changes: 0 additions & 38 deletions specs/Rewards.md

This file was deleted.

10 changes: 10 additions & 0 deletions src/contracts/DelegatorFactory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;

import {Factory} from "src/contracts/common/Factory.sol";

import {IDelegatorFactory} from "src/interfaces/IDelegatorFactory.sol";

contract DelegatorFactory is Factory, IDelegatorFactory {
constructor(address owner_) Factory(owner_) {}
}
Loading

0 comments on commit 20c8603

Please sign in to comment.