deployment script verify fix

Signed-off-by: pradyuman-verma <pradyumnverma27@gmail.com>
This commit is contained in:
pradyuman-verma 2022-07-09 20:00:05 +05:30
parent 1e78276bb2
commit 24e81b2049
No known key found for this signature in database
GPG Key ID: E36FD6BC8923221F

View File

@ -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}`);