-
Notifications
You must be signed in to change notification settings - Fork 68
feat: Added foundry deploy script #1044
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
base: master
Are you sure you want to change the base?
Conversation
64e7247
to
7ebdaf8
Compare
|
||
## Mainnet (Chain ID: 1) | ||
|
||
### DeployPermissionSplitterProxy.s.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.
Are these just examples or does this .md
file also get auto updated?
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.
This file also gets auto updated (which is a bit easier to read than the json file)
from pathlib import Path | ||
|
||
|
||
def find_broadcast_files(broadcast_dir: Path) -> list: |
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.
Can this script run well in the github CI? I think that'd be an ideal end result of this script. Also I know you're probably more familiar with python but does this script require other dependencies? I am wary of adding more dependencies especially since we already have typescript set up..but its not a big deal. This file so far isn't part of the CI/hot path so its fine
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.
changed it to a ts script instead
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 this is a great start.
@@ -0,0 +1,223 @@ | |||
#!/usr/bin/env python3 |
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.
Why python?
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.
changed it to ts
script/DeployConstants.sol
Outdated
|
||
/** | ||
* @title DeployConstants | ||
* @notice Contains constants used in deployment scripts, converted from consts.ts |
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.
Could we read this in via one or more json configuration files? Two advantages:
- Config/code split so it's clear (in the future) which changes are configuration and which changes are logical.
- More flexibility: it will allow us to pull in this info from somewhere else easily. For instance, the json could be generated/updated from an API OR we could import one or more of the config jsons from a common package (like our constants package or something).
Thoughts?
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.
Mainly because dealing with json inside a foundry script is not trivial, I also have deployed-addresses.json
that is generated regarding your second point
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.
Don't they have utilities for that that makes it fairly trivial if the json is well structured? I may be missing some additional complexity (I haven't tried to use these utils before)
https://getfoundry.sh/reference/cheatcodes/parse-json/?highlight=json
https://getfoundry.sh/reference/cheatcodes/parse-json-keys
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.
updated to using perse-json, much cleaner now :)
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.
Thoughts on expanding this, s.t. the Constants.sol values are read in from json as well?
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.
Constants are currently in a ts file, but I can create a json for constants that Constants.sol uses
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
72e2502
to
84ccd43
Compare
script/Constants.sol
Outdated
WETH9Interface constant WETH_SCROLL = WETH9Interface(0x5300000000000000000000000000000000000004); | ||
WETH9Interface constant WETH_UNICHAIN = WETH9Interface(0x4200000000000000000000000000000000000006); | ||
WETH9Interface constant WETH_UNICHAIN_SEPOLIA = WETH9Interface(0x4200000000000000000000000000000000000006); | ||
WETH9Interface constant WETH_ALEPH_ZERO = WETH9Interface(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // Assuming bridged WETH |
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.
This also looks wrong. Maybe we should name this wrapped native token so that it aligns with the var names in the spoke pool constructors (same thing with getWethAddress()
below).
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 catch, updated and renamed to WRAPPED_NATIVE_TOKEN_{CHAINNAME}
script/Constants.sol
Outdated
WETH9Interface constant WETH_OPTIMISM_SEPOLIA = WETH9Interface(0x4200000000000000000000000000000000000006); | ||
WETH9Interface constant WETH_BASE = WETH9Interface(0x4200000000000000000000000000000000000006); | ||
WETH9Interface constant WETH_BASE_SEPOLIA = WETH9Interface(0x4200000000000000000000000000000000000006); | ||
WETH9Interface constant WETH_LENS = WETH9Interface(0x4200000000000000000000000000000000000006); |
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.
WETH9Interface constant WETH_LENS = WETH9Interface(0x4200000000000000000000000000000000000006); | |
WETH9Interface constant WETH_LENS = WETH9Interface(0xE5ecd226b3032910CEaa43ba92EE8232f8237553); |
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.
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
1a9787a
to
6b82900
Compare
Signed-off-by: Faisal Usmani <[email protected]>
Signed-off-by: Faisal Usmani <[email protected]>
300516f
to
6aec3c4
Compare
First attempt at deploy script migration to foundry. Just did one deploy script and looking for feedback.
List of changes:
DeployHubPool.s.sol
andscript/DeployEthereumSpokePool.s.sol
insidescript
folderDeployConstants.sol
insidescript
folder that works similar todeploy/consts.ts
by providing third party smart contract addressesDeploymentUtils.sol
insidescript
that works similar toutils/utils.hre.ts
forge script script/DeployHubPool.s.sol:DeployHubPool --rpc-url $RPC_URL --broadcast --verify -vvvv
which deploys and verifies the contract and adds the deploy info in thebroadcast
folderscript/extract_foundry_addresses.sh
that extracts all the deployed addresses from thebroadcast
folder and puts it in a json, an md file and a sol file (similar todeployments.json
)Looking for feedback on the proposed flow and how I can make this better and address some of the short comings of the current deployment flow
Fixes https://linear.app/uma/issue/UMA-2906/contracts-migrate-smart-contract-deploy-to-foundry