From 2f83f9fce64a92a2d7decf5d9afd5c78e65f8242 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 24 Oct 2024 15:52:22 +0100 Subject: [PATCH 01/23] feat: initial base chain support --- .github/workflows/vercel.yml | 2 + README.md | 15 ++--- .../pure/ApproveButton/index.cosmos.tsx | 4 +- .../CurrencySelectButton/index.cosmos.tsx | 4 +- .../common/pure/OrderProgressBarV2/index.tsx | 11 ++-- .../src/common/pure/RateInfo/index.cosmos.tsx | 4 +- .../common/services/getQuoteCurrency/index.ts | 10 +++- .../src/legacy/components/AMMsLogo/index.tsx | 57 ------------------ apps/cowswap-frontend/src/mocks/orderMock.ts | 4 +- .../src/mocks/tradeStateMock.ts | 4 +- .../pure/LimitOrdersDetails/index.cosmos.tsx | 4 +- .../pure/OrdersTableContainer/orders.mock.ts | 14 ++--- .../pure/banners/TwapSuggestionBanner.tsx | 1 + .../src/modules/twap/const.ts | 1 + .../usdAmount/apis/getCoingeckoUsdPrice.ts | 3 +- .../usdAmount/apis/getDefillamaUsdPrice.ts | 1 + .../modules/volumeFee/state/cowswapFeeAtom.ts | 1 + .../LockedGnoVesting/claimData/index.ts | 4 +- .../assets/src/cow-swap/network-base-logo.svg | 4 ++ libs/common-const/src/chainInfo.ts | 15 +++++ libs/common-const/src/common.ts | 7 ++- .../src/nativeAndWrappedTokens.ts | 32 +++++++--- libs/common-const/src/networks.ts | 2 + libs/common-const/src/tokens.ts | 59 ++++++++++++++++++- libs/common-utils/src/explorer.ts | 1 + libs/core/src/gnosisSafe/index.ts | 3 +- libs/ens/src/hooks/useENSRegistrarContract.ts | 4 +- .../tokens/src/const/defaultFavoriteTokens.ts | 13 ++++ libs/tokens/src/const/tokensList.json | 9 ++- libs/tokens/src/const/tokensLists.ts | 3 + libs/tokens/src/services/searchTokensInApi.ts | 31 +++++++--- .../state/tokenLists/tokenListsStateAtom.ts | 2 + libs/tokens/src/utils/trustTokenLogoUrl.ts | 1 + .../src/web3-react/utils/switchChain.ts | 1 + package.json | 2 +- yarn.lock | 6 +- 36 files changed, 214 insertions(+), 125 deletions(-) create mode 100644 libs/assets/src/cow-swap/network-base-logo.svg diff --git a/.github/workflows/vercel.yml b/.github/workflows/vercel.yml index 8bc79003ae..ba8a657979 100644 --- a/.github/workflows/vercel.yml +++ b/.github/workflows/vercel.yml @@ -47,12 +47,14 @@ jobs: REACT_APP_NETWORK_URL_1=${{ secrets.REACT_APP_NETWORK_URL_1 }} REACT_APP_NETWORK_URL_100=${{ secrets.REACT_APP_NETWORK_URL_100 }} REACT_APP_NETWORK_URL_42161=${{ secrets.REACT_APP_NETWORK_URL_42161 }} + REACT_APP_NETWORK_URL_8453=${{ secrets.REACT_APP_NETWORK_URL_8453 }} REACT_APP_NETWORK_URL_11155111=${{ secrets.REACT_APP_NETWORK_URL_11155111 }} REACT_APP_WC_PROJECT_ID=${{ secrets.REACT_APP_WC_PROJECT_ID }} REACT_APP_IPFS_READ_URI=${{ secrets.REACT_APP_IPFS_READ_URI }} REACT_APP_EXPLORER_SENTRY_DSN=${{ secrets.EXPLORER_SENTRY_DSN }} REACT_APP_SUBGRAPH_URL_MAINNET=${{ secrets.REACT_APP_SUBGRAPH_URL_MAINNET }} REACT_APP_SUBGRAPH_URL_ARBITRUM_ONE=${{ secrets.REACT_APP_SUBGRAPH_URL_ARBITRUM_ONE }} + REACT_APP_SUBGRAPH_URL_BASE=${{ secrets.REACT_APP_SUBGRAPH_URL_BASE }} REACT_APP_SUBGRAPH_URL_GNOSIS_CHAIN=${{ secrets.REACT_APP_SUBGRAPH_URL_GNOSIS_CHAIN }} REACT_APP_BFF_BASE_URL=${{ secrets.BFF_BASE_URL }} REACT_APP_CMS_BASE_URL=${{ secrets.CMS_BASE_URL }} diff --git a/README.md b/README.md index 9ed4392d7e..43094caf91 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ yarn test # 🔎 Explorer -Start the Explorer on http://localhost:4200 +Start the Explorer on [Read more about the Explorer](apps/explorer/README.md) @@ -69,7 +69,7 @@ yarn build:explorer # 🐄 cow.fi -Start CoW.fi on http://localhost:3001 +Start CoW.fi on ### Start @@ -85,7 +85,7 @@ yarn build:cowfi # 🖼️ Widget Configurator -Start the Widget Configurator on http://127.0.0.1:4200/widget-configurator +Start the Widget Configurator on ```bash # Start @@ -97,7 +97,7 @@ yarn build:widget # 🌌 Cosmos UI Library -Start the Cosmos UI Library on http://localhost:5000 +Start the Cosmos UI Library on ```bash yarn run cosmos @@ -174,6 +174,7 @@ REACT_APP_NETWORK_URL_1: https://... REACT_APP_NETWORK_URL_11155111: https://... REACT_APP_NETWORK_URL_100: https://... REACT_APP_NETWORK_URL_42161: https://... +REACT_APP_NETWORK_URL_8453: https://... ``` Additionally, if you plan to run the integration tests locally you must define: @@ -216,7 +217,6 @@ The API endpoint is configured using the environment variable REACT_APP_BFF_BASE_URL=https://bff.cow.fi ``` - ## CMS API Endpoints (Content Management System) The CMS API is a helper API that provides some additional content to the frontend. @@ -235,10 +235,6 @@ The API endpoint is configured using the environment variable REACT_APP_CMS_BASE_URL=https://cms.cow.fi/api ``` - - - - ## Price feeds CoW Swap tries to find the best price available on-chain using some price feeds. @@ -295,4 +291,3 @@ In case of problems with the service worker cache you force a reset using 1. [Oveall Architecture](docs/architecture-overview.md) 2. [Amounts formatting](apps/cowswap-frontend/src/utils/amountFormat/README.md) 3. [ABIs](libs/abis/README.md) - diff --git a/apps/cowswap-frontend/src/common/pure/ApproveButton/index.cosmos.tsx b/apps/cowswap-frontend/src/common/pure/ApproveButton/index.cosmos.tsx index 94f6a8d854..e4b45b02bb 100644 --- a/apps/cowswap-frontend/src/common/pure/ApproveButton/index.cosmos.tsx +++ b/apps/cowswap-frontend/src/common/pure/ApproveButton/index.cosmos.tsx @@ -1,4 +1,4 @@ -import { COW, GNO } from '@cowprotocol/common-const' +import { COW, GNO_MAINNET } from '@cowprotocol/common-const' import { SupportedChainId } from '@cowprotocol/cow-sdk' import { DemoContainer } from 'cosmos.decorator' @@ -9,7 +9,7 @@ import { ApprovalState } from '../../hooks/useApproveState' import { ApproveButton } from '.' const COW_TOKEN = COW[SupportedChainId.MAINNET] -const GNO_TOKEN = GNO[SupportedChainId.MAINNET] +const GNO_TOKEN = GNO_MAINNET const Custom = () => { const [currencyRaw] = useSelect('currency', { diff --git a/apps/cowswap-frontend/src/common/pure/CurrencySelectButton/index.cosmos.tsx b/apps/cowswap-frontend/src/common/pure/CurrencySelectButton/index.cosmos.tsx index 738139d32a..757a002e1c 100644 --- a/apps/cowswap-frontend/src/common/pure/CurrencySelectButton/index.cosmos.tsx +++ b/apps/cowswap-frontend/src/common/pure/CurrencySelectButton/index.cosmos.tsx @@ -1,4 +1,4 @@ -import { COW, GNO } from '@cowprotocol/common-const' +import { COW, GNO_MAINNET } from '@cowprotocol/common-const' import { SupportedChainId } from '@cowprotocol/cow-sdk' import { useSelect } from 'react-cosmos/client' @@ -6,7 +6,7 @@ import { useSelect } from 'react-cosmos/client' import { CurrencySelectButton, CurrencySelectButtonProps } from 'common/pure/CurrencySelectButton/index' const COW_TOKEN = COW[SupportedChainId.MAINNET] -const GNO_TOKEN = GNO[SupportedChainId.MAINNET] +const GNO_TOKEN = GNO_MAINNET function useCustomProps(): CurrencySelectButtonProps { const [currencyRaw] = useSelect('currency', { diff --git a/apps/cowswap-frontend/src/common/pure/OrderProgressBarV2/index.tsx b/apps/cowswap-frontend/src/common/pure/OrderProgressBarV2/index.tsx index 985c97a570..d55de0fc5c 100644 --- a/apps/cowswap-frontend/src/common/pure/OrderProgressBarV2/index.tsx +++ b/apps/cowswap-frontend/src/common/pure/OrderProgressBarV2/index.tsx @@ -649,14 +649,15 @@ const COW_SWAP_BENEFITS = [ "Unlike most other exchanges, CoW Swap doesn't charge you any fees if your trade fails.", ] -const TRADE_ON_ARBITRUM_BENEFIT = - 'CoW Swap is now live on Arbitrum. Switch the network toggle in the nav bar for quick, cheap transactions.' +const TRADE_ON_NEW_CHAINS_BENEFIT = + 'CoW Swap is now live on Arbitrum and Base. Switch the network toggle in the nav bar for quick, cheap transactions.' const CHAIN_SPECIFIC_BENEFITS: Record = { - [SupportedChainId.MAINNET]: [TRADE_ON_ARBITRUM_BENEFIT, ...COW_SWAP_BENEFITS], + [SupportedChainId.MAINNET]: [TRADE_ON_NEW_CHAINS_BENEFIT, ...COW_SWAP_BENEFITS], [SupportedChainId.ARBITRUM_ONE]: COW_SWAP_BENEFITS, - [SupportedChainId.GNOSIS_CHAIN]: [TRADE_ON_ARBITRUM_BENEFIT, ...COW_SWAP_BENEFITS], - [SupportedChainId.SEPOLIA]: [TRADE_ON_ARBITRUM_BENEFIT, ...COW_SWAP_BENEFITS], + [SupportedChainId.BASE]: COW_SWAP_BENEFITS, + [SupportedChainId.GNOSIS_CHAIN]: [TRADE_ON_NEW_CHAINS_BENEFIT, ...COW_SWAP_BENEFITS], + [SupportedChainId.SEPOLIA]: [TRADE_ON_NEW_CHAINS_BENEFIT, ...COW_SWAP_BENEFITS], } function truncateWithEllipsis(str: string, maxLength: number): string { diff --git a/apps/cowswap-frontend/src/common/pure/RateInfo/index.cosmos.tsx b/apps/cowswap-frontend/src/common/pure/RateInfo/index.cosmos.tsx index ff9ada0d32..2a2752530a 100644 --- a/apps/cowswap-frontend/src/common/pure/RateInfo/index.cosmos.tsx +++ b/apps/cowswap-frontend/src/common/pure/RateInfo/index.cosmos.tsx @@ -1,4 +1,4 @@ -import { COW, GNO, USDC_SEPOLIA, WETH_GNOSIS_CHAIN, WETH_SEPOLIA, WXDAI } from '@cowprotocol/common-const' +import { COW, GNO_SEPOLIA, USDC_SEPOLIA, WETH_GNOSIS_CHAIN, WETH_SEPOLIA, WXDAI } from '@cowprotocol/common-const' import { SupportedChainId } from '@cowprotocol/cow-sdk' import { TokenSymbol } from '@cowprotocol/ui' import { CurrencyAmount, Token } from '@uniswap/sdk-core' @@ -9,7 +9,7 @@ import { RateInfo, RateInfoParams } from './index' const inputCurrency = WETH_GNOSIS_CHAIN const outputCurrency = WXDAI -const GNO_SEPOLIA = GNO[SupportedChainId.GNOSIS_CHAIN] + const COW_SEPOLIA = COW[SupportedChainId.GNOSIS_CHAIN] const rateInfoParams = { diff --git a/apps/cowswap-frontend/src/common/services/getQuoteCurrency/index.ts b/apps/cowswap-frontend/src/common/services/getQuoteCurrency/index.ts index b18d563bec..75cdf0d387 100644 --- a/apps/cowswap-frontend/src/common/services/getQuoteCurrency/index.ts +++ b/apps/cowswap-frontend/src/common/services/getQuoteCurrency/index.ts @@ -1,13 +1,16 @@ import { DAI, DAI_ARBITRUM_ONE, + DAI_BASE, NATIVE_CURRENCY_ADDRESS, USDC_ARBITRUM_ONE, + USDC_BASE, USDC_GNOSIS_CHAIN, USDC_MAINNET, USDC_SEPOLIA, USDT, USDT_ARBITRUM_ONE, + USDT_BASE, USDT_GNOSIS_CHAIN, WXDAI, } from '@cowprotocol/common-const' @@ -25,8 +28,9 @@ const STABLE_COINS: Record = { // XDAI and WXDAI are stable-coins .concat(NATIVE_CURRENCY_ADDRESS), [SupportedChainId.ARBITRUM_ONE]: [USDT_ARBITRUM_ONE, USDC_ARBITRUM_ONE, DAI_ARBITRUM_ONE].map((token) => - token.address.toLowerCase() + token.address.toLowerCase(), ), + [SupportedChainId.BASE]: [USDT_BASE, USDC_BASE, DAI_BASE].map((token) => token.address.toLowerCase()), [SupportedChainId.SEPOLIA]: [USDC_SEPOLIA].map((token) => token.address.toLowerCase()), } @@ -41,7 +45,7 @@ const STABLE_COINS: Record = { export function getQuoteCurrency( chainId: SupportedChainId | undefined, inputCurrencyAmount: Nullish>, - outputCurrencyAmount: Nullish> + outputCurrencyAmount: Nullish>, ): Currency | null { if (!chainId || !inputCurrencyAmount || !outputCurrencyAmount) return null @@ -58,7 +62,7 @@ export function getQuoteCurrency( export function getQuoteCurrencyByStableCoin( chainId: SupportedChainId | undefined, inputCurrency: Currency | null, - outputCurrency: Currency | null + outputCurrency: Currency | null, ): Currency | null { if (!chainId || !inputCurrency || !outputCurrency) return null diff --git a/apps/cowswap-frontend/src/legacy/components/AMMsLogo/index.tsx b/apps/cowswap-frontend/src/legacy/components/AMMsLogo/index.tsx index 14389d2d16..830c764c5f 100644 --- a/apps/cowswap-frontend/src/legacy/components/AMMsLogo/index.tsx +++ b/apps/cowswap-frontend/src/legacy/components/AMMsLogo/index.tsx @@ -13,37 +13,6 @@ import Swapr from '@cowprotocol/assets/cow-swap/ammslogo/swapr.png' import Symmetric from '@cowprotocol/assets/cow-swap/ammslogo/symmetric.png' import Uniswap from '@cowprotocol/assets/cow-swap/ammslogo/uniswap.png' import Gno from '@cowprotocol/assets/cow-swap/network-gnosis-chain-logo.svg' -import { SupportedChainId } from '@cowprotocol/cow-sdk' - -import styled from 'styled-components/macro' - -import { animationDelay, crossFade, fadeInOut, imagesAnimationDelay, presentationTime } from './utils' - -export const Wrapper = styled.div<{ logosLength: number }>` - display: flex; - align-items: center; - justify-content: center; - width: 24px; - height: 24px; - border-radius: 100%; - box-shadow: 0px 0px 10px 2px ${({ theme }) => theme.paper}; - background-color: ${({ theme }) => theme.white}; - transform-style: preserve-3d; - position: absolute; - top: -4px; - right: 0px; - - img { - position: absolute; - left: 0; - animation: ${(props) => fadeInOut(presentationTime, crossFade, props.logosLength)} - ${(props) => animationDelay * props.logosLength}s infinite; - } - - ${(props) => imagesAnimationDelay(props.logosLength, animationDelay)} -` - -type Image = { src: string; alt: string } const SushiImage = { src: Sushi, alt: 'AMMs Sushi' } const OneInchImage = { src: Oneinch, alt: 'AMMs 1inch' } @@ -60,23 +29,6 @@ const LevinSwapImage = { src: Levinswap, alt: 'Levinswap 0x' } const SymmetricImage = { src: Symmetric, alt: 'Symmetric 0x' } const ZeroXImage = { src: ZeroX, alt: 'AMMs 0x' } -const ETH_AMM_LOGOS = [SushiImage, OneInchImage, ParaSwapImage, UniswapImage, CurveImage, MatchaImage, ZeroXImage] - -const LogosPerNetwork: Record> = { - [SupportedChainId.MAINNET]: ETH_AMM_LOGOS, - [SupportedChainId.SEPOLIA]: ETH_AMM_LOGOS, - [SupportedChainId.ARBITRUM_ONE]: ETH_AMM_LOGOS, // TODO: review actual AMMs on arbitrum - [SupportedChainId.GNOSIS_CHAIN]: [ - SushiImage, - BaoSwapImage, - HoneySwapImage, - SwaprImage, - SymmetricImage, - ElkImage, - LevinSwapImage, - ], -} - export const AMM_LOGOS: Record = { baoswap: BaoSwapImage, balancer: BalancerImage, @@ -95,12 +47,3 @@ export const AMM_LOGOS: Record = { default: { src: Gno, alt: 'Default unknown AMM' }, } -export function AMMsLogo({ chainId }: { chainId: SupportedChainId }) { - return ( - - {LogosPerNetwork[chainId].map(({ src, alt }, index) => ( - {alt} - ))} - - ) -} diff --git a/apps/cowswap-frontend/src/mocks/orderMock.ts b/apps/cowswap-frontend/src/mocks/orderMock.ts index 1d2d23d30b..5a14fb615b 100644 --- a/apps/cowswap-frontend/src/mocks/orderMock.ts +++ b/apps/cowswap-frontend/src/mocks/orderMock.ts @@ -1,11 +1,11 @@ -import { COW, GNO } from '@cowprotocol/common-const' +import { COW, USDC } from '@cowprotocol/common-const' import { OrderClass, OrderKind, SigningScheme, SupportedChainId } from '@cowprotocol/cow-sdk' import { Order, OrderStatus } from 'legacy/state/orders/actions' export const getOrderMock = (chainId: SupportedChainId): Order => { const inputToken = COW[chainId] - const outputToken = GNO[chainId] + const outputToken = USDC[chainId] const creationTime = '2023-05-29T15:27:32.319Z' return { diff --git a/apps/cowswap-frontend/src/mocks/tradeStateMock.ts b/apps/cowswap-frontend/src/mocks/tradeStateMock.ts index 94edb51f66..32f62b4830 100644 --- a/apps/cowswap-frontend/src/mocks/tradeStateMock.ts +++ b/apps/cowswap-frontend/src/mocks/tradeStateMock.ts @@ -1,4 +1,4 @@ -import { COW, GNO } from '@cowprotocol/common-const' +import { COW, GNO_MAINNET } from '@cowprotocol/common-const' import { tryParseCurrencyAmount } from '@cowprotocol/common-utils' import { SupportedChainId } from '@cowprotocol/cow-sdk' import { Currency, Percent, Price } from '@uniswap/sdk-core' @@ -11,7 +11,7 @@ import { CurrencyInfo } from 'common/pure/CurrencyInputPanel/types' const chainId = SupportedChainId.MAINNET const inputCurrency = COW[chainId] -const outputCurrency = GNO[chainId] +const outputCurrency = GNO_MAINNET export const inputCurrencyInfoMock: CurrencyInfo = { field: Field.INPUT, diff --git a/apps/cowswap-frontend/src/modules/limitOrders/pure/LimitOrdersDetails/index.cosmos.tsx b/apps/cowswap-frontend/src/modules/limitOrders/pure/LimitOrdersDetails/index.cosmos.tsx index 4b5609f3c3..26f9743adb 100644 --- a/apps/cowswap-frontend/src/modules/limitOrders/pure/LimitOrdersDetails/index.cosmos.tsx +++ b/apps/cowswap-frontend/src/modules/limitOrders/pure/LimitOrdersDetails/index.cosmos.tsx @@ -1,6 +1,6 @@ import { SetStateAction } from 'jotai' -import { COW, GNO } from '@cowprotocol/common-const' +import { COW, GNO_MAINNET } from '@cowprotocol/common-const' import { OrderClass, OrderKind, SupportedChainId } from '@cowprotocol/cow-sdk' import { CurrencyAmount } from '@uniswap/sdk-core' @@ -14,7 +14,7 @@ import { TradeFlowContext } from '../../services/types' import { LimitOrdersDetails } from './index' const inputCurrency = COW[SupportedChainId.MAINNET] -const outputCurrency = GNO[SupportedChainId.MAINNET] +const outputCurrency = GNO_MAINNET const rateInfoParams = { chainId: 5, diff --git a/apps/cowswap-frontend/src/modules/ordersTable/pure/OrdersTableContainer/orders.mock.ts b/apps/cowswap-frontend/src/modules/ordersTable/pure/OrdersTableContainer/orders.mock.ts index 68638447dc..46c3abdb6d 100644 --- a/apps/cowswap-frontend/src/modules/ordersTable/pure/OrdersTableContainer/orders.mock.ts +++ b/apps/cowswap-frontend/src/modules/ordersTable/pure/OrdersTableContainer/orders.mock.ts @@ -1,4 +1,4 @@ -import { COW, DAI, GNO, USDC, WETH_GNOSIS_CHAIN } from '@cowprotocol/common-const' +import { COW, DAI, GNO_GNOSIS_CHAIN, USDC, WETH_GNOSIS_CHAIN } from '@cowprotocol/common-const' import { OrderClass, OrderKind, SigningScheme } from '@cowprotocol/cow-sdk' import { OrderStatus } from 'legacy/state/orders/actions' @@ -16,10 +16,10 @@ export const ordersMock: ParsedOrder[] = [ status: OrderStatus.PENDING, creationTime: '2022-11-11T13:15:13.551Z', inputToken: WETH_GNOSIS_CHAIN, - outputToken: GNO[chainId], + outputToken: GNO_GNOSIS_CHAIN, receiver: '', sellToken: WETH_GNOSIS_CHAIN.address, - buyToken: GNO[chainId].address, + buyToken: GNO_GNOSIS_CHAIN.address, sellAmount: '5000300000000000', buyAmount: '23000000000000', sellAmountBeforeFee: '5000300000000000', @@ -39,10 +39,10 @@ export const ordersMock: ParsedOrder[] = [ status: OrderStatus.PENDING, creationTime: '2022-10-03T09:15:13.551Z', inputToken: COW[chainId], - outputToken: GNO[chainId], + outputToken: GNO_GNOSIS_CHAIN, receiver: '', sellToken: COW[chainId].address, - buyToken: GNO[chainId].address, + buyToken: GNO_GNOSIS_CHAIN.address, sellAmount: '1230000000000000', buyAmount: '55000000000000', sellAmountBeforeFee: '1230000000000000', @@ -85,10 +85,10 @@ export const ordersMock: ParsedOrder[] = [ status: OrderStatus.FULFILLED, creationTime: '2022-11-11T13:15:13.551Z', inputToken: USDC[chainId], - outputToken: GNO[chainId], + outputToken: GNO_GNOSIS_CHAIN, receiver: '', sellToken: USDC[chainId].address, - buyToken: GNO[chainId].address, + buyToken: GNO_GNOSIS_CHAIN.address, sellAmount: '5000300000000000', buyAmount: '23000000000000', sellAmountBeforeFee: '5000300000000000', diff --git a/apps/cowswap-frontend/src/modules/swap/pure/banners/TwapSuggestionBanner.tsx b/apps/cowswap-frontend/src/modules/swap/pure/banners/TwapSuggestionBanner.tsx index e11fefff2a..53f3c0dfcc 100644 --- a/apps/cowswap-frontend/src/modules/swap/pure/banners/TwapSuggestionBanner.tsx +++ b/apps/cowswap-frontend/src/modules/swap/pure/banners/TwapSuggestionBanner.tsx @@ -34,6 +34,7 @@ const AMOUNT_LIMIT: Record = { [SupportedChainId.MAINNET]: 50_000, // $50,000 [SupportedChainId.GNOSIS_CHAIN]: 500, // $500 [SupportedChainId.ARBITRUM_ONE]: 500, // $500 + [SupportedChainId.BASE]: 500, // $500 [SupportedChainId.SEPOLIA]: 100, // $100 } diff --git a/apps/cowswap-frontend/src/modules/twap/const.ts b/apps/cowswap-frontend/src/modules/twap/const.ts index be419cdb17..6f9b01fe37 100644 --- a/apps/cowswap-frontend/src/modules/twap/const.ts +++ b/apps/cowswap-frontend/src/modules/twap/const.ts @@ -41,6 +41,7 @@ export const MINIMUM_PART_SELL_AMOUNT_FIAT: Record = { [SupportedChainId.MAINNET]: 'ethereum', [SupportedChainId.GNOSIS_CHAIN]: 'xdai', [SupportedChainId.ARBITRUM_ONE]: 'arbitrum-one', + [SupportedChainId.BASE]: 'base', [SupportedChainId.SEPOLIA]: null, } @@ -91,7 +92,7 @@ export async function getCoingeckoUsdPrice(currency: Token): Promise = { [SupportedChainId.MAINNET]: 'ethereum', [SupportedChainId.GNOSIS_CHAIN]: 'xdai', [SupportedChainId.ARBITRUM_ONE]: 'arbitrum-one', + [SupportedChainId.BASE]: 'base', [SupportedChainId.SEPOLIA]: null, } diff --git a/apps/cowswap-frontend/src/modules/volumeFee/state/cowswapFeeAtom.ts b/apps/cowswap-frontend/src/modules/volumeFee/state/cowswapFeeAtom.ts index d613237a71..05cbdb7d26 100644 --- a/apps/cowswap-frontend/src/modules/volumeFee/state/cowswapFeeAtom.ts +++ b/apps/cowswap-frontend/src/modules/volumeFee/state/cowswapFeeAtom.ts @@ -18,6 +18,7 @@ const COWSWAP_VOLUME_FEES: Record = { bps: 10, // 0.1% recipient: '0x451100Ffc88884bde4ce87adC8bB6c7Df7fACccd', // Arb1 Protocol fee safe }, + [SupportedChainId.BASE]: null, [SupportedChainId.GNOSIS_CHAIN]: { bps: 10, // 0.1% recipient: '0x6b3214fD11dc91De14718DeE98Ef59bCbFcfB432', // Gnosis Chain Protocol fee safe diff --git a/apps/cowswap-frontend/src/pages/Account/LockedGnoVesting/claimData/index.ts b/apps/cowswap-frontend/src/pages/Account/LockedGnoVesting/claimData/index.ts index e5cef58989..7ac49d1946 100644 --- a/apps/cowswap-frontend/src/pages/Account/LockedGnoVesting/claimData/index.ts +++ b/apps/cowswap-frontend/src/pages/Account/LockedGnoVesting/claimData/index.ts @@ -13,6 +13,7 @@ const indexFiles: Record = { [SupportedChainId.MAINNET]: mainnetIndex, [SupportedChainId.GNOSIS_CHAIN]: gnosisChainIndex, [SupportedChainId.ARBITRUM_ONE]: [], + [SupportedChainId.BASE]: [], [SupportedChainId.SEPOLIA]: [], } @@ -20,6 +21,7 @@ const chainNames: Record = { [SupportedChainId.MAINNET]: 'mainnet', [SupportedChainId.GNOSIS_CHAIN]: 'gnosisChain', [SupportedChainId.ARBITRUM_ONE]: null, + [SupportedChainId.BASE]: null, [SupportedChainId.SEPOLIA]: null, } @@ -53,7 +55,7 @@ const fetchChunk = (path: string) => { const promise = chunkCache.get(path) ?? (fetch( - `https://raw.githubusercontent.com/gnosis/locked-gno-cow-merkle-distro/${DISTRO_REPO_BRANCH_NAME}/${path}` + `https://raw.githubusercontent.com/gnosis/locked-gno-cow-merkle-distro/${DISTRO_REPO_BRANCH_NAME}/${path}`, ).then((res) => res.json()) as Promise>) chunkCache.set(path, promise) return promise diff --git a/libs/assets/src/cow-swap/network-base-logo.svg b/libs/assets/src/cow-swap/network-base-logo.svg new file mode 100644 index 0000000000..9fc6d5b4af --- /dev/null +++ b/libs/assets/src/cow-swap/network-base-logo.svg @@ -0,0 +1,4 @@ + + + + diff --git a/libs/common-const/src/chainInfo.ts b/libs/common-const/src/chainInfo.ts index 072a077c83..4efb4adf3f 100644 --- a/libs/common-const/src/chainInfo.ts +++ b/libs/common-const/src/chainInfo.ts @@ -1,5 +1,6 @@ import ArbitrumOneLogoLight from '@cowprotocol/assets/cow-swap/network-arbitrum-one-logo-blue.svg' import ArbitrumOneLogoDark from '@cowprotocol/assets/cow-swap/network-arbitrum-one-logo-white.svg' +import BaseLogo from '@cowprotocol/assets/cow-swap/network-base-logo.svg' import GnosisChainLogo from '@cowprotocol/assets/cow-swap/network-gnosis-chain-logo.svg' import EthereumLogo from '@cowprotocol/assets/cow-swap/network-mainnet-logo.svg' import SepoliaLogo from '@cowprotocol/assets/cow-swap/network-sepolia-logo.svg' @@ -55,6 +56,20 @@ export const CHAIN_INFO: ChainInfoMap = { color: '#1B4ADD', nativeCurrency: NATIVE_CURRENCIES[SupportedChainId.ARBITRUM_ONE], }, + [SupportedChainId.BASE]: { + docs: 'https://docs.base.org/', + bridge: 'https://bridge.base.org/deposit', + explorer: 'https://basescan.io', + infoLink: 'https://www.base.org/', + label: 'Base', + addressPrefix: 'base', + name: 'base', + explorerTitle: 'Basescan', + urlAlias: 'base', + logo: { light: BaseLogo, dark: BaseLogo }, + color: '#0052FF', + nativeCurrency: NATIVE_CURRENCIES[SupportedChainId.BASE], + }, [SupportedChainId.GNOSIS_CHAIN]: { docs: 'https://docs.gnosischain.com', bridge: 'https://bridge.gnosischain.com/', diff --git a/libs/common-const/src/common.ts b/libs/common-const/src/common.ts index f2031d8498..e0b4315ed4 100644 --- a/libs/common-const/src/common.ts +++ b/libs/common-const/src/common.ts @@ -50,6 +50,7 @@ export const V_COW_CONTRACT_ADDRESS: Record = { [SupportedChainId.MAINNET]: '0xd057b63f5e69cf1b929b356b579cba08d7688048', [SupportedChainId.GNOSIS_CHAIN]: '0xc20C9C13E853fc64d054b73fF21d3636B2d97eaB', [SupportedChainId.ARBITRUM_ONE]: null, // doesn't exist! + [SupportedChainId.BASE]: null, // doesn't exist! [SupportedChainId.SEPOLIA]: '0x21d06a222bbb94ec1406a0a8ba86b4d761bc9864', } @@ -57,6 +58,7 @@ export const COW_CONTRACT_ADDRESS: Record = { [SupportedChainId.MAINNET]: '0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB', [SupportedChainId.GNOSIS_CHAIN]: '0x177127622c4A00F3d409B75571e12cB3c8973d3c', [SupportedChainId.ARBITRUM_ONE]: '0xcb8b5cd20bdcaea9a010ac1f8d835824f5c87a04', + [SupportedChainId.BASE]: '', // TODO: bridge to base [SupportedChainId.SEPOLIA]: '0x0625aFB445C3B6B7B929342a04A22599fd5dBB59', } @@ -73,11 +75,12 @@ export const MINIMUM_ETH_FLOW_SLIPPAGE_BPS: Record = { [SupportedChainId.MAINNET]: 200, // 2% [SupportedChainId.GNOSIS_CHAIN]: DEFAULT_SLIPPAGE_BPS, [SupportedChainId.ARBITRUM_ONE]: DEFAULT_SLIPPAGE_BPS, + [SupportedChainId.BASE]: DEFAULT_SLIPPAGE_BPS, [SupportedChainId.SEPOLIA]: DEFAULT_SLIPPAGE_BPS, } export const MINIMUM_ETH_FLOW_SLIPPAGE: Record = mapSupportedNetworks( - (chainId) => new Percent(MINIMUM_ETH_FLOW_SLIPPAGE_BPS[chainId], 10_000) + (chainId) => new Percent(MINIMUM_ETH_FLOW_SLIPPAGE_BPS[chainId], 10_000), ) export const HIGH_ETH_FLOW_SLIPPAGE_BPS = 1_000 // 10% @@ -110,12 +113,14 @@ export const GAS_FEE_ENDPOINTS: Record = { [SupportedChainId.MAINNET]: 'https://api.blocknative.com/gasprices/blockprices', [SupportedChainId.GNOSIS_CHAIN]: 'https://gnosis.blockscout.com/api/v1/gas-price-oracle', [SupportedChainId.ARBITRUM_ONE]: 'https://arbitrum.blockscout.com/api/v1/gas-price-oracle', + [SupportedChainId.BASE]: 'https://base.blockscout.com/api/v1/gas-price-oracle', [SupportedChainId.SEPOLIA]: '', } export const GAS_API_KEYS: Record = { [SupportedChainId.MAINNET]: process.env.REACT_APP_BLOCKNATIVE_API_KEY || null, [SupportedChainId.GNOSIS_CHAIN]: null, [SupportedChainId.ARBITRUM_ONE]: null, + [SupportedChainId.BASE]: null, [SupportedChainId.SEPOLIA]: null, } diff --git a/libs/common-const/src/nativeAndWrappedTokens.ts b/libs/common-const/src/nativeAndWrappedTokens.ts index 9455310c80..d372938b99 100644 --- a/libs/common-const/src/nativeAndWrappedTokens.ts +++ b/libs/common-const/src/nativeAndWrappedTokens.ts @@ -16,7 +16,7 @@ export const WRAPPED_NATIVE_CURRENCIES: Record WETH9_MAINNET_ADDRESS, DEFAULT_NATIVE_DECIMALS, 'WETH', - 'Wrapped Ether' + 'Wrapped Ether', ), [SupportedChainId.GNOSIS_CHAIN]: new TokenWithLogo( undefined, @@ -24,7 +24,7 @@ export const WRAPPED_NATIVE_CURRENCIES: Record '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d', DEFAULT_NATIVE_DECIMALS, 'WXDAI', - 'Wrapped XDAI' + 'Wrapped XDAI', ), [SupportedChainId.ARBITRUM_ONE]: new TokenWithLogo( ETH_LOGO_URL, @@ -32,7 +32,15 @@ export const WRAPPED_NATIVE_CURRENCIES: Record '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', DEFAULT_NATIVE_DECIMALS, 'WETH', - 'Wrapped Ether' + 'Wrapped Ether', + ), + [SupportedChainId.BASE]: new TokenWithLogo( + ETH_LOGO_URL, + SupportedChainId.BASE, + '0x4200000000000000000000000000000000000006', + DEFAULT_NATIVE_DECIMALS, + 'WETH', + 'Wrapped Ether', ), [SupportedChainId.SEPOLIA]: new TokenWithLogo( ETH_LOGO_URL, @@ -40,7 +48,7 @@ export const WRAPPED_NATIVE_CURRENCIES: Record '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14', DEFAULT_NATIVE_DECIMALS, 'WETH', - 'Wrapped Ether' + 'Wrapped Ether', ), } @@ -51,7 +59,7 @@ export const NATIVE_CURRENCIES: Record = { NATIVE_CURRENCY_ADDRESS, DEFAULT_NATIVE_DECIMALS, 'ETH', - 'Ether' + 'Ether', ), [SupportedChainId.GNOSIS_CHAIN]: new TokenWithLogo( undefined, @@ -59,7 +67,7 @@ export const NATIVE_CURRENCIES: Record = { NATIVE_CURRENCY_ADDRESS, DEFAULT_NATIVE_DECIMALS, 'xDAI', - 'xDAI' + 'xDAI', ), [SupportedChainId.ARBITRUM_ONE]: new TokenWithLogo( undefined, @@ -67,7 +75,15 @@ export const NATIVE_CURRENCIES: Record = { NATIVE_CURRENCY_ADDRESS, DEFAULT_NATIVE_DECIMALS, 'ETH', - 'Ether' + 'Ether', + ), + [SupportedChainId.BASE]: new TokenWithLogo( + undefined, + SupportedChainId.BASE, + NATIVE_CURRENCY_ADDRESS, + DEFAULT_NATIVE_DECIMALS, + 'ETH', + 'Ether', ), [SupportedChainId.SEPOLIA]: new TokenWithLogo( undefined, @@ -75,7 +91,7 @@ export const NATIVE_CURRENCIES: Record = { NATIVE_CURRENCY_ADDRESS, DEFAULT_NATIVE_DECIMALS, 'ETH', - 'Ether' + 'Ether', ), } diff --git a/libs/common-const/src/networks.ts b/libs/common-const/src/networks.ts index b70980c548..43b4380939 100644 --- a/libs/common-const/src/networks.ts +++ b/libs/common-const/src/networks.ts @@ -7,6 +7,7 @@ const RPC_URL_ENVS: Record = { [SupportedChainId.MAINNET]: process.env.REACT_APP_NETWORK_URL_1 || undefined, [SupportedChainId.GNOSIS_CHAIN]: process.env.REACT_APP_NETWORK_URL_100 || undefined, [SupportedChainId.ARBITRUM_ONE]: process.env.REACT_APP_NETWORK_URL_42161 || undefined, + [SupportedChainId.BASE]: process.env.REACT_APP_NETWORK_URL_8453 || undefined, [SupportedChainId.SEPOLIA]: process.env.REACT_APP_NETWORK_URL_11155111 || undefined, } @@ -14,6 +15,7 @@ const DEFAULT_RPC_URL: Record = { [SupportedChainId.MAINNET]: USDC_MAINNET, [SupportedChainId.GNOSIS_CHAIN]: USDC_GNOSIS_CHAIN, [SupportedChainId.ARBITRUM_ONE]: USDC_ARBITRUM_ONE, + [SupportedChainId.BASE]: USDC_BASE, [SupportedChainId.SEPOLIA]: USDC_SEPOLIA, } @@ -235,6 +273,7 @@ export const TOKEN_SHORTHANDS: { [shorthand: string]: Record = { [SupportedChainId.MAINNET]: V_COW_TOKEN_MAINNET, [SupportedChainId.GNOSIS_CHAIN]: V_COW_TOKEN_XDAI, [SupportedChainId.ARBITRUM_ONE]: null, + [SupportedChainId.BASE]: null, [SupportedChainId.SEPOLIA]: V_COW_TOKEN_SEPOLIA, } @@ -307,6 +347,15 @@ export const COW_TOKEN_ARBITRUM = new TokenWithLogo( 'CoW Protocol Token', ) +export const COW_TOKEN_BASE = new TokenWithLogo( + COW_TOKEN_MAINNET.logoURI, + SupportedChainId.BASE, + COW_CONTRACT_ADDRESS[SupportedChainId.BASE] || '', + 18, + 'COW', + 'CoW Protocol Token', +) + const COW_TOKEN_SEPOLIA = new TokenWithLogo( COW_TOKEN_MAINNET.logoURI, SupportedChainId.SEPOLIA, @@ -320,13 +369,15 @@ export const COW: Record = { [SupportedChainId.MAINNET]: COW_TOKEN_MAINNET, [SupportedChainId.GNOSIS_CHAIN]: COW_TOKEN_XDAI, [SupportedChainId.ARBITRUM_ONE]: COW_TOKEN_ARBITRUM, + [SupportedChainId.BASE]: COW_TOKEN_BASE, [SupportedChainId.SEPOLIA]: COW_TOKEN_SEPOLIA, } -export const GNO: Record = { +export const GNO: Record = { [SupportedChainId.MAINNET]: GNO_MAINNET, [SupportedChainId.GNOSIS_CHAIN]: GNO_GNOSIS_CHAIN, [SupportedChainId.ARBITRUM_ONE]: GNO_ARBITRUM_ONE, + [SupportedChainId.BASE]: null, [SupportedChainId.SEPOLIA]: GNO_SEPOLIA, } @@ -371,6 +422,7 @@ export const MERKLE_DROP_CONTRACT_ADDRESSES: Record = [SupportedChainId.MAINNET]: '0x64646f112FfD6F1B7533359CFaAF7998F23C8c40', [SupportedChainId.GNOSIS_CHAIN]: '0x48D8566887F8c7d99757CE29c2cD39962bfd9547', [SupportedChainId.ARBITRUM_ONE]: '', // doesn't exist + [SupportedChainId.BASE]: '', // doesn't exist [SupportedChainId.SEPOLIA]: '', // TODO SEPOLIA: check it } @@ -378,5 +430,6 @@ export const TOKEN_DISTRO_CONTRACT_ADDRESSES: Record = [SupportedChainId.MAINNET]: '0x68FFAaC7A431f276fe73604C127Bd78E49070c92', [SupportedChainId.GNOSIS_CHAIN]: '0x3d610e917130f9D036e85A030596807f57e11093', [SupportedChainId.ARBITRUM_ONE]: '', // doesn't exist + [SupportedChainId.BASE]: '', // doesn't exist [SupportedChainId.SEPOLIA]: '', // TODO SEPOLIA: check it } diff --git a/libs/common-utils/src/explorer.ts b/libs/common-utils/src/explorer.ts index 964be02886..f18a55c375 100644 --- a/libs/common-utils/src/explorer.ts +++ b/libs/common-utils/src/explorer.ts @@ -19,6 +19,7 @@ function _getExplorerUrlByEnvironment(): Record { [ChainId.MAINNET]: baseUrl, [ChainId.GNOSIS_CHAIN]: `${baseUrl}/gc`, [ChainId.ARBITRUM_ONE]: `${baseUrl}/arb1`, + [ChainId.BASE]: `${baseUrl}/base`, [ChainId.SEPOLIA]: `${baseUrl}/sepolia`, } } diff --git a/libs/core/src/gnosisSafe/index.ts b/libs/core/src/gnosisSafe/index.ts index b9819ddc32..78e0c71f9d 100644 --- a/libs/core/src/gnosisSafe/index.ts +++ b/libs/core/src/gnosisSafe/index.ts @@ -12,6 +12,7 @@ const SAFE_TRANSACTION_SERVICE_URL: Record = { [SupportedChainId.MAINNET]: 'https://safe-transaction-mainnet.safe.global', [SupportedChainId.GNOSIS_CHAIN]: 'https://safe-transaction-gnosis-chain.safe.global', [SupportedChainId.ARBITRUM_ONE]: 'https://safe-transaction-arbitrum.safe.global', + [SupportedChainId.BASE]: 'https://safe-transaction-base.safe.global', [SupportedChainId.SEPOLIA]: 'https://safe-transaction-sepolia.safe.global', } @@ -77,7 +78,7 @@ export function getSafeWebUrl(chainId: SupportedChainId, safeAddress: string, sa export function getSafeTransaction( chainId: number, safeTxHash: string, - library: Web3Provider + library: Web3Provider, ): Promise { console.log('[api/gnosisSafe] getSafeTransaction', chainId, safeTxHash) const client = _getClientOrThrow(chainId, library) diff --git a/libs/ens/src/hooks/useENSRegistrarContract.ts b/libs/ens/src/hooks/useENSRegistrarContract.ts index 143427f970..9bd397e607 100644 --- a/libs/ens/src/hooks/useENSRegistrarContract.ts +++ b/libs/ens/src/hooks/useENSRegistrarContract.ts @@ -11,6 +11,8 @@ const ENS_REGISTRAR_ADDRESSES: Record = { [SupportedChainId.GNOSIS_CHAIN]: null, [SupportedChainId.SEPOLIA]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', [SupportedChainId.ARBITRUM_ONE]: null, + [SupportedChainId.BASE]: null, + // TODO: use mainnet registrar for all chains https://docs.ens.domains/learn/deployments, which means being connected to mainnet additionally to the other chain } export function useENSRegistrarContract(): EnsRegistrar | undefined { @@ -26,7 +28,7 @@ export function useENSRegistrarContract(): EnsRegistrar | undefined { return getContract(address, EnsAbi, _provider) as EnsRegistrar }, - SWR_NO_REFRESH_OPTIONS + SWR_NO_REFRESH_OPTIONS, ) return data diff --git a/libs/tokens/src/const/defaultFavoriteTokens.ts b/libs/tokens/src/const/defaultFavoriteTokens.ts index bb51e1ca79..e136ec9118 100644 --- a/libs/tokens/src/const/defaultFavoriteTokens.ts +++ b/libs/tokens/src/const/defaultFavoriteTokens.ts @@ -2,19 +2,24 @@ import { ARB_ARBITRUM_ONE, COW, COW_TOKEN_ARBITRUM, + COW_TOKEN_BASE, DAI, DAI_ARBITRUM_ONE, + DAI_BASE, EURE_GNOSIS_CHAIN, GNO_GNOSIS_CHAIN, TokenWithLogo, USDC_ARBITRUM_ONE, + USDC_BASE, USDC_MAINNET, USDC_SEPOLIA, USDCe_GNOSIS_CHAIN, USDT, USDT_ARBITRUM_ONE, + USDT_BASE, WBTC, WBTC_ARBITRUM_ONE, + WBTC_BASE, WBTC_GNOSIS_CHAIN, WETH_GNOSIS_CHAIN, WRAPPED_NATIVE_CURRENCIES, @@ -63,6 +68,14 @@ export const DEFAULT_FAVORITE_TOKENS: Record = { ARB_ARBITRUM_ONE, COW_TOKEN_ARBITRUM, ]), + [SupportedChainId.BASE]: tokensListToMap([ + USDC_BASE, + USDT_BASE, + WRAPPED_NATIVE_CURRENCIES[SupportedChainId.BASE], + WBTC_BASE, + DAI_BASE, + COW_TOKEN_BASE, + ]), [SupportedChainId.SEPOLIA]: tokensListToMap([ WRAPPED_NATIVE_CURRENCIES[SupportedChainId.SEPOLIA], COW[SupportedChainId.SEPOLIA], diff --git a/libs/tokens/src/const/tokensList.json b/libs/tokens/src/const/tokensList.json index 9789cd9fb9..210faafe52 100644 --- a/libs/tokens/src/const/tokensList.json +++ b/libs/tokens/src/const/tokensList.json @@ -112,5 +112,12 @@ "enabledByDefault": true, "source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CowSwapSepolia.json" } + ], + "8453": [ + { + "priority": 1, + "enabledByDefault": true, + "source": "https://files.cow.fi/tokens/CowSwap.json" + } ] -} +} \ No newline at end of file diff --git a/libs/tokens/src/const/tokensLists.ts b/libs/tokens/src/const/tokensLists.ts index b5fc521b9f..0215352290 100644 --- a/libs/tokens/src/const/tokensLists.ts +++ b/libs/tokens/src/const/tokensLists.ts @@ -16,3 +16,6 @@ export const GNOSIS_UNISWAP_TOKENS_LIST = export const ARBITRUM_ONE_TOKENS_LIST = 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/ArbitrumOneUniswapTokensList.json' + +// TODO: create BASE UNI token list +export const BASE_TOKENS_LIST = '' diff --git a/libs/tokens/src/services/searchTokensInApi.ts b/libs/tokens/src/services/searchTokensInApi.ts index 9b49250caa..9eac6b952e 100644 --- a/libs/tokens/src/services/searchTokensInApi.ts +++ b/libs/tokens/src/services/searchTokensInApi.ts @@ -5,7 +5,16 @@ import { gql, GraphQLClient } from 'graphql-request' type Address = `0x${string}` -type Chain = 'ARBITRUM' | 'ETHEREUM' | 'ETHEREUM_SEPOLIA' | 'OPTIMISM' | 'POLYGON' | 'CELO' | 'BNB' | 'UNKNOWN_CHAIN' +type Chain = + | 'ARBITRUM' + | 'ETHEREUM' + | 'ETHEREUM_SEPOLIA' + | 'OPTIMISM' + | 'POLYGON' + | 'CELO' + | 'BNB' + | 'BASE' + | 'UNKNOWN_CHAIN' interface FetchTokensResult { id: string @@ -115,21 +124,25 @@ const GQL_CLIENT = new GraphQLClient(BASE_URL) const CHAIN_NAMES: Record = { [SupportedChainId.MAINNET]: 'ETHEREUM', [SupportedChainId.ARBITRUM_ONE]: 'ARBITRUM', - [SupportedChainId.SEPOLIA]: null, + [SupportedChainId.BASE]: 'BASE', + [SupportedChainId.SEPOLIA]: 'ETHEREUM_SEPOLIA', [SupportedChainId.GNOSIS_CHAIN]: null, } -const CHAIN_IDS = Object.entries(CHAIN_NAMES).reduce((acc, [supportedChainId, chain]) => { - if (chain) { - acc[chain] = parseInt(supportedChainId) - } +const CHAIN_IDS = Object.entries(CHAIN_NAMES).reduce( + (acc, [supportedChainId, chain]) => { + if (chain) { + acc[chain] = parseInt(supportedChainId) + } - return acc -}, {} as Record) + return acc + }, + {} as Record, +) export async function searchTokensInApi( chainId: SupportedChainId, - searchQuery: string + searchQuery: string, ): Promise { const chain = CHAIN_NAMES[chainId] diff --git a/libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts b/libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts index f9616bebc6..53ea5f1547 100644 --- a/libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts +++ b/libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts @@ -6,6 +6,7 @@ import { mapSupportedNetworks, SupportedChainId } from '@cowprotocol/cow-sdk' import { ARBITRUM_ONE_TOKENS_LIST, + BASE_TOKENS_LIST, DEFAULT_TOKENS_LISTS, GNOSIS_UNISWAP_TOKENS_LIST, LP_TOKEN_LISTS, @@ -24,6 +25,7 @@ const UNISWAP_TOKEN_LIST_URL: Record = { [SupportedChainId.MAINNET]: UNISWAP_TOKENS_LIST, [SupportedChainId.GNOSIS_CHAIN]: GNOSIS_UNISWAP_TOKENS_LIST, [SupportedChainId.ARBITRUM_ONE]: ARBITRUM_ONE_TOKENS_LIST, + [SupportedChainId.BASE]: BASE_TOKENS_LIST, [SupportedChainId.SEPOLIA]: UNISWAP_TOKENS_LIST, } diff --git a/libs/tokens/src/utils/trustTokenLogoUrl.ts b/libs/tokens/src/utils/trustTokenLogoUrl.ts index 86eeb9eb8c..ccc150ee8b 100644 --- a/libs/tokens/src/utils/trustTokenLogoUrl.ts +++ b/libs/tokens/src/utils/trustTokenLogoUrl.ts @@ -4,6 +4,7 @@ const chainIdToName: Record = { [SupportedChainId.MAINNET]: 'ethereum', [SupportedChainId.GNOSIS_CHAIN]: 'xdai', [SupportedChainId.ARBITRUM_ONE]: 'arbitrum', + [SupportedChainId.BASE]: 'base', [SupportedChainId.SEPOLIA]: 'ethereum', } diff --git a/libs/wallet/src/web3-react/utils/switchChain.ts b/libs/wallet/src/web3-react/utils/switchChain.ts index 28e8320fe5..dbbadbe820 100644 --- a/libs/wallet/src/web3-react/utils/switchChain.ts +++ b/libs/wallet/src/web3-react/utils/switchChain.ts @@ -18,6 +18,7 @@ const WALLET_RPC_SUGGESTION: Record = { [SupportedChainId.MAINNET]: null, [SupportedChainId.GNOSIS_CHAIN]: 'https://rpc.gnosischain.com/', [SupportedChainId.ARBITRUM_ONE]: 'https://arb1.arbitrum.io/rpc', + [SupportedChainId.BASE]: 'https://mainnet.base.org', [SupportedChainId.SEPOLIA]: null, } diff --git a/package.json b/package.json index aa2dc9f855..794b11536a 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@cowprotocol/cms": "^0.6.0", "@cowprotocol/contracts": "^1.3.1", "@cowprotocol/cow-runner-game": "^0.2.9", - "@cowprotocol/cow-sdk": "^5.5.1", + "@cowprotocol/cow-sdk": "file:.yalc/@cowprotocol/cow-sdk", "@cowprotocol/ethflowcontract": "cowprotocol/ethflowcontract.git#main-artifacts", "@davatar/react": "1.8.1", "@emotion/react": "^11.11.1", diff --git a/yarn.lock b/yarn.lock index e4bd823e29..f5472fea91 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2429,10 +2429,8 @@ resolved "https://registry.yarnpkg.com/@cowprotocol/cow-runner-game/-/cow-runner-game-0.2.9.tgz#3f94b3f370bd114f77db8b1d238cba3ef4e9d644" integrity sha512-rX7HnoV+HYEEkBaqVUsAkGGo0oBrExi+d6Io+8nQZYwZk+IYLmS9jdcIObsLviM2h4YX8+iin6NuKl35AaiHmg== -"@cowprotocol/cow-sdk@^5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.5.1.tgz#7bb4627c56958e8c438d08c10f7bdb3a89dc3c2f" - integrity sha512-FFc9pj8xhsfGZ1vjw+4IFGb6UTdPzuOoZOvM/OhZlrfy15ohfSSb2urbHWASvKjbcXeg6KqL4aHS6KEw+BYnmA== +"@cowprotocol/cow-sdk@file:.yalc/@cowprotocol/cow-sdk": + version "5.7.0-RC.0" dependencies: "@cowprotocol/contracts" "^1.6.0" "@ethersproject/abstract-signer" "^5.7.0" From 1dafb32371b71f5d87d717b9b484f6af3179e760 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 24 Oct 2024 16:52:51 +0100 Subject: [PATCH 02/23] feat: add COW token address on BASE --- libs/common-const/src/common.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/common-const/src/common.ts b/libs/common-const/src/common.ts index e0b4315ed4..2047d11a3e 100644 --- a/libs/common-const/src/common.ts +++ b/libs/common-const/src/common.ts @@ -58,7 +58,7 @@ export const COW_CONTRACT_ADDRESS: Record = { [SupportedChainId.MAINNET]: '0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB', [SupportedChainId.GNOSIS_CHAIN]: '0x177127622c4A00F3d409B75571e12cB3c8973d3c', [SupportedChainId.ARBITRUM_ONE]: '0xcb8b5cd20bdcaea9a010ac1f8d835824f5c87a04', - [SupportedChainId.BASE]: '', // TODO: bridge to base + [SupportedChainId.BASE]: '0xc694a91e6b071bF030A18BD3053A7fE09B6DaE69', [SupportedChainId.SEPOLIA]: '0x0625aFB445C3B6B7B929342a04A22599fd5dBB59', } From a3da148b9ecfdef0952aaa6874884fd4cef6ef50 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 24 Oct 2024 17:30:24 +0100 Subject: [PATCH 03/23] feat: update cow-sdk with base support --- package.json | 4 ++-- yarn.lock | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 794b11536a..2b0bcaa824 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@cowprotocol/cms": "^0.6.0", "@cowprotocol/contracts": "^1.3.1", "@cowprotocol/cow-runner-game": "^0.2.9", - "@cowprotocol/cow-sdk": "file:.yalc/@cowprotocol/cow-sdk", + "@cowprotocol/cow-sdk": "^5.7.0-RC.0", "@cowprotocol/ethflowcontract": "cowprotocol/ethflowcontract.git#main-artifacts", "@davatar/react": "1.8.1", "@emotion/react": "^11.11.1", @@ -339,4 +339,4 @@ "vite-tsconfig-paths": "~4.3.2", "vitest": "~0.32.0" } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index f5472fea91..8b6e8249b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2429,8 +2429,10 @@ resolved "https://registry.yarnpkg.com/@cowprotocol/cow-runner-game/-/cow-runner-game-0.2.9.tgz#3f94b3f370bd114f77db8b1d238cba3ef4e9d644" integrity sha512-rX7HnoV+HYEEkBaqVUsAkGGo0oBrExi+d6Io+8nQZYwZk+IYLmS9jdcIObsLviM2h4YX8+iin6NuKl35AaiHmg== -"@cowprotocol/cow-sdk@file:.yalc/@cowprotocol/cow-sdk": +"@cowprotocol/cow-sdk@^5.7.0-RC.0": version "5.7.0-RC.0" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.7.0-RC.0.tgz#14c4a05f1be7463613be656072f9d0d331cd7f15" + integrity sha512-ke6l11X/wt5KNgdO+WCsUvoF6NeeZ4xjtEX0CseauIkjDfacaX20IfO8dT4AD0SFc4MmAp0cX75eSqMD4Ipc+A== dependencies: "@cowprotocol/contracts" "^1.6.0" "@ethersproject/abstract-signer" "^5.7.0" @@ -2442,8 +2444,8 @@ limiter "^2.1.0" "@cowprotocol/ethflowcontract@cowprotocol/ethflowcontract.git#main-artifacts": - version "1.2.0" - resolved "https://codeload.github.com/cowprotocol/ethflowcontract/tar.gz/0163ee489587fb7f2cbabcab9d566ebc4ec189f5" + version "1.3.0" + resolved "https://codeload.github.com/cowprotocol/ethflowcontract/tar.gz/ed75d811aba0e18aa80e949cbc979d34ab7fd9ee" "@cspotcode/source-map-support@^0.8.0": version "0.8.1" From ba69d1d9af621da48f9cc02c84b08f95907ab0eb Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 24 Oct 2024 17:51:52 +0100 Subject: [PATCH 04/23] chore: bump permit-utils version to 0.5.0-RC.0 --- libs/permit-utils/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/permit-utils/package.json b/libs/permit-utils/package.json index 7bbeb4ac5a..031b404f16 100644 --- a/libs/permit-utils/package.json +++ b/libs/permit-utils/package.json @@ -1,6 +1,6 @@ { "name": "@cowprotocol/permit-utils", - "version": "0.4.0", + "version": "0.5.0-RC.0", "type": "module", "dependencies": { "ethers": "^5.7.2", @@ -16,4 +16,4 @@ "require": "./index.cjs" } } -} +} \ No newline at end of file From 6207aab12f5fd3aad28a76ef7dcccc3412f15f50 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Fri, 25 Oct 2024 17:24:19 +0100 Subject: [PATCH 05/23] feat: base for explorer --- apps/explorer/src/const.ts | 3 +++ apps/explorer/src/consts/subgraphUrls.ts | 1 + apps/explorer/src/explorer/pages/Home/index.tsx | 1 + 3 files changed, 5 insertions(+) diff --git a/apps/explorer/src/const.ts b/apps/explorer/src/const.ts index 9d9bf8d878..2a7dab76ea 100644 --- a/apps/explorer/src/const.ts +++ b/apps/explorer/src/const.ts @@ -96,6 +96,7 @@ export const MEDIA = { export const WETH_ADDRESS_MAINNET = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' export const WXDAI_ADDRESS_XDAI = '0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d' export const WETH_ADDRESS_ARBITRUM_ONE = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1' +export const WETH_ADDRESS_BASE = '0x4200000000000000000000000000000000000006' export const WETH_ADDRESS_SEPOLIA = '0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14' export const NATIVE_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' export const NATIVE_TOKEN_ADDRESS_LOWERCASE = NATIVE_TOKEN_ADDRESS.toLowerCase() @@ -104,6 +105,7 @@ export const WRAPPED_NATIVE_ADDRESS: Record = { [SupportedChainId.MAINNET]: WETH_ADDRESS_MAINNET, [SupportedChainId.GNOSIS_CHAIN]: WXDAI_ADDRESS_XDAI, [SupportedChainId.ARBITRUM_ONE]: WETH_ADDRESS_ARBITRUM_ONE, + [SupportedChainId.BASE]: WETH_ADDRESS_BASE, [SupportedChainId.SEPOLIA]: WETH_ADDRESS_SEPOLIA, } @@ -125,6 +127,7 @@ export const NATIVE_TOKEN_PER_NETWORK: Record = { [SupportedChainId.MAINNET]: ETH, [SupportedChainId.GNOSIS_CHAIN]: XDAI, [SupportedChainId.ARBITRUM_ONE]: ETH, + [SupportedChainId.BASE]: ETH, [SupportedChainId.SEPOLIA]: ETH, } diff --git a/apps/explorer/src/consts/subgraphUrls.ts b/apps/explorer/src/consts/subgraphUrls.ts index 72f9ffba37..ab1f94af67 100644 --- a/apps/explorer/src/consts/subgraphUrls.ts +++ b/apps/explorer/src/consts/subgraphUrls.ts @@ -11,5 +11,6 @@ export const SUBGRAPH_URLS: Record = { [SupportedChainId.MAINNET]: getSubgraphUrl(SupportedChainId.MAINNET, 'MAINNET'), [SupportedChainId.GNOSIS_CHAIN]: getSubgraphUrl(SupportedChainId.GNOSIS_CHAIN, 'GNOSIS_CHAIN'), [SupportedChainId.ARBITRUM_ONE]: getSubgraphUrl(SupportedChainId.ARBITRUM_ONE, 'ARBITRUM_ONE'), + [SupportedChainId.BASE]: getSubgraphUrl(SupportedChainId.BASE, 'BASE'), [SupportedChainId.SEPOLIA]: getSubgraphUrl(SupportedChainId.SEPOLIA, 'SEPOLIA'), } diff --git a/apps/explorer/src/explorer/pages/Home/index.tsx b/apps/explorer/src/explorer/pages/Home/index.tsx index 26b8daf2e4..e16587b8e7 100644 --- a/apps/explorer/src/explorer/pages/Home/index.tsx +++ b/apps/explorer/src/explorer/pages/Home/index.tsx @@ -65,6 +65,7 @@ const SHOW_TOKENS_TABLE: Record = { [SupportedChainId.MAINNET]: true, [SupportedChainId.GNOSIS_CHAIN]: false, // Gchain data is not reliable [SupportedChainId.ARBITRUM_ONE]: false, // No data for Arbitrum one + [SupportedChainId.BASE]: false, // No data for Base [SupportedChainId.SEPOLIA]: false, // No data for Sepolia } From 8d5d3028ba69c189f64ec98b2eb591a4c0d27712 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Fri, 25 Oct 2024 17:31:10 +0100 Subject: [PATCH 06/23] feat: fix widget configurator build, but var still required --- apps/widget-configurator/src/app/configurator/consts.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/widget-configurator/src/app/configurator/consts.ts b/apps/widget-configurator/src/app/configurator/consts.ts index 30cf0b2f20..7fd48e5358 100644 --- a/apps/widget-configurator/src/app/configurator/consts.ts +++ b/apps/widget-configurator/src/app/configurator/consts.ts @@ -8,10 +8,12 @@ import { TokenListItem } from './types' const GNOSIS_DEFAULT_PARTNER_FEE_RECIPIENT = '0x6b3214fd11dc91de14718dee98ef59bcbfcfb432' const MAINNET_DEFAULT_PARTNER_FEE_RECIPIENT = '0xB64963f95215FDe6510657e719bd832BB8bb941B' const ARB1_DEFAULT_PARTNER_FEE_RECIPIENT = '0x451100Ffc88884bde4ce87adC8bB6c7Df7fACccd' +const BASE_DEFAULT_PARTNER_FEE_RECIPIENT = '' // TODO: add fee recipient export const DEFAULT_PARTNER_FEE_RECIPIENT_PER_NETWORK: Record = { [SupportedChainId.MAINNET]: MAINNET_DEFAULT_PARTNER_FEE_RECIPIENT, [SupportedChainId.GNOSIS_CHAIN]: GNOSIS_DEFAULT_PARTNER_FEE_RECIPIENT, [SupportedChainId.ARBITRUM_ONE]: ARB1_DEFAULT_PARTNER_FEE_RECIPIENT, + [SupportedChainId.BASE]: BASE_DEFAULT_PARTNER_FEE_RECIPIENT, [SupportedChainId.SEPOLIA]: MAINNET_DEFAULT_PARTNER_FEE_RECIPIENT, } From 51615f0d36150c872abd1adc74c5f14362db8317 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 31 Oct 2024 15:34:53 +0000 Subject: [PATCH 07/23] feat: add BASE stablecoins --- libs/common-const/src/tokens.ts | 67 ++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/libs/common-const/src/tokens.ts b/libs/common-const/src/tokens.ts index ec570c2742..df90094816 100644 --- a/libs/common-const/src/tokens.ts +++ b/libs/common-const/src/tokens.ts @@ -239,6 +239,60 @@ export const DAI_BASE = new TokenWithLogo( 'Dai Stablecoin', ) +export const DOLA_BASE = new TokenWithLogo( + cowprotocolTokenLogoUrl('0x4621b7A9c75199271F773Ebd9A499dbd165c3191', SupportedChainId.BASE), + SupportedChainId.BASE, + '0x4621b7A9c75199271F773Ebd9A499dbd165c3191', + 18, + 'DOLA', + 'Dola USD Stablecoin', +) + +export const USDZ_BASE = new TokenWithLogo( + cowprotocolTokenLogoUrl('0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938', SupportedChainId.BASE), + SupportedChainId.BASE, + '0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938', + 18, + 'USDz', + 'USDz', +) + +export const EURC_BASE = new TokenWithLogo( + cowprotocolTokenLogoUrl('0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42', SupportedChainId.BASE), + SupportedChainId.BASE, + '0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42', + 18, + 'EURC', + 'EURC', +) + +export const CGUSD_BASE = new TokenWithLogo( + cowprotocolTokenLogoUrl('0xca72827a3d211cfd8f6b00ac98824872b72cab49', SupportedChainId.BASE), + SupportedChainId.BASE, + '0xca72827a3d211cfd8f6b00ac98824872b72cab49', + 18, + 'cgUSD', + 'Cygnus Global USD', +) + +export const USD_PLUS_BASE = new TokenWithLogo( + cowprotocolTokenLogoUrl('0xb79dd08ea68a908a97220c76d19a6aa9cbde4376', SupportedChainId.BASE), + SupportedChainId.BASE, + '0xb79dd08ea68a908a97220c76d19a6aa9cbde4376', + 18, + 'USD+', + 'USD+', +) + +export const EUSD_BASE = new TokenWithLogo( + cowprotocolTokenLogoUrl('0xcfa3ef56d303ae4faaba0592388f19d7c3399fb4', SupportedChainId.BASE), + SupportedChainId.BASE, + '0xcfa3ef56d303ae4faaba0592388f19d7c3399fb4', + 18, + 'eUSD', + 'Electronic Dollar', +) + // Sepolia export const GNO_SEPOLIA = new TokenWithLogo( @@ -308,7 +362,6 @@ const V_COW_TOKEN_SEPOLIA = new TokenWithLogo( 'CoW Protocol Virtual Token', ) -// TODO: V_COW not present in all chains, make sure code using it can handle that export const V_COW: Record = { [SupportedChainId.MAINNET]: V_COW_TOKEN_MAINNET, [SupportedChainId.GNOSIS_CHAIN]: V_COW_TOKEN_XDAI, @@ -407,11 +460,23 @@ const ARBITRUM_ONE_STABLECOINS = [ MIM_ARBITRUM_ONE.address, ].map((t) => t.toLowerCase()) +const _BASE_STABLECOINS = [ + USDC_BASE.address, + DAI_BASE.address, + DOLA_BASE.address, + USDZ_BASE.address, + EURC_BASE.address, + CGUSD_BASE.address, + USD_PLUS_BASE.address, + EUSD_BASE.address, +].map((t) => t.toLowerCase()) + export const STABLECOINS: Record> = { [SupportedChainId.MAINNET]: new Set(), [SupportedChainId.GNOSIS_CHAIN]: new Set(GNOSIS_CHAIN_STABLECOINS), [SupportedChainId.ARBITRUM_ONE]: new Set(ARBITRUM_ONE_STABLECOINS), [SupportedChainId.SEPOLIA]: new Set(), + [SupportedChainId.BASE]: new Set(), } /** From 924372d6beae577b25bbe7e82de197d3038c6f47 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 31 Oct 2024 17:58:34 +0000 Subject: [PATCH 08/23] feat: use uniswap's default list for chains where its supported --- libs/tokens/src/const/tokensLists.ts | 6 ------ libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts | 6 ++---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/libs/tokens/src/const/tokensLists.ts b/libs/tokens/src/const/tokensLists.ts index 0215352290..138aab9db3 100644 --- a/libs/tokens/src/const/tokensLists.ts +++ b/libs/tokens/src/const/tokensLists.ts @@ -13,9 +13,3 @@ export const UNISWAP_TOKENS_LIST = 'https://ipfs.io/ipns/tokens.uniswap.org' export const GNOSIS_UNISWAP_TOKENS_LIST = 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/GnosisUniswapTokensList.json' - -export const ARBITRUM_ONE_TOKENS_LIST = - 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/ArbitrumOneUniswapTokensList.json' - -// TODO: create BASE UNI token list -export const BASE_TOKENS_LIST = '' diff --git a/libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts b/libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts index 53ea5f1547..77bf475d43 100644 --- a/libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts +++ b/libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts @@ -5,8 +5,6 @@ import { getJotaiMergerStorage } from '@cowprotocol/core' import { mapSupportedNetworks, SupportedChainId } from '@cowprotocol/cow-sdk' import { - ARBITRUM_ONE_TOKENS_LIST, - BASE_TOKENS_LIST, DEFAULT_TOKENS_LISTS, GNOSIS_UNISWAP_TOKENS_LIST, LP_TOKEN_LISTS, @@ -24,8 +22,8 @@ import { environmentAtom } from '../environmentAtom' const UNISWAP_TOKEN_LIST_URL: Record = { [SupportedChainId.MAINNET]: UNISWAP_TOKENS_LIST, [SupportedChainId.GNOSIS_CHAIN]: GNOSIS_UNISWAP_TOKENS_LIST, - [SupportedChainId.ARBITRUM_ONE]: ARBITRUM_ONE_TOKENS_LIST, - [SupportedChainId.BASE]: BASE_TOKENS_LIST, + [SupportedChainId.ARBITRUM_ONE]: UNISWAP_TOKENS_LIST, + [SupportedChainId.BASE]: UNISWAP_TOKENS_LIST, [SupportedChainId.SEPOLIA]: UNISWAP_TOKENS_LIST, } From 94ea6da25dbcae521d9610394ced21a3d6c59a71 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Fri, 1 Nov 2024 16:31:45 +0000 Subject: [PATCH 09/23] chore: use cbBTC instead of WBTC, which is way more liquid on Base --- libs/common-const/src/tokens.ts | 10 +++++----- libs/tokens/src/const/defaultFavoriteTokens.ts | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/common-const/src/tokens.ts b/libs/common-const/src/tokens.ts index df90094816..bdbabc36e0 100644 --- a/libs/common-const/src/tokens.ts +++ b/libs/common-const/src/tokens.ts @@ -212,13 +212,13 @@ export const USDT_BASE = new TokenWithLogo( 'USDT', 'Tether USD', ) -export const WBTC_BASE = new TokenWithLogo( - WBTC.logoURI, +export const CBBTC_BASE = new TokenWithLogo( + cowprotocolTokenLogoUrl('0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', SupportedChainId.BASE), SupportedChainId.BASE, - '0x0555E30da8f98308EdB960aa94C0Db47230d2B9c', + '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', 8, - 'WBTC', - 'Wrapped BTC', + 'cbBTC', + 'Coinbase Wrapped BTC', ) export const USDC_BASE = new TokenWithLogo( diff --git a/libs/tokens/src/const/defaultFavoriteTokens.ts b/libs/tokens/src/const/defaultFavoriteTokens.ts index e136ec9118..61c54335cc 100644 --- a/libs/tokens/src/const/defaultFavoriteTokens.ts +++ b/libs/tokens/src/const/defaultFavoriteTokens.ts @@ -1,5 +1,6 @@ import { ARB_ARBITRUM_ONE, + CBBTC_BASE, COW, COW_TOKEN_ARBITRUM, COW_TOKEN_BASE, @@ -19,7 +20,6 @@ import { USDT_BASE, WBTC, WBTC_ARBITRUM_ONE, - WBTC_BASE, WBTC_GNOSIS_CHAIN, WETH_GNOSIS_CHAIN, WRAPPED_NATIVE_CURRENCIES, @@ -72,7 +72,7 @@ export const DEFAULT_FAVORITE_TOKENS: Record = { USDC_BASE, USDT_BASE, WRAPPED_NATIVE_CURRENCIES[SupportedChainId.BASE], - WBTC_BASE, + CBBTC_BASE, DAI_BASE, COW_TOKEN_BASE, ]), From 80d5c6e687153f108f46ce3d541f0231c3ba9a87 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Fri, 1 Nov 2024 16:31:59 +0000 Subject: [PATCH 10/23] fix: correct number of decimals for Base tokens --- libs/common-const/src/tokens.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/common-const/src/tokens.ts b/libs/common-const/src/tokens.ts index bdbabc36e0..d27b2fc122 100644 --- a/libs/common-const/src/tokens.ts +++ b/libs/common-const/src/tokens.ts @@ -261,7 +261,7 @@ export const EURC_BASE = new TokenWithLogo( cowprotocolTokenLogoUrl('0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42', SupportedChainId.BASE), SupportedChainId.BASE, '0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42', - 18, + 6, 'EURC', 'EURC', ) @@ -270,7 +270,7 @@ export const CGUSD_BASE = new TokenWithLogo( cowprotocolTokenLogoUrl('0xca72827a3d211cfd8f6b00ac98824872b72cab49', SupportedChainId.BASE), SupportedChainId.BASE, '0xca72827a3d211cfd8f6b00ac98824872b72cab49', - 18, + 6, 'cgUSD', 'Cygnus Global USD', ) @@ -279,7 +279,7 @@ export const USD_PLUS_BASE = new TokenWithLogo( cowprotocolTokenLogoUrl('0xb79dd08ea68a908a97220c76d19a6aa9cbde4376', SupportedChainId.BASE), SupportedChainId.BASE, '0xb79dd08ea68a908a97220c76d19a6aa9cbde4376', - 18, + 6, 'USD+', 'USD+', ) From dbfb2b6e17ea0d440db0e605549f11440bcb7128 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Fri, 1 Nov 2024 17:30:52 +0000 Subject: [PATCH 11/23] feat: add base token list to explorer pre-loaded tokens --- apps/explorer/src/hooks/useTokenList.ts | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/apps/explorer/src/hooks/useTokenList.ts b/apps/explorer/src/hooks/useTokenList.ts index dfb68b3bc2..18404ff75f 100644 --- a/apps/explorer/src/hooks/useTokenList.ts +++ b/apps/explorer/src/hooks/useTokenList.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react' import { SWR_NO_REFRESH_OPTIONS } from '@cowprotocol/common-const' -import { ALL_SUPPORTED_CHAIN_IDS, SupportedChainId, mapSupportedNetworks } from '@cowprotocol/cow-sdk' +import { ALL_SUPPORTED_CHAIN_IDS, mapSupportedNetworks, SupportedChainId } from '@cowprotocol/cow-sdk' import type { TokenInfo, TokenList } from '@uniswap/token-lists' import useSWR from 'swr' @@ -15,24 +15,33 @@ export function useTokenList(chainId: SupportedChainId | undefined): { data: Tok const { data: cowSwapList, isLoading: isCowListLoading } = useTokenListByUrl( chainId !== SupportedChainId.SEPOLIA ? 'https://files.cow.fi/tokens/CowSwap.json' - : 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CowSwapSepolia.json' + : 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CowSwapSepolia.json', ) const { data: coingeckoList, isLoading: isCoingeckoListLoading } = useTokenListByUrl( - chainId === SupportedChainId.MAINNET ? 'https://tokens.coingecko.com/uniswap/all.json' : '' + chainId === SupportedChainId.MAINNET ? 'https://tokens.coingecko.com/uniswap/all.json' : '', ) const { data: honeyswapList, isLoading: isHoneyswapListLoading } = useTokenListByUrl( - chainId === SupportedChainId.GNOSIS_CHAIN ? 'https://tokens.honeyswap.org' : '' + chainId === SupportedChainId.GNOSIS_CHAIN ? 'https://tokens.honeyswap.org' : '', ) const { data: arbitrumOneList, isLoading: isArbitrumOneListLoading } = useTokenListByUrl( - chainId === SupportedChainId.ARBITRUM_ONE ? 'https://tokens.coingecko.com/arbitrum-one/all.json' : '' + chainId === SupportedChainId.ARBITRUM_ONE ? 'https://tokens.coingecko.com/arbitrum-one/all.json' : '', + ) + const { data: baseList, isLoading: isBaseListLoading } = useTokenListByUrl( + chainId === SupportedChainId.BASE ? 'https://tokens.coingecko.com/base/all.json' : '', ) const isLoading = chainId - ? isCowListLoading || isHoneyswapListLoading || isCoingeckoListLoading || isArbitrumOneListLoading + ? isCowListLoading || + isHoneyswapListLoading || + isCoingeckoListLoading || + isArbitrumOneListLoading || + isBaseListLoading : false return useMemo(() => { - const data = chainId ? { ...coingeckoList, ...honeyswapList, ...cowSwapList, ...arbitrumOneList }[chainId] : {} + const data = chainId + ? { ...coingeckoList, ...honeyswapList, ...cowSwapList, ...arbitrumOneList, ...baseList }[chainId] + : {} return { data, isLoading } }, [chainId, coingeckoList, honeyswapList, cowSwapList, arbitrumOneList, isLoading]) @@ -58,6 +67,6 @@ function fetcher(tokenListUrl: string): Promise { acc[token.chainId][token.address.toLowerCase()] = token } return acc - }, INITIAL_TOKEN_LIST_PER_NETWORK) + }, INITIAL_TOKEN_LIST_PER_NETWORK), ) } From 05bec85c6ba24d22b763b44bdc4d6d26b9467472 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Fri, 1 Nov 2024 18:20:26 +0000 Subject: [PATCH 12/23] feat: add isBaseEnabled feature flag --- libs/common-hooks/src/useAvailableChains.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/common-hooks/src/useAvailableChains.ts b/libs/common-hooks/src/useAvailableChains.ts index 1a7892ba50..4e7c610179 100644 --- a/libs/common-hooks/src/useAvailableChains.ts +++ b/libs/common-hooks/src/useAvailableChains.ts @@ -3,6 +3,8 @@ import { useMemo } from 'react' import { getAvailableChains } from '@cowprotocol/common-utils' import { SupportedChainId } from '@cowprotocol/cow-sdk' +import { useFeatureFlags } from './useFeatureFlags' + /** * Hook to get a list of SupportedChainId currently available/enabled * @@ -12,12 +14,12 @@ import { SupportedChainId } from '@cowprotocol/cow-sdk' */ export function useAvailableChains(): SupportedChainId[] { // 1. Load feature flag for chain being enabled - // const { isArbitrumOneEnabled } = useFeatureFlags() + const { isBaseEnabled } = useFeatureFlags() return useMemo( // 2. Conditionally build a list of chain ids to exclude // () => getAvailableChains(isArbitrumOneEnabled ? undefined : [SupportedChainId.ARBITRUM_ONE]), - () => getAvailableChains(), - [] + () => getAvailableChains(isBaseEnabled ? undefined : [SupportedChainId.BASE]), + [isBaseEnabled], ) } From 1014b2a25d38e86cb3b9215bcb06fbdb0484c364 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Fri, 1 Nov 2024 18:26:07 +0000 Subject: [PATCH 13/23] feat: add full coingecko list disabled to base --- libs/tokens/src/const/tokensList.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/tokens/src/const/tokensList.json b/libs/tokens/src/const/tokensList.json index 210faafe52..05c6635226 100644 --- a/libs/tokens/src/const/tokensList.json +++ b/libs/tokens/src/const/tokensList.json @@ -118,6 +118,10 @@ "priority": 1, "enabledByDefault": true, "source": "https://files.cow.fi/tokens/CowSwap.json" + }, + { + "priority": 2, + "source": "https://tokens.coingecko.com/base/all.json" } ] -} \ No newline at end of file +} From 8714223b1bbd8499cd3192d3e2a14356b3d8d9a7 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Tue, 5 Nov 2024 07:36:58 +0000 Subject: [PATCH 14/23] feat: add default fee recipient address for Base --- apps/widget-configurator/src/app/configurator/consts.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/widget-configurator/src/app/configurator/consts.ts b/apps/widget-configurator/src/app/configurator/consts.ts index 7fd48e5358..4957a0d00a 100644 --- a/apps/widget-configurator/src/app/configurator/consts.ts +++ b/apps/widget-configurator/src/app/configurator/consts.ts @@ -8,7 +8,7 @@ import { TokenListItem } from './types' const GNOSIS_DEFAULT_PARTNER_FEE_RECIPIENT = '0x6b3214fd11dc91de14718dee98ef59bcbfcfb432' const MAINNET_DEFAULT_PARTNER_FEE_RECIPIENT = '0xB64963f95215FDe6510657e719bd832BB8bb941B' const ARB1_DEFAULT_PARTNER_FEE_RECIPIENT = '0x451100Ffc88884bde4ce87adC8bB6c7Df7fACccd' -const BASE_DEFAULT_PARTNER_FEE_RECIPIENT = '' // TODO: add fee recipient +const BASE_DEFAULT_PARTNER_FEE_RECIPIENT = '0x3c4DBcCf8d80D3d92B0d82197aebf52574ED1F3B' export const DEFAULT_PARTNER_FEE_RECIPIENT_PER_NETWORK: Record = { [SupportedChainId.MAINNET]: MAINNET_DEFAULT_PARTNER_FEE_RECIPIENT, [SupportedChainId.GNOSIS_CHAIN]: GNOSIS_DEFAULT_PARTNER_FEE_RECIPIENT, From cad07f5ba714e43de660085e7f19928e525792d4 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Tue, 5 Nov 2024 13:48:07 +0000 Subject: [PATCH 15/23] fix: add base to lp page links --- apps/cowswap-frontend/src/modules/yield/lpPageLinks.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/cowswap-frontend/src/modules/yield/lpPageLinks.ts b/apps/cowswap-frontend/src/modules/yield/lpPageLinks.ts index 9df218f5b3..4304ef758f 100644 --- a/apps/cowswap-frontend/src/modules/yield/lpPageLinks.ts +++ b/apps/cowswap-frontend/src/modules/yield/lpPageLinks.ts @@ -5,6 +5,7 @@ const COW_AMM_CHAINS = { [SupportedChainId.MAINNET]: 'ethereum', [SupportedChainId.GNOSIS_CHAIN]: 'gnosis', [SupportedChainId.ARBITRUM_ONE]: 'arbitrum', + [SupportedChainId.BASE]: 'base', [SupportedChainId.SEPOLIA]: '', } @@ -12,6 +13,7 @@ const UNI_CHAINS = { [SupportedChainId.MAINNET]: 'ethereum', [SupportedChainId.GNOSIS_CHAIN]: '', [SupportedChainId.ARBITRUM_ONE]: 'arbitrum', + [SupportedChainId.BASE]: 'base', [SupportedChainId.SEPOLIA]: '', } @@ -19,6 +21,7 @@ const SUSHI_CHAINS = { [SupportedChainId.MAINNET]: 'ethereum', [SupportedChainId.GNOSIS_CHAIN]: 'gnosis', [SupportedChainId.ARBITRUM_ONE]: 'arbitrum', + [SupportedChainId.BASE]: 'base', [SupportedChainId.SEPOLIA]: '', } @@ -26,6 +29,7 @@ const PANCAKE_CHAINS = { [SupportedChainId.MAINNET]: 'eth', [SupportedChainId.GNOSIS_CHAIN]: '', [SupportedChainId.ARBITRUM_ONE]: 'arb', + [SupportedChainId.BASE]: 'base', [SupportedChainId.SEPOLIA]: '', } From 08a75d43bd0f87bf422a30bdcc145912b95676ba Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Tue, 5 Nov 2024 18:35:29 +0000 Subject: [PATCH 16/23] feat: early exit on cowSwapFeeAtom if fee is not set for network --- .../src/modules/volumeFee/state/cowswapFeeAtom.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/cowswap-frontend/src/modules/volumeFee/state/cowswapFeeAtom.ts b/apps/cowswap-frontend/src/modules/volumeFee/state/cowswapFeeAtom.ts index 05cbdb7d26..b22878a4e3 100644 --- a/apps/cowswap-frontend/src/modules/volumeFee/state/cowswapFeeAtom.ts +++ b/apps/cowswap-frontend/src/modules/volumeFee/state/cowswapFeeAtom.ts @@ -1,6 +1,6 @@ import { atom } from 'jotai' -import { STABLECOINS, LpToken } from '@cowprotocol/common-const' +import { LpToken, STABLECOINS } from '@cowprotocol/common-const' import { getCurrencyAddress, isInjectedWidget } from '@cowprotocol/common-utils' import { SupportedChainId } from '@cowprotocol/cow-sdk' import { walletInfoAtom } from '@cowprotocol/wallet' @@ -27,6 +27,14 @@ const COWSWAP_VOLUME_FEES: Record = { export const cowSwapFeeAtom = atom((get) => { const { chainId, account } = get(walletInfoAtom) + + const volumeFee = COWSWAP_VOLUME_FEES[chainId] + + // Early exit if fee is not set for this network + if (!volumeFee) { + return null + } + const tradeState = get(derivedTradeStateAtom) const tradeTypeState = get(tradeTypeAtom) const isYieldWidget = tradeTypeState?.tradeType === TradeType.YIELD @@ -53,7 +61,7 @@ export const cowSwapFeeAtom = atom((get) => { // No stable-stable trades if (isInputTokenStable && isOutputTokenStable) return null - return COWSWAP_VOLUME_FEES[chainId] + return volumeFee }) function shouldApplyFee(account: string | undefined, percentage: number | boolean | undefined): boolean { From 64a51512ef339b79807a9782470ca4c0e480bc50 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Tue, 5 Nov 2024 18:35:47 +0000 Subject: [PATCH 17/23] refactor: single source of truth for stablecoins --- .../common/services/getQuoteCurrency/index.ts | 37 ++----------------- libs/common-const/src/tokens.ts | 12 ++++-- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/apps/cowswap-frontend/src/common/services/getQuoteCurrency/index.ts b/apps/cowswap-frontend/src/common/services/getQuoteCurrency/index.ts index 75cdf0d387..c79187f9a5 100644 --- a/apps/cowswap-frontend/src/common/services/getQuoteCurrency/index.ts +++ b/apps/cowswap-frontend/src/common/services/getQuoteCurrency/index.ts @@ -1,39 +1,10 @@ -import { - DAI, - DAI_ARBITRUM_ONE, - DAI_BASE, - NATIVE_CURRENCY_ADDRESS, - USDC_ARBITRUM_ONE, - USDC_BASE, - USDC_GNOSIS_CHAIN, - USDC_MAINNET, - USDC_SEPOLIA, - USDT, - USDT_ARBITRUM_ONE, - USDT_BASE, - USDT_GNOSIS_CHAIN, - WXDAI, -} from '@cowprotocol/common-const' +import { STABLECOINS } from '@cowprotocol/common-const' import { getCurrencyAddress } from '@cowprotocol/common-utils' import { SupportedChainId } from '@cowprotocol/cow-sdk' import { Currency, CurrencyAmount } from '@uniswap/sdk-core' import { Nullish } from 'types' -// TODO: Find a solution for using API: https://www.coingecko.com/en/categories/stablecoins -const STABLE_COINS: Record = { - [SupportedChainId.MAINNET]: [USDC_MAINNET, USDT, DAI].map((token) => token.address.toLowerCase()), - [SupportedChainId.GNOSIS_CHAIN]: [USDC_GNOSIS_CHAIN, USDT_GNOSIS_CHAIN, WXDAI] - .map((token) => token.address.toLowerCase()) - // XDAI and WXDAI are stable-coins - .concat(NATIVE_CURRENCY_ADDRESS), - [SupportedChainId.ARBITRUM_ONE]: [USDT_ARBITRUM_ONE, USDC_ARBITRUM_ONE, DAI_ARBITRUM_ONE].map((token) => - token.address.toLowerCase(), - ), - [SupportedChainId.BASE]: [USDT_BASE, USDC_BASE, DAI_BASE].map((token) => token.address.toLowerCase()), - [SupportedChainId.SEPOLIA]: [USDC_SEPOLIA].map((token) => token.address.toLowerCase()), -} - /** * Quote - means the currency we consider as base (https://www.investopedia.com/terms/q/quotecurrency.asp#:~:text=What%20Is%20a%20Quote%20Currency,value%20of%20the%20base%20currency) * For example: 400 UNI -> 2000 USDC - UNI is the quote currency, because is a stable coin against a non-stable coin @@ -66,13 +37,13 @@ export function getQuoteCurrencyByStableCoin( ): Currency | null { if (!chainId || !inputCurrency || !outputCurrency) return null - const stableCoins = STABLE_COINS[chainId] + const stableCoins = STABLECOINS[chainId] const inputAddress = getCurrencyAddress(inputCurrency).toLowerCase() const outputAddress = getCurrencyAddress(outputCurrency).toLowerCase() - const isInputStableCoin = stableCoins.includes(inputAddress) - const isOutputStableCoin = stableCoins.includes(outputAddress) + const isInputStableCoin = stableCoins.has(inputAddress) + const isOutputStableCoin = stableCoins.has(outputAddress) if (isInputStableCoin) return outputCurrency if (isOutputStableCoin) return inputCurrency diff --git a/libs/common-const/src/tokens.ts b/libs/common-const/src/tokens.ts index d27b2fc122..32e4cb1da9 100644 --- a/libs/common-const/src/tokens.ts +++ b/libs/common-const/src/tokens.ts @@ -437,6 +437,9 @@ export const GNO: Record = { const SDAI_GNOSIS_CHAIN_ADDRESS = '0xaf204776c7245bf4147c2612bf6e5972ee483701' const GBPE_GNOSIS_CHAIN_ADDRESS = '0x5cb9073902f2035222b9749f8fb0c9bfe5527108' +// Not used for fees +const MAINNET_STABLECOINS = [USDC_MAINNET.address, USDT.address, DAI.address].map((t) => t.toLowerCase()) + // NOTE: whenever this list is updated, make sure to update the docs section regarding the volume fees // https://github.com/cowprotocol/docs/blob/main/docs/governance/fees/fees.md?plain=1#L40 const GNOSIS_CHAIN_STABLECOINS = [ @@ -460,7 +463,8 @@ const ARBITRUM_ONE_STABLECOINS = [ MIM_ARBITRUM_ONE.address, ].map((t) => t.toLowerCase()) -const _BASE_STABLECOINS = [ +// Not used for fees +const BASE_STABLECOINS = [ USDC_BASE.address, DAI_BASE.address, DOLA_BASE.address, @@ -472,11 +476,11 @@ const _BASE_STABLECOINS = [ ].map((t) => t.toLowerCase()) export const STABLECOINS: Record> = { - [SupportedChainId.MAINNET]: new Set(), + [SupportedChainId.MAINNET]: new Set(MAINNET_STABLECOINS), [SupportedChainId.GNOSIS_CHAIN]: new Set(GNOSIS_CHAIN_STABLECOINS), [SupportedChainId.ARBITRUM_ONE]: new Set(ARBITRUM_ONE_STABLECOINS), - [SupportedChainId.SEPOLIA]: new Set(), - [SupportedChainId.BASE]: new Set(), + [SupportedChainId.SEPOLIA]: new Set([USDC_SEPOLIA.address]), + [SupportedChainId.BASE]: new Set(BASE_STABLECOINS), } /** From 9ac9d1f6ee69307fdd3e1a78633efb5b83e94328 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Wed, 6 Nov 2024 07:36:10 +0000 Subject: [PATCH 18/23] chore: fix lint --- apps/explorer/src/hooks/useTokenList.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/explorer/src/hooks/useTokenList.ts b/apps/explorer/src/hooks/useTokenList.ts index 18404ff75f..c911d0506e 100644 --- a/apps/explorer/src/hooks/useTokenList.ts +++ b/apps/explorer/src/hooks/useTokenList.ts @@ -44,7 +44,7 @@ export function useTokenList(chainId: SupportedChainId | undefined): { data: Tok : {} return { data, isLoading } - }, [chainId, coingeckoList, honeyswapList, cowSwapList, arbitrumOneList, isLoading]) + }, [chainId, coingeckoList, honeyswapList, cowSwapList, arbitrumOneList, isLoading, baseList]) } function useTokenListByUrl(tokenListUrl: string) { From 43e11e4616727824d6c9eb7f2339e9e084420fc0 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 7 Nov 2024 09:41:01 +0000 Subject: [PATCH 19/23] fix: use correct basescan tld --- libs/common-const/src/chainInfo.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/common-const/src/chainInfo.ts b/libs/common-const/src/chainInfo.ts index 4efb4adf3f..5edd3d0ed9 100644 --- a/libs/common-const/src/chainInfo.ts +++ b/libs/common-const/src/chainInfo.ts @@ -59,7 +59,7 @@ export const CHAIN_INFO: ChainInfoMap = { [SupportedChainId.BASE]: { docs: 'https://docs.base.org/', bridge: 'https://bridge.base.org/deposit', - explorer: 'https://basescan.io', + explorer: 'https://basescan.org', infoLink: 'https://www.base.org/', label: 'Base', addressPrefix: 'base', From a2ad40093d01dd605fc1d5a5f0f75ef7ec44ddd0 Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 7 Nov 2024 15:50:09 +0000 Subject: [PATCH 20/23] chore: remove unecessary conditional --- libs/common-const/src/tokens.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/common-const/src/tokens.ts b/libs/common-const/src/tokens.ts index 32e4cb1da9..cbd260cb32 100644 --- a/libs/common-const/src/tokens.ts +++ b/libs/common-const/src/tokens.ts @@ -376,7 +376,7 @@ export const V_COW: Record = { const COW_TOKEN_MAINNET = new TokenWithLogo( undefined, SupportedChainId.MAINNET, - COW_CONTRACT_ADDRESS[SupportedChainId.MAINNET] || '', + COW_CONTRACT_ADDRESS[SupportedChainId.MAINNET], 18, 'COW', 'CoW Protocol Token', @@ -385,7 +385,7 @@ const COW_TOKEN_MAINNET = new TokenWithLogo( const COW_TOKEN_XDAI = new TokenWithLogo( COW_TOKEN_MAINNET.logoURI, SupportedChainId.GNOSIS_CHAIN, - COW_CONTRACT_ADDRESS[SupportedChainId.GNOSIS_CHAIN] || '', + COW_CONTRACT_ADDRESS[SupportedChainId.GNOSIS_CHAIN], 18, 'COW', 'CoW Protocol Token', @@ -394,7 +394,7 @@ const COW_TOKEN_XDAI = new TokenWithLogo( export const COW_TOKEN_ARBITRUM = new TokenWithLogo( COW_TOKEN_MAINNET.logoURI, SupportedChainId.ARBITRUM_ONE, - COW_CONTRACT_ADDRESS[SupportedChainId.ARBITRUM_ONE] || '', + COW_CONTRACT_ADDRESS[SupportedChainId.ARBITRUM_ONE], 18, 'COW', 'CoW Protocol Token', @@ -403,7 +403,7 @@ export const COW_TOKEN_ARBITRUM = new TokenWithLogo( export const COW_TOKEN_BASE = new TokenWithLogo( COW_TOKEN_MAINNET.logoURI, SupportedChainId.BASE, - COW_CONTRACT_ADDRESS[SupportedChainId.BASE] || '', + COW_CONTRACT_ADDRESS[SupportedChainId.BASE], 18, 'COW', 'CoW Protocol Token', @@ -412,7 +412,7 @@ export const COW_TOKEN_BASE = new TokenWithLogo( const COW_TOKEN_SEPOLIA = new TokenWithLogo( COW_TOKEN_MAINNET.logoURI, SupportedChainId.SEPOLIA, - COW_CONTRACT_ADDRESS[SupportedChainId.SEPOLIA] || '', + COW_CONTRACT_ADDRESS[SupportedChainId.SEPOLIA], 18, 'COW', 'CoW Protocol Token', From 163d9548da504b899d55954e30a6eff80577f13e Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 7 Nov 2024 15:55:52 +0000 Subject: [PATCH 21/23] feat: add base start date tooltip --- .../containers/AccountDetails/SurplusCard.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/apps/cowswap-frontend/src/modules/account/containers/AccountDetails/SurplusCard.tsx b/apps/cowswap-frontend/src/modules/account/containers/AccountDetails/SurplusCard.tsx index 60b2afa635..0481421a6e 100644 --- a/apps/cowswap-frontend/src/modules/account/containers/AccountDetails/SurplusCard.tsx +++ b/apps/cowswap-frontend/src/modules/account/containers/AccountDetails/SurplusCard.tsx @@ -21,6 +21,18 @@ import { InfoCard } from './styled' const DEFAULT_START_DATE = 'March 2023' const ARBITRUM_ONE_START_DATE = 'May 2024' +const BASE_START_DATE = 'December 2024' + + + +const START_DATE: Record = { + [SupportedChainId.MAINNET]: DEFAULT_START_DATE, + [SupportedChainId.GNOSIS_CHAIN]: DEFAULT_START_DATE, + [SupportedChainId.ARBITRUM_ONE]: ARBITRUM_ONE_START_DATE, + [SupportedChainId.BASE]: BASE_START_DATE, + [SupportedChainId.SEPOLIA]: DEFAULT_START_DATE +} + export function SurplusCard() { const { surplusAmount, isLoading } = useTotalSurplus() @@ -29,7 +41,7 @@ export function SurplusCard() { const surplusUsdAmount = useUsdAmount(showSurplusAmount ? surplusAmount : undefined).value const native = useNativeCurrency() const nativeSymbol = native.symbol || 'ETH' - const isArbitrumOne = native.chainId === SupportedChainId.ARBITRUM_ONE + const startDate = START_DATE[native.chainId as SupportedChainId] const Wrapper = styled.div` margin: 12px auto 24px; @@ -158,9 +170,7 @@ export function SurplusCard() { Your total surplus{' '} From 0f04ef14c86f2a1ab7b01c89d224c99a080da37f Mon Sep 17 00:00:00 2001 From: Alfetopito Date: Thu, 7 Nov 2024 16:02:42 +0000 Subject: [PATCH 22/23] fix: use correct chain for twap small part warning --- apps/cowswap-frontend/src/modules/twap/const.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/cowswap-frontend/src/modules/twap/const.ts b/apps/cowswap-frontend/src/modules/twap/const.ts index 6f9b01fe37..2165b7e75e 100644 --- a/apps/cowswap-frontend/src/modules/twap/const.ts +++ b/apps/cowswap-frontend/src/modules/twap/const.ts @@ -41,7 +41,7 @@ export const MINIMUM_PART_SELL_AMOUNT_FIAT: Record Date: Thu, 7 Nov 2024 16:05:57 +0000 Subject: [PATCH 23/23] chore: bump to latest cow-sdk --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2b0bcaa824..5c8bb41c8e 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@cowprotocol/cms": "^0.6.0", "@cowprotocol/contracts": "^1.3.1", "@cowprotocol/cow-runner-game": "^0.2.9", - "@cowprotocol/cow-sdk": "^5.7.0-RC.0", + "@cowprotocol/cow-sdk": "^5.7.1", "@cowprotocol/ethflowcontract": "cowprotocol/ethflowcontract.git#main-artifacts", "@davatar/react": "1.8.1", "@emotion/react": "^11.11.1", diff --git a/yarn.lock b/yarn.lock index 8b6e8249b7..96c6bbb17d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2429,10 +2429,10 @@ resolved "https://registry.yarnpkg.com/@cowprotocol/cow-runner-game/-/cow-runner-game-0.2.9.tgz#3f94b3f370bd114f77db8b1d238cba3ef4e9d644" integrity sha512-rX7HnoV+HYEEkBaqVUsAkGGo0oBrExi+d6Io+8nQZYwZk+IYLmS9jdcIObsLviM2h4YX8+iin6NuKl35AaiHmg== -"@cowprotocol/cow-sdk@^5.7.0-RC.0": - version "5.7.0-RC.0" - resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.7.0-RC.0.tgz#14c4a05f1be7463613be656072f9d0d331cd7f15" - integrity sha512-ke6l11X/wt5KNgdO+WCsUvoF6NeeZ4xjtEX0CseauIkjDfacaX20IfO8dT4AD0SFc4MmAp0cX75eSqMD4Ipc+A== +"@cowprotocol/cow-sdk@^5.7.1": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@cowprotocol/cow-sdk/-/cow-sdk-5.7.1.tgz#22b556b79c949a3c5a65ee87f188a477f29d76eb" + integrity sha512-1SKzf6hqLEUP3if+Ki6eweSWcUA7hDyFcmUW2tf6a0XROwl9ktNHWP7dJ09zMrnFn6k03DqoYvKun1i+WS1D7Q== dependencies: "@cowprotocol/contracts" "^1.6.0" "@ethersproject/abstract-signer" "^5.7.0"