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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
require('dotenv').config();
const {ethers} = require("hardhat");
const hre = require("hardhat");
// Comment out the executors you don't want to deploy
const executors_to_deploy = {
"ethereum": [
// USV2 - Args: Fee BPS
{exchange: "UniswapV2Executor", args: [30]},
// PANCAKESWAP V2 - Args: Fee BPS
{exchange: "UniswapV2Executor", args: [25]},
// USV3 & PANCAKESWAP V3 - Args: (none)
{exchange: "UniswapV3Executor", args: []},
// Args: Pool manager, Angstrom hook
{
exchange: "UniswapV4Executor", args: [
"0x000000000004444c5dc75cB358380D2e3dE08A90",
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
// Args: (none)
{exchange: "BalancerV2Executor", args: []},
// Args: Ekubo core contract, mev resist
{
exchange: "EkuboExecutor", args: [
"0xe0e0e08A6A4b9Dc7bD67BCB7aadE5cF48157d444",
"0x553a2EFc570c9e104942cEC6aC1c18118e54C091"
]
},
// Args: ETH address in curve pools, stETH address
{
exchange: "CurveExecutor", args: [
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
]
},
// Args: (none)
{exchange: "MaverickV2Executor", args: []},
// Args: (none)
{exchange: "BalancerV3Executor", args: []},
// Args: Bebop Settlement contract
{
exchange: "BebopExecutor",
args: ["0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"]
},
// Args: Hashflow router
{
exchange: "HashflowExecutor",
args: ["0x55084eE0fEf03f14a305cd24286359A35D735151"]
},
// Args: liquidity
{
exchange: "FluidV1Executor", args: [
"0x52Aa899454998Be5b000Ad077a46Bbe360F4e497"
]
},
// Args:
{
exchange: "ERC4626Executor", args: []
},
// Args: deposit pool
{
exchange: "RocketpoolExecutor", args: [
"0xCE15294273CFb9D9b628F4D61636623decDF4fdC",
]
},
// Args:
{
exchange: "EkuboV3Executor", args: []
},
// Args: Wrapped native token address
{
exchange: "NativeWrapExecutor", args: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]
},
// Args: Liquorice settlement, Liquorice balance manager
{
exchange: "LiquoriceExecutor", args: [
"0x0448633eb8B0A42EfED924C42069E0DcF08fb552",
"0xb87bAE43a665EB5943A5642F81B26666bC9E5C95"
]
},
],
"base": [
// USV2 - Args: Fee BPS
{exchange: "UniswapV2Executor", args: [30]},
// USV3 - Args: (none)
{exchange: "UniswapV3Executor", args: []},
// USV4 - Args: Pool manager, Angstrom hook
{
exchange: "UniswapV4Executor", args: [
"0x498581ff718922c3f8e6a244956af099b2652b2b",
"0x631352Aaa9d6554848aF674106bCD8Bb9E59a5CF"
]
},
// Args: Bebop Settlement contract
{
exchange: "BebopExecutor",
args: ["0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"]
},
// Aerodrome Slipstreams - Args: (none)
{exchange: "SlipstreamsExecutor", args: []},
// Args: Wrapped native token address
{
exchange: "NativeWrapExecutor", args: ["0x4200000000000000000000000000000000000006"]
},
],
"unichain": [
// USV2 - Args: Fee BPS
{exchange: "UniswapV2Executor", args: [30]},
// USV3 - Args: (none)
{exchange: "UniswapV3Executor", args: []},
// USV4 - Args: Pool manager, Angstrom hook
{
exchange: "UniswapV4Executor", args: [
"0x1f98400000000000000000000000000000000004",
// This is the Angstrom address for ethereum. There isn't one for unichain
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
// Args: ETH address in curve pools, stETH address
{
exchange: "CurveExecutor", args: [
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"0x0000000000000000000000000000000000000000" // No stETH on unichain
]
},
// Aerodrome Slipstreams - Args: (none)
{exchange: "SlipstreamsExecutor", args: []},
// Args: Wrapped native token address
{
exchange: "NativeWrapExecutor", args: ["0x4200000000000000000000000000000000000006"]
},
],
"arbitrum": [
// USV2 - Args: Fee BPS
{exchange: "UniswapV2Executor", args: [30]},
// USV3 & PANCAKESWAP V3 - Args: (none)
{exchange: "UniswapV3Executor", args: []},
// USV4 - Args: Pool manager, Angstrom hook
{
exchange: "UniswapV4Executor", args: [
"0x360e68faccca8ca495c1b759fd9eee466db9fb32",
// This is the Angstrom address for ethereum. There isn't one for
// arbitrum
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
// Args: Wrapped native token address (WETH)
{
exchange: "NativeWrapExecutor", args: ["0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"]
},
],
"polygon": [
// USV2 & QUICKSWAP V2 - Args: Fee BPS
{exchange: "UniswapV2Executor", args: [30]},
// USV3 - Args: (none)
{exchange: "UniswapV3Executor", args: []},
// USV4 - Args: Pool manager, Angstrom hook
{
exchange: "UniswapV4Executor", args: [
"0x67366782805870060151383f4bbff9dab53e5cd6",
// This is the Angstrom address for ethereum. There isn't one for
// polygon
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
// Args: Wrapped native token address (WPOL)
{
exchange: "NativeWrapExecutor", args: ["0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"]
},
],
"bsc": [
// USV2 - Args: Fee BPS
{exchange: "UniswapV2Executor", args: [30]},
// PANCAKESWAP V2 - Args: Fee BPS
{exchange: "UniswapV2Executor", args: [25]},
// USV3 & PANCAKESWAP V3 - Args: (none)
{exchange: "UniswapV3Executor", args: []},
// USV4 - Args: Pool manager, Angstrom hook
{
exchange: "UniswapV4Executor", args: [
"0x28e2ea090877bf75740558f6bfb36a5ffee9e9df",
// This is the Angstrom address for ethereum. There isn't one for BSC
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
// Args: Wrapped native token address (WBNB)
{
exchange: "NativeWrapExecutor", args: ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"]
},
],
}
async function main() {
const network = hre.network.name;
console.log(`Deploying executors to ${network}`);
const [deployer] = await ethers.getSigners();
console.log(`Deploying with account: ${deployer.address}`);
console.log(`Account balance: ${ethers.utils.formatEther(await deployer.getBalance())} ETH`);
// Deterministic Deployment Proxy
// More info: https://getfoundry.sh/guides/deterministic-deployments-using-create2/
const create2FactoryAddress = "0x4e59b44847b379578588920cA78FbF26c0B4956C";
console.log(`Using CREATE2 factory at: ${create2FactoryAddress}`);
for (const executor of executors_to_deploy[network]) {
const {exchange, args} = executor;
const Executor = await ethers.getContractFactory(exchange);
// Get bytecode with constructor arguments
const deployTx = Executor.getDeployTransaction(...args);
const bytecode = deployTx.data;
// Use a salt that includes network and executor name
const salt = ethers.utils.id(`${exchange}-${network}`);
// Compute the address where the contract will be deployed
// CREATE2 address = keccak256(0xff ++ factory_address ++ salt ++ keccak256(bytecode))[12:]
const bytecodeHash = ethers.utils.keccak256(bytecode);
const computedAddress = ethers.utils.getCreate2Address(create2FactoryAddress, salt, bytecodeHash);
console.log(`${exchange} will be deployed to: ${computedAddress}`);
const deploymentData = ethers.utils.concat([salt, bytecode]);
const tx = await deployer.sendTransaction({
to: create2FactoryAddress,
data: deploymentData,
});
await tx.wait();
console.log(`${exchange} deployed to: ${computedAddress}`);
// Verify on Tenderly
try {
await hre.tenderly.verify({
name: exchange,
address: computedAddress,
});
console.log("Contract verified successfully on Tenderly");
} catch (error) {
console.error("Error during contract verification:", error);
}
console.log("Waiting for 1 minute before verifying the contract...");
await new Promise(resolve => setTimeout(resolve, 60000));
// Verify on Etherscan
try {
await hre.run("verify:verify", {
address: computedAddress,
constructorArguments: args,
});
console.log(`${exchange} verified successfully on blockchain explorer!`);
} catch (error) {
console.error(`Error during blockchain explorer verification:`, error);
}
}
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error("Deployment failed:", error);
process.exit(1);
});