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-911] Migrate to new hardhat-ethers #137

Merged
merged 32 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
95190ca
Bump deps
zZoMROT Nov 22, 2023
341f794
Hack limit-order-protocol deps
zZoMROT Nov 22, 2023
0a64e0d
Patch FeeBank tests
zZoMROT Nov 22, 2023
0104f18
Patch FeeBankCharger tests
zZoMROT Nov 22, 2023
9c4d308
Patch MeasureGas tests
zZoMROT Nov 22, 2023
b3a58ff
Patch PowerPod tests
zZoMROT Nov 22, 2023
d9a1762
Patch PriorityFeeLimiter tests
zZoMROT Nov 22, 2023
922aa4b
Patch Settlement tests
zZoMROT Nov 22, 2023
1d26988
Patch WhitelistChecker tests
zZoMROT Nov 22, 2023
d46df7d
Patch WhitelistRegistry tests
zZoMROT Nov 22, 2023
facb6c8
Patch deploy scripts
zZoMROT Nov 22, 2023
a85b8a1
Remove unused helper
zZoMROT Nov 22, 2023
670a1c9
Fix util from settlementV1 deps
zZoMROT Nov 22, 2023
0652aa4
Merge branch 'master' into feature/bump-hardhat-ethers
ZumZoom Dec 20, 2023
ff4f013
bump some deps
ZumZoom Dec 20, 2023
7b4fc49
wip Bump solidity and oz
zZoMROT Dec 20, 2023
2755741
Merge branch 'feature/bump-hardhat-ethers' into feature/bump-solidity-oz
zZoMROT Dec 20, 2023
0fa80f1
Fix tests
zZoMROT Dec 20, 2023
d03237c
Fix linter
zZoMROT Dec 20, 2023
81c2178
Fix ci node version
zZoMROT Dec 20, 2023
af4bd57
Fix docgen
zZoMROT Dec 20, 2023
9ade15f
update CI
ZumZoom Dec 21, 2023
c6434e8
bump deps
ZumZoom Dec 21, 2023
f3d668b
bump version
ZumZoom Dec 21, 2023
cdb6217
update cleanup script
ZumZoom Dec 21, 2023
8693c4c
vendor orderUtilsV1
ZumZoom Dec 21, 2023
04e7936
Merge pull request #140 from 1inch/feature/bump-solidity-oz
ZumZoom Dec 21, 2023
0dfa44b
use loose pragma for interfaces
ZumZoom Dec 21, 2023
dcef012
remove unused mocks
ZumZoom Dec 21, 2023
14112d0
fix test
ZumZoom Dec 21, 2023
3102b21
simplify
ZumZoom Dec 21, 2023
24c3cc0
update deployment script
ZumZoom Dec 21, 2023
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
16 changes: 7 additions & 9 deletions deploy/deploy-whitelist.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const hre = require('hardhat');
const { getChainId } = hre;
const { idempotentDeployGetContract } = require('../test/helpers/utils.js');
const { deployAndGetContract } = require('@1inch/solidity-utils');

const DAO_ADDRESS = '0x7951c7ef839e26F63DA87a42C9a87986507f1c07';

Expand All @@ -13,17 +13,15 @@ module.exports = async ({ getNamedAccounts, deployments }) => {
const { deployer } = await getNamedAccounts();

const delegation = await deployments.get('PowerPod');
console.log('delegation: ', delegation.address);
console.log('delegation: ', await delegation.getAddress());

const whitelist = await idempotentDeployGetContract(
'WhitelistRegistry',
// 1000 = 10% threshold
[delegation.address, '1000'],
const whitelist = await deployAndGetContract({
contractName: 'WhitelistRegistry',
constructorArgs: [await delegation.getAddress(), '1000'], // 1000 = 10% threshold
deployments,
deployer,
'WhitelistRegistryV2',
// true,
);
deploymentName: 'WhitelistRegistryV2',
});

const tx = await whitelist.transferOwnership(DAO_ADDRESS);
await tx.wait();
Expand Down
75 changes: 32 additions & 43 deletions deploy/deploy_settlement_env.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const hre = require('hardhat');
const { getChainId, ethers } = hre;
const { idempotentDeployGetContract } = require('../test/helpers/utils.js');
const { deployAndGetContract } = require('@1inch/solidity-utils');

const INCH_ADDR = '0x111111111117dC0aa78b770fA6A738034120C302';
const ST1INCH_ADDR = '0x9A0C8Ff858d273f57072D714bca7411D717501D7';
Expand All @@ -14,63 +14,52 @@ module.exports = async ({ getNamedAccounts, deployments }) => {

const { deployer } = await getNamedAccounts();

const st1inch = (await ethers.getContractFactory('St1inch')).attach(ST1INCH_ADDR);
const st1inch = (await ethers.getContractFactory('St1inch')).attach(ST1INCH_ADDR); // eslint-disable-line no-unused-vars
ZumZoom marked this conversation as resolved.
Show resolved Hide resolved

const settlement = await idempotentDeployGetContract(
'Settlement',
[ROUTER_V5_ADDR, INCH_ADDR],
const settlement = await deployAndGetContract({
contractName: 'SettlementExtension',
constructorArgs: [ROUTER_V5_ADDR, INCH_ADDR],
deployments,
deployer,
'Settlement',
// true,
);
deploymentName: 'Settlement',
});

const feeBankAddress = await settlement.feeBank();
console.log('FeeBank deployed to:', feeBankAddress);

if (chainId !== '31337') {
await hre.run('verify:verify', {
address: feeBankAddress,
constructorArguments: [settlement.address, INCH_ADDR, deployer],
constructorArguments: [await settlement.getAddress(), INCH_ADDR, deployer],
});
}

const delegation = await idempotentDeployGetContract(
'PowerPod',
['Delegated st1INCH', 'dst1INCH', st1inch.address],
deployments,
deployer,
'PowerPod',
// true,
);
// const delegation = await deployAndGetContract({
ZumZoom marked this conversation as resolved.
Show resolved Hide resolved
// contractName: 'PowerPod',
// constructorArgs: ['Delegated st1INCH', 'dst1INCH', await st1inch.getAddress()],
// deployments,
// deployer,
// });

/* const resolverMetadata = */ await idempotentDeployGetContract(
'ResolverMetadata',
[delegation.address],
deployments,
deployer,
'ResolverMetadata',
// true,
);
// /* const resolverMetadata = */ await deployAndGetContract({
// contractName: 'ResolverMetadata',
// constructorArgs: [await delegation.getAddress()],
// deployments,
// deployer,
// });

const whitelist = await idempotentDeployGetContract(
'WhitelistRegistry',
// 1000 = 10% threshold
[delegation.address, '1000'],
deployments,
deployer,
'WhitelistRegistry',
// true,
);
// const whitelist = await deployAndGetContract({
// contractName: 'WhitelistRegistry',
// constructorArgs: [await delegation.getAddress(), '1000'], // 1000 = 10% threshold
// deployments,
// deployer,
// });

/* const whitelistHelper = */ await idempotentDeployGetContract(
'WhitelistHelper',
[whitelist.address],
deployments,
deployer,
'WhitelistHelper',
// true,
);
// /* const whitelistHelper = */ await deployAndGetContract({
// contractName: 'WhitelistHelper',
// constructorArgs: [await whitelist.getAddress()],
// deployments,
// deployer,
// });
};

module.exports.skip = async () => true;
30 changes: 14 additions & 16 deletions deploy/deploy_settlement_only.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const hre = require('hardhat');
const { getChainId } = hre;
const { idempotentDeployGetContract } = require('../test/helpers/utils.js');
const { deployAndGetContract } = require('@1inch/solidity-utils');

const INCH = {
1: '0x111111111117dC0aa78b770fA6A738034120C302', // Mainnet
Expand All @@ -27,37 +27,35 @@ module.exports = async ({ getNamedAccounts, deployments }) => {

const { deployer } = await getNamedAccounts();

const settlement = await idempotentDeployGetContract(
'Settlement',
[ROUTER_V5_ADDR, INCH[chainId]],
const settlement = await deployAndGetContract({
contractName: 'SettlementExtension',
constructorArgs: [ROUTER_V5_ADDR, INCH[chainId]],
deployments,
deployer,
'Settlement',
// true,
);
deploymentName: 'Settlement',
});

console.log('Settlement deployed to:', settlement.address);
console.log('Settlement deployed to:', await settlement.getAddress());

const feeBankAddress = await settlement.feeBank();
console.log('FeeBank deployed to:', feeBankAddress);

if (chainId !== '31337') {
await hre.run('verify:verify', {
address: feeBankAddress,
constructorArguments: [settlement.address, INCH[chainId], deployer],
constructorArguments: [await settlement.getAddress(), INCH[chainId], deployer],
});
}

const settlementStaging = await idempotentDeployGetContract(
'Settlement',
[ROUTER_V5_ADDR, INCH[chainId]],
const settlementStaging = await deployAndGetContract({
contractName: 'SettlementExtension',
constructorArgs: [ROUTER_V5_ADDR, INCH[chainId]],
deployments,
deployer,
'SettlementStaging',
true,
);
deploymentName: 'SettlementStaging',
});

console.log('Settlement staging to:', settlementStaging.address);
console.log('Settlement staging to:', await settlementStaging.getAddress());
};

module.exports.skip = async () => true;
6 changes: 3 additions & 3 deletions deploy/zksync.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ module.exports = async function (hre) {

const Settlement = await deployer.loadArtifact('Settlement');
const settlement = await deployer.deploy(Settlement, [ROUTER, USDC]);
console.log(`${Settlement.contractName} was deployed to ${settlement.address}`);
console.log(`${Settlement.contractName} was deployed to ${await settlement.getAddress()}`);
if (await hre.getChainId() !== '31337') {
await hre.run('verify:verify', {
address: settlement.address,
address: await settlement.getAddress(),
constructorArguments: [ROUTER, USDC],
});
}

const settlementStaging = await deployer.deploy(Settlement, [ROUTER, USDC]);
console.log(`${Settlement.contractName}Staging was deployed to ${settlementStaging.address}`);
console.log(`${Settlement.contractName}Staging was deployed to ${await settlementStaging.getAddress()}`);
};

module.exports.skip = async () => true;
5 changes: 2 additions & 3 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
require('@matterlabs/hardhat-zksync-deploy');
require('@matterlabs/hardhat-zksync-solc');
require('@matterlabs/hardhat-zksync-verify');
require('@nomiclabs/hardhat-ethers');
require('@nomiclabs/hardhat-etherscan');
require('@nomicfoundation/hardhat-verify');
require('@nomicfoundation/hardhat-chai-matchers');
require('solidity-coverage');
require('hardhat-dependency-compiler');
Expand Down Expand Up @@ -66,7 +65,7 @@ module.exports = {
],
},
zksolc: {
version: '1.3.7',
version: '1.3.17',
compilerSource: 'binary',
settings: {},
},
Expand Down
40 changes: 21 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,40 @@
"dependencies": {
"@1inch/delegating": "0.0.21",
"@1inch/erc20-pods": "0.0.17",
"@1inch/limit-order-protocol-contract": "4.0.0-prerelease-14",
"@1inch/solidity-utils": "2.2.27",
"@1inch/limit-order-protocol-contract": "git+https://github.com/1inch/limit-order-protocol.git#feature/bump-hardhat-ethers",
"@1inch/solidity-utils": "3.2.0",
"@1inch/st1inch": "2.0.3",
"@openzeppelin/contracts": "4.8.2"
},
"devDependencies": {
"@1inch/limit-order-settlement-v1": "git+https://github.com/1inch/limit-order-settlement.git#1.0.0",
"@matterlabs/hardhat-zksync-deploy": "0.6.3",
"@matterlabs/hardhat-zksync-solc": "0.3.16",
"@matterlabs/hardhat-zksync-verify": "0.1.4",
"@nomicfoundation/hardhat-chai-matchers": "1.0.6",
"@nomicfoundation/hardhat-network-helpers": "1.0.8",
"@nomiclabs/hardhat-ethers": "2.2.3",
"@nomiclabs/hardhat-etherscan": "3.1.7",
"chai": "4.3.7",
"dotenv": "16.0.3",
"eslint": "8.38.0",
"@matterlabs/hardhat-zksync-deploy": "1.0.0",
"@matterlabs/hardhat-zksync-solc": "1.0.0",
"@matterlabs/hardhat-zksync-verify": "0.2.0",
"@nomicfoundation/hardhat-chai-matchers": "2.0.2",
"@nomicfoundation/hardhat-network-helpers": "1.0.9",
"@nomicfoundation/hardhat-verify": "1.1.1",
"@nomicfoundation/hardhat-ethers": "3.0.5",
"chai": "4.3.10",
"dotenv": "16.3.1",
"eslint": "8.53.0",
"eslint-config-standard": "17.0.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-n": "15.7.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-n": "16.3.1",
"eslint-plugin-promise": "6.1.1",
"hardhat": "2.13.1",
"ethers": "6.8.1",
"hardhat": "2.19.1",
"hardhat-dependency-compiler": "1.1.3",
"hardhat-deploy": "0.11.26",
"hardhat-deploy": "0.11.34",
"hardhat-gas-reporter": "1.0.9",
"hardhat-tracer": "2.2.2",
"hardhat-tracer": "2.7.0",
"prettier": "2.8.7",
"prettier-plugin-solidity": "1.1.3",
"solc": "0.8.19",
"solhint": "3.4.1",
"solidity-coverage": "0.8.2",
"solidity-coverage": "0.8.4",
"solidity-docgen": "0.6.0-beta.35",
"zksync-web3": "0.14.3"
"zksync-web3": "0.16.0",
"zksync2-js": "0.2.2"
}
}
Loading
Loading