Expose implementation address in hardhat plugin
See original GitHub issueIt would be nice for there to be a standardized way to get the address of a deployed implementation contract when working with the hardhat plugin.
Currently the user flow is:
const Box = await ethers.getContractFactory("Box");
const box = await upgrades.deployProxy(Box, [42]);
await box.deployed();
console.log("Box deployed to:", box.address);
But it would be nice to do something like this:
const Box = await ethers.getContractFactory("Box");
const box = await upgrades.deployProxy(Box, [42]);
await box.deployed();
console.log("Box deployed to:", box.address);
const implementation = await upgrades.getImplementation(box);
await run("verify", implementation.address") // Run the etherscan verification tkas
Currently a user must manually check the ./.openzeppelin/
folder and extract the contract address.
Automating this process is made difficult by the fact that the implementations are stored in a map whose key is a hash. The method of obtaining this hash isn’t readily documented either.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:17 (11 by maintainers)
Top Results From Across the Web
Plugins | Ethereum development environment for ... - Hardhat
A jest environment with hardhat built in. Hardhat plugin to deploy your smart contracts across multiple EVM chains with the same deterministic address....
Read more >How to get implementation address after deployProxy ...
I'm deploying my token using the proxy pattern via hardhat-upgrades. await run('verify:verify', { address: token. address, constructorArguments ...
Read more >hardhat-exposed - npm
A Hardhat plugin to automatically expose internal functions for smart contract testing. Installation. npm install -D hardhat-exposed. Add to hardhat.config.js :.
Read more >How to deploy your first smart contract on Ethereum ... - StErMi
Change the hardhat configuration file extension to .ts and update the content ... If you copy that contract address and past it on...
Read more >Hardhat: networks and providers - HackMD
An Ethereum node can be used to read the state of the blockchain or to send transactions that modify that state. To let...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Available in the latest release.
Hi @abcoathup,
An example use case that I encountered needing is automating the etherscan verification of an implemented proxy when using hardhat.
I found a workaround, but it’s as you can probably see, less than ideal:
Another user case that we needed it for is we have our own json format where we store all deployed contracts (proxy, implementation, proxyadmin) and we needed to fetch those from the manifest to load the json file.
I’m concerned those core functions will change, or the manifest format will change, so an official way to retrieve this data would be helpful.