Verified source code for UUPS proxy has other proxy contracts

Hello guys,

I have some doubts regarding proxy contracts, I am using UUPSUpgradeable proxy to upgrade my contract, for deployment I have used tools Remix and hardhat with deploy script.
When I am using Remix to deploy my contract it works fine , And it's deploying what I am expected to do ..
Proxy address : https://mumbai.polygonscan.com/address/0x60533DF6CeB28016546B1d8456eD0db319fEa23D#code
When I am using harhat to deploy my contract it works little much different , its deploying some additional contract which I have not imported in my main contractProxy address : https://mumbai.polygonscan.com/address/0x197D7815d87C21d508A755fea6ba15743967C2Ab#code

deploy script in hardhat://async function main() {

const erc1155 = await ethers.getContractFactory("test");
const ERC1155 = await upgrades.deployProxy(erc1155);
await ERC1155.deployed();
console.log("test address:", ERC1155.address);

}

My questions are simple: why am I getting additional imported contracts like beconProxy.sol , UpgradeableBeacon.sol while deploying in hardhat and how to avoid them ..

Although those additional contracts appear in the verified source code, you can ignore them because they are not used by your specific proxy. For example, ERC1967Proxy does not have any dependencies (either directly or indirectly) on UpgradeableBeacon.sol.

This occurs due to a side effect of how the Hardhat Upgrades plugin currently submits source code for Etherscan verification. These different contracts are all compiled at the same time, so they all appear in the same Solc input JSON that gets submitted to Etherscan.

Issue https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/754 will fix this in the plugin when it is resolved, however any previously verified contracts would still have those additional source files on Etherscan.

Thanks for your reply :v:

1 Like