-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Step 1 of 2] feat: add create2Factory #1
Conversation
ready for review, no more change will be added |
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.
lgtm
nonReentrant | ||
returns (address deployed) | ||
{ | ||
deployed = Create2.deploy(msg.value, salt, creationCode); |
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.
Suggestion: can we add deploy event here , so we can know which contract deployed by this factory
ee79f71
to
d77c1c3
Compare
src/CustomizedProxyChild.sol
Outdated
|
||
if (newOwner != address(0)) { | ||
// transfer ownership | ||
Ownable(addr).transferOwnership(newOwner); |
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.
I think the only issue with this is what if the addr
is not Ownable
? like if it is IAccessControl
?
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.
i guess then we might need to have a separate ProxyChild for that contract. In my sense the "ProxyChild" is more like a on-chain "deployScript" with fixed addr and nonce = 0. It needs to be customized according to the contract we want to deploy
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.
then maybe we can just generalized it by deploy(creationCode, calldata)
and then addr.call(calldata)
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.
will update this part if this approach is taken
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.
same thoughts, agree with Omelette since some of his farming contract is not using Ownable 😆
src/Create3.sol
Outdated
//SPDX-License-Identifier: Unlicense | ||
pragma solidity ^0.8.0; | ||
|
||
import {CustomizedProxyChild} from "./CustomizedProxyChild.sol"; |
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.
would there also be a Create3Factory.sol
?
src/Create3.sol
Outdated
// TODO: update desc | ||
|
||
/** | ||
* @title A library for deploying contracts EIP-3171 style. |
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.
maybe can put the reference to where this was 'referenced' from
d77c1c3
to
f6a5133
Compare
Based on option 2c
This is a 2 steps process:
Original goal: have all deployment script here. However we cannot do that as this means all contract will deploy from the same
foundry.toml
config