From 548f8ed198bf3fa2db57c80652888466fd467596 Mon Sep 17 00:00:00 2001 From: Igor Sobolev Date: Wed, 18 Sep 2024 14:20:34 +0100 Subject: [PATCH] deploy univ3 caller on base --- package.json | 11 +++++---- scripts/4_deploy_uniswap_v2_caller copy.js | 23 ------------------- .../{0_deploy_router.js => deploy_router.js} | 0 ...mple_caller.js => deploy_simple_caller.js} | 0 ..._caller.js => deploy_uniswap_v2_caller.js} | 0 ..._caller.js => deploy_uniswap_v3_caller.js} | 2 +- scripts/deployment.js | 3 +++ ...etup_router_fee.js => setup_router_fee.js} | 0 scripts/{6_verify.js => verify.js} | 0 test/callers/UniswapV2Caller.js | 2 +- 10 files changed, 11 insertions(+), 30 deletions(-) delete mode 100644 scripts/4_deploy_uniswap_v2_caller copy.js rename scripts/{0_deploy_router.js => deploy_router.js} (100%) rename scripts/{1_deploy_simple_caller.js => deploy_simple_caller.js} (100%) rename scripts/{2_deploy_uniswap_v2_caller.js => deploy_uniswap_v2_caller.js} (100%) rename scripts/{5_deploy_uniswap_v2_caller.js => deploy_uniswap_v3_caller.js} (95%) rename scripts/{3_setup_router_fee.js => setup_router_fee.js} (100%) rename scripts/{6_verify.js => verify.js} (100%) diff --git a/package.json b/package.json index f8a8e92c..cc8829bb 100755 --- a/package.json +++ b/package.json @@ -15,11 +15,12 @@ "lint": "npm run lint:solhint && npm run lint:eslint", "slither": "slither . --filter-paths \"node_modules\"", "truffle-dashboard": "npx truffle dashboard", - "deploy:router": "npx hardhat run scripts/0_deploy_router.js --network truffle-dashboard", - "deploy:sc": "npx hardhat run scripts/1_deploy_simple_caller.js --network truffle-dashboard", - "deploy:univ2caller": "npx hardhat run scripts/2_deploy_uniswap_v2_caller.js --network truffle-dashboard", - "initialize:router": "npx hardhat run scripts/3_setup_router_fee.js --network truffle-dashboard", - "verify": "npx hardhat run scripts/4_verify.js --network mode", + "deploy:router": "npx hardhat run scripts/deploy_router.js --network truffle-dashboard", + "deploy:sc": "npx hardhat run scripts/deploy_simple_caller.js --network truffle-dashboard", + "deploy:univ2caller": "npx hardhat run scripts/deploy_uniswap_v2_caller.js --network truffle-dashboard", + "deploy:univ3caller": "npx hardhat run scripts/deploy_uniswap_v3_caller.js --network truffle-dashboard", + "initialize:router": "npx hardhat run scripts/setup_router_fee.js --network truffle-dashboard", + "verify": "npx hardhat run scripts/verify.js --network base", "docs:serve": "npx @techdocs/cli serve:mkdocs -p 3333" }, "lint-staged": { diff --git a/scripts/4_deploy_uniswap_v2_caller copy.js b/scripts/4_deploy_uniswap_v2_caller copy.js deleted file mode 100644 index 520cb6ef..00000000 --- a/scripts/4_deploy_uniswap_v2_caller copy.js +++ /dev/null @@ -1,23 +0,0 @@ -import deploymentAddresses from './deployment'; - -try { - (async () => { - console.log('Make sure 0x161b29D1919D4E06b53eE449376181B5082b30B9 is used and nonce is 3-6'); - - const chainIdHex = await hre.network.provider.request({ method: 'eth_chainId' }); - const chainId = parseInt(chainIdHex.toString(), 16).toString(); - - console.log(`Working with chainId ${chainId}`); - - // We get the contract to deploy - const Contract = await ethers.getContractFactory('UniswapV2Caller'); - const contract = await Contract.deploy(deploymentAddresses.weth[chainId]); - - console.log(`${'UniswapV2Caller'} deployed to: ${contract.address}`); - - return contract.address; - })(); -} catch (error) { - console.error(error); - process.exit(1); -} diff --git a/scripts/0_deploy_router.js b/scripts/deploy_router.js similarity index 100% rename from scripts/0_deploy_router.js rename to scripts/deploy_router.js diff --git a/scripts/1_deploy_simple_caller.js b/scripts/deploy_simple_caller.js similarity index 100% rename from scripts/1_deploy_simple_caller.js rename to scripts/deploy_simple_caller.js diff --git a/scripts/2_deploy_uniswap_v2_caller.js b/scripts/deploy_uniswap_v2_caller.js similarity index 100% rename from scripts/2_deploy_uniswap_v2_caller.js rename to scripts/deploy_uniswap_v2_caller.js diff --git a/scripts/5_deploy_uniswap_v2_caller.js b/scripts/deploy_uniswap_v3_caller.js similarity index 95% rename from scripts/5_deploy_uniswap_v2_caller.js rename to scripts/deploy_uniswap_v3_caller.js index 29561842..a02ce985 100644 --- a/scripts/5_deploy_uniswap_v2_caller.js +++ b/scripts/deploy_uniswap_v3_caller.js @@ -2,7 +2,7 @@ import deploymentAddresses from './deployment'; try { (async () => { - console.log('Make sure 0x161b29D1919D4E06b53eE449376181B5082b30B9 is used and nonce is 7'); + console.log('Make sure 0x161b29D1919D4E06b53eE449376181B5082b30B9 is used and nonce is 8'); const chainIdHex = await hre.network.provider.request({ method: 'eth_chainId' }); const chainId = parseInt(chainIdHex.toString(), 16).toString(); diff --git a/scripts/deployment.js b/scripts/deployment.js index e7660ef2..dff997f5 100644 --- a/scripts/deployment.js +++ b/scripts/deployment.js @@ -61,6 +61,9 @@ const deploymentAddresses = { 7777777: '0xe76BA87E04555e1a5afcCb0c8c5AC4d0b29e3dBE', 666666666: '0xe76BA87E04555e1a5afcCb0c8c5AC4d0b29e3dBE', }, + uniswapV3Caller: { + 8453: '0x05Bdc1AED3f648424efA4b76a96d6294b788f416', + }, weth: { 56: '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', 100: '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', diff --git a/scripts/3_setup_router_fee.js b/scripts/setup_router_fee.js similarity index 100% rename from scripts/3_setup_router_fee.js rename to scripts/setup_router_fee.js diff --git a/scripts/6_verify.js b/scripts/verify.js similarity index 100% rename from scripts/6_verify.js rename to scripts/verify.js diff --git a/test/callers/UniswapV2Caller.js b/test/callers/UniswapV2Caller.js index 322c02d8..197da5e5 100644 --- a/test/callers/UniswapV2Caller.js +++ b/test/callers/UniswapV2Caller.js @@ -304,7 +304,7 @@ describe('UniswapV2Caller', () => { ).to.be.reverted; }); - it.only('should do dai -> eth trade', async () => { + it('should do dai -> eth trade', async () => { await dai.approve(router.address, ethers.utils.parseUnits('500', 18)); await execute(