Open zemse opened 2 years ago
This issue is also being tracked on Linear.
We use Linear to manage our development process, but we keep the conversations on Github.
LINEAR-ID: e11ac264-a69e-4d90-9207-339329709aaf
This issue was marked as stale because it didn't have any activity in the last 30 days. If you think it's still relevant, please leave a comment indicating so. Otherwise, it will be closed in 7 days.
Not stale at all.
Motivation
Currently, to deploy a contract at the desired address on the hardhat network, the only way to do that seems to be the
hardhat_setCode
. The limitation of this approach is that it cannot run any constructor init code, just the runtime code.Usecase to deploy contracts at desired addresses are to mock contracts at CREATE2 addresses or even mock existing contracts on a mainnet fork. Plugins like smock or hardhat-deploy or various different plugins, can then leverage this great feature of deploying contract at a dev specified address while deployment.
Specification
The introduction of a new hardhat API called
hardhat_copyAccount
takes in a source account address and a destination account address. It should fail if an account already exists (similar to UNIX cp). So it can take an additional optional param calledforce
, to overwrite existing accounts.