├── .eslintrc.json ├── .firebaserc ├── .github └── workflows │ ├── gcp-deploy.yaml │ ├── gcp-undeploy.yaml │ ├── production.yml │ └── sokol.yml ├── .gitignore ├── .husky ├── .gitignore └── pre-commit ├── .prettierrc.json ├── Dockerfile ├── README.md ├── docker-compose.yml ├── firebase.json ├── nginx.conf ├── package.json ├── packages ├── dapp │ ├── .eslintrc.json │ ├── .sample-env │ ├── .unimportedrc.json │ ├── jsconfig.json │ ├── package.json │ ├── public │ │ ├── android-chrome-192x192.png │ │ ├── android-chrome-512x512.png │ │ ├── apple-touch-icon.png │ │ ├── browserconfig.xml │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── manifest.json │ │ ├── mstile-150x150.png │ │ ├── robots.txt │ │ └── safari-pinned-tab.svg │ └── src │ │ ├── App.jsx │ │ ├── assets │ │ ├── alert.svg │ │ ├── blue-tick.svg │ │ ├── bsc-logo.png │ │ ├── change-network.png │ │ ├── claim.svg │ │ ├── close.svg │ │ ├── coinbase.svg │ │ ├── confirm-transfer.svg │ │ ├── custom-token.svg │ │ ├── down-triangle.svg │ │ ├── drop-down.svg │ │ ├── error.svg │ │ ├── eth-logo.png │ │ ├── eth.png │ │ ├── imtoken.svg │ │ ├── info.svg │ │ ├── loading.svg │ │ ├── logo.svg │ │ ├── metamask-fox.svg │ │ ├── multiple-claim.svg │ │ ├── no-history.svg │ │ ├── right-arrow.svg │ │ ├── search.svg │ │ ├── settings.svg │ │ ├── transfer.svg │ │ ├── unlock.svg │ │ ├── up-triangle.svg │ │ └── xdai-logo.png │ │ ├── components │ │ ├── bridge │ │ │ ├── ActionButtons.jsx │ │ │ ├── AdvancedMenu.jsx │ │ │ ├── BridgeTokens.jsx │ │ │ ├── FromToken.jsx │ │ │ ├── SwitchButton.jsx │ │ │ ├── SystemFeedback.jsx │ │ │ ├── ToToken.jsx │ │ │ ├── TransferButton.jsx │ │ │ └── UnlockButton.jsx │ │ ├── common │ │ │ ├── AddToMetamask.jsx │ │ │ ├── BridgeDropdown.jsx │ │ │ ├── CoinzillaBannerAd.jsx │ │ │ ├── CoinzillaTextAd.jsx │ │ │ ├── ErrorFallback.jsx │ │ │ ├── Footer.jsx │ │ │ ├── Header.jsx │ │ │ ├── Layout.jsx │ │ │ ├── Logo.jsx │ │ │ ├── ProgressRing.jsx │ │ │ ├── Routes.jsx │ │ │ ├── TxLink.jsx │ │ │ ├── UpdateSettings.jsx │ │ │ ├── WalletInfo.jsx │ │ │ └── WalletSelector.jsx │ │ ├── history │ │ │ ├── BridgeHistory.jsx │ │ │ ├── HistoryItem.jsx │ │ │ ├── HistoryPagination.jsx │ │ │ ├── ManualClaim.jsx │ │ │ └── NoHistory.jsx │ │ ├── modals │ │ │ ├── AddToMetamaskModal.jsx │ │ │ ├── BridgeLoadingModal.jsx │ │ │ ├── ClaimErrorModal.jsx │ │ │ ├── ClaimTokensModal.jsx │ │ │ ├── ClaimTransferModal.jsx │ │ │ ├── ConfirmBSCTokenModal.jsx │ │ │ ├── ConfirmTransferModal.jsx │ │ │ ├── CustomTokenModal.jsx │ │ │ ├── LoadingModal.jsx │ │ │ ├── NeedsConfirmationModal.jsx │ │ │ ├── SelectTokenModal.jsx │ │ │ ├── TermsOfServiceModal.jsx │ │ │ └── TokenListModal.jsx │ │ └── warnings │ │ │ ├── AuspiciousGasWarning.jsx │ │ │ ├── BSCETHTokenWarnings.jsx │ │ │ ├── BSCGCTokenWarnings.jsx │ │ │ ├── DaiWarning.jsx │ │ │ ├── GCOriginOnBSCTokenWarning.jsx │ │ │ ├── GnosisSafeWarning.jsx │ │ │ ├── GraphHealthWarning.jsx │ │ │ ├── InflationaryTokenWarning.jsx │ │ │ ├── MedianGasWarning.jsx │ │ │ ├── NeedsTransactionsWarning.jsx │ │ │ ├── RPCHealthWarning.jsx │ │ │ ├── RebasingTokenWarning.jsx │ │ │ ├── SafeMoonTokenWarning.jsx │ │ │ ├── StakeTokenWarning.jsx │ │ │ └── TokenWarnings.jsx │ │ ├── contexts │ │ ├── BridgeContext.jsx │ │ ├── SettingsContext.jsx │ │ └── Web3Context.jsx │ │ ├── hooks │ │ ├── useAmbVersion.js │ │ ├── useApproval.js │ │ ├── useBridgeDirection.js │ │ ├── useClaim.js │ │ ├── useClaimableTransfers.js │ │ ├── useCoinzillaText.js │ │ ├── useCopyToClipboard.js │ │ ├── useENS.js │ │ ├── useETHPrice.js │ │ ├── useGasPrice.js │ │ ├── useGraphHealth.js │ │ ├── useLocalState.js │ │ ├── useMediatorInfo.js │ │ ├── useNeedsClaiming.js │ │ ├── useRPCHealth.js │ │ ├── useRefresh.js │ │ ├── useRenderChain.jsx │ │ ├── useSwitchChain.js │ │ ├── useTokenDisabled.jsx │ │ ├── useTokenLimits.js │ │ ├── useTotalConfirms.js │ │ ├── useTransactionStatus.js │ │ ├── useUpdateInterval.js │ │ ├── useUserHistory.js │ │ └── useValidatorsContract.js │ │ ├── icons │ │ ├── DownArrowIcon.jsx │ │ ├── GithubIcon.jsx │ │ ├── GnosisChainIcon.jsx │ │ ├── HistoryIcon.jsx │ │ ├── LeftIcon.jsx │ │ ├── LimitsIcon.jsx │ │ ├── NetworkIcon.jsx │ │ ├── OmniBridgeIcon.jsx │ │ ├── PlusIcon.jsx │ │ ├── RaidGuildIcon.jsx │ │ ├── RightIcon.jsx │ │ ├── SettingsIcon.jsx │ │ ├── SwitchIcon.jsx │ │ ├── TelegramIcon.jsx │ │ ├── TwitterIcon.jsx │ │ ├── WalletFilledIcon.jsx │ │ └── WalletIcon.jsx │ │ ├── index.jsx │ │ ├── lib │ │ ├── amb.js │ │ ├── bridge.js │ │ ├── chainalysis.js │ │ ├── constants.js │ │ ├── graphHealth.js │ │ ├── helpers.js │ │ ├── history.js │ │ ├── message.js │ │ ├── metamask.js │ │ ├── networks.js │ │ ├── overrides.js │ │ ├── providerHelpers.js │ │ ├── providers.js │ │ ├── token.js │ │ └── tokenList.js │ │ ├── pages │ │ ├── History.jsx │ │ └── Home.jsx │ │ ├── snapshots │ │ ├── signatures_0x258667E543C913264388B33328337257aF208a8f.json │ │ ├── signatures_0x459A3bd49F1ff109bc90b76125533699AaAAf9A6.json │ │ ├── signatures_0x674c97db4cE6caC04A124d745979f3E4cBa0E9f0.json │ │ └── signatures_0xbDc141c8D2343f33F40Cb9edD601CcF460CD0dDe.json │ │ ├── stores │ │ ├── ethPrice.js │ │ ├── gasPrice.js │ │ ├── graphHealth.js │ │ └── rpcHealth.js │ │ └── theme.js └── subgraph │ ├── config │ ├── bsc-mainnet.json │ ├── bsc-xdai.json │ ├── kovan.json │ ├── mainnet-bsc.json │ ├── mainnet.json │ ├── poa-xdai.json │ ├── sokol.json │ ├── xdai-bsc.json │ ├── xdai-poa.json │ └── xdai.json │ ├── package.json │ ├── schema.graphql │ ├── src │ ├── abis │ │ ├── amb.json │ │ ├── bridge.json │ │ ├── omnibridge.json │ │ └── token.json │ └── mappings │ │ ├── amb.ts │ │ ├── bridge.ts │ │ ├── helpers.ts │ │ ├── omnibridge.ts │ │ └── overrides.ts │ └── subgraph.template.yaml └── yarn.lock /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": ["airbnb", "prettier"], 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": ["simple-import-sort"], 9 | "settings": {}, 10 | "rules": { 11 | "import/no-default-export": "error", 12 | "import/prefer-default-export": "off", 13 | "sort-imports": "off", 14 | "import/order": "off", 15 | "simple-import-sort/imports": "warn", 16 | "simple-import-sort/exports": "warn" 17 | }, 18 | "ignorePatterns": ["packages/subgraph/**"] 19 | } 20 | -------------------------------------------------------------------------------- /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "xdai": "xdai-omnibridge", 4 | "sokol": "sokol-omnibridge" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /.github/workflows/gcp-undeploy.yaml: -------------------------------------------------------------------------------- 1 | name: Undeploy Preview from Cloud Run 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - develop 7 | types: 8 | - closed 9 | 10 | jobs: 11 | undeploy: 12 | name: Undeploy from Cloud Run 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - id: auth 17 | uses: google-github-actions/auth@v0 18 | with: 19 | credentials_json: ${{ secrets.GCP_CREDENTIALS }} 20 | 21 | - name: Set up gcloud 22 | uses: google-github-actions/setup-gcloud@v0 23 | 24 | - name: Undeploy 25 | run: gcloud -q run services delete omnibridge-ui-preview-${{github.event.number}} --region asia-east1 26 | 27 | - name: Delete image 28 | run: gcloud -q artifacts docker images delete asia-east1-docker.pkg.dev/omnibridge-ui/frontend/dev-image-${{github.event.number}} 29 | 30 | - name: Comment on pull request 31 | uses: thollander/actions-comment-pull-request@v1 32 | with: 33 | message: Successfully undeployed the Preview of this Pull Request 34 | GITHUB_TOKEN: ${{github.token}} 35 | -------------------------------------------------------------------------------- /.github/workflows/production.yml: -------------------------------------------------------------------------------- 1 | name: Build and Deploy Production 2 | on: 3 | push: 4 | branches: 5 | - master 6 | 7 | jobs: 8 | deploy: 9 | name: Build & Deploy Production 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Cancel Previous Runs 13 | uses: styfle/cancel-workflow-action@0.4.0 14 | with: 15 | access_token: ${{ github.token }} 16 | - uses: actions/checkout@v2 17 | - uses: actions/setup-node@v1 18 | with: 19 | node-version: 12.x 20 | 21 | - uses: actions/cache@v2 22 | with: 23 | path: '**/node_modules' 24 | key: nodeModules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} 25 | 26 | - name: Install Dependencies 27 | run: yarn --frozen-lockfile 28 | env: 29 | CI: true 30 | 31 | - name: Build 32 | run: yarn dapp:build 33 | env: 34 | CI: true 35 | REACT_APP_DEFAULT_BRIDGE_DIRECTION: eth-xdai 36 | REACT_APP_ENABLED_BRIDGES: 'eth-xdai bsc-xdai poa-xdai eth-bsc' 37 | REACT_APP_INFURA_ID: ${{ secrets.INFURA_ID }} 38 | REACT_APP_GAS_PRICE_FALLBACK_GWEI: 50 39 | REACT_APP_GAS_PRICE_SUPPLIER_URL: https://gasprice.poa.network/ 40 | REACT_APP_GAS_PRICE_SPEED_TYPE: fast 41 | REACT_APP_GAS_PRICE_UPDATE_INTERVAL: 60000 42 | REACT_APP_ETH_PRICE_API_URL: 'https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=USD' 43 | REACT_APP_ETH_PRICE_UPDATE_INTERVAL: 60000 44 | REACT_APP_TITLE: OmniBridge - %c 45 | REACT_APP_DESCRIPTION: 'The OmniBridge multi-token extension is the simplest way to transfer ANY ERC20/ERC677/ERC827 token to and from the xDai chain.' 46 | REACT_APP_UI_STATUS_UPDATE_INTERVAL: 5000 47 | REACT_APP_DEBUG_LOGS: false 48 | REACT_APP_GRAPH_HEALTH_UPDATE_INTERVAL: 60000 49 | REACT_APP_GRAPH_HEALTH_THRESHOLD_BLOCKS: 10 50 | REACT_APP_XDAI_RPC_URL: https://rpc.ankr.com/gnosis 51 | REACT_APP_POA_RPC_URL: https://core.poa.network 52 | REACT_APP_SOKOL_RPC_URL: https://sokol.poa.network 53 | REACT_APP_MAINNET_RPC_URL: https://mainnet.infura.io/v3/${{ secrets.INFURA_ID }} https://mainnet-nethermind.blockscout.com/ 54 | REACT_APP_KOVAN_RPC_URL: https://kovan.infura.io/v3/${{ secrets.INFURA_ID }} https://kovan.poa.network/ 55 | REACT_APP_BSC_RPC_URL: https://bsc-dataseed.binance.org https://bsc-dataseed1.defibit.io/ 56 | REACT_APP_COINZILLA_API_KEY: ${{ secrets.COINZILLA_API_KEY }} 57 | REACT_APP_OWLRACLE_API_KEY: ${{ secrets.OWLRACLE_API_KEY }} 58 | REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} 59 | 60 | - name: Deploy to Firebase 61 | uses: w9jds/firebase-action@master 62 | with: 63 | args: deploy --only hosting --project xdai 64 | env: 65 | CI: true 66 | FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} 67 | 68 | - name: Create Sentry release 69 | uses: getsentry/action-release@v1 70 | env: 71 | SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} 72 | SENTRY_ORG: ${{ secrets.SENTRY_ORG }} 73 | SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} 74 | with: 75 | environment: production 76 | -------------------------------------------------------------------------------- /.github/workflows/sokol.yml: -------------------------------------------------------------------------------- 1 | name: Build and Deploy Sokol 2 | on: 3 | push: 4 | branches: 5 | - develop 6 | 7 | jobs: 8 | deploy: 9 | name: Build & Deploy Sokol 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Cancel Previous Runs 13 | uses: styfle/cancel-workflow-action@0.4.0 14 | with: 15 | access_token: ${{ github.token }} 16 | - uses: actions/checkout@v2 17 | - uses: actions/setup-node@v1 18 | with: 19 | node-version: 12.x 20 | 21 | - uses: actions/cache@v2 22 | with: 23 | path: '**/node_modules' 24 | key: nodeModules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} 25 | 26 | - name: Install Dependencies 27 | run: yarn --frozen-lockfile 28 | env: 29 | CI: true 30 | 31 | - name: Build 32 | run: yarn dapp:build 33 | env: 34 | CI: true 35 | REACT_APP_DEFAULT_BRIDGE_DIRECTION: kovan-sokol 36 | REACT_APP_ENABLED_BRIDGES: 'eth-xdai bsc-xdai poa-xdai eth-bsc kovan-sokol' 37 | REACT_APP_INFURA_ID: ${{ secrets.PERSONAL_INFURA_ID }} 38 | REACT_APP_GAS_PRICE_FALLBACK_GWEI: 50 39 | REACT_APP_GAS_PRICE_SUPPLIER_URL: https://gasprice.poa.network/ 40 | REACT_APP_GAS_PRICE_SPEED_TYPE: fast 41 | REACT_APP_GAS_PRICE_UPDATE_INTERVAL: 60000 42 | REACT_APP_ETH_PRICE_API_URL: 'https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=USD' 43 | REACT_APP_ETH_PRICE_UPDATE_INTERVAL: 60000 44 | REACT_APP_TITLE: OmniBridge - %c 45 | REACT_APP_DESCRIPTION: 'The OmniBridge multi-token extension is the simplest way to transfer ANY ERC20/ERC677/ERC827 token to and from the xDai chain.' 46 | REACT_APP_UI_STATUS_UPDATE_INTERVAL: 5000 47 | REACT_APP_DEBUG_LOGS: true 48 | REACT_APP_GRAPH_HEALTH_UPDATE_INTERVAL: 60000 49 | REACT_APP_GRAPH_HEALTH_THRESHOLD_BLOCKS: 10 50 | REACT_APP_XDAI_RPC_URL: https://rpc.ankr.com/gnosis 51 | REACT_APP_POA_RPC_URL: https://core.poa.network 52 | REACT_APP_SOKOL_RPC_URL: https://sokol.poa.network 53 | REACT_APP_MAINNET_RPC_URL: https://mainnet.infura.io/v3/${{ secrets.PERSONAL_INFURA_ID }} https://mainnet-nethermind.blockscout.com/ 54 | REACT_APP_KOVAN_RPC_URL: https://kovan.infura.io/v3/${{ secrets.PERSONAL_INFURA_ID }} https://kovan.poa.network/ 55 | REACT_APP_BSC_RPC_URL: https://bsc-dataseed.binance.org https://bsc-dataseed1.defibit.io/ 56 | REACT_APP_COINZILLA_API_KEY: ${{ secrets.COINZILLA_API_KEY }} 57 | REACT_APP_OWLRACLE_API_KEY: ${{ secrets.OWLRACLE_API_KEY }} 58 | REACT_APP_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} 59 | 60 | - name: Deploy to Firebase 61 | uses: w9jds/firebase-action@master 62 | with: 63 | args: deploy --only hosting --project sokol 64 | env: 65 | CI: true 66 | FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} 67 | 68 | - name: Create Sentry release 69 | uses: getsentry/action-release@v1 70 | env: 71 | SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} 72 | SENTRY_ORG: ${{ secrets.SENTRY_ORG }} 73 | SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} 74 | with: 75 | environment: sokol 76 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | .pnp 6 | .pnp.js 7 | 8 | # testing 9 | coverage 10 | 11 | # production 12 | build 13 | 14 | # misc 15 | .DS_Store 16 | .env* 17 | 18 | # debug 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | 23 | # subgraph 24 | packages/subgraph/build/ 25 | packages/subgraph/src/types/ 26 | 27 | # vim 28 | *.swp 29 | 30 | # firebase 31 | .firebase/* 32 | firebase-debug.log* 33 | 34 | # eslint 35 | .eslintcache 36 | 37 | # subgraph 38 | subgraph.yaml 39 | 40 | # package-lock 41 | package-lock.json 42 | 43 | # yarn 44 | .yarn* 45 | .yarnrc 46 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn lint-staged 5 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "singleQuote": true, 4 | "trailingComma": "all", 5 | "tabWidth": 2, 6 | "arrowParens": "avoid", 7 | "overrides": [ 8 | { 9 | "files": "overrides.js", 10 | "options": { 11 | "printWidth": 90 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Stage 1 - the build process 2 | 3 | FROM node:16 AS build 4 | 5 | WORKDIR /usr/src/app 6 | 7 | COPY yarn.lock . 8 | COPY package.json . 9 | COPY .eslintrc.json . 10 | COPY packages/dapp/src ./packages/dapp/src 11 | COPY packages/dapp/public ./packages/dapp/public 12 | COPY packages/dapp/package.json ./packages/dapp/package.json 13 | COPY packages/dapp/jsconfig.json ./packages/dapp/jsconfig.json 14 | COPY packages/dapp/.eslintrc.json ./packages/dapp/.eslintrc.json 15 | 16 | ARG REACT_APP_DEFAULT_BRIDGE_DIRECTION 17 | ARG REACT_APP_ENABLED_BRIDGES 18 | ARG REACT_APP_INFURA_ID 19 | ARG REACT_APP_GAS_PRICE_FALLBACK_GWEI 20 | ARG REACT_APP_GAS_PRICE_SUPPLIER_URL 21 | ARG REACT_APP_GAS_PRICE_SPEED_TYPE 22 | ARG REACT_APP_GAS_PRICE_UPDATE_INTERVAL 23 | ARG REACT_APP_ETH_PRICE_API_URL 24 | ARG REACT_APP_ETH_PRICE_UPDATE_INTERVAL 25 | ARG REACT_APP_TITLE 26 | ARG REACT_APP_DESCRIPTION 27 | ARG REACT_APP_UI_STATUS_UPDATE_INTERVAL 28 | ARG REACT_APP_DEBUG_LOGS 29 | ARG REACT_APP_GRAPH_HEALTH_UPDATE_INTERVAL 30 | ARG REACT_APP_GRAPH_HEALTH_THRESHOLD_BLOCKS 31 | ARG REACT_APP_XDAI_RPC_URL 32 | ARG REACT_APP_POA_RPC_URL 33 | ARG REACT_APP_SOKOL_RPC_URL 34 | ARG REACT_APP_MAINNET_RPC_URL 35 | ARG REACT_APP_KOVAN_RPC_URL 36 | ARG REACT_APP_BSC_RPC_URL 37 | ARG REACT_APP_COINZILLA_API_KEY 38 | ARG REACT_APP_OWLRACLE_API_KEY 39 | ARG REACT_APP_SENTRY_DSN 40 | 41 | ENV REACT_APP_DEFAULT_BRIDGE_DIRECTION $REACT_APP_DEFAULT_BRIDGE_DIRECTION 42 | ENV REACT_APP_ENABLED_BRIDGES $REACT_APP_ENABLED_BRIDGES 43 | ENV REACT_APP_INFURA_ID $REACT_APP_INFURA_ID 44 | ENV REACT_APP_GAS_PRICE_FALLBACK_GWEI $REACT_APP_GAS_PRICE_FALLBACK_GWEI 45 | ENV REACT_APP_GAS_PRICE_SUPPLIER_URL $REACT_APP_GAS_PRICE_SUPPLIER_URL 46 | ENV REACT_APP_GAS_PRICE_SPEED_TYPE $REACT_APP_GAS_PRICE_SPEED_TYPE 47 | ENV REACT_APP_GAS_PRICE_UPDATE_INTERVAL $REACT_APP_GAS_PRICE_UPDATE_INTERVAL 48 | ENV REACT_APP_ETH_PRICE_API_URL $REACT_APP_ETH_PRICE_API_URL 49 | ENV REACT_APP_ETH_PRICE_UPDATE_INTERVAL $REACT_APP_ETH_PRICE_UPDATE_INTERVAL 50 | ENV REACT_APP_TITLE $REACT_APP_TITLE 51 | ENV REACT_APP_DESCRIPTION $REACT_APP_DESCRIPTION 52 | ENV REACT_APP_UI_STATUS_UPDATE_INTERVAL $REACT_APP_UI_STATUS_UPDATE_INTERVAL 53 | ENV REACT_APP_DEBUG_LOGS $REACT_APP_DEBUG_LOGS 54 | ENV REACT_APP_GRAPH_HEALTH_UPDATE_INTERVAL $REACT_APP_GRAPH_HEALTH_UPDATE_INTERVAL 55 | ENV REACT_APP_GRAPH_HEALTH_THRESHOLD_BLOCKS $REACT_APP_GRAPH_HEALTH_THRESHOLD_BLOCKS 56 | ENV REACT_APP_XDAI_RPC_URL $REACT_APP_XDAI_RPC_URL 57 | ENV REACT_APP_POA_RPC_URL $REACT_APP_POA_RPC_URL 58 | ENV REACT_APP_SOKOL_RPC_URL $REACT_APP_SOKOL_RPC_URL 59 | ENV REACT_APP_MAINNET_RPC_URL $REACT_APP_MAINNET_RPC_URL 60 | ENV REACT_APP_KOVAN_RPC_URL $REACT_APP_KOVAN_RPC_URL 61 | ENV REACT_APP_BSC_RPC_URL $REACT_APP_BSC_RPC_URL 62 | ENV REACT_APP_COINZILLA_API_KEY $REACT_APP_COINZILLA_API_KEY 63 | ENV REACT_APP_OWLRACLE_API_KEY $REACT_APP_OWLRACLE_API_KEY 64 | ENV REACT_APP_SENTRY_DSN $REACT_APP_SENTRY_DSN 65 | 66 | RUN yarn install --frozen-lockfile 67 | 68 | RUN yarn dapp:build 69 | 70 | # Stage 2 - the production environment 71 | 72 | FROM nginx:alpine 73 | 74 | COPY ./nginx.conf /etc/nginx/conf.d/default.conf 75 | 76 | WORKDIR /usr/share/nginx/html 77 | 78 | RUN rm -rf ./* 79 | 80 | COPY --from=build /usr/src/app/packages/dapp/build . 81 | 82 | EXPOSE 3000 83 | 84 | ENTRYPOINT ["nginx", "-g", "daemon off;"] 85 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Omnibridge 2 | 3 | The OmniBridge [multi-token extension](https://docs.tokenbridge.net/eth-xdai-amb-bridge/multi-token-extension) for the Arbitrary Message Bridge is the simplest way to transfer ANY ERC20/ERC677/ERC827 token to and from the xDai chain. 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### React App 10 | 11 | #### `yarn dapp:start` 12 | 13 | Runs the React app in development mode.
14 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 15 | 16 | The page will automatically reload if you make changes to the code.
17 | You will see the build errors and lint warnings in the console. 18 | 19 | #### `yarn dapp:test` 20 | 21 | Runs the React test watcher in an interactive mode.
22 | By default, runs tests related to files changed since the last commit. 23 | 24 | #### `yarn dapp:build` 25 | 26 | Builds the React app for production to the `build` folder.
27 | It correctly bundles React in production mode and optimizes the build for the best performance. 28 | 29 | The build is minified and the filenames include the hashes.
30 | Your app is ready to be deployed! 31 | 32 | ### Subgraph 33 | 34 | #### `yarn subgraph:auth` 35 | 36 | ```sh 37 | GRAPH_ACCESS_TOKEN=your-access-token-here yarn subgraph:auth 38 | ``` 39 | 40 | #### `yarn subgraph:prepare-` 41 | 42 | Generates subgraph.yaml for particular network. 43 | Supported networks are kovan, sokol, xdai and mainnet. 44 | 45 | #### `yarn subgraph:codegen` 46 | 47 | Generates AssemblyScript types for smart contract ABIs and the subgraph schema. 48 | 49 | #### `yarn subgraph:build` 50 | 51 | Compiles the subgraph to WebAssembly. 52 | 53 | #### `yarn subgraph:deploy-` 54 | 55 | Deploys the subgraph for particular network to the official Graph Node.
56 | 57 | - 58 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.8' 2 | services: 3 | dapp: 4 | build: 5 | context: . 6 | args: 7 | REACT_APP_DEFAULT_BRIDGE_DIRECTION: ${REACT_APP_DEFAULT_BRIDGE_DIRECTION} 8 | REACT_APP_ENABLED_BRIDGES: ${REACT_APP_ENABLED_BRIDGES} 9 | REACT_APP_INFURA_ID: ${REACT_APP_INFURA_ID} 10 | REACT_APP_GAS_PRICE_FALLBACK_GWEI: ${REACT_APP_GAS_PRICE_FALLBACK_GWEI} 11 | REACT_APP_GAS_PRICE_SUPPLIER_URL: ${REACT_APP_GAS_PRICE_SUPPLIER_URL} 12 | REACT_APP_GAS_PRICE_SPEED_TYPE: ${REACT_APP_GAS_PRICE_SPEED_TYPE} 13 | REACT_APP_GAS_PRICE_UPDATE_INTERVAL: ${REACT_APP_GAS_PRICE_UPDATE_INTERVAL} 14 | REACT_APP_ETH_PRICE_API_URL: ${REACT_APP_ETH_PRICE_API_URL} 15 | REACT_APP_ETH_PRICE_UPDATE_INTERVAL: ${REACT_APP_ETH_PRICE_UPDATE_INTERVAL} 16 | REACT_APP_TITLE: ${REACT_APP_TITLE} 17 | REACT_APP_DESCRIPTION: ${REACT_APP_DESCRIPTION} 18 | REACT_APP_UI_STATUS_UPDATE_INTERVAL: ${REACT_APP_UI_STATUS_UPDATE_INTERVAL} 19 | REACT_APP_DEBUG_LOGS: ${REACT_APP_DEBUG_LOGS} 20 | REACT_APP_GRAPH_HEALTH_UPDATE_INTERVAL: ${REACT_APP_GRAPH_HEALTH_UPDATE_INTERVAL} 21 | REACT_APP_GRAPH_HEALTH_THRESHOLD_BLOCKS: ${REACT_APP_GRAPH_HEALTH_THRESHOLD_BLOCKS} 22 | REACT_APP_XDAI_RPC_URL: ${REACT_APP_XDAI_RPC_URL} 23 | REACT_APP_POA_RPC_URL: ${REACT_APP_POA_RPC_URL} 24 | REACT_APP_SOKOL_RPC_URL: ${REACT_APP_SOKOL_RPC_URL} 25 | REACT_APP_MAINNET_RPC_URL: ${REACT_APP_MAINNET_RPC_URL} 26 | REACT_APP_KOVAN_RPC_URL: ${REACT_APP_KOVAN_RPC_URL} 27 | REACT_APP_BSC_RPC_URL: ${REACT_APP_BSC_RPC_URL} 28 | REACT_APP_COINZILLA_API_KEY: ${REACT_APP_COINZILLA_API_KEY} 29 | REACT_APP_OWLRACLE_API_KEY: ${REACT_APP_OWLRACLE_API_KEY} 30 | REACT_APP_SENTRY_DSN: ${REACT_APP_SENTRY_DSN} 31 | ports: 32 | - 3000:3000 33 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "packages/dapp/build", 4 | "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], 5 | "rewrites": [ 6 | { 7 | "source": "**", 8 | "destination": "/index.html" 9 | } 10 | ], 11 | "headers": [ 12 | { 13 | "source": "**/*.@(jpg|svg|png|json)", 14 | "headers": [ 15 | { 16 | "key": "Access-Control-Allow-Origin", 17 | "value": "*" 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | 3 | listen 3000; 4 | 5 | location / { 6 | # This would be the directory where your React app's static files are stored at 7 | root /usr/share/nginx/html; 8 | try_files $uri /index.html; 9 | } 10 | 11 | location ~* \.(jpg|svg|png|json)$ { 12 | root /usr/share/nginx/html; 13 | add_header Access-Control-Allow-Origin *; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@omnibridge/ui", 3 | "version": "1.0.0", 4 | "keywords": [ 5 | "ethereum", 6 | "react", 7 | "workspaces", 8 | "yarn" 9 | ], 10 | "private": true, 11 | "scripts": { 12 | "subgraph:auth": "yarn workspace @omnibridge/subgraph auth", 13 | "subgraph:codegen": "yarn workspace @omnibridge/subgraph codegen", 14 | "subgraph:build": "yarn workspace @omnibridge/subgraph build", 15 | "subgraph:prepare-kovan": "yarn workspace @omnibridge/subgraph prepare-kovan", 16 | "subgraph:deploy-kovan": "yarn workspace @omnibridge/subgraph deploy-kovan", 17 | "subgraph:prepare-sokol": "yarn workspace @omnibridge/subgraph prepare-sokol", 18 | "subgraph:deploy-sokol": "yarn workspace @omnibridge/subgraph deploy-sokol", 19 | "subgraph:prepare-xdai": "yarn workspace @omnibridge/subgraph prepare-xdai", 20 | "subgraph:deploy-xdai": "yarn workspace @omnibridge/subgraph deploy-xdai", 21 | "subgraph:prepare-mainnet": "yarn workspace @omnibridge/subgraph prepare-mainnet", 22 | "subgraph:deploy-mainnet": "yarn workspace @omnibridge/subgraph deploy-mainnet", 23 | "subgraph:prepare-xdai-bsc": "yarn workspace @omnibridge/subgraph prepare-xdai-bsc", 24 | "subgraph:deploy-xdai-bsc": "yarn workspace @omnibridge/subgraph deploy-xdai-bsc", 25 | "subgraph:prepare-bsc-xdai": "yarn workspace @omnibridge/subgraph prepare-bsc-xdai", 26 | "subgraph:deploy-bsc-xdai": "yarn workspace @omnibridge/subgraph deploy-bsc-xdai", 27 | "subgraph:prepare-mainnet-bsc": "yarn workspace @omnibridge/subgraph prepare-mainnet-bsc", 28 | "subgraph:deploy-mainnet-bsc": "yarn workspace @omnibridge/subgraph deploy-mainnet-bsc", 29 | "subgraph:prepare-bsc-mainnet": "yarn workspace @omnibridge/subgraph prepare-bsc-mainnet", 30 | "subgraph:deploy-bsc-mainnet": "yarn workspace @omnibridge/subgraph deploy-bsc-mainnet", 31 | "dapp:build": "yarn workspace @omnibridge/dapp build", 32 | "dapp:eject": "yarn workspace @omnibridge/dapp eject", 33 | "dapp:start": "yarn workspace @omnibridge/dapp start", 34 | "dapp:test": "yarn workspace @omnibridge/dapp test", 35 | "dapp:lint": "yarn workspace @omnibridge/dapp lint", 36 | "lint": "eslint --ignore-path .gitignore \"./packages/**/*.{ts,tsx,js,jsx}\"", 37 | "format": "prettier --ignore-path .gitignore --write \"{*,**/*}.{ts,tsx,js,jsx,json,md}\"", 38 | "prepare": "husky install" 39 | }, 40 | "workspaces": { 41 | "nohoist": [ 42 | "**/@graphprotocol/graph-ts", 43 | "**/@graphprotocol/graph-ts/**" 44 | ], 45 | "packages": [ 46 | "packages/*" 47 | ] 48 | }, 49 | "devDependencies": { 50 | "eslint-config-airbnb": "^19.0.4", 51 | "eslint-config-prettier": "^8.5.0", 52 | "eslint-plugin-import": "^2.26.0", 53 | "eslint-plugin-jsx-a11y": "^6.5.1", 54 | "eslint-plugin-react": "^7.29.4", 55 | "eslint-plugin-react-hooks": "^4.4.0", 56 | "eslint-plugin-simple-import-sort": "^7.0.0", 57 | "husky": "^7.0.4", 58 | "lint-staged": "^12.3.7", 59 | "prettier": "^2.6.2" 60 | }, 61 | "license": "UNLICENSED", 62 | "lint-staged": { 63 | "*.{ts,tsx,js,jsx}": [ 64 | "eslint --fix", 65 | "prettier --write" 66 | ], 67 | "*.{json,md}": "prettier --write" 68 | }, 69 | "dependencies": {}, 70 | "resolutions": { 71 | "react-error-overlay": "6.0.9" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /packages/dapp/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "extends": ["airbnb", "prettier", "react-app", "plugin:import/recommended"], 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": ["simple-import-sort"], 9 | "settings": { 10 | "import/resolver": { 11 | "node": { 12 | "extensions": [".js", ".jsx", ".d.ts", ".ts", ".tsx"], 13 | "moduleDirectory": ["node_modules", "src"] 14 | } 15 | } 16 | }, 17 | "rules": { 18 | "import/no-default-export": "error", 19 | "import/prefer-default-export": "off", 20 | "import/no-relative-packages": "warn", 21 | "sort-imports": "off", 22 | "import/order": "off", 23 | "simple-import-sort/imports": "warn", 24 | "simple-import-sort/exports": "warn", 25 | "react/jsx-props-no-spreading": "off", 26 | "react/function-component-definition": "off", 27 | "react/prop-types": "off", 28 | "arrow-body-style": "warn" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/dapp/.sample-env: -------------------------------------------------------------------------------- 1 | REACT_APP_DEFAULT_BRIDGE_DIRECTION=kovan-sokol 2 | REACT_APP_ENABLED_BRIDGES=eth-xdai bsc-xdai poa-xdai eth-bsc kovan-sokol 3 | REACT_APP_INFURA_ID= 4 | REACT_APP_GAS_PRICE_SUPPLIER_URL=https://gasprice.poa.network/ 5 | REACT_APP_GAS_PRICE_SPEED_TYPE=standard 6 | REACT_APP_GAS_PRICE_FALLBACK_GWEI=50 7 | REACT_APP_GAS_PRICE_UPDATE_INTERVAL=60000 8 | REACT_APP_ETH_PRICE_API_URL=https://api.coingecko.com/api/v3/simple/price?ids=ethereum&vs_currencies=USD 9 | REACT_APP_ETH_PRICE_UPDATE_INTERVAL=60000 10 | REACT_APP_TITLE=OmniBridge - %c 11 | REACT_APP_DESCRIPTION=The OmniBridge multi-token extension is the simplest way to transfer ANY ERC20/ERC677/ERC827 token to and from the xDai chain. 12 | REACT_APP_UI_STATUS_UPDATE_INTERVAL=5000 13 | REACT_APP_DEBUG_LOGS=true 14 | REACT_APP_GRAPH_HEALTH_UPDATE_INTERVAL=60000 15 | REACT_APP_GRAPH_HEALTH_THRESHOLD_BLOCKS=10 16 | REACT_APP_COINZILLA_API_KEY= 17 | REACT_APP_OWLRACLE_API_KEY= 18 | REACT_APP_SENTRY_DSN= 19 | 20 | 21 | REACT_APP_XDAI_RPC_URL=https://rpc.xdaichain.com https://dai.poa.network 22 | REACT_APP_POA_RPC_URL=https://core.poa.network 23 | REACT_APP_SOKOL_RPC_URL=https://sokol.poa.network 24 | REACT_APP_MAINNET_RPC_URL=https://mainnet.infura.io/v3/ https://mainnet-nethermind.blockscout.com/ 25 | REACT_APP_KOVAN_RPC_URL=https://kovan.infura.io/v3/ https://kovan.poa.network/ 26 | REACT_APP_BSC_RPC_URL=https://bsc-dataseed.binance.org https://bsc-dataseed1.defibit.io/ 27 | -------------------------------------------------------------------------------- /packages/dapp/.unimportedrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "ignoreUnresolved": [], 3 | "ignoreUnimported": [], 4 | "ignoreUnused": [], 5 | "ignorePatterns": [ 6 | "**/node_modules/**", 7 | "**/*.stories.{js,jsx,ts,tsx}", 8 | "**/*.tests.{js,jsx,ts,tsx}", 9 | "**/*.test.{js,jsx,ts,tsx}", 10 | "**/*.spec.{js,jsx,ts,tsx}", 11 | "**/tests/**", 12 | "**/__tests__/**", 13 | "**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /packages/dapp/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "src", 4 | "include": ["src"] 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/dapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@omnibridge/dapp", 3 | "version": "1.0.0", 4 | "browserslist": { 5 | "production": [ 6 | ">0.2%", 7 | "not dead", 8 | "not op_mini all" 9 | ], 10 | "development": [ 11 | "last 1 chrome version", 12 | "last 1 firefox version", 13 | "last 1 safari version" 14 | ] 15 | }, 16 | "dependencies": { 17 | "@chakra-ui/icons": "^1.0.15", 18 | "@chakra-ui/react": "^1.8.7", 19 | "@chakra-ui/theme": "^1.10.0", 20 | "@davatar/react": "^1.8.1", 21 | "@emotion/react": "^11.9.0", 22 | "@emotion/styled": "^11.3.0", 23 | "@gnosis.pm/safe-apps-web3modal": "^12.0.0", 24 | "@sentry/react": "^6.19.7", 25 | "@sentry/tracing": "^6.19.7", 26 | "@uniswap/token-lists": "^1.0.0-beta.21", 27 | "@walletconnect/web3-provider": "^1.7.7", 28 | "ajv": "^6.12.6", 29 | "copy-to-clipboard": "^3.3.1", 30 | "ethers": "^5.4.4", 31 | "fast-memoize": "^2.5.2", 32 | "focus-visible": "^5.2.0", 33 | "framer-motion": "^4.1.17", 34 | "gas-price-oracle": "^0.3.3", 35 | "graphql": "^16.5.0", 36 | "graphql-request": "^3.5.0", 37 | "query-string": "^7.0.1", 38 | "react": "^17.0.2", 39 | "react-dom": "^17.0.2", 40 | "react-router-dom": "^5.2.0", 41 | "react-scripts": "^4.0.3", 42 | "walletlink": "^2.1.9", 43 | "web3modal": "^1.9.6" 44 | }, 45 | "license": "UNLICENSED", 46 | "scripts": { 47 | "build": "GENERATE_SOURCEMAP=false react-scripts build", 48 | "eject": "react-scripts eject", 49 | "start": "react-scripts start", 50 | "test": "react-scripts test", 51 | "lint": "eslint \"./src/**/*.{js,jsx}\"" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /packages/dapp/public/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/public/android-chrome-192x192.png -------------------------------------------------------------------------------- /packages/dapp/public/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/public/android-chrome-512x512.png -------------------------------------------------------------------------------- /packages/dapp/public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/public/apple-touch-icon.png -------------------------------------------------------------------------------- /packages/dapp/public/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #ffffff 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/dapp/public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/public/favicon-16x16.png -------------------------------------------------------------------------------- /packages/dapp/public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/public/favicon-32x32.png -------------------------------------------------------------------------------- /packages/dapp/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/public/favicon.ico -------------------------------------------------------------------------------- /packages/dapp/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 14 | 20 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | OmniBridge 41 | 42 | 43 | 44 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /packages/dapp/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "OmniBridge", 3 | "name": "OmniBridge", 4 | "description": "The OmniBridge is the simplest way to transfer ANY ERC20/ERC677/ERC827 token to and from the xDai chain.", 5 | "iconPath": "android-chrome-512x512.png", 6 | "providedBy": { "name": "xDai Chain", "url": "https://xdaichain.com" }, 7 | "icons": [ 8 | { 9 | "src": "android-chrome-192x192.png", 10 | "sizes": "192x192", 11 | "type": "image/png" 12 | }, 13 | { 14 | "src": "android-chrome-512x512.png", 15 | "sizes": "512x512", 16 | "type": "image/png" 17 | } 18 | ], 19 | "start_url": ".", 20 | "display": "standalone", 21 | "theme_color": "#EEF4FD", 22 | "background_color": "#EEF4FD" 23 | } 24 | -------------------------------------------------------------------------------- /packages/dapp/public/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/public/mstile-150x150.png -------------------------------------------------------------------------------- /packages/dapp/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /packages/dapp/public/safari-pinned-tab.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | Created by potrace 1.11, written by Peter Selinger 2001-2013 9 | 10 | 12 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/dapp/src/App.jsx: -------------------------------------------------------------------------------- 1 | import 'focus-visible/dist/focus-visible'; 2 | 3 | import { ChakraProvider, CSSReset } from '@chakra-ui/react'; 4 | import { css, Global } from '@emotion/react'; 5 | import { ErrorBoundary } from '@sentry/react'; 6 | import { ErrorFallback } from 'components/common/ErrorFallback'; 7 | import { Layout } from 'components/common/Layout'; 8 | import { Routes } from 'components/common/Routes'; 9 | import { SettingsProvider } from 'contexts/SettingsContext'; 10 | import { Web3Provider } from 'contexts/Web3Context'; 11 | import { logError } from 'lib/helpers'; 12 | import React from 'react'; 13 | import { BrowserRouter as Router } from 'react-router-dom'; 14 | import { theme } from 'theme'; 15 | 16 | const GlobalStyles = css` 17 | /* 18 | This will hide the focus indicator if the element receives focus via the mouse, 19 | but it will still show up on keyboard focus. 20 | */ 21 | .js-focus-visible :focus:not([data-focus-visible-added]) { 22 | outline: none; 23 | box-shadow: none; 24 | } 25 | `; 26 | 27 | export const App = () => ( 28 | 29 | 30 | 31 | } 33 | onError={error => logError(error)} 34 | > 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | ); 47 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/alert.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/blue-tick.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/bsc-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/src/assets/bsc-logo.png -------------------------------------------------------------------------------- /packages/dapp/src/assets/change-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/src/assets/change-network.png -------------------------------------------------------------------------------- /packages/dapp/src/assets/claim.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/coinbase.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/confirm-transfer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/down-triangle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/drop-down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/error.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/eth-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/src/assets/eth-logo.png -------------------------------------------------------------------------------- /packages/dapp/src/assets/eth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/src/assets/eth.png -------------------------------------------------------------------------------- /packages/dapp/src/assets/imtoken.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/info.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/loading.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/metamask-fox.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/right-arrow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/search.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/transfer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/unlock.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/up-triangle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/dapp/src/assets/xdai-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omni/omnibridge-ui/ac183732f2b5ba0dddaaa919ecf56239907421d8/packages/dapp/src/assets/xdai-logo.png -------------------------------------------------------------------------------- /packages/dapp/src/components/bridge/ActionButtons.jsx: -------------------------------------------------------------------------------- 1 | import { Flex, Tooltip } from '@chakra-ui/react'; 2 | import { TransferButton } from 'components/bridge/TransferButton'; 3 | import { UnlockButton } from 'components/bridge/UnlockButton'; 4 | import { useBridgeContext } from 'contexts/BridgeContext'; 5 | import { useWeb3Context } from 'contexts/Web3Context'; 6 | import { useApproval } from 'hooks/useApproval'; 7 | import { getNetworkName } from 'lib/helpers'; 8 | import React from 'react'; 9 | 10 | export const ActionButtons = ({ tokenLimits }) => { 11 | const { fromToken, fromAmount, txHash } = useBridgeContext(); 12 | const approval = useApproval(fromToken, fromAmount, txHash); 13 | const { isConnected, providerChainId, isSanctioned } = useWeb3Context(); 14 | 15 | const isValid = 16 | !isSanctioned && isConnected && providerChainId === fromToken?.chainId; 17 | 18 | const inner = ( 19 | 27 | 28 | 29 | 30 | ); 31 | 32 | let tooltipTitle = ''; 33 | 34 | if (!isValid) { 35 | if (isConnected) { 36 | if (isSanctioned) { 37 | tooltipTitle = 'Bridging is blocked'; 38 | } else { 39 | tooltipTitle = `Please switch to ${getNetworkName(fromToken?.chainId)}`; 40 | } 41 | } else { 42 | tooltipTitle = 'Please connect your wallet'; 43 | } 44 | } 45 | 46 | return isValid ? inner : {inner}; 47 | }; 48 | -------------------------------------------------------------------------------- /packages/dapp/src/components/bridge/AdvancedMenu.jsx: -------------------------------------------------------------------------------- 1 | import { CloseIcon } from '@chakra-ui/icons'; 2 | import { 3 | Button, 4 | Flex, 5 | Input, 6 | InputGroup, 7 | InputRightElement, 8 | useDisclosure, 9 | } from '@chakra-ui/react'; 10 | import { useBridgeContext } from 'contexts/BridgeContext'; 11 | import { useWeb3Context } from 'contexts/Web3Context'; 12 | import { utils } from 'ethers'; 13 | import React, { useCallback } from 'react'; 14 | 15 | export const AdvancedMenu = () => { 16 | const { isGnosisSafe } = useWeb3Context(); 17 | const { isOpen, onOpen, onClose } = useDisclosure(); 18 | const { receiver, setReceiver } = useBridgeContext(); 19 | 20 | const isMenuOpen = isOpen || isGnosisSafe; 21 | 22 | const onClick = useCallback(() => { 23 | if (isMenuOpen) { 24 | setReceiver(''); 25 | if (!isGnosisSafe) onClose(); 26 | } else { 27 | onOpen(); 28 | } 29 | }, [isMenuOpen, setReceiver, isGnosisSafe, onOpen, onClose]); 30 | 31 | return ( 32 | 39 | 48 | {isMenuOpen ? ( 49 | 50 | setReceiver(e.target.value)} 58 | isInvalid={!!receiver && !utils.isAddress(receiver)} 59 | _focus={{ boxShadow: '0 0 0 3px rgba(66, 153, 225, 0.6)' }} 60 | _invalid={{ 61 | boxShadow: '0 0 0 3px #ef5d5d !important', 62 | }} 63 | /> 64 | 65 | 73 | 74 | 75 | ) : ( 76 | 87 | )} 88 | 89 | 90 | ); 91 | }; 92 | -------------------------------------------------------------------------------- /packages/dapp/src/components/bridge/SwitchButton.jsx: -------------------------------------------------------------------------------- 1 | import { IconButton, Tooltip } from '@chakra-ui/react'; 2 | import { useBridgeContext } from 'contexts/BridgeContext'; 3 | import { useWeb3Context } from 'contexts/Web3Context'; 4 | import { useSwitchChain } from 'hooks/useSwitchChain'; 5 | import { SwitchIcon } from 'icons/SwitchIcon'; 6 | import React, { useCallback, useState } from 'react'; 7 | 8 | export const SwitchButton = () => { 9 | const { isConnected, providerChainId, isMetamask } = useWeb3Context(); 10 | 11 | const { switchTokens, toToken } = useBridgeContext(); 12 | const switchChain = useSwitchChain(); 13 | 14 | const isDefaultChain = [1, 3, 4, 5, 42].includes(toToken?.chainId); 15 | const isMobileBrowser = navigator?.userAgent?.includes('Mobile') ?? false; 16 | const canSwitchInWallet = 17 | isConnected && isMetamask && (isMobileBrowser ? !isDefaultChain : true); 18 | 19 | const [loading, setLoading] = useState(false); 20 | 21 | const switchOnClick = useCallback( 22 | () => 23 | (async () => { 24 | setLoading(true); 25 | if (canSwitchInWallet && providerChainId !== toToken?.chainId) { 26 | await switchChain(toToken?.chainId); 27 | } else { 28 | switchTokens(); 29 | } 30 | setLoading(false); 31 | })(), 32 | [switchChain, providerChainId, canSwitchInWallet, switchTokens, toToken], 33 | ); 34 | 35 | return ( 36 | 37 | } 39 | p="0.5rem" 40 | variant="ghost" 41 | position="absolute" 42 | top={{ base: '50%', lg: '0' }} 43 | left={{ base: '0', lg: '50%' }} 44 | transform={{ 45 | base: 'translateY(-50%) translateX(0.5rem) rotate(90deg)', 46 | lg: 'translateX(-50%) translateY(calc(-100% - 1.25rem))', 47 | }} 48 | borderRadius="0.5rem" 49 | color="blue.500" 50 | _hover={{ bg: '#EEF4FD' }} 51 | onClick={switchOnClick} 52 | isLoading={loading} 53 | _loading={{ 54 | bg: '#EEF4FD', 55 | }} 56 | /> 57 | 58 | ); 59 | }; 60 | -------------------------------------------------------------------------------- /packages/dapp/src/components/common/AddToMetamask.jsx: -------------------------------------------------------------------------------- 1 | import { Image, useDisclosure, useToast } from '@chakra-ui/react'; 2 | import MetamaskFox from 'assets/metamask-fox.svg'; 3 | import { AddToMetamaskModal } from 'components/modals/AddToMetamaskModal'; 4 | import { useWeb3Context } from 'contexts/Web3Context'; 5 | import { ADDRESS_ZERO } from 'lib/constants'; 6 | import { getNetworkName, logError } from 'lib/helpers'; 7 | import { addTokenToMetamask } from 'lib/metamask'; 8 | import React, { useCallback } from 'react'; 9 | 10 | export const AddToMetamask = ({ token, asModal = false, ...props }) => { 11 | const { providerChainId, isMetamask } = useWeb3Context(); 12 | const toast = useToast(); 13 | const { isOpen, onOpen, onClose } = useDisclosure(); 14 | 15 | const showError = useCallback( 16 | msg => { 17 | if (msg) { 18 | toast({ 19 | title: 'Error: Unable to add token', 20 | description: msg, 21 | status: 'error', 22 | isClosable: 'true', 23 | }); 24 | } 25 | }, 26 | [toast], 27 | ); 28 | 29 | const addToken = useCallback(async () => { 30 | if (providerChainId !== token.chainId) { 31 | showError(`Please switch wallet to ${getNetworkName(token.chainId)}`); 32 | } else { 33 | await addTokenToMetamask(token).catch(metamaskError => { 34 | logError({ metamaskError }); 35 | if (metamaskError && metamaskError.message) { 36 | showError( 37 | `Please add the token ${token.address} manually in the wallet app. Got message: "${metamaskError.message}"`, 38 | ); 39 | } 40 | }); 41 | } 42 | }, [showError, token, providerChainId]); 43 | 44 | const onClick = useCallback(() => { 45 | if (asModal) { 46 | onOpen(); 47 | } else { 48 | addToken(); 49 | } 50 | }, [onOpen, asModal, addToken]); 51 | 52 | return isMetamask ? ( 53 | <> 54 | {token.address !== ADDRESS_ZERO && ( 55 | metamask-fox 63 | )} 64 | {asModal && isOpen && ( 65 | 66 | )} 67 | 68 | ) : null; 69 | }; 70 | -------------------------------------------------------------------------------- /packages/dapp/src/components/common/BridgeDropdown.jsx: -------------------------------------------------------------------------------- 1 | import { 2 | Button, 3 | Menu, 4 | MenuButton, 5 | MenuItem, 6 | MenuList, 7 | Text, 8 | useBreakpointValue, 9 | } from '@chakra-ui/react'; 10 | import { useSettings } from 'contexts/SettingsContext'; 11 | import { DownArrowIcon } from 'icons/DownArrowIcon'; 12 | import { NetworkIcon } from 'icons/NetworkIcon'; 13 | import { networks } from 'lib/networks'; 14 | import React, { useCallback, useEffect } from 'react'; 15 | 16 | export const BridgeDropdown = ({ close }) => { 17 | const { bridgeDirection, setBridgeDirection } = useSettings(); 18 | const placement = useBreakpointValue({ base: 'bottom', md: 'bottom-end' }); 19 | 20 | const setItem = useCallback( 21 | e => { 22 | setBridgeDirection(e.target.value, true); 23 | close(); 24 | }, 25 | [close, setBridgeDirection], 26 | ); 27 | 28 | const networkOptions = Object.keys(networks); 29 | const isValidNetwork = Object.keys(networks).indexOf(bridgeDirection) >= 0; 30 | 31 | const currentBridgeDirection = isValidNetwork 32 | ? bridgeDirection 33 | : networkOptions[0]; 34 | 35 | useEffect(() => { 36 | if (!isValidNetwork) { 37 | setBridgeDirection(networkOptions[0], true); 38 | } 39 | }, [isValidNetwork, networkOptions, setBridgeDirection]); 40 | 41 | return ( 42 | 43 | } 46 | rightIcon={} 47 | color="grey" 48 | bg="none" 49 | _hover={{ color: 'blue.500', bgColor: 'blackAlpha.100' }} 50 | p={2} 51 | > 52 | 53 | {networks[currentBridgeDirection].label} 54 | 55 | 56 | 57 | {Object.entries(networks).map(([key, { label }]) => ( 58 | 67 | {label} 68 | 69 | ))} 70 | 71 | 72 | ); 73 | }; 74 | -------------------------------------------------------------------------------- /packages/dapp/src/components/common/CoinzillaBannerAd.jsx: -------------------------------------------------------------------------------- 1 | import { Box } from '@chakra-ui/react'; 2 | import { COINZILLA_API_KEY } from 'lib/constants'; 3 | import React, { useEffect } from 'react'; 4 | 5 | export const CoinzillaBannerAd = props => { 6 | useEffect(() => { 7 | window.coinzilla_display = window.coinzilla_display || []; 8 | window.coinzilla_display.push({ 9 | zone: COINZILLA_API_KEY, 10 | width: window.screen.availWidth >= 728 ? '728' : '320', 11 | height: window.screen.availWidth >= 728 ? '90' : '100', 12 | }); 13 | }, []); 14 | 15 | if (!COINZILLA_API_KEY) return null; 16 | return ( 17 | 24 | ); 25 | }; 26 | -------------------------------------------------------------------------------- /packages/dapp/src/components/common/CoinzillaTextAd.jsx: -------------------------------------------------------------------------------- 1 | import { HStack, Image, Link, Text } from '@chakra-ui/react'; 2 | import { useCoinzillaText } from 'hooks/useCoinzillaText'; 3 | import React from 'react'; 4 | 5 | export const CoinzillaTextAd = () => { 6 | const { isFetching, adData, adFetchError } = useCoinzillaText(); 7 | 8 | if (isFetching || adFetchError || !adData) return null; 9 | 10 | const { 11 | ad: { thumbnail, name, title, url, cta_button: ctaButton }, 12 | } = adData; 13 | 14 | return ( 15 | 21 | Sponsored: 22 | ad-logo 23 | {name} 24 | - {title} 25 | 26 | {ctaButton} 27 | 28 | 29 | ); 30 | }; 31 | -------------------------------------------------------------------------------- /packages/dapp/src/components/common/ErrorFallback.jsx: -------------------------------------------------------------------------------- 1 | import { Flex, Text } from '@chakra-ui/react'; 2 | import React from 'react'; 3 | 4 | export const ErrorFallback = () => ( 5 | 12 | Something went wrong 13 | Please check console for error log 14 | 15 | ); 16 | -------------------------------------------------------------------------------- /packages/dapp/src/components/common/Footer.jsx: -------------------------------------------------------------------------------- 1 | import { Box, Flex, HStack, Text, useBreakpointValue } from '@chakra-ui/react'; 2 | import { GithubIcon } from 'icons/GithubIcon'; 3 | import { GnosisChainIcon } from 'icons/GnosisChainIcon'; 4 | import { OmniBridgeIcon } from 'icons/OmniBridgeIcon'; 5 | import { RaidGuildIcon } from 'icons/RaidGuildIcon'; 6 | import { TelegramIcon } from 'icons/TelegramIcon'; 7 | import { TwitterIcon } from 'icons/TwitterIcon'; 8 | import React from 'react'; 9 | import { Link } from 'react-router-dom'; 10 | 11 | export const Footer = () => { 12 | const smallScreen = useBreakpointValue({ base: true, sm: false }); 13 | return ( 14 | 24 | {!smallScreen && ( 25 | 26 | 32 | 33 | 34 | 35 | )} 36 | 37 | 38 | 43 | 44 | 45 | 46 | 47 | 52 | 53 | 54 | 55 | 56 | 61 | 62 | 63 | 64 | 65 | 70 | 71 | 72 | 73 | 74 | 79 | 84 | Built by 85 | 86 | 87 | 88 | 89 | 90 | ); 91 | }; 92 | -------------------------------------------------------------------------------- /packages/dapp/src/components/common/Layout.jsx: -------------------------------------------------------------------------------- 1 | import { Flex, Image } from '@chakra-ui/react'; 2 | import DownTriangle from 'assets/down-triangle.svg'; 3 | import UpTriangle from 'assets/up-triangle.svg'; 4 | import { Footer } from 'components/common/Footer'; 5 | import { TermsOfServiceModal } from 'components/modals/TermsOfServiceModal'; 6 | import React from 'react'; 7 | 8 | export const Layout = ({ children }) => ( 9 | 21 | 29 | 37 | 46 | {children} 47 | 48 |