Skip to content

Commit

Permalink
fix: remove zksync-ethers dependency (#877)
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 b834719 commit 61ab015
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/hardhat-zksync-verify-vyper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/hardhat-zksync-verify-vyper/src/task-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function verifyContract(
): Promise<number> {
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;
Expand Down
8 changes: 4 additions & 4 deletions packages/hardhat-zksync-verify-vyper/src/utils.ts
Original file line number Diff line number Diff line change
@@ -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)) {
Expand Down Expand Up @@ -31,14 +31,14 @@ export async function encodeArguments(abi: any, constructorArgs: any[]) {
return deployArgumentsEncoded;
}

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;

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;
Expand Down

0 comments on commit 61ab015

Please sign in to comment.