From 24e81b20499b459275f3dc780b54fc6f334b3755 Mon Sep 17 00:00:00 2001 From: pradyuman-verma Date: Sat, 9 Jul 2022 20:00:05 +0530 Subject: [PATCH] deployment script verify fix Signed-off-by: pradyuman-verma --- scripts/deployment/deployConnector.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/deployment/deployConnector.ts b/scripts/deployment/deployConnector.ts index cbcca6b1..1b925480 100644 --- a/scripts/deployment/deployConnector.ts +++ b/scripts/deployment/deployConnector.ts @@ -1,6 +1,6 @@ import hre, { ethers } from "hardhat"; - import { execScript } from "../tests/command"; + export const deployConnector = async (connectorName?: string) => { connectorName = String(process.env.connectorName) ?? connectorName; const Connector = await ethers.getContractFactory(connectorName); @@ -11,19 +11,20 @@ export const deployConnector = async (connectorName?: string) => { const chain = String(hre.network.name); if (chain !== "hardhat") { + const allPaths = await hre.artifacts.getArtifactPaths(); + + let connectorPath; + for (const path of allPaths) + if (path.split("/").includes(connectorName + ".json")) + connectorPath = path.slice(path.indexOf("contracts"), path.indexOf(connectorName) - 1) + `:${connectorName}`; + try { await execScript({ cmd: "npx", - args: [ - "hardhat", - "verify", - "--network", - `${chain}`, - `${connector.address}`, - ], + args: ["hardhat", "verify", "--network", `${chain}`, `${connector.address}`, "--contract", `${connectorPath}`], env: { - networkType: chain, - }, + networkType: chain + } }); } catch (error) { console.log(`Failed to verify: ${connectorName}@${connector.address}`);