Skip to content

for verification on the block explorer. Waiting for verification result... #5858

@wjh-x

Description

@wjh-x

Hello everyone, I encountered a problem where the deployment contract verification failed.
For example, the second BaseRegistrarImplementation contract needs to use the address of the first ENSRegistry contract. The first contract can be verified normally on the browser, but the second contract is always waiting. Below is my project information. Please help me. Thank you.

package.json
{ "devDependencies": { "@nomicfoundation/hardhat-chai-matchers": "^2.0.0", "@nomicfoundation/hardhat-ethers": "^3.0.8", "@nomicfoundation/hardhat-ignition": "^0.15.0", "@nomicfoundation/hardhat-ignition-ethers": "^0.15.0", "@nomicfoundation/hardhat-network-helpers": "^1.0.0", "@nomicfoundation/hardhat-toolbox": "^5.0.0", "@nomicfoundation/hardhat-verify": "^2.0.11", "@typechain/ethers-v6": "^0.5.0", "@typechain/hardhat": "^9.0.0", "chai": "^4.2.0", "ethers": "^6.13.4", "hardhat": "^2.22.14", "hardhat-gas-reporter": "^1.0.8", "solidity-coverage": "^0.8.0", "typechain": "^8.3.0" }, "packageManager": "[email protected]+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610", "dependencies": { "@ensdomains/ens-contracts": "1.0.1", "dotenv": "^16.4.5", "hardhat-deploy": "^0.14.0", "undici": "^6.20.1", "viem": "^2.21.34" } }

hardhat.config.js
`require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-ethers");
require("hardhat-deploy");
require("dotenv").config();

const { ProxyAgent, setGlobalDispatcher } = require("undici");
const proxyAgent = new ProxyAgent("http://127.0.0.1:7890");
setGlobalDispatcher(proxyAgent);

const RPC_URL = process.env.RPC_URL;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
const AMAZETEST_API_KEY = process.env.AMAZETEST_API_KEY;
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY;
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL;

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
defaultNetwork: "hardhat",
networks: {
amazetest: {
url: RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 100100100,
},
amazemainnet: {
url: RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 94,
},
sepolia: {
url: SEPOLIA_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 11155111,
},
},
// etherscan: {
// apiKey: ETHERSCAN_API_KEY,
// },
etherscan: {
apiKey: {
amazetest: AMAZETEST_API_KEY,
},
customChains: [
{
network: "amazetest",
chainId: 100100100,
urls: {
apiURL: "https://testnet.amazechain.com/api",
browserURL: "https://testnet.amazechain.com/",
},
},
],
},
solidity: "0.8.27",
};
Below is my deploy.js codeconst { ethers, run, network } = require("hardhat");
const { namehash } = require("viem/ens");

async function main() {
// ENSRegistry
const eNSRegistryFactory = await ethers.getContractFactory(
"contracts/ens/ENSRegistry.sol:ENSRegistry"
);
console.log("deploy contract ENSRegistry...");
const eNSRegistry = await eNSRegistryFactory.deploy();
await eNSRegistry.waitForDeployment();
console.log(deploy contract to: ${eNSRegistry.target});

if (network.config.chainId === 100100100 && process.env.AMAZETEST_API_KEY) {
console.log("waitting for block taxes...");
await eNSRegistry.deploymentTransaction().wait(2);
await verify(
eNSRegistry.target,
[],
"contracts/ens/ENSRegistry.sol:ENSRegistry"
);
}

// BaseRegistrarImplementation
const baseNode = namehash("eth"); // 0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae
// console.log(baseNode);
const baseRegistrarImplementationFactory = await ethers.getContractFactory(
"contracts/ens/BaseRegistrarImplementation.sol:BaseRegistrarImplementation"
);
console.log("deploy contract BaseRegistrarImplementation...");
const baseRegistrarImplementation =
await baseRegistrarImplementationFactory.deploy(
eNSRegistry.target,
baseNode
);
await baseRegistrarImplementation.waitForDeployment();
console.log(deploy contract to: ${baseRegistrarImplementation.target});

if (network.config.chainId === 100100100 && process.env.AMAZETEST_API_KEY) {
console.log("waitting for block taxes...");
await baseRegistrarImplementation.deploymentTransaction().wait(2);
await verify(
baseRegistrarImplementation.target,
[eNSRegistry.target, baseNode],
"contracts/ens/BaseRegistrarImplementation.sol:BaseRegistrarImplementation"
);
}
}

// 验证合约
async function verify(contractAddress, args, contractPath) {
console.log("verifying contract...");
try {
await run("verify:verify", {
address: contractAddress,
constructorArguments: args,
contract: contractPath,
});
} catch (e) {
if (e.message.toLowerCase().includes("alreay verified")) {
console.log("already verified");
} else {
console.log(e);
}
}
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
This is my runyarn hardhat run scripts/deploy.js --network amazetest
yarn run v1.22.22
warning package.json: No license field
$ /Users/macbook/Desktop/wjh/blockchain/ens/node_modules/.bin/hardhat run scripts/deploy.js --network amazetest
deploy contract ENSRegistry...
deploy contract to: 0xD15f731a40aE1FBc6da1855686E1A63cc10Ec479
waitting for block taxes...
verifying contract...
The contract 0xD15f731a40aE1FBc6da1855686E1A63cc10Ec479 has already been verified on the block explorer. If you're trying to verify a partially verified contract, please use the --force flag.
https://testnet.amazechain.com/address/0xD15f731a40aE1FBc6da1855686E1A63cc10Ec479#code

deploy contract BaseRegistrarImplementation...
deploy contract to: 0x111549c39480AcF2C0E94a2cef4Cc0E355d334d9
waitting for block taxes...
verifying contract...
Successfully submitted source code for contract
contracts/ens/BaseRegistrarImplementation.sol:BaseRegistrarImplementation at 0x111549c39480AcF2C0E94a2cef4Cc0E355d334d9
for verification on the block explorer. Waiting for verification result...`

Metadata

Metadata

Assignees

Labels

status:needs-more-infoThere's not enough information to start working on this issue

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions