diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 0f80ebb7bd..e621c974f4 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -114,7 +114,7 @@ jobs: VITE_TAG: ${{ needs.prepare.outputs.image_tag }} CURRENT_BRANCH: ${{ needs.prepare.outputs.current_branch }} NODE_OPTIONS: '--max_old_space_size=4096' - run: yarn build + run: yarn build-dev - name: Docker build and push uses: docker/build-push-action@v2 diff --git a/package.json b/package.json index be9d66f6ab..f8e62113b3 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@kybernetwork/oauth2": "1.0.0", "@kyberswap/krystal-walletconnect-v2": "0.0.1", "@kyberswap/ks-sdk-classic": "^1.0.3", - "@kyberswap/ks-sdk-core": "1.0.11", + "@kyberswap/ks-sdk-core": "1.0.12", "@kyberswap/ks-sdk-elastic": "^1.1.2", "@kyberswap/ks-sdk-solana": "^1.0.2", "@lingui/loader": "~3.14.0", @@ -200,7 +200,7 @@ "vite-tsconfig-paths": "^4.0.8" }, "resolutions": { - "@kyberswap/ks-sdk-core": "1.0.11", + "@kyberswap/ks-sdk-core": "1.0.12", "babel-plugin-lodash/@babel/types": "~7.20.0", "react-error-overlay": "6.0.9", "@lingui/babel-plugin-extract-messages": "3.14.0", diff --git a/src/constants/bases.ts b/src/constants/bases.ts index 8a4bd0bae2..808d2b0641 100644 --- a/src/constants/bases.ts +++ b/src/constants/bases.ts @@ -28,6 +28,7 @@ const WETH_ONLY: ChainTokenList = { [ChainId.LINEA]: [WETH[ChainId.LINEA]], [ChainId.ZKEVM]: [WETH[ChainId.ZKEVM]], [ChainId.BASE]: [WETH[ChainId.BASE]], + [ChainId.SCROLL]: [WETH[ChainId.SCROLL]], [ChainId.SOLANA_DEVNET]: [WETH[ChainId.SOLANA_DEVNET]], } @@ -179,4 +180,5 @@ export const SUGGESTED_BASES: ChainTokenList = { new Token(ChainId.LINEA, '0x7d43aabc515c356145049227cee54b608342c0ad', 18, 'BUSD', 'BUSD'), ], [ChainId.BASE]: [...WETH_ONLY[ChainId.BASE], USDC[ChainId.BASE], DAI[ChainId.BASE]], + [ChainId.SCROLL]: [...WETH_ONLY[ChainId.SCROLL], USDT[ChainId.SCROLL], USDC[ChainId.SCROLL], DAI[ChainId.SCROLL]], } diff --git a/src/constants/networks.ts b/src/constants/networks.ts index 51149291d8..9dad2d4a63 100644 --- a/src/constants/networks.ts +++ b/src/constants/networks.ts @@ -20,6 +20,7 @@ import { matic, mumbai, optimism, + scroll, solana, solanaDevnet, zkEvm, @@ -51,6 +52,7 @@ const NETWORKS_INFO_CONFIG: NETWORKS_INFO_CONFIG_TYPE = { [ChainId.LINEA]: linea, [ChainId.ZKEVM]: zkEvm, [ChainId.BASE]: base, + [ChainId.SCROLL]: scroll, [ChainId.SOLANA]: solana, [ChainId.SOLANA_DEVNET]: solanaDevnet, } as const @@ -77,6 +79,7 @@ export const MAINNET_NETWORKS = [ ChainId.ZKEVM, ChainId.ZKSYNC, ChainId.BASE, + ChainId.SCROLL, ChainId.BSCMAINNET, ChainId.AVAXMAINNET, // ChainId.SOLANA, @@ -148,6 +151,7 @@ export const STATIC_FEE_OPTIONS: { [chainId: number]: number[] | undefined } = { [ChainId.LINEA]: [8, 10, 50, 300, 500, 1000], [ChainId.ZKEVM]: [8, 10, 50, 300, 500, 1000], [ChainId.BASE]: [8, 10, 50, 300, 500, 1000], + [ChainId.SCROLL]: [8, 10, 50, 300, 500, 1000], } export const ONLY_STATIC_FEE_CHAINS = [ @@ -159,6 +163,7 @@ export const ONLY_STATIC_FEE_CHAINS = [ ChainId.LINEA, ChainId.ZKEVM, ChainId.BASE, + ChainId.SCROLL, ] // hardcode for unavailable subgraph diff --git a/src/constants/networks/index.ts b/src/constants/networks/index.ts index d5d210bd1b..f64d1000fd 100644 --- a/src/constants/networks/index.ts +++ b/src/constants/networks/index.ts @@ -17,4 +17,5 @@ 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 scroll } from './scroll' export { default as solanaDevnet } from './solana-devnet' diff --git a/src/constants/networks/scroll.ts b/src/constants/networks/scroll.ts new file mode 100644 index 0000000000..b78f11ec83 --- /dev/null +++ b/src/constants/networks/scroll.ts @@ -0,0 +1,70 @@ +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 scroll: EVMNetworkInfo = { + chainId: ChainId.SCROLL, + route: 'scroll', + ksSettingRoute: 'scroll', + priceRoute: 'scroll', + poolFarmRoute: 'scroll', + aggregatorRoute: 'scroll', + name: 'Scroll', + icon: 'https://file.notion.so/f/s/253723b6-f537-4968-a2e6-f102b893ef4c/Scroll_logo_mark_300300px_RGB.svg?id=2ecfe530-2ce5-48d0-8bed-537a584a92ce&table=block&spaceId=cc12e519-e01d-4277-9573-3fe8e5bdf9ce&expirationTimestamp=1697558400000&signature=-PD15tUbD8xuN5VOSpwW0B1Cl30TILAHe-LsLjqPhlQ&downloadName=Scroll_logo+mark_300*300px_RGB.svg', + + iconSelected: NOT_SUPPORT, + + defaultBlockSubgraph: 'https://scroll-graph.kyberengineering.io/subgraphs/name/kybernetwork/scroll-blocks', + etherscanUrl: 'https://scrollscan.com', + etherscanName: 'Scrollscan', + bridgeURL: 'https://scroll.io/bridge', + nativeToken: { + symbol: 'ETH', + name: 'ETH', + logo: EthereumLogo, + decimal: 18, + minForGas: 10 ** 16, + }, + defaultRpcUrl: 'https://rpc.scroll.io', + multicall: '0xcA11bde05977b3631167028862bE2a173976CA11', + classic: { + defaultSubgraph: 'https://scroll-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-exchange-scroll', + 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://scroll-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-scroll', + startBlock: 36376, + coreFactory: '0xC7a590291e07B9fe9E64b86c58fD8fC764308C4A', + nonfungiblePositionManager: '0xe222fBE074A436145b255442D919E4E3A6c6a480', + tickReader: '0x8Fd8Cb948965d9305999D767A02bf79833EADbB3', + initCodeHash: '0x00e263aaa3a2c06a89b53217a9e7aad7e15613490a72e0f95f303c4de2dc7045', + quoter: '0x4d47fd5a29904Dae0Ef51b1c450C9750F15D7856', + routers: '0xF9c2b5746c946EF883ab2660BbbB1f10A5bdeAb4', + farms: ['0x7D5ba536ab244aAA1EA42aB88428847F25E3E676'], + farmv2Quoter: '0x6AFeb9EDd6Cf44fA8E89b1eee28284e6dD7705C8', + farmV2S: ['0x3D6AfE2fB73fFEd2E3dD00c501A174554e147a43', '0xf2BcDf38baA52F6b0C1Db5B025DfFf01Ae1d6dBd'], + }, + limitOrder: NOT_SUPPORT, + averageBlockTimeInSeconds: 8.4, // dont use for base + coingeckoNetworkId: 'scroll', + coingeckoNativeTokenId: 'ethereum', + deBankSlug: EMPTY, + dexToCompare: NOT_SUPPORT, + geckoTermialId: NOT_SUPPORT, +} + +export default scroll diff --git a/src/constants/tokens.ts b/src/constants/tokens.ts index 8087ffb1e5..121c9a0564 100644 --- a/src/constants/tokens.ts +++ b/src/constants/tokens.ts @@ -57,6 +57,7 @@ export const STABLE_COIN_ADDRESSES_TO_TAKE_FEE: Record = { [ChainId.ZKEVM]: [], [ChainId.LINEA]: [], [ChainId.BASE]: [], + [ChainId.SCROLL]: [], [ChainId.SOLANA_DEVNET]: [], } @@ -151,6 +152,7 @@ export const SUPER_STABLE_COINS_ADDRESS: { [chainId in ChainId]: string[] } = { '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb', // DAI ], [ChainId.LINEA]: [], + [ChainId.SCROLL]: [], [ChainId.SOLANA_DEVNET]: [], } @@ -200,6 +202,7 @@ export const CORRELATED_COINS_ADDRESS: { [chainId in ChainId]: string[][] } = { [ChainId.ZKEVM]: [], [ChainId.LINEA]: [], [ChainId.BASE]: [], + [ChainId.SCROLL]: [], [ChainId.SOLANA_DEVNET]: [], } @@ -243,6 +246,8 @@ export const DAI: { [chainId in ChainId]: Token } = { 'DAI', 'DAI (Wormhole)', ), + // TDOD: Get real DAI + [ChainId.SCROLL]: new Token(ChainId.SCROLL, '0x50c5725949a6f0c72e6c4a641f24049a917db0cb', 18, 'DAI', 'Dai'), } export const USDC: { [chainId in ChainId]: Token } = { @@ -284,6 +289,8 @@ 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'), + // TODO: verify this USDC on Scroll + [ChainId.SCROLL]: new Token(ChainId.SCROLL, '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4', 6, 'USDC', 'USD Coin'), } export const USDT: { [chainId in ChainId]: Token } = { @@ -352,6 +359,8 @@ export const USDT: { [chainId in ChainId]: Token } = { // not existed [ChainId.BASE]: new Token(ChainId.BASE, '0xA219439258ca9da29E9Cc4cE5596924745e12B93', 6, 'USDT', 'Tether USD'), + // TODO: verify this address + [ChainId.SCROLL]: new Token(ChainId.SCROLL, '0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df', 6, 'USDT', 'Tether USD'), } export const COMP = new Token(ChainId.MAINNET, '0xc00e94Cb662C3520282E6f5717214004A7f26888', 18, 'COMP', 'Compound') @@ -381,12 +390,13 @@ export const KNC: { [chainId in ChainId]: Token } = { [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'), + [ChainId.BASE]: new Token(ChainId.BASE, '0x28fe69Ff6864C1C218878BDCA01482D36B9D57b1', 18, 'KNC', 'KNC'), // 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.SCROLL]: new Token(ChainId.SCROLL, KNC_ADDRESS, 18, 'KNC', 'KNC'), [ChainId.ZKSYNC]: new Token(ChainId.ZKSYNC, KNC_ADDRESS, 18, 'KNC', 'KNC'), [ChainId.AVAXTESTNET]: new Token(ChainId.AVAXTESTNET, KNC_ADDRESS, 18, 'KNC', 'KNC'), @@ -430,6 +440,7 @@ export const DEFAULT_OUTPUT_TOKEN_BY_CHAIN: Partial> = { [ChainId.ZKEVM]: USDT[ChainId.ZKEVM], [ChainId.LINEA]: USDC[ChainId.LINEA], [ChainId.BASE]: USDC[ChainId.BASE], + [ChainId.SCROLL]: USDC[ChainId.SCROLL], } export const DEFAULT_SWAP_FEE_STABLE_PAIRS = 4 diff --git a/src/pages/About/AboutKyberSwap/index.tsx b/src/pages/About/AboutKyberSwap/index.tsx index 7db120d347..adcfa213e2 100644 --- a/src/pages/About/AboutKyberSwap/index.tsx +++ b/src/pages/About/AboutKyberSwap/index.tsx @@ -1017,6 +1017,11 @@ function AboutKyberSwap() { alt="Base" width="100%" /> + Sroll diff --git a/yarn.lock b/yarn.lock index a4e14a88d9..0a2d855de6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2293,10 +2293,10 @@ tiny-warning "^1.0.3" toformat "^2.0.0" -"@kyberswap/ks-sdk-core@1.0.11", "@kyberswap/ks-sdk-core@^1.0.5": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@kyberswap/ks-sdk-core/-/ks-sdk-core-1.0.11.tgz#59362240147001ccabcb49ed77991b2f78b0e440" - integrity sha512-A7pPRqr0lFeSYOsuitsld+WglV4G8Tl5FsKZpx9mBjOrSFKGLOtCE0oMwAeD4+Jjo8VyLJppkBINQYY7wAq8Xg== +"@kyberswap/ks-sdk-core@1.0.12", "@kyberswap/ks-sdk-core@^1.0.5": + version "1.0.12" + resolved "https://registry.yarnpkg.com/@kyberswap/ks-sdk-core/-/ks-sdk-core-1.0.12.tgz#a48cd835adb90cc138218746cea0d7f246d28643" + integrity sha512-JWqo4bfmvc74P5gUgmmJzZh2GQj5MzRPrpD4L/nIPMhzvdIMreK2aEbU0euv8g2ao+Gthnk8e3hnYragxzj7yQ== dependencies: "@ethersproject/address" "^5.0.2" "@solana/web3.js" "^1.66.2"