Skip to content

Commit 81624a1

Browse files
authored
SOR - Remove graphTraversalConfig from inputs (#1848)
1 parent ff7aa07 commit 81624a1

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

Diff for: .changeset/khaki-plants-leave.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'backend': patch
3+
---
4+
5+
SOR - Remove graphTraversalConfig from inputs

Diff for: modules/sor/sor.service.ts

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import {
1717
import { PathWithAmount } from './lib/path';
1818
import { getInputAmount, getOutputAmount } from './lib/utils';
1919

20+
const DEFAULT_MAX_DEPTH = 4;
21+
2022
export class SorService {
2123
async getSorSwapPaths(args: QuerySorGetSwapPathsArgs): Promise<GqlSorGetSwapPaths> {
2224
console.log('getSorSwaps args', JSON.stringify(args));
@@ -94,7 +96,7 @@ export class SorService {
9496
const swapKind = mapSwapKind(input.swapType);
9597

9698
// retry with different max depth if no paths are found
97-
let swapOptions = this.buildSwapOptions(input.graphTraversalConfig);
99+
let swapOptions = this.buildSwapOptions(DEFAULT_MAX_DEPTH);
98100
let paths = await SOR.getPathsWithPools(
99101
tokenIn,
100102
tokenOut,
@@ -107,10 +109,7 @@ export class SorService {
107109
);
108110

109111
if (!paths) {
110-
swapOptions = this.buildSwapOptions({
111-
...swapOptions.graphTraversalConfig,
112-
maxNonBoostedPathDepth: swapOptions.graphTraversalConfig.maxNonBoostedPathDepth! + 1,
113-
});
112+
swapOptions = this.buildSwapOptions(DEFAULT_MAX_DEPTH + 1);
114113
paths = await SOR.getPathsWithPools(
115114
tokenIn,
116115
tokenOut,
@@ -140,13 +139,12 @@ export class SorService {
140139
}
141140
}
142141

143-
private buildSwapOptions(graphTraversalConfig?: GraphTraversalConfig): {
142+
private buildSwapOptions(maxNonBoostedPathDepth: number): {
144143
graphTraversalConfig: GraphTraversalConfig;
145144
} {
146145
return {
147146
graphTraversalConfig: {
148-
maxNonBoostedPathDepth: graphTraversalConfig?.maxNonBoostedPathDepth ?? 4,
149-
...graphTraversalConfig,
147+
maxNonBoostedPathDepth,
150148
},
151149
};
152150
}

Diff for: modules/sor/types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export interface GetSwapPathsInput {
1212
protocolVersion: number;
1313
considerPoolsWithHooks: boolean;
1414
poolIds?: string[];
15-
graphTraversalConfig?: GraphTraversalConfig;
1615
callDataInput?: (GqlSwapCallDataInput & { wethIsEth: boolean }) | undefined;
1716
}
1817

0 commit comments

Comments
 (0)