diff --git a/.env.velas b/.env.velas
new file mode 100644
index 000000000..4bce9bd77
--- /dev/null
+++ b/.env.velas
@@ -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"
+
diff --git a/.travis/build.sh b/.travis/build.sh
index 6139547ec..a4f7d10af 100644
--- a/.travis/build.sh
+++ b/.travis/build.sh
@@ -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
diff --git a/package.json b/package.json
index 6e95a797e..20395273e 100644
--- a/package.json
+++ b/package.json
@@ -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",
@@ -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"
},
diff --git a/src/apollo/manager.js b/src/apollo/manager.js
index 1ad7fccf8..8d752fd79 100644
--- a/src/apollo/manager.js
+++ b/src/apollo/manager.js
@@ -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) {
@@ -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
}
diff --git a/src/assets/networks/velas-network.png b/src/assets/networks/velas-network.png
new file mode 100644
index 000000000..64299fd10
Binary files /dev/null and b/src/assets/networks/velas-network.png differ
diff --git a/src/assets/velas.png b/src/assets/velas.png
new file mode 100644
index 000000000..64299fd10
Binary files /dev/null and b/src/assets/velas.png differ
diff --git a/src/components/GlobalStats/index.js b/src/components/GlobalStats/index.js
index bbcdc1bf4..f56ec32a1 100644
--- a/src/components/GlobalStats/index.js
+++ b/src/components/GlobalStats/index.js
@@ -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)')
diff --git a/src/components/NetworkModal/index.js b/src/components/NetworkModal/index.js
index 159044f73..c08979615 100644
--- a/src/components/NetworkModal/index.js
+++ b/src/components/NetworkModal/index.js
@@ -105,6 +105,7 @@ export default function NetworkModal() {
ChainId.CRONOS,
ChainId.ARBITRUM,
// ChainId.BTTC,
+ ChainId.VELAS,
].map((key, i) => {
if (chainId === key) {
return (
diff --git a/src/components/SwitcNetworkButton/index.js b/src/components/SwitcNetworkButton/index.js
index 7a7a897a3..861082bb9 100644
--- a/src/components/SwitcNetworkButton/index.js
+++ b/src/components/SwitcNetworkButton/index.js
@@ -52,6 +52,7 @@ const SwitchNetworkButton = () => {
ChainId.CRONOS,
ChainId.ARBITRUM,
ChainId.BTTC,
+ ChainId.VELAS,
].includes(chainId)
) {
return null
diff --git a/src/components/TokenLogo/index.js b/src/components/TokenLogo/index.js
index fbfb25234..9e6c54aa3 100644
--- a/src/components/TokenLogo/index.js
+++ b/src/components/TokenLogo/index.js
@@ -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'
@@ -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'
@@ -175,6 +177,19 @@ export function getNativeTokenLogo({ size = '24px', ...rest }) {
/>
)
+ case '106':
+ return (
+
+
+
+ )
default:
return (
@@ -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:
diff --git a/src/constants/index.js b/src/constants/index.js
index 9482e4ce4..96f555b10 100644
--- a/src/constants/index.js
+++ b/src/constants/index.js
@@ -80,6 +80,7 @@ export const ChainId = {
ARBITRUM_TESTNET: 421611,
ARBITRUM: 42161,
BTTC: 199,
+ VELAS: 106,
}
export const ANALYTICS_URLS = {
@@ -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
diff --git a/src/constants/networks.js b/src/constants/networks.js
index 917df5fbf..c8f9265f1 100644
--- a/src/constants/networks.js
+++ b/src/constants/networks.js
@@ -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 = {
@@ -17,6 +18,7 @@ export const NETWORK_ICON = {
[ChainId.CRONOS]: Cronos,
[ChainId.ARBITRUM]: Arbitrum,
[ChainId.BTTC]: BitTorrent,
+ [ChainId.VELAS]: Velas,
}
export const NETWORK_LABEL = {
@@ -28,4 +30,5 @@ export const NETWORK_LABEL = {
[ChainId.CRONOS]: 'Cronos',
[ChainId.ARBITRUM]: 'Arbitrum',
[ChainId.BTTC]: 'BitTorrent',
+ [ChainId.VELAS]: 'Velas',
}
diff --git a/src/constants/tokenLists/velas.tokenlist.js b/src/constants/tokenLists/velas.tokenlist.js
new file mode 100644
index 000000000..702bbb6cc
--- /dev/null
+++ b/src/constants/tokenLists/velas.tokenlist.js
@@ -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
diff --git a/src/contexts/Application.js b/src/contexts/Application.js
index a61f732c8..d9acf9e1b 100644
--- a/src/contexts/Application.js
+++ b/src/contexts/Application.js
@@ -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'
@@ -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
}
diff --git a/src/contexts/User.js b/src/contexts/User.js
index 2b8aeff95..45f7381aa 100644
--- a/src/contexts/User.js
+++ b/src/contexts/User.js
@@ -404,12 +404,11 @@ export function useUserLiquidityChart(account) {
// now cycle through pair day datas, for each one find usd value = ownership[address] * reserveUSD
const dailyUSD = relavantDayDatas.reduce((totalUSD, dayData) => {
if (dayData) {
- return (totalUSD =
- totalUSD +
- (ownershipPerPair[dayData.pairAddress]
- ? (parseFloat(ownershipPerPair[dayData.pairAddress].lpTokenBalance) / parseFloat(dayData.totalSupply)) *
- parseFloat(dayData.reserveUSD)
- : 0))
+ const currentSumData = ownershipPerPair[dayData.pairAddress]
+ ? (parseFloat(ownershipPerPair[dayData.pairAddress].lpTokenBalance) / parseFloat(dayData.totalSupply)) *
+ parseFloat(dayData.reserveUSD)
+ : 0
+ return totalUSD + (currentSumData || 0)
} else {
return totalUSD
}
diff --git a/src/pages/AccountPage.js b/src/pages/AccountPage.js
index edb1ad656..9d8b4b0ac 100644
--- a/src/pages/AccountPage.js
+++ b/src/pages/AccountPage.js
@@ -144,8 +144,8 @@ function AccountPage({ account }) {
? dynamicPositions.reduce((total, position) => {
return (
total +
- (parseFloat(position?.liquidityTokenBalance) / parseFloat(position?.pool?.totalSupply)) *
- position?.pool?.reserveUSD
+ ((parseFloat(position?.liquidityTokenBalance) / parseFloat(position?.pool?.totalSupply)) *
+ position?.pool?.reserveUSD || 0)
)
}, 0)
: null
diff --git a/src/utils/index.js b/src/utils/index.js
index 5ed7d12b3..f9017669e 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -556,6 +556,8 @@ export function getNativeTokenSymbol() {
return 'CRO'
case '338':
return 'CRO'
+ case '106':
+ return 'VLX'
default:
return 'ETH'
}
@@ -579,6 +581,8 @@ export function getNativeTokenWrappedName() {
return 'CRO (Wrapped)'
case '338':
return 'CRO (Wrapped)'
+ case '106':
+ return 'VLX (Wrapped)'
default:
return 'Ether (Wrapped)'
}
@@ -608,6 +612,8 @@ export function getEtherscanLinkText() {
return 'Arbiscan'
case `${ChainId.BTTC}`:
return 'Bttcscan'
+ case `${ChainId.VELAS}`:
+ return 'Velas EVM Explorer'
default:
return 'Etherscan'
@@ -636,6 +642,8 @@ export function getNetworkName() {
return 'Arbitrum'
case '421611':
return 'Arbitrum Rinkeby'
+ case '106':
+ return 'Velas'
default:
return 'Ethereum'
}
@@ -659,6 +667,8 @@ export function getDefaultAddLiquidityUrl() {
return `${process.env.REACT_APP_DMM_SWAP_URL}pools/CRO`
case '338':
return `${process.env.REACT_APP_DMM_SWAP_URL}pools/CRO`
+ case '106':
+ return `${process.env.REACT_APP_DMM_SWAP_URL}pools/VLX`
default:
return `${process.env.REACT_APP_DMM_SWAP_URL}pools/ETH/${KNC_ADDRESS}`
}
diff --git a/src/utils/tokenLists.ts b/src/utils/tokenLists.ts
index 826bc476d..eb54e5c5b 100644
--- a/src/utils/tokenLists.ts
+++ b/src/utils/tokenLists.ts
@@ -57,7 +57,7 @@ export default async function getTokenList(listUrl: string): Promise
// Bypass validator for Matic network
// Because the Uniswap token schema will fail on Quickswap tokens list
if (
- ['137', '56', '43114', '250', '25', ChainId.ARBITRUM, ChainId.BTTC].includes(
+ ['137', '56', '43114', '250', '25', ChainId.ARBITRUM, ChainId.BTTC, ChainId.VELAS].includes(
String(process.env.REACT_APP_CHAIN_ID)
)
) {