Commit bc243e1c authored by Moody Salem's avatar Moody Salem

refactor: some clean up of the common bases code, add WETH

parent 679a58da
...@@ -3,7 +3,7 @@ import { Text } from 'rebass' ...@@ -3,7 +3,7 @@ import { Text } from 'rebass'
import { Currency } from '@uniswap/sdk-core' import { Currency } from '@uniswap/sdk-core'
import styled from 'styled-components/macro' import styled from 'styled-components/macro'
import { SUGGESTED_BASES } from '../../constants/routing' import { COMMON_BASES } from '../../constants/routing'
import { currencyId } from '../../utils/currencyId' import { currencyId } from '../../utils/currencyId'
import { AutoColumn } from '../Column' import { AutoColumn } from '../Column'
import QuestionHelper from '../QuestionHelper' import QuestionHelper from '../QuestionHelper'
...@@ -35,7 +35,9 @@ export default function CommonBases({ ...@@ -35,7 +35,9 @@ export default function CommonBases({
selectedCurrency?: Currency | null selectedCurrency?: Currency | null
onSelect: (currency: Currency) => void onSelect: (currency: Currency) => void
}) { }) {
return ( const bases = typeof chainId !== 'undefined' ? COMMON_BASES[chainId] ?? [] : []
return bases.length > 0 ? (
<AutoColumn gap="md"> <AutoColumn gap="md">
<AutoRow> <AutoRow>
<Text fontWeight={500} fontSize={14}> <Text fontWeight={500} fontSize={14}>
...@@ -44,7 +46,7 @@ export default function CommonBases({ ...@@ -44,7 +46,7 @@ export default function CommonBases({
<QuestionHelper text="These tokens are commonly paired with other tokens." /> <QuestionHelper text="These tokens are commonly paired with other tokens." />
</AutoRow> </AutoRow>
<AutoRow gap="4px"> <AutoRow gap="4px">
{(typeof chainId === 'number' ? SUGGESTED_BASES[chainId] ?? [] : []).map((currency: Currency) => { {bases.map((currency: Currency) => {
const isSelected = selectedCurrency?.equals(currency) const isSelected = selectedCurrency?.equals(currency)
return ( return (
<BaseWrapper <BaseWrapper
...@@ -61,5 +63,5 @@ export default function CommonBases({ ...@@ -61,5 +63,5 @@ export default function CommonBases({
})} })}
</AutoRow> </AutoRow>
</AutoColumn> </AutoColumn>
) ) : null
} }
...@@ -66,10 +66,18 @@ export const CUSTOM_BASES: { [chainId: number]: { [tokenAddress: string]: Token[ ...@@ -66,10 +66,18 @@ export const CUSTOM_BASES: { [chainId: number]: { [tokenAddress: string]: Token[
[AMPL.address]: [DAI, WETH9[1]], [AMPL.address]: [DAI, WETH9[1]],
}, },
} }
// used for display in the default list when adding liquidity
export const SUGGESTED_BASES: ChainCurrencyList = { /**
[1]: [Ether.onChain(1), DAI, USDC, USDT, WBTC], * Shows up in the currency select for swap and add liquidity
*/
export const COMMON_BASES: ChainCurrencyList = {
[1]: [Ether.onChain(1), DAI, USDC, USDT, WBTC, WETH9[1]],
[3]: [Ether.onChain(3), WETH9[3]],
[4]: [Ether.onChain(4), WETH9[4]],
[5]: [Ether.onChain(5), WETH9[5]],
[42]: [Ether.onChain(42), WETH9[42]],
} }
// used to construct the list of all pairs we consider by default in the frontend // used to construct the list of all pairs we consider by default in the frontend
export const BASES_TO_TRACK_LIQUIDITY_FOR: ChainTokenList = { export const BASES_TO_TRACK_LIQUIDITY_FOR: ChainTokenList = {
...WETH_ONLY, ...WETH_ONLY,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment