Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/cow-fi/services/tokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import path from 'path'
import { DATA_CACHE_TIME_SECONDS } from '@/const/meta'
import { Network } from '@/const/networkMap'
import { PlatformData, Platforms, TokenDetails, TokenInfo } from 'types'
import { COW_CDN } from '@cowprotocol/common-const'

const NETWORKS: Network[] = ['ethereum', 'base', 'arbitrum-one', 'avalanche', 'polygon-pos', 'xdai']
const COW_TOKEN_ID = 'cow-protocol'

const TOKEN_LISTS_URL = 'https://files.cow.fi/tokens/cowFi-tokens.json'
const TOKEN_LISTS_URL = `${COW_CDN}/tokens/cowFi-tokens.json`
const DESCRIPTIONS_DIR_PATH = path.join(process.cwd(), 'data', 'descriptions')

/**
Expand Down
2 changes: 2 additions & 0 deletions apps/cowswap-frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,5 @@ INTEGRATION_TESTS_INFURA_KEY=
# Crowdin translations
#######################################
# CROWDIN_PERSONAL_TOKEN

REACT_APP_COW_CDN=https://files.cow.fi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useState, ReactNode, useRef } from 'react'

import {
COW_CDN,
USDC_BASE,
USDC_GNOSIS_CHAIN,
USDC_MAINNET,
Expand Down Expand Up @@ -38,7 +39,7 @@ const account = '0xfb3c7eb936cAA12B5A884d612393969A557d4307'
const swapAndBridgeContextMock: SwapAndBridgeContext = {
bridgeProvider: {
logoUrl:
'https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/src/bridging/providers/across/across-logo.png',
`${COW_CDN}/cow-sdk/bridging/providers/across/across-logo.png`,
name: 'Across',
dappId: 'cow-sdk://bridging/providers/across',
website: 'https://across.to',
Expand Down
5 changes: 3 additions & 2 deletions apps/cowswap-frontend/src/modules/permit/const.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { COW_CDN } from '@cowprotocol/common-const'

import ms from 'ms.macro'

export const PENDING_ORDER_PERMIT_CHECK_INTERVAL = ms`60s`

export const PRE_GENERATED_PERMIT_URL =
'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/PermitInfo'
export const PRE_GENERATED_PERMIT_URL = `${COW_CDN}/token-lists/PermitInfo`
8 changes: 4 additions & 4 deletions apps/cowswap-frontend/src/modules/tokensList/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TokenWithLogo } from '@cowprotocol/common-const'
import { COW_CDN, TokenWithLogo } from '@cowprotocol/common-const'
import { SupportedChainId } from '@cowprotocol/cow-sdk'
import { ListState } from '@cowprotocol/tokens'

Expand Down Expand Up @@ -101,7 +101,7 @@ export const customTokensMock: TokenWithLogo[] = [
export const listsMock: ListState[] = [
{
source:
'https://tokenlists.org/token-list?url=https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CowSwapSepolia.json',
`https://tokenlists.org/token-list?url=${COW_CDN}/token-lists/CowSwapSepolia.json`,
list: {
name: 'CowSwap Sepolia',
logoURI: 'https://gnosis.mypinata.cloud/ipfs/Qme9B6jRpGtZsRFcPjHvA5T4ugFuL4c3SzWfxyMPa59AMo',
Expand All @@ -128,10 +128,10 @@ export const listsMock: ListState[] = [
]

export const importListsMock: ListState = {
source: 'https://files.cow.fi/tokens/CowSwap.json',
source: `${COW_CDN}/tokens/CowSwap.json`,
list: {
name: 'CoW Swap',
logoURI: 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/images/list-logo.png',
logoURI: `${COW_CDN}/token-lists/images/list-logo.png`,
// TODO: Replace any with proper type definitions
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tokens: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] as any[],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { COW_CDN } from '@cowprotocol/common-const'
import { ChainInfo, EnrichedOrder, EvmCall, TokenInfo } from '@cowprotocol/cow-sdk'
import {
BridgeProvider,
Expand All @@ -21,7 +22,7 @@ export class TestReceiverAccountBridgeProvider implements ReceiverAccountBridgeP
info: BridgeProviderInfo = {
name: 'Receiver Bridge',
logoUrl:
'https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/packages/bridging/src/providers/mock/mock-logo.webp',
`${COW_CDN}/cow-sdk/bridging/providers/mock/mock-logo.webp`,
dappId: 'test-receiver-bridge',
website: 'https://github.com/cowprotocol/cowswap',
type: 'ReceiverAccountBridgeProvider',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { COW_CDN } from '@cowprotocol/common-const'
import type { CrossChainOrder } from '@cowprotocol/sdk-bridging'

export const crossChainOrderMock = {
Expand All @@ -8,7 +9,7 @@ export const crossChainOrderMock = {
info: {
name: 'Bungee',
logoUrl:
'https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/src/bridging/providers/bungee/bungee-logo.png',
`${COW_CDN}/cow-sdk/bridging/providers/bungee/bungee-logo.png`,
dappId: 'cow-sdk://bridging/providers/bungee',
website: 'https://www.bungee.exchange',
},
Expand Down
6 changes: 3 additions & 3 deletions apps/explorer/src/hooks/useTokenList.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react'

import { SWR_NO_REFRESH_OPTIONS } from '@cowprotocol/common-const'
import { COW_CDN, SWR_NO_REFRESH_OPTIONS } from '@cowprotocol/common-const'
import { ALL_SUPPORTED_CHAIN_IDS, mapSupportedNetworks, SupportedChainId } from '@cowprotocol/cow-sdk'
import type { TokenInfo, TokenList } from '@uniswap/token-lists'

Expand Down Expand Up @@ -32,8 +32,8 @@ const EMPTY_TOKENS: TokenListByAddress = {}
export function useTokenList(chainId: SupportedChainId | undefined): { data: TokenListByAddress; isLoading: boolean } {
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',
? `${COW_CDN}/tokens/CowSwap.json`
: `${COW_CDN}/token-lists/CowSwapSepolia.json`,
)
const { data: coingeckoUniswapList, isLoading: isCoingeckoUniswapLoading } = useTokenListByUrl(
chainId === SupportedChainId.MAINNET ? 'https://tokens.coingecko.com/uniswap/all.json' : '',
Expand Down
1 change: 1 addition & 0 deletions apps/explorer/src/utils/miscellaneous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const delay = <T = void>(ms = 100, result?: T): Promise<T> =>

/**
* Uses images from https://github.com/trustwallet/tokens
* @deprecated TODO5(daniel)
*/
export function getImageUrl(tokenAddress?: string): string | undefined {
if (!tokenAddress) return undefined
Expand Down
5 changes: 3 additions & 2 deletions apps/widget-configurator/src/app/configurator/consts.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { COW_CDN } from '@cowprotocol/common-const'
import { CowWidgetEventListeners, CowWidgetEvents, ToastMessageType } from '@cowprotocol/events'
import { CowSwapWidgetPaletteParams, TokenInfo, TradeType } from '@cowprotocol/widget-lib'

Expand All @@ -9,8 +10,8 @@ export const TRADE_MODES = [TradeType.SWAP, TradeType.LIMIT, TradeType.ADVANCED,

// Sourced from https://tokenlists.org/
export const DEFAULT_TOKEN_LISTS: TokenListItem[] = [
{ url: 'https://files.cow.fi/tokens/CowSwap.json', enabled: true },
{ url: 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.1.json', enabled: true },
{ url: `${COW_CDN}/tokens/CowSwap.json`, enabled: true },
{ url: `${COW_CDN}/token-lists/CoinGecko.1.json`, enabled: true },
{ url: 'https://www.gemini.com/uniswap/manifest.json', enabled: false },
{ url: 'https://messari.io/tokenlist/messari-verified', enabled: false },
{ url: 'https://static.optimism.io/optimism.tokenlist.json', enabled: false },
Expand Down
1 change: 1 addition & 0 deletions libs/common-const/src/cdn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const COW_CDN = process.env.REACT_APP_COW_CDN || 'https://files.cow.fi'
4 changes: 3 additions & 1 deletion libs/common-const/src/cowprotocolTokenLogoUrl.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { SupportedChainId } from '@cowprotocol/cow-sdk'

const tokenUrlRoot = 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/images'
import { COW_CDN } from './cdn'

const tokenUrlRoot = `${COW_CDN}/token-lists/images`

export const cowprotocolTokenLogoUrl = (address: string, chainId: SupportedChainId): string =>
`${tokenUrlRoot}/${chainId}/${address}/logo.png`
1 change: 1 addition & 0 deletions libs/common-const/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './bff'
export * from './chainInfo'
export * from './cdn'
export * from './common'
export * from './cowprotocolTokenLogoUrl'
export * from './feeRecipient'
Expand Down
4 changes: 2 additions & 2 deletions libs/hook-dapp-lib/src/hookDappsRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const hookDappsRegistry = {
version: '0.0.1',
website: 'https://www.bungee.exchange',
image:
'https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/src/bridging/providers/bungee/bungee-logo.png',
'https://files.cow.fi/cow-sdk/bridging/providers/bungee/bungee-logo.png',
conditions: {
walletCompatibility: ['EOA'],
},
Expand All @@ -178,7 +178,7 @@ export const hookDappsRegistry = {
version: '0.0.1',
website: 'https://across.to',
image:
'https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/src/bridging/providers/across/across-logo.png',
'https://files.cow.fi/cow-sdk/bridging/providers/across/across-logo.png',
conditions: {
walletCompatibility: ['EOA'],
},
Expand Down
12 changes: 6 additions & 6 deletions libs/tokens/src/const/lpTokensList.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@
{
"priority": 100,
"lpTokenProvider": "COW_AMM",
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/refs/heads/main/src/public/lp-tokens/cow-amm.json"
"source": "https://files.cow.fi/token-lists/lp-tokens/cow-amm.json"
},
{
"priority": 101,
"lpTokenProvider": "UNIV2",
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/refs/heads/main/src/public/lp-tokens/uniswapv2.json"
"source": "https://files.cow.fi/token-lists/lp-tokens/uniswapv2.json"
},
{
"priority": 102,
"lpTokenProvider": "CURVE",
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/refs/heads/main/src/public/lp-tokens/curve.json"
"source": "https://files.cow.fi/token-lists/lp-tokens/curve.json"
},
{
"priority": 103,
"lpTokenProvider": "BALANCERV2",
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/refs/heads/main/src/public/lp-tokens/balancerv2.json"
"source": "https://files.cow.fi/token-lists/lp-tokens/balancerv2.json"
},
{
"priority": 104,
"lpTokenProvider": "SUSHI",
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/refs/heads/main/src/public/lp-tokens/sushiswap.json"
"source": "https://files.cow.fi/token-lists/lp-tokens/sushiswap.json"
},
{
"priority": 105,
"lpTokenProvider": "PANCAKE",
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/refs/heads/main/src/public/lp-tokens/pancakeswap.json"
"source": "https://files.cow.fi/token-lists/lp-tokens/pancakeswap.json"
}
]
34 changes: 17 additions & 17 deletions libs/tokens/src/const/tokensList.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"priority": 2,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.1.json"
"source": "https://files.cow.fi/token-lists/CoinGecko.1.json"
},
{
"priority": 3,
Expand All @@ -33,12 +33,12 @@
{
"priority": 3,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/Uniswap.100.json"
"source": "https://files.cow.fi/token-lists/Uniswap.100.json"
},
{
"priority": 4,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.100.json"
"source": "https://files.cow.fi/token-lists/CoinGecko.100.json"
},
{
"priority": 5,
Expand All @@ -54,12 +54,12 @@
{
"priority": 2,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/Uniswap.42161.json"
"source": "https://files.cow.fi/token-lists/Uniswap.42161.json"
},
{
"priority": 3,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.42161.json"
"source": "https://files.cow.fi/token-lists/CoinGecko.42161.json"
},
{
"priority": 4,
Expand All @@ -74,7 +74,7 @@
{
"priority": 1,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CowSwapSepolia.json"
"source": "https://files.cow.fi/token-lists/CowSwapSepolia.json"
}
],
"8453": [
Expand All @@ -85,13 +85,13 @@
},
{
"priority": 2,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.8453.json",
"source": "https://files.cow.fi/token-lists/CoinGecko.8453.json",
"enabledByDefault": true
},
{
"priority": 3,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/Uniswap.8453.json"
"source": "https://files.cow.fi/token-lists/Uniswap.8453.json"
},
{
"priority": 4,
Expand All @@ -110,13 +110,13 @@
},
{
"priority": 2,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.137.json",
"source": "https://files.cow.fi/token-lists/CoinGecko.137.json",
"enabledByDefault": true
},
{
"priority": 3,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/Uniswap.137.json"
"source": "https://files.cow.fi/token-lists/Uniswap.137.json"
}
],
"43114": [
Expand All @@ -127,13 +127,13 @@
},
{
"priority": 2,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.43114.json",
"source": "https://files.cow.fi/token-lists/CoinGecko.43114.json",
"enabledByDefault": true
},
{
"priority": 3,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/Uniswap.43114.json"
"source": "https://files.cow.fi/token-lists/Uniswap.43114.json"
}
],
"56": [
Expand All @@ -144,13 +144,13 @@
},
{
"priority": 2,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.56.json",
"source": "https://files.cow.fi/token-lists/CoinGecko.56.json",
"enabledByDefault": true
},
{
"priority": 3,
"enabledByDefault": true,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/Uniswap.56.json"
"source": "https://files.cow.fi/token-lists/Uniswap.56.json"
},
{
"priority": 4,
Expand All @@ -165,7 +165,7 @@
},
{
"priority": 2,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.232.json",
"source": "https://files.cow.fi/token-lists/CoinGecko.232.json",
"enabledByDefault": true
}
],
Expand All @@ -177,7 +177,7 @@
},
{
"priority": 2,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.59144.json",
"source": "https://files.cow.fi/token-lists/CoinGecko.59144.json",
"enabledByDefault": true
}
],
Expand All @@ -189,7 +189,7 @@
},
{
"priority": 2,
"source": "https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public/CoinGecko.9745.json",
"source": "https://files.cow.fi/token-lists/CoinGecko.9745.json",
"enabledByDefault": true
}
]
Expand Down
3 changes: 2 additions & 1 deletion libs/tokens/src/state/tokenLists/tokenListsStateAtom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { atom } from 'jotai'
import { atomWithStorage } from 'jotai/utils'

import { COW_CDN } from '@cowprotocol/common-const'
import { atomWithIdbStorage, getJotaiMergerStorage } from '@cowprotocol/core'
import { mapSupportedNetworks, SupportedChainId } from '@cowprotocol/cow-sdk'

Expand All @@ -14,7 +15,7 @@ import {
} from '../../types'
import { environmentAtom } from '../environmentAtom'

const TOKEN_LIST_SRC = 'https://raw.githubusercontent.com/cowprotocol/token-lists/main/src/public'
const TOKEN_LIST_SRC = `${COW_CDN}/token-lists`

const UNISWAP_TOKEN_LIST_URL: Record<SupportedChainId, string> = {
[SupportedChainId.MAINNET]: UNISWAP_TOKENS_LIST,
Expand Down
3 changes: 3 additions & 0 deletions libs/tokens/src/utils/trustTokenLogoUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const chainIdToName: Record<SupportedChainId, string | null> = {
[SupportedChainId.PLASMA]: 'plasma',
}

/**
* @deprecated TODO5(daniel)
*/
export function trustTokenLogoUrl(address: string, chainId: SupportedChainId): string | null {
const trustChainName = chainIdToName[chainId]

Expand Down