-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathAlignedLayerUpgradeAddAggregator.s.sol
More file actions
114 lines (94 loc) · 3.69 KB
/
AlignedLayerUpgradeAddAggregator.s.sol
File metadata and controls
114 lines (94 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.12;
import {Script} from "forge-std/Script.sol";
import "eigenlayer-contracts/src/contracts/core/AVSDirectory.sol";
import {RegistryCoordinator} from "eigenlayer-middleware/RegistryCoordinator.sol";
import {StakeRegistry} from "eigenlayer-middleware/StakeRegistry.sol";
import {IRewardsCoordinator} from "eigenlayer-contracts/src/contracts/interfaces/IRewardsCoordinator.sol";
import {AlignedLayerServiceManager} from "src/core/AlignedLayerServiceManager.sol";
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
import "forge-std/StdJson.sol";
contract AlignedLayerSetAggregator is Script {
function run(
string memory eigenLayerDeploymentFilePath,
string memory alignedLayerDeploymentFilePath,
string memory alignedConfigFilePath
) external returns (address, address) {
string memory eigen_deployment_file = vm.readFile(
eigenLayerDeploymentFilePath
);
string memory aligned_deployment_file = vm.readFile(
alignedLayerDeploymentFilePath
);
string memory aligned_config_file = vm.readFile(alignedConfigFilePath);
ProxyAdmin alignedLayerProxyAdmin = ProxyAdmin(
stdJson.readAddress(
aligned_deployment_file,
".addresses.alignedLayerProxyAdmin"
)
);
RegistryCoordinator registryCoordinator = RegistryCoordinator(
stdJson.readAddress(
aligned_deployment_file,
".addresses.registryCoordinator"
)
);
AVSDirectory avsDirectory = AVSDirectory(
stdJson.readAddress(
eigen_deployment_file,
".addresses.avsDirectory"
)
);
StakeRegistry stakeRegistry = StakeRegistry(
stdJson.readAddress(
aligned_deployment_file,
".addresses.stakeRegistry"
)
);
IRewardsCoordinator rewardsCoordinator = IRewardsCoordinator(
stdJson.readAddress(
eigen_deployment_file,
".addresses.rewardsCoordinator"
)
);
address alignedLayerAggregator = stdJson.readAddress(
aligned_config_file,
".permissions.aggregator"
);
vm.startBroadcast();
AlignedLayerServiceManager alignedLayerServiceManagerImplementation = new AlignedLayerServiceManager(
avsDirectory,
rewardsCoordinator,
registryCoordinator,
stakeRegistry
);
vm.stopBroadcast();
vm.startBroadcast();
// alignedLayerServiceManager is the proxy
AlignedLayerServiceManager alignedLayerServiceManager = AlignedLayerServiceManager(
payable(
stdJson.readAddress(
aligned_deployment_file,
".addresses.alignedLayerServiceManager"
)
)
);
vm.stopBroadcast();
vm.startBroadcast();
alignedLayerProxyAdmin.upgrade(
TransparentUpgradeableProxy(
payable(address(alignedLayerServiceManager))
),
address(alignedLayerServiceManagerImplementation)
);
vm.stopBroadcast();
vm.startBroadcast();
alignedLayerServiceManager.initializeAggregator(alignedLayerAggregator);
vm.stopBroadcast();
return (
address(alignedLayerServiceManager),
address(alignedLayerServiceManagerImplementation)
);
}
}