-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathdeployPriorityQueue.s.sol
More file actions
133 lines (116 loc) · 5.86 KB
/
deployPriorityQueue.s.sol
File metadata and controls
133 lines (116 loc) · 5.86 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;
import "forge-std/Script.sol";
import {LiquidityPool} from "../../../src/LiquidityPool.sol";
import {PriorityWithdrawalQueue} from "../../../src/PriorityWithdrawalQueue.sol";
import {UUPSProxy} from "../../../src/UUPSProxy.sol";
import {Utils, ICreate2Factory} from "../../utils/utils.sol";
import {EtherFiRedemptionManager} from "../../../src/EtherFiRedemptionManager.sol";
contract DeployPriorityQueue is Script, Utils {
ICreate2Factory constant factory = ICreate2Factory(0x356d1B83970CeF2018F2c9337cDdb67dff5AEF99);
address priorityWithdrawalQueueImpl;
address priorityWithdrawalQueueProxy;
address liquidityPoolImpl;
address etherFiRedemptionManagerImpl;
bytes32 commitHashSalt = hex"7fc5100aa09ac0c9236907fe0330a15cb0fda6f8";
uint32 constant MIN_DELAY = 1 hours; // TODO: Set appropriate min delay (e.g., 1 hours = 3600)
function dryRun() public view {
console2.log("================================================");
console2.log("============= DRY RUN - CONFIG ============");
console2.log("================================================");
console2.log("");
console2.log("Constructor Args for PriorityWithdrawalQueue:");
console2.log(" _liquidityPool:", LIQUIDITY_POOL);
console2.log(" _eETH:", EETH);
console2.log(" _roleRegistry:", ROLE_REGISTRY);
console2.log(" _treasury:", WITHDRAW_REQUEST_NFT_BUYBACK_SAFE);
console2.log(" _minDelay:", MIN_DELAY);
console2.log("");
console2.log("Constructor Args for LiquidityPool:");
console2.log(" _priorityWithdrawalQueue: <computed from Create2>");
console2.log("");
console2.log("Salt:", vm.toString(commitHashSalt));
console2.log("");
console2.log("To compute exact addresses, run with mainnet fork:");
console2.log(" forge script script/upgrades/priority-queue/deployPriorityQueue.s.sol:DeployPriorityQueue --sig 'dryRun()' --fork-url <RPC_URL>");
}
function run() public {
console2.log("================================================");
console2.log("======== Deploying Priority Queue & LP =========");
console2.log("================================================");
console2.log("");
vm.startBroadcast();
// Step 1: Deploy PriorityWithdrawalQueue implementation
{
string memory contractName = "PriorityWithdrawalQueue";
bytes memory constructorArgs = abi.encode(
LIQUIDITY_POOL,
EETH,
WEETH,
ROLE_REGISTRY,
WITHDRAW_REQUEST_NFT_BUYBACK_SAFE,
MIN_DELAY
);
bytes memory bytecode = abi.encodePacked(
type(PriorityWithdrawalQueue).creationCode,
constructorArgs
);
priorityWithdrawalQueueImpl = deploy(contractName, constructorArgs, bytecode, commitHashSalt, true, factory);
}
// Step 2: Deploy PriorityWithdrawalQueue proxy with initialization
{
string memory contractName = "UUPSProxy"; // Use actual contract name for artifact lookup
// Encode initialize() call for proxy deployment
bytes memory initData = abi.encodeWithSelector(PriorityWithdrawalQueue.initialize.selector);
bytes memory constructorArgs = abi.encode(priorityWithdrawalQueueImpl, initData);
bytes memory bytecode = abi.encodePacked(
type(UUPSProxy).creationCode,
constructorArgs
);
priorityWithdrawalQueueProxy = deploy(contractName, constructorArgs, bytecode, commitHashSalt, true, factory);
}
// Step 3: Deploy EtherFiRedemptionManager implementation
{
string memory contractName = "EtherFiRedemptionManager";
bytes memory constructorArgs = abi.encode(
LIQUIDITY_POOL,
EETH,
WEETH,
WITHDRAW_REQUEST_NFT_BUYBACK_SAFE,
ROLE_REGISTRY,
ETHERFI_RESTAKER,
priorityWithdrawalQueueProxy
);
bytes memory bytecode = abi.encodePacked(
type(EtherFiRedemptionManager).creationCode,
constructorArgs
);
etherFiRedemptionManagerImpl = deploy(contractName, constructorArgs, bytecode, commitHashSalt, true, factory);
}
// Step 4: Deploy LiquidityPool implementation with predicted proxy address
{
string memory contractName = "LiquidityPool";
bytes memory constructorArgs = abi.encode(priorityWithdrawalQueueProxy);
bytes memory bytecode = abi.encodePacked(
type(LiquidityPool).creationCode,
constructorArgs
);
liquidityPoolImpl = deploy(contractName, constructorArgs, bytecode, commitHashSalt, true, factory);
}
vm.stopBroadcast();
// Summary
console2.log("");
console2.log("================================================");
console2.log("============== DEPLOYMENT SUMMARY ==============");
console2.log("================================================");
console2.log("LiquidityPool Implementation:", liquidityPoolImpl);
console2.log("PriorityWithdrawalQueue Implementation:", priorityWithdrawalQueueImpl);
console2.log("PriorityWithdrawalQueue Proxy:", priorityWithdrawalQueueProxy);
console2.log("EtherFiRedemptionManager Implementation:", etherFiRedemptionManagerImpl);
console2.log("");
console2.log("NEXT STEPS:");
console2.log("1. Upgrade LiquidityPool proxy to new implementation");
console2.log("2. Upgrade EtherFiRedemptionManager proxy to new implementation");
console2.log("3. Grant necessary roles in RoleRegistry");
}
}