foundry
foundry copied to clipboard
Cheatcode for cloning account to a specific address
Component
Forge
Describe the feature you would like
We are interested in a new cheatcode op: vm.cloneAccount
, which clones (code, state, balance, nonce) from one account to another account. This would be useful when we need to deploy code with a complex constructor to a specific address, let external calls from a contract we cannot control execute different code on different accounts when we fork the chain, etc. These cannot be easily achieved using vm.deal
, vm.etch
or vm.accesses
This operation is hard to implement in Solidity but easy in revm.
Example:
vm.cloneAccount(0x35c9dfd76bf02107ff4f7128Bd69716612d31dDb, 0xeCf9571038d92097a6C09A8d75713fEE69877211)
which should clone (code, state, balance, nonce) of 0x35c9dfd76bf02107ff4f7128Bd69716612d31dDb to 0xeCf9571038d92097a6C09A8d75713fEE69877211.
Additional context
No response