Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: base and avax #615

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
"@uniswap/redux-multicall": "^1.1.8",
"@uniswap/router-sdk": "^1.6.0",
"@uniswap/sdk-core": "^4.0.6",
"@uniswap/smart-order-router": "^3.13.7",
"@uniswap/token-lists": "^1.0.0-beta.30",
"@uniswap/universal-router-sdk": "^1.5.6",
"@uniswap/smart-order-router": "^3.15.2",
"@uniswap/token-lists": "^1.0.0-beta.33",
"@uniswap/universal-router-sdk": "^1.5.7",
"@uniswap/v2-sdk": "^3.2.0",
"@uniswap/v3-sdk": "^3.10.0",
"@web3-react/core": "^8.2.0",
Expand Down Expand Up @@ -166,7 +166,7 @@
"@types/wcag-contrast": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
"@uniswap/default-token-list": "^9.0.0",
"@uniswap/default-token-list": "^11.5.0",
"@uniswap/v2-core": "1.0.0",
"@uniswap/v3-core": "1.0.0",
"@uniswap/v3-periphery": "^1.1.1",
Expand Down
11 changes: 11 additions & 0 deletions src/assets/svg/avax-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/assets/svg/base-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions src/components/EtherscanLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChainId } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { SupportedChainId } from 'constants/chains'
import { Link } from 'icons'
import { ReactNode, useMemo } from 'react'
import styled from 'styled-components/macro'
Expand Down Expand Up @@ -30,10 +30,7 @@ export default function EtherscanLink({
showIcon = true,
}: EtherscanLinkProps) {
const { chainId } = useWeb3React()
const url = useMemo(
() => data && getExplorerLink(chainId || SupportedChainId.MAINNET, data, type),
[chainId, data, type]
)
const url = useMemo(() => data && getExplorerLink(chainId || ChainId.MAINNET, data, type), [chainId, data, type])

return (
<StyledExternalLink href={url} color={color} target="_blank">
Expand Down
28 changes: 14 additions & 14 deletions src/components/Logo/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SupportedChainId } from 'constants/chains'
import { ChainId } from '@uniswap/sdk-core'
import { isAddress } from 'utils'

import EthereumLogo from '../../assets/images/ethereum-logo.png'
Expand All @@ -9,19 +9,19 @@ import { LogoTableInput } from './LogoTable'

type Network = 'ethereum' | 'arbitrum' | 'optimism' | 'polygon' | 'celo' | 'smartchain'

function chainIdToNetworkName(networkId: SupportedChainId): Network | undefined {
function chainIdToNetworkName(networkId: ChainId): Network | undefined {
switch (networkId) {
case SupportedChainId.MAINNET:
case ChainId.MAINNET:
return 'ethereum'
case SupportedChainId.ARBITRUM_ONE:
case ChainId.ARBITRUM_ONE:
return 'arbitrum'
case SupportedChainId.OPTIMISM:
case ChainId.OPTIMISM:
return 'optimism'
case SupportedChainId.POLYGON:
case ChainId.POLYGON:
return 'polygon'
case SupportedChainId.CELO:
case ChainId.CELO:
return 'celo'
case SupportedChainId.BNB:
case ChainId.BNB:
return 'smartchain'
default:
return 'ethereum'
Expand All @@ -41,15 +41,15 @@ export function getAssetsRepoURI(asset: LogoTableInput): string | undefined {
: undefined
}

export function getNativeLogoURI(chainId: SupportedChainId = SupportedChainId.MAINNET): string {
export function getNativeLogoURI(chainId: ChainId = ChainId.MAINNET): string {
switch (chainId) {
case SupportedChainId.POLYGON:
case SupportedChainId.POLYGON_MUMBAI:
case ChainId.POLYGON:
case ChainId.POLYGON_MUMBAI:
return MaticLogo
case SupportedChainId.CELO:
case SupportedChainId.CELO_ALFAJORES:
case ChainId.CELO:
case ChainId.CELO_ALFAJORES:
return CeloLogo
case SupportedChainId.BNB:
case ChainId.BNB:
return BnbLogo
default:
return EthereumLogo
Expand Down
4 changes: 2 additions & 2 deletions src/components/Swap/SwapActionButton/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChainId } from '@uniswap/sdk-core'
import { useWeb3React } from '@web3-react/core'
import { isSupportedChainId } from 'constants/chainInfo'
import { SupportedChainId } from 'constants/chains'
import { ChainError, useSwapInfo } from 'hooks/swap'
import { SwapApprovalState } from 'hooks/swap/useSwapApproval'
import { useIsWrap } from 'hooks/swap/useWrapCallback'
Expand Down Expand Up @@ -39,7 +39,7 @@ export default function SwapActionButton() {
return <ConnectWalletButton />
} else if (error === ChainError.MISMATCHED_CHAINS || error === ChainError.UNSUPPORTED_CHAIN) {
const tokenChainId = inputCurrency?.chainId ?? outputCurrency?.chainId
const supportedTokenChainId = isSupportedChainId(tokenChainId) ? tokenChainId : SupportedChainId.MAINNET
const supportedTokenChainId = isSupportedChainId(tokenChainId) ? tokenChainId : ChainId.MAINNET
return <SwitchChainButton chainId={supportedTokenChainId} />
} else if (isWrap) {
return <WrapButton disabled={isDisabled} />
Expand Down
40 changes: 18 additions & 22 deletions src/constants/addresses.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SupportedChainId } from 'constants/chains'
import { ChainId } from '@uniswap/sdk-core'
import { constructSameAddressMap } from 'utils/constructSameAddressMap'

type AddressMap = { [chainId: number]: string }
Expand All @@ -7,37 +7,33 @@ export const UNI_ADDRESS: AddressMap = constructSameAddressMap('0x1f9840a85d5aF5

export const MULTICALL_ADDRESS: AddressMap = {
...constructSameAddressMap('0x1F98415757620B543A52E61c46B32eB19261F984', [
SupportedChainId.OPTIMISM_GOERLI,
SupportedChainId.OPTIMISM,
SupportedChainId.POLYGON_MUMBAI,
SupportedChainId.POLYGON,
ChainId.OPTIMISM_GOERLI,
ChainId.OPTIMISM,
ChainId.POLYGON_MUMBAI,
ChainId.POLYGON,
]),
[SupportedChainId.ARBITRUM_ONE]: '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB',
[SupportedChainId.ARBITRUM_RINKEBY]: '0xa501c031958F579dB7676fF1CE78AD305794d579',
[SupportedChainId.CELO]: '0x633987602DE5C4F337e3DbF265303A1080324204',
[SupportedChainId.CELO_ALFAJORES]: '0x633987602DE5C4F337e3DbF265303A1080324204',
[ChainId.ARBITRUM_ONE]: '0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB',
[ChainId.CELO]: '0x633987602DE5C4F337e3DbF265303A1080324204',
[ChainId.CELO_ALFAJORES]: '0x633987602DE5C4F337e3DbF265303A1080324204',
}

export const SWAP_ROUTER_ADDRESSES: AddressMap = {
...constructSameAddressMap('0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', [
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISM_GOERLI,
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.POLYGON,
SupportedChainId.POLYGON_MUMBAI,
ChainId.OPTIMISM,
ChainId.OPTIMISM_GOERLI,
ChainId.ARBITRUM_ONE,
ChainId.POLYGON,
ChainId.POLYGON_MUMBAI,
]),
[SupportedChainId.CELO]: '0x5615CDAb10dc425a742d643d949a7F474C01abc4',
[SupportedChainId.CELO_ALFAJORES]: '0x5615CDAb10dc425a742d643d949a7F474C01abc4',
[ChainId.CELO]: '0x5615CDAb10dc425a742d643d949a7F474C01abc4',
[ChainId.CELO_ALFAJORES]: '0x5615CDAb10dc425a742d643d949a7F474C01abc4',
}

export const ARGENT_WALLET_DETECTOR_ADDRESS: AddressMap = {
[SupportedChainId.MAINNET]: '0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8',
[ChainId.MAINNET]: '0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8',
}

export const ENS_REGISTRAR_ADDRESSES: AddressMap = {
[SupportedChainId.MAINNET]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[SupportedChainId.ROPSTEN]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[SupportedChainId.GOERLI]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[SupportedChainId.RINKEBY]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[ChainId.MAINNET]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[ChainId.GOERLI]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
}
Loading
Loading