Is there any way to get the “exact code” tag at the proxy?
I am using hardhat “2.26.0” with “hardhat-verify” "2.0.1"
Code to reproduce
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "dotenv/config";
import "@openzeppelin/hardhat-upgrades";
import "@nomicfoundation/hardhat-verify";
const config: HardhatUserConfig = {
solidity: {
version: "0.8.29",
settings: {
viaIR: true,
},
},
networks: {
"bsc-testnet": {
url: BSC_TESTNET_RPC_URL,
chainId: 97,
accounts: TESTNET_PRIVATE_KEY ? [TESTNET_PRIVATE_KEY] : [],
gasPrice: "auto",
},
"bsc-mainnet": {
url: BSC_MAINNET_RPC_URL,
chainId: 56,
accounts: MAINNET_PRIVATE_KEY ? [MAINNET_PRIVATE_KEY] : [],
gasPrice: "auto",
},
},
etherscan: {
apiKey: ETHERSCAN_API_KEY,
customChains: [
{
network: "bsc-testnet",
chainId: 97,
urls: {
apiURL: "https://api.etherscan.io/v2/api",
browserURL: "https://testnet.bscscan.com",
},
},
],
},
defaultNetwork: "hardhat",
sourcify: {
enabled: true,
},
};
export default config;
/deploy.ts
import { ethers, upgrades } from "hardhat";
import parameters from "./parameters";
/**
* @title CentToken Testnet Deployment Script
* @dev This script deploys the upgradable CentToken contract to a testnet.
* It uses randomly generated addresses for the token allocations for quick testing.
*/
async function main() {
const CentTokenFactory = await ethers.getContractFactory("CentToken");
// Deploy the contract as an upgradable proxy
const centToken = await upgrades.deployProxy(
CentTokenFactory as any,
[parameters.allocationWallets, parameters.adminWallet],
{
initializer: "initialize",
kind: "uups",
}
);
await centToken.waitForDeployment();
const proxyAddress = await centToken.getAddress();
console.log("CentToken (Proxy) deployed to:", proxyAddress);
// The implementation contract address is what you will verify on BscScan
const implementationAddress = await upgrades.erc1967.getImplementationAddress(
proxyAddress
);
console.log("Implementation contract deployed to:", implementationAddress);
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Environment
{
"name": "cent-token",
"devDependencies": {
"@nomicfoundation/hardhat-toolbox": "^6.0.0",
"@openzeppelin/contracts": "^5.3.0",
"@openzeppelin/contracts-upgradeable": "^5.3.0",
"@openzeppelin/hardhat-upgrades": "^3.9.0",
"dotenv": "^17.0.0",
"hardhat": "^2.26.0"
},
"dependencies": {
"@nomicfoundation/hardhat-verify": "^2.0.1",
"@openzeppelin/contracts-upgradeable": "^5.3.0",
"ethers": "^6.15.0"
}
}