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: enable v2 routing on all deployed L2 #465

Merged
merged 19 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ Total ticks crossed: 7

```

```
./bin/cli quote --tokenIn 0x7F5c764cBc14f9669B88837ca1490cCa17c31607 --tokenOut 0x4200000000000000000000000000000000000042 --amount 1 --exactIn --minSplits 1 --protocols v2 --router alpha --chainId 10
```


## Optimism-Goerli

```
Expand Down
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@
"@uniswap/sdk-core": "^4.0.7",
"@uniswap/swap-router-contracts": "^1.3.0",
"@uniswap/token-lists": "^1.0.0-beta.31",
"@uniswap/universal-router": "^1.0.1",
"@uniswap/universal-router-sdk": "^1.5.8",
"@uniswap/v2-sdk": "^3.2.3",
"@uniswap/universal-router": "^1.6.0",
"@uniswap/universal-router-sdk": "^1.6.0",
"@uniswap/v2-sdk": "^3.3.0",
"@uniswap/v3-sdk": "^3.10.0",
"async-retry": "^1.3.1",
"await-timeout": "^1.1.1",
"await-timeout": "^1.1.1",
"axios": "^0.21.1",
"brotli": "^1.3.3",
"bunyan": "^1.8.15",
Expand Down
16 changes: 14 additions & 2 deletions src/providers/v2/static-subgraph-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ import { WRAPPED_NATIVE_CURRENCY } from '../../util/chains';
import { log } from '../../util/log';
import {
DAI_MAINNET,
DAI_OPTIMISM,
OP_OPTIMISM,
USDC_MAINNET,
USDC_OPTIMISM,
USDT_MAINNET,
USDT_OPTIMISM,
WBTC_MAINNET,
WBTC_OPTIMISM
} from '../token-provider';

import { IV2SubgraphProvider, V2SubgraphPool } from './subgraph-provider';
Expand All @@ -27,8 +32,15 @@ const BASES_TO_CHECK_TRADES_AGAINST: ChainTokenList = {
],
[ChainId.GOERLI]: [WRAPPED_NATIVE_CURRENCY[ChainId.GOERLI]!],
[ChainId.SEPOLIA]: [WRAPPED_NATIVE_CURRENCY[ChainId.SEPOLIA]!],
//v2 not deployed on [optimism, arbitrum, polygon, celo, gnosis, moonbeam, bnb, avalanche] and their testnets
[ChainId.OPTIMISM]: [],
//v2 not deployed on [arbitrum, polygon, celo, gnosis, moonbeam, bnb, avalanche] and their testnets
[ChainId.OPTIMISM]: [
WRAPPED_NATIVE_CURRENCY[ChainId.OPTIMISM]!,
USDC_OPTIMISM,
DAI_OPTIMISM,
USDT_OPTIMISM,
WBTC_OPTIMISM,
OP_OPTIMISM
],
[ChainId.ARBITRUM_ONE]: [],
[ChainId.ARBITRUM_GOERLI]: [],
[ChainId.OPTIMISM_GOERLI]: [],
Expand Down
7 changes: 6 additions & 1 deletion src/util/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ export const SUPPORTED_CHAINS: ChainId[] = [
// Gnosis and Moonbeam don't yet have contracts deployed yet
];

export const V2_SUPPORTED = [ChainId.MAINNET, ChainId.GOERLI, ChainId.SEPOLIA];
export const V2_SUPPORTED = [
ChainId.MAINNET,
ChainId.GOERLI,
ChainId.SEPOLIA,
ChainId.OPTIMISM
];

export const HAS_L1_FEE = [
ChainId.OPTIMISM,
Expand Down
Loading