Skip to content

Commit e53239a

Browse files
authored
Revert "chore: bump sor to 4.17.9 - base mixed quoter v1 address (#817)" (#818)
- **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...) - **What is the current behavior?** (You can also link to an open issue here) - **What is the new behavior (if this is a feature change)?** - **Other information**:
1 parent 9a1e48e commit e53239a

File tree

8 files changed

+40
-420
lines changed

8 files changed

+40
-420
lines changed

package-lock.json

+29-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uniswap/smart-order-router",
3-
"version": "4.17.9",
3+
"version": "4.17.6",
44
"description": "Uniswap Smart Order Router",
55
"main": "build/main/index.js",
66
"typings": "build/main/index.d.ts",
@@ -37,15 +37,15 @@
3737
"@types/brotli": "^1.3.4",
3838
"@uniswap/default-token-list": "^11.13.0",
3939
"@uniswap/permit2-sdk": "^1.3.0",
40-
"@uniswap/router-sdk": "^1.21.4",
40+
"@uniswap/router-sdk": "^1.21.0",
4141
"@uniswap/sdk-core": "^7.5.0",
4242
"@uniswap/swap-router-contracts": "^1.3.1",
4343
"@uniswap/token-lists": "^1.0.0-beta.31",
4444
"@uniswap/universal-router": "^1.6.0",
45-
"@uniswap/universal-router-sdk": "^4.15.1",
45+
"@uniswap/universal-router-sdk": "^4.14.0",
4646
"@uniswap/v2-sdk": "^4.13.0",
4747
"@uniswap/v3-sdk": "^3.24.0",
48-
"@uniswap/v4-sdk": "^1.18.1",
48+
"@uniswap/v4-sdk": "^1.18.0",
4949
"async-retry": "^1.3.1",
5050
"await-timeout": "^1.1.1",
5151
"axios": "^0.21.1",

src/routers/alpha-router/entities/route-with-valid-quote.ts

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import { BigNumber } from '@ethersproject/bignumber';
22
import { Protocol } from '@uniswap/router-sdk';
33
import { Currency, Token, TradeType } from '@uniswap/sdk-core';
4-
import { Pair } from '@uniswap/v2-sdk';
54
import { Pool as V3Pool } from '@uniswap/v3-sdk';
65
import { Pool as V4Pool } from '@uniswap/v4-sdk';
76
import _ from 'lodash';
87

8+
import { Pair } from '@uniswap/v2-sdk';
99
import { IV4PoolProvider } from '../../../providers';
1010
import { IV2PoolProvider } from '../../../providers/v2/pool-provider';
1111
import { IV3PoolProvider } from '../../../providers/v3/pool-provider';
1212
import { CurrencyAmount } from '../../../util/amounts';
13-
import { FAKE_TICK_SPACING } from '../../../util/pools';
1413
import { routeToString } from '../../../util/routes';
1514
import {
1615
MixedRoute,
@@ -431,23 +430,14 @@ export class MixedRouteWithValidQuote implements IMixedRouteWithValidQuote {
431430
v3PoolProvider,
432431
v2PoolProvider,
433432
}: MixedRouteWithValidQuoteParams) {
434-
const poolsWithoutFakePool = route.pools.filter(
435-
(p) => !(p instanceof V4Pool && p.tickSpacing === FAKE_TICK_SPACING)
436-
);
437-
const routeWithoutEthWethFakePool = new MixedRoute(
438-
poolsWithoutFakePool,
439-
route.input,
440-
route.output
441-
);
442-
443433
this.amount = amount;
444434
this.rawQuote = rawQuote;
445435
this.sqrtPriceX96AfterList = sqrtPriceX96AfterList;
446436
this.initializedTicksCrossedList = initializedTicksCrossedList;
447437
this.quoterGasEstimate = quoterGasEstimate;
448438
this.quote = CurrencyAmount.fromRawAmount(quoteToken, rawQuote.toString());
449439
this.percent = percent;
450-
this.route = routeWithoutEthWethFakePool;
440+
this.route = route;
451441
this.gasModel = mixedRouteGasModel;
452442
this.quoteToken = quoteToken;
453443
this.tradeType = tradeType;
@@ -469,7 +459,7 @@ export class MixedRouteWithValidQuote implements IMixedRouteWithValidQuote {
469459
this.quoteAdjustedForGas = quoteGasAdjusted;
470460
}
471461

472-
this.poolIdentifiers = _.map(routeWithoutEthWethFakePool.pools, (p) => {
462+
this.poolIdentifiers = _.map(route.pools, (p) => {
473463
if (p instanceof V4Pool) {
474464
return v4PoolProvider.getPoolId(
475465
p.token0,

src/routers/alpha-router/functions/compute-all-routes.ts

+4-31
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { TPool } from '@uniswap/router-sdk/dist/utils/TPool';
2-
import { ChainId, Currency, Token } from '@uniswap/sdk-core';
2+
import { Currency, Token } from '@uniswap/sdk-core';
33
import { Pair } from '@uniswap/v2-sdk';
44
import { Pool as V3Pool } from '@uniswap/v3-sdk';
55
import { Pool as V4Pool } from '@uniswap/v4-sdk';
66

7-
import { getAddressLowerCase, nativeOnChain } from '../../../util';
7+
import { getAddressLowerCase } from '../../../util';
88
import { log } from '../../../util/log';
9-
import { FAKE_TICK_SPACING, V4_ETH_WETH_FAKE_POOL } from '../../../util/pools';
109
import { poolToString, routeToString } from '../../../util/routes';
1110
import {
1211
MixedRoute,
@@ -76,17 +75,6 @@ export function computeAllMixedRoutes(
7675
parts: TPool[],
7776
maxHops: number
7877
): MixedRoute[] {
79-
// only add fake v4 pool, if we see there's a native v4 pool in the candidate pool
80-
const containsV4NativePools =
81-
parts.filter(
82-
(pool) =>
83-
pool instanceof V4Pool &&
84-
pool.involvesToken(nativeOnChain(ChainId.MAINNET))
85-
).length > 0;
86-
// NOTE: we added a fake v4 pool, in order for mixed route to connect the v3 weth pool with v4 eth pool
87-
const amendedPools = containsV4NativePools
88-
? parts.concat(V4_ETH_WETH_FAKE_POOL[currencyIn.chainId as ChainId])
89-
: parts;
9078
const routesRaw = computeAllRoutes<TPool, MixedRoute, Currency>(
9179
currencyIn,
9280
currencyOut,
@@ -97,7 +85,7 @@ export function computeAllMixedRoutes(
9785
currency.isNative
9886
? (pool as V4Pool).involvesToken(currency)
9987
: pool.involvesToken(currency),
100-
amendedPools,
88+
parts,
10189
maxHops
10290
);
10391
/// filter out pure v4 and v3 and v2 routes
@@ -137,22 +125,7 @@ export function computeAllRoutes<
137125
tokensVisited: Set<string>,
138126
_previousTokenOut?: TCurrency
139127
) => {
140-
const currentRouteContainsFakeV4Pool =
141-
currentRoute.filter(
142-
(pool) =>
143-
pool instanceof V4Pool && pool.tickSpacing === FAKE_TICK_SPACING
144-
).length > 0;
145-
const amendedMaxHops = currentRouteContainsFakeV4Pool
146-
? maxHops + 1
147-
: maxHops;
148-
149-
// amendedMaxHops is the maxHops + 1 if the current route contains a fake v4 pool
150-
// b/c we want to allow the route to go through the fake v4 pool
151-
// also gas wise, if a route goes through the fake v4 pool, mixed quoter will add the wrap/unwrap gas cost:
152-
// https://github.com/Uniswap/mixed-quoter/pull/41/files#diff-a4d1289f264d1da22aac20cc55a9d01c8ba9cccd76ce1af8f952ec9034e7e1aaR189
153-
// and SOR will use the gas cost from the mixed quoter:
154-
// https://github.com/Uniswap/smart-order-router/blob/17da523f1af050e6430afb866d96681346c8fb8b/src/routers/alpha-router/gas-models/mixedRoute/mixed-route-heuristic-gas-model.ts#L222
155-
if (currentRoute.length > amendedMaxHops) {
128+
if (currentRoute.length > maxHops) {
156129
return;
157130
}
158131

src/util/addresses.ts

-2
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,12 @@ export const MIXED_ROUTE_QUOTER_V1_ADDRESSES: AddressMap = {
141141
CHAIN_TO_ADDRESSES_MAP[ChainId.MAINNET].mixedRouteQuoterV1Address,
142142
[ChainId.GOERLI]:
143143
CHAIN_TO_ADDRESSES_MAP[ChainId.GOERLI].mixedRouteQuoterV1Address,
144-
[ChainId.BASE]: '0xc7A3b85D43fF66AD98A895dE0EaE4b9e24C932D7',
145144
};
146145

147146
export const MIXED_ROUTE_QUOTER_V2_ADDRESSES: AddressMap = {
148147
[ChainId.SEPOLIA]:
149148
CHAIN_TO_ADDRESSES_MAP[ChainId.SEPOLIA].mixedRouteQuoterV2Address,
150149
[ChainId.MAINNET]: '0xE63C5F5005909E96b5aA9CE10744CCE70eC16CC3',
151-
[ChainId.BASE]: '0xc7A3b85D43fF66AD98A895dE0EaE4b9e24C932D7',
152150
};
153151

154152
export const UNISWAP_MULTICALL_ADDRESSES: AddressMap = {

src/util/chains.ts

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export const MIXED_SUPPORTED = [
5252
ChainId.MAINNET,
5353
ChainId.SEPOLIA,
5454
ChainId.GOERLI,
55-
ChainId.BASE,
5655
];
5756

5857
export const HAS_L1_FEE = [

0 commit comments

Comments
 (0)