Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
fix l2 routing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahZinsmeister committed Jul 7, 2021
1 parent 8e9981e commit f6dea47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
7 changes: 6 additions & 1 deletion src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ export enum SupportedChainId {
OPTIMISTIC_KOVAN = 69,
}

export const L2_CHAIN_IDS = [SupportedChainId.ARBITRUM_ONE, SupportedChainId.OPTIMISM]
export const L2_CHAIN_IDS = [
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISTIC_KOVAN,
]

export const L2_INFO: Record<number, { bridge: string; docs: string; explorer: string; logoUrl: string }> = {
[SupportedChainId.OPTIMISM]: {
Expand Down
18 changes: 9 additions & 9 deletions src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,36 +74,36 @@ function TopLevelModals() {
const Routes = () => {
const { chainId } = useActiveWeb3React()

const HIDE_ON_L2 = Boolean(chainId && L2_CHAIN_IDS.includes(chainId))
const ON_L2 = Boolean(chainId && L2_CHAIN_IDS.includes(chainId))
return (
<Switch>
<Route exact strict path="/vote" component={Vote} />
<Route exact strict path="/vote/:governorIndex/:id" component={VotePage} />
<Route exact strict path="/claim" component={OpenClaimAddressModalAndRedirectToSwap} />
{HIDE_ON_L2 && <Route exact strict path="/uni" component={Earn} />}
{HIDE_ON_L2 && <Route exact strict path="/uni/:currencyIdA/:currencyIdB" component={Manage} />}
{!ON_L2 && <Route exact strict path="/uni" component={Earn} />}
{!ON_L2 && <Route exact strict path="/uni/:currencyIdA/:currencyIdB" component={Manage} />}

<Route exact strict path="/send" component={RedirectPathToSwapOnly} />
<Route exact strict path="/swap/:outputCurrency" component={RedirectToSwap} />
<Route exact strict path="/swap" component={Swap} />

{HIDE_ON_L2 && <Route exact strict path="/pool/v2/find" component={PoolFinder} />}
{HIDE_ON_L2 && <Route exact strict path="/pool/v2" component={PoolV2} />}
{!ON_L2 && <Route strict path="/pool/v2" component={PoolV2} />}
{!ON_L2 && <Route exact strict path="/pool/v2/find" component={PoolFinder} />}
<Route exact strict path="/pool" component={Pool} />
<Route exact strict path="/pool/:tokenId" component={PositionPage} />

{HIDE_ON_L2 && (
{!ON_L2 && (
<Route exact strict path="/add/v2/:currencyIdA?/:currencyIdB?" component={RedirectDuplicateTokenIdsV2} />
)}
<Route exact strict path="/add/:currencyIdA?/:currencyIdB?/:feeAmount?" component={RedirectDuplicateTokenIds} />

<Route exact strict path="/increase/:currencyIdA?/:currencyIdB?/:feeAmount?/:tokenId?" component={AddLiquidity} />

{HIDE_ON_L2 && <Route exact strict path="/remove/v2/:currencyIdA/:currencyIdB" component={RemoveLiquidity} />}
{!ON_L2 && <Route exact strict path="/remove/v2/:currencyIdA/:currencyIdB" component={RemoveLiquidity} />}
<Route exact strict path="/remove/:tokenId" component={RemoveLiquidityV3} />

{HIDE_ON_L2 && <Route exact strict path="/migrate/v2" component={MigrateV2} />}
{HIDE_ON_L2 && <Route exact strict path="/migrate/v2/:address" component={MigrateV2Pair} />}
{!ON_L2 && <Route exact strict path="/migrate/v2" component={MigrateV2} />}
{!ON_L2 && <Route exact strict path="/migrate/v2/:address" component={MigrateV2Pair} />}

<Route exact strict path="/create-proposal" component={CreateProposal} />
<Route component={RedirectPathToSwapOnly} />
Expand Down

0 comments on commit f6dea47

Please sign in to comment.