I'm deploying my token using the proxy pattern via hardhat-upgrades.
const TokenFactory = await ethers.getContractFactory('MyToken');
const token = await upgrades.deployProxy(TokenFactory);
const result = await token.deployed();
Next I want to verify the contract on etherscan using hardhat-etherscan
await run('verify:verify', {
address: token.address,
constructorArguments: []
});
The problem is token.address
points to the proxy. From what I understand the proxy doesnt need to be verified, but rather the implementation does.
But I can't seem to find a way to get the implementation address.
Where is this elusive address and how can I access it programmatically after deploying the proxy?