Skip to content

Commit 3b1db8f

Browse files
committed
feat: initial deploy
1 parent 1777a64 commit 3b1db8f

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// SPDX-License-Identifier: BUSL-1.1
2+
pragma solidity ^0.8.12;
3+
4+
import {EOADeployer} from "zeus-templates/templates/EOADeployer.sol";
5+
import "../Env.sol";
6+
7+
import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol";
8+
import "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol";
9+
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
10+
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
11+
12+
contract Deploy is EOADeployer {
13+
using EigenLabsUpgrade for *;
14+
15+
function _runAsEOA() internal override {
16+
vm.startBroadcast();
17+
deployImpl({
18+
name: type(AllocationManager).name,
19+
deployedTo: address(new AllocationManager({
20+
_delegation: Env.proxy.delegationManager(),
21+
_pauserRegistry: Env.impl.pauserRegistry(),
22+
_permissionController: Env.proxy.permissionController(),
23+
_DEALLOCATION_DELAY: Env.MIN_WITHDRAWAL_DELAY(),
24+
_ALLOCATION_CONFIGURATION_DELAY: Env.ALLOCATION_CONFIGURATION_DELAY()
25+
}))
26+
});
27+
28+
deployImpl({
29+
name: type(DelegationManager).name,
30+
deployedTo: address(new DelegationManager({
31+
_strategyManager: Env.proxy.strategyManager(),
32+
_eigenPodManager: Env.proxy.eigenPodManager(),
33+
_allocationManager: Env.proxy.allocationManager(),
34+
_pauserRegistry: Env.impl.pauserRegistry(),
35+
_permissionController: Env.proxy.permissionController(),
36+
_MIN_WITHDRAWAL_DELAY: Env.MIN_WITHDRAWAL_DELAY()
37+
}))
38+
});
39+
40+
vm.stopBroadcast();
41+
}
42+
43+
function testDeploy() public virtual {
44+
_runAsEOA();
45+
46+
_validateImplConstructors();
47+
_validateImplsInitialized();
48+
}
49+
50+
/// @dev Validate the immutables set in the new implementation constructors
51+
function _validateImplConstructors() internal view {
52+
AllocationManager allocationManager = Env.impl.allocationManager();
53+
assertTrue(allocationManager.delegation() == Env.proxy.delegationManager(), "alm.dm invalid");
54+
assertTrue(allocationManager.pauserRegistry() == Env.impl.pauserRegistry(), "alm.pR invalid");
55+
assertTrue(allocationManager.permissionController() == Env.proxy.permissionController(), "alm.pc invalid");
56+
assertTrue(allocationManager.DEALLOCATION_DELAY() == Env.MIN_WITHDRAWAL_DELAY(), "alm.deallocDelay invalid");
57+
assertTrue(allocationManager.ALLOCATION_CONFIGURATION_DELAY() == Env.ALLOCATION_CONFIGURATION_DELAY(), "alm.configDelay invalid");
58+
59+
60+
DelegationManager delegation = Env.impl.delegationManager();
61+
assertTrue(delegation.strategyManager() == Env.proxy.strategyManager(), "dm.sm invalid");
62+
assertTrue(delegation.eigenPodManager() == Env.proxy.eigenPodManager(), "dm.epm invalid");
63+
assertTrue(delegation.allocationManager() == Env.proxy.allocationManager(), "dm.alm invalid");
64+
assertTrue(delegation.pauserRegistry() == Env.impl.pauserRegistry(), "dm.pR invalid");
65+
assertTrue(delegation.permissionController() == Env.proxy.permissionController(), "dm.pc invalid");
66+
assertTrue(delegation.minWithdrawalDelayBlocks() == Env.MIN_WITHDRAWAL_DELAY(), "dm.withdrawalDelay invalid");
67+
}
68+
69+
/// @dev Call initialize on all deployed implementations to ensure initializers are disabled
70+
function _validateImplsInitialized() internal {
71+
bytes memory errInit = "Initializable: contract is already initialized";
72+
73+
AllocationManager allocationManager = Env.impl.allocationManager();
74+
vm.expectRevert(errInit);
75+
allocationManager.initialize(address(0), 0);
76+
77+
DelegationManager delegation = Env.impl.delegationManager();
78+
vm.expectRevert(errInit);
79+
delegation.initialize(address(0), 0);
80+
}
81+
}

0 commit comments

Comments
 (0)