Via hardhat plugin
Hardhat is a full-featured development environment for contract compilation, deployment and verification. The Hardhat Etherscan plugin supports contract verification on U2U Chain blockchain explorer.
Last updated
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
const config: HardhatUserConfig = {
solidity: "0.8.19",
networks: {
solaris: {
url: 'https://rpc-mainnet.uniultra.xyz/',
accounts: ["YOUR_PRIVATE_KEY"], // it should start with 0x...
},
nebulas: {
url: 'https://rpc-nebulas-testnet.uniultra.xyz/',
accounts: ["YOUR_PRIVATE_KEY"], // it should start with 0x...
}
},
etherscan: {
apiKey: {
solaris: "abc", // arbitrary string
nebulas: "abc", // arbitrary string
},
customChains: [
{
network: "solaris",
chainId: 39,
urls: {
apiURL: "https://u2uscan.xyz/api",
browserURL: "https://u2uscan.xyz"
}
},
{
network: "nebulas",
chainId: 2484,
urls: {
apiURL: "https://testnet.u2uscan.xyz/api",
browserURL: "https://testnet.u2uscan.xyz"
}
},
]
}
};
export default config;
> npx hardhat run scripts/deploy.ts --network solaris
# Contract deployed to: 0x8D51395C76C34d0e11178c1F7EE3219B4b958e30npx hardhat verify --network solaris DEPLOYED_CONTRACT_ADDRESS [ARG_1 ARG_2 ...]> npx hardhat verify --network solaris 0x8D51395C76C34d0e11178c1F7EE3219B4b958e30 1000000000000000
Successfully submitted source code for contract
contracts/Lock.sol:Lock at 0x8D51395C76C34d0e11178c1F7EE3219B4b958e30
for verification on the block explorer. Waiting for verification result...
Successfully verified contract Lock on the block explorer.
https://u2uscan.xyz/address/0x8D51395C76C34d0e11178c1F7EE3219B4b958e30?tab=contract