From 2805d9c973e3ce05cabf01e2abf3417d9c63bc7c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nguy=E1=BB=85n=20Ho=C3=A0i=20Danh?=
<33005392+nguyenhoaidanh@users.noreply.github.com>
Date: Mon, 28 Aug 2023 14:10:15 +0700
Subject: [PATCH 1/4] update: note kyberAI (#2193)
---
.../pages/RegisterWhitelist/SubscribeForm.tsx | 25 ++++++++-----------
.../pages/RegisterWhitelist/styled.tsx | 4 +--
2 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/src/pages/TrueSightV2/pages/RegisterWhitelist/SubscribeForm.tsx b/src/pages/TrueSightV2/pages/RegisterWhitelist/SubscribeForm.tsx
index 9292614c3f..5186e7ba49 100644
--- a/src/pages/TrueSightV2/pages/RegisterWhitelist/SubscribeForm.tsx
+++ b/src/pages/TrueSightV2/pages/RegisterWhitelist/SubscribeForm.tsx
@@ -1,7 +1,6 @@
import { Trans, t } from '@lingui/macro'
import { debounce } from 'lodash'
import { FormEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'
-import { useMedia } from 'react-use'
import { Text } from 'rebass'
import { useLazyCheckReferralCodeQuery, useRequestWhiteListMutation } from 'services/kyberAISubscription'
@@ -13,10 +12,9 @@ import useParsedQueryString from 'hooks/useParsedQueryString'
import useTheme from 'hooks/useTheme'
import { getErrorMessage, isReferrerCodeInvalid } from 'pages/TrueSightV2/utils'
import { useSessionInfo } from 'state/authen/hooks'
-import { MEDIA_WIDTHS } from 'theme'
import { isEmailValid } from 'utils/string'
-import { FormWrapper, Input, Label } from './styled'
+import { FormWrapper, Input } from './styled'
export default function EmailForm({
showVerify,
@@ -28,7 +26,6 @@ export default function EmailForm({
const qs = useParsedQueryString<{ referrer: string }>()
const [referredByCode, setCode] = useState(qs.referrer || '')
const [errorInput, setErrorInput] = useState({ email: '', referredByCode: '' })
- const isMobile = useMedia(`(max-width: ${MEDIA_WIDTHS.upToSmall}px)`)
const { userInfo } = useSessionInfo()
const [requestWaitList] = useRequestWhiteListMutation()
@@ -101,35 +98,33 @@ export default function EmailForm({
return (
<>
-
-
+
- We will never share your email with third parties
+ We will never share your email with third parties.
-
-
+
+
+
+ Use a referral code to get access to KyberAI faster!
+
diff --git a/src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx b/src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx
index 94944148fc..5cbdd5255e 100644
--- a/src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx
+++ b/src/pages/TrueSightV2/pages/RegisterWhitelist/styled.tsx
@@ -49,12 +49,12 @@ export const InputWithCopy = (props: InputProps) => {
}
export const FormWrapper = styled.div`
- width: 500px;
+ width: 380px;
display: flex;
gap: 1rem;
z-index: 1;
+ flex-direction: column;
${({ theme }) => theme.mediaWidth.upToSmall`
width: 100%;
- flex-wrap: wrap;
`}
`
From 8ee84965cace4bebbd3928ebfff6640118602f2e Mon Sep 17 00:00:00 2001
From: Nguyen Van Viet
Date: Mon, 28 Aug 2023 14:21:11 +0700
Subject: [PATCH 2/4] feat: add Base (#2187)
* feat: add Base
* disable classic
* enable cross chain swap
* add stg base farm
* chore: update network logo
* fix: wrong token import
* revert env
---------
Co-authored-by: Danh
---
package.json | 4 +-
src/components/ClassicElasticTab.tsx | 66 ++++---
src/constants/bases.ts | 2 +
src/constants/index.ts | 8 +-
src/constants/networks.ts | 18 +-
src/constants/networks/base.ts | 73 +++++++
src/constants/networks/fantom.ts | 5 +-
src/constants/networks/index.ts | 2 +
src/constants/networks/zkevm.ts | 2 +-
src/constants/networks/zksync.ts | 2 +-
src/constants/tokens.ts | 240 ++++++-----------------
src/constants/v2.ts | 9 -
src/hooks/Tokens.ts | 2 +-
src/pages/About/AboutKyberSwap/index.tsx | 7 +-
src/pages/App.tsx | 29 +--
src/state/about/hooks.ts | 4 +-
src/state/application/hooks.ts | 26 +--
src/utils/index.ts | 4 +-
yarn.lock | 8 +-
19 files changed, 245 insertions(+), 266 deletions(-)
create mode 100644 src/constants/networks/base.ts
diff --git a/package.json b/package.json
index 810efcba8a..128a6ce039 100644
--- a/package.json
+++ b/package.json
@@ -49,7 +49,7 @@
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
"@kybernetwork/oauth2": "1.0.0",
"@kyberswap/ks-sdk-classic": "^1.0.3",
- "@kyberswap/ks-sdk-core": "1.0.9",
+ "@kyberswap/ks-sdk-core": "1.0.10",
"@kyberswap/ks-sdk-elastic": "^1.1.2",
"@kyberswap/ks-sdk-solana": "^1.0.2",
"@lingui/loader": "~3.14.0",
@@ -197,7 +197,7 @@
"vite-tsconfig-paths": "^4.0.8"
},
"resolutions": {
- "@kyberswap/ks-sdk-core": "1.0.9",
+ "@kyberswap/ks-sdk-core": "1.0.10",
"react-error-overlay": "6.0.9",
"@lingui/babel-plugin-extract-messages": "3.14.0",
"@lingui/cli": "3.14.0",
diff --git a/src/components/ClassicElasticTab.tsx b/src/components/ClassicElasticTab.tsx
index 7916413a4d..e6202f2a5e 100644
--- a/src/components/ClassicElasticTab.tsx
+++ b/src/components/ClassicElasticTab.tsx
@@ -9,7 +9,8 @@ import { useMedia } from 'react-use'
import { Flex, Text } from 'rebass'
import { ReactComponent as DropdownSVG } from 'assets/svg/down.svg'
-import { ELASTIC_NOT_SUPPORTED, VERSION } from 'constants/v2'
+import { CLASSIC_NOT_SUPPORTED, ELASTIC_NOT_SUPPORTED } from 'constants/networks'
+import { VERSION } from 'constants/v2'
import { useActiveWeb3React } from 'hooks'
import useElasticCompensationData from 'hooks/useElasticCompensationData'
import useElasticLegacy from 'hooks/useElasticLegacy'
@@ -34,6 +35,8 @@ function ClassicElasticTab() {
const { chainId } = useActiveWeb3React()
const notSupportedMsg = ELASTIC_NOT_SUPPORTED[chainId]
+ const notSupportedClassicMsg = CLASSIC_NOT_SUPPORTED[chainId]
+
const theme = useTheme()
const location = useLocation()
const navigate = useNavigate()
@@ -44,7 +47,7 @@ function ClassicElasticTab() {
const showLegacyExplicit = upToMedium ? false : isFarmpage ? shouldShowFarmTab : shouldShowPositionTab
- const dontShowLegacy = [ChainId.ZKEVM, ChainId.LINEA].includes(chainId)
+ const dontShowLegacy = [ChainId.ZKEVM, ChainId.BASE, ChainId.LINEA].includes(chainId)
const legacyTag = (small?: boolean) => (
{
+ if (!!notSupportedClassicMsg && version === VERSION.CLASSIC) return
if (!!notSupportedMsg && version !== VERSION.CLASSIC) return
const newQs = { ...qs, tab: version }
navigate({ search: stringify(newQs) }, { replace: true })
@@ -90,6 +94,17 @@ function ClassicElasticTab() {
return theme.subText
}
+ const getColorOfClassicTab = () => {
+ if (!!notSupportedClassicMsg) {
+ return theme.disableText
+ }
+
+ if (tab === VERSION.CLASSIC) {
+ return theme.primary
+ }
+ return theme.subText
+ }
+
const getColorOfLegacyElasticTab = () => {
if (!!notSupportedMsg) {
return theme.disableText
@@ -102,11 +117,14 @@ function ClassicElasticTab() {
const legacyElasticColor = getColorOfLegacyElasticTab()
useEffect(() => {
- if (!!notSupportedMsg && tab !== VERSION.CLASSIC) {
+ if (!!notSupportedClassicMsg && tab === VERSION.CLASSIC) {
+ const newQs = { ...qs, tab: VERSION.ELASTIC }
+ navigate({ search: stringify(newQs) }, { replace: true })
+ } else if (!!notSupportedMsg && tab !== VERSION.CLASSIC) {
const newQs = { ...qs, tab: VERSION.CLASSIC }
navigate({ search: stringify(newQs) }, { replace: true })
}
- }, [navigate, notSupportedMsg, qs, tab])
+ }, [navigate, notSupportedMsg, notSupportedClassicMsg, qs, tab])
return (
@@ -116,6 +134,8 @@ function ClassicElasticTab() {
text={
dontShowLegacy
? ''
+ : tab === VERSION.CLASSIC && notSupportedClassicMsg
+ ? notSupportedClassicMsg
: notSupportedMsg ||
(!showLegacyExplicit ? (
@@ -212,25 +232,27 @@ function ClassicElasticTab() {
>
)}
- {
- handleSwitchTab(VERSION.CLASSIC)
- }}
- >
-
-
+ {
+ handleSwitchTab(VERSION.CLASSIC)
+ }}
>
- {isFarmpage ? Classic Farms : Classic Pools}
-
-
+
+
+ {isFarmpage ? Classic Farms : Classic Pools}
+
+
+
)
}
diff --git a/src/constants/bases.ts b/src/constants/bases.ts
index 65457134b1..d9a6516f45 100644
--- a/src/constants/bases.ts
+++ b/src/constants/bases.ts
@@ -29,6 +29,7 @@ const WETH_ONLY: ChainTokenList = {
[ChainId.SOLANA]: [WETH[ChainId.SOLANA]],
[ChainId.LINEA]: [WETH[ChainId.LINEA]],
[ChainId.ZKEVM]: [WETH[ChainId.ZKEVM]],
+ [ChainId.BASE]: [WETH[ChainId.BASE]],
[ChainId.SOLANA_DEVNET]: [WETH[ChainId.SOLANA_DEVNET]],
}
@@ -183,4 +184,5 @@ export const SUGGESTED_BASES: ChainTokenList = {
...WETH_ONLY[ChainId.LINEA],
new Token(ChainId.LINEA, '0x7d43aabc515c356145049227cee54b608342c0ad', 18, 'BUSD', 'BUSD'),
],
+ [ChainId.BASE]: [...WETH_ONLY[ChainId.BASE], USDC[ChainId.BASE], DAI[ChainId.BASE]],
}
diff --git a/src/constants/index.ts b/src/constants/index.ts
index beff413dc1..01665a544c 100644
--- a/src/constants/index.ts
+++ b/src/constants/index.ts
@@ -317,10 +317,16 @@ export const CHAINS_SUPPORT_CROSS_CHAIN =
ChainId.OPTIMISM,
ChainId.FANTOM,
ChainId.LINEA,
+ ChainId.BASE,
]
: SUPPORTED_NETWORKS
-export const TYPE_AND_SWAP_NOT_SUPPORTED_CHAINS: ChainId[] = [ChainId.ZKSYNC, ChainId.LINEA, ChainId.ZKEVM]
+export const TYPE_AND_SWAP_NOT_SUPPORTED_CHAINS: ChainId[] = [
+ ChainId.ZKSYNC,
+ ChainId.LINEA,
+ ChainId.ZKEVM,
+ ChainId.BASE,
+]
export const SWAP_FEE_RECEIVER_ADDRESS = '0x4f82e73EDb06d29Ff62C91EC8f5Ff06571bdeb29'
diff --git a/src/constants/networks.ts b/src/constants/networks.ts
index 635391b726..a6786a3e9e 100644
--- a/src/constants/networks.ts
+++ b/src/constants/networks.ts
@@ -1,4 +1,5 @@
import { ChainId, ChainType, getChainType } from '@kyberswap/ks-sdk-core'
+import { t } from '@lingui/macro'
import { SolanaNetworkInfo } from 'constants/networks/type'
@@ -7,6 +8,7 @@ import {
aurora,
avax,
avaxTestnet,
+ base,
bnb,
bnbTestnet,
bttc,
@@ -22,10 +24,10 @@ import {
solana,
solanaDevnet,
velas,
+ zkEvm,
zksync,
} from './networks/index'
import { EVMNetworkInfo } from './networks/type'
-import zkEvm from './networks/zkevm'
type SOLANA_NETWORK = ChainId.SOLANA | ChainId.SOLANA_DEVNET
@@ -52,6 +54,7 @@ const NETWORKS_INFO_CONFIG: NETWORKS_INFO_CONFIG_TYPE = {
[ChainId.ZKSYNC]: zksync,
[ChainId.LINEA]: linea,
[ChainId.ZKEVM]: zkEvm,
+ [ChainId.BASE]: base,
[ChainId.SOLANA]: solana,
[ChainId.SOLANA_DEVNET]: solanaDevnet,
} as const
@@ -77,6 +80,7 @@ export const MAINNET_NETWORKS = [
ChainId.MATIC,
ChainId.ZKEVM,
ChainId.ZKSYNC,
+ ChainId.BASE,
ChainId.BSCMAINNET,
ChainId.AVAXMAINNET,
// ChainId.SOLANA,
@@ -168,6 +172,7 @@ export const STATIC_FEE_OPTIONS: { [chainId: number]: number[] | undefined } = {
[ChainId.ZKSYNC]: [8, 10, 50, 300, 500, 1000],
[ChainId.LINEA]: [8, 10, 50, 300, 500, 1000],
[ChainId.ZKEVM]: [8, 10, 50, 300, 500, 1000],
+ [ChainId.BASE]: [8, 10, 50, 300, 500, 1000],
}
export const ONLY_STATIC_FEE_CHAINS = [
@@ -180,6 +185,7 @@ export const ONLY_STATIC_FEE_CHAINS = [
ChainId.ZKSYNC,
ChainId.LINEA,
ChainId.ZKEVM,
+ ChainId.BASE,
]
// hardcode for unavailable subgraph
@@ -220,3 +226,13 @@ export const COMING_SOON_NETWORKS_FOR_MY_EARNINGS_CLASSIC: ChainId[] = [
ChainId.AURORA,
ChainId.OASIS,
]
+
+export const ELASTIC_NOT_SUPPORTED: { [key: string]: string } = {
+ [ChainId.AURORA]: t`Elastic is not supported on Aurora. Please switch to other chains`,
+ [ChainId.ZKSYNC]: t`Elastic will be available soon`,
+ // [ChainId.VELAS]: t`Elastic will be available soon`,
+}
+
+export const CLASSIC_NOT_SUPPORTED: { [key: string]: string } = {
+ [ChainId.BASE]: t`Classic is not supported on Base. Please switch to other chains`,
+}
diff --git a/src/constants/networks/base.ts b/src/constants/networks/base.ts
new file mode 100644
index 0000000000..74ad713985
--- /dev/null
+++ b/src/constants/networks/base.ts
@@ -0,0 +1,73 @@
+import { ChainId } from '@kyberswap/ks-sdk-core'
+
+import EthereumLogo from 'assets/images/ethereum-logo.png'
+import { EVMNetworkInfo } from 'constants/networks/type'
+
+const EMPTY = ''
+const EMPTY_ARRAY: any[] = []
+const NOT_SUPPORT = null
+
+const base: EVMNetworkInfo = {
+ chainId: ChainId.BASE,
+ route: 'base',
+ ksSettingRoute: 'base',
+ priceRoute: 'base',
+ poolFarmRoute: 'base',
+ aggregatorRoute: 'base',
+ name: 'Base',
+ icon: 'https://raw.githubusercontent.com/base-org/brand-kit/001c0e9b40a67799ebe0418671ac4e02a0c683ce/logo/in-product/Base_Network_Logo.svg',
+ iconDark: NOT_SUPPORT,
+ iconSelected: NOT_SUPPORT,
+ iconDarkSelected: NOT_SUPPORT,
+ defaultBlockSubgraph: 'https://base-graph.kyberengineering.io/subgraphs/name/kybernetwork/base-blocks',
+ etherscanUrl: 'https://basescan.org',
+ etherscanName: 'Base Explorer',
+ bridgeURL: EMPTY,
+ nativeToken: {
+ symbol: 'ETH',
+ name: 'ETH',
+ logo: EthereumLogo,
+ decimal: 18,
+ minForGas: 10 ** 16,
+ },
+ defaultRpcUrl: 'https://mainnet.base.org',
+ multicall: '0xcA11bde05977b3631167028862bE2a173976CA11',
+ classic: {
+ defaultSubgraph: 'https://base-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-exchange-base',
+ static: {
+ zap: '0x2abE8750e4a65584d7452316356128C936273e0D',
+ router: '0x5649B4DD00780e99Bab7Abb4A3d581Ea1aEB23D0',
+ factory: '0x1c758aF0688502e49140230F6b0EBd376d429be5',
+ },
+ oldStatic: NOT_SUPPORT,
+ dynamic: NOT_SUPPORT,
+ claimReward: NOT_SUPPORT,
+ fairlaunch: EMPTY_ARRAY,
+ fairlaunchV2: EMPTY_ARRAY,
+ },
+ elastic: {
+ defaultSubgraph: 'https://base-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-base',
+ startBlock: 2949023,
+ coreFactory: '0xC7a590291e07B9fe9E64b86c58fD8fC764308C4A',
+ nonfungiblePositionManager: '0xe222fBE074A436145b255442D919E4E3A6c6a480',
+ tickReader: '0x8Fd8Cb948965d9305999D767A02bf79833EADbB3',
+ initCodeHash: '0x00e263aaa3a2c06a89b53217a9e7aad7e15613490a72e0f95f303c4de2dc7045',
+ quoter: '0x4d47fd5a29904Dae0Ef51b1c450C9750F15D7856',
+ routers: '0xF9c2b5746c946EF883ab2660BbbB1f10A5bdeAb4',
+ farms: ['0x7D5ba536ab244aAA1EA42aB88428847F25E3E676'],
+ farmv2Quoter: '0x6AFeb9EDd6Cf44fA8E89b1eee28284e6dD7705C8',
+ farmV2S: ['0x3D6AfE2fB73fFEd2E3dD00c501A174554e147a43', '0xf2BcDf38baA52F6b0C1Db5B025DfFf01Ae1d6dBd'],
+ },
+ limitOrder: {
+ production: NOT_SUPPORT,
+ development: NOT_SUPPORT,
+ },
+ averageBlockTimeInSeconds: 2, // dont use for base
+ coingeckoNetworkId: 'base',
+ coingeckoNativeTokenId: 'ethereum',
+ deBankSlug: EMPTY,
+ dexToCompare: NOT_SUPPORT,
+ geckoTermialId: NOT_SUPPORT,
+}
+
+export default base
diff --git a/src/constants/networks/fantom.ts b/src/constants/networks/fantom.ts
index e7dc201f3a..4e62b5ef38 100644
--- a/src/constants/networks/fantom.ts
+++ b/src/constants/networks/fantom.ts
@@ -1,6 +1,5 @@
import { ChainId } from '@kyberswap/ks-sdk-core'
-import FTM from 'assets/networks/fantom-network.png'
import { EVMNetworkInfo } from 'constants/networks/type'
const EMPTY = ''
@@ -15,7 +14,7 @@ const fantomInfo: EVMNetworkInfo = {
poolFarmRoute: 'fantom',
aggregatorRoute: 'fantom',
name: 'Fantom',
- icon: FTM,
+ icon: 'https://storage.googleapis.com/ks-setting-a3aa20b7/779366f0-c120-4827-ac5e-9ed77ca202b91692929044916.png',
iconDark: NOT_SUPPORT,
iconSelected: NOT_SUPPORT,
iconDarkSelected: NOT_SUPPORT,
@@ -26,7 +25,7 @@ const fantomInfo: EVMNetworkInfo = {
nativeToken: {
symbol: 'FTM',
name: 'FTM',
- logo: FTM,
+ logo: 'https://storage.googleapis.com/ks-setting-a3aa20b7/779366f0-c120-4827-ac5e-9ed77ca202b91692929044916.png',
decimal: 18,
minForGas: 10 ** 16,
},
diff --git a/src/constants/networks/index.ts b/src/constants/networks/index.ts
index d1a7d0a58e..d5d9729def 100644
--- a/src/constants/networks/index.ts
+++ b/src/constants/networks/index.ts
@@ -17,4 +17,6 @@ export { default as solana } from './solana'
export { default as velas } from './velas'
export { default as zksync } from './zksync'
export { default as linea } from './linea'
+export { default as zkEvm } from './zkevm'
+export { default as base } from './base'
export { default as solanaDevnet } from './solana-devnet'
diff --git a/src/constants/networks/zkevm.ts b/src/constants/networks/zkevm.ts
index 413f621558..806b74b0a4 100644
--- a/src/constants/networks/zkevm.ts
+++ b/src/constants/networks/zkevm.ts
@@ -15,7 +15,7 @@ const zkEvm: EVMNetworkInfo = {
poolFarmRoute: 'polygon-zkevm',
aggregatorRoute: 'polygon-zkevm',
name: 'Polygon zkEVM',
- icon: 'https://storage.googleapis.com/ks-setting-a3aa20b7/013aecc7-9868-4b06-a056-7dd5997b4139.svg',
+ icon: 'https://storage.googleapis.com/ks-setting-a3aa20b7/41cb81da-c7ed-4bc1-99ef-4bfe6d80861e1692928936919.svg',
iconDark: NOT_SUPPORT,
iconSelected: NOT_SUPPORT,
iconDarkSelected: NOT_SUPPORT,
diff --git a/src/constants/networks/zksync.ts b/src/constants/networks/zksync.ts
index 2178bd64fe..a244400de6 100644
--- a/src/constants/networks/zksync.ts
+++ b/src/constants/networks/zksync.ts
@@ -17,7 +17,7 @@ const zkSyncInfo: EVMNetworkInfo = {
poolFarmRoute: 'zksync',
aggregatorRoute: 'zksync',
name: 'zkSync Era',
- icon: 'https://storage.googleapis.com/ks-setting-a3aa20b7/ad122023-76dd-4cdd-ad5a-7572726f004f.svg',
+ icon: 'https://storage.googleapis.com/ks-setting-a3aa20b7/5c5dc8c7-ba2d-4861-8ff2-4646892e5cb41692929153917.png',
iconDark: NOT_SUPPORT,
iconSelected: NOT_SUPPORT,
iconDarkSelected: NOT_SUPPORT,
diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts
index dc7030a6c1..1f218561e9 100644
--- a/src/constants/tokens.ts
+++ b/src/constants/tokens.ts
@@ -66,6 +66,7 @@ export const STABLE_COIN_ADDRESSES_TO_TAKE_FEE: Record = {
[ChainId.ARBITRUM]: [],
[ChainId.ZKEVM]: [],
[ChainId.LINEA]: [],
+ [ChainId.BASE]: [],
[ChainId.SOLANA_DEVNET]: [],
}
@@ -168,7 +169,10 @@ export const SUPER_STABLE_COINS_ADDRESS: { [chainId in ChainId]: string[] } = {
'0x1E4a5963aBFD975d8c9021ce480b42188849D41d', // USDT
'0xC5015b9d9161Dca7e18e32f6f25C4aD850731Fd4', // DAI
],
-
+ [ChainId.BASE]: [
+ '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', // USDbC
+ '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb', // DAI
+ ],
[ChainId.LINEA]: [],
[ChainId.SOLANA_DEVNET]: [],
}
@@ -220,111 +224,53 @@ export const CORRELATED_COINS_ADDRESS: { [chainId in ChainId]: string[][] } = {
[ChainId.AVAXTESTNET]: [],
[ChainId.ZKEVM]: [],
[ChainId.LINEA]: [],
+ [ChainId.BASE]: [],
[ChainId.SOLANA_DEVNET]: [],
}
export const DAI: { [chainId in ChainId]: Token } = {
- [ChainId.MAINNET]: new Token(
- ChainId.MAINNET,
- '0x6B175474E89094C44Da98b954EedeAC495271d0F',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
- [ChainId.GÖRLI]: new Token(ChainId.GÖRLI, '0x1BBeeEdCF32dc2c1Ebc2F138e3FC7f3DeCD44D6A', 18, 'DAI', 'Dai Stablecoin'),
- [ChainId.MATIC]: new Token(ChainId.MATIC, '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', 18, 'DAI', 'Dai Stablecoin'),
- [ChainId.MUMBAI]: new Token(
- ChainId.MUMBAI,
- '0x5e2de02472aC02736b43054f095837725A5870eF',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
- [ChainId.BSCTESTNET]: new Token(
- ChainId.BSCTESTNET,
- '0xBb843a2296F9AA49070EB2Dcd482f23548238f65',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
- [ChainId.BSCMAINNET]: new Token(
- ChainId.BSCMAINNET,
- '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
- [ChainId.AVAXTESTNET]: new Token(
- ChainId.AVAXTESTNET,
- '0xE50c0F38a1890Db49d64ac1C4A5B4fe2f02f819d',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
- [ChainId.AVAXMAINNET]: new Token(
- ChainId.AVAXMAINNET,
- '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
- [ChainId.FANTOM]: new Token(
- ChainId.FANTOM,
- '0x91a40C733c97a6e1BF876EaF9ed8c08102eB491f',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
- [ChainId.CRONOS]: new Token(
- ChainId.CRONOS,
- '0xF2001B145b43032AAF5Ee2884e456CCd805F677D',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
+ [ChainId.MAINNET]: new Token(ChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'DAI'),
+ [ChainId.GÖRLI]: new Token(ChainId.GÖRLI, '0x1BBeeEdCF32dc2c1Ebc2F138e3FC7f3DeCD44D6A', 18, 'DAI', 'DAI'),
+ [ChainId.MATIC]: new Token(ChainId.MATIC, '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', 18, 'DAI', 'DAI'),
+ [ChainId.MUMBAI]: new Token(ChainId.MUMBAI, '0x5e2de02472aC02736b43054f095837725A5870eF', 18, 'DAI', 'DAI'),
+ [ChainId.BSCTESTNET]: new Token(ChainId.BSCTESTNET, '0xBb843a2296F9AA49070EB2Dcd482f23548238f65', 18, 'DAI', 'DAI'),
+ [ChainId.BSCMAINNET]: new Token(ChainId.BSCMAINNET, '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', 18, 'DAI', 'DAI'),
+ [ChainId.AVAXTESTNET]: new Token(ChainId.AVAXTESTNET, '0xE50c0F38a1890Db49d64ac1C4A5B4fe2f02f819d', 18, 'DAI', 'DAI'),
+ [ChainId.AVAXMAINNET]: new Token(ChainId.AVAXMAINNET, '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', 18, 'DAI', 'DAI'),
+ [ChainId.FANTOM]: new Token(ChainId.FANTOM, '0x91a40C733c97a6e1BF876EaF9ed8c08102eB491f', 18, 'DAI', 'DAI'),
+ [ChainId.CRONOS]: new Token(ChainId.CRONOS, '0xF2001B145b43032AAF5Ee2884e456CCd805F677D', 18, 'DAI', 'DAI'),
[ChainId.ARBITRUM]: new Token(
ChainId.ARBITRUM,
'0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
18,
'DAI_e',
- 'Dai Stablecoin_Ethereum',
- ),
- [ChainId.BTTC]: new Token(ChainId.BTTC, '0xe7dC549AE8DB61BDE71F22097BEcc8dB542cA100', 18, 'DAI', 'Dai Stablecoin'),
- [ChainId.AURORA]: new Token(
- ChainId.AURORA,
- '0xe3520349F477A5F6EB06107066048508498A291b',
- 18,
- 'DAI',
- 'Dai Stablecoin',
+ 'DAI_Ethereum',
),
+ [ChainId.BTTC]: new Token(ChainId.BTTC, '0xe7dC549AE8DB61BDE71F22097BEcc8dB542cA100', 18, 'DAI', 'DAI'),
+ [ChainId.AURORA]: new Token(ChainId.AURORA, '0xe3520349F477A5F6EB06107066048508498A291b', 18, 'DAI', 'DAI'),
[ChainId.ZKEVM]: new Token(ChainId.ZKEVM, '0xC5015b9d9161Dca7e18e32f6f25C4aD850731Fd4', 18, 'DAI', 'Dai'),
[ChainId.LINEA]: new Token(ChainId.LINEA, '0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5', 18, 'DAI', 'Dai'),
+ [ChainId.BASE]: new Token(ChainId.BASE, '0x50c5725949a6f0c72e6c4a641f24049a917db0cb', 18, 'DAI', 'Dai'),
//not existing on Velas
- [ChainId.VELAS]: new Token(ChainId.VELAS, '0xe7dC549AE8DB61BDE71F22097BEcc8dB542cA100', 18, 'DAI', 'Dai Stablecoin'),
+ [ChainId.VELAS]: new Token(ChainId.VELAS, '0xe7dC549AE8DB61BDE71F22097BEcc8dB542cA100', 18, 'DAI', 'DAI'),
//not existing on Oasis
- [ChainId.OASIS]: new Token(ChainId.OASIS, '0xe7dC549AE8DB61BDE71F22097BEcc8dB542cA100', 18, 'DAI', 'Dai Stablecoin'),
- [ChainId.OPTIMISM]: new Token(
- ChainId.OPTIMISM,
- '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
- 18,
- 'DAI',
- 'Dai Stablecoin',
- ),
+ [ChainId.OASIS]: new Token(ChainId.OASIS, '0xe7dC549AE8DB61BDE71F22097BEcc8dB542cA100', 18, 'DAI', 'DAI'),
+ [ChainId.OPTIMISM]: new Token(ChainId.OPTIMISM, '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1', 18, 'DAI', 'DAI'),
[ChainId.ZKSYNC]: new Token(ChainId.ZKSYNC, '0x4BEf76b6b7f2823C6c1f4FcfEACD85C24548ad7e', 18, 'DAI', 'Dai'),
[ChainId.SOLANA]: new Token(
ChainId.SOLANA,
'EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o',
8,
'DAI',
- 'Dai Stablecoin (Wormhole)',
+ 'DAI (Wormhole)',
),
[ChainId.SOLANA_DEVNET]: new Token(
ChainId.SOLANA_DEVNET,
'EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o',
8,
'DAI',
- 'Dai Stablecoin (Wormhole)',
+ 'DAI (Wormhole)',
),
}
@@ -333,33 +279,21 @@ export const USDC: { [chainId in ChainId]: Token } = {
[ChainId.GÖRLI]: new Token(ChainId.GÖRLI, '0x8e9Bd30D15420bAe4B7EC0aC014B7ECeE864373C', 18, 'USDC', 'USD Coin'),
[ChainId.MATIC]: new Token(ChainId.MATIC, '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', 6, 'USDC', 'USD Coin'),
[ChainId.MUMBAI]: new Token(ChainId.MUMBAI, '0x2CeC76B26A8d96BF3072D34A01BB3a4edE7c06BE', 6, 'USDC', 'USD Coin'),
- [ChainId.BSCTESTNET]: new Token(
- ChainId.BSCTESTNET,
- '0xb448B701807E644f141a4E4a269aD2F567526505',
- 6,
- 'USDC',
- 'USD Coin',
- ),
- [ChainId.BSCMAINNET]: new Token(
- ChainId.BSCMAINNET,
- '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d',
- 18,
- 'USDC',
- 'USD Coin',
- ),
+ [ChainId.BSCTESTNET]: new Token(ChainId.BSCTESTNET, '0xb448B701807E644f141a4E4a269aD2F567526505', 6, 'USDC', 'USDC'),
+ [ChainId.BSCMAINNET]: new Token(ChainId.BSCMAINNET, '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d', 18, 'USDC', 'USDC'),
[ChainId.AVAXTESTNET]: new Token(
ChainId.AVAXTESTNET,
'0x5973774202E8b0ad563A69D502bb0e670e7d00Dd',
6,
'USDC',
- 'USD Coin',
+ 'USDC',
),
[ChainId.AVAXMAINNET]: new Token(
ChainId.AVAXMAINNET,
'0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
6,
'USDC.e',
- 'USD Coin',
+ 'USDC',
),
[ChainId.FANTOM]: new Token(ChainId.FANTOM, '0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf', 6, 'USDC', 'USD Coin'),
[ChainId.CRONOS]: new Token(ChainId.CRONOS, '0xc21223249CA28397B4B6541dfFaEcC539BfF0c59', 6, 'USDC', 'USD Coin'),
@@ -386,6 +320,7 @@ export const USDC: { [chainId in ChainId]: Token } = {
),
[ChainId.ZKEVM]: new Token(ChainId.ZKEVM, '0xA8CE8aee21bC2A48a5EF670afCc9274C7bbbC035', 6, 'USDC', 'USD Coin'),
[ChainId.LINEA]: new Token(ChainId.LINEA, '0x176211869cA2b568f2A7D4EE941E073a821EE1ff', 6, 'USDC', 'USD Coin'),
+ [ChainId.BASE]: new Token(ChainId.BASE, '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', 6, 'USDC', 'USD Coin'),
}
export const USDT: { [chainId in ChainId]: Token } = {
@@ -453,6 +388,9 @@ export const USDT: { [chainId in ChainId]: Token } = {
'USDT',
'Tether USD',
),
+
+ // not existed
+ [ChainId.BASE]: new Token(ChainId.BASE, '0xA219439258ca9da29E9Cc4cE5596924745e12B93', 6, 'USDT', 'Tether USD'),
}
export const COMP = new Token(ChainId.MAINNET, '0xc00e94Cb662C3520282E6f5717214004A7f26888', 18, 'COMP', 'Compound')
@@ -471,99 +409,38 @@ export const KNCL_ADDRESS = '0xdd974D5C2e2928deA5F71b9825b8b646686BD200'
// todo: make it nullable
export const KNC: { [chainId in ChainId]: Token } = {
- [ChainId.MAINNET]: new Token(ChainId.MAINNET, KNC_ADDRESS, 18, 'KNC', 'Kyber Network Crystal'),
- [ChainId.GÖRLI]: new Token(
- ChainId.GÖRLI,
- '0xd19e5119Efc73FeA1e70f9fbbc105DaB89D914e4',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ),
- [ChainId.MATIC]: new Token(
- ChainId.MATIC,
- '0x1C954E8fe737F99f68Fa1CCda3e51ebDB291948C',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ),
- [ChainId.MUMBAI]: new Token(
- ChainId.MUMBAI,
- '0xFD1f9381Cb641Dc76Fe8087dbcf8ea84a2c77cbE',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ),
- [ChainId.BSCTESTNET]: new Token(
- ChainId.BSCTESTNET,
- '0x51E8D106C646cA58Caf32A47812e95887C071a62',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ),
- [ChainId.BSCMAINNET]: new Token(
- ChainId.BSCMAINNET,
- '0xfe56d5892BDffC7BF58f2E84BE1b2C32D21C308b',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ),
- [ChainId.AVAXTESTNET]: new Token(ChainId.AVAXTESTNET, KNC_ADDRESS, 18, 'KNC', 'Kyber Network Crystal'),
- [ChainId.AVAXMAINNET]: new Token(
- ChainId.AVAXMAINNET,
- '0x39fC9e94Caeacb435842FADeDeCB783589F50f5f',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ),
- [ChainId.FANTOM]: new Token(ChainId.FANTOM, KNC_ADDRESS, 18, 'KNC', 'Kyber Network Crystal'),
- [ChainId.CRONOS]: new Token(ChainId.CRONOS, KNC_ADDRESS, 18, 'KNC', 'Kyber Network Crystal'),
- [ChainId.AURORA]: new Token(ChainId.AURORA, KNC_ADDRESS, 18, 'KNC', 'Kyber Network Crystal'),
- [ChainId.BTTC]: new Token(
- ChainId.BTTC,
- '0x18fA72e0EE4C580a129b0CE5bD0694d716C7443E',
- 18,
- 'KNC_b',
- 'Kyber Network Crystal v2 - BSC',
- ),
-
- // UPDATE WHEN HAS BRIDGE KNC
- [ChainId.ARBITRUM]: new Token(ChainId.ARBITRUM, KNC_ADDRESS, 18, 'KNC', 'Kyber Network Crystal'),
- [ChainId.VELAS]: new Token(ChainId.VELAS, KNC_ADDRESS, 18, 'KNC', 'Kyber Network Crystal'),
- [ChainId.OASIS]: new Token(ChainId.OASIS, KNC_ADDRESS, 18, 'KNC', 'Kyber Network Crystal'),
- [ChainId.OPTIMISM]: new Token(
- ChainId.OPTIMISM,
- '0xa00e3a3511aac35ca78530c85007afcd31753819',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ),
+ [ChainId.MAINNET]: new Token(ChainId.MAINNET, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+ [ChainId.GÖRLI]: new Token(ChainId.GÖRLI, '0xd19e5119Efc73FeA1e70f9fbbc105DaB89D914e4', 18, 'KNC', 'KNC'),
+ [ChainId.MATIC]: new Token(ChainId.MATIC, '0x1C954E8fe737F99f68Fa1CCda3e51ebDB291948C', 18, 'KNC', 'KNC'),
+ [ChainId.BSCTESTNET]: new Token(ChainId.BSCTESTNET, '0x51E8D106C646cA58Caf32A47812e95887C071a62', 18, 'KNC', 'KNC'),
+ [ChainId.BSCMAINNET]: new Token(ChainId.BSCMAINNET, '0xfe56d5892BDffC7BF58f2E84BE1b2C32D21C308b', 18, 'KNC', 'KNC'),
+ [ChainId.AVAXMAINNET]: new Token(ChainId.AVAXMAINNET, '0x39fC9e94Caeacb435842FADeDeCB783589F50f5f', 18, 'KNC', 'KNC'),
+ [ChainId.BTTC]: new Token(ChainId.BTTC, '0x18fA72e0EE4C580a129b0CE5bD0694d716C7443E', 18, 'KNC_b', 'KNC v2 - BSC'),
+ [ChainId.ARBITRUM]: new Token(ChainId.ARBITRUM, '0xe4DDDfe67E7164b0FE14E218d80dC4C08eDC01cB', 18, 'KNC', 'KNC'),
+ [ChainId.OPTIMISM]: new Token(ChainId.OPTIMISM, '0xa00e3a3511aac35ca78530c85007afcd31753819', 18, 'KNC', 'KNC'),
[ChainId.LINEA]: new Token(ChainId.LINEA, '0x3b2F62d42DB19B30588648bf1c184865D4C3B1D6', 18, 'KNC', 'KNC'),
+ [ChainId.ZKEVM]: new Token(ChainId.ZKEVM, '0x6A80A465409ce8D36C513129C0FEEa61BEd579ba', 18, 'KNC', 'KNC'),
- // TODO(viet-nv): this address doesn't exist. check again
- [ChainId.ZKSYNC]: new Token(
- ChainId.ZKSYNC,
- '0xa00e3a3511aac35ca78530c85007afcd31753819',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ),
- [ChainId.SOLANA]: new Token(
- ChainId.SOLANA,
- 'KNCkfGAnBUvoG5EJipAzSBjjaF8iNL4ivYsBS14DKdg',
- 18,
- 'KNC',
- 'Kyber Network Crystal',
- ), // todo: not exists yet
+ // TODO(viet-nv): KNC does not exist on the below chain
+ [ChainId.CRONOS]: new Token(ChainId.CRONOS, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+ [ChainId.AURORA]: new Token(ChainId.AURORA, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+ [ChainId.FANTOM]: new Token(ChainId.FANTOM, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+ [ChainId.BASE]: new Token(ChainId.BASE, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+ [ChainId.ZKSYNC]: new Token(ChainId.ZKSYNC, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+ [ChainId.VELAS]: new Token(ChainId.VELAS, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+ [ChainId.OASIS]: new Token(ChainId.OASIS, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+
+ [ChainId.AVAXTESTNET]: new Token(ChainId.AVAXTESTNET, KNC_ADDRESS, 18, 'KNC', 'KNC'),
+ [ChainId.MUMBAI]: new Token(ChainId.MUMBAI, '0xFD1f9381Cb641Dc76Fe8087dbcf8ea84a2c77cbE', 18, 'KNC', 'KNC'),
+
+ [ChainId.SOLANA]: new Token(ChainId.SOLANA, 'KNCkfGAnBUvoG5EJipAzSBjjaF8iNL4ivYsBS14DKdg', 18, 'KNC', 'KNC'), // todo: not exists yet
[ChainId.SOLANA_DEVNET]: new Token(
ChainId.SOLANA_DEVNET,
'KNCkfGAnBUvoG5EJipAzSBjjaF8iNL4ivYsBS14DKdg',
18,
'KNC',
- 'Kyber Network Crystal',
+ 'KNC',
),
-
- // not existing
- [ChainId.ZKEVM]: new Token(ChainId.ZKEVM, '0x3b2F62d42DB19B30588648bf1c184865D4C3B1D6', 18, 'KNC', 'KNC'),
}
export const PINNED_PAIRS: { readonly [chainId in ChainId]?: [Token, Token][] } = {
@@ -591,10 +468,11 @@ export const DEFAULT_OUTPUT_TOKEN_BY_CHAIN: Partial> = {
[ChainId.OASIS]: USDC[ChainId.OASIS],
[ChainId.BTTC]: USDT[ChainId.BTTC], // USDT_b
[ChainId.SOLANA]: USDC[ChainId.SOLANA],
- [ChainId.GÖRLI]: KNC[ChainId.GÖRLI],
+ [ChainId.GÖRLI]: USDT[ChainId.GÖRLI],
[ChainId.ZKSYNC]: USDC[ChainId.ZKSYNC],
[ChainId.ZKEVM]: USDT[ChainId.ZKEVM],
[ChainId.LINEA]: USDC[ChainId.LINEA],
+ [ChainId.BASE]: USDC[ChainId.BASE],
}
export const DEFAULT_SWAP_FEE_STABLE_PAIRS = 4
diff --git a/src/constants/v2.ts b/src/constants/v2.ts
index 877ce443a1..e7fb9bd3dc 100644
--- a/src/constants/v2.ts
+++ b/src/constants/v2.ts
@@ -1,12 +1,3 @@
-import { ChainId } from '@kyberswap/ks-sdk-core'
-import { t } from '@lingui/macro'
-
-export const ELASTIC_NOT_SUPPORTED: { [key: string]: string } = {
- [ChainId.AURORA]: t`Elastic is not supported on Aurora. Please switch to other chains`,
- [ChainId.ZKSYNC]: t`Elastic will be available soon`,
- // [ChainId.VELAS]: t`Elastic will be available soon`,
-}
-
export enum VERSION {
ELASTIC = 'elastic',
CLASSIC = 'classic',
diff --git a/src/hooks/Tokens.ts b/src/hooks/Tokens.ts
index 0b3a22b6f4..9cc625a414 100644
--- a/src/hooks/Tokens.ts
+++ b/src/hooks/Tokens.ts
@@ -26,7 +26,7 @@ import useDebounce from './useDebounce'
function useTokensFromMap(tokenMap: TokenAddressMap, lowercaseAddress?: boolean, customChainId?: ChainId): TokenMap {
const { chainId: currentChainId } = useActiveWeb3React()
const chainId = customChainId || currentChainId
- const userAddedTokens = useUserAddedTokens()
+ const userAddedTokens = useUserAddedTokens(chainId)
return useMemo(() => {
if (!chainId) return {}
diff --git a/src/pages/About/AboutKyberSwap/index.tsx b/src/pages/About/AboutKyberSwap/index.tsx
index c192e0ded4..9843a19356 100644
--- a/src/pages/About/AboutKyberSwap/index.tsx
+++ b/src/pages/About/AboutKyberSwap/index.tsx
@@ -1034,12 +1034,17 @@ function AboutKyberSwap() {
+
diff --git a/src/pages/App.tsx b/src/pages/App.tsx
index e49426b87c..5996d55fb6 100644
--- a/src/pages/App.tsx
+++ b/src/pages/App.tsx
@@ -25,7 +25,7 @@ import Snowfall from 'components/Snowflake/Snowfall'
import Web3ReactManager from 'components/Web3ReactManager'
import { ENV_LEVEL } from 'constants/env'
import { APP_PATHS, BLACKLIST_WALLETS, CHAINS_SUPPORT_CROSS_CHAIN } from 'constants/index'
-import { NETWORKS_INFO, SUPPORTED_NETWORKS } from 'constants/networks'
+import { CLASSIC_NOT_SUPPORTED, NETWORKS_INFO, SUPPORTED_NETWORKS } from 'constants/networks'
import { ENV_TYPE } from 'constants/type'
import { useActiveWeb3React } from 'hooks'
import { useAutoLogin } from 'hooks/useLogin'
@@ -156,7 +156,7 @@ const RedirectWithNetworkSuffix = () => {
const RoutesWithNetworkPrefix = () => {
const { network } = useParams()
- const { networkInfo } = useActiveWeb3React()
+ const { networkInfo, chainId } = useActiveWeb3React()
const location = useLocation()
useSyncNetworkParamWithStore()
@@ -176,15 +176,22 @@ const RoutesWithNetworkPrefix = () => {
return (
- } />
- }
- />
- }
- />
+ {!CLASSIC_NOT_SUPPORTED[chainId] && (
+ <>
+ }
+ />
+ }
+ />
+ }
+ />
+ >
+ )}
) => {
- let kncPriceByETH = 0
-
- try {
- const result = await apolloClient.query({
- query: TOKEN_DERIVED_ETH(KNC[chainId].address),
- fetchPolicy: 'no-cache',
- })
-
- const derivedETH = result?.data?.tokens[0]?.derivedETH
-
- kncPriceByETH = parseFloat(derivedETH) || 0
- } catch (e) {
- console.log(e)
- }
-
- return kncPriceByETH
-}
-
export function useKNCPrice() {
const { data } = useTokenPricesWithLoading([KNC_ADDRESS], ChainId.MAINNET)
if (!data) return 0
diff --git a/src/utils/index.ts b/src/utils/index.ts
index 8622594eb2..269eaddb63 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -11,7 +11,7 @@ import { GET_BLOCKS } from 'apollo/queries'
import { ENV_KEY } from 'constants/env'
import { DEFAULT_GAS_LIMIT_MARGIN, ZERO_ADDRESS } from 'constants/index'
import { NETWORKS_INFO, SUPPORTED_NETWORKS, isEVM } from 'constants/networks'
-import { KNC, KNCL_ADDRESS } from 'constants/tokens'
+import { KNCL_ADDRESS, KNC_ADDRESS } from 'constants/tokens'
import { EVMWalletInfo, SUPPORTED_WALLET, SolanaWalletInfo, WalletInfo } from 'constants/wallets'
import store from 'state'
import { GroupedTxsByHash, TransactionDetails } from 'state/transactions/type'
@@ -377,7 +377,7 @@ export const getTokenLogoURL = (inputAddress: string, chainId: ChainId): string
address = WETH[chainId].address
}
- if (address.toLowerCase() === KNC[chainId].address.toLowerCase()) {
+ if (address.toLowerCase() === KNC_ADDRESS) {
return 'https://raw.githubusercontent.com/KyberNetwork/kyberswap-interface/develop/src/assets/images/KNC.svg'
}
diff --git a/yarn.lock b/yarn.lock
index f54bcfa5be..cd50cc9c0e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2068,10 +2068,10 @@
tiny-warning "^1.0.3"
toformat "^2.0.0"
-"@kyberswap/ks-sdk-core@1.0.9", "@kyberswap/ks-sdk-core@^1.0.5":
- version "1.0.9"
- resolved "https://registry.yarnpkg.com/@kyberswap/ks-sdk-core/-/ks-sdk-core-1.0.9.tgz#9cb4915a9703948e840e62f332daca1282fcf189"
- integrity sha512-kl2o0sw3Q+rR6KHxQbe57Gl2ajWv9IGaboOaRSpxCKsmA27hRmVaaiMmbbWfJNh8h6UZB9WohEoG/U48kD7o4Q==
+"@kyberswap/ks-sdk-core@1.0.10", "@kyberswap/ks-sdk-core@^1.0.5":
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/@kyberswap/ks-sdk-core/-/ks-sdk-core-1.0.10.tgz#11de6c644d67ecdf3ced22e2560ff28580225846"
+ integrity sha512-g3+EDfCjH0waYacmN/yiSvEWITwDME2lWLutCPx1G43ySfmQoFTXIuzcBWdit8t2eXtTLBhzu1IBTM1WjUbaOA==
dependencies:
"@ethersproject/address" "^5.0.2"
"@solana/web3.js" "^1.66.2"
From 16fe520f298ad2760da2736a088c58f55b508fb1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nguy=E1=BB=85n=20Ho=C3=A0i=20Danh?=
<33005392+nguyenhoaidanh@users.noreply.github.com>
Date: Tue, 29 Aug 2023 11:03:51 +0700
Subject: [PATCH 3/4] fix: min size check box crosschain (#2196)
---
src/pages/Bridge/ComfirmBridgeModal.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/Bridge/ComfirmBridgeModal.tsx b/src/pages/Bridge/ComfirmBridgeModal.tsx
index 5d18de085c..a90da3df6b 100644
--- a/src/pages/Bridge/ComfirmBridgeModal.tsx
+++ b/src/pages/Bridge/ComfirmBridgeModal.tsx
@@ -361,7 +361,7 @@ export const ConfirmCrossChainModal = memo(function ConfirmCrossChainModal({
}}
type="checkbox"
checked={accepted}
- style={{ height: '16px', width: '16px', cursor: 'pointer' }}
+ style={{ height: '16px', width: '16px', minWidth: '16px', minHeight: '16px', cursor: 'pointer' }}
/>
From 489c5a9a9475813369872d4a92325d0863b76f51 Mon Sep 17 00:00:00 2001
From: ltthienn <132639843+ltthienn@users.noreply.github.com>
Date: Tue, 29 Aug 2023 14:28:27 +0700
Subject: [PATCH 4/4] [QA-46] | E2E - Validate Pool APR, TVL response (#2195)
---
.github/workflows/cypress.yml | 22 ++++-----
.github/workflows/schedule.yml | 14 +++---
cypress.config.ts | 6 +--
cypress/e2e/pages/farm-page.po.cy.ts | 46 +++++++++++++++++++
cypress/e2e/pages/swap-page.po.cy.ts | 21 +++++++--
cypress/e2e/selectors/selectors.cy.ts | 5 ++
cypress/e2e/specs/farm-page.e2e.cy.ts | 24 ++++++++++
cypress/e2e/specs/intercept.e2e.cy.ts | 31 +++++++++----
.../YieldPools/ElasticFarmGroup/FarmCard.tsx | 6 ++-
.../ElasticFarmv2/components/FarmCard.tsx | 4 +-
10 files changed, 143 insertions(+), 36 deletions(-)
create mode 100644 cypress/e2e/pages/farm-page.po.cy.ts
create mode 100644 cypress/e2e/specs/farm-page.e2e.cy.ts
diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml
index c72a026cf8..ca66fcb250 100644
--- a/.github/workflows/cypress.yml
+++ b/.github/workflows/cypress.yml
@@ -48,11 +48,11 @@ jobs:
REF_BRANCH=${REF/refs\/tags\//}
BRANCH=$REF_BRANCH
fi
- echo "::set-output name=value::$BRANCH"
+ echo "value=$BRANCH" >> $GITHUB_OUTPUT
- name: Extract GitHub HEAD SHA
id: head_sha
- run: echo "::set-output name=value::$(git rev-parse HEAD)"
+ run: echo "value=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Get Docker image tag
id: get_tag
@@ -60,7 +60,7 @@ jobs:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
short_sha="$(echo $HEAD_SHA | head -c7)"
- echo "::set-output name=image_tag::adpr-$short_sha"
+ echo "image_tag=adpr-$short_sha" >> $GITHUB_OUTPUT
cypress-test:
runs-on: ubuntu-latest
@@ -87,7 +87,7 @@ jobs:
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
-
+
- name: Yarn Build
env:
CI: false
@@ -95,16 +95,16 @@ jobs:
CURRENT_BRANCH: ${{ needs.prepare.outputs.current_branch }}
NODE_OPTIONS: '--max_old_space_size=4096'
run: yarn build-adpr
-
+
- name: Install cypress
- run: yarn cypress install --force
-
+ run: yarn cypress install --force
+
- name: Run xvfb and fluxbox
run: |
Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
env:
- DISPLAY: :0.0
+ DISPLAY: :0.0
- name: Run Cypress Test
run: |+
@@ -113,8 +113,8 @@ jobs:
yarn test-e2e -e grepTags=smoke,NETWORK=Ethereum
env:
DISPLAY: :0.0
-
- - name: Archive e2e artifacts
+
+ - name: Archive e2e artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8
if: always()
with:
@@ -122,4 +122,4 @@ jobs:
path: |
cypress/videos
cypress/screenshots
- continue-on-error: true
+ continue-on-error: true
diff --git a/.github/workflows/schedule.yml b/.github/workflows/schedule.yml
index 04862cd183..2f3c0718dc 100644
--- a/.github/workflows/schedule.yml
+++ b/.github/workflows/schedule.yml
@@ -33,15 +33,15 @@ jobs:
sudo apt-get install --no-install-recommends -y \
fluxbox \
xvfb
-
+
- name: Install cypress
- run: yarn cypress install --force
-
+ run: yarn cypress install --force
+
- name: Run xvfb and fluxbox
run: Xvfb :0 -screen 0 1024x768x24 -listen tcp -ac &
fluxbox &
env:
- DISPLAY: :0.0
+ DISPLAY: :0.0
- name: Run Cypress Test
run: |+
@@ -49,7 +49,7 @@ jobs:
yarn test-schedule -e grepTags=regression,NETWORK=${{ matrix.network }}
env:
DISPLAY: :0.0
-
+
- name: Notify on failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
@@ -61,8 +61,8 @@ jobs:
SLACK_TITLE: E2E Test ${{inputs.BASE_URL}}
SLACK_USERNAME: autoBot
SLACK_LINK_NAMES: true
-
- - name: Archive e2e artifacts
+
+ - name: Archive e2e artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8
if: always()
with:
diff --git a/cypress.config.ts b/cypress.config.ts
index 5da0b93d20..4a3042f44d 100644
--- a/cypress.config.ts
+++ b/cypress.config.ts
@@ -14,8 +14,8 @@ export default defineConfig({
viewportWidth: 1920,
viewportHeight: 1080,
env: {
- grepFilterSpecs:true,
- grepOmitFiltered:true
+ grepFilterSpecs: true,
+ grepOmitFiltered: true,
},
e2e: {
setupNodeEvents(on, config) {
@@ -23,6 +23,6 @@ export default defineConfig({
require('@cypress/grep/src/plugin')(config)
synpressPlugins(on, config)
},
- specPattern: 'cypress/e2e/specs/*.e2e.cy.ts'
+ specPattern: 'cypress/e2e/specs/*.e2e.cy.ts',
},
})
diff --git a/cypress/e2e/pages/farm-page.po.cy.ts b/cypress/e2e/pages/farm-page.po.cy.ts
new file mode 100644
index 0000000000..3575e57f45
--- /dev/null
+++ b/cypress/e2e/pages/farm-page.po.cy.ts
@@ -0,0 +1,46 @@
+import { FarmLocators, HeaderLocators } from "../selectors/selectors.cy"
+
+export class FarmPage {
+
+ getTvlValues() {
+ const arr: string[] = []
+ const listData = cy.get(FarmLocators.lblTvl)
+ listData
+ .each(item => {
+ arr.push(item.text().split('$')[1])
+ })
+ return arr
+ }
+
+ getAprValues() {
+ const arr: string[] = []
+ const listData = cy.get(FarmLocators.lblApr)
+ listData
+ .each(item => {
+ arr.push(item.text().split('%')[0])
+ })
+ return arr
+ }
+
+ countInvalidFarms(arrApr: string[], arrTvl: string[]) {
+ const totalFarms = arrApr.length
+ let count = 0;
+ for (let i = 0; i < totalFarms; i++) {
+ if (((arrTvl[i]) === undefined || Number(arrTvl[i]) === 0) && Number(arrApr[i]) === 0) {
+ count = count + 1;
+ }
+ }
+ return count
+ }
+
+ checkExistData() {
+ return cy.get(FarmLocators.lblApr, {timeout: 5000}).should(() => { }).then($obj => {
+ if ($obj.length > 0) {
+ return true
+ }
+ else {
+ return false
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/cypress/e2e/pages/swap-page.po.cy.ts b/cypress/e2e/pages/swap-page.po.cy.ts
index 6da235890b..31dc3d5fe6 100644
--- a/cypress/e2e/pages/swap-page.po.cy.ts
+++ b/cypress/e2e/pages/swap-page.po.cy.ts
@@ -1,4 +1,4 @@
-import { NetworkLocators, SwapPageLocators, TokenCatalogLocators, WalletLocators } from "../selectors/selectors.cy"
+import { HeaderLocators, NetworkLocators, SwapPageLocators, TokenCatalogLocators, WalletLocators } from "../selectors/selectors.cy"
export interface myCallbackType {
(myArgument: T): void
@@ -35,14 +35,29 @@ export const SwapPage = {
getStatusConnectedWallet() {
cy.get(WalletLocators.statusConnected, { timeout: 10000 }).should('be.visible')
- }
+ },
+
+ goToFarmPage() {
+ cy.get(HeaderLocators.dropdownEarn).click({ force: true })
+ cy.get(HeaderLocators.lblFarms).click({ force: true })
+ },
+
+ goToPoolPage() {
+ cy.get(HeaderLocators.dropdownEarn).click({ force: true })
+ cy.get(HeaderLocators.lblPools).click({ force: true })
+ },
+
+ goToMyPoolsPage() {
+ cy.get(HeaderLocators.dropdownEarn).click({ force: true })
+ cy.get(HeaderLocators.lblMyPools).click({ force: true })
+ },
}
export class Network {
selectNetwork(network: string) {
cy.get(NetworkLocators.btnSelectNetwork, { timeout: 30000 }).should('be.visible').click()
cy.get(NetworkLocators.btnNetwork).contains(network).click({ force: true })
- }
+ }
}
export class TokenCatalog {
diff --git a/cypress/e2e/selectors/selectors.cy.ts b/cypress/e2e/selectors/selectors.cy.ts
index e7af50485a..f3a85e1eb3 100644
--- a/cypress/e2e/selectors/selectors.cy.ts
+++ b/cypress/e2e/selectors/selectors.cy.ts
@@ -39,3 +39,8 @@ export const HeaderLocators = {
lblMyPools: '[data-testid=my-pools-nav-link]',
lblFarms: '[data-testid=farms-nav-link]',
}
+
+export const FarmLocators = {
+ lblApr: '[data-testid=apr-value]',
+ lblTvl: '[data-testid=tvl-value]',
+}
\ No newline at end of file
diff --git a/cypress/e2e/specs/farm-page.e2e.cy.ts b/cypress/e2e/specs/farm-page.e2e.cy.ts
new file mode 100644
index 0000000000..2015017a57
--- /dev/null
+++ b/cypress/e2e/specs/farm-page.e2e.cy.ts
@@ -0,0 +1,24 @@
+import { FarmPage } from "../pages/farm-page.po.cy";
+import { SwapPage } from "../pages/swap-page.po.cy"
+import { DEFAULT_URL, TAG, } from "../selectors/constants.cy"
+const farm = new FarmPage()
+
+describe('Farm', { tags: TAG.regression }, () => {
+ beforeEach(() => {
+ SwapPage.open(DEFAULT_URL)
+ SwapPage.goToFarmPage()
+ farm.checkExistData().then((value) => {
+ if (value === true) {
+ cy.wrap(farm.getAprValues()).as('arrApr')
+ cy.wrap(farm.getTvlValues()).as('arrTvl')
+ }
+ cy.wrap(value).as('checkData')
+ })
+ })
+ it('Should be displayed APR and TVL values', function () {
+ if (this.checkData === true) {
+ const count = farm.countInvalidFarms(this.arrApr, this.arrTvl)
+ expect(count).not.to.equal(this.arrApr.length)
+ }
+ })
+})
diff --git a/cypress/e2e/specs/intercept.e2e.cy.ts b/cypress/e2e/specs/intercept.e2e.cy.ts
index cefd5f6ce7..163e19ca92 100644
--- a/cypress/e2e/specs/intercept.e2e.cy.ts
+++ b/cypress/e2e/specs/intercept.e2e.cy.ts
@@ -1,7 +1,10 @@
/* eslint-disable @typescript-eslint/no-empty-function */
-import { SwapPage } from "../pages/swap-page.po.cy"
-import { DEFAULT_URL, TAG, } from "../selectors/constants.cy"
+import { FarmPage } from "../pages/farm-page.po.cy";
+import { SwapPage, TokenCatalog } from "../pages/swap-page.po.cy"
+import { DEFAULT_URL, TAG, } from "../selectors/constants.cy"
import { HeaderLocators } from "../selectors/selectors.cy"
+const tokenCatalog = new TokenCatalog()
+const farm = new FarmPage()
describe('Intercept', { tags: TAG.regression }, () => {
beforeEach(() => {
@@ -19,19 +22,32 @@ describe('Intercept', { tags: TAG.regression }, () => {
cy.intercept('GET', '**/farm-pools?**').as('get-farm-list')
cy.intercept('GET', '**/pools?**').as('get-pool-list')
cy.intercept('GET', '**/block?**').as('get-block')
- cy.get(HeaderLocators.dropdownEarn).click({ force: true })
- cy.get(HeaderLocators.lblPools).click({ force: true })
+ SwapPage.goToPoolPage()
cy.wait('@get-farm-list', { timeout: 5000 }).its('response.statusCode').should('equal', 200)
cy.wait('@get-pool-list', { timeout: 5000 }).its('response.statusCode').should('equal', 200)
cy.wait('@get-block', { timeout: 60000 }).its('response.statusCode').should('equal', 200)
})
+
+ it('Should be displayed APR and TVL values', () => {
+ cy.intercept('GET', '**/pools?**').as('get-pools')
+ SwapPage.goToPoolPage()
+ cy.wait('@get-pools', { timeout: 20000 }).its('response.body.data').then(response => {
+ const totalPools = response.pools.length;
+ const count = response.pools.reduce((acc: number, pool: { totalValueLockedUsd: string; apr: string }) => {
+ if (pool.totalValueLockedUsd === '0' && pool.apr === '0') {
+ return acc + 1;
+ }
+ return acc;
+ }, 0);
+ expect(count).not.to.equal(totalPools);
+ })
+ })
})
describe('My Pools', () => {
it('Should get farm list successfully', () => {
cy.intercept('GET', '**/farm-pools?**').as('get-farm-list')
- cy.get(HeaderLocators.dropdownEarn).click({ force: true })
- cy.get(HeaderLocators.lblPools).click({ force: true })
+ SwapPage.goToMyPoolsPage()
cy.wait('@get-farm-list', { timeout: 5000 }).its('response.statusCode').should('equal', 200)
})
})
@@ -41,8 +57,7 @@ describe('Intercept', { tags: TAG.regression }, () => {
cy.intercept('GET', '**/farm-pools?**').as('get-farm-list')
cy.intercept('GET', '**/pools?**').as('get-pool-list')
cy.intercept('GET', '**/block?**').as('get-block')
- cy.get(HeaderLocators.dropdownEarn).click({ force: true })
- cy.get(HeaderLocators.lblFarms).click({ force: true })
+ SwapPage.goToFarmPage()
cy.get('[data-testid=farm-block]')
.should(_ => {})
.then($list => {
diff --git a/src/components/YieldPools/ElasticFarmGroup/FarmCard.tsx b/src/components/YieldPools/ElasticFarmGroup/FarmCard.tsx
index d4d3a888f4..7950031d8f 100644
--- a/src/components/YieldPools/ElasticFarmGroup/FarmCard.tsx
+++ b/src/components/YieldPools/ElasticFarmGroup/FarmCard.tsx
@@ -207,7 +207,7 @@ const FarmCard = ({
-
+
{(pool.farmAPR + pool.poolAPR).toFixed(2)}%
@@ -230,7 +230,9 @@ const FarmCard = ({
- {formatDollarAmount(pool.tvl)}
+
+ {formatDollarAmount(pool.tvl)}
+
{pool.startTime > currentTimestamp ? (
{getFormattedTimeFromSecond(pool.startTime - currentTimestamp)}
) : pool.endTime > currentTimestamp ? (
diff --git a/src/pages/Farm/ElasticFarmv2/components/FarmCard.tsx b/src/pages/Farm/ElasticFarmv2/components/FarmCard.tsx
index a1defa6ae8..fedf159687 100644
--- a/src/pages/Farm/ElasticFarmv2/components/FarmCard.tsx
+++ b/src/pages/Farm/ElasticFarmv2/components/FarmCard.tsx
@@ -283,7 +283,7 @@ function FarmCard({
)
}
>
-
+
{farm.tvl ? formatDollarAmount(farm.tvl) : '--'}
@@ -377,7 +377,7 @@ function FarmCard({
-
+
{(poolAPR + (range?.apr || 0)).toFixed(2)}%