From 61ab015eccd16417ece429d2fb105834700f2046 Mon Sep 17 00:00:00 2001 From: nikola-bozin-txfusion <147805948+nikola-bozin-txfusion@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:01:27 +0100 Subject: [PATCH] fix: remove zksync-ethers dependency (#877) * fix: remove zksync-ethers dependency --- packages/hardhat-zksync-verify-vyper/package.json | 1 - packages/hardhat-zksync-verify-vyper/src/task-actions.ts | 2 +- packages/hardhat-zksync-verify-vyper/src/utils.ts | 8 ++++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/hardhat-zksync-verify-vyper/package.json b/packages/hardhat-zksync-verify-vyper/package.json index a75ee781f..466504c27 100644 --- a/packages/hardhat-zksync-verify-vyper/package.json +++ b/packages/hardhat-zksync-verify-vyper/package.json @@ -38,7 +38,6 @@ "axios": "^1.6.2", "chai": "^4.3.6", "chalk": "4.1.2", - "zksync-ethers": "^6.0.0", "@nomiclabs/hardhat-vyper": "^3.0.5", "@ethersproject/abi":"^5.1.2", "@ethersproject/address": "5.7.0" diff --git a/packages/hardhat-zksync-verify-vyper/src/task-actions.ts b/packages/hardhat-zksync-verify-vyper/src/task-actions.ts index 0d236ccb2..9e26630ee 100644 --- a/packages/hardhat-zksync-verify-vyper/src/task-actions.ts +++ b/packages/hardhat-zksync-verify-vyper/src/task-actions.ts @@ -64,7 +64,7 @@ export async function verifyContract( ): Promise { await hre.run(TASK_COMPILE_VYPER, { quiet: true }); - const deployedBytecode = await retrieveContractBytecode(address, hre.network); + const deployedBytecode = await retrieveContractBytecode(address, hre); const artifact = await hre.run(TASK_VERIFY_GET_ARTIFACT, { contractFQN, deployedBytecode }); const artificatBytecode = artifact.bytecode; diff --git a/packages/hardhat-zksync-verify-vyper/src/utils.ts b/packages/hardhat-zksync-verify-vyper/src/utils.ts index 9c4a3c6a5..e31d7e302 100644 --- a/packages/hardhat-zksync-verify-vyper/src/utils.ts +++ b/packages/hardhat-zksync-verify-vyper/src/utils.ts @@ -1,7 +1,7 @@ import axios from 'axios'; -import * as zk from 'zksync-ethers'; import { ZkSyncVerifyPluginError } from './errors'; import { WRONG_CONSTRUCTOR_ARGUMENTS } from './constants'; +import { HardhatRuntimeEnvironment } from 'hardhat/types'; export function handleAxiosError(error: any): never { if (axios.isAxiosError(error)) { @@ -31,14 +31,14 @@ export async function encodeArguments(abi: any, constructorArgs: any[]) { return deployArgumentsEncoded; } -export async function retrieveContractBytecode(address: string, hreNetwork: any): Promise { - const provider = new zk.Provider(hreNetwork.config.url); +export async function retrieveContractBytecode(address: string, hre:HardhatRuntimeEnvironment): Promise { + const provider = hre.network.provider; const bytecodeString = (await provider.send('eth_getCode', [address, 'latest'])) as string; if (bytecodeString.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 bytecodeString;