-
Notifications
You must be signed in to change notification settings - Fork 388
/
config.ts
98 lines (96 loc) · 2.77 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import { ChainId } from '@uniswap/sdk-core';
import { AlphaRouterConfig, LowerCaseStringArray } from './alpha-router';
export const DEFAULT_ROUTING_CONFIG_BY_CHAIN = (
chainId: ChainId
): AlphaRouterConfig => {
switch (chainId) {
// Optimism
case ChainId.OPTIMISM:
case ChainId.OPTIMISM_GOERLI:
case ChainId.OPTIMISM_SEPOLIA:
case ChainId.BASE:
case ChainId.BASE_GOERLI:
return {
v2PoolSelection: {
topN: 3,
topNDirectSwaps: 1,
topNTokenInOut: 5,
topNSecondHop: 2,
topNWithEachBaseToken: 2,
topNWithBaseToken: 6,
},
v3PoolSelection: {
topN: 2,
topNDirectSwaps: 2,
topNTokenInOut: 2,
topNSecondHop: 1,
topNWithEachBaseToken: 3,
topNWithBaseToken: 3,
},
maxSwapsPerPath: 3,
minSplits: 1,
maxSplits: 7,
distributionPercent: 10,
forceCrossProtocol: false,
};
// Arbitrum calls have lower gas limits and tend to timeout more, which causes us to reduce the multicall
// batch size and send more multicalls per quote. To reduce the amount of requests each quote sends, we
// have to adjust the routing config so we explore fewer routes.
case ChainId.ARBITRUM_ONE:
case ChainId.ARBITRUM_GOERLI:
case ChainId.CELO:
case ChainId.CELO_ALFAJORES:
return {
v2PoolSelection: {
topN: 3,
topNDirectSwaps: 1,
topNTokenInOut: 5,
topNSecondHop: 2,
topNWithEachBaseToken: 2,
topNWithBaseToken: 6,
},
v3PoolSelection: {
topN: 2,
topNDirectSwaps: 2,
topNTokenInOut: 2,
topNSecondHop: 1,
topNWithEachBaseToken: 3,
topNWithBaseToken: 2,
},
maxSwapsPerPath: 2,
minSplits: 1,
maxSplits: 7,
distributionPercent: 25,
forceCrossProtocol: false,
};
default:
return {
v2PoolSelection: {
topN: 3,
topNDirectSwaps: 1,
topNTokenInOut: 5,
topNSecondHop: 2,
tokensToAvoidOnSecondHops: new LowerCaseStringArray(
'0xd46ba6d942050d489dbd938a2c909a5d5039a161' // AMPL on Mainnet
),
topNWithEachBaseToken: 2,
topNWithBaseToken: 6,
},
v3PoolSelection: {
topN: 2,
topNDirectSwaps: 2,
topNTokenInOut: 3,
topNSecondHop: 1,
topNWithEachBaseToken: 3,
topNWithBaseToken: 5,
},
maxSwapsPerPath: 3,
minSplits: 1,
maxSplits: 7,
distributionPercent: 5,
forceCrossProtocol: false,
};
}
};
export const ETH_GAS_STATION_API_URL =
'https://ethgasstation.info/api/ethgasAPI.json';