Skip to content

Commit

Permalink
Merge pull request #352 from 1inch/patch/fee-taker-deploy-script
Browse files Browse the repository at this point in the history
[SC-1429] Update deploy scripts for FeeTaker
  • Loading branch information
zZoMROT authored Jan 29, 2025
2 parents ecbc96c + 8990881 commit b33c007
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
3 changes: 2 additions & 1 deletion deploy/deploy-FeeTaker-zksync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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({
Expand Down
32 changes: 9 additions & 23 deletions deploy/deploy-FeeTaker.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { deployAndGetContractWithCreate3 } = require('@1inch/solidity-utils');
const hre = require('hardhat');
const { ethers } = hre;
const { getChainId } = hre;
Expand All @@ -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`);
Expand All @@ -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;

0 comments on commit b33c007

Please sign in to comment.