From 5e15c611eab231e71d9f118431d33d70f888f66d Mon Sep 17 00:00:00 2001 From: ChefJoJo <94336009+chef-jojo@users.noreply.github.com> Date: Thu, 24 Aug 2023 20:08:22 +0800 Subject: [PATCH] feat: Linea (#7547) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 🤖 Generated by Copilot at 0864022 ### Summary 🌐🥞🚀 This pull request adds support for the Linea chain, a new blockchain network, to the PancakeSwap web app and smart router packages. It defines the Linea chain parameters, contract addresses, tokens, pools, and subgraph URL in various files. It also enables V2 and V3 features for the Linea chain, such as cross-chain and cross-protocol swaps, gas model, and multicall. > _Sing, O Muse, of the valiant developers who dared_ > _To add support for the Linea chain, a new network fair_ > _They updated the web app and the packages with skill and care_ > _And defined the tokens, contracts, and queries with `chains.ts` as their lair_ ### Walkthrough * Add Linea chain support to the web app and the smart router packages ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-5b02b946734e39568c018763a8445fe22e5633c04fa393f78eaec1947165713dR146), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4R29), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4R94-R135), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4R148), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4R160), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ccab19ffbec70686dc2221f7b79432ece4302c36067c91063d258209c09ec07R197), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ccab19ffbec70686dc2221f7b79432ece4302c36067c91063d258209c09ec07R211), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-7238357db46da6bb48ca41841457ac0e832ee21fb8fd76a6b3c9dbf701ce8c62R76), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR16), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR38), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR54), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR70), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR93), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecR4), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecR36), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecR73), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95R15), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95R31), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95R46), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-d8d2e80f999905e1bd9986d3e969db239634d3022e41fc1471625e64ec294a54R48-R51), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-8678467f9c5f232cf1e8d50d56227b3901ce30af399e575a2d1b39ef99eebf8dR219), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-dfa0d43a8db000e0c6466316afa72d83e8ce626238b0960dae8ecdf2de43bfc3R53), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-49573f110ec3a7b2c18b2aec89dcca7184192e3187731aaed499af0da5ae3c08R23), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R17), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R33), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R48), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R63), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R87), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-24d3b14038aadecce9558c47648b19363b226e949e3580a1381f1b4eb5af9bdfR11), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-24d3b14038aadecce9558c47648b19363b226e949e3580a1381f1b4eb5af9bdfR28), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-811cce7aeac21c9b1e6aceba276b6f1c541076dbf4722a255a0c1c7c40b9c3ccR83), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-b61d8bdd98a286c72deb45821a4ec9c7f76e5d799076e05a8f094a0ca72f79c2R21), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-b61d8bdd98a286c72deb45821a4ec9c7f76e5d799076e05a8f094a0ca72f79c2R36), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-f6944a0f19cabcd660c00c460c8db3a84157604fd85ec718e2530b2bf300e952R26), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-9ee18cb7fa7b08aada0e9a3c92dede9202fb872ba10bd8f230843faef707f463R31), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-9ee18cb7fa7b08aada0e9a3c92dede9202fb872ba10bd8f230843faef707f463R48), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R16), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R38), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R56), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R141-R148), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R197), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R226), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-e19e37172da9e6ea69624bbf503812c8bf3999c4bc79c78a9fe7288219c0de7eR1-R7), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-8dce334490b3aef54ec2484deec6ef79b4438828dc1ee3324cfa3b2a5244251bR210), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-8dce334490b3aef54ec2484deec6ef79b4438828dc1ee3324cfa3b2a5244251bR272)) * Define the chain id, name, network, native currency, rpc urls, block explorers, contracts, and testnet flag for the Linea chain in `chains.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4R94-R135), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4R160)) * Add the Linea chain name and query name to the network switcher component and the chain explorer URL in `NetworkSwitcher.tsx` and `chains.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-5b02b946734e39568c018763a8445fe22e5633c04fa393f78eaec1947165713dR146), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-870705bc610c873933b2d04d9a57db54345cab8d9ad2af707454ac577b21f6e4R29)) * Add the Linea rpc urls for the server and public nodes in `nodes.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecR4), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecR36), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-17218d64565ce12e09953351575126053d6b30541c3605f7ee38a34374a7daecR73)) * Add the Linea addresses for the PancakeSwap V2 factory and router contracts in `contracts.ts` and `exchange.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ccab19ffbec70686dc2221f7b79432ece4302c36067c91063d258209c09ec07R197), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ccab19ffbec70686dc2221f7b79432ece4302c36067c91063d258209c09ec07R211), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R48)) * Add the Linea subgraph URL for the Uniswap V3 pools in `endpoints.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-7238357db46da6bb48ca41841457ac0e832ee21fb8fd76a6b3c9dbf701ce8c62R76)) * Add the Linea chain refresh time, suggested bases, bases to track liquidity, and pairs to track liquidity in `exchange.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR38), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR54), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR70), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6c1ab0c7f31ca2b1900f09bca08f47eb81d6df582ebc368bdcc1000dbf59659fR93)) * Add the Linea revalidation time for the fast, normal, and slow pools in `pools.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95R15), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95R31), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-6ddce95e802c6a0d90c11aede57b78c496812dc5c4b41ad90624e555af6bde95R46)) * Add the Linea default token and pool list in `useInfoUserSavedTokensAndPoolsList.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-d8d2e80f999905e1bd9986d3e969db239634d3022e41fc1471625e64ec294a54R48-R51)) * Add the Linea chain to the combineMaps function in `lists/hooks.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-8678467f9c5f232cf1e8d50d56227b3901ce30af399e575a2d1b39ef99eebf8dR219)) * Add the Linea swap data to the SWAP_INFO_BY_CHAIN object in `fetchDerivedPriceData.ts` ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-dfa0d43a8db000e0c6466316afa72d83e8ce626238b0960dae8ecdf2de43bfc3R53)) * Add the Linea chain name to the CHAIN_ID_TO_CHAIN_NAME object in `common.ts` for the smart router package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-49573f110ec3a7b2c18b2aec89dcca7184192e3187731aaed499af0da5ae3c08R23)) * Add the Linea address for the smart router contract in `exchange.ts` for the smart router package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R33)) * Add the Linea address for the stable swap info contract in `exchange.ts` for the smart router package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R63)) * Add the Linea bases to check trades against in `exchange.ts` for the smart router package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-78ce9cd83b6e1807ee9752c395d004a76077b4df666c24beafa7932c76193b02R87)) * Add the Linea usd gas tokens in `gasModel/index.ts` for the gas model package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-24d3b14038aadecce9558c47648b19363b226e949e3580a1381f1b4eb5af9bdfR28)) * Add the Linea chain to the BATCH_MULTICALL_CONFIGS object in `multicall.ts` for the multicall package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-811cce7aeac21c9b1e6aceba276b6f1c541076dbf4722a255a0c1c7c40b9c3ccR83)) * Add the Linea address for the mixed route quoter contract and the Uniswap V3 quoter contract in `v3.ts` for the v3 router package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-b61d8bdd98a286c72deb45821a4ec9c7f76e5d799076e05a8f094a0ca72f79c2R21), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-b61d8bdd98a286c72deb45821a4ec9c7f76e5d799076e05a8f094a0ca72f79c2R36)) * Add the Linea address for the PancakeSwap multicall contract in `multicallSwapProvider.ts` for the multicall swap provider package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-f6944a0f19cabcd660c00c460c8db3a84157604fd85ec718e2530b2bf300e952R26)) * Add the Linea success rate config and block conflict tolerance in `onChainQuoteProvider.ts` for the on chain quote provider package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-9ee18cb7fa7b08aada0e9a3c92dede9202fb872ba10bd8f230843faef707f463R31), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-9ee18cb7fa7b08aada0e9a3c92dede9202fb872ba10bd8f230843faef707f463R48)) * Add the Linea chain id, factory address, init code hash, wrapped ether token, wrapped native token, and native token in `constants.ts` for the swap sdk package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R16), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R38), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R56), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R141-R148), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R197), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-47643406d29b8598e2ec7264a59eca0794e0b4f77eded976f680d8dc5c145595R226)) * Add the Linea tokens in `59144.ts` and `common.ts` for the tokens package ([link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-e19e37172da9e6ea69624bbf503812c8bf3999c4bc79c78a9fe7288219c0de7eR1-R7), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-8dce334490b3aef54ec2484deec6ef79b4438828dc1ee3324cfa3b2a5244251bR210), [link](https://github.com/pancakeswap/pancake-frontend/pull/7547/files?diff=unified&w=0#diff-8dce334490b3aef54ec2484deec6ef79b4438828dc1ee3324cfa3b2a5244251bR272)) --------- Co-authored-by: chefjackson <116779127+chefjackson@users.noreply.github.com> --- .changeset/wild-insects-fetch.md | 9 ++++ apis/routing/src/constants.ts | 2 + apps/aptos/components/NetworkSwitcher.tsx | 1 + apps/web/src/components/NetworkSwitcher.tsx | 1 + apps/web/src/config/chains.ts | 51 ++++++++++++++++++- apps/web/src/config/constants/contracts.ts | 2 + apps/web/src/config/constants/endpoints.ts | 1 + apps/web/src/config/constants/exchange.ts | 5 ++ apps/web/src/config/constants/lists.ts | 29 +++++++---- .../tokenLists/pancake-default.tokenlist.json | 8 +++ apps/web/src/config/nodes.ts | 4 +- apps/web/src/config/pools.ts | 3 ++ .../state/swap/fetch/fetchDerivedPriceData.ts | 1 + apps/web/src/utils/graphql.ts | 1 + packages/smart-router/evm/constants/common.ts | 1 + .../smart-router/evm/constants/exchange.ts | 5 ++ .../evm/constants/gasModel/index.ts | 2 + .../smart-router/evm/constants/multicall.ts | 1 + packages/smart-router/evm/constants/v3.ts | 2 + .../providers/multicallSwapProvider.ts | 1 + .../providers/onChainQuoteProvider.ts | 2 + packages/swap-sdk/src/constants.ts | 13 +++++ packages/tokens/src/59144.ts | 9 ++++ packages/tokens/src/common.ts | 3 ++ packages/tokens/src/index.ts | 1 + .../src/components/CurrencyLogo/utils.ts | 1 + packages/v3-sdk/src/constants.ts | 3 ++ 27 files changed, 149 insertions(+), 13 deletions(-) create mode 100644 .changeset/wild-insects-fetch.md create mode 100644 packages/tokens/src/59144.ts diff --git a/.changeset/wild-insects-fetch.md b/.changeset/wild-insects-fetch.md new file mode 100644 index 000000000..ca80f3bcc --- /dev/null +++ b/.changeset/wild-insects-fetch.md @@ -0,0 +1,9 @@ +--- +'routing-api': minor +'@pancakeswap/smart-router': minor +'@pancakeswap/sdk': minor +'@pancakeswap/tokens': minor +'@pancakeswap/v3-sdk': minor +--- + +Add linea support diff --git a/apis/routing/src/constants.ts b/apis/routing/src/constants.ts index 4efa3bf75..c10d28aa6 100644 --- a/apis/routing/src/constants.ts +++ b/apis/routing/src/constants.ts @@ -11,6 +11,7 @@ export const SUPPORTED_CHAINS = [ ChainId.ARBITRUM_ONE, ChainId.SCROLL_SEPOLIA, ChainId.BASE_TESTNET, + ChainId.LINEA, ] as const export type SupportedChainId = (typeof SUPPORTED_CHAINS)[number] @@ -24,6 +25,7 @@ export const V3_SUBGRAPH_URLS: Record = { [ChainId.ZKSYNC]: 'https://api.studio.thegraph.com/query/45376/exchange-v3-zksync/version/latest', [ChainId.SCROLL_SEPOLIA]: 'https://api.studio.thegraph.com/query/45376/exchange-v3-scroll-sepolia/version/latest', [ChainId.BASE_TESTNET]: 'https://api.studio.thegraph.com/query/45376/exchange-v3-base-testnet/version/latest', + [ChainId.LINEA]: 'https://graph-query.linea.build/subgraphs/name/pancakeswap/exchange-v3-linea', [ChainId.LINEA_TESTNET]: 'https://thegraph.goerli.zkevm.consensys.net/subgraphs/name/pancakeswap/exchange-v3-linea-goerli', [ChainId.ARBITRUM_ONE]: 'https://api.thegraph.com/subgraphs/name/pancakeswap/exchange-v3-arb', diff --git a/apps/aptos/components/NetworkSwitcher.tsx b/apps/aptos/components/NetworkSwitcher.tsx index d152f1677..9186acbdb 100644 --- a/apps/aptos/components/NetworkSwitcher.tsx +++ b/apps/aptos/components/NetworkSwitcher.tsx @@ -14,6 +14,7 @@ const evmChains = [ { id: 324, name: 'zkSync Era', chainName: 'zkSync' }, { id: 1101, name: 'Polygon zkEVM', chainName: 'polygonZkEVM' }, { id: 42161, name: 'Arbitrum One', chainName: 'arb' }, + { id: 59144, name: 'Linea', chainName: 'linea' }, ] const NetworkSelect = () => { diff --git a/apps/web/src/components/NetworkSwitcher.tsx b/apps/web/src/components/NetworkSwitcher.tsx index 961461d50..821242ce2 100644 --- a/apps/web/src/components/NetworkSwitcher.tsx +++ b/apps/web/src/components/NetworkSwitcher.tsx @@ -149,6 +149,7 @@ const SHORT_SYMBOL = { [ChainId.POLYGON_ZKEVM_TESTNET]: 'tZkEVM', [ChainId.ZKSYNC]: 'zkSync', [ChainId.ZKSYNC_TESTNET]: 'tZkSync', + [ChainId.LINEA]: 'Linea', [ChainId.LINEA_TESTNET]: 'tLinea', [ChainId.OPBNB_TESTNET]: 'tOpBNB', [ChainId.BASE_TESTNET]: 'tBase', diff --git a/apps/web/src/config/chains.ts b/apps/web/src/config/chains.ts index 69d1cfc60..1ea35f302 100644 --- a/apps/web/src/config/chains.ts +++ b/apps/web/src/config/chains.ts @@ -28,6 +28,7 @@ export const CHAIN_QUERY_NAME = { [ChainId.POLYGON_ZKEVM_TESTNET]: 'polygonZkEVMTestnet', [ChainId.ZKSYNC]: 'zkSync', [ChainId.ZKSYNC_TESTNET]: 'zkSyncTestnet', + [ChainId.LINEA]: 'linea', [ChainId.LINEA_TESTNET]: 'lineaTestnet', [ChainId.OPBNB_TESTNET]: 'opBnbTestnet', [ChainId.BASE_TESTNET]: 'baseTestnet', @@ -99,6 +100,48 @@ export const opbnbTestnet = { testnet: true, } as const satisfies Chain +export const linea = { + id: 59_144, + name: 'Linea Mainnet', + network: 'linea-mainnet', + nativeCurrency: { name: 'Linea Ether', symbol: 'ETH', decimals: 18 }, + rpcUrls: { + infura: { + http: ['https://linea-mainnet.infura.io/v3'], + webSocket: ['wss://linea-mainnet.infura.io/ws/v3'], + }, + default: { + http: ['https://rpc.linea.build'], + webSocket: ['wss://rpc.linea.build'], + }, + public: { + http: ['https://rpc.linea.build'], + webSocket: ['wss://rpc.linea.build'], + }, + }, + blockExplorers: { + default: { + name: 'Etherscan', + url: 'https://lineascan.build', + }, + etherscan: { + name: 'Etherscan', + url: 'https://lineascan.build', + }, + blockscout: { + name: 'Blockscout', + url: 'https://explorer.linea.build', + }, + }, + contracts: { + multicall3: { + address: '0xcA11bde05977b3631167028862bE2a173976CA11', + blockCreated: 42, + }, + }, + testnet: false, +} as const satisfies Chain + /** * Controls some L2 specific behavior, e.g. slippage tolerance, special UI behavior. * The expectation is that all of these networks have immediate transaction confirmation. @@ -111,6 +154,7 @@ export const L2_CHAIN_IDS: ChainId[] = [ ChainId.ZKSYNC, ChainId.ZKSYNC_TESTNET, ChainId.LINEA_TESTNET, + ChainId.LINEA, ] export const CHAINS = [ @@ -118,10 +162,13 @@ export const CHAINS = [ mainnet, bscTestnet, goerli, - zkSync, - zkSyncTestnet, polygonZkEvm, polygonZkEvmTestnet, + zkSync, + zkSyncTestnet, + arbitrum, + arbitrumGoerli, + linea, lineaTestnet, arbitrumGoerli, arbitrum, diff --git a/apps/web/src/config/constants/contracts.ts b/apps/web/src/config/constants/contracts.ts index 93adcd81c..36412af6f 100644 --- a/apps/web/src/config/constants/contracts.ts +++ b/apps/web/src/config/constants/contracts.ts @@ -200,6 +200,7 @@ export default { [ChainId.POLYGON_ZKEVM]: '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364', [ChainId.POLYGON_ZKEVM_TESTNET]: '0x1f489dd5B559E976AE74303F939Cfd0aF1b62C2B', [ChainId.ARBITRUM_ONE]: '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364', + [ChainId.LINEA]: '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364', [ChainId.LINEA_TESTNET]: '0xacFa791C833120c769Fd3066c940B7D30Cd8BC73', [ChainId.ARBITRUM_GOERLI]: '0xb10120961f7504766976A89E29802Fa00553da5b', [ChainId.OPBNB_TESTNET]: '0x9d4277f1D41CCB30C0e91f7d1bBA2A739E19032C', @@ -217,6 +218,7 @@ export default { [ChainId.POLYGON_ZKEVM]: '0xbC203d7f83677c7ed3F7acEc959963E7F4ECC5C2', [ChainId.POLYGON_ZKEVM_TESTNET]: '0x4A3902773F947ce028969db670E568fFC9524E8C', [ChainId.ARBITRUM_ONE]: '0xbC203d7f83677c7ed3F7acEc959963E7F4ECC5C2', + [ChainId.LINEA]: '0xbC203d7f83677c7ed3F7acEc959963E7F4ECC5C2', [ChainId.LINEA_TESTNET]: '0x3652Fc6EDcbD76161b8554388867d3dAb65eCA93', [ChainId.ARBITRUM_GOERLI]: '0xCcf770BdBD8ccC57a7a7ABff53825fD895a06238', [ChainId.OPBNB_TESTNET]: '0xA1911b740c07c0d58cAa71b54CD06f7D11218a3B', diff --git a/apps/web/src/config/constants/endpoints.ts b/apps/web/src/config/constants/endpoints.ts index bf6ad6c22..079eb374f 100644 --- a/apps/web/src/config/constants/endpoints.ts +++ b/apps/web/src/config/constants/endpoints.ts @@ -74,6 +74,7 @@ export const V3_SUBGRAPH_URLS = { [ChainId.POLYGON_ZKEVM_TESTNET]: null, [ChainId.ZKSYNC]: 'https://api.studio.thegraph.com/query/45376/exchange-v3-zksync/version/latest', [ChainId.ZKSYNC_TESTNET]: 'https://api.studio.thegraph.com/query/45376/exchange-v3-zksync-testnet/version/latest', + [ChainId.LINEA]: 'https://graph-query.linea.build/subgraphs/name/pancakeswap/exchange-v3-linea', [ChainId.LINEA_TESTNET]: 'https://thegraph.goerli.zkevm.consensys.net/subgraphs/name/pancakeswap/exchange-v3-linea-goerli', [ChainId.BASE_TESTNET]: 'https://api.studio.thegraph.com/query/45376/exchange-v3-base-testnet/version/latest', diff --git a/apps/web/src/config/constants/exchange.ts b/apps/web/src/config/constants/exchange.ts index c826e4a0a..2e3acb42d 100644 --- a/apps/web/src/config/constants/exchange.ts +++ b/apps/web/src/config/constants/exchange.ts @@ -16,6 +16,7 @@ import { opBnbTestnetTokens, baseTestnetTokens, scrollSepoliaTokens, + lineaTokens, } from '@pancakeswap/tokens' import { ChainTokenList } from './types' @@ -37,6 +38,7 @@ export const CHAIN_REFRESH_TIME = { [ChainId.POLYGON_ZKEVM_TESTNET]: 7_000, [ChainId.ZKSYNC]: 3_000, [ChainId.ZKSYNC_TESTNET]: 3_000, + [ChainId.LINEA]: 12_000, [ChainId.LINEA_TESTNET]: 12_000, [ChainId.OPBNB_TESTNET]: 6_000, [ChainId.BASE_TESTNET]: 6_000, @@ -55,6 +57,7 @@ export const SUGGESTED_BASES: ChainTokenList = { [ChainId.POLYGON_ZKEVM_TESTNET]: [polygonZkEvmTestnetTokens.weth, polygonZkEvmTestnetTokens.usdt], [ChainId.ZKSYNC]: [zksyncTokens.usdc, zksyncTokens.weth], [ChainId.ZKSYNC_TESTNET]: [zkSyncTestnetTokens.usdc, zkSyncTestnetTokens.weth], + [ChainId.LINEA]: [lineaTokens.usdc, lineaTokens.weth], [ChainId.LINEA_TESTNET]: [lineaTestnetTokens.usdc, lineaTestnetTokens.weth], [ChainId.OPBNB_TESTNET]: [ opBnbTestnetTokens.usdc, @@ -78,6 +81,7 @@ export const BASES_TO_TRACK_LIQUIDITY_FOR: ChainTokenList = { [ChainId.POLYGON_ZKEVM_TESTNET]: [polygonZkEvmTestnetTokens.weth, polygonZkEvmTestnetTokens.usdt], [ChainId.ZKSYNC]: [zksyncTokens.usdc, zksyncTokens.weth], [ChainId.ZKSYNC_TESTNET]: [zkSyncTestnetTokens.usdc, zkSyncTestnetTokens.weth], + [ChainId.LINEA]: [lineaTokens.usdc, lineaTokens.weth], [ChainId.LINEA_TESTNET]: [lineaTestnetTokens.usdc, lineaTestnetTokens.weth], [ChainId.OPBNB_TESTNET]: [opBnbTestnetTokens.usdc, opBnbTestnetTokens.wbnb, opBnbTestnetTokens.usdt], [ChainId.BASE_TESTNET]: [baseTestnetTokens.usdc, baseTestnetTokens.weth], @@ -103,6 +107,7 @@ export const PINNED_PAIRS: { readonly [chainId in ChainId]?: [Token, Token][] } [ChainId.POLYGON_ZKEVM]: [[polygonZkEvmTokens.weth, polygonZkEvmTokens.usdt]], [ChainId.ZKSYNC]: [[zksyncTokens.usdc, zksyncTokens.weth]], [ChainId.ZKSYNC_TESTNET]: [[zkSyncTestnetTokens.usdc, zkSyncTestnetTokens.weth]], + [ChainId.LINEA]: [[lineaTokens.usdc, lineaTokens.weth]], [ChainId.LINEA_TESTNET]: [[lineaTestnetTokens.usdc, lineaTestnetTokens.weth]], [ChainId.OPBNB_TESTNET]: [[opBnbTestnetTokens.usdc, opBnbTestnetTokens.wbnb]], [ChainId.BASE_TESTNET]: [[baseTestnetTokens.usdc, baseTestnetTokens.weth]], diff --git a/apps/web/src/config/constants/lists.ts b/apps/web/src/config/constants/lists.ts index fe6c6afed..2da743959 100644 --- a/apps/web/src/config/constants/lists.ts +++ b/apps/web/src/config/constants/lists.ts @@ -1,21 +1,27 @@ import { ChainId } from '@pancakeswap/sdk' export const PANCAKE_EXTENDED = 'https://tokens.pancakeswap.finance/pancakeswap-extended.json' -export const COINGECKO = 'https://tokens.pancakeswap.finance/coingecko.json' -export const PANCAKE_ETH_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-eth-default.json' -export const PANCAKE_ZKSYNC_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-zksync-default.json' -export const PANCAKE_POLYGON_ZKEVM_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-polygon-zkevm-default.json' + +const COINGECKO = 'https://tokens.pancakeswap.finance/coingecko.json' +const PANCAKE_ETH_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-eth-default.json' +const PANCAKE_ZKSYNC_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-zksync-default.json' +const PANCAKE_POLYGON_ZKEVM_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-polygon-zkevm-default.json' const PANCAKE_ARB_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-arbitrum-default.json' +const PANCAKE_LINEA_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-linea-default.json' + export const PANCAKE_ETH_MM = 'https://tokens.pancakeswap.finance/pancakeswap-eth-mm.json' export const PANCAKE_BSC_MM = 'https://tokens.pancakeswap.finance/pancakeswap-bnb-mm.json' -export const COINGECKO_ETH = 'https://tokens.coingecko.com/uniswap/all.json' -export const CMC = 'https://tokens.pancakeswap.finance/cmc.json' -export const ETH_URLS = [PANCAKE_ETH_DEFAULT, PANCAKE_ETH_MM, COINGECKO_ETH] -export const BSC_URLS = [PANCAKE_EXTENDED, CMC, COINGECKO, PANCAKE_BSC_MM] -export const POLYGON_ZKEVM_URLS = [PANCAKE_POLYGON_ZKEVM_DEFAULT] +const COINGECKO_ETH = 'https://tokens.coingecko.com/uniswap/all.json' +// export const CMC = 'https://tokens.pancakeswap.finance/cmc.json' // not updated for a while + +const ETH_URLS = [PANCAKE_ETH_DEFAULT, PANCAKE_ETH_MM, COINGECKO_ETH] +const BSC_URLS = [PANCAKE_EXTENDED, COINGECKO, PANCAKE_BSC_MM] +const POLYGON_ZKEVM_URLS = [PANCAKE_POLYGON_ZKEVM_DEFAULT] const ARBITRUM_URLS = [PANCAKE_ARB_DEFAULT] -export const ZKSYNC_URLS = [PANCAKE_ZKSYNC_DEFAULT] + +const LINEA_URLS = [PANCAKE_LINEA_DEFAULT] +const ZKSYNC_URLS = [PANCAKE_ZKSYNC_DEFAULT] // List of official tokens list export const OFFICIAL_LISTS = [PANCAKE_EXTENDED, PANCAKE_ETH_DEFAULT] @@ -28,6 +34,7 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [ ...BSC_URLS, ...ETH_URLS, ...ZKSYNC_URLS, + ...LINEA_URLS, ...POLYGON_ZKEVM_URLS, ...ARBITRUM_URLS, ...UNSUPPORTED_LIST_URLS, // need to load unsupported tokens as well @@ -44,6 +51,7 @@ export const DEFAULT_ACTIVE_LIST_URLS: string[] = [ PANCAKE_POLYGON_ZKEVM_DEFAULT, PANCAKE_ZKSYNC_DEFAULT, PANCAKE_ARB_DEFAULT, + PANCAKE_LINEA_DEFAULT, ] export const MULTI_CHAIN_LIST_URLS: { [chainId: number]: string[] } = { @@ -52,4 +60,5 @@ export const MULTI_CHAIN_LIST_URLS: { [chainId: number]: string[] } = { [ChainId.ZKSYNC]: ZKSYNC_URLS, [ChainId.POLYGON_ZKEVM]: POLYGON_ZKEVM_URLS, [ChainId.ARBITRUM_ONE]: ARBITRUM_URLS, + [ChainId.LINEA]: LINEA_URLS, } diff --git a/apps/web/src/config/constants/tokenLists/pancake-default.tokenlist.json b/apps/web/src/config/constants/tokenLists/pancake-default.tokenlist.json index da2298647..2464aa728 100644 --- a/apps/web/src/config/constants/tokenLists/pancake-default.tokenlist.json +++ b/apps/web/src/config/constants/tokenLists/pancake-default.tokenlist.json @@ -258,6 +258,14 @@ "chainId": 1101, "logoURI": "https://tokens.pancakeswap.finance/images/symbol/usdc.png" }, + { + "name": "USD Coin", + "address": "0x176211869cA2b568f2A7D4EE941E073a821EE1ff", + "symbol": "USDC", + "decimals": 6, + "chainId": 59144, + "logoURI": "https://tokens.pancakeswap.finance/images/symbol/usdc.png" + }, { "name": "USD Coin", "address": "0x02a3e7E0480B668bD46b42852C58363F93e3bA5C", diff --git a/apps/web/src/config/nodes.ts b/apps/web/src/config/nodes.ts index 1a69b0907..caebf7853 100644 --- a/apps/web/src/config/nodes.ts +++ b/apps/web/src/config/nodes.ts @@ -10,7 +10,7 @@ import { scrollSepolia, } from 'wagmi/chains' import { getNodeRealUrlV2 } from 'utils/nodeReal' -import { opbnbTestnet } from './chains' +import { opbnbTestnet, linea } from './chains' const POLYGON_ZKEVM_NODES = [ 'https://f2562de09abc5efbd21eefa083ff5326.zkevm-rpc.com/', @@ -48,6 +48,7 @@ export const SERVER_NODES = { ], [ChainId.ZKSYNC]: zkSync.rpcUrls.public.http, [ChainId.ZKSYNC_TESTNET]: zkSyncTestnet.rpcUrls.public.http, + [ChainId.LINEA]: linea.rpcUrls.public.http, [ChainId.LINEA_TESTNET]: [ 'https://rpc.goerli.linea.build', 'https://linea-testnet.rpc.thirdweb.com', @@ -87,6 +88,7 @@ export const PUBLIC_NODES = { ], [ChainId.ZKSYNC]: zkSync.rpcUrls.public.http, [ChainId.ZKSYNC_TESTNET]: zkSyncTestnet.rpcUrls.public.http, + [ChainId.LINEA]: linea.rpcUrls.public.http, [ChainId.LINEA_TESTNET]: [ 'https://rpc.goerli.linea.build', 'https://linea-testnet.rpc.thirdweb.com', diff --git a/apps/web/src/config/pools.ts b/apps/web/src/config/pools.ts index f4f4e2fb8..e4cf54c6e 100644 --- a/apps/web/src/config/pools.ts +++ b/apps/web/src/config/pools.ts @@ -12,6 +12,7 @@ export const POOLS_FAST_REVALIDATE = { [ChainId.POLYGON_ZKEVM_TESTNET]: 15_000, [ChainId.ZKSYNC]: 15_000, [ChainId.ZKSYNC_TESTNET]: 15_000, + [ChainId.LINEA]: 20_000, [ChainId.LINEA_TESTNET]: 20_000, [ChainId.OPBNB_TESTNET]: 10_000, [ChainId.BASE_TESTNET]: 10_000, @@ -30,6 +31,7 @@ export const POOLS_NORMAL_REVALIDATE = { [ChainId.POLYGON_ZKEVM_TESTNET]: 15_000, [ChainId.ZKSYNC]: 15_000, [ChainId.ZKSYNC_TESTNET]: 15_000, + [ChainId.LINEA]: 20_000, [ChainId.LINEA_TESTNET]: 20_000, [ChainId.OPBNB_TESTNET]: 15_000, [ChainId.BASE_TESTNET]: 15_000, @@ -47,6 +49,7 @@ export const POOLS_SLOW_REVALIDATE = { [ChainId.POLYGON_ZKEVM_TESTNET]: 20_000, [ChainId.ZKSYNC]: 20_000, [ChainId.ZKSYNC_TESTNET]: 20_000, + [ChainId.LINEA]: 30_000, [ChainId.LINEA_TESTNET]: 30_000, [ChainId.OPBNB_TESTNET]: 20_000, [ChainId.BASE_TESTNET]: 20_000, diff --git a/apps/web/src/state/swap/fetch/fetchDerivedPriceData.ts b/apps/web/src/state/swap/fetch/fetchDerivedPriceData.ts index f6493edb6..63c424395 100644 --- a/apps/web/src/state/swap/fetch/fetchDerivedPriceData.ts +++ b/apps/web/src/state/swap/fetch/fetchDerivedPriceData.ts @@ -50,6 +50,7 @@ const SWAP_INFO_BY_CHAIN = { v3: V3_SUBGRAPH_URLS[ChainId.ZKSYNC], }, [ChainId.ZKSYNC_TESTNET]: {}, + [ChainId.LINEA]: {}, [ChainId.LINEA_TESTNET]: { v2: INFO_CLIENT_WITH_CHAIN[ChainId.LINEA_TESTNET], v3: V3_SUBGRAPH_URLS[ChainId.LINEA_TESTNET], diff --git a/apps/web/src/utils/graphql.ts b/apps/web/src/utils/graphql.ts index ece3b50c9..78731957f 100644 --- a/apps/web/src/utils/graphql.ts +++ b/apps/web/src/utils/graphql.ts @@ -43,6 +43,7 @@ export const v3Clients = { [ChainId.POLYGON_ZKEVM]: new GraphQLClient(V3_SUBGRAPH_URLS[ChainId.POLYGON_ZKEVM]), [ChainId.ZKSYNC]: new GraphQLClient(V3_SUBGRAPH_URLS[ChainId.ZKSYNC]), [ChainId.ZKSYNC_TESTNET]: new GraphQLClient(V3_SUBGRAPH_URLS[ChainId.ZKSYNC_TESTNET]), + [ChainId.LINEA]: new GraphQLClient(V3_SUBGRAPH_URLS[ChainId.LINEA]), [ChainId.LINEA_TESTNET]: new GraphQLClient(V3_SUBGRAPH_URLS[ChainId.LINEA_TESTNET]), [ChainId.BASE_TESTNET]: new GraphQLClient(V3_SUBGRAPH_URLS[ChainId.BASE_TESTNET]), [ChainId.SCROLL_SEPOLIA]: new GraphQLClient(V3_SUBGRAPH_URLS[ChainId.SCROLL_SEPOLIA]), diff --git a/packages/smart-router/evm/constants/common.ts b/packages/smart-router/evm/constants/common.ts index a18a46caa..320a13a81 100644 --- a/packages/smart-router/evm/constants/common.ts +++ b/packages/smart-router/evm/constants/common.ts @@ -23,4 +23,5 @@ export const CHAIN_ID_TO_CHAIN_NAME = { [ChainId.BASE_TESTNET]: '', [ChainId.OPBNB_TESTNET]: '', [ChainId.SCROLL_SEPOLIA]: '', + [ChainId.LINEA]: 'linea', } satisfies Record diff --git a/packages/smart-router/evm/constants/exchange.ts b/packages/smart-router/evm/constants/exchange.ts index 91a8c8611..d73b66a5f 100644 --- a/packages/smart-router/evm/constants/exchange.ts +++ b/packages/smart-router/evm/constants/exchange.ts @@ -17,6 +17,7 @@ import { baseTestnetTokens, opBnbTestnetTokens, scrollSepoliaTokens, + lineaTokens, } from '@pancakeswap/tokens' import { ChainMap, ChainTokenList } from '../types' @@ -32,6 +33,7 @@ export const SMART_ROUTER_ADDRESSES = { [ChainId.POLYGON_ZKEVM_TESTNET]: '0x365C5F0B816828936320ea143e337fbA7D1b911E', [ChainId.ZKSYNC]: '0xf8b59f3c3Ab33200ec80a8A58b2aA5F5D2a8944C', [ChainId.ZKSYNC_TESTNET]: '0x4DC9186c6C5F7dd430c7b6D8D513076637902241', + [ChainId.LINEA]: '0x678Aa4bF4E210cf2166753e054d5b7c31cc7fa86', [ChainId.LINEA_TESTNET]: '0x21d809FB4052bb1807cfe2418bA638d72F4aEf87', [ChainId.OPBNB_TESTNET]: '0xf317eD77Baed624d0EA2384AA88D91B774a9b009', [ChainId.BASE_TESTNET]: '0xDDC44b8507B4Ca992fB60F0ECdF5651A87668509', @@ -49,6 +51,7 @@ export const V2_ROUTER_ADDRESS: ChainMap = { [ChainId.POLYGON_ZKEVM_TESTNET]: '0x1ac9F6489487a282961b3929bCFA0a773251315E', [ChainId.ZKSYNC]: '0x5aEaF2883FBf30f3D62471154eDa3C0c1b05942d', [ChainId.ZKSYNC_TESTNET]: '0xA0Fbd5d1474950bc9417FB00f9d4e2ee0385c560', + [ChainId.LINEA]: '0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb', [ChainId.LINEA_TESTNET]: '0xD7A304138D50C125733d1fE8a2041199E4944Aa1', [ChainId.OPBNB_TESTNET]: '0x62FF25CFD64E55673168c3656f4902bD7Aa5F0f4', [ChainId.BASE_TESTNET]: '0xC259d1D3476558630d83b0b60c105ae958382792', @@ -66,6 +69,7 @@ export const STABLE_SWAP_INFO_ADDRESS: ChainMap = { [ChainId.POLYGON_ZKEVM_TESTNET]: '', [ChainId.ZKSYNC]: '', [ChainId.ZKSYNC_TESTNET]: '', + [ChainId.LINEA]: '', [ChainId.LINEA_TESTNET]: '', [ChainId.OPBNB_TESTNET]: '', [ChainId.BASE_TESTNET]: '', @@ -92,6 +96,7 @@ export const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = { [ChainId.POLYGON_ZKEVM_TESTNET]: [polygonZkEvmTestnetTokens.weth, polygonZkEvmTestnetTokens.usdt], [ChainId.ZKSYNC]: [zksyncTokens.usdc, zksyncTokens.weth], [ChainId.ZKSYNC_TESTNET]: [zkSyncTestnetTokens.usdc, zkSyncTestnetTokens.weth], + [ChainId.LINEA]: [lineaTokens.usdc, lineaTokens.weth], [ChainId.LINEA_TESTNET]: [lineaTestnetTokens.usdc, lineaTestnetTokens.weth], [ChainId.OPBNB_TESTNET]: [opBnbTestnetTokens.usdc, opBnbTestnetTokens.wbnb], [ChainId.BASE_TESTNET]: [baseTestnetTokens.usdc, baseTestnetTokens.weth], diff --git a/packages/smart-router/evm/constants/gasModel/index.ts b/packages/smart-router/evm/constants/gasModel/index.ts index 4f64db37f..bfce76a93 100644 --- a/packages/smart-router/evm/constants/gasModel/index.ts +++ b/packages/smart-router/evm/constants/gasModel/index.ts @@ -8,6 +8,7 @@ import { polygonZkEvmTestnetTokens, zkSyncTestnetTokens, zksyncTokens, + lineaTokens, lineaTestnetTokens, arbitrumGoerliTokens, arbitrumTokens, @@ -27,6 +28,7 @@ export const usdGasTokensByChain = { [ChainId.POLYGON_ZKEVM_TESTNET]: [polygonZkEvmTestnetTokens.usdt], [ChainId.ZKSYNC]: [zksyncTokens.usdc], [ChainId.ZKSYNC_TESTNET]: [zkSyncTestnetTokens.usdc], + [ChainId.LINEA]: [lineaTokens.usdc], [ChainId.LINEA_TESTNET]: [lineaTestnetTokens.usdc], [ChainId.OPBNB_TESTNET]: [opBnbTestnetTokens.usdc], [ChainId.BASE_TESTNET]: [baseTestnetTokens.usdc], diff --git a/packages/smart-router/evm/constants/multicall.ts b/packages/smart-router/evm/constants/multicall.ts index f2f91310c..4a0e89dc9 100644 --- a/packages/smart-router/evm/constants/multicall.ts +++ b/packages/smart-router/evm/constants/multicall.ts @@ -67,6 +67,7 @@ export const BATCH_MULTICALL_CONFIGS: ChainMap = { }, [ChainId.ZKSYNC]: DEFAULT, [ChainId.ZKSYNC_TESTNET]: DEFAULT, + [ChainId.LINEA]: DEFAULT, [ChainId.LINEA_TESTNET]: DEFAULT, [ChainId.BASE_TESTNET]: DEFAULT, [ChainId.OPBNB_TESTNET]: DEFAULT, diff --git a/packages/smart-router/evm/constants/v3.ts b/packages/smart-router/evm/constants/v3.ts index 0fffd29ec..f13c548bd 100644 --- a/packages/smart-router/evm/constants/v3.ts +++ b/packages/smart-router/evm/constants/v3.ts @@ -18,6 +18,7 @@ export const MIXED_ROUTE_QUOTER_ADDRESSES = { [ChainId.POLYGON_ZKEVM_TESTNET]: '0x9CFCdecF9e37Bf25023A2B42537127c1089600fE', [ChainId.ZKSYNC]: '0x9B1edFB3848660402E4f1DC25733764e80aA627A', [ChainId.ZKSYNC_TESTNET]: '0x7931c270f59Cb1c2617e87976689bD6803afF50a', + [ChainId.LINEA]: '0x4c650FB471fe4e0f476fD3437C3411B1122c4e3B', [ChainId.LINEA_TESTNET]: '0x7d3ed219e45637Cfa77b1a634d0489a2950d1B7F', [ChainId.OPBNB_TESTNET]: '0x118F080BF268aa7De4bE6d5e579D926903E7d6Cb', [ChainId.BASE_TESTNET]: '0x9d4277f1D41CCB30C0e91f7d1bBA2A739E19032C', @@ -35,6 +36,7 @@ export const V3_QUOTER_ADDRESSES = { [ChainId.POLYGON_ZKEVM_TESTNET]: '0xA9c08a89Be4503E04Fd84Eadad4320eE34e9B11D', [ChainId.ZKSYNC]: '0x3d146FcE6c1006857750cBe8aF44f76a28041CCc', [ChainId.ZKSYNC_TESTNET]: '0x43e273b4Ffd6bC9d6Be1a862D19893549c3b9b46', + [ChainId.LINEA]: '0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997', [ChainId.LINEA_TESTNET]: '0x669254936caE83bE34008BdFdeeA63C902497B31', [ChainId.OPBNB_TESTNET]: '0x052a99849Ef2e13a5CB28275862991671D4b6fF5', [ChainId.BASE_TESTNET]: '0x6cc56b20bf8C4FfD58050D15AbA2978A745CC691', diff --git a/packages/smart-router/evm/v3-router/providers/multicallSwapProvider.ts b/packages/smart-router/evm/v3-router/providers/multicallSwapProvider.ts index 06d7a1e1e..9ae8b070d 100644 --- a/packages/smart-router/evm/v3-router/providers/multicallSwapProvider.ts +++ b/packages/smart-router/evm/v3-router/providers/multicallSwapProvider.ts @@ -23,6 +23,7 @@ const PANCAKE_MULTICALL_ADDRESSES = { [ChainId.POLYGON_ZKEVM_TESTNET]: '0x5DCC00121b4a481D8EDF9782Df6c6CF398AF20B8', [ChainId.ZKSYNC]: '0x2a76b93B9Cd441AE8aDA529e0e95826e00556351', [ChainId.ZKSYNC_TESTNET]: '0xA47DDFb5D068bFaa8ceb7476A60d5C3Fb87E58D9', + [ChainId.LINEA]: '0xac1cE734566f390A94b00eb9bf561c2625BF44ea', [ChainId.LINEA_TESTNET]: '0x32226588378236Fd0c7c4053999F88aC0e5cAc77', [ChainId.OPBNB_TESTNET]: '0x6cc56b20bf8C4FfD58050D15AbA2978A745CC691', [ChainId.BASE_TESTNET]: '0xEDd6EC404A7eeEDae3309A1607fDF72AEDd923FB', diff --git a/packages/smart-router/evm/v3-router/providers/onChainQuoteProvider.ts b/packages/smart-router/evm/v3-router/providers/onChainQuoteProvider.ts index a63b5762a..637b1504c 100644 --- a/packages/smart-router/evm/v3-router/providers/onChainQuoteProvider.ts +++ b/packages/smart-router/evm/v3-router/providers/onChainQuoteProvider.ts @@ -28,6 +28,7 @@ const SUCCESS_RATE_CONFIG = { [ChainId.POLYGON_ZKEVM_TESTNET]: 0, [ChainId.ZKSYNC]: 0.1, [ChainId.ZKSYNC_TESTNET]: 0.1, + [ChainId.LINEA]: 0.1, [ChainId.LINEA_TESTNET]: 0.1, [ChainId.OPBNB_TESTNET]: 0.1, [ChainId.BASE_TESTNET]: 0.1, @@ -47,6 +48,7 @@ const BLOCK_CONFLICT_TOLERANCE = { [ChainId.POLYGON_ZKEVM_TESTNET]: 1, [ChainId.ZKSYNC]: 3, [ChainId.ZKSYNC_TESTNET]: 3, + [ChainId.LINEA]: 3, [ChainId.LINEA_TESTNET]: 3, [ChainId.OPBNB_TESTNET]: 3, [ChainId.BASE_TESTNET]: 3, diff --git a/packages/swap-sdk/src/constants.ts b/packages/swap-sdk/src/constants.ts index b834eb2a7..cbbde23c9 100644 --- a/packages/swap-sdk/src/constants.ts +++ b/packages/swap-sdk/src/constants.ts @@ -15,6 +15,7 @@ export enum ChainId { ARBITRUM_ONE = 42161, ARBITRUM_GOERLI = 421613, SCROLL_SEPOLIA = 534351, + LINEA = 59144, LINEA_TESTNET = 59140, BASE_TESTNET = 84531, } @@ -37,6 +38,7 @@ export const FACTORY_ADDRESS_MAP = { [ChainId.POLYGON_ZKEVM_TESTNET]: '0xBA40c83026213F9cbc79998752721a0312bdB74a', [ChainId.ZKSYNC]: '0xd03D8D566183F0086d8D09A84E1e30b58Dd5619d', [ChainId.ZKSYNC_TESTNET]: '0x48a33610Cd0E130af2024D55F67aE72a8C51aC27', + [ChainId.LINEA]: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', [ChainId.LINEA_TESTNET]: '0xB6FAfd4ADbCd21cF665909767e0eD0D05709abfB', [ChainId.OPBNB_TESTNET]: '0x776e4bD2f72de2176A59465e316335aaf8ed4E8F', [ChainId.BASE_TESTNET]: '0x715303D2eF7dA7FFAbF637651D71FD11d41fAf7F', @@ -57,6 +59,7 @@ export const INIT_CODE_HASH_MAP = { [ChainId.POLYGON_ZKEVM_TESTNET]: INIT_CODE_HASH_ETH, [ChainId.ZKSYNC]: '0x0100045707a42494392b3558029b9869f865ff9df8f375dc1bf20b0555093f43', [ChainId.ZKSYNC_TESTNET]: '0x0100045707a42494392b3558029b9869f865ff9df8f375dc1bf20b0555093f43', + [ChainId.LINEA]: INIT_CODE_HASH_ETH, [ChainId.LINEA_TESTNET]: INIT_CODE_HASH_ETH, [ChainId.OPBNB_TESTNET]: INIT_CODE_HASH_ETH, [ChainId.BASE_TESTNET]: INIT_CODE_HASH_ETH, @@ -144,6 +147,14 @@ export const WETH9 = { 'Wrapped Ether', 'https://weth.io' ), + [ChainId.LINEA]: new ERC20Token( + ChainId.LINEA, + '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f', + 18, + 'WETH', + 'Wrapped Ether', + 'https://weth.io' + ), [ChainId.LINEA_TESTNET]: new ERC20Token( ChainId.LINEA_TESTNET, '0x2C1b868d6596a18e32E61B901E4060C872647b6C', @@ -224,6 +235,7 @@ export const WNATIVE = { [ChainId.POLYGON_ZKEVM_TESTNET]: WETH9[ChainId.POLYGON_ZKEVM_TESTNET], [ChainId.ZKSYNC]: WETH9[ChainId.ZKSYNC], [ChainId.ZKSYNC_TESTNET]: WETH9[ChainId.ZKSYNC_TESTNET], + [ChainId.LINEA]: WETH9[ChainId.LINEA], [ChainId.LINEA_TESTNET]: WETH9[ChainId.LINEA_TESTNET], [ChainId.OPBNB_TESTNET]: WBNB[ChainId.OPBNB_TESTNET], [ChainId.BASE_TESTNET]: WETH9[ChainId.BASE_TESTNET], @@ -255,6 +267,7 @@ export const NATIVE = { [ChainId.POLYGON_ZKEVM_TESTNET]: ETHER, [ChainId.ZKSYNC]: ETHER, [ChainId.ZKSYNC_TESTNET]: ETHER, + [ChainId.LINEA]: ETHER, [ChainId.LINEA_TESTNET]: ETHER, [ChainId.OPBNB_TESTNET]: { name: 'Binance Chain Native Token', diff --git a/packages/tokens/src/59144.ts b/packages/tokens/src/59144.ts new file mode 100644 index 000000000..9929c4e97 --- /dev/null +++ b/packages/tokens/src/59144.ts @@ -0,0 +1,9 @@ +import { ChainId, ERC20Token, WETH9 } from '@pancakeswap/sdk' +import { USDC, USDT } from './common' + +export const lineaTokens = { + weth: WETH9[ChainId.LINEA], + usdc: USDC[ChainId.LINEA], + wbtc: new ERC20Token(ChainId.LINEA, '0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4', 8, 'WBTC', 'Wrapped BTC'), + usdt: USDT[ChainId.LINEA], +} diff --git a/packages/tokens/src/common.ts b/packages/tokens/src/common.ts index 6c539cc9c..60a4fee48 100644 --- a/packages/tokens/src/common.ts +++ b/packages/tokens/src/common.ts @@ -215,6 +215,7 @@ export const USDC = { 'USDC', 'USD Coin', ), + [ChainId.LINEA]: new ERC20Token(ChainId.LINEA, '0x176211869cA2b568f2A7D4EE941E073a821EE1ff', 6, 'USDC', 'USD Coin'), [ChainId.LINEA_TESTNET]: new ERC20Token( ChainId.LINEA_TESTNET, '0xf56dc6695cF1f5c364eDEbC7Dc7077ac9B586068', @@ -283,6 +284,7 @@ export const USDT = { 'USDT', 'Tether USD', ), + [ChainId.LINEA]: new ERC20Token(ChainId.LINEA, '0xA219439258ca9da29E9Cc4cE5596924745e12B93', 6, 'USDT', 'Tether USD'), } export const WBTC_ETH = new ERC20Token( @@ -304,6 +306,7 @@ export const STABLE_COIN = { [ChainId.ZKSYNC_TESTNET]: USDC[ChainId.ZKSYNC_TESTNET], [ChainId.POLYGON_ZKEVM]: USDT[ChainId.POLYGON_ZKEVM], [ChainId.POLYGON_ZKEVM_TESTNET]: USDT[ChainId.POLYGON_ZKEVM_TESTNET], + [ChainId.LINEA]: USDC[ChainId.LINEA], [ChainId.LINEA_TESTNET]: USDC[ChainId.LINEA_TESTNET], [ChainId.OPBNB_TESTNET]: USDC[ChainId.OPBNB_TESTNET], [ChainId.BASE_TESTNET]: USDC[ChainId.BASE_TESTNET], diff --git a/packages/tokens/src/index.ts b/packages/tokens/src/index.ts index 0cdfc59b9..6159a3bcd 100644 --- a/packages/tokens/src/index.ts +++ b/packages/tokens/src/index.ts @@ -10,6 +10,7 @@ export * from './1442' export * from './324' export * from './280' export * from './59140' +export * from './59144' export * from './421613' export * from './5611' export * from './84531' diff --git a/packages/uikit/src/components/CurrencyLogo/utils.ts b/packages/uikit/src/components/CurrencyLogo/utils.ts index e1dff7762..f2e12d54a 100644 --- a/packages/uikit/src/components/CurrencyLogo/utils.ts +++ b/packages/uikit/src/components/CurrencyLogo/utils.ts @@ -40,6 +40,7 @@ const chainName: { [key: number]: string } = { [ChainId.POLYGON_ZKEVM]: "polygon-zkevm", [ChainId.ARBITRUM_ONE]: "arb", [ChainId.ZKSYNC]: "zksync", + [ChainId.LINEA]: "linea", }; // TODO: move to utils or token-list diff --git a/packages/v3-sdk/src/constants.ts b/packages/v3-sdk/src/constants.ts index 44376959e..608c9b55a 100644 --- a/packages/v3-sdk/src/constants.ts +++ b/packages/v3-sdk/src/constants.ts @@ -17,6 +17,7 @@ export const FACTORY_ADDRESSES = { [ChainId.POLYGON_ZKEVM_TESTNET]: '0x2430dbd123BC40f8Be6110065a448C1aA0619Cb1', [ChainId.ZKSYNC]: '0x1BB72E0CbbEA93c08f535fc7856E0338D7F7a8aB', [ChainId.ZKSYNC_TESTNET]: '0x48e6Bc3f2546E63908cd09b04E2B3f78e57B6292', + [ChainId.LINEA]: FACTORY_ADDRESS, [ChainId.LINEA_TESTNET]: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E', [ChainId.OPBNB_TESTNET]: '0x0F81fD8DaC20A21029B496D8F8E08385201B8ca0', [ChainId.BASE_TESTNET]: '0x618f16159d489AA7761168F0200b7705dee9e2C0', @@ -36,6 +37,7 @@ export const DEPLOYER_ADDRESSES = { [ChainId.POLYGON_ZKEVM_TESTNET]: '0x86808Be3f426C9B4c8C706bCDe29dBC036A1259B', [ChainId.ZKSYNC]: '0x7f71382044A6a62595D5D357fE75CA8199123aD6', [ChainId.ZKSYNC_TESTNET]: '0xaC20647b8e9d1C4cb199104485518c136817b380', + [ChainId.LINEA]: DEPLOYER_ADDRESS, [ChainId.LINEA_TESTNET]: '0xdAecee3C08e953Bd5f89A5Cc90ac560413d709E3', [ChainId.OPBNB_TESTNET]: '0xD55CAFAB2Ffa1139Be46bc5C0b8259c620050dFC', [ChainId.BASE_TESTNET]: '0x5A6919Dfd2C761788608b0D1bd1239961ADCB08B', @@ -57,6 +59,7 @@ export const POOL_INIT_CODE_HASHES = { [ChainId.POLYGON_ZKEVM_TESTNET]: POOL_INIT_CODE_HASH, [ChainId.ZKSYNC]: '0x01001487a7c45b21c52a0bc0558bf48d897d14792f1d0cc82733c8271d069178', [ChainId.ZKSYNC_TESTNET]: '0x01001487a7c45b21c52a0bc0558bf48d897d14792f1d0cc82733c8271d069178', + [ChainId.LINEA]: POOL_INIT_CODE_HASH, [ChainId.LINEA_TESTNET]: POOL_INIT_CODE_HASH, [ChainId.OPBNB_TESTNET]: POOL_INIT_CODE_HASH, [ChainId.BASE_TESTNET]: POOL_INIT_CODE_HASH,