Skip to content

Commit

Permalink
remove Etherscan.ts utility script
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcabot committed Jan 12, 2023
1 parent 2adcbc1 commit b66ba33
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 41 deletions.
19 changes: 17 additions & 2 deletions deploy/SoulLinker.ts
@@ -1,7 +1,7 @@
import hre from "hardhat";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { getEnvParams, getPrivateKey } from "../src/EnvParams";
import { verifyOnEtherscan } from "../src/Etherscan";
import { paymentParams } from "../src/PaymentParams";

let admin: SignerWithAddress;
Expand Down Expand Up @@ -50,7 +50,22 @@ const func: DeployFunction = async ({

// verify contract with etherscan, if its not a local network
if (network.name == "mainnet" || network.name == "goerli") {
verifyOnEtherscan(soulLinkerDeploymentResult.address, constructorArguments);
try {
console.log(11);
await hre.run("verify:verify", {
address: soulLinkerDeploymentResult.address,
constructorArguments
});
console.log(22);
} catch (error) {
console.log("error", error);
if (
!error.message.includes("Contract source code already verified") &&
!error.message.includes("Reason: Already Verified")
) {
throw error;
}
}
}

if (network.name == "hardhat") {
Expand Down
16 changes: 14 additions & 2 deletions deploy/SoulName.ts
@@ -1,7 +1,7 @@
import hre from "hardhat";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { getEnvParams, getPrivateKey } from "../src/EnvParams";
import { verifyOnEtherscan } from "../src/Etherscan";

let admin: SignerWithAddress;

Expand Down Expand Up @@ -37,7 +37,19 @@ const func: DeployFunction = async ({

// verify contract with etherscan, if its not a local network
if (network.name == "mainnet" || network.name == "goerli") {
verifyOnEtherscan(soulNameDeploymentResult.address, constructorArguments);
try {
await hre.run("verify:verify", {
address: soulNameDeploymentResult.address,
constructorArguments
});
} catch (error) {
if (
!error.message.includes("Contract source code already verified") &&
!error.message.includes("Reason: Already Verified")
) {
throw error;
}
}
}

if (network.name == "hardhat") {
Expand Down
16 changes: 14 additions & 2 deletions deploy/SoulStore.ts
@@ -1,7 +1,7 @@
import hre from "hardhat";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { getEnvParams, getPrivateKey } from "../src/EnvParams";
import { verifyOnEtherscan } from "../src/Etherscan";
import { paymentParams } from "../src/PaymentParams";

let admin: SignerWithAddress;
Expand Down Expand Up @@ -48,7 +48,19 @@ const func: DeployFunction = async ({

// verify contract with etherscan, if its not a local network
if (network.name == "mainnet" || network.name == "goerli") {
verifyOnEtherscan(soulStoreDeploymentResult.address, constructorArguments);
try {
await hre.run("verify:verify", {
address: soulStoreDeploymentResult.address,
constructorArguments
});
} catch (error) {
if (
!error.message.includes("Contract source code already verified") &&
!error.message.includes("Reason: Already Verified")
) {
throw error;
}
}
}

if (network.name == "hardhat") {
Expand Down
19 changes: 14 additions & 5 deletions deploy/Soulbound2FA.ts
@@ -1,7 +1,7 @@
import hre from "hardhat";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { getEnvParams, getPrivateKey } from "../src/EnvParams";
import { verifyOnEtherscan } from "../src/Etherscan";
import { paymentParams } from "../src/PaymentParams";

let admin: SignerWithAddress;
Expand Down Expand Up @@ -55,10 +55,19 @@ const func: DeployFunction = async ({

// verify contract with etherscan, if its not a local network
if (network.name == "goerli") {
verifyOnEtherscan(
soulbound2FADeploymentResult.address,
constructorArguments
);
try {
await hre.run("verify:verify", {
address: soulbound2FADeploymentResult.address,
constructorArguments
});
} catch (error) {
if (
!error.message.includes("Contract source code already verified") &&
!error.message.includes("Reason: Already Verified")
) {
throw error;
}
}
}

if (network.name == "hardhat") {
Expand Down
19 changes: 14 additions & 5 deletions deploy/SoulboundCreditScore.ts
@@ -1,7 +1,7 @@
import hre from "hardhat";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { getEnvParams, getPrivateKey } from "../src/EnvParams";
import { verifyOnEtherscan } from "../src/Etherscan";
import { paymentParams } from "../src/PaymentParams";

let admin: SignerWithAddress;
Expand Down Expand Up @@ -55,10 +55,19 @@ const func: DeployFunction = async ({

// verify contract with etherscan, if its not a local network
if (network.name == "mainnet" || network.name == "goerli") {
verifyOnEtherscan(
soulboundCreditScoreDeploymentResult.address,
constructorArguments
);
try {
await hre.run("verify:verify", {
address: soulboundCreditScoreDeploymentResult.address,
constructorArguments
});
} catch (error) {
if (
!error.message.includes("Contract source code already verified") &&
!error.message.includes("Reason: Already Verified")
) {
throw error;
}
}
}

if (network.name == "hardhat") {
Expand Down
19 changes: 14 additions & 5 deletions deploy/SoulboundIdentity.ts
@@ -1,7 +1,7 @@
import hre from "hardhat";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { getEnvParams } from "../src/EnvParams";
import { verifyOnEtherscan } from "../src/Etherscan";

let admin: SignerWithAddress;

Expand Down Expand Up @@ -35,10 +35,19 @@ const func: DeployFunction = async ({

// verify contract with etherscan, if its not a local network
if (network.name == "mainnet" || network.name == "goerli") {
verifyOnEtherscan(
soulboundIdentityDeploymentResult.address,
constructorArguments
);
try {
await hre.run("verify:verify", {
address: soulboundIdentityDeploymentResult.address,
constructorArguments
});
} catch (error) {
if (
!error.message.includes("Contract source code already verified") &&
!error.message.includes("Reason: Already Verified")
) {
throw error;
}
}
}
};

Expand Down
20 changes: 0 additions & 20 deletions src/Etherscan.ts

This file was deleted.

0 comments on commit b66ba33

Please sign in to comment.