-
Notifications
You must be signed in to change notification settings - Fork 115
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
Stylus deployer #294
base: develop
Are you sure you want to change the base?
Stylus deployer #294
Conversation
release: v3.0.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't dug into the tests yet but the deployer looks pretty good
// bubble up the revert if there was one | ||
if and(iszero(newContractAddress), not(iszero(returndatasize()))) { | ||
let p := mload(0x40) | ||
returndatacopy(p, 0, returndatasize()) | ||
revert(p, returndatasize()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these could be pulled out of the if/else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my assembly foo isnt good enough, you got a suggestion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol no the assembly is good i was just thinking like this:
address newContractAddress;
if (salt != 0) {
assembly {
newContractAddress := create2(0, add(bytecode, 0x20), mload(bytecode), salt)
}
} else {
assembly {
newContractAddress := create(0, add(bytecode, 0x20), mload(bytecode))
}
}
assembly {
// bubble up the revert if there was one
if and(iszero(newContractAddress), not(iszero(returndatasize()))) {
let p := mload(0x40)
returndatacopy(p, 0, returndatasize())
revert(p, returndatasize())
}
}
Co-authored-by: Henry <[email protected]>
Co-authored-by: Henry <[email protected]>
…s/nitro-contracts into stylus-factory-chris
No description provided.