Skip to content

Commit

Permalink
fix: remove zksync-ethers dependency (#876)
Browse files Browse the repository at this point in the history
* fix: remove zksync-ethers dependency
  • Loading branch information
nikola-bozin-txfusion authored Mar 6, 2024
1 parent 61ab015 commit 5964e3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion packages/hardhat-zksync-verify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"chalk": "4.1.2",
"@ethersproject/abi": "^5.1.2",
"@ethersproject/address": "5.7.0",
"zksync-ethers": "^6.0.0",
"cbor": "^8.1.0",
"debug": "^4.1.1",
"@openzeppelin/contracts": "^4.9.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-zksync-verify/src/task-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export async function verifyContract(
throw new ZkSyncVerifyPluginError(`${address} is an invalid address.`);
}

const deployedBytecodeHex = await retrieveContractBytecode(address, hre.network);
const deployedBytecodeHex = await retrieveContractBytecode(address, hre);
const deployedBytecode = new Bytecode(deployedBytecodeHex);

const compilerVersions: string[] = await hre.run(TASK_VERIFY_GET_COMPILER_VERSIONS);
Expand Down
9 changes: 4 additions & 5 deletions packages/hardhat-zksync-verify/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import axios from 'axios';
import * as zk from 'zksync-ethers';
import chalk from 'chalk';
import { SolcUserConfig } from 'hardhat/types';
import { HardhatRuntimeEnvironment, SolcUserConfig } from 'hardhat/types';
import { VerificationStatusResponse } from './zksync-block-explorer/verification-status-response';
import { checkVerificationStatusService } from './zksync-block-explorer/service';
import { ZkSyncVerifyPluginError } from './errors';
Expand Down Expand Up @@ -67,15 +66,15 @@ export async function executeVeificationWithRetry(
}
}

export async function retrieveContractBytecode(address: string, hreNetwork: any): Promise<string> {
const provider = new zk.Provider(hreNetwork.config.url);
export async function retrieveContractBytecode(address: string, hre:HardhatRuntimeEnvironment): Promise<string> {
const provider = hre.network.provider;
const bytecodeString = (await provider.send('eth_getCode', [address, 'latest'])) as string;
const deployedBytecode = bytecodeString.startsWith('0x') ? bytecodeString.slice(2) : bytecodeString;

if (deployedBytecode.length === 0) {
throw new ZkSyncVerifyPluginError(
`The address ${address} has no bytecode. Is the contract deployed to this network?
The selected network is ${hreNetwork.name}.`,
The selected network is ${hre.network.name}.`,
);
}
return deployedBytecode;
Expand Down

0 comments on commit 5964e3f

Please sign in to comment.