@paraswap/dex-lib 3.9.1 → 3.9.2-bebop.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/config.js +6 -0
- package/build/config.js.map +1 -1
- package/build/dex/bebop/bebop.d.ts +0 -1
- package/build/dex/bebop/bebop.js +16 -14
- package/build/dex/bebop/bebop.js.map +1 -1
- package/build/dex/index.js +2 -0
- package/build/dex/index.js.map +1 -1
- package/build/executor/Executor01BytecodeBuilder.js +3 -2
- package/build/executor/Executor01BytecodeBuilder.js.map +1 -1
- package/build/executor/Executor02BytecodeBuilder.js +3 -2
- package/build/executor/Executor02BytecodeBuilder.js.map +1 -1
- package/build/executor/Executor03BytecodeBuilder.js +3 -2
- package/build/executor/Executor03BytecodeBuilder.js.map +1 -1
- package/build/types.d.ts +1 -0
- package/package.json +4 -2
- package/src/abi/bebop/BebopSettlement.abi.json +2137 -0
- package/src/config.ts +7 -0
- package/src/dex/bebop/bebop-e2e.test.ts +195 -0
- package/src/dex/bebop/bebop-integration.test.ts +170 -0
- package/src/dex/bebop/bebop.ts +840 -0
- package/src/dex/bebop/config.ts +37 -0
- package/src/dex/bebop/constants.ts +15 -0
- package/src/dex/bebop/rate-fetcher.ts +138 -0
- package/src/dex/bebop/types.ts +90 -0
- package/src/dex/bebop/validators.ts +29 -0
- package/src/dex/index.ts +2 -0
- package/src/executor/Executor01BytecodeBuilder.ts +3 -2
- package/src/executor/Executor02BytecodeBuilder.ts +3 -2
- package/src/executor/Executor03BytecodeBuilder.ts +3 -2
- package/src/lib/fetcher/wsFetcher.ts +145 -0
- package/src/types.ts +1 -0
package/src/config.ts
CHANGED
|
@@ -34,6 +34,7 @@ type BaseConfig = {
|
|
|
34
34
|
idleDaoAuthToken?: string;
|
|
35
35
|
swaapV2AuthToken?: string;
|
|
36
36
|
dexalotAuthToken?: string;
|
|
37
|
+
bebopAuthToken?: string;
|
|
37
38
|
forceRpcFallbackDexs: string[];
|
|
38
39
|
};
|
|
39
40
|
|
|
@@ -73,6 +74,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
73
74
|
rpcPollingBlocksBackToTriggerUpdate: 0,
|
|
74
75
|
swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
|
|
75
76
|
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
|
|
77
|
+
bebopAuthToken: process.env.API_KEY_BEBOP_AUTH_TOKEN || '',
|
|
76
78
|
idleDaoAuthToken: process.env.API_KEY_IDLEDAO_AUTH_TOKEN || '',
|
|
77
79
|
hashFlowDisabledMMs:
|
|
78
80
|
process.env[`HASHFLOW_DISABLED_MMS_1`]?.split(',') || [],
|
|
@@ -221,6 +223,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
221
223
|
hashFlowDisabledMMs:
|
|
222
224
|
process.env[`HASHFLOW_DISABLED_MMS_43114`]?.split(',') || [],
|
|
223
225
|
dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
|
|
226
|
+
bebopAuthToken: process.env.API_KEY_BEBOP_AUTH_TOKEN || '',
|
|
224
227
|
augustusV6Address: '0x6a000f20005980200259b80c5102003040001068',
|
|
225
228
|
executorsAddresses: {
|
|
226
229
|
Executor01: '0x000010036C0190E009a000d0fc3541100A07380A',
|
|
@@ -297,6 +300,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
297
300
|
Executor03: '0xe009F00e200A090090fC70e02d70B232000c0802',
|
|
298
301
|
},
|
|
299
302
|
dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
|
|
303
|
+
bebopAuthToken: process.env.API_KEY_BEBOP_AUTH_TOKEN || '',
|
|
300
304
|
adapterAddresses: {
|
|
301
305
|
ArbitrumAdapter01: '0x369A2FDb910d432f0a07381a5E3d27572c876713',
|
|
302
306
|
ArbitrumAdapter02: '0x58a5f0b73969800FAFf8556cD2187E3FCE71A6cb',
|
|
@@ -343,6 +347,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
343
347
|
uniswapV2ExchangeRouterAddress:
|
|
344
348
|
'0xB41dD984730dAf82f5C41489E21ac79D5e3B61bC',
|
|
345
349
|
uniswapV3EventLoggingSampleRate: 0,
|
|
350
|
+
bebopAuthToken: process.env.API_KEY_BEBOP_AUTH_TOKEN || '',
|
|
346
351
|
rfqConfigs: {},
|
|
347
352
|
rpcPollingMaxAllowedStateDelayInBlocks: 5,
|
|
348
353
|
rpcPollingBlocksBackToTriggerUpdate: 3,
|
|
@@ -397,6 +402,7 @@ const baseConfigs: { [network: number]: BaseConfig } = {
|
|
|
397
402
|
multicallV2Address: '0xeDF6D2a16e8081F777eB623EeB4411466556aF3d',
|
|
398
403
|
privateHttpProvider: process.env.HTTP_PROVIDER_8453,
|
|
399
404
|
dexalotAuthToken: process.env.API_KEY_DEXALOT_AUTH_TOKEN || '',
|
|
405
|
+
bebopAuthToken: process.env.API_KEY_BEBOP_AUTH_TOKEN || '',
|
|
400
406
|
hashFlowAuthToken: process.env.API_KEY_HASHFLOW_AUTH_TOKEN || '',
|
|
401
407
|
swaapV2AuthToken: process.env.API_KEY_SWAAP_V2_AUTH_TOKEN || '',
|
|
402
408
|
hashFlowDisabledMMs: [],
|
|
@@ -464,6 +470,7 @@ export function generateConfig(network: number): Config {
|
|
|
464
470
|
idleDaoAuthToken: baseConfig.idleDaoAuthToken,
|
|
465
471
|
swaapV2AuthToken: baseConfig.swaapV2AuthToken,
|
|
466
472
|
dexalotAuthToken: baseConfig.dexalotAuthToken,
|
|
473
|
+
bebopAuthToken: baseConfig.bebopAuthToken,
|
|
467
474
|
hashFlowDisabledMMs: baseConfig.hashFlowDisabledMMs,
|
|
468
475
|
forceRpcFallbackDexs: baseConfig.forceRpcFallbackDexs,
|
|
469
476
|
apiKeyTheGraph: process.env.API_KEY_THE_GRAPH || '',
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
5
|
+
import { testE2E } from '../../../tests/utils-e2e';
|
|
6
|
+
import {
|
|
7
|
+
Tokens,
|
|
8
|
+
Holders,
|
|
9
|
+
NativeTokenSymbols,
|
|
10
|
+
} from '../../../tests/constants-e2e';
|
|
11
|
+
import { Network, ContractMethod, SwapSide } from '../../constants';
|
|
12
|
+
import { StaticJsonRpcProvider } from '@ethersproject/providers';
|
|
13
|
+
import { generateConfig } from '../../config';
|
|
14
|
+
|
|
15
|
+
function testForNetwork(
|
|
16
|
+
network: Network,
|
|
17
|
+
dexKey: string,
|
|
18
|
+
tokenASymbol: string,
|
|
19
|
+
tokenBSymbol: string,
|
|
20
|
+
tokenAAmount: string,
|
|
21
|
+
tokenBAmount: string,
|
|
22
|
+
nativeTokenAmount: string,
|
|
23
|
+
) {
|
|
24
|
+
const provider = new StaticJsonRpcProvider(
|
|
25
|
+
generateConfig(network).privateHttpProvider,
|
|
26
|
+
network,
|
|
27
|
+
);
|
|
28
|
+
const tokens = Tokens[network];
|
|
29
|
+
const holders = Holders[network];
|
|
30
|
+
const nativeTokenSymbol = NativeTokenSymbols[network];
|
|
31
|
+
|
|
32
|
+
const sideToContractMethods = new Map([
|
|
33
|
+
[SwapSide.SELL, [ContractMethod.swapExactAmountIn]],
|
|
34
|
+
[SwapSide.BUY, [ContractMethod.swapExactAmountOut]],
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
describe(`${network}`, () => {
|
|
38
|
+
sideToContractMethods.forEach((contractMethods, side) =>
|
|
39
|
+
describe(`${side}`, () => {
|
|
40
|
+
contractMethods.forEach((contractMethod: ContractMethod) => {
|
|
41
|
+
describe(`${contractMethod}`, () => {
|
|
42
|
+
it(`${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
|
|
43
|
+
await testE2E(
|
|
44
|
+
tokens[nativeTokenSymbol],
|
|
45
|
+
tokens[tokenASymbol],
|
|
46
|
+
holders[nativeTokenSymbol],
|
|
47
|
+
side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
|
|
48
|
+
side,
|
|
49
|
+
dexKey,
|
|
50
|
+
contractMethod,
|
|
51
|
+
network,
|
|
52
|
+
provider,
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
it(`${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
|
|
56
|
+
await testE2E(
|
|
57
|
+
tokens[tokenASymbol],
|
|
58
|
+
tokens[nativeTokenSymbol],
|
|
59
|
+
holders[tokenASymbol],
|
|
60
|
+
side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
|
|
61
|
+
side,
|
|
62
|
+
dexKey,
|
|
63
|
+
contractMethod,
|
|
64
|
+
network,
|
|
65
|
+
provider,
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
it(`${tokenASymbol} -> ${tokenBSymbol}`, async () => {
|
|
69
|
+
await testE2E(
|
|
70
|
+
tokens[tokenASymbol],
|
|
71
|
+
tokens[tokenBSymbol],
|
|
72
|
+
holders[tokenASymbol],
|
|
73
|
+
side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
|
|
74
|
+
side,
|
|
75
|
+
dexKey,
|
|
76
|
+
contractMethod,
|
|
77
|
+
network,
|
|
78
|
+
provider,
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}),
|
|
84
|
+
);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
describe('Bebop E2E', () => {
|
|
89
|
+
const dexKey = 'Bebop';
|
|
90
|
+
|
|
91
|
+
describe('Mainnetx', () => {
|
|
92
|
+
const network = Network.MAINNET;
|
|
93
|
+
|
|
94
|
+
const tokenASymbol: string = 'USDC';
|
|
95
|
+
const tokenBSymbol: string = 'WETH';
|
|
96
|
+
|
|
97
|
+
const tokenAAmount: string = '1000000000';
|
|
98
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
99
|
+
const nativeTokenAmount = '1000000000000000000';
|
|
100
|
+
|
|
101
|
+
testForNetwork(
|
|
102
|
+
network,
|
|
103
|
+
dexKey,
|
|
104
|
+
tokenASymbol,
|
|
105
|
+
tokenBSymbol,
|
|
106
|
+
tokenAAmount,
|
|
107
|
+
tokenBAmount,
|
|
108
|
+
nativeTokenAmount,
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
describe('Mainnet Alt Pair', () => {
|
|
113
|
+
const network = Network.MAINNET;
|
|
114
|
+
|
|
115
|
+
const tokenASymbol: string = 'WBTC';
|
|
116
|
+
const tokenBSymbol: string = 'WETH';
|
|
117
|
+
|
|
118
|
+
const tokenAAmount: string = '10000000';
|
|
119
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
120
|
+
const nativeTokenAmount = '1000000000000000000';
|
|
121
|
+
|
|
122
|
+
testForNetwork(
|
|
123
|
+
network,
|
|
124
|
+
dexKey,
|
|
125
|
+
tokenASymbol,
|
|
126
|
+
tokenBSymbol,
|
|
127
|
+
tokenAAmount,
|
|
128
|
+
tokenBAmount,
|
|
129
|
+
nativeTokenAmount,
|
|
130
|
+
);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('Arbitrum', () => {
|
|
134
|
+
const network = Network.ARBITRUM;
|
|
135
|
+
|
|
136
|
+
const tokenASymbol: string = 'USDC';
|
|
137
|
+
const tokenBSymbol: string = 'WETH';
|
|
138
|
+
|
|
139
|
+
const tokenAAmount: string = '1000000000';
|
|
140
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
141
|
+
const nativeTokenAmount = '1000000000000000000';
|
|
142
|
+
|
|
143
|
+
testForNetwork(
|
|
144
|
+
network,
|
|
145
|
+
dexKey,
|
|
146
|
+
tokenASymbol,
|
|
147
|
+
tokenBSymbol,
|
|
148
|
+
tokenAAmount,
|
|
149
|
+
tokenBAmount,
|
|
150
|
+
nativeTokenAmount,
|
|
151
|
+
);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
describe('Base', () => {
|
|
155
|
+
const network = Network.BASE;
|
|
156
|
+
|
|
157
|
+
const tokenASymbol: string = 'USDbC';
|
|
158
|
+
const tokenBSymbol: string = 'WETH';
|
|
159
|
+
|
|
160
|
+
const tokenAAmount: string = '1000000000';
|
|
161
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
162
|
+
const nativeTokenAmount = '1000000000000000000';
|
|
163
|
+
|
|
164
|
+
testForNetwork(
|
|
165
|
+
network,
|
|
166
|
+
dexKey,
|
|
167
|
+
tokenASymbol,
|
|
168
|
+
tokenBSymbol,
|
|
169
|
+
tokenAAmount,
|
|
170
|
+
tokenBAmount,
|
|
171
|
+
nativeTokenAmount,
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
describe('Optimism', () => {
|
|
176
|
+
const network = Network.OPTIMISM;
|
|
177
|
+
|
|
178
|
+
const tokenASymbol: string = 'USDT';
|
|
179
|
+
const tokenBSymbol: string = 'WETH';
|
|
180
|
+
|
|
181
|
+
const tokenAAmount: string = '1000000000';
|
|
182
|
+
const tokenBAmount: string = '1000000000000000000';
|
|
183
|
+
const nativeTokenAmount = '1000000000000000000';
|
|
184
|
+
|
|
185
|
+
testForNetwork(
|
|
186
|
+
network,
|
|
187
|
+
dexKey,
|
|
188
|
+
tokenASymbol,
|
|
189
|
+
tokenBSymbol,
|
|
190
|
+
tokenAAmount,
|
|
191
|
+
tokenBAmount,
|
|
192
|
+
nativeTokenAmount,
|
|
193
|
+
);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import dotenv from 'dotenv';
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
5
|
+
import { Interface, Result } from '@ethersproject/abi';
|
|
6
|
+
import { DummyDexHelper } from '../../dex-helper/index';
|
|
7
|
+
import { Network, SwapSide } from '../../constants';
|
|
8
|
+
import { BI_POWS } from '../../bigint-constants';
|
|
9
|
+
import { Bebop } from './bebop';
|
|
10
|
+
import {
|
|
11
|
+
checkPoolPrices,
|
|
12
|
+
checkPoolsLiquidity,
|
|
13
|
+
checkConstantPoolPrices,
|
|
14
|
+
} from '../../../tests/utils';
|
|
15
|
+
import { Tokens } from '../../../tests/constants-e2e';
|
|
16
|
+
|
|
17
|
+
async function testPricingOnNetwork(
|
|
18
|
+
bebop: Bebop,
|
|
19
|
+
network: Network,
|
|
20
|
+
dexKey: string,
|
|
21
|
+
blockNumber: number,
|
|
22
|
+
srcTokenSymbol: string,
|
|
23
|
+
destTokenSymbol: string,
|
|
24
|
+
side: SwapSide,
|
|
25
|
+
amounts: bigint[],
|
|
26
|
+
) {
|
|
27
|
+
const networkTokens = Tokens[network];
|
|
28
|
+
|
|
29
|
+
const pools = await bebop.getPoolIdentifiers(
|
|
30
|
+
networkTokens[srcTokenSymbol],
|
|
31
|
+
networkTokens[destTokenSymbol],
|
|
32
|
+
side,
|
|
33
|
+
blockNumber,
|
|
34
|
+
);
|
|
35
|
+
console.log(
|
|
36
|
+
`${srcTokenSymbol} <> ${destTokenSymbol} Pool Identifiers: `,
|
|
37
|
+
pools,
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
expect(pools.length).toBeGreaterThan(0);
|
|
41
|
+
|
|
42
|
+
const poolPrices = await bebop.getPricesVolume(
|
|
43
|
+
networkTokens[srcTokenSymbol],
|
|
44
|
+
networkTokens[destTokenSymbol],
|
|
45
|
+
amounts,
|
|
46
|
+
side,
|
|
47
|
+
blockNumber,
|
|
48
|
+
pools,
|
|
49
|
+
);
|
|
50
|
+
console.log(
|
|
51
|
+
`${srcTokenSymbol} <> ${destTokenSymbol} Pool Prices: `,
|
|
52
|
+
poolPrices,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
expect(poolPrices).not.toBeNull();
|
|
56
|
+
if (bebop.hasConstantPriceLargeAmounts) {
|
|
57
|
+
checkConstantPoolPrices(poolPrices!, amounts, dexKey);
|
|
58
|
+
} else {
|
|
59
|
+
checkPoolPrices(poolPrices!, amounts, side, dexKey, false);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
describe('Bebop', function () {
|
|
64
|
+
const dexKey = 'Bebop';
|
|
65
|
+
let blockNumber: number;
|
|
66
|
+
let bebop: Bebop;
|
|
67
|
+
|
|
68
|
+
describe('Mainnet', () => {
|
|
69
|
+
const network = Network.MAINNET;
|
|
70
|
+
const dexHelper = new DummyDexHelper(network);
|
|
71
|
+
|
|
72
|
+
const tokens = Tokens[network];
|
|
73
|
+
|
|
74
|
+
const srcTokenSymbol = 'ETH';
|
|
75
|
+
const destTokenSymbol = 'USDC';
|
|
76
|
+
|
|
77
|
+
const amountsForSell = [
|
|
78
|
+
0n,
|
|
79
|
+
1n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
80
|
+
2n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
81
|
+
3n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
82
|
+
4n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
83
|
+
5n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
84
|
+
6n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
85
|
+
7n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
86
|
+
8n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
87
|
+
9n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
88
|
+
10n * BI_POWS[tokens[srcTokenSymbol].decimals],
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
const amountsForBuy = [
|
|
92
|
+
0n,
|
|
93
|
+
1000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
94
|
+
2000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
95
|
+
3000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
96
|
+
4000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
97
|
+
5000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
98
|
+
6000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
99
|
+
7000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
100
|
+
8000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
101
|
+
9000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
102
|
+
10000n * BI_POWS[tokens[destTokenSymbol].decimals],
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
beforeAll(async () => {
|
|
106
|
+
blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
|
|
107
|
+
bebop = new Bebop(network, dexKey, dexHelper);
|
|
108
|
+
if (bebop.initializePricing) {
|
|
109
|
+
await bebop.initializePricing(blockNumber);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
afterAll(async () => {
|
|
114
|
+
if (bebop.releaseResources) {
|
|
115
|
+
await bebop.releaseResources();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('getPoolIdentifiers and getPricesVolume SELL', async function () {
|
|
120
|
+
await testPricingOnNetwork(
|
|
121
|
+
bebop,
|
|
122
|
+
network,
|
|
123
|
+
dexKey,
|
|
124
|
+
blockNumber,
|
|
125
|
+
srcTokenSymbol,
|
|
126
|
+
destTokenSymbol,
|
|
127
|
+
SwapSide.SELL,
|
|
128
|
+
amountsForSell,
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('getPoolIdentifiers and getPricesVolume BUY', async function () {
|
|
133
|
+
await testPricingOnNetwork(
|
|
134
|
+
bebop,
|
|
135
|
+
network,
|
|
136
|
+
dexKey,
|
|
137
|
+
blockNumber,
|
|
138
|
+
srcTokenSymbol,
|
|
139
|
+
destTokenSymbol,
|
|
140
|
+
SwapSide.BUY,
|
|
141
|
+
amountsForBuy,
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('getTopPoolsForToken', async function () {
|
|
146
|
+
// We have to check without calling initializePricing, because
|
|
147
|
+
// pool-tracker is not calling that function
|
|
148
|
+
const newBebop = new Bebop(network, dexKey, dexHelper);
|
|
149
|
+
if (newBebop.updatePoolState) {
|
|
150
|
+
await newBebop.updatePoolState();
|
|
151
|
+
}
|
|
152
|
+
const poolLiquidity = await newBebop.getTopPoolsForToken(
|
|
153
|
+
tokens[srcTokenSymbol].address,
|
|
154
|
+
10,
|
|
155
|
+
);
|
|
156
|
+
console.log(
|
|
157
|
+
`${srcTokenSymbol} Top Pools:`,
|
|
158
|
+
JSON.stringify(poolLiquidity, null, 2),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
if (!newBebop.hasConstantPriceLargeAmounts) {
|
|
162
|
+
checkPoolsLiquidity(
|
|
163
|
+
poolLiquidity,
|
|
164
|
+
Tokens[network][srcTokenSymbol].address,
|
|
165
|
+
dexKey,
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|