From efa6fae0e8f3884849dc7ec51f0e32483b483836 Mon Sep 17 00:00:00 2001 From: Diana Carvalho Date: Tue, 15 Jul 2025 10:01:38 +0100 Subject: [PATCH] feat: Uniswap X deployment script --- don't change below this line --- ENG-4675 Took 23 minutes --- foundry/scripts/README.md | 20 ++++++- foundry/scripts/deploy-uniswap-x-filler.js | 62 ++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 foundry/scripts/deploy-uniswap-x-filler.js diff --git a/foundry/scripts/README.md b/foundry/scripts/README.md index ff170e4..cc7d16e 100644 --- a/foundry/scripts/README.md +++ b/foundry/scripts/README.md @@ -66,4 +66,22 @@ For each of the following, you must select one of `tenderly_ethereum`, `tenderly 2. The scripts deploy-executors, remove-executor, set-roles and revoke-role all support this. 1. If `SAFE_ADDRESS` is set, then it will propose a transaction to the safe wallet and later on it needs to be approved in their UI to execute on chain. - 2. If it's not set, it will submit the transaction directly to the chain. \ No newline at end of file + 2. If it's not set, it will submit the transaction directly to the chain. + +## Deploy Uniswap X filler + +The current script deploys an Uniswap X filler and verifies it in the corresponding blockchain explorer. + +Make sure to run `unset HISTFILE` in your terminal before setting the private key. This will prevent the private key +from being stored in the shell history. + +1. Set the following environment variables: + +``` +export RPC_URL= +export PRIVATE_KEY= +export BLOCKCHAIN_EXPLORER_API_KEY= +``` + +2. Confirm that the variables `tychoRouter`, `uniswapXReactor` and `nativeToken` are correctly set in the script. +3. Run `npx hardhat run scripts/deploy-uniswap-x-filler.js --network NETWORK`. diff --git a/foundry/scripts/deploy-uniswap-x-filler.js b/foundry/scripts/deploy-uniswap-x-filler.js new file mode 100644 index 0000000..e0ab7b4 --- /dev/null +++ b/foundry/scripts/deploy-uniswap-x-filler.js @@ -0,0 +1,62 @@ +require('dotenv').config(); +const {ethers} = require("hardhat"); +const hre = require("hardhat"); + +async function main() { + const network = hre.network.name; + let tychoRouter; + let uniswapXReactor; + let nativeToken; + if (network === "ethereum") { + tychoRouter = "0xfD0b31d2E955fA55e3fa641Fe90e08b677188d35"; + uniswapXReactor = "0x00000011F84B9aa48e5f8aA8B9897600006289Be"; + nativeToken = "0x0000000000000000000000000000000000000000"; + } else if (network === "base") { + tychoRouter = "0xea3207778e39EB02D72C9D3c4Eac7E224ac5d369"; + uniswapXReactor = "0x000000001Ec5656dcdB24D90DFa42742738De729"; + nativeToken = "0x0000000000000000000000000000000000000000"; + } else if (network === "unichain") { + tychoRouter = "0xFfA5ec2e444e4285108e4a17b82dA495c178427B"; + uniswapXReactor = "0x00000006021a6Bce796be7ba509BBBA71e956e37"; + nativeToken = "0x0000000000000000000000000000000000000000"; + } else { + throw new Error(`Unsupported network: ${network}`); + } + + console.log(`Deploying Uniswap X filler to ${network} with:`); + console.log(`- Tycho router: ${tychoRouter}`); + console.log(`- Uniswap X reactor: ${uniswapXReactor}`); + console.log(`- Native token: ${nativeToken}`); + + const [deployer] = await ethers.getSigners(); + console.log(`Deploying with account: ${deployer.address}`); + console.log(`Account balance: ${ethers.utils.formatEther(await deployer.getBalance())} ETH`); + + const UniswapXFiller = await ethers.getContractFactory("UniswapXFiller"); + const filler = await UniswapXFiller.deploy(tychoRouter, uniswapXReactor, nativeToken); + + await filler.deployed(); + console.log(`Uniswap X Filler deployed to: ${filler.address}`); + + console.log("Waiting for 1 minute before verifying the contract on the blockchain explorer..."); + await new Promise(resolve => setTimeout(resolve, 60000)); + + // Verify on Etherscan + try { + await hre.run("verify:verify", { + address: filler.address, + constructorArguments: [tychoRouter, uniswapXReactor, nativeToken], + }); + console.log(`Uniswap X filler 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); + }); \ No newline at end of file