Skip to content

Commit

Permalink
chore: bump sor to 3.42.0 - feat: implement v4 candidate pools from t…
Browse files Browse the repository at this point in the history
…op tvl v4 subgraph (#814)

* chore: bump sor to 3.42.0

* fix prettier

* chore: bump sor to 3.42.0
  • Loading branch information
jsy1218 authored Aug 22, 2024
1 parent 2cc5ebe commit 2a6944e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/handlers/injector-sor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ export abstract class InjectorSOR<Router, QueryParams> extends Injector<
v4SubgraphProvider,
v3SubgraphProvider,
onChainQuoteProvider: quoteProvider,
v4PoolProvider,
v3PoolProvider,
v2PoolProvider,
v2QuoteProvider: new V2QuoteProvider(),
Expand Down
3 changes: 2 additions & 1 deletion lib/handlers/router-entities/aws-subgraph-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
MetricLoggerUnit,
V2SubgraphPool,
V3SubgraphPool,
V4SubgraphPool,
} from '@uniswap/smart-order-router'
import { S3 } from 'aws-sdk'
import { ChainId } from '@uniswap/sdk-core'
Expand Down Expand Up @@ -106,7 +107,7 @@ export const cachePoolsFromS3 = async <TSubgraphPool>(
return pools
}

export class V4AWSSubgraphProvider extends AWSSubgraphProvider<V3SubgraphPool> implements IV3SubgraphProvider {
export class V4AWSSubgraphProvider extends AWSSubgraphProvider<V4SubgraphPool> implements IV3SubgraphProvider {
constructor(chainId: ChainId, bucket: string, baseKey: string) {
super(chainId, Protocol.V4, bucket, baseKey)
}
Expand Down
38 changes: 38 additions & 0 deletions lib/handlers/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = (chainId: ChainId): AlphaRouterCo
topNWithEachBaseToken: 3,
topNWithBaseToken: 3,
},
v4PoolSelection: {
topN: 2,
topNDirectSwaps: 2,
topNTokenInOut: 2,
topNSecondHop: 1,
topNWithEachBaseToken: 3,
topNWithBaseToken: 3,
},
maxSwapsPerPath: 3,
minSplits: 1,
maxSplits: 7,
Expand Down Expand Up @@ -61,6 +69,14 @@ export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = (chainId: ChainId): AlphaRouterCo
topNWithEachBaseToken: 3,
topNWithBaseToken: 2,
},
v4PoolSelection: {
topN: 2,
topNDirectSwaps: 2,
topNTokenInOut: 2,
topNSecondHop: 1,
topNWithEachBaseToken: 3,
topNWithBaseToken: 2,
},
maxSwapsPerPath: 2,
minSplits: 1,
maxSplits: 7,
Expand Down Expand Up @@ -91,6 +107,17 @@ export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = (chainId: ChainId): AlphaRouterCo
topNWithEachBaseToken: 3,
topNWithBaseToken: 5,
},
v4PoolSelection: {
topN: 2,
topNDirectSwaps: 2,
topNTokenInOut: 3,
topNSecondHop: 1,
topNSecondHopForTokenAddress: new MapWithLowerCaseKey<number>([
['0x5f98805a4e8be255a32880fdec7f6728c6568ba0', 2], // LUSD
]),
topNWithEachBaseToken: 3,
topNWithBaseToken: 5,
},
maxSwapsPerPath: 3,
minSplits: 1,
maxSplits: 2,
Expand Down Expand Up @@ -121,6 +148,17 @@ export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = (chainId: ChainId): AlphaRouterCo
topNWithEachBaseToken: 3,
topNWithBaseToken: 5,
},
v4PoolSelection: {
topN: 2,
topNDirectSwaps: 2,
topNTokenInOut: 3,
topNSecondHop: 1,
topNSecondHopForTokenAddress: new MapWithLowerCaseKey<number>([
['0x5f98805a4e8be255a32880fdec7f6728c6568ba0', 2], // LUSD
]),
topNWithEachBaseToken: 3,
topNWithBaseToken: 5,
},
maxSwapsPerPath: 3,
minSplits: 1,
maxSplits: 7,
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"@uniswap/router-sdk": "^1.10.0",
"@uniswap/sdk-core": "^5.3.0",
"@types/semver": "^7.5.8",
"@uniswap/smart-order-router": "3.41.0",
"@uniswap/smart-order-router": "3.42.0",
"@uniswap/token-lists": "^1.0.0-beta.33",
"@uniswap/universal-router-sdk": "^2.2.4",
"@uniswap/v2-sdk": "^4.3.2",
Expand Down

0 comments on commit 2a6944e

Please sign in to comment.