-
-
Notifications
You must be signed in to change notification settings - Fork 143
/
uniswap.config.ts
60 lines (59 loc) · 2.03 KB
/
uniswap.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
import { ConfigManagerV2 } from '../../services/config-manager-v2';
import { AvailableNetworks } from '../../services/config-manager-types';
export namespace UniswapConfig {
export interface NetworkConfig {
allowedSlippage: string;
gasLimitEstimate: number;
ttl: number;
maximumHops: number;
uniswapV3SmartOrderRouterAddress: (network: string) => string;
uniswapV3NftManagerAddress: (network: string) => string;
tradingTypes: (type: string) => Array<string>;
chainType: string;
availableNetworks: Array<AvailableNetworks>;
}
export const config: NetworkConfig = {
allowedSlippage: ConfigManagerV2.getInstance().get(
`uniswap.allowedSlippage`
),
gasLimitEstimate: ConfigManagerV2.getInstance().get(
`uniswap.gasLimitEstimate`
),
ttl: ConfigManagerV2.getInstance().get(`uniswap.ttl`),
maximumHops: ConfigManagerV2.getInstance().get(`uniswap.maximumHops`),
uniswapV3SmartOrderRouterAddress: (network: string) =>
ConfigManagerV2.getInstance().get(
`uniswap.contractAddresses.${network}.uniswapV3SmartOrderRouterAddress`
),
uniswapV3NftManagerAddress: (network: string) =>
ConfigManagerV2.getInstance().get(
`uniswap.contractAddresses.${network}.uniswapV3NftManagerAddress`
),
tradingTypes: (type: string) => {
return type === 'swap' ? ['AMM'] : ['AMM_LP'];
},
chainType: 'EVM',
availableNetworks: [
{
chain: 'ethereum',
networks: Object.keys(
ConfigManagerV2.getInstance().get('uniswap.contractAddresses')
).filter((network) =>
Object.keys(
ConfigManagerV2.getInstance().get('ethereum.networks')
).includes(network)
),
},
{
chain: 'polygon',
networks: Object.keys(
ConfigManagerV2.getInstance().get('uniswap.contractAddresses')
).filter((network) =>
Object.keys(
ConfigManagerV2.getInstance().get('polygon.networks')
).includes(network)
),
},
],
};
}