diff --git a/package.json b/package.json index 7ff6a103a5..8ac6a94b36 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.7-rc2", + "@kyberswap/ks-sdk-core": "1.0.8", "@kyberswap/ks-sdk-elastic": "^1.1.2", "@kyberswap/ks-sdk-solana": "^1.0.2", "@lingui/loader": "~3.14.0", @@ -199,7 +199,7 @@ "vite-tsconfig-paths": "^4.0.8" }, "resolutions": { - "@kyberswap/ks-sdk-core": "1.0.7-rc2", + "@kyberswap/ks-sdk-core": "1.0.8", "react-error-overlay": "6.0.9", "@lingui/babel-plugin-extract-messages": "3.14.0", "@lingui/cli": "3.14.0", diff --git a/src/components/Header/web3/NetworkModal/Networks.tsx b/src/components/Header/web3/NetworkModal/Networks.tsx index 69e2057eb8..baedfd0f46 100644 --- a/src/components/Header/web3/NetworkModal/Networks.tsx +++ b/src/components/Header/web3/NetworkModal/Networks.tsx @@ -197,7 +197,7 @@ const Networks = ({ {name} - {key === ChainId.ZKSYNC && ( + {key === ChainId.LINEA && ( New diff --git a/src/constants/bases.ts b/src/constants/bases.ts index 6b9bb07042..90e577560f 100644 --- a/src/constants/bases.ts +++ b/src/constants/bases.ts @@ -28,6 +28,7 @@ const WETH_ONLY: ChainTokenList = { [ChainId.ZKSYNC]: [WETH[ChainId.ZKSYNC]], [ChainId.SOLANA]: [WETH[ChainId.SOLANA]], [ChainId.LINEA_TESTNET]: [WETH[ChainId.LINEA_TESTNET]], + [ChainId.LINEA]: [WETH[ChainId.LINEA]], [ChainId.SOLANA_DEVNET]: [WETH[ChainId.SOLANA_DEVNET]], } @@ -183,4 +184,8 @@ export const SUGGESTED_BASES: ChainTokenList = { USDT[ChainId.LINEA_TESTNET], DAI[ChainId.LINEA_TESTNET], ], + [ChainId.LINEA]: [ + ...WETH_ONLY[ChainId.LINEA], + new Token(ChainId.LINEA, '0x7d43aabc515c356145049227cee54b608342c0ad', 18, 'BUSD', 'BUSD'), + ], } diff --git a/src/constants/index.ts b/src/constants/index.ts index 21fa6f3576..b8f2a4ef6e 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -339,7 +339,7 @@ export const CHAINS_SUPPORT_CROSS_CHAIN = ChainId.SOLANA, ] -export const TYPE_AND_SWAP_NOT_SUPPORTED_CHAINS: ChainId[] = [ChainId.ZKSYNC, ChainId.LINEA_TESTNET] +export const TYPE_AND_SWAP_NOT_SUPPORTED_CHAINS: ChainId[] = [ChainId.ZKSYNC, ChainId.LINEA_TESTNET, ChainId.LINEA] export const SWAP_FEE_RECEIVER_ADDRESS = '0x4f82e73EDb06d29Ff62C91EC8f5Ff06571bdeb29' diff --git a/src/constants/networks.ts b/src/constants/networks.ts index 1a44747bc4..b7c8da1862 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -14,6 +14,7 @@ import { ethereum, fantom, görli, + linea, lineaTestnet, matic, mumbai, @@ -50,6 +51,7 @@ export const NETWORKS_INFO_CONFIG: NETWORKS_INFO_CONFIG_TYPE = { [ChainId.OPTIMISM]: optimism, [ChainId.ZKSYNC]: zksync, [ChainId.LINEA_TESTNET]: lineaTestnet, + [ChainId.LINEA]: linea, [ChainId.SOLANA]: solana, [ChainId.SOLANA_DEVNET]: solanaDevnet, } as const @@ -80,8 +82,7 @@ export const MAINNET_NETWORKS = [ ChainId.VELAS, ChainId.AURORA, ChainId.ZKSYNC, - // TODO(viet-nv): update when integrating LINEA MAINNET - ChainId.LINEA_TESTNET, + ChainId.LINEA, ] as const export const EVM_NETWORKS = SUPPORTED_NETWORKS.filter(chainId => getChainType(chainId) === ChainType.EVM) as Exclude< diff --git a/src/constants/networks/index.ts b/src/constants/networks/index.ts index 7ac823d62d..352f7387a7 100644 --- a/src/constants/networks/index.ts +++ b/src/constants/networks/index.ts @@ -17,4 +17,5 @@ export { default as solana } from './solana' export { default as velas } from './velas' export { default as zksync } from './zksync' export { default as lineaTestnet } from './linea-testnet' +export { default as linea } from './linea' export { default as solanaDevnet } from './solana-devnet' diff --git a/src/constants/networks/linea.ts b/src/constants/networks/linea.ts new file mode 100644 index 0000000000..8b3f1cf19e --- /dev/null +++ b/src/constants/networks/linea.ts @@ -0,0 +1,73 @@ +import { ChainId } from '@kyberswap/ks-sdk-core' + +import EthereumLogo from 'assets/images/ethereum-logo.png' +import { KS_SETTING_API } from 'constants/env' +import { EVMNetworkInfo } from 'constants/networks/type' + +const EMPTY = '' +const EMPTY_ARRAY: any[] = [] +const NOT_SUPPORT = null + +const lineaInfo: EVMNetworkInfo = { + chainId: ChainId.LINEA, + route: 'linea', + ksSettingRoute: 'linea', + priceRoute: 'linea', + poolFarmRoute: 'linea', + aggregatorRoute: 'linea', + name: 'Linea', + icon: 'https://linea.build/apple-touch-icon.png', + iconDark: NOT_SUPPORT, + iconSelected: NOT_SUPPORT, + iconDarkSelected: NOT_SUPPORT, + defaultBlockSubgraph: '', // TODO + etherscanUrl: 'https://lineascan.build', + etherscanName: 'Linea Explorer', + tokenListUrl: `${KS_SETTING_API}/v1/tokens?chainIds=${ChainId.LINEA}&isWhitelisted=${true}`, + bridgeURL: EMPTY, + nativeToken: { + symbol: 'ETH', + name: 'LineaETH', + logo: EthereumLogo, + decimal: 18, + minForGas: 10 ** 16, + }, + defaultRpcUrl: 'https://rpc.linea.build', + multicall: '0xcA11bde05977b3631167028862bE2a173976CA11', + classic: { + defaultSubgraph: '', // TODO + static: { + zap: '', + router: '', + factory: '', + }, + oldStatic: NOT_SUPPORT, + dynamic: NOT_SUPPORT, + claimReward: NOT_SUPPORT, + fairlaunch: EMPTY_ARRAY, + fairlaunchV2: EMPTY_ARRAY, + }, + elastic: { + defaultSubgraph: '', // TODO + startBlock: 1769, + coreFactory: '0xC7a590291e07B9fe9E64b86c58fD8fC764308C4A', + nonfungiblePositionManager: '0xe222fBE074A436145b255442D919E4E3A6c6a480', + tickReader: '0x8Fd8Cb948965d9305999D767A02bf79833EADbB3', + initCodeHash: '0x00e263aaa3a2c06a89b53217a9e7aad7e15613490a72e0f95f303c4de2dc7045', + quoter: '0x4d47fd5a29904Dae0Ef51b1c450C9750F15D7856', + routers: '0xF9c2b5746c946EF883ab2660BbbB1f10A5bdeAb4', + farms: [], + }, + limitOrder: { + production: NOT_SUPPORT, + development: NOT_SUPPORT, + }, + averageBlockTimeInSeconds: 2, // TODO: check these info + coingeckoNetworkId: NOT_SUPPORT, + coingeckoNativeTokenId: NOT_SUPPORT, + deBankSlug: EMPTY, + dexToCompare: NOT_SUPPORT, + geckoTermialId: NOT_SUPPORT, +} + +export default lineaInfo diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts index 3af4c91827..70561933f4 100644 --- a/src/constants/tokens.ts +++ b/src/constants/tokens.ts @@ -133,6 +133,9 @@ export const STABLE_COINS_ADDRESS: { [chainId in ChainId]: string[] } = { '0x8741Ba6225A6BF91f9D73531A98A89807857a2B3', // DAI '0x7d43AABC515C356145049227CeE54B608342c0ad', // BUSD ], + [ChainId.LINEA]: [ + '0x7d43aabc515c356145049227cee54b608342c0ad', // BUSD + ], [ChainId.SOLANA]: [ 'EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o', // Dai 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // usdc @@ -187,6 +190,7 @@ export const STABLE_COIN_ADDRESSES_TO_TAKE_FEE: Record = { [ChainId.BSCMAINNET]: [], [ChainId.ARBITRUM]: [], [ChainId.LINEA_TESTNET]: [], + [ChainId.LINEA]: [], [ChainId.SOLANA_DEVNET]: [], } @@ -285,6 +289,7 @@ export const SUPER_STABLE_COINS_ADDRESS: { [chainId in ChainId]: string[] } = { [ChainId.BSCTESTNET]: [], [ChainId.AVAXTESTNET]: [], [ChainId.LINEA_TESTNET]: [], + [ChainId.LINEA]: [], [ChainId.SOLANA_DEVNET]: [], } @@ -334,6 +339,7 @@ export const CORRELATED_COINS_ADDRESS: { [chainId in ChainId]: string[][] } = { [ChainId.BSCTESTNET]: [], [ChainId.AVAXTESTNET]: [], [ChainId.LINEA_TESTNET]: [], + [ChainId.LINEA]: [], [ChainId.SOLANA_DEVNET]: [], } @@ -418,6 +424,10 @@ export const DAI: { [chainId in ChainId]: Token } = { 'DAI', 'Dai', ), + + //not existing + [ChainId.LINEA]: new Token(ChainId.LINEA, '0x8741Ba6225A6BF91f9D73531A98A89807857a2B3', 18, 'DAI', 'Dai'), + //not existing on Velas [ChainId.VELAS]: new Token(ChainId.VELAS, '0xe7dC549AE8DB61BDE71F22097BEcc8dB542cA100', 18, 'DAI', 'Dai Stablecoin'), //not existing on Oasis @@ -509,6 +519,9 @@ export const USDC: { [chainId in ChainId]: Token } = { 'USDC', 'USD Coin', ), + + // not existing + [ChainId.LINEA]: new Token(ChainId.LINEA, '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', 6, 'USDC', 'USD Coin'), } export const USDT: { [chainId in ChainId]: Token } = { @@ -564,6 +577,7 @@ export const USDT: { [chainId in ChainId]: Token } = { 'USDT', 'Tether USD', ), + [ChainId.LINEA_TESTNET]: new Token( ChainId.LINEA_TESTNET, '0x1990BC6dfe2ef605Bfc08f5A23564dB75642Ad73', @@ -571,6 +585,10 @@ export const USDT: { [chainId in ChainId]: Token } = { 'USDT', 'Tether USD', ), + + // not existing + [ChainId.LINEA]: new Token(ChainId.LINEA, '0x1990BC6dfe2ef605Bfc08f5A23564dB75642Ad73', 6, 'USDT', 'Tether USD'), + [ChainId.ZKSYNC]: new Token(ChainId.ZKSYNC, '0x493257fd37edb34451f62edf8d2a0c418852ba4c', 6, 'USDT', 'Tether USD'), [ChainId.SOLANA]: new Token(ChainId.SOLANA, 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB', 6, 'USDT', 'Tether USD'), [ChainId.SOLANA_DEVNET]: new Token( @@ -687,14 +705,16 @@ export const KNC: { [chainId in ChainId]: Token } = { 'Kyber Network Crystal', ), - // TODO(viet-nv): + // not existing [ChainId.LINEA_TESTNET]: new Token( ChainId.LINEA_TESTNET, '0x6Cb9750a92643382e020eA9a170AbB83Df05F30B', 6, - 'USDT', - 'Tether USD', + 'KNC', + 'KNC', ), + // not existing + [ChainId.LINEA]: new Token(ChainId.LINEA, '0x6Cb9750a92643382e020eA9a170AbB83Df05F30B', 6, 'KNC', 'KNC'), } export const PINNED_PAIRS: { readonly [chainId in ChainId]?: [Token, Token][] } = { @@ -725,6 +745,7 @@ export const DEFAULT_OUTPUT_TOKEN_BY_CHAIN: Partial> = { [ChainId.GÖRLI]: KNC[ChainId.GÖRLI], [ChainId.ZKSYNC]: USDC[ChainId.ZKSYNC], [ChainId.LINEA_TESTNET]: USDC[ChainId.LINEA_TESTNET], + [ChainId.LINEA]: new Token(ChainId.LINEA, '0x7d43aabc515c356145049227cee54b608342c0ad', 18, 'BUSD', 'BUSD'), } export const DEFAULT_SWAP_FEE_STABLE_PAIRS = 4 diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 2aa6c33bf5..3477844850 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -5,7 +5,7 @@ import * as Sentry from '@sentry/react' import { Suspense, lazy, useEffect } from 'react' import { isMobile } from 'react-device-detect' import { AlertTriangle } from 'react-feather' -import { Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom' +import { Navigate, Route, Routes, useLocation, useNavigate, useParams } from 'react-router-dom' import { useNetwork, usePrevious } from 'react-use' import { Flex, Text } from 'rebass' import styled from 'styled-components' @@ -14,6 +14,7 @@ import snow from 'assets/images/snow.png' import Popups from 'components/Announcement/Popups' import TopBanner from 'components/Announcement/Popups/TopBanner' import AppHaveUpdate from 'components/AppHaveUpdate' +import { ButtonPrimary } from 'components/Button' import ModalConfirm from 'components/ConfirmModal' import ErrorBoundary from 'components/ErrorBoundary' import Footer from 'components/Footer/Footer' @@ -45,6 +46,22 @@ import ElasticLegacyNotice from './ElasticLegacy/ElasticLegacyNotice' import Icons from './Icons' import VerifyAuth from './Verify/VerifyAuth' +// THIS IS ONLY TEMPORARY, WILL REMOVE IN NEXT VERSION +const CommingSoonModal = () => { + const navigate = useNavigate() + return ( + navigate('/')}> + + Our pools and farms will be available soon! + + navigate('/')}> + Ok + + + + ) +} + // test page for swap only through elastic const ElasticSwap = lazy(() => import('./ElasticSwap')) const SwapV2 = lazy(() => import('./SwapV2')) @@ -331,19 +348,28 @@ export default function App() { <> {/* Pools Routes */} } /> - } /> + : } + /> <> {/* Farms Routes */} } /> - } /> + : } + /> <> {/* My Pools Routes */} } /> - } /> + : } + /> <> diff --git a/src/state/about/hooks.ts b/src/state/about/hooks.ts index 8fd83d3a85..8f3274a843 100644 --- a/src/state/about/hooks.ts +++ b/src/state/about/hooks.ts @@ -53,9 +53,7 @@ export function useGlobalData() { } const getResultByChainIds = async (chainIds: readonly ChainId[]) => { // todo namgold: add aggregator API for solana - const elasticChains = chainIds - .filter(id => isEVM(id)) - .filter(id => !ELASTIC_NOT_SUPPORTED[id] && id !== ChainId.LINEA_TESTNET) + const elasticChains = chainIds.filter(id => isEVM(id)).filter(id => !ELASTIC_NOT_SUPPORTED[id]) const elasticPromises = elasticChains.map(chain => allKyberswapConfig[chain].elasticClient.query({ @@ -72,14 +70,12 @@ export function useGlobalData() { return total + parseFloat(item?.data?.factories?.[0]?.totalValueLockedUSD || '0') }, 0) - const allChainPromises = chainIds - .filter(id => isEVM(id) && id !== ChainId.LINEA_TESTNET) - .map(chain => - allKyberswapConfig[chain].classicClient.query({ - query: GLOBAL_DATA(), - fetchPolicy: 'cache-first', - }), - ) + const allChainPromises = chainIds.filter(isEVM).map(chain => + allKyberswapConfig[chain].classicClient.query({ + query: GLOBAL_DATA(), + fetchPolicy: 'cache-first', + }), + ) const queryResult = (await Promise.all(allChainPromises.map(promises => promises.catch(e => e)))).filter( res => !(res instanceof Error), diff --git a/yarn.lock b/yarn.lock index 9349def944..078f7e665b 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.7-rc2", "@kyberswap/ks-sdk-core@^1.0.5": - version "1.0.7-rc2" - resolved "https://registry.yarnpkg.com/@kyberswap/ks-sdk-core/-/ks-sdk-core-1.0.7-rc2.tgz#ab707a43625bdd6b7416ad0482c94d2a25e9560a" - integrity sha512-CaWbLr7+3AXLHsF3AxMTapjvAo/AisRZQghtY664mzEk6otYfXeeizcgV3o/gML7/rW3YPdUFM4iifwHcXlOqQ== +"@kyberswap/ks-sdk-core@1.0.8", "@kyberswap/ks-sdk-core@^1.0.5": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@kyberswap/ks-sdk-core/-/ks-sdk-core-1.0.8.tgz#11dbcbc7fd2d1243e221c5e7436be2b7735ee108" + integrity sha512-mbOr9oLcEmtKWdyXKio4pUWRBX0qkFHOrNmSet81MsXMCgIz59hMFqlZ7KSNL8j8iOJOR79j7s8deOUtghQsKA== dependencies: "@ethersproject/address" "^5.0.2" "@solana/web3.js" "^1.66.2"