Skip to content

Commit

Permalink
add arbitrum analytics (#274)
Browse files Browse the repository at this point in the history
* add arbitrum test

* add arbitrum test

* add arbitrum

* feat: add bttc

* fix: BNB token logo

* add more token

* fix: warning scam token

* fix: get scan text for bttc

* feat: deploy arbitrum

* update arbitrum factory

* add ci-cd
  • Loading branch information
viet-nv authored Mar 3, 2022
1 parent 14d861f commit 64f60a3
Show file tree
Hide file tree
Showing 22 changed files with 2,460 additions and 17 deletions.
12 changes: 12 additions & 0 deletions .env.arbitrum
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
REACT_APP_CHAIN_ID=42161
REACT_APP_MAINNET_ENV=production
REACT_APP_DMM_SWAP_URL="https://kyberswap.com/#/"
REACT_APP_FACTORY_ADDRESS=0x51e8d106c646ca58caf32a47812e95887c071a62
REACT_APP_SUBGRAPH_NAME=viet-nv/kyberswap-arbitrum
REACT_APP_SUBGRAPH_URL=https://api.thegraph.com/subgraphs/name/viet-nv/kyberswap-arbitrum
REACT_APP_SUBGRAPH_BLOCK_URL=https://api.thegraph.com/subgraphs/name/viet-nv/arbitrum-blocks
REACT_APP_ETHERSCAN_URL=https://arbiscan.io
REACT_APP_KNC_ADDRESS=0x868fc5cb3367c4a43c350b85d5001acaf58a857e
REACT_APP_WETH_ADDRESS=0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23
REACT_APP_DEFAULT_START_TIME=1644536463
REACT_APP_AGGREGATOR_STATS_API="https://aggregator-stats.kyberswap.com"
12 changes: 12 additions & 0 deletions .env.arbitrum.testnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
REACT_APP_CHAIN_ID=421611
REACT_APP_MAINNET_ENV=staging
REACT_APP_DMM_SWAP_URL="https://dev-dmm-interface-pr-807.knstats.com/#/"
REACT_APP_FACTORY_ADDRESS=0x570797C68C6D060503b2CfcBe5780205057010d5
REACT_APP_SUBGRAPH_NAME=viet-nv/kyberswap-arbitrum-rinkeby
REACT_APP_SUBGRAPH_URL=https://api.thegraph.com/subgraphs/name/viet-nv/kyberswap-arbitrum-rinkeby
REACT_APP_SUBGRAPH_BLOCK_URL=https://api.thegraph.com/subgraphs/name/viet-nv/arbitrum-rinkeby-blocks
REACT_APP_ETHERSCAN_URL=https://testnet.arbiscan.io
REACT_APP_KNC_ADDRESS=0x7596961744096D12eFa3CfA58d1D30EDd82BD396
REACT_APP_WETH_ADDRESS=0x93D51226c4C3c265ca0c2F6420fa4c6A9151c09e
REACT_APP_DEFAULT_START_TIME=1644212237
REACT_APP_AGGREGATOR_STATS_API="https://aggregator-stats.kyberswap.com"
12 changes: 12 additions & 0 deletions .env.bttc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
REACT_APP_CHAIN_ID=199
REACT_APP_MAINNET_ENV=production
REACT_APP_DMM_SWAP_URL="https://kyberswap.com/#/"
REACT_APP_FACTORY_ADDRESS=0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974
REACT_APP_SUBGRAPH_NAME=dynamic-amm/kyberswap-bttc
REACT_APP_SUBGRAPH_URL=https://bttc-graph.dev.kyberengineering.io/subgraphs/name/dynamic-amm/kyberswap-bttc
REACT_APP_SUBGRAPH_BLOCK_URL=https://bttc-graph.dev.kyberengineering.io/subgraphs/name/dynamic-amm/bttc-blocks
REACT_APP_ETHERSCAN_URL=https://bttcscan.com
REACT_APP_KNC_ADDRESS=0x868fc5cb3367c4a43c350b85d5001acaf58a857e
REACT_APP_WETH_ADDRESS=0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23
REACT_APP_DEFAULT_START_TIME=1645007928
REACT_APP_AGGREGATOR_STATS_API="https://aggregator-stats.kyberswap.com"
21 changes: 21 additions & 0 deletions .travis.bak.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,24 @@ deploy:
on:
all_branches: true
condition: $TRAVIS_BRANCH =~ ^main$

- provider: gcs
access_key_id: $GCS_ACCESS_KEY_ID
secret_access_key: $GCS_SECRET_KEY_ID
bucket: arbitrum-analytics.kyberswap.com
skip_cleanup: true
local-dir: build-arbitrum
on:
all_branches: true
condition: $TRAVIS_BRANCH =~ ^main$

- provider: gcs
access_key_id: $GCS_ACCESS_KEY_ID
secret_access_key: $GCS_SECRET_KEY_ID
bucket: arbitrum-analytics.kyberswap.com
skip_cleanup: true
local-dir: build-arbitrum-index
cache_control: "public, max-age=30"
on:
all_branches: true
condition: $TRAVIS_BRANCH =~ ^main$
7 changes: 7 additions & 0 deletions .travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ elif [[ "$TRAVIS_BRANCH" == "main" ]]; then
mv build/index.html build-cronos-index
mv build build-cronos
echo "Finished running build"

echo "Start running build arbitrum"
yarn build-arbitrum
mkdir build-arbitrum-index
cp build/index.html build-arbitrum-index
mv build build-arbitrum
echo "Finished running build"
else
echo "Branch is not set for auto-build."
exit 0
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"start-fantom-staging": "env-cmd -f .env.fantom.staging react-scripts start",
"start-cronos-testnet": "env-cmd -f .env.cronos.testnet react-scripts start",
"start-cronos": "env-cmd -f .env.cronos react-scripts start",
"start-arbitrum-testnet": "env-cmd -f .env.arbitrum.testnet react-scripts start",
"start-arbitrum": "env-cmd -f .env.arbitrum react-scripts start",
"start-bttc": "env-cmd -f .env.bttc react-scripts start",
"build": "react-scripts build",
"build-ropsten": "env-cmd -f .env.ropsten react-scripts build",
"build-staging": "env-cmd -f .env.staging react-scripts build",
Expand All @@ -105,6 +108,9 @@
"build-fantom-staging": "env-cmd -f .env.fantom.staging react-scripts build",
"build-cronos-testnet": "env-cmd -f .env.cronos.testnet react-scripts build",
"build-cronos": "env-cmd -f .env.cronos react-scripts build",
"build-arbitrum-testnet": "env-cmd -f .env.arbitrum.testnet react-scripts build",
"build-arbitrum": "env-cmd -f .env.arbitrum react-scripts build",
"build-bttc": "env-cmd -f .env.bttc react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down
1 change: 1 addition & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const Right = styled.div`
const Center = styled.div`
position: relative;
height: 100%;
min-height: 100vh;
z-index: 10;
transition: width 0.25s ease;
background-color: ${({ theme }) => theme.buttonBlack};
Expand Down
9 changes: 9 additions & 0 deletions src/apollo/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ const EXCHANGE_SUBGRAPH_URLS = {
],
cronosTestnet: ['https://testnet-cronos-subgraph.knstats.com/subgraphs/name/dynamic-amm/dmm-exchange-cronos-testnet'],
cronos: ['https://cronos-subgraph.kyberswap.com/subgraphs/name/kyberswap/kyberswap-cronos'],
arbitrumTestnet: ['https://api.thegraph.com/subgraphs/name/viet-nv/kyberswap-arbitrum-rinkeby'],
arbitrum: ['https://api.thegraph.com/subgraphs/name/viet-nv/kyberswap-arbitrum'],
bttc: ['https://bttc-graph.dev.kyberengineering.io/subgraphs/name/dynamic-amm/kyberswap-bttc'],
}

export function getExchangeSubgraphUrls(networkId) {
Expand Down Expand Up @@ -71,6 +74,12 @@ export function getExchangeSubgraphUrls(networkId) {
return EXCHANGE_SUBGRAPH_URLS.cronosTestnet
case ChainId.CRONOS:
return EXCHANGE_SUBGRAPH_URLS.cronos
case ChainId.ARBITRUM_TESTNET:
return EXCHANGE_SUBGRAPH_URLS.arbitrumTestnet
case ChainId.ARBITRUM:
return EXCHANGE_SUBGRAPH_URLS.arbitrum
case ChainId.BTTC:
return EXCHANGE_SUBGRAPH_URLS.bttc
default:
return EXCHANGE_SUBGRAPH_URLS.mainnet
}
Expand Down
1 change: 1 addition & 0 deletions src/apollo/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ export const GLOBAL_DATA = (block) => {
pairCount
}
}`

return gql(queryString)
}

Expand Down
181 changes: 181 additions & 0 deletions src/assets/networks/arbitrum-network.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/networks/bittorrent-network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/components/NetworkModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ export default function NetworkModal() {
ChainId.AVAXMAINNET,
ChainId.FANTOM,
ChainId.CRONOS,
ChainId.ARBITRUM,
// ChainId.BTTC,
].map((key, i) => {
if (chainId === key) {
return (
Expand Down
13 changes: 10 additions & 3 deletions src/components/SwitcNetworkButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,16 @@ const SwitchNetworkButton = () => {
const below576 = useMedia('(max-width: 576px)')

if (
![ChainId.MAINNET, ChainId.MATIC, ChainId.BSCMAINNET, ChainId.AVAXMAINNET, ChainId.FANTOM, ChainId.CRONOS].includes(
chainId
)
![
ChainId.MAINNET,
ChainId.MATIC,
ChainId.BSCMAINNET,
ChainId.AVAXMAINNET,
ChainId.FANTOM,
ChainId.CRONOS,
ChainId.ARBITRUM,
ChainId.BTTC,
].includes(chainId)
) {
return null
}
Expand Down
19 changes: 18 additions & 1 deletion src/components/TokenLogo/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React, { useState, useEffect } from 'react'
import styled from 'styled-components'

import { ROPSTEN_TOKEN_LOGOS_MAPPING, WETH_ADDRESS } from '../../constants'
import { ROPSTEN_TOKEN_LOGOS_MAPPING, WETH_ADDRESS, ChainId } from '../../constants'
import ETHEREUM_TOKEN_LIST from '../../constants/tokenLists/ethereum.tokenlist'
import POLYGON_TOKEN_LIST from '../../constants/tokenLists/polygon.tokenlist'
import BSC_TOKEN_LIST from '../../constants/tokenLists/bsc.tokenlist'
import AVALANCHE_TOKEN_LIST from '../../constants/tokenLists/avalanche.tokenlist'
import FANTOM_TOKEN_LIST from '../../constants/tokenLists/fantom.tokenlist'
import CRONOS_TOKEN_LIST from '../../constants/tokenLists/cronos.tokenlist'
import ARBITRUM_TOKEN_LIST from '../../constants/tokenLists/arbitrum.tokenlist'
import BTTC_TOKEN_LIST from '../../constants/tokenLists/bttc.tokenlist'
import { isAddress } from '../../utils/index.js'
import PlaceHolder from '../../assets/placeholder.png'
import EthereumLogo from '../../assets/eth.png'
Expand Down Expand Up @@ -278,6 +280,21 @@ export default function TokenLogo({ address, header = false, size = '24px', ...r
path = getCronosTokenLogoURL(address)
break

case `${ChainId.ARBITRUM}`:
if (formattedAddress && ARBITRUM_TOKEN_LIST[formattedAddress]) {
return getCustomLogo({ address, src: ARBITRUM_TOKEN_LIST[formattedAddress].logoURI, size, setError, ...rest })
}
path = `https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/arbitrum/assets/${isAddress(
address
)}/logo.png`
break

case `${ChainId.BTTC}`:
if (formattedAddress && BTTC_TOKEN_LIST[formattedAddress]) {
return getCustomLogo({ address, src: BTTC_TOKEN_LIST[formattedAddress].logoURI, size, setError, ...rest })
}
break

default:
if (formattedAddress && ETHEREUM_TOKEN_LIST[formattedAddress]?.logoURI) {
return getCustomLogo({ address, src: ETHEREUM_TOKEN_LIST[formattedAddress].logoURI, size, setError, ...rest })
Expand Down
Loading

0 comments on commit 64f60a3

Please sign in to comment.