-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add DeploymentConfig
for network specifc deployments
#5
Conversation
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 in general, couple queries
4deccd1
to
5eb149d
Compare
To allow deployment to different chains but using the same deployment scripts, this commit introduces a basic `DeploymentConfig` which can be extended as necessary in each project. There's a few things that should be considered: - `activeNetworkConfig` will be initialized via the constructor, at which point it is know what `block.chainid` is - To add new configuration settings, extend `NetworkConfig` - To add a new config for a different chain, extend the `if/else` block in the constructor so that it creates a `NetworkConfig` for the chain in question
5eb149d
to
d6bbd46
Compare
@rymnc take another look :D |
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
|
||
contract Deploy is BaseScript { | ||
function run() public broadcast returns (Foo foo) { | ||
function run() public returns (Foo foo, DeploymentConfig deploymentConfig) { |
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.
nice, last question - what does the broadcast keyword specify?
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.
broadcast
is a modifier that wraps the function in vm.startBroadcast()
and vm.stopBroadcast()
.
Anything that happens inside these are tx that are broadcast to the network.
We don't want the instantiation of DeploymentConfig()
to happen onchain, we only need it to access our configuration values.
That's why I'm removing the broadcast
from the main deploy script's run()
function. This gives us control over which action should indeed be broadcast.
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.
nice, okay!
Description
To allow deployment to different chains but using the same deployment scripts, this commit introduces a basic
DeploymentConfig
which can be extended as necessary in each project.There's a few things that should be considered:
activeNetworkConfig
will be initialized via the constructor, at which point it is know whatblock.chainid
isNetworkConfig
if/else
block in the constructor so that it creates aNetworkConfig
for the chain in questionChecklist
Ensure you completed all of the steps below before submitting your pull request:
forge snapshot
?pnpm lint
?forge test
?