-
Notifications
You must be signed in to change notification settings - Fork 10
feat(sharing): Deploy DPS contract using Github action #443
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
7fe87f8
Disable temporarily
zguesmi 1c5c65e
Add action to deploy sharing contract
zguesmi 9246b87
Use a random salt
zguesmi ffca818
Update readme
zguesmi 763f876
Verify contracts
zguesmi 47dcd99
Deploy using actions
zguesmi 0c430d0
Clean
zguesmi 237aa32
Fix CI
zguesmi 0839d20
Install foundry
zguesmi 5f41095
Provide poco and dataset registry addresses to deployment script
zguesmi 51a69cc
chore: save deployment artifacts for arbitrumSepolia (testnets, 15050…
github-actions[bot] efb8932
Fix CI
zguesmi c92d3ab
Fix CI
zguesmi 05da051
chore: save deployment artifacts for arbitrumSepolia (testnets, 15051…
github-actions[bot] e88a8cb
Deploy on Arbitrum with random salt
zguesmi aec63e3
Uncomment workflow and redeploy
zguesmi 35b77ba
Fix reusable action
zguesmi 31fce84
Debug
zguesmi b483668
chore: save deployment artifacts for arbitrumSepolia (testnets, 15069…
github-actions[bot] df8aba7
Debug
zguesmi b72632f
Rename api key env variable
zguesmi 1af9e02
Remove draft deployment
zguesmi e3c8950
Uncomment ci steps
zguesmi 479974d
Clean
zguesmi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| name: Sharing Smart Contract - Deployment | ||
|
|
||
| on: | ||
| workflow_dispatch: # Manual trigger | ||
| inputs: | ||
| network: | ||
| description: 'Network' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - hardhat | ||
| - avalancheFujiTestnet | ||
| - arbitrumSepolia | ||
| - bellecour | ||
| default: 'hardhat' | ||
| environment: | ||
| description: 'Environment' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - testnets | ||
| - mainnets | ||
| default: 'testnets' | ||
|
|
||
| jobs: | ||
|
|
||
| # Validate deployment network and environment. | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Validate mainnet deployment conditions | ||
| # Use `mainnets` environment (wallet) only for mainnet deployments | ||
| # and only from the main branch. | ||
| # TODO update this when we have other mainnets | ||
| run: | | ||
| if [[ \ | ||
| "${{ inputs.environment }}" == "mainnets" && \ | ||
| !("${{ inputs.network }}" == "bellecour" && "${{ github.ref }}" == "refs/heads/main") \ | ||
| ]]; then | ||
| echo "::error::Bellecour mainnet deployments must be made from the main branch. Current branch: ${GITHUB_REF#refs/heads/}" | ||
| exit 1 | ||
| fi | ||
| echo "Deployment validated!" | ||
|
|
||
| # Build and test before deploying. | ||
| ci: | ||
| needs: validate | ||
| uses: ./.github/workflows/sharing-smart-contracts-reusable.yml | ||
| with: | ||
| node-version: 18 | ||
|
|
||
| # Run deployment steps. | ||
| deploy: | ||
| needs: ci | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # Required for saving deployment | ||
| environment: ${{ inputs.environment }} | ||
| steps: | ||
| - name: Say Hello | ||
| run: echo "Hello from env - ${{ inputs.environment }}" | ||
|
|
||
| # - uses: actions/checkout@v4 | ||
| # with: | ||
| # fetch-depth: 0 | ||
|
|
||
| # - uses: actions/setup-node@v4 | ||
| # with: | ||
| # node-version: 18 | ||
| # cache: 'npm' # Cache dependencies | ||
|
|
||
| # - name: Install dependencies | ||
| # run: npm ci | ||
|
|
||
| # - name: Set environment variables | ||
| # id: set-env | ||
| # run: | | ||
| # echo "PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}" >> $GITHUB_ENV | ||
| # if [ "${{ inputs.network }}" == "avalancheFujiTestnet" ]; then | ||
| # echo "FUJI_RPC_URL=${{ secrets.FUJI_RPC_URL }}" >> $GITHUB_ENV | ||
| # echo "SNOWTRACE_API_KEY=${{ secrets.SNOWTRACE_API_KEY }}" >> $GITHUB_ENV | ||
| # fi | ||
|
|
||
| # if [ "${{ inputs.network }}" == "arbitrumSepolia" ]; then | ||
| # echo "ARBITRUM_SEPOLIA_RPC_URL=${{ secrets.ARBITRUM_SEPOLIA_RPC_URL }}" >> $GITHUB_ENV | ||
| # echo "ARBISCAN_API_KEY=${{ secrets.ARBISCAN_API_KEY }}" >> $GITHUB_ENV | ||
| # fi | ||
|
|
||
| # if [ "${{ inputs.network }}" == "bellecour" ]; then | ||
| # echo "BELLECOUR_RPC_URL=${{ secrets.BELLECOUR_RPC_URL }}" >> $GITHUB_ENV | ||
| # fi | ||
|
|
||
| # - name: Deploy contracts | ||
| # run: | | ||
| # echo "Deploying to: ${{ inputs.network }} with ${{ inputs.environment }} environment" | ||
| # npm run deploy -- --network ${{ inputs.network }} | ||
|
|
||
| # - name: Update config.json with ERC1538Proxy address | ||
| # if: inputs.network != 'hardhat' | ||
| # run: npx hardhat run scripts/tools/update-config.ts --network ${{ inputs.network }} | ||
|
|
||
| # - name: Save deployment artifacts and updated config | ||
| # if: inputs.network != 'hardhat' | ||
| # uses: stefanzweifel/git-auto-commit-action@v5 | ||
| # with: | ||
| # commit_message: 'chore: save deployment artifacts for ${{ inputs.network }} (${{ inputs.environment }}, ${{ github.run_id }})' | ||
| # file_pattern: 'deployments/${{ inputs.network }}/* config/config.json' | ||
| # 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>' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,61 +54,61 @@ jobs: | |
| working-directory: packages/sharing-smart-contract | ||
| run: npm run uml | ||
|
|
||
| - name: Static Analyzer | ||
| uses: crytic/[email protected] | ||
| id: slither | ||
| with: | ||
| sarif: result.sarif | ||
| fail-on: none | ||
| target: 'packages/sharing-smart-contract/' | ||
|
|
||
| - name: Start Anvil | ||
| run: | | ||
| anvil --host 0.0.0.0 --port 8545 --hardfork berlin --fork-url https://bellecour.iex.ec --chain-id 134 --gas-limit 6700000 --gas-price 0 & | ||
|
|
||
| - name: Wait for Anvil to start | ||
| run: | | ||
| timeout=30 | ||
| interval=1 | ||
| echo "Waiting for Anvil to start..." | ||
| for ((i=0; i<timeout; i++)); do | ||
| if nc -z localhost 8545; then | ||
| echo "Anvil is operational." | ||
| exit 0 | ||
| fi | ||
| echo "Attempt $((i+1)) of $timeout: Anvil is not ready, waiting ${interval}s..." | ||
| sleep $interval | ||
| done | ||
| echo "Error: Anvil did not start within the timeout period." | ||
| exit 1 | ||
|
|
||
| - name: Upgrade test | ||
| working-directory: packages/sharing-smart-contract | ||
| run: npm run upgrade-local-fork -- --network local-bellecour-fork | ||
|
|
||
| # TODO check why the CI does not fail when the following error occurs | ||
| # (when the RPC node is not available): | ||
| # 1) Uncaught error outside test suite | ||
| - name: Hardhat tests | ||
| working-directory: packages/sharing-smart-contract | ||
| run: npm run test -- --network local-bellecour-fork | ||
|
|
||
| - name: Test deployment script | ||
| working-directory: packages/sharing-smart-contract | ||
| run: | | ||
| POCO_ADDRESS=0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f \ | ||
| DATASET_REGISTRY_ADDRESS=0x799DAa22654128d0C64d5b79eac9283008158730 \ | ||
| npm run deploy -- --network local-bellecour-fork | ||
|
|
||
| - name: Set Directory Permissions | ||
| working-directory: packages/sharing-smart-contract | ||
| run: sudo chmod -R 777 . | ||
|
|
||
| - name: Forge Tests | ||
| working-directory: packages/sharing-smart-contract | ||
| run: forge test --no-match-test "invariant" -vvvv | ||
|
|
||
| - name: Upload SARIF file | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| with: | ||
| sarif_file: ${{ steps.slither.outputs.sarif }} | ||
| # - name: Static Analyzer | ||
| # uses: crytic/[email protected] | ||
| # id: slither | ||
| # with: | ||
| # sarif: result.sarif | ||
| # fail-on: none | ||
| # target: 'packages/sharing-smart-contract/' | ||
|
|
||
| # - name: Start Anvil | ||
| # run: | | ||
| # anvil --host 0.0.0.0 --port 8545 --hardfork berlin --fork-url https://bellecour.iex.ec --chain-id 134 --gas-limit 6700000 --gas-price 0 & | ||
|
|
||
| # - name: Wait for Anvil to start | ||
| # run: | | ||
| # timeout=30 | ||
| # interval=1 | ||
| # echo "Waiting for Anvil to start..." | ||
| # for ((i=0; i<timeout; i++)); do | ||
| # if nc -z localhost 8545; then | ||
| # echo "Anvil is operational." | ||
| # exit 0 | ||
| # fi | ||
| # echo "Attempt $((i+1)) of $timeout: Anvil is not ready, waiting ${interval}s..." | ||
| # sleep $interval | ||
| # done | ||
| # echo "Error: Anvil did not start within the timeout period." | ||
| # exit 1 | ||
|
|
||
| # - name: Upgrade test | ||
| # working-directory: packages/sharing-smart-contract | ||
| # run: npm run upgrade-local-fork -- --network local-bellecour-fork | ||
|
|
||
| # # TODO check why the CI does not fail when the following error occurs | ||
| # # (when the RPC node is not available): | ||
| # # 1) Uncaught error outside test suite | ||
| # - name: Hardhat tests | ||
| # working-directory: packages/sharing-smart-contract | ||
| # run: npm run test -- --network local-bellecour-fork | ||
|
|
||
| # - name: Test deployment script | ||
| # working-directory: packages/sharing-smart-contract | ||
| # run: | | ||
| # POCO_ADDRESS=0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f \ | ||
| # DATASET_REGISTRY_ADDRESS=0x799DAa22654128d0C64d5b79eac9283008158730 \ | ||
| # npm run deploy -- --network local-bellecour-fork | ||
|
|
||
| # - name: Set Directory Permissions | ||
| # working-directory: packages/sharing-smart-contract | ||
| # run: sudo chmod -R 777 . | ||
|
|
||
| # - name: Forge Tests | ||
| # working-directory: packages/sharing-smart-contract | ||
| # run: forge test --no-match-test "invariant" -vvvv | ||
|
|
||
| # - name: Upload SARIF file | ||
| # uses: github/codeql-action/upload-sarif@v3 | ||
| # with: | ||
| # sarif_file: ${{ steps.slither.outputs.sarif }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -109,7 +109,7 @@ module.exports = { | |||||
| ignition: { | ||||||
| strategyConfig: { | ||||||
| create2: { | ||||||
| salt: "0x0000000000000000000000000000000000000000000000000000000000000000", | ||||||
| salt: "0x5FD8F2C3DFCF36E174AC91A44AE6CAEBDDA012EFED601736E2C20A11A56CF532", | ||||||
|
||||||
| salt: "0x5FD8F2C3DFCF36E174AC91A44AE6CAEBDDA012EFED601736E2C20A11A56CF532", | |
| salt: "0x0000000000000000000000000000000000000000000000000000000000000000", |
Member
Author
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 do it in the next PR.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.