fix: update USDbC to default USDC on Base (#7377)

* fix: update usdbc to default usdc

* add base to chainid logo lookup

* remove nit

* replace dai with usdbc
This commit is contained in:
Kristie Huang 2023-10-18 14:03:55 -04:00 committed by GitHub
parent 71d3661b22
commit c5f2df4bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 6 deletions

@ -20,6 +20,7 @@ import {
OP, OP,
PORTAL_ETH_CELO, PORTAL_ETH_CELO,
PORTAL_USDC_CELO, PORTAL_USDC_CELO,
USDbC_BASE,
USDC_ARBITRUM, USDC_ARBITRUM,
USDC_ARBITRUM_GOERLI, USDC_ARBITRUM_GOERLI,
USDC_AVALANCHE, USDC_AVALANCHE,
@ -89,7 +90,7 @@ export const COMMON_BASES: ChainCurrencyList = {
], ],
[ChainId.OPTIMISM]: [nativeOnChain(ChainId.OPTIMISM), OP, DAI_OPTIMISM, USDC_OPTIMISM, USDT_OPTIMISM, WBTC_OPTIMISM], [ChainId.OPTIMISM]: [nativeOnChain(ChainId.OPTIMISM), OP, DAI_OPTIMISM, USDC_OPTIMISM, USDT_OPTIMISM, WBTC_OPTIMISM],
[ChainId.OPTIMISM_GOERLI]: [nativeOnChain(ChainId.OPTIMISM_GOERLI)], [ChainId.OPTIMISM_GOERLI]: [nativeOnChain(ChainId.OPTIMISM_GOERLI)],
[ChainId.BASE]: [nativeOnChain(ChainId.BASE), WRAPPED_NATIVE_CURRENCY[ChainId.BASE] as Token, USDC_BASE], [ChainId.BASE]: [nativeOnChain(ChainId.BASE), WRAPPED_NATIVE_CURRENCY[ChainId.BASE] as Token, USDC_BASE, USDbC_BASE],
[ChainId.POLYGON]: [ [ChainId.POLYGON]: [
nativeOnChain(ChainId.POLYGON), nativeOnChain(ChainId.POLYGON),
WETH_POLYGON, WETH_POLYGON,

@ -66,13 +66,14 @@ export const PORTAL_USDC_CELO = new Token(
'USDCet', 'USDCet',
'USDC (Portal from Ethereum)' 'USDC (Portal from Ethereum)'
) )
export const USDC_BASE = new Token( export const USDbC_BASE = new Token(
ChainId.BASE, ChainId.BASE,
'0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA', '0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA',
6, 6,
'USD Base Coin', 'USDbC',
'USDbC' 'USD Base Coin'
) )
export const USDC_BASE = new Token(ChainId.BASE, '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', 6, 'USDC', 'USD Coin')
export const DAI = new Token(ChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'Dai Stablecoin') export const DAI = new Token(ChainId.MAINNET, '0x6B175474E89094C44Da98b954EedeAC495271d0F', 18, 'DAI', 'Dai Stablecoin')
export const DAI_ARBITRUM_ONE = new Token( export const DAI_ARBITRUM_ONE = new Token(
@ -103,6 +104,7 @@ export const DAI_POLYGON = new Token(
'DAI', 'DAI',
'Dai Stablecoin' 'Dai Stablecoin'
) )
export const USDT_POLYGON = new Token( export const USDT_POLYGON = new Token(
ChainId.POLYGON, ChainId.POLYGON,
'0xc2132d05d31c914a87c6611c10748aeb04b58e8f', '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
@ -468,6 +470,7 @@ export const TOKEN_SHORTHANDS: { [shorthand: string]: { [chainId in ChainId]?: s
[ChainId.POLYGON]: USDC_POLYGON.address, [ChainId.POLYGON]: USDC_POLYGON.address,
[ChainId.POLYGON_MUMBAI]: USDC_POLYGON_MUMBAI.address, [ChainId.POLYGON_MUMBAI]: USDC_POLYGON_MUMBAI.address,
[ChainId.BNB]: USDC_BSC.address, [ChainId.BNB]: USDC_BSC.address,
[ChainId.BASE]: USDC_BASE.address,
[ChainId.CELO]: PORTAL_USDC_CELO.address, [ChainId.CELO]: PORTAL_USDC_CELO.address,
[ChainId.CELO_ALFAJORES]: PORTAL_USDC_CELO.address, [ChainId.CELO_ALFAJORES]: PORTAL_USDC_CELO.address,
[ChainId.GOERLI]: USDC_GOERLI.address, [ChainId.GOERLI]: USDC_GOERLI.address,

@ -10,6 +10,7 @@ import {
DAI_OPTIMISM, DAI_OPTIMISM,
USDC_ARBITRUM, USDC_ARBITRUM,
USDC_AVALANCHE, USDC_AVALANCHE,
USDC_BASE,
USDC_MAINNET, USDC_MAINNET,
USDC_POLYGON, USDC_POLYGON,
USDT_BSC, USDT_BSC,
@ -25,6 +26,7 @@ const STABLECOIN_AMOUNT_OUT: { [chainId: number]: CurrencyAmount<Token> } = {
[ChainId.CELO]: CurrencyAmount.fromRawAmount(CUSD_CELO, 10_000e18), [ChainId.CELO]: CurrencyAmount.fromRawAmount(CUSD_CELO, 10_000e18),
[ChainId.BNB]: CurrencyAmount.fromRawAmount(USDT_BSC, 100e18), [ChainId.BNB]: CurrencyAmount.fromRawAmount(USDT_BSC, 100e18),
[ChainId.AVALANCHE]: CurrencyAmount.fromRawAmount(USDC_AVALANCHE, 10_000e6), [ChainId.AVALANCHE]: CurrencyAmount.fromRawAmount(USDC_AVALANCHE, 10_000e6),
[ChainId.BASE]: CurrencyAmount.fromRawAmount(USDC_BASE, 10_000e6),
} }
/** /**

@ -39,6 +39,7 @@ const RETRY_OPTIONS_BY_CHAIN_ID: { [chainId: number]: RetryOptions } = {
[ChainId.ARBITRUM_GOERLI]: { n: 10, minWait: 250, maxWait: 1000 }, [ChainId.ARBITRUM_GOERLI]: { n: 10, minWait: 250, maxWait: 1000 },
[ChainId.OPTIMISM]: { n: 10, minWait: 250, maxWait: 1000 }, [ChainId.OPTIMISM]: { n: 10, minWait: 250, maxWait: 1000 },
[ChainId.OPTIMISM_GOERLI]: { n: 10, minWait: 250, maxWait: 1000 }, [ChainId.OPTIMISM_GOERLI]: { n: 10, minWait: 250, maxWait: 1000 },
[ChainId.BASE]: { n: 10, minWait: 250, maxWait: 1000 },
} }
const DEFAULT_RETRY_OPTIONS: RetryOptions = { n: 1, minWait: 0, maxWait: 0 } const DEFAULT_RETRY_OPTIONS: RetryOptions = { n: 1, minWait: 0, maxWait: 0 }

@ -10,7 +10,7 @@ import CeloLogo from '../../assets/svg/celo_logo.svg'
import MaticLogo from '../../assets/svg/matic-token-icon.svg' import MaticLogo from '../../assets/svg/matic-token-icon.svg'
import { isCelo, NATIVE_CHAIN_ID, nativeOnChain } from '../../constants/tokens' import { isCelo, NATIVE_CHAIN_ID, nativeOnChain } from '../../constants/tokens'
type Network = 'ethereum' | 'arbitrum' | 'optimism' | 'polygon' | 'smartchain' | 'celo' | 'avalanchec' type Network = 'ethereum' | 'arbitrum' | 'optimism' | 'polygon' | 'smartchain' | 'celo' | 'avalanchec' | 'base'
export function chainIdToNetworkName(networkId: ChainId): Network { export function chainIdToNetworkName(networkId: ChainId): Network {
switch (networkId) { switch (networkId) {
@ -28,6 +28,8 @@ export function chainIdToNetworkName(networkId: ChainId): Network {
return 'celo' return 'celo'
case ChainId.AVALANCHE: case ChainId.AVALANCHE:
return 'avalanchec' return 'avalanchec'
case ChainId.BASE:
return 'base'
default: default:
return 'ethereum' return 'ethereum'
} }
@ -52,7 +54,14 @@ export function getNativeLogoURI(chainId: ChainId = ChainId.MAINNET): string {
function getTokenLogoURI(address: string, chainId: ChainId = ChainId.MAINNET): string | void { function getTokenLogoURI(address: string, chainId: ChainId = ChainId.MAINNET): string | void {
const networkName = chainIdToNetworkName(chainId) const networkName = chainIdToNetworkName(chainId)
const networksWithUrls = [ChainId.ARBITRUM_ONE, ChainId.MAINNET, ChainId.OPTIMISM, ChainId.BNB, ChainId.AVALANCHE] const networksWithUrls = [
ChainId.ARBITRUM_ONE,
ChainId.MAINNET,
ChainId.OPTIMISM,
ChainId.BNB,
ChainId.AVALANCHE,
ChainId.BASE,
]
if (isCelo(chainId) && address === nativeOnChain(chainId).wrapped.address) { if (isCelo(chainId) && address === nativeOnChain(chainId).wrapped.address) {
return CeloLogo return CeloLogo
} }