require('dotenv').config();
const {ethers} = require("hardhat");
const hre = require("hardhat");
const executors_to_deploy = {
"ethereum": [
{exchange: "UniswapV2Executor", args: [30]},
{exchange: "UniswapV2Executor", args: [25]},
{exchange: "UniswapV3Executor", args: []},
{
exchange: "UniswapV4Executor", args: [
"0x000000000004444c5dc75cB358380D2e3dE08A90",
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
{exchange: "BalancerV2Executor", args: []},
{
exchange: "EkuboExecutor", args: [
"0xe0e0e08A6A4b9Dc7bD67BCB7aadE5cF48157d444",
"0x553a2EFc570c9e104942cEC6aC1c18118e54C091"
]
},
{
exchange: "CurveExecutor", args: [
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84"
]
},
{exchange: "MaverickV2Executor", args: []},
{exchange: "BalancerV3Executor", args: []},
{
exchange: "BebopExecutor",
args: ["0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"]
},
{
exchange: "HashflowExecutor",
args: ["0x55084eE0fEf03f14a305cd24286359A35D735151"]
},
{
exchange: "FluidV1Executor", args: [
"0x52Aa899454998Be5b000Ad077a46Bbe360F4e497"
]
},
{
exchange: "ERC4626Executor", args: []
},
{
exchange: "RocketpoolExecutor", args: [
"0xCE15294273CFb9D9b628F4D61636623decDF4fdC",
]
},
{
exchange: "EkuboV3Executor", args: []
},
{
exchange: "WethExecutor", args: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]
},
{
exchange: "LiquoriceExecutor", args: [
"0x0448633eb8B0A42EfED924C42069E0DcF08fb552",
"0xb87bAE43a665EB5943A5642F81B26666bC9E5C95"
]
},
],
"base": [
{exchange: "UniswapV2Executor", args: [30]},
{exchange: "UniswapV3Executor", args: []},
{
exchange: "UniswapV4Executor", args: [
"0x498581ff718922c3f8e6a244956af099b2652b2b",
"0x631352Aaa9d6554848aF674106bCD8Bb9E59a5CF"
]
},
{
exchange: "BebopExecutor",
args: ["0xbbbbbBB520d69a9775E85b458C58c648259FAD5F"]
},
{exchange: "SlipstreamsExecutor", args: []},
{
exchange: "WethExecutor", args: ["0x4200000000000000000000000000000000000006"]
},
],
"unichain": [
{exchange: "UniswapV2Executor", args: [30]},
{exchange: "UniswapV3Executor", args: []},
{
exchange: "UniswapV4Executor", args: [
"0x1f98400000000000000000000000000000000004",
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
{
exchange: "CurveExecutor", args: [
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
"0x0000000000000000000000000000000000000000" ]
},
{exchange: "SlipstreamsExecutor", args: []},
{
exchange: "WethExecutor", args: ["0x4200000000000000000000000000000000000006"]
},
],
"arbitrum": [
{exchange: "UniswapV2Executor", args: [30]},
{exchange: "UniswapV3Executor", args: []},
{
exchange: "UniswapV4Executor", args: [
"0x360e68faccca8ca495c1b759fd9eee466db9fb32",
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
],
"polygon": [
{exchange: "UniswapV2Executor", args: [30]},
{exchange: "UniswapV3Executor", args: []},
{
exchange: "UniswapV4Executor", args: [
"0x67366782805870060151383f4bbff9dab53e5cd6",
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
],
"bsc": [
{exchange: "UniswapV2Executor", args: [30]},
{exchange: "UniswapV2Executor", args: [25]},
{exchange: "UniswapV3Executor", args: []},
{
exchange: "UniswapV4Executor", args: [
"0x28e2ea090877bf75740558f6bfb36a5ffee9e9df",
"0x0000000aa232009084Bd71A5797d089AA4Edfad4"
]
},
],
}
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`);
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);
const deployTx = Executor.getDeployTransaction(...args);
const bytecode = deployTx.data;
const salt = ethers.utils.id(`${exchange}-${network}`);
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}`);
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));
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);
});