feat(`cast compute-address`): add support for `CREATE2` addresses
Component
Cast
Describe the feature you would like
Right now cast-compute-address only supports address calculation using the standard RLP encoding pattern. It would be very useful (at least for me 😄) if you could add support for CREATE2-based address creations where you need to supply the nonce and the init-code-hash.
cast-compute-address --deployer 0x... --salt 0x... --init-code-hash 0x... (or --init-code 0x...)
Supportive 👍
This would look something like: cast compute-address <address> --salt <salt> --init-code-hash <code_hash>, the nonce shouldn't matter for create2.
cast compute-address currently fetches the nonce from the RPC if the --nonce is not defined. In the implementation we need to make sure that it won't attempt to do this when the --init-code-hash is passed. The salt should be optional in my opinion and default to 0x.
Supportive 👍
This would look something like:
cast compute-address <address> --salt <salt> --init-code-hash <code_hash>, thenonceshouldn't matter for create2.
cast compute-addresscurrently fetches thenoncefrom the RPC if the--nonceis not defined. In the implementation we need to make sure that it won't attempt to do this when the--init-code-hashis passed. The salt should be optional in my opinion and default to0x.
I think we should also allow for --init-code since that's what most people will have first (instead of the hash). I would be explicit about the --salt tbh, but that's maybe just me being an "explicit maxi" 😄.
I think we can support both --init-code and --init-code-hash here, yeah let's keep --salt explicit
@mablr is this something you would be interested in working on? 😃
Yes 😄
I can do it in the next days.
Amazing thanks @mablr!