Uniswap / interface

🦄 Open source interfaces for the Uniswap protocol
https://app.uniswap.org
GNU General Public License v3.0
4.9k stars 4.98k forks source link

Redirect away from V2 pages when network switches to L2 #2199

Open awbvious opened 3 years ago

awbvious commented 3 years ago

URL

https://app.uniswap.org/#/pool/v2

Error

Error: No V2 factory address on this chain

Stacktrace

Error: No V2 factory address on this chain
    at sr (https://app.uniswap.org/static/js/main.5691fd30.chunk.js:1:85317)
    at https://app.uniswap.org/static/js/main.5691fd30.chunk.js:1:587638
    at Array.map (<anonymous>)
    at https://app.uniswap.org/static/js/main.5691fd30.chunk.js:1:587599
    at Object.useMemo (https://app.uniswap.org/static/js/4.d35f88da.chunk.js:2:1666864)
    at t.useMemo (https://app.uniswap.org/static/js/4.d35f88da.chunk.js:2:1585104)
    at aT (https://app.uniswap.org/static/js/main.5691fd30.chunk.js:1:587577)
    at no (https://app.uniswap.org/static/js/4.d35f88da.chunk.js:2:1660899)
    at Vu (https://app.uniswap.org/static/js/4.d35f88da.chunk.js:2:1713357)
    at Ss (https://app.uniswap.org/static/js/4.d35f88da.chunk.js:2:1700531)

Device data

{
  "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
  "browser": {
    "name": "Chrome",
    "version": "92.0.4515.131",
    "major": "92"
  },
  "engine": {
    "name": "Blink",
    "version": "92.0.4515.131"
  },
  "os": {
    "name": "Windows",
    "version": "10"
  },
  "device": {},
  "cpu": {
    "architecture": "amd64"
  }
}
awbvious commented 3 years ago

Steps to reproduce.

Go to Uniswap on Ethereum. Go to pools. Go to view v2 liquidity. Go to import v2 pool. Change the chain in metamask from Ethereum to Optimism. Press back arrow in UI. Crash.


Much simpler method: 1) Make sure Metamask is connected to Ethereum. 2) Go to https://app.uniswap.org/#/pool/v2 3) Switch Metamask to Optimism. 4) Crash

willhennessy commented 3 years ago

Thanks! In general if the user is on a V2 page and then switches to a network that does not support V2, we should redirect to app.uniswap.org