NomicFoundation / hardhat

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
https://hardhat.org
Other
7.35k stars 1.42k forks source link

Feature Request: Hardhat network copy account API #2718

Open zemse opened 2 years ago

zemse commented 2 years ago

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 called force, to overwrite existing accounts.

github-actions[bot] commented 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

github-actions[bot] commented 2 years ago

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.

fvictorio commented 2 years ago

Not stale at all.