-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for create2 in ethers.utils.getContractAddress ? #697
Comments
Oh yes! I meant to add this earlier. I have the necessary function in another project and will add it to both v4 and v5 today. Thanks for the reminder. :) |
I've added
Or if you have the initCode hash instead:
The v5 version will only support the latter option, I think, but I'd be curious which you use more often. |
Closing this now, but please feel free to re-open (or open a new issue) if you have any problems. Thanks! :) |
Hi, I am trying the getCreate2Address function, but it is not giving me the addresses that are finally created. With the ethers function getCreate2Address we can not pass the arguments and I think that's why it doesn't coincide. Thanks a lot! |
You have to pass in the initcode, which is the deployment bytecode concatenated with the ABI encoded arguments. You can use the That should give you the address you are expecting. Let me know if that works for you. :) |
We are using
ethers.utils.getContractAddress
in order to determine the address of an upcoming contract (using the sender's address and its nonce).As we are moving to using
create2
, this approach does not yield the correct address.Is there any plan to support create2 for
getContractAddress
?The text was updated successfully, but these errors were encountered: