foundry
foundry copied to clipboard
feat: add cast create2 initcodehash
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\")\")