mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Merge pull request #243 from Instadapp/script-fixes
This commit is contained in:
commit
ce465592e4
|
@ -1,6 +1,6 @@
|
||||||
import hre, { ethers } from "hardhat";
|
import hre, { ethers } from "hardhat";
|
||||||
|
|
||||||
import { execScript } from "../tests/command";
|
import { execScript } from "../tests/command";
|
||||||
|
|
||||||
export const deployConnector = async (connectorName?: string) => {
|
export const deployConnector = async (connectorName?: string) => {
|
||||||
connectorName = String(process.env.connectorName) ?? connectorName;
|
connectorName = String(process.env.connectorName) ?? connectorName;
|
||||||
const Connector = await ethers.getContractFactory(connectorName);
|
const Connector = await ethers.getContractFactory(connectorName);
|
||||||
|
@ -11,19 +11,20 @@ export const deployConnector = async (connectorName?: string) => {
|
||||||
|
|
||||||
const chain = String(hre.network.name);
|
const chain = String(hre.network.name);
|
||||||
if (chain !== "hardhat") {
|
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 {
|
try {
|
||||||
await execScript({
|
await execScript({
|
||||||
cmd: "npx",
|
cmd: "npx",
|
||||||
args: [
|
args: ["hardhat", "verify", "--network", `${chain}`, `${connector.address}`, "--contract", `${connectorPath}`],
|
||||||
"hardhat",
|
|
||||||
"verify",
|
|
||||||
"--network",
|
|
||||||
`${chain}`,
|
|
||||||
`${connector.address}`,
|
|
||||||
],
|
|
||||||
env: {
|
env: {
|
||||||
networkType: chain,
|
networkType: chain
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(`Failed to verify: ${connectorName}@${connector.address}`);
|
console.log(`Failed to verify: ${connectorName}@${connector.address}`);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user