-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add deploy workflow for contract deployment #79
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
Changes from 69 commits
df21e2e
8b91778
ff606eb
a1cb82d
c540155
824d927
297257d
3102541
1ca7bd3
f047102
ad7ef0f
c9187f6
cd1dbc8
ea8193a
bc09372
9031254
cc91ceb
bd4e41e
ea06d32
d7b404e
ccaf928
080654f
49b409b
9b53432
afae923
e9d744c
c6657c4
0b92545
cd8857a
00a24ba
75c42fd
80ad04e
7005fd5
c2ed408
2ef85a0
bdcbbe4
cd822bd
3d66d80
9bfde9c
7711369
dcc8d7c
5cec6af
339fa96
5b76764
c8a34e5
3d00c31
62a38a1
4b22c7a
3a28389
8b1ca4d
821f51a
91e5fb3
141d398
dabecd4
3fa80f8
0341d73
1159675
51674fc
87edcc3
af47bbf
577ebdf
6185f34
22c3759
cf1c822
3226728
7754ed6
3e84df9
25688b5
b059352
4756fe1
f76c4cd
d8e9ed5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| name: Deploy contracts | ||
|
|
||
| on: | ||
| workflow_dispatch: # Manual trigger | ||
| inputs: | ||
| network: | ||
| description: 'Network' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - anvil | ||
| - sepolia | ||
| - ethereum | ||
| - arbitrum_sepolia | ||
| - arbitrum | ||
| default: 'anvil' | ||
|
|
||
| jobs: | ||
|
|
||
| # Build and test before deploying. | ||
| build-and-test: | ||
| uses: ./.github/workflows/main.yml | ||
| with: | ||
| SEPOLIA_RPC_URL: ${{ vars.SEPOLIA_RPC_URL }} | ||
| ARBITRUM_SEPOLIA_RPC_URL: ${{ vars.ARBITRUM_SEPOLIA_RPC_URL }} | ||
| network: ${{ inputs.network }} | ||
|
|
||
| # Deploy and verify contract. | ||
| deploy: | ||
| needs: build-and-test | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| CI: true | ||
| permissions: | ||
| contents: write # Required to commit deployment files. | ||
| environment: ${{ inputs.network }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: stable | ||
| cache: true | ||
|
|
||
| - name: Deploy contracts on Anvil (All networks) | ||
| if: inputs.network == 'anvil' | ||
| env: | ||
| DEPLOYER_PRIVATE_KEY: ${{ vars.ANVIL_PRIVATE_KEY }} | ||
| SEPOLIA_RPC_URL: ${{ vars.SEPOLIA_RPC_URL }} | ||
| ARBITRUM_SEPOLIA_RPC_URL: ${{ vars.ARBITRUM_SEPOLIA_RPC_URL }} | ||
| ANVIL_SEPOLIA_RPC_URL: ${{ vars.ANVIL_SEPOLIA_RPC_URL }} | ||
| ANVIL_ARBITRUM_SEPOLIA_RPC_URL: ${{ vars.ANVIL_ARBITRUM_SEPOLIA_RPC_URL }} | ||
| run: | | ||
| make fork-sepolia & make fork-arbitrum-sepolia & sleep 10 && make deploy-on-anvil | ||
zguesmi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Deploy contracts on Sepolia/EthereumMainnet | ||
| if: inputs.network == 'sepolia' || inputs.network == 'ethereum' | ||
| env: | ||
| DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }} | ||
| CHAIN: ${{ inputs.network }} | ||
| RPC_URL: ${{ secrets.RPC_URL }} | ||
| run: | | ||
| make deploy-liquidity-unifier-and-bridge | ||
|
|
||
| - name: Deploy contracts on ChainX | ||
| if: inputs.network != 'sepolia' && inputs.network != 'ethereum' && inputs.network != 'anvil' | ||
| env: | ||
| DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }} | ||
| CHAIN: ${{ inputs.network }} | ||
| RPC_URL: ${{ secrets.RPC_URL }} | ||
| run: | | ||
| make deploy-crosschain-token-and-bridge | ||
|
|
||
| - name: Save deployment artifacts | ||
| if: inputs.network != 'anvil' | ||
| uses: stefanzweifel/git-auto-commit-action@v5 | ||
| with: | ||
| commit_message: 'chore: save deployment artifacts for ${{ inputs.network }} (${{ github.run_id }})' | ||
Le-Caignec marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| file_pattern: 'config/config.json broadcast/' | ||
| commit_user_name: 'GitHub Actions Bot' | ||
| commit_user_email: 'github-actions[bot]@users.noreply.github.com' | ||
| commit_author: 'GitHub Actions Bot <github-actions[bot]@users.noreply.github.com>' | ||
|
|
||
| - name: Verify contracts | ||
| if: inputs.network != 'anvil' | ||
| run: | | ||
| echo "TODO: Implement contract verification for ${{ inputs.network }}." | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,16 +66,25 @@ deploy-on-testnets: | |
| TARGET_CHAIN=arbitrum_sepolia TARGET_RPC=$(ARBITRUM_SEPOLIA_RPC_URL) \ | ||
| OPTIONS="--verify --verifier etherscan --verifier-api-key $(ETHERSCAN_API_KEY) --verifier-url $(ETHERSCAN_API_URL)" | ||
|
|
||
| deploy-liquidity-unifier-and-bridge: | ||
| $(MAKE) deploy-contract CONTRACT=RLCLiquidityUnifier CHAIN=$(CHAIN) RPC_URL=$(RPC_URL) OPTIONS="$(OPTIONS)" | ||
| $(MAKE) deploy-contract CONTRACT=bridges/layerZero/IexecLayerZeroBridge CHAIN=$(CHAIN) RPC_URL=$(RPC_URL) OPTIONS="$(OPTIONS)" | ||
|
|
||
| deploy-crosschain-token-and-bridge: | ||
| $(MAKE) deploy-contract CONTRACT=RLCCrosschainToken CHAIN=$(CHAIN) RPC_URL=$(RPC_URL) OPTIONS="$(OPTIONS)" | ||
| $(MAKE) deploy-contract CONTRACT=bridges/layerZero/IexecLayerZeroBridge CHAIN=$(CHAIN) RPC_URL=$(RPC_URL) OPTIONS="$(OPTIONS)" | ||
|
|
||
| deploy-all: # SOURCE_CHAIN, SOURCE_RPC, TARGET_CHAIN, TARGET_RPC, OPTIONS | ||
| $(MAKE) deploy-contract CONTRACT=RLCLiquidityUnifier CHAIN=$(SOURCE_CHAIN) RPC_URL=$(SOURCE_RPC) OPTIONS="$(OPTIONS)" | ||
| $(MAKE) deploy-contract CONTRACT=bridges/layerZero/IexecLayerZeroBridge CHAIN=$(SOURCE_CHAIN) RPC_URL=$(SOURCE_RPC) OPTIONS="$(OPTIONS)" | ||
| $(MAKE) deploy-contract CONTRACT=RLCCrosschainToken CHAIN=$(TARGET_CHAIN) RPC_URL=$(TARGET_RPC) OPTIONS="$(OPTIONS)" | ||
| $(MAKE) deploy-contract CONTRACT=bridges/layerZero/IexecLayerZeroBridge CHAIN=$(TARGET_CHAIN) RPC_URL=$(TARGET_RPC) OPTIONS="$(OPTIONS)" | ||
| $(MAKE) deploy-liquidity-unifier-and-bridge CHAIN=$(SOURCE_CHAIN) RPC_URL=$(SOURCE_RPC) OPTIONS=$(OPTIONS) | ||
| $(MAKE) deploy-crosschain-token-and-bridge CHAIN=$(TARGET_CHAIN) RPC_URL=$(TARGET_RPC) OPTIONS=$(OPTIONS) | ||
| @echo "Contracts deployment completed." | ||
| @echo "⚠️ Run 'make configure-all' to configure bridges." | ||
| @echo "⚠️ Please configure the bridges. Do not forget to authorize the RLCLiquidityUnifier and RLCCrosschainToken contracts on the bridges." | ||
|
|
||
| configure-all: # SOURCE_CHAIN, TARGET_CHAIN, SOURCE_RPC, TARGET_RPC | ||
| $(MAKE) configure-bridge SOURCE_CHAIN=$(SOURCE_CHAIN) TARGET_CHAIN=$(TARGET_CHAIN) RPC_URL=$(SOURCE_RPC) | ||
| $(MAKE) configure-bridge SOURCE_CHAIN=$(TARGET_CHAIN) TARGET_CHAIN=$(SOURCE_CHAIN) RPC_URL=$(TARGET_RPC) | ||
|
Comment on lines
85
to
86
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it's true, between those commande we should change the wallet. Makefile commande is not adapted to our Yes, that’s true — we should switch wallets between those commands. The Makefile command wasn’t suited to our workflow. I’ve fixed it, but it’s not within the scope of this PR.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand sorry! What's not in the scope?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. responded on slack |
||
| @echo "Deployment completed." | ||
| @echo "⚠️ Please authorize bridges on RLCLiquidityUnifier and RLCCrosschainToken contracts." | ||
| # TODO verify contracts after deployment. | ||
| @echo "Bridge configuration completed." | ||
|
|
||
| # | ||
| # High-level upgrade targets | ||
|
|
@@ -111,7 +120,7 @@ deploy-contract: # CONTRACT, CHAIN, RPC_URL, OPTIONS | |
| @echo "Deploying $(CONTRACT) on $(CHAIN) with options: $(OPTIONS)" | ||
| CHAIN=$(CHAIN) forge script script/$(CONTRACT).s.sol:Deploy \ | ||
| --rpc-url $(RPC_URL) \ | ||
| --account $(ACCOUNT) \ | ||
| $$(if [ "$(CI)" = "true" ]; then echo "--private-key $(DEPLOYER_PRIVATE_KEY)"; else echo "--account $(ACCOUNT)"; fi) \ | ||
| $(OPTIONS) \ | ||
| --broadcast \ | ||
| -vvv | ||
|
|
||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.