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

Powerful command line options for deployment script #752

Merged
merged 4 commits into from
Jan 15, 2024

Conversation

smol-ninja
Copy link
Member

@smol-ninja smol-ninja commented Dec 17, 2023

Resolves #751

Usage

~ ./shell/deploy-multi-chain.sh --help

Usage: ./shell/deploy-multi-chain.sh [-h] [--help] [--print] [-i] [--interactive] [-s] [--script]
                                     [--broadcast] [--deterministic] [--with-gas-price] [--all]
                                     [[chain1 chain2 ...]]
Examples:
    ./shell/deploy-multi-chain.sh # By default, deploys only to Sepolia
    ./shell/deploy-multi-chain.sh --broadcast optimism mainnet
    ./shell/deploy-multi-chain.sh --broadcast --deterministic mainnet

Supported networks:
Network              Chain ID
-----------          -----------
arbitrum             42161
arbitrum_sepolia     421614
avalanche            43114
base                 8453
bnb_smart_chain      56
gnosis               100
mainnet              1
optimism             10
polygon              137
scroll               534352
sepolia              11155111

Description

Note: Enters interactive mode if .env.deployment not found

Command line options Description
--all Deploy on all chains
--broadcast Broadcast the deployment and verify on Etherscan.
--deterministic Deploy using the deterministic script.
-h, --help Show available command-line options and exit.
-i, --interactive Enters interactive mode and ignore .env.deployment.
--print Simulate and show the deployment command.
-s, --script Script to run from /script folder.
--with-gas-price Specify gas price for transaction.

@smol-ninja smol-ninja requested a review from PaulRBerg December 17, 2023 22:21
@smol-ninja smol-ninja force-pushed the build/generate-deployment-command branch from 690f1c0 to b601577 Compare December 17, 2023 22:30
@smol-ninja smol-ninja force-pushed the build/generate-deployment-command branch from b601577 to 98a74dd Compare December 18, 2023 17:31
@PaulRBerg PaulRBerg force-pushed the build/multi-chain-script branch from 79aa953 to 5b2eb75 Compare December 19, 2023 12:55
@smol-ninja smol-ninja force-pushed the build/generate-deployment-command branch from 98a74dd to d2472aa Compare December 19, 2023 14:19
andreivladbrg

This comment was marked as resolved.

@andreivladbrg andreivladbrg force-pushed the build/multi-chain-script branch from 8827002 to 0b6d4ee Compare December 22, 2023 14:56
@smol-ninja smol-ninja force-pushed the build/generate-deployment-command branch from d2472aa to 29c2f85 Compare December 22, 2023 15:11
@smol-ninja smol-ninja changed the title Add script to generate deployment command New command line options for deployment script Dec 24, 2023
@smol-ninja
Copy link
Member Author

I see that there multiple similarities between deploy-multi-chain and generate-deployment-command, do you think it would be possible to call the generate-deployment-command inside deploy-multi-chain so that we will not repeat so much?
I know that calling other bash scripts is possible but I am not sure how to handle the input arguments

if --print argument is passed

~ ./shell/deploy-multi-chain.sh --print avalanche

Compiling the contracts...

Deployment on avalanche started...
+ Simulating on forked network
+ Printing command without action

forge script script/DeployCore3.s.sol --rpc-url https://avalanche-mainnet.infura.io/v3/68967a55fb91488684a9c1000f321d7f --sig 'run(address,address,uint256)' 0x6666cA940D2f4B65883b454b7Bc7EEB039f64fa3 0x66F5431B0765D984f82A4fc4551b2c9ccF7eAC9C 300 -vvv

End of it

without --print

~ ./shell/deploy-multi-chain.sh avalanche

Compiling the contracts...

Deployment on avalanche started...
+ Simulating on forked network
No files changed, compilation skipped
Script ran successfully.

== Return ==
nftDescriptor: contract SablierV2NFTDescriptor 0xaC7A8d8e1131432393009a16eF0965A66C64E570
lockupDynamic: contract SablierV2LockupDynamic 0xCB13Ac0e8DF85ceE89DcdBF3F30547497722F27E
lockupLinear: contract SablierV2LockupLinear 0x604b3daacBa6a53eF61afeAeC5fC289E7E1C0764

@smol-ninja
Copy link
Member Author

@andreivladbrg I think this is quite a powerful and flexible script we have developed here. Let me know if you have new suggestions.

@smol-ninja smol-ninja changed the title New command line options for deployment script Powerful command line options for deployment script Dec 24, 2023
@PaulRBerg
Copy link
Member

I've reviewed the script, and I'm impressed - great work @smol-ninja.

I've only given it a cursory review, but it generally looks good to me. We can test it some more when we get to deploy V2.2

Side note: as suggested here, it might be worthwhile to turn this script into an internal Rust-based CLI utility. It has become complex enough for a Bash script.

Copy link
Member

@PaulRBerg PaulRBerg left a comment

Choose a reason for hiding this comment

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

lgtm

@PaulRBerg PaulRBerg merged commit aed1c8c into build/multi-chain-script Jan 15, 2024
2 checks passed
@PaulRBerg PaulRBerg deleted the build/generate-deployment-command branch January 15, 2024 17:27
andreivladbrg added a commit that referenced this pull request Jan 16, 2024
* build: add deploy multi chains script

build: remove etherscan api keys in foundry.toml
feat: add deploy core 3 scripts
chore: improve .env.example file

* build: add arbitrum sepolia

chore: git ignore deployments dir

* chore: update wording in scripts

chore: remove forge fmt comment

* refactor: separate base env from deployment env

chore: improve multi-chain deployment script
refactor: rename env var MAX_SEGMENT_COUNT

* refactor: rename multi-chain script

* chore: fix arbitrum config key

* fix: use array to create deployment command

* chore: create an array for deployment command

* Powerful command line options for deployment script (#752)

* build: add script to generate deployment command

* feat: new command-line options for deploy-multi-chain command

* chore: continue for warnings and throw for errors

* perf: polish deployment script

---------

Co-authored-by: Paul Razvan Berg <[email protected]>

* refactor: hard code admin addresses

---------

Co-authored-by: andreivladbrg <[email protected]>
Co-authored-by: smol-ninja <[email protected]>
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.

3 participants