Skip to content

Commit

Permalink
update: add no compile flag to hardhat verify
Browse files Browse the repository at this point in the history
  • Loading branch information
kiriyaga committed Oct 26, 2023
1 parent 609808f commit 851ebd3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/selfish-trees-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@matterlabs/hardhat-zksync-verify": patch
---

Add noCompile flag to the contract verification script to not recompile the contracts before sending verification request
4 changes: 2 additions & 2 deletions packages/hardhat-zksync-verify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"README.md"
],
"dependencies": {
"axios": "^1.4.0",
"@matterlabs/hardhat-zksync-solc": "0.4.1",
"@nomicfoundation/hardhat-verify": "^1.0.2",
"axios": "^1.4.0",
"chalk": "4.1.2",
"dockerode": "^3.3.4"
},
"devDependencies": {
"@nomicfoundation/hardhat-verify": "^1.0.2",
"@types/chai": "^4.2.0",
"@types/mocha": "^9.1.0",
"@types/node": "^18.11.17",
Expand Down
4 changes: 3 additions & 1 deletion packages/hardhat-zksync-verify/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ extendEnvironment((hre: HardhatRuntimeEnvironment) => {
hre.network.verifyURL = hre.network.config.verifyURL ?? TESTNET_VERIFY_URL;
});

task(TASK_VERIFY, 'Verifies contract on Ethereum and zkSync networks').setAction(verify);
task(TASK_VERIFY, 'Verifies contract on Ethereum and zkSync networks')
.addFlag("noCompile", "Run verify without compile")
.setAction(verify);

subtask(TASK_VERIFY_VERIFY).setAction(verifyContract);

Expand Down
8 changes: 6 additions & 2 deletions packages/hardhat-zksync-verify/src/task-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export async function verify(
contract: string;
constructorArgsParams: any[];
libraries: string;
noCompile: boolean;
},
hre: HardhatRuntimeEnvironment,
runSuper: RunSuperFunction<TaskArguments>
Expand Down Expand Up @@ -69,6 +70,7 @@ export async function verify(
constructorArguments: constructorArguments,
contract: args.contract,
libraries,
noCompile: args.noCompile,
});
}

Expand Down Expand Up @@ -120,7 +122,7 @@ export async function getConstructorArguments(
}

export async function verifyContract(
{ address, contract: contractFQN, constructorArguments, libraries }: TaskArguments,
{ address, contract: contractFQN, constructorArguments, libraries, noCompile }: TaskArguments,
hre: HardhatRuntimeEnvironment,
runSuper: RunSuperFunction<TaskArguments>
): Promise<number> {
Expand All @@ -138,7 +140,9 @@ export async function verifyContract(

const compilerVersions: string[] = await hre.run(TASK_VERIFY_GET_COMPILER_VERSIONS);

await hre.run(TASK_COMPILE, { quiet: true });
if (!noCompile) {
await hre.run(TASK_COMPILE, { quiet: true });
}

const contractInformation: ContractInformation = await hre.run(TASK_VERIFY_GET_CONTRACT_INFORMATION, {
contractFQN: contractFQN,
Expand Down
3 changes: 3 additions & 0 deletions packages/hardhat-zksync-verify/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export interface VerificationArgs {

// --list-networks flag
listNetworks: boolean;

// Do not compile contracts before verifying
noCompile?: boolean;
}

export interface Libraries {
Expand Down
11 changes: 10 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@
ts-morph "^19.0.0"

"@matterlabs/hardhat-zksync-node@link:packages/hardhat-zksync-node":
version "0.0.1-beta.1"
version "0.0.1-beta.4"
dependencies:
"@matterlabs/hardhat-zksync-solc" "0.4.2"
axios "^1.4.0"
Expand Down Expand Up @@ -757,6 +757,15 @@
"@openzeppelin/upgrades-core" "~1.27.0"
dockerode "^3.3.4"

"@matterlabs/hardhat-zksync-verify@link:packages/hardhat-zksync-verify":
version "0.2.0"
dependencies:
"@matterlabs/hardhat-zksync-solc" "0.4.1"
"@nomicfoundation/hardhat-verify" "^1.0.2"
axios "^1.4.0"
chalk "4.1.2"
dockerode "^3.3.4"

"@matterlabs/hardhat-zksync-vyper@link:packages/hardhat-zksync-vyper":
version "0.2.2"
dependencies:
Expand Down

0 comments on commit 851ebd3

Please sign in to comment.