Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SC-1429] Update deploy scripts for FeeTaker #352

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
Loading