foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat: add cast create2 initcodehash

Open 0xClandestine opened this issue 1 year ago • 0 comments

Component

Cast

Describe the feature you would like

Something like this would be nice for computing CREATE2 initcode hashes on the fly:

cast create2 initcodehash <contract> <optional_args_selector> <args>

Output should equal:

keccak256(abi.encodePacked(type(c).creationCode, abi.encode(params))

Additional context

I've currently been using this helper in my package.json:

cast keccak $(cast concat-hex \"$(forge inspect --silent Witness bytecode)\" \"$(cast abi-encode 'abi.encode(address)' \"$OWNER_ADDRESS\")\")

0xClandestine avatar Feb 10 '24 15:02 0xClandestine