diff --git a/.github/workflows/build-boba.yml b/.github/workflows/build-boba.yml new file mode 100644 index 0000000000..b147e2ef20 --- /dev/null +++ b/.github/workflows/build-boba.yml @@ -0,0 +1,57 @@ +name: Publish Containers + +on: + push: + branches: + - 'inomurko/v3.14.5' + +jobs: + + build-publish-win: + name: Create containers + runs-on: ubuntu-latest + steps: + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }} + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }} + + - uses: actions/checkout@v2 + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Get services + working-directory: ./boba_ops + run: git submodule sync --recursive && git submodule update --recursive --init + + - name: Build the services + working-directory: ./boba_ops + run: docker compose build + + - name: Tag + working-directory: ./boba_ops + run: | + docker images + for i in $(docker images --format "{{.Repository}}:{{.Tag}}" | grep bobanetwork); do + docker image tag "$i" bobanetwork/$(echo $i | awk -F'/' '{print $2}' | awk -F':' '{print $1}'):latest + done + docker images + + - name: Push + working-directory: ./boba_ops + run: | + for i in $(docker images --format "{{.Repository}}:{{.Tag}}" | grep bobanetwork); do + echo "$1" + docker push "$i" + done diff --git a/.github/workflows/deploy-arbitrum.yml b/.github/workflows/deploy-arbitrum.yml index 7dd0e8dee2..3876e808eb 100644 --- a/.github/workflows/deploy-arbitrum.yml +++ b/.github/workflows/deploy-arbitrum.yml @@ -66,7 +66,6 @@ jobs: yarn install --cache-folder ./.yarncache --frozen-lockfile rm -rf .yarncache yarn cache clean - # Set production flag - name: Set production flag for release PR or tagged build run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV diff --git a/.github/workflows/deploy-bsc.yml b/.github/workflows/deploy-bsc.yml deleted file mode 100644 index 55fb904ffb..0000000000 --- a/.github/workflows/deploy-bsc.yml +++ /dev/null @@ -1,148 +0,0 @@ -name: Deploy to Binance smart chain - -# Run on pushes to main or PRs to main -on: - push: - branches: - - main - pull_request: - branches: - - main - # Launches build when release is published - release: - types: [published] - -env: - REPO_NAME_ALPHANUMERIC: safereact - REACT_APP_NETWORK: 'bsc' - STAGING_BUCKET_NAME: ${{ secrets.STAGING_BSC_BUCKET_NAME }} - REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN_BSC }} - REACT_APP_GOOGLE_ANALYTICS: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID_BSC }} - REACT_APP_GNOSIS_APPS_URL: ${{ secrets.REACT_APP_GNOSIS_APPS_URL_PROD }} - -jobs: - debug: - name: Debug - runs-on: ubuntu-latest - steps: - - name: Dump env - run: env | sort - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - deploy: - name: Deployment - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - name: Remove broken apt repos [Ubuntu] - if: ${{ matrix.os }} == 'ubuntu-latest' - run: | - for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - - uses: actions/checkout@v2 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 14 - - - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - - run: | - sudo apt-get update - sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user - # Due to some dependencies yarn may randomly throw an error about invalid cache - # This approach is taken from https://github.com/yarnpkg/yarn/issues/7212#issuecomment-506155894 to fix the issue - # Another approach is to install with flag --network-concurrency 1, but this will make the installation pretty slow (default value is 8) - mkdir .yarncache - yarn install --cache-folder ./.yarncache --frozen-lockfile - rm -rf .yarncache - yarn cache clean - - # Set production flag - - name: Set production flag for release PR or tagged build - run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/tags/v') || github.base_ref == 'main' - - - name: Build ${{ env.REACT_APP_NETWORK }} app - run: yarn build - env: - PUBLIC_URL: './' - REACT_APP_FORTMATIC_KEY: ${{ secrets.REACT_APP_FORTMATIC_KEY }} - REACT_APP_INFURA_TOKEN: ${{ secrets.REACT_APP_INFURA_TOKEN }} - REACT_APP_PORTIS_ID: ${{ secrets.REACT_APP_PORTIS_ID }} - REACT_APP_INTERCOM_ID: ${{ secrets.REACT_APP_INTERCOM_ID }} - REACT_APP_IPFS_GATEWAY: ${{ secrets.REACT_APP_IPFS_GATEWAY }} - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - - # Script to deploy Pull Requests - - run: bash ./scripts/github/deploy_pull_request.sh - if: success() && github.event.number - env: - PR_NUMBER: ${{ github.event.number }} - REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - - - name: 'PRaul: Comment PR with app URLs' - uses: mshick/add-pr-comment@v1 - with: - message: | - * [Safe Multisig app ${{ env.REACT_APP_NETWORK }}](${{ env.REVIEW_FEATURE_URL }}/${{ env.REACT_APP_NETWORK }}/app/) - repo-token: ${{ secrets.GITHUB_TOKEN }} - repo-token-user-login: 'github-actions[bot]' - if: success() && github.event.number - env: - REVIEW_FEATURE_URL: https://pr${{ github.event.number }}--${{ env.REPO_NAME_ALPHANUMERIC }}.review.gnosisdev.com - - # Script to deploy to development environment - # xDai build is never created in development branch - - # Script to deploy to staging environment - - name: 'Deploy to S3: Staging' - if: github.ref == 'refs/heads/main' - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/current/app --delete - - # Script to upload release files - - name: 'Upload release build files for production' - if: startsWith(github.ref, 'refs/tags/v') - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }} --delete - # - run: bash ./scripts/github/deploy_release.sh - # if: startsWith(github.ref, 'refs/tags/v') - # env: - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # PR_NUMBER: ${{ github.event.number }} - # REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - # REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - # VERSION_TAG: ${{ github.event.release.tag_name }} - - # Script to prepare production deployments - - run: bash ./scripts/github/prepare_production_deployment.sh - if: success() && startsWith(github.ref, 'refs/tags/v') - env: - PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} - PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} - VERSION_TAG: ${{ github.event.release.tag_name }} - - # Upload Sentry source maps when sending to staging or production - - run: yarn sentry-upload-sourcemaps - if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG}} - SENTRY_PROJECT: gnosis-safe-multisig-${{ env.REACT_APP_NETWORK }} diff --git a/.github/workflows/deploy-ewc.yml b/.github/workflows/deploy-ewc.yml deleted file mode 100644 index e9c77ede8a..0000000000 --- a/.github/workflows/deploy-ewc.yml +++ /dev/null @@ -1,148 +0,0 @@ -name: Deploy to EWC network - -# Run on pushes to main or PRs to main -on: - push: - branches: - - main - pull_request: - branches: - - main - # Launches build when release is published - release: - types: [published] - -env: - REPO_NAME_ALPHANUMERIC: safereact - REACT_APP_NETWORK: 'energy_web_chain' - STAGING_BUCKET_NAME: ${{ secrets.STAGING_EWC_BUCKET_NAME }} - REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN_EWC }} - REACT_APP_GOOGLE_ANALYTICS: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID_EWC }} - REACT_APP_GNOSIS_APPS_URL: ${{ secrets.REACT_APP_GNOSIS_APPS_URL_PROD }} - -jobs: - debug: - name: Debug - runs-on: ubuntu-latest - steps: - - name: Dump env - run: env | sort - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - deploy: - name: Deployment - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - name: Remove broken apt repos [Ubuntu] - if: ${{ matrix.os }} == 'ubuntu-latest' - run: | - for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - - uses: actions/checkout@v2 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 14 - - - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - - run: | - sudo apt-get update - sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user - # Due to some dependencies yarn may randomly throw an error about invalid cache - # This approach is taken from https://github.com/yarnpkg/yarn/issues/7212#issuecomment-506155894 to fix the issue - # Another approach is to install with flag --network-concurrency 1, but this will make the installation pretty slow (default value is 8) - mkdir .yarncache - yarn install --cache-folder ./.yarncache --frozen-lockfile - rm -rf .yarncache - yarn cache clean - - # Set production flag - - name: Set production flag for release PR or tagged build - run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/tags/v') || github.base_ref == 'main' - - - name: Build ${{ env.REACT_APP_NETWORK }} app - run: yarn build - env: - PUBLIC_URL: './' - REACT_APP_FORTMATIC_KEY: ${{ secrets.REACT_APP_FORTMATIC_KEY }} - REACT_APP_INFURA_TOKEN: ${{ secrets.REACT_APP_INFURA_TOKEN }} - REACT_APP_PORTIS_ID: ${{ secrets.REACT_APP_PORTIS_ID }} - REACT_APP_INTERCOM_ID: ${{ secrets.REACT_APP_INTERCOM_ID }} - REACT_APP_IPFS_GATEWAY: ${{ secrets.REACT_APP_IPFS_GATEWAY }} - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - - # Script to deploy Pull Requests - - run: bash ./scripts/github/deploy_pull_request.sh - if: success() && github.event.number - env: - PR_NUMBER: ${{ github.event.number }} - REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - - - name: 'PRaul: Comment PR with app URLs' - uses: mshick/add-pr-comment@v1 - with: - message: | - * [Safe Multisig app ${{ env.REACT_APP_NETWORK }}](${{ env.REVIEW_FEATURE_URL }}/${{ env.REACT_APP_NETWORK }}/app/) - repo-token: ${{ secrets.GITHUB_TOKEN }} - repo-token-user-login: 'github-actions[bot]' - if: success() && github.event.number - env: - REVIEW_FEATURE_URL: https://pr${{ github.event.number }}--${{ env.REPO_NAME_ALPHANUMERIC }}.review.gnosisdev.com - - # Script to deploy to the dev environment - # EWC build is never created on the dev branch - - # Script to deploy to staging environment - - name: 'Deploy to S3: Staging' - if: github.ref == 'refs/heads/main' - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/current/app --delete - - # Script to upload release files - - name: 'Upload release build files for production' - if: startsWith(github.ref, 'refs/tags/v') - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }} --delete - # - run: bash ./scripts/github/deploy_release.sh - # if: startsWith(github.ref, 'refs/tags/v') - # env: - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # PR_NUMBER: ${{ github.event.number }} - # REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - # REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - # VERSION_TAG: ${{ github.event.release.tag_name }} - - # Script to prepare production deployments - - run: bash ./scripts/github/prepare_production_deployment.sh - if: success() && startsWith(github.ref, 'refs/tags/v') - env: - PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} - PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} - VERSION_TAG: ${{ github.event.release.tag_name }} - - # Upload Sentry source maps when sending to staging or production - - run: yarn sentry-upload-sourcemaps - if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG}} - SENTRY_PROJECT: gnosis-safe-multisig-${{ env.REACT_APP_NETWORK }} diff --git a/.github/workflows/deploy-mainnet.yml b/.github/workflows/deploy-mainnet.yml deleted file mode 100644 index 54b192f95b..0000000000 --- a/.github/workflows/deploy-mainnet.yml +++ /dev/null @@ -1,152 +0,0 @@ -name: Deploy to Mainnet network - -# Run on pushes to main or PRs -on: - # Pull request hook without any config. Launches for every pull request - pull_request: - push: - branches: - - main - # Launches build when release is published - release: - types: [published] - -env: - REPO_NAME_ALPHANUMERIC: safereact - REACT_APP_NETWORK: 'mainnet' - STAGING_BUCKET_NAME: ${{ secrets.STAGING_MAINNET_BUCKET_NAME }} - REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN_MAINNET }} - REACT_APP_GOOGLE_ANALYTICS: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID_MAINNET }} - REACT_APP_GNOSIS_APPS_URL: ${{ secrets.REACT_APP_GNOSIS_APPS_URL_PROD }} - REACT_APP_ETHERSCAN_API_KEY: ${{ secrets.REACT_APP_ETHERSCAN_API_KEY }} - REACT_APP_ETHGASSTATION_API_KEY: ${{ secrets.REACT_APP_ETHGASSTATION_API_KEY }} - -jobs: - debug: - name: Debug - runs-on: ubuntu-latest - steps: - - name: Dump env - run: env | sort - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - deploy: - name: Deployment - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - name: Remove broken apt repos [Ubuntu] - if: ${{ matrix.os }} == 'ubuntu-latest' - run: | - for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 14 - - - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - - run: | - sudo apt-get update - sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user - # Due to some dependencies yarn may randomly throw an error about invalid cache - # This approach is taken from https://github.com/yarnpkg/yarn/issues/7212#issuecomment-506155894 to fix the issue - # Another approach is to install with flag --network-concurrency 1, but this will make the installation pretty slow (default value is 8) - mkdir .yarncache - yarn install --cache-folder ./.yarncache --frozen-lockfile - rm -rf .yarncache - yarn cache clean - - # Set production flag - - name: Set production flag for release PR or tagged build - run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/tags/v') || github.base_ref == 'main' - - - name: Build ${{ env.REACT_APP_NETWORK }} app - run: yarn build - env: - PUBLIC_URL: './' - REACT_APP_FORTMATIC_KEY: ${{ secrets.REACT_APP_FORTMATIC_KEY }} - REACT_APP_INFURA_TOKEN: ${{ secrets.REACT_APP_INFURA_TOKEN }} - REACT_APP_SAFE_APPS_RPC_INFURA_TOKEN: ${{ secrets.REACT_APP_SAFE_APPS_RPC_INFURA_TOKEN }} - REACT_APP_PORTIS_ID: ${{ secrets.REACT_APP_PORTIS_ID }} - REACT_APP_INTERCOM_ID: ${{ secrets.REACT_APP_INTERCOM_ID }} - REACT_APP_IPFS_GATEWAY: ${{ secrets.REACT_APP_IPFS_GATEWAY }} - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - - # Script to deploy Pull Requests - - run: bash ./scripts/github/deploy_pull_request.sh - if: success() && github.event.number - env: - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - PR_NUMBER: ${{ github.event.number }} - REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - TRAVIS_TAG: ${{ github.event.release.tag_name }} - - - name: 'PRaul: Comment PR with app URLs' - uses: mshick/add-pr-comment@v1 - with: - message: | - * [Safe Multisig app ${{ env.REACT_APP_NETWORK }}](${{ env.REVIEW_FEATURE_URL }}/${{ env.REACT_APP_NETWORK }}/app/) - repo-token: ${{ secrets.GITHUB_TOKEN }} - repo-token-user-login: 'github-actions[bot]' - if: success() && github.event.number - env: - REVIEW_FEATURE_URL: https://pr${{ github.event.number }}--${{ env.REPO_NAME_ALPHANUMERIC }}.review.gnosisdev.com - - # Script to deploy to the dev environment - # Mainnet build is never created on the dev branch - - # Script to deploy to staging environment - - name: 'Deploy to S3: Staging' - if: github.ref == 'refs/heads/main' # Or refs/heads/main - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/current/app --delete - - # Script to upload release files - - name: 'Upload release build files for production' - if: startsWith(github.ref, 'refs/tags/v') - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }} --delete - # - run: bash ./scripts/github/deploy_release.sh - # if: startsWith(github.ref, 'refs/tags/v') - # env: - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # PR_NUMBER: ${{ github.event.number }} - # REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - # REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - # VERSION_TAG: ${{ github.event.release.tag_name }} - - # Script to prepare production deployments - - run: bash ./scripts/github/prepare_production_deployment.sh - if: success() && startsWith(github.ref, 'refs/tags/v') - env: - PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} - PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} - VERSION_TAG: ${{ github.event.release.tag_name }} - - # Upload Sentry source maps when sending to staging or production - - run: yarn sentry-upload-sourcemaps - if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG}} - SENTRY_PROJECT: gnosis-safe-multisig-${{ env.REACT_APP_NETWORK }} diff --git a/.github/workflows/deploy-polygon.yml b/.github/workflows/deploy-polygon.yml deleted file mode 100644 index 306847229e..0000000000 --- a/.github/workflows/deploy-polygon.yml +++ /dev/null @@ -1,144 +0,0 @@ -name: Deploy to Polygon network - -# Run on pushes to main or PRs to main -on: - push: - branches: - - main - pull_request: - # Launches build when release is published - release: - types: [published] - -env: - REPO_NAME_ALPHANUMERIC: safereact - REACT_APP_NETWORK: 'polygon' - STAGING_BUCKET_NAME: ${{ secrets.STAGING_POLYGON_BUCKET_NAME }} - REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN_POLYGON }} - REACT_APP_GOOGLE_ANALYTICS: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID_POLYGON }} - REACT_APP_GNOSIS_APPS_URL: ${{ secrets.REACT_APP_GNOSIS_APPS_URL_PROD }} - -jobs: - debug: - name: Debug - runs-on: ubuntu-latest - steps: - - name: Dump env - run: env | sort - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - deploy: - name: Deployment - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - name: Remove broken apt repos [Ubuntu] - if: ${{ matrix.os }} == 'ubuntu-latest' - run: | - for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 14 - - - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - - run: | - sudo apt-get update - sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user - # Due to some dependencies yarn may randomly throw an error about invalid cache - # This approach is taken from https://github.com/yarnpkg/yarn/issues/7212#issuecomment-506155894 to fix the issue - # Another approach is to install with flag --network-concurrency 1, but this will make the installation pretty slow (default value is 8) - mkdir .yarncache - yarn install --cache-folder ./.yarncache --frozen-lockfile - rm -rf .yarncache - yarn cache clean - # Set production flag - - name: Set production flag for release PR or tagged build - run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/tags/v') || github.base_ref == 'main' - - - name: Build ${{ env.REACT_APP_NETWORK }} app - run: yarn build - env: - PUBLIC_URL: './' - REACT_APP_FORTMATIC_KEY: ${{ secrets.REACT_APP_FORTMATIC_KEY }} - REACT_APP_INFURA_TOKEN: ${{ secrets.REACT_APP_INFURA_TOKEN }} - REACT_APP_SAFE_APPS_RPC_INFURA_TOKEN: ${{ secrets.REACT_APP_SAFE_APPS_RPC_INFURA_TOKEN }} - REACT_APP_PORTIS_ID: ${{ secrets.REACT_APP_PORTIS_ID }} - REACT_APP_INTERCOM_ID: ${{ secrets.REACT_APP_INTERCOM_ID }} - REACT_APP_IPFS_GATEWAY: ${{ secrets.REACT_APP_IPFS_GATEWAY }} - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - - # Script to deploy Pull Requests - - run: bash ./scripts/github/deploy_pull_request.sh - if: success() && github.event.number - env: - PR_NUMBER: ${{ github.event.number }} - REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - - - name: 'PRaul: Comment PR with app URLs' - uses: mshick/add-pr-comment@v1 - with: - message: | - * [Safe Multisig app ${{ env.REACT_APP_NETWORK }}](${{ env.REVIEW_FEATURE_URL }}/${{ env.REACT_APP_NETWORK }}/app/) - repo-token: ${{ secrets.GITHUB_TOKEN }} - repo-token-user-login: 'github-actions[bot]' - if: success() && github.event.number - env: - REVIEW_FEATURE_URL: https://pr${{ github.event.number }}--${{ env.REPO_NAME_ALPHANUMERIC }}.review.gnosisdev.com - - # Script to deploy to the dev environment - # Polygon build is never created on the dev branch - - # Script to deploy to staging environment - - name: 'Deploy to S3: Staging' - if: github.ref == 'refs/heads/main' - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/current/app --delete - - # Script to upload release files - - name: 'Upload release build files for production' - if: startsWith(github.ref, 'refs/tags/v') - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }} --delete - # - run: bash ./scripts/github/deploy_release.sh - # if: startsWith(github.ref, 'refs/tags/v') - # env: - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # PR_NUMBER: ${{ github.event.number }} - # REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - # REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - # VERSION_TAG: ${{ github.event.release.tag_name }} - # Script to prepare production deployments - - run: bash ./scripts/github/prepare_production_deployment.sh - if: success() && startsWith(github.ref, 'refs/tags/v') - env: - PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} - PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} - VERSION_TAG: ${{ github.event.release.tag_name }} - - # Upload Sentry source maps when sending to staging or production - - run: yarn sentry-upload-sourcemaps - if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG}} - SENTRY_PROJECT: gnosis-safe-multisig-${{ env.REACT_APP_NETWORK }} diff --git a/.github/workflows/deploy-volta.yml b/.github/workflows/deploy-volta.yml deleted file mode 100644 index 0fdaa860cd..0000000000 --- a/.github/workflows/deploy-volta.yml +++ /dev/null @@ -1,147 +0,0 @@ -name: Deploy to Volta network - -# Run on pushes to main or PRs to main -on: - push: - branches: - - main - pull_request: - branches: - - main - # Launches build when release is published - release: - types: [published] - -env: - REPO_NAME_ALPHANUMERIC: safereact - REACT_APP_NETWORK: 'volta' - STAGING_BUCKET_NAME: ${{ secrets.STAGING_VOLTA_BUCKET_NAME }} - REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN_VOLTA }} - REACT_APP_GOOGLE_ANALYTICS: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID_VOLTA }} - REACT_APP_GNOSIS_APPS_URL: ${{ secrets.REACT_APP_GNOSIS_APPS_URL_PROD }} - -jobs: - debug: - name: Debug - runs-on: ubuntu-latest - steps: - - name: Dump env - run: env | sort - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - deploy: - name: Deployment - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - name: Remove broken apt repos [Ubuntu] - if: ${{ matrix.os }} == 'ubuntu-latest' - run: | - for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - - uses: actions/checkout@v2 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 14 - - - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - - run: | - sudo apt-get update - sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user - # Due to some dependencies yarn may randomly throw an error about invalid cache - # This approach is taken from https://github.com/yarnpkg/yarn/issues/7212#issuecomment-506155894 to fix the issue - # Another approach is to install with flag --network-concurrency 1, but this will make the installation pretty slow (default value is 8) - mkdir .yarncache - yarn install --cache-folder ./.yarncache --frozen-lockfile - rm -rf .yarncache - yarn cache clean - - # Set production flag - - name: Set production flag for release PR or tagged build - run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/tags/v') || github.base_ref == 'main' - - - name: Build ${{ env.REACT_APP_NETWORK }} app - run: yarn build - env: - PUBLIC_URL: './' - REACT_APP_FORTMATIC_KEY: ${{ secrets.REACT_APP_FORTMATIC_KEY }} - REACT_APP_INFURA_TOKEN: ${{ secrets.REACT_APP_INFURA_TOKEN }} - REACT_APP_PORTIS_ID: ${{ secrets.REACT_APP_PORTIS_ID }} - REACT_APP_INTERCOM_ID: ${{ secrets.REACT_APP_INTERCOM_ID }} - REACT_APP_IPFS_GATEWAY: ${{ secrets.REACT_APP_IPFS_GATEWAY }} - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - - # Script to deploy Pull Requests - - run: bash ./scripts/github/deploy_pull_request.sh - if: success() && github.event.number - env: - PR_NUMBER: ${{ github.event.number }} - REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - - - name: 'PRaul: Comment PR with app URLs' - uses: mshick/add-pr-comment@v1 - with: - message: | - * [Safe Multisig app ${{ env.REACT_APP_NETWORK }}](${{ env.REVIEW_FEATURE_URL }}/${{ env.REACT_APP_NETWORK }}/app/) - repo-token: ${{ secrets.GITHUB_TOKEN }} - repo-token-user-login: 'github-actions[bot]' - if: success() && github.event.number - env: - REVIEW_FEATURE_URL: https://pr${{ github.event.number }}--${{ env.REPO_NAME_ALPHANUMERIC }}.review.gnosisdev.com - - # Script to deploy to the dev environment - # Volta build is never created on the dev branch - - # Script to deploy to staging environment - - name: 'Deploy to S3: Staging' - if: github.ref == 'refs/heads/main' - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/current/app --delete - - # Script to upload release files - - name: 'Upload release build files for production' - if: startsWith(github.ref, 'refs/tags/v') - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }} --delete - # - run: bash ./scripts/github/deploy_release.sh - # if: startsWith(github.ref, 'refs/tags/v') - # env: - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # PR_NUMBER: ${{ github.event.number }} - # REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - # REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - # VERSION_TAG: ${{ github.event.release.tag_name }} - # Script to prepare production deployments - - run: bash ./scripts/github/prepare_production_deployment.sh - if: success() && startsWith(github.ref, 'refs/tags/v') - env: - PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} - PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} - VERSION_TAG: ${{ github.event.release.tag_name }} - - # Upload Sentry source maps when sending to staging or production - - run: yarn sentry-upload-sourcemaps - if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG}} - SENTRY_PROJECT: gnosis-safe-multisig-${{ env.REACT_APP_NETWORK }} diff --git a/.github/workflows/deploy-xdai.yml b/.github/workflows/deploy-xdai.yml deleted file mode 100644 index 2eef022c8e..0000000000 --- a/.github/workflows/deploy-xdai.yml +++ /dev/null @@ -1,148 +0,0 @@ -name: Deploy to xDai network - -# Run on pushes to main or PRs to main -on: - push: - branches: - - main - pull_request: - branches: - - main - # Launches build when release is published - release: - types: [published] - -env: - REPO_NAME_ALPHANUMERIC: safereact - REACT_APP_NETWORK: 'xdai' - STAGING_BUCKET_NAME: ${{ secrets.STAGING_XDAI_BUCKET_NAME }} - REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN_XDAI }} - REACT_APP_GOOGLE_ANALYTICS: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID_XDAI }} - REACT_APP_GNOSIS_APPS_URL: ${{ secrets.REACT_APP_GNOSIS_APPS_URL_PROD }} - -jobs: - debug: - name: Debug - runs-on: ubuntu-latest - steps: - - name: Dump env - run: env | sort - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - deploy: - name: Deployment - runs-on: ubuntu-latest - - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - name: Remove broken apt repos [Ubuntu] - if: ${{ matrix.os }} == 'ubuntu-latest' - run: | - for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done - - uses: actions/checkout@v2 - - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: 14 - - - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - - run: | - sudo apt-get update - sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user - # Due to some dependencies yarn may randomly throw an error about invalid cache - # This approach is taken from https://github.com/yarnpkg/yarn/issues/7212#issuecomment-506155894 to fix the issue - # Another approach is to install with flag --network-concurrency 1, but this will make the installation pretty slow (default value is 8) - mkdir .yarncache - yarn install --cache-folder ./.yarncache --frozen-lockfile - rm -rf .yarncache - yarn cache clean - - # Set production flag - - name: Set production flag for release PR or tagged build - run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/tags/v') || github.base_ref == 'main' - - - name: Build ${{ env.REACT_APP_NETWORK }} app - run: yarn build - env: - PUBLIC_URL: './' - REACT_APP_FORTMATIC_KEY: ${{ secrets.REACT_APP_FORTMATIC_KEY }} - REACT_APP_INFURA_TOKEN: ${{ secrets.REACT_APP_INFURA_TOKEN }} - REACT_APP_PORTIS_ID: ${{ secrets.REACT_APP_PORTIS_ID }} - REACT_APP_INTERCOM_ID: ${{ secrets.REACT_APP_INTERCOM_ID }} - REACT_APP_IPFS_GATEWAY: ${{ secrets.REACT_APP_IPFS_GATEWAY }} - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.AWS_DEFAULT_REGION }} - - # Script to deploy Pull Requests - - run: bash ./scripts/github/deploy_pull_request.sh - if: success() && github.event.number - env: - PR_NUMBER: ${{ github.event.number }} - REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - - - name: 'PRaul: Comment PR with app URLs' - uses: mshick/add-pr-comment@v1 - with: - message: | - * [Safe Multisig app ${{ env.REACT_APP_NETWORK }}](${{ env.REVIEW_FEATURE_URL }}/${{ env.REACT_APP_NETWORK }}/app/) - repo-token: ${{ secrets.GITHUB_TOKEN }} - repo-token-user-login: 'github-actions[bot]' - if: success() && github.event.number - env: - REVIEW_FEATURE_URL: https://pr${{ github.event.number }}--${{ env.REPO_NAME_ALPHANUMERIC }}.review.gnosisdev.com - - # Script to deploy to the dev environment - # xDai build is never created on the dev branch - - # Script to deploy to staging environment - - name: 'Deploy to S3: Staging' - if: github.ref == 'refs/heads/main' - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/current/app --delete - - # Script to upload release files - - name: 'Upload release build files for production' - if: startsWith(github.ref, 'refs/tags/v') - run: aws s3 sync build s3://${{ env.STAGING_BUCKET_NAME }}/releases/${{ github.event.release.tag_name }} --delete - # - run: bash ./scripts/github/deploy_release.sh - # if: startsWith(github.ref, 'refs/tags/v') - # env: - # AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - # PR_NUMBER: ${{ github.event.number }} - # REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - # REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - # VERSION_TAG: ${{ github.event.release.tag_name }} - - # Script to prepare production deployments - - run: bash ./scripts/github/prepare_production_deployment.sh - if: success() && startsWith(github.ref, 'refs/tags/v') - env: - PROD_DEPLOYMENT_HOOK_TOKEN: ${{ secrets.PROD_DEPLOYMENT_HOOK_TOKEN }} - PROD_DEPLOYMENT_HOOK_URL: ${{ secrets.PROD_DEPLOYMENT_HOOK_URL }} - VERSION_TAG: ${{ github.event.release.tag_name }} - - # Upload Sentry source maps when sending to staging or production - - run: yarn sentry-upload-sourcemaps - if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) - env: - SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG}} - SENTRY_PROJECT: gnosis-safe-multisig-${{ env.REACT_APP_NETWORK }} diff --git a/.github/workflows/deploy-rinkeby.yml b/.github/workflows/deploy.yml similarity index 80% rename from .github/workflows/deploy-rinkeby.yml rename to .github/workflows/deploy.yml index 04ee381447..e6560e28d6 100644 --- a/.github/workflows/deploy-rinkeby.yml +++ b/.github/workflows/deploy.yml @@ -1,6 +1,6 @@ -name: Deploy to Rinkeby network +name: Deploy -# Run on pushes to dev/main or PR +# Run on pushes to main or PRs on: # Pull request hook without any config. Launches for every pull request pull_request: @@ -12,14 +12,12 @@ on: # Launches build when release is published release: types: [published] - workflow_dispatch: env: REPO_NAME_ALPHANUMERIC: safereact - REACT_APP_NETWORK: 'rinkeby' - STAGING_BUCKET_NAME: ${{ secrets.STAGING_RINKEBY_BUCKET_NAME }} - REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN_RINKEBY }} - REACT_APP_GOOGLE_ANALYTICS: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID_RINKEBY }} + STAGING_BUCKET_NAME: ${{ secrets.STAGING_MAINNET_BUCKET_NAME }} + REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN_MAINNET }} + REACT_APP_GOOGLE_ANALYTICS: ${{ secrets.REACT_APP_GOOGLE_ANALYTICS_ID_MAINNET }} REACT_APP_GNOSIS_APPS_URL: ${{ secrets.REACT_APP_GNOSIS_APPS_URL_PROD }} REACT_APP_ETHERSCAN_API_KEY: ${{ secrets.REACT_APP_ETHERSCAN_API_KEY }} REACT_APP_ETHGASSTATION_API_KEY: ${{ secrets.REACT_APP_ETHGASSTATION_API_KEY }} @@ -38,6 +36,7 @@ jobs: deploy: name: Deployment runs-on: ubuntu-latest + steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.8.0 @@ -70,15 +69,24 @@ jobs: rm -rf .yarncache yarn cache clean - # Set production flag + # Set dev flag (for PR deployments) + - name: Set PR flag + run: echo "REACT_APP_ENV=dev" >> $GITHUB_ENV + if: github.ref != 'refs/heads/main' + + # Set production flag on staging + - name: Set production flag for staging + run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV + if: github.ref == 'refs/heads/main' + + # Set production flag on prod - name: Set production flag for release PR or tagged build run: echo "REACT_APP_ENV=production" >> $GITHUB_ENV if: startsWith(github.ref, 'refs/tags/v') || github.base_ref == 'main' - - name: Build ${{ env.REACT_APP_NETWORK }} app ${{ env.REACT_APP_ENV }} + - name: Build app run: yarn build env: - PUBLIC_URL: './' REACT_APP_FORTMATIC_KEY: ${{ secrets.REACT_APP_FORTMATIC_KEY }} REACT_APP_INFURA_TOKEN: ${{ secrets.REACT_APP_INFURA_TOKEN }} REACT_APP_SAFE_APPS_RPC_INFURA_TOKEN: ${{ secrets.REACT_APP_SAFE_APPS_RPC_INFURA_TOKEN }} @@ -97,21 +105,31 @@ jobs: - run: bash ./scripts/github/deploy_pull_request.sh if: success() && github.event.number env: + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} PR_NUMBER: ${{ github.event.number }} REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} - TRAVIS_TAG: ${{ github.event.release.tag_name }} - name: 'PRaul: Comment PR with app URLs' uses: mshick/add-pr-comment@v1 with: message: | - * [Safe Multisig app ${{ env.REACT_APP_NETWORK }}](${{ env.REVIEW_FEATURE_URL }}/${{ env.REACT_APP_NETWORK }}/app/) + * [Safe Rinkeby](${{ env.REVIEW_FEATURE_URL }}/rinkeby) + * [Safe Mainnet](${{ env.REVIEW_FEATURE_URL }}/mainnet) + * [Safe Polygon](${{ env.REVIEW_FEATURE_URL }}/polygon) + * [Safe BSC](${{ env.REVIEW_FEATURE_URL }}/bsc) + * [Safe Arbitrum](${{ env.REVIEW_FEATURE_URL }}/arbitrum) + * Unified app on *dev*: https://safe-team.dev.gnosisdev.com/app/ repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token-user-login: 'github-actions[bot]' if: success() && github.event.number env: - REVIEW_FEATURE_URL: https://pr${{ github.event.number }}--${{ env.REPO_NAME_ALPHANUMERIC }}.review.gnosisdev.com + REVIEW_FEATURE_URL: https://pr${{ github.event.number }}--safereact.review-safe.gnosisdev.com/app + + # Script to deploy to the dev environment + - name: 'Deploy to S3: Dev' + if: github.ref == 'refs/heads/dev' + run: aws s3 sync build s3://${{ secrets.AWS_DEV_BUCKET_NAME }}/app --delete # Script to deploy to staging environment - name: 'Deploy to S3: Staging' @@ -129,10 +147,9 @@ jobs: # AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} # PR_NUMBER: ${{ github.event.number }} # REVIEW_BUCKET_NAME: ${{ secrets.AWS_REVIEW_BUCKET_NAME }} - # REACT_APP_NETWORK: ${{ env.REACT_APP_NETWORK }} # VERSION_TAG: ${{ github.event.release.tag_name }} - # Script to notify production deployments + # Script to prepare production deployments - run: bash ./scripts/github/prepare_production_deployment.sh if: success() && startsWith(github.ref, 'refs/tags/v') env: @@ -145,8 +162,8 @@ jobs: if: success() && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) env: SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} - SENTRY_ORG: ${{ secrets.SENTRY_ORG}} - SENTRY_PROJECT: gnosis-safe-multisig-${{ env.REACT_APP_NETWORK }} + SENTRY_ORG: ${{ secrets.SENTRY_ORG }} + SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} e2e: name: Trigger e2e tests if: success() && github.ref == 'refs/heads/dev' diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..5d7b9e71b2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "boba_ops/safe-client-gateway"] + path = boba_ops/safe-client-gateway + url = https://github.com/gnosis/safe-client-gateway.git +[submodule "boba_ops/safe-config-service"] + path = boba_ops/safe-config-service + url = https://github.com/gnosis/safe-config-service +[submodule "boba_ops/safe-transaction-service"] + path = boba_ops/safe-transaction-service + url = https://github.com/gnosis/safe-transaction-service diff --git a/Dockerfile b/Dockerfile index 54c769f356..f543489add 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,9 +8,14 @@ COPY package.json ./ COPY yarn.lock ./ -RUN yarn install +ADD src/ ./src +ADD config/ ./config +ADD patches/ ./patches +ADD scripts/ ./scripts +ADD public/ ./public +ADD docs/ ./docs -COPY . . +RUN yarn install EXPOSE 3000 diff --git a/boba_ops/README.md b/boba_ops/README.md new file mode 100644 index 0000000000..5adcd65a38 --- /dev/null +++ b/boba_ops/README.md @@ -0,0 +1,10 @@ +Add users: +docker exec -it boba_ops-safe-transaction-service-1 python manage.py createsuperuser + +Add chain: +./load_chain + \ No newline at end of file diff --git a/boba_ops/boba_chains.json b/boba_ops/boba_chains.json new file mode 100644 index 0000000000..ae4bb5abf0 --- /dev/null +++ b/boba_ops/boba_chains.json @@ -0,0 +1,54 @@ +[ + { + "model": "chains.chain", + "pk": 288, + "fields": { + "relevance": 1, + "name": "Boba", + "short_name": "boba", + "description": "Boba Network", + "l2": true, + "rpc_authentication": "API_KEY_PATH", + "rpc_uri": "https://mainnet.boba.network/", + "safe_apps_rpc_authentication": "NO_AUTHENTICATION", + "safe_apps_rpc_uri": "https://mainnet.boba.network/", + "block_explorer_uri_address_template": "https://blockexplorer.boba.network/address/{{address}}", + "block_explorer_uri_tx_hash_template": "https://blockexplorer.boba.network/tx/{{txHash}}", + "currency_name": "Ether", + "currency_symbol": "ETH", + "currency_decimals": 18, + "currency_logo_uri": "chains/1/currency_logo.png", + "transaction_service_uri": "http://nginx-safe-transaction-service:8000", + "vpc_transaction_service_uri": "http://nginx-safe-transaction-service:8000", + "theme_text_color": "#001428", + "theme_background_color": "#E8E7E6", + "recommended_master_copy_version": "1.3.0" + } + }, + { + "model": "chains.chain", + "pk": 28, + "fields": { + "relevance": 2, + "name": "Boba Rinkeby", + "short_name": "boba_rinkeby", + "description": "Boba Network Rinkeby", + "l2": true, + "rpc_authentication": "NO_AUTHENTICATION", + "rpc_uri": "https://rinkeby.boba.network", + "safe_apps_rpc_authentication": "NO_AUTHENTICATION", + "safe_apps_rpc_uri": "https://rinkeby.boba.network", + "block_explorer_uri_address_template": "https://blockexplorer.rinkeby.boba.network/address/{{address}}", + "block_explorer_uri_tx_hash_template": "https://blockexplorer.rinkeby.boba.network/tx/{{txHash}}", + "currency_name": "Ether", + "currency_symbol": "ETH", + "currency_decimals": 18, + "currency_logo_uri": "chains/1/currency_logo.png", + "transaction_service_uri": "http://nginx-safe-transaction-service:8000", + "vpc_transaction_service_uri": "http://nginx-safe-transaction-service:8000", + "theme_text_color": "#ffffff", + "theme_background_color": "#E8673C", + "recommended_master_copy_version": "1.3.0" + } + } +] \ No newline at end of file diff --git a/boba_ops/boba_logo.png b/boba_ops/boba_logo.png new file mode 100644 index 0000000000..950682151c Binary files /dev/null and b/boba_ops/boba_logo.png differ diff --git a/boba_ops/boba_logo.svg b/boba_ops/boba_logo.svg new file mode 100644 index 0000000000..a58d770d6f --- /dev/null +++ b/boba_ops/boba_logo.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/boba_ops/build-ci.sh b/boba_ops/build-ci.sh new file mode 100755 index 0000000000..db83bd7143 --- /dev/null +++ b/boba_ops/build-ci.sh @@ -0,0 +1,3 @@ +DOCKER_BUILDKIT=1 +COMPOSE_DOCKER_CLI_BUILD=1 +docker-compose build -- safe-react safe-config-service safe-client-gateway safe-transaction-service \ No newline at end of file diff --git a/boba_ops/create_user b/boba_ops/create_user new file mode 100755 index 0000000000..d24173f43d --- /dev/null +++ b/boba_ops/create_user @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +set -eo pipefail +docker exec -it boba_ops-safe-transaction-service-1 python manage.py createsuperuser diff --git a/boba_ops/docker-compose.yml b/boba_ops/docker-compose.yml new file mode 100644 index 0000000000..acb39934b5 --- /dev/null +++ b/boba_ops/docker-compose.yml @@ -0,0 +1,126 @@ +version: '3.5' + +volumes: + nginx-shared: + nginx-sharedd: + +services: + nginx-safe-transaction-service: + image: nginx:alpine + hostname: nginx-safe-transaction-service + ports: + - "8000:8000" + volumes: + - ./safe-transaction-service/docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro + - nginx-shared:/nginx + depends_on: + - safe-transaction-service + + nginx-safe-config-service: + image: nginx:alpine + hostname: nginx-safe-config-service + env_file: + - envs/.env_safe_config_service + ports: + - "8001:80" + volumes: + - ./safe-config-service/nginx/templates:/etc/nginx/templates + - nginx-sharedd:/nginx + depends_on: + - safe-config-service + + redis: + image: redis:alpine + ports: + - "6379:6379" + command: + - --save "" + - --appendonly no + + db: + image: postgres:13-alpine + ports: + - "5432:5432" + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + + safe-transaction-service: + image: bobanetwork/safe-transaction-service + build: + context: ./safe-transaction-service/ + dockerfile: ./docker/web/Dockerfile + env_file: + - envs/.env_safe_transaction_service + depends_on: + - db + - redis + - worker + - scheduler + working_dir: /app + ports: + - "8888:8888" + volumes: + - nginx-shared:/nginx + restart: always + command: ./docker/web/run_web.sh + + worker: &worker + image: bobanetwork/safe-transaction-service + build: + context: ./safe-transaction-service/ + dockerfile: ./docker/web/Dockerfile + env_file: + - envs/.env_safe_transaction_service + depends_on: + - db + - redis + restart: always + command: ./docker/web/celery/worker/run.sh + + scheduler: + <<: *worker + command: ./docker/web/celery/scheduler/run.sh + + safe-client-gateway: + image: bobanetwork/safe-client-gateway + build: + context: ./safe-client-gateway/ + dockerfile: ./Dockerfile + env_file: + - envs/.env_safe_client_gateway + environment: + - REDIS_URI=redis://redis:6379 + - ROCKET_PORT=3666 + - ROCKET_ADDRESS=0.0.0.0 + depends_on: + - redis + ports: + - "8002:3666" + + safe-config-service: + image: bobanetwork/safe-config-service + build: + context: ./safe-config-service/ + dockerfile: ./Dockerfile + tty: true + volumes: + - nginx-sharedd:/nginx + env_file: + - envs/.env_safe_config_service + depends_on: + - db + + safe-react: + image: bobanetwork/safe-react + build: + context: ../ + dockerfile: ./Dockerfile + env_file: + - envs/.env_safe_react + volumes: + - /app/node_modules + - ../:/app + restart: always + ports: + - 3000:3000 \ No newline at end of file diff --git a/boba_ops/envs/.env_safe_client_gateway b/boba_ops/envs/.env_safe_client_gateway new file mode 100644 index 0000000000..6779928479 --- /dev/null +++ b/boba_ops/envs/.env_safe_client_gateway @@ -0,0 +1,60 @@ +# Staging +CONFIG_SERVICE_URI=http://nginx-safe-config-service +# Production +# CONFIG_SERVICE_URI=https://safe-config.gnosis.io + +# Feature Flags +FEATURE_FLAG_NESTED_DECODING=true +FEATURE_FLAG_BALANCES_RATE_IMPLEMENTATION=false + +SCHEME=http +# Random string (generated with openssl rand -base64 32) +ROCKET_SECRET_KEY=Qt6DPFUU8qO4BKTCQnKAgt9FBBJxIWAYUGyHuruVfpE= +ROCKET_LOG_LEVEL=debug +ROCKET_PORT=8000 +ROCKET_ADDRESS=127.0.0.1 +# ROCKET_PORT=8000 +# ROCKET_ADDRESS=localhost +WEBHOOK_TOKEN=some_random_token +# Rocket logs are noise-y, this value filters the logs for errors and our perf monitor +# Set to "debug" when developing +# You can select which proportion of the time logs are emited with LOG_THRESHOLD values range [0.0, 1.0] +# Each time we log, we will generate a random (from a uniform distribution) number that we will test against LOG_THRESHOLD +RUST_LOG=safe_client_gateway=debug,safe_client_gateway::monitoring=info +LOG_ALL_ERROR_RESPONSES=true +VPC_TRANSACTION_SERVICE_URI=true +CONCURRENT_BALANCE_TOKEN_REQUESTS=5 +# LOG_THRESHOLD=0.1 + +# Time outs for caches (all have defaults in the code) +# The unit of these values is "milliseconds" +# SAFE_INFO_CACHE_DURATION=1000 +# ADDRESS_INFO_CACHE_DURATION=1000 +# TOKEN_INFO_CACHE_DURATION=1000 +# CHAIN_INFO_CACHE_DURATION=1000 +# CHAIN_INFO_RESPONSE_CACHE_DURATION=1000 +# EXCHANGE_API_CACHE_DURATION=1000 +# REQUEST_CACHE_DURATION=1000 +# ABOUT_CACHE_DURATION=1000 +# BALANCES_REQUEST_CACHE_DURATION=1000 +# SAFE_APP_MANIFEST_CACHE_DURATION=1000 +# REQS_ERROR_CACHE_DURATION=1000 +# OWNERS_FOR_SAFES_CACHE_DURATION=1000 +# INDEFINITE_TIMEOUT=1000 # long cache duration of your choice +# SHORT_ERROR_DURATION=1000 +# LONG_ERROR_DURATION=1000 +# SAFE_APPS_CACHE_DURATION=1000 + +# Http request time outs +# The unit of these values is "milliseconds" +INTERNAL_CLIENT_CONNECT_TIMEOUT=10000 +SAFE_APP_INFO_REQUEST_TIMEOUT=10000 +CHAIN_INFO_REQUEST_TIMEOUT=15000 + +# Redis +#REDIS_URI=redis://127.0.0.1:6380 +# REDIS_SCAN_COUNT=300 + +# Exchange rate API: https://exchangeratesapi.io/ +EXCHANGE_API_BASE_URI=http://api.exchangeratesapi.io/latest +EXCHANGE_API_KEY= diff --git a/boba_ops/envs/.env_safe_config_service b/boba_ops/envs/.env_safe_config_service new file mode 100644 index 0000000000..26f6a19e08 --- /dev/null +++ b/boba_ops/envs/.env_safe_config_service @@ -0,0 +1,108 @@ +# Default values are optimized for production to avoid having to configure +# much in production. +# +# However it should be easy to get going in development too. If you see an +# uncommented option that means it's either mandatory to set it or it's being +# overwritten in development to make your life easier. + +# In development avoid writing out bytecode to __pycache__ directories. +PYTHONDONTWRITEBYTECODE=true + +# You should generate a random string of 50+ characters for this value in prod. +SECRET_KEY=insecure_key_for_dev + +# This should never be set to true in production but it should be enabled in dev. +DEBUG=true + +# Root log level (default is INFO) +# Possible values are DEBUG | INFO | WARNING | ERROR | CRITICAL +ROOT_LOG_LEVEL=DEBUG + +# A comma separated list of allowed hosts. In production this should be your +# domain name, such as "example.com,www.example.com" or ".example.com" to +# support both example.com and all sub-domains for your domain. +# +# This is being overwritten in development to support multiple Docker dev +# environments where you might be connecting over a local network IP address +# instead of localhost. You should not use "*" in production. +DJANGO_ALLOWED_HOSTS=".localhost,127.0.0.1,[::1],*,safe-client-gateway" + +# The bind port for gunicorn. +# +# Be warned that if you change this value you'll need to change 8000 in both +# your Dockerfile and in a few spots in docker-compose.yml due to the nature of +# how this value can be set (Docker Compose doesn't support nested ENV vars). +GUNICORN_BIND_PORT=8000 + +# Docker Nginx Volume Root +DOCKER_NGINX_VOLUME_ROOT=/nginx + +# The bind socket for gunicorn +GUNICORN_BIND_SOCKET=unix:${DOCKER_NGINX_VOLUME_ROOT}/gunicorn.socket + +# The port exposed to the host by the nginx image. +NGINX_HOST_PORT=8080 + +# A directory where the result of executing envsubst is output (default: /etc/nginx/conf.d) +# Used by the nginx docker image in the templating system in order to use the environment variables set +NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx/ + +# Should the Webpack watcher use polling? Not all Docker hosts support inotify. +# If you find your assets aren't updating in development then set this to true. +#WEBPACK_WATCHER_POLL=false + +# You'll always want to set the POSTGRES_USER and POSTGRES_PASSWORD since the +# postgres Docker image uses them for its default database user and password. +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres +POSTGRES_NAME=postgres +POSTGRES_HOST=db +POSTGRES_PORT=5432 + +# What volume path should be used? In development we want to volume mount +# everything so we can develop our code without rebuilding our Docker images. +# DOCKER_WEB_VOLUME=.:/app + +# Restart workers when code changes. +# This setting is intended for development. It will cause workers to be restarted whenever application code changes. +GUNICORN_WEB_RELOAD=false + +# The Client Gateway URL. This is for triggering webhooks to invalidate its cache for example +CGW_URL=http://127.0.0.1 + +# The Client Gateway /flush token. +#CGW_FLUSH_TOKEN=example-flush-token + +# What CPU and memory constraints will be added to your services? When left at +# 0, they will happily use as much as needed. +#DOCKER_POSTGRES_CPUS=0 +#DOCKER_POSTGRES_MEMORY=0 +#DOCKER_REDIS_CPUS=0 +#DOCKER_REDIS_MEMORY=0 +#DOCKER_WEB_CPUS=0 +#DOCKER_WEB_MEMORY=0 +#DOCKER_WORKER_CPUS=0 +#DOCKER_WORKER_MEMORY=0 + +# Default file storage class to be used for any file-related operations that don’t specify a particular storage system. +# storages.backends.s3boto3.S3Boto3Storage – Used for S3 configuration (AWS needs to be configured) +# django.core.files.storage.FileSystemStorage – Django default +DEFAULT_FILE_STORAGE=django.core.files.storage.FileSystemStorage +#DEFAULT_FILE_STORAGE=storages.backends.s3boto3.S3Boto3Storage + +# django-storages – Amazon S3 configuration +# See https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html + +# Your Amazon Web Services access key, as a string. +#AWS_ACCESS_KEY_ID= + +# Your Amazon Web Services secret access key, as a string. +#AWS_SECRET_ACCESS_KEY= + +# Your Amazon Web Services storage bucket name, as a string. +#AWS_STORAGE_BUCKET_NAME= + +# If you're using S3 as a CDN (via CloudFront), you'll probably want this storage to serve those files using tha +# This is just the domain name ie.: no protocol should be set here and it should not end in a slash `/` +# eg.: AWS_S3_CUSTOM_DOMAIN=cdn.mydomain.com +#AWS_S3_CUSTOM_DOMAIN= diff --git a/boba_ops/envs/.env_safe_react b/boba_ops/envs/.env_safe_react new file mode 100644 index 0000000000..540022df46 --- /dev/null +++ b/boba_ops/envs/.env_safe_react @@ -0,0 +1,2 @@ +REACT_APP_NETWORK=BOBA_RINKEBY +NODE_ENV=test \ No newline at end of file diff --git a/boba_ops/envs/.env_safe_transaction_service b/boba_ops/envs/.env_safe_transaction_service new file mode 100644 index 0000000000..b0351b48fb --- /dev/null +++ b/boba_ops/envs/.env_safe_transaction_service @@ -0,0 +1,12 @@ +PYTHONPATH=/app/ +DJANGO_SETTINGS_MODULE=config.settings.local +DJANGO_SECRET_KEY='Very-secure-secret-string' +C_FORCE_ROOT=true +DEBUG=0 +DATABASE_URL=psql://postgres:postgres@db:5432/postgres +ETHEREUM_NODE_URL=https://rinkeby.boba.network +ETHEREUM_TRACING_NODE_URL=https://rinkeby.boba.network +ETH_L2_NETWORK=1 +REDIS_URL=redis://redis:6379/0 +CELERY_BROKER_URL=redis://redis:6379/1 +DJANGO_ALLOWED_HOSTS="localhost,0.0.0.0,127.0.0.1,*,172.22.0.9" \ No newline at end of file diff --git a/boba_ops/load_chain b/boba_ops/load_chain new file mode 100755 index 0000000000..6421072f81 --- /dev/null +++ b/boba_ops/load_chain @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -eo pipefail +docker compose cp boba_chains.json safe-config-service:/tmp/boba_chains.json +./run manage loaddata /tmp/boba_chains.json \ No newline at end of file diff --git a/boba_ops/run b/boba_ops/run new file mode 100755 index 0000000000..dfedacec94 --- /dev/null +++ b/boba_ops/run @@ -0,0 +1,50 @@ +#!/usr/bin/env bash + +set -eo pipefail + +DC="${DC:-exec}" + +# If we're running in CI we need to disable TTY allocation for docker-compose +# commands that enable it by default, such as exec and run. +TTY="" +if [[ ! -t 1 ]]; then + TTY="-T" +fi + +# ----------------------------------------------------------------------------- +# Helper functions start with _ and aren't listed in this script's help menu. +# ----------------------------------------------------------------------------- + +function _dc { + docker-compose "${DC}" ${TTY} "${@}" +} + +# ----------------------------------------------------------------------------- + +function cmd { + # Run any command you want in the safe-config-service container + _dc safe-config-service "${@}" +} + +function manage { + # Run any manage.py commands + + # We need to collectstatic before we run our tests. + if [ "${1-''}" == "test" ]; then + cmd python src/manage.py collectstatic --no-input + fi + + cmd python src/manage.py "${@}" +} + +function help { + printf "%s [args]\n\nTasks:\n" "${0}" + + compgen -A function | grep -v "^_" | cat -n + + printf "\nExtended help:\n Each task has comments for general usage\n" +} + +# This idea is heavily inspired by: https://github.com/adriancooney/Taskfile +TIMEFORMAT=$'\nTask completed in %3lR' +time "${@:-help}" diff --git a/boba_ops/safe-client-gateway b/boba_ops/safe-client-gateway new file mode 160000 index 0000000000..1d211160d1 --- /dev/null +++ b/boba_ops/safe-client-gateway @@ -0,0 +1 @@ +Subproject commit 1d211160d1578007d0e660de152a9515e0c79c46 diff --git a/boba_ops/safe-config-service b/boba_ops/safe-config-service new file mode 160000 index 0000000000..b6488385e2 --- /dev/null +++ b/boba_ops/safe-config-service @@ -0,0 +1 @@ +Subproject commit b6488385e2a5d41e9693e48b34696840fe73ab9e diff --git a/boba_ops/safe-transaction-service b/boba_ops/safe-transaction-service new file mode 160000 index 0000000000..c9a41020f0 --- /dev/null +++ b/boba_ops/safe-transaction-service @@ -0,0 +1 @@ +Subproject commit c9a41020f04df06d001b12c81c9bc1fcf10582c8 diff --git a/docker-compose.yml b/docker-compose.yml index 38e52e895b..76ace1eb6e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,4 +7,4 @@ services: - /app/node_modules - ./:/app ports: - - 3000:3000 + - 3000:3000 \ No newline at end of file diff --git a/package.json b/package.json index ca9ce5bb51..c5879ebee2 100644 --- a/package.json +++ b/package.json @@ -171,7 +171,7 @@ "@gnosis.pm/safe-apps-sdk": "4.3.0-next.2", "@gnosis.pm/safe-apps-sdk-v1": "npm:@gnosis.pm/safe-apps-sdk@0.4.2", "@gnosis.pm/safe-core-sdk": "^0.3.1", - "@gnosis.pm/safe-deployments": "^1.2.0", + "@gnosis.pm/safe-deployments": "^1.5.0", "@gnosis.pm/safe-react-components": "^0.8.0", "@gnosis.pm/safe-react-gateway-sdk": "2.3.0", "@ledgerhq/hw-transport-node-hid-singleton": "6.3.0", diff --git a/src/config/assets/boba_logo.svg b/src/config/assets/boba_logo.svg new file mode 100644 index 0000000000..a58d770d6f --- /dev/null +++ b/src/config/assets/boba_logo.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/config/networks/boba.ts b/src/config/networks/boba.ts new file mode 100644 index 0000000000..4bde906674 --- /dev/null +++ b/src/config/networks/boba.ts @@ -0,0 +1,73 @@ +import BobaLogo from 'src/config/assets/boba_logo.svg' +import { + EnvironmentSettings, + ETHEREUM_LAYER, + ETHEREUM_NETWORK, + FEATURES, + NetworkConfig, + WALLETS, +} from 'src/config/networks/network.d' + +const baseConfig: EnvironmentSettings = { + //this is the frontend2backend url + clientGatewayUrl: 'http://127.0.0.1:8002/v1', + txServiceUrl: 'http://127.0.0.1:8000/api/v1', + safeUrl: 'http://gnosis-safe.mainnet.boba:3000/app', + gasPriceOracles: [ + { + url: 'https://mainnet.boba.network/', + }, + ], + rpcServiceUrl: 'https://mainnet.boba.network/', + safeAppsRpcServiceUrl: 'https://mainnet.boba.network/', + networkExplorerName: 'BlockExplorer', + networkExplorerUrl: 'https://blockexplorer.boba.network/', + networkExplorerApiUrl: 'https://blockexplorer.boba.network/api', +} + +const boba: NetworkConfig = { + environment: { + dev: { + ...baseConfig, + }, + staging: { + ...baseConfig, + }, + production: { + ...baseConfig, + }, + }, + network: { + id: ETHEREUM_NETWORK.BOBA, + backgroundColor: '#2A3245', + textColor: '#ffffff', + label: 'Boba', + isTestNet: false, + ethereumLayer: ETHEREUM_LAYER.L2, + nativeCoin: { + address: '0x0000000000000000000000000000000000000000', + name: 'ETH', + symbol: 'ETH', + decimals: 18, + logoUri: BobaLogo, + }, + }, + disabledWallets: [ + WALLETS.TREZOR, + WALLETS.LEDGER, + WALLETS.COINBASE, + WALLETS.FORTMATIC, + WALLETS.OPERA, + WALLETS.OPERA_TOUCH, + WALLETS.PORTIS, + WALLETS.TORUS, + WALLETS.TRUST, + WALLETS.WALLET_LINK, + WALLETS.AUTHEREUM, + WALLETS.LATTICE, + WALLETS.KEYSTONE, + ], + disabledFeatures: [FEATURES.DOMAIN_LOOKUP, FEATURES.SPENDING_LIMIT], +} + +export default boba diff --git a/src/config/networks/boba_rinkeby.ts b/src/config/networks/boba_rinkeby.ts new file mode 100644 index 0000000000..fe721558a6 --- /dev/null +++ b/src/config/networks/boba_rinkeby.ts @@ -0,0 +1,73 @@ +import BobaLogo from 'src/config/assets/boba_logo.svg' +import { + EnvironmentSettings, + ETHEREUM_LAYER, + ETHEREUM_NETWORK, + FEATURES, + NetworkConfig, + WALLETS, +} from 'src/config/networks/network.d' + +const baseConfig: EnvironmentSettings = { + //this is the frontend2backend url + clientGatewayUrl: 'http://127.0.0.1:8002/v1', + txServiceUrl: 'http://127.0.0.1:8000/api/v1', + safeUrl: 'http://gnosis-safe.rinkeby.boba:3000/app', + gasPriceOracles: [ + { + url: 'https://rinkeby.boba.network/', + }, + ], + rpcServiceUrl: 'https://rinkeby.boba.network/', + safeAppsRpcServiceUrl: 'https://rinkeby.boba.network/', + networkExplorerName: 'BlockExplorer', + networkExplorerUrl: 'https://blockexplorer.rinkeby.boba.network/', + networkExplorerApiUrl: 'https://blockexplorer.rinkeby.boba.network/api', +} + +const boba_rinkeby: NetworkConfig = { + environment: { + dev: { + ...baseConfig, + }, + staging: { + ...baseConfig, + }, + production: { + ...baseConfig, + }, + }, + network: { + id: ETHEREUM_NETWORK.BOBA_RINKEBY, + backgroundColor: '#2A3245', + textColor: '#ffffff', + label: 'Boba Rinkeby', + isTestNet: true, + ethereumLayer: ETHEREUM_LAYER.L2, + nativeCoin: { + address: '0x0000000000000000000000000000000000000000', + name: 'ETH', + symbol: 'ETH', + decimals: 18, + logoUri: BobaLogo, + }, + }, + disabledWallets: [ + WALLETS.TREZOR, + WALLETS.LEDGER, + WALLETS.COINBASE, + WALLETS.FORTMATIC, + WALLETS.OPERA, + WALLETS.OPERA_TOUCH, + WALLETS.PORTIS, + WALLETS.TORUS, + WALLETS.TRUST, + WALLETS.WALLET_LINK, + WALLETS.AUTHEREUM, + WALLETS.LATTICE, + WALLETS.KEYSTONE, + ], + disabledFeatures: [FEATURES.DOMAIN_LOOKUP, FEATURES.SPENDING_LIMIT], +} + +export default boba_rinkeby diff --git a/src/config/networks/index.ts b/src/config/networks/index.ts index 693c3be7ae..914eeecadb 100644 --- a/src/config/networks/index.ts +++ b/src/config/networks/index.ts @@ -7,6 +7,8 @@ import energy_web_chain from './energy_web_chain' import volta from './volta' import polygon from './polygon' import bsc from './bsc' +import boba_rinkeby from './boba_rinkeby' +import boba from './boba' export default { local, @@ -18,4 +20,6 @@ export default { volta, polygon, bsc, + boba_rinkeby, + boba, } diff --git a/src/config/networks/network.d.ts b/src/config/networks/network.d.ts index 6ad5e367c9..c4917b74f8 100644 --- a/src/config/networks/network.d.ts +++ b/src/config/networks/network.d.ts @@ -55,6 +55,8 @@ export enum ETHEREUM_NETWORK { LOCAL = '4447', ARBITRUM = '42161', VOLTA = '73799', + BOBA_RINKEBY = '28', + BOBA = '288', } export type NetworkSettings = { @@ -79,10 +81,10 @@ export type GasPriceOracle = { url: string // Different gas api providers can use a different name to reflect different gas levels based on tx speed // For example in ethGasStation for ETHEREUM_MAINNET = safeLow | average | fast - gasParameter: string + gasParameter?: string // Some providers may not use the most common standard, gwei to return the gas price value // This is the case of Ethgasstation that returns price as gwei x 10. - gweiFactor: string + gweiFactor?: string } type GasPrice = diff --git a/src/logic/wallets/ethTransactions.ts b/src/logic/wallets/ethTransactions.ts index 69d9fd2493..538683b943 100644 --- a/src/logic/wallets/ethTransactions.ts +++ b/src/logic/wallets/ethTransactions.ts @@ -1,5 +1,6 @@ import axios from 'axios' import { BigNumber } from 'bignumber.js' +import { BigNumber as BigNumberEthers } from 'ethers' import { EthAdapterTransaction } from '@gnosis.pm/safe-core-sdk/dist/src/ethereumLibs/EthAdapter' import { getSDKWeb3Adapter, getWeb3, web3ReadOnly } from 'src/logic/wallets/getWeb3' @@ -16,9 +17,21 @@ const FIXED_GAS_FEE = '2.5' const fetchGasPrice = async (gasPriceOracle: GasPriceOracle): Promise => { const { url, gasParameter, gweiFactor } = gasPriceOracle - const { data: response } = await axios.get(url) - const data = response.data || response.result || response // Sometimes the data comes with a data parameter - return new BigNumber(data[gasParameter]).multipliedBy(gweiFactor).toString() + if (gasParameter === undefined || gweiFactor === undefined) { + const rpcRequest = { + jsonrpc: '2.0', + method: 'eth_gasPrice', + params: [], + id: 1, + } + const headers = { headers: { 'Content-Type': 'application/json' } } + const { data: response } = await axios.post(url, rpcRequest, headers) + return BigNumberEthers.from(response.result).toString() + } else { + const { data: response } = await axios.get(url) + const data = response.data || response.result || response // Sometimes the data comes with a data parameter + return new BigNumber(data[gasParameter]).multipliedBy(gweiFactor).toString() + } } export const calculateGasPrice = async (): Promise => { diff --git a/yarn.lock b/yarn.lock index ca22ebe2a4..e85b6b485e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2147,10 +2147,10 @@ "@gnosis.pm/safe-core-sdk-types" "^0.1.1" ethereumjs-util "^7.0.10" -"@gnosis.pm/safe-deployments@^1.2.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-deployments/-/safe-deployments-1.4.0.tgz#d49d3d36cc014ef62306d09c0f4761895a17d7a6" - integrity sha512-q4salJNQ/Gx0DnZJytAFO/U4OwGI6xTGtTJSOZK+C9Fh2NW8sep+YfSunHQvCLcu4b7WgWEBhxnCV6rpyveLHg== +"@gnosis.pm/safe-deployments@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@gnosis.pm/safe-deployments/-/safe-deployments-1.5.0.tgz#5e01ccc2e2d78bf91ecb4453a64d1cac3a5ba2d6" + integrity sha512-IDU7I+IQr1zUU94/uD8shDVI+/nUA1unQUg8jtbTG0YGcmm49Lu8G01rqtWt2mhLxZWzFsgbLWGnU+/BzUqk7g== "@gnosis.pm/safe-react-components@^0.8.0": version "0.8.0"