From 89908817290246d66177a84ccea6df31e1378a38 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 29 Jan 2025 12:56:36 +0000 Subject: [PATCH] Update deploy scripts for FeeTaker --- deploy/deploy-FeeTaker-zksync.js | 3 ++- deploy/deploy-FeeTaker.js | 32 +++++++++----------------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/deploy/deploy-FeeTaker-zksync.js b/deploy/deploy-FeeTaker-zksync.js index e1d8c3ee..13037cc8 100644 --- a/deploy/deploy-FeeTaker-zksync.js +++ b/deploy/deploy-FeeTaker-zksync.js @@ -7,6 +7,7 @@ const WETH = { }; const ROUTER_V6_ADDR = '0x6fd4383cB451173D5f9304F041C7BCBf27d561fF'; +const ACCESS_TOKEN_ADDR = '0xC2c4fE863EC835D7DdbFE91Fe33cf1C7Df45Fa7C'; module.exports = async ({ deployments, getNamedAccounts }) => { const networkName = hre.network.name; @@ -24,7 +25,7 @@ module.exports = async ({ deployments, getNamedAccounts }) => { const { deployer } = await getNamedAccounts(); - const constructorArgs = [ROUTER_V6_ADDR, WETH[chainId], deployer]; + const constructorArgs = [ROUTER_V6_ADDR, ACCESS_TOKEN_ADDR, WETH[chainId], deployer]; const contractName = 'FeeTaker'; await deployAndGetContract({ diff --git a/deploy/deploy-FeeTaker.js b/deploy/deploy-FeeTaker.js index f90835b2..1dbccbc8 100644 --- a/deploy/deploy-FeeTaker.js +++ b/deploy/deploy-FeeTaker.js @@ -1,3 +1,4 @@ +const { deployAndGetContractWithCreate3 } = require('@1inch/solidity-utils'); const hre = require('hardhat'); const { ethers } = hre; const { getChainId } = hre; @@ -18,11 +19,10 @@ const WETH = { }; const ROUTER_V6_ADDR = '0x111111125421ca6dc452d289314280a0f8842a65'; +const ACCESS_TOKEN_ADDR = '0xACCe550000159e70908C0499a1119D04e7039C28'; const FEE_TAKER_SALT = ethers.keccak256(ethers.toUtf8Bytes('FeeTaker')); -const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); - module.exports = async ({ deployments, getNamedAccounts }) => { const networkName = hre.network.name; console.log(`running ${networkName} deploy script`); @@ -39,27 +39,13 @@ module.exports = async ({ deployments, getNamedAccounts }) => { const { deployer } = await getNamedAccounts(); - const create3Deployer = await ethers.getContractAt('ICreate3Deployer', (await deployments.get('Create3Deployer')).address); - - const FeeTakerFactory = await ethers.getContractFactory('FeeTaker'); - - const deployData = (await FeeTakerFactory.getDeployTransaction(ROUTER_V6_ADDR, WETH[chainId], deployer)).data; - - const txn = create3Deployer.deploy(FEE_TAKER_SALT, deployData, { gasLimit: 5000000 }); - await (await txn).wait(); - - const feeTaker = await ethers.getContractAt('FeeTaker', await create3Deployer.addressOf(FEE_TAKER_SALT)); - - console.log('FeeTaker deployed to:', await feeTaker.getAddress()); - - await sleep(5000); // wait for etherscan to index contract - - if (chainId !== '31337') { - await hre.run('verify:verify', { - address: await feeTaker.getAddress(), - constructorArguments: [ROUTER_V6_ADDR, WETH[chainId], deployer], - }); - } + await deployAndGetContractWithCreate3({ + contractName: 'FeeTaker', + constructorArgs: [ROUTER_V6_ADDR, ACCESS_TOKEN_ADDR, WETH[chainId], deployer], + create3Deployer: (await deployments.get('Create3Deployer')).address, + salt: FEE_TAKER_SALT, + deployments, + }); }; module.exports.skip = async () => true;