Skip to content

Commit

Permalink
add velas (#284)
Browse files Browse the repository at this point in the history
* add velas

* Trigger build

* fix value

* fix chart when there is NaN

* update factory address

* fix icon

* fix showing 0 fees
  • Loading branch information
namgold authored Mar 8, 2022
1 parent 4579712 commit 0e3bfee
Show file tree
Hide file tree
Showing 18 changed files with 275 additions and 10 deletions.
12 changes: 12 additions & 0 deletions .env.velas
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
REACT_APP_CHAIN_ID=106
REACT_APP_DMM_SWAP_URL="https://kyberswap.com/#/"
REACT_APP_FACTORY_ADDRESS=0xD9bfE9979e9CA4b2fe84bA5d4Cf963bBcB376974
REACT_APP_SUBGRAPH_NAME=kybernetwork/kyberswap-exchange-velas
REACT_APP_SUBGRAPH_URL=https://velas-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-exchange-velas
REACT_APP_SUBGRAPH_BLOCK_URL=https://velas-graph.kyberengineering.io/subgraphs/name/kybernetwork/velas-blocks
REACT_APP_ETHERSCAN_URL=https://evmexplorer.velas.com
REACT_APP_KNC_ADDRESS=0xfe56d5892bdffc7bf58f2e84be1b2c32d21c308b
REACT_APP_WETH_ADDRESS=0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126
REACT_APP_DEFAULT_START_TIME=1630313700
REACT_APP_AGGREGATOR_STATS_API="https://aggregator-stats.kyberswap.com"

7 changes: 7 additions & 0 deletions .travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ elif [[ "$TRAVIS_BRANCH" == "main" ]]; then
cp build/index.html build-arbitrum-index
mv build build-arbitrum
echo "Finished running build"

echo "Start running build velas"
yarn build-velas
mkdir build-velas-index
cp build/index.html build-velas-index
mv build build-velas
echo "Finished running build"
else
echo "Branch is not set for auto-build."
exit 0
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"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",
"start-velas": "env-cmd -f .env.velas 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 @@ -111,6 +112,7 @@
"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",
"build-velas": "env-cmd -f .env.velas react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down
3 changes: 3 additions & 0 deletions src/apollo/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const EXCHANGE_SUBGRAPH_URLS = {
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'],
velas: ['https://velas-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-exchange-velas'],
}

export function getExchangeSubgraphUrls(networkId) {
Expand Down Expand Up @@ -80,6 +81,8 @@ export function getExchangeSubgraphUrls(networkId) {
return EXCHANGE_SUBGRAPH_URLS.arbitrum
case ChainId.BTTC:
return EXCHANGE_SUBGRAPH_URLS.bttc
case ChainId.VELAS:
return EXCHANGE_SUBGRAPH_URLS.velas
default:
return EXCHANGE_SUBGRAPH_URLS.mainnet
}
Expand Down
Binary file added src/assets/networks/velas-network.png
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/velas.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: 1 addition & 1 deletion src/components/GlobalStats/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Divider = styled.div`

export default function GlobalStats() {
const { oneDayTxns, oneDayFeeUSD, oneDayFeeChange, txnChange } = useGlobalData()
const oneDayFees = oneDayFeeUSD ? formattedNum(oneDayFeeUSD, true) : ''
const oneDayFees = Number.isFinite(oneDayFeeUSD) ? formattedNum(oneDayFeeUSD, true) : ''
const theme = useTheme()
const aggregatorVolume = useAggregatorVolume()
const above768 = useMedia('(min-width: 768px)')
Expand Down
1 change: 1 addition & 0 deletions src/components/NetworkModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default function NetworkModal() {
ChainId.CRONOS,
ChainId.ARBITRUM,
// ChainId.BTTC,
ChainId.VELAS,
].map((key, i) => {
if (chainId === key) {
return (
Expand Down
1 change: 1 addition & 0 deletions src/components/SwitcNetworkButton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const SwitchNetworkButton = () => {
ChainId.CRONOS,
ChainId.ARBITRUM,
ChainId.BTTC,
ChainId.VELAS,
].includes(chainId)
) {
return null
Expand Down
23 changes: 23 additions & 0 deletions src/components/TokenLogo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ 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 VELAS_TOKEN_LIST from '../../constants/tokenLists/velas.tokenlist'
import { isAddress } from '../../utils/index.js'
import PlaceHolder from '../../assets/placeholder.png'
import EthereumLogo from '../../assets/eth.png'
Expand All @@ -18,6 +19,7 @@ import BnbLogo from '../../assets/bnb.png'
import AvaxLogo from '../../assets/avax.png'
import FantomLogo from '../../assets/networks/fantom-network.png'
import CronosLogo from '../../assets/cronos.svg'
import VelasLogo from '../../assets/velas.png'
import { getMaticTokenLogoURL } from '../../utils/maticTokenMapping'
import { getMumbaiTokenLogoURL } from '../../utils/mumbaiTokenMapping'
import { getBscTestnetTokenLogoURL } from '../../utils/bscTestnetTokenMapping'
Expand Down Expand Up @@ -175,6 +177,19 @@ export function getNativeTokenLogo({ size = '24px', ...rest }) {
/>
</StyledNativeTokenLogo>
)
case '106':
return (
<StyledNativeTokenLogo size={size} {...rest}>
<img
src={VelasLogo}
style={{
boxShadow: '0px 6px 10px rgba(0, 0, 0, 0.075)',
borderRadius: '24px',
}}
alt=""
/>
</StyledNativeTokenLogo>
)
default:
return (
<StyledNativeTokenLogo size={size} {...rest}>
Expand Down Expand Up @@ -289,10 +304,18 @@ export default function TokenLogo({ address, header = false, size = '24px', ...r
)}/logo.png`
break

case `${ChainId.VELAS}`:
if (formattedAddress && VELAS_TOKEN_LIST[formattedAddress]) {
return getCustomLogo({ address, src: VELAS_TOKEN_LIST[formattedAddress].logoURI, size, setError, ...rest })
}
path = 'error'
break

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

default:
Expand Down
2 changes: 2 additions & 0 deletions src/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export const ChainId = {
ARBITRUM_TESTNET: 421611,
ARBITRUM: 42161,
BTTC: 199,
VELAS: 106,
}

export const ANALYTICS_URLS = {
Expand All @@ -91,6 +92,7 @@ export const ANALYTICS_URLS = {
25: 'https://cronos-analytics.kyberswap.com',
[ChainId.ARBITRUM]: 'https://arbitrum-analytics.kyberswap.com',
[ChainId.BTTC]: 'https://bttc-analytics.kyberswap.com',
[ChainId.VELAS]: 'https://velas-analytics.kyberswap.com',
}

// This variable to handle crazy APR which it can be wrong calculations or a bug
Expand Down
3 changes: 3 additions & 0 deletions src/constants/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Fantom from '../assets/networks/fantom-network.png'
import Cronos from '../assets/networks/cronos-network.png'
import Arbitrum from '../assets/networks/arbitrum-network.svg'
import BitTorrent from '../assets/networks/bittorrent-network.png'
import Velas from '../assets/networks/velas-network.png'
import { ChainId } from '.'

export const NETWORK_ICON = {
Expand All @@ -17,6 +18,7 @@ export const NETWORK_ICON = {
[ChainId.CRONOS]: Cronos,
[ChainId.ARBITRUM]: Arbitrum,
[ChainId.BTTC]: BitTorrent,
[ChainId.VELAS]: Velas,
}

export const NETWORK_LABEL = {
Expand All @@ -28,4 +30,5 @@ export const NETWORK_LABEL = {
[ChainId.CRONOS]: 'Cronos',
[ChainId.ARBITRUM]: 'Arbitrum',
[ChainId.BTTC]: 'BitTorrent',
[ChainId.VELAS]: 'Velas',
}
198 changes: 198 additions & 0 deletions src/constants/tokenLists/velas.tokenlist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
export const VELAS_TOKEN_ARRAY = [
{
chainId: 106,
address: '0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126',
symbol: 'WVLX',
name: 'Wrapped VLX',
decimals: 18,
logoURI:
'https://raw.githubusercontent.com/KyberNetwork/dmm-interface/9c1efef2dc1c650adeac5ed7a370cad8e064f6be/src/assets/networks/velas-network.png',
},
{
chainId: 106,
address: '0xc111c29A988AE0C0087D97b33C6E6766808A3BD3',
symbol: 'BUSD',
name: 'Multichain BUSD',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/4687.png',
},
{
chainId: 106,
address: '0xaBf26902Fd7B624e0db40D31171eA9ddDf078351',
symbol: 'WAG',
name: 'Wagyu',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/11354.png',
},
{
chainId: 106,
address: '0x01445C31581c354b7338AC35693AB2001B50b9aE',
symbol: 'USDT',
name: 'Multichain USDT',
decimals: 6,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/825.png',
},
{
chainId: 106,
address: '0x8d9fB713587174Ee97e91866050c383b5cEE6209',
symbol: 'SCAR',
name: 'Velhalla',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/13250.png',
},
{
chainId: 106,
address: '0x72eB7CA07399Ec402c5b7aa6A65752B6A1Dc0C27',
symbol: 'ASTRO',
name: 'AstroSwap',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/12120.png',
},
{
chainId: 106,
address: '0x3611Fbfb06ffBcEf9Afb210f6Ace86742e6c14a4',
symbol: 'ADA',
name: 'Ada Asset',
decimals: 6,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/2010.png',
},
{
chainId: 106,
address: '0x8a74BC8c372bC7f0E9cA3f6Ac0df51BE15aEC47A',
symbol: 'PLSPAD',
name: 'PULSEPAD.io',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/12416.png',
},
{
chainId: 106,
address: '0x6EF5D1aB0642ceF5227465e209f92675008558cA',
symbol: 'VSH',
name: 'VELASSHIBA',
decimals: 9,
logoURI: '',
},
{
chainId: 106,
address: '0xa065e0858417Dfc7abC6f2BD4D0185332475C180',
symbol: 'VLXPAD',
name: 'Velas Pad',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/11654.png',
},
{
chainId: 106,
address: '0x4cBA3447E51239065310E24c02C190945ad761d9',
symbol: 'MNFT',
name: 'MarvelousNFT',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/16218.png',
},
{
chainId: 106,
address: '0x62858686119135cc00C4A3102b436a0eB314D402',
symbol: 'METAV',
name: 'METAVPAD.com',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/13978.png',
},
{
chainId: 106,
address: '0xd12f7A98C0d740E7Ec82E8caF94EB79C56D1B623',
symbol: 'VDGT',
name: 'VeleroDAO',
decimals: 18,
logoURI: 'https://uploads-ssl.webflow.com/6182e85a5a4402f6f59cf04d/618ac51c292383a659d6b744_VELERO-token.svg',
},
{
chainId: 106,
address: '0x09bcE7716D46459DF7473982Fd27A96EabD6eE4d',
symbol: 'BITORB',
name: 'Bitorbit',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/12255.png',
},
{
chainId: 106,
address: '0x9Ab70e92319f0b9127df78868Fd3655fB9f1E322',
symbol: 'WWY',
name: 'WeWay Token',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/17047.png',
},
{
chainId: 106,
address: '0xF800F6977a7F98eAca9163e549be17bbdA84394a',
symbol: 'VHT',
name: 'Velhalla Token',
decimals: 18,
logoURI: '',
},
{
chainId: 106,
address: '0x32561fA6D2D3E2191bF50f813DF2C34fb3C89B62',
symbol: 'VERVE',
name: 'VERVETV.app',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/16902.png',
},
{
chainId: 106,
address: '0x2217e5921B7edfB4BB193a6228459974010D2198',
symbol: 'QMALL',
name: 'Qmall Token',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/18059.png',
},
{
chainId: 106,
address: '0x9b6fbF0ea23faF0d77B94d5699B44062e5E747Ac',
symbol: 'SWAPZ',
name: 'Swapz',
decimals: 18,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/10557.png',
},
{
chainId: 106,
address: '0x948E8c6E0c9035f7372a10e10f9f71cC81341053',
symbol: 'VPUNKS',
name: 'VelasPunks',
decimals: 18,
logoURI: '',
},
{
chainId: 106,
address: '0xe2C120f188eBd5389F71Cf4d9C16d05b62A58993',
symbol: 'USDC',
name: 'Multichain USDC',
decimals: 6,
logoURI: 'https://s2.coinmarketcap.com/static/img/coins/64x64/3408.png',
},
{
chainId: 106,
address: '0x85219708c49aa701871Ad330A94EA0f41dFf24Ca',
symbol: 'ETH',
name: 'Multichain ETH',
decimals: 18,
logoURI:
'https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0x85219708c49aa701871ad330a94ea0f41dff24ca/logo.png?raw=true',
},
{
chainId: 106,
address: '0xcd7509b76281223f5b7d3ad5d47f8d7aa5c2b9bf',
symbol: 'USDV',
name: 'USD Velero Stablecoin',
decimals: 18,
logoURI:
'https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0xcd7509b76281223f5b7d3ad5d47f8d7aa5c2b9bf/logo.png?raw=true',
},
]

const VELAS_TOKEN_LIST = VELAS_TOKEN_ARRAY.reduce((acc, cur) => {
return {
...acc,
[cur.address]: cur,
}
}, {})

export default VELAS_TOKEN_LIST
4 changes: 4 additions & 0 deletions src/contexts/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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 VELAS_TOKEN_LIST from '../constants/tokenLists/velas.tokenlist'
dayjs.extend(utc)

const UPDATE = 'UPDATE'
Expand Down Expand Up @@ -376,6 +377,9 @@ export function useListedTokens() {
case ChainId.BTTC:
tokenslist = BTTC_TOKEN_LIST
break
case ChainId.VELAS:
tokenslist = VELAS_TOKEN_LIST
break
default:
break
}
Expand Down
Loading

0 comments on commit 0e3bfee

Please sign in to comment.