Skip to content
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

create2 option #11

Closed
wants to merge 5 commits into from
Closed

create2 option #11

wants to merge 5 commits into from

Conversation

z0r0z
Copy link
Contributor

@z0r0z z0r0z commented May 1, 2022

add create2 optionality w/ salt

add create2 optionality
@z0r0z z0r0z mentioned this pull request May 1, 2022
z0r0z added 4 commits May 4, 2022 23:36
add salt to demo factory
add salt for demo factory deployment
add null input for demo clone deployment
use non-reserved keyword for null salt value constant
@BlinkyStitt
Copy link

I don't think the is_zero check on salt is the right way to do this. I currently use create2 with empty salts for almost all of my deploys. I do this because I care about easily recreating the same address and not because I want a vanity address. I could change all my code to use a salt of "1" or something as default, but I think two separate functions would be better

@strollinghome
Copy link

@wighawag @ZeframLou any chance of getting this merged? Interested in using this and deterministic address would-be killer.

Also, I've been talking to people at Etherscan and they added minor support for detecting these types of clones already. Ideally, we'd get something similar to how EIP-1167 gets code verified automatically for all clones.

@@ -137,7 +140,12 @@ library ClonesWithImmutableArgs {
}
// solhint-disable-next-line no-inline-assembly
assembly {
instance := create(0, ptr, creationSize)
if iszero(salt) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe instead of this check, we should create 2 functions clone as before and cloneDeterministic

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, happy to make a new PR to work on this, unless @z0r0z is up for continuing on this?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also super noob question, I'm not very good at assembly. But would there be a way to write a predictDeterministic function that predicts the address it'll deploy to without actually deploying the contract? I know OZ's Clones have that too.

@wighawag
Copy link
Owner

Thanks @z0r0z for the PR and sorry for not looking at it all this time. A new Pr that implement create2 has been merged : #19

@wighawag wighawag closed this Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants