@paraswap/dex-lib 2.42.3 → 2.42.4-baseswap

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.
Files changed (99) hide show
  1. package/build/dex/balancer-v1/balancer-v1.js +21 -10
  2. package/build/dex/balancer-v1/balancer-v1.js.map +1 -1
  3. package/build/dex/balancer-v1/config.d.ts +2 -1
  4. package/build/dex/balancer-v1/config.js +3 -2
  5. package/build/dex/balancer-v1/config.js.map +1 -1
  6. package/build/dex/baseswap-v3/baseswap-v3-factory.d.ts +26 -0
  7. package/build/dex/baseswap-v3/baseswap-v3-factory.js +44 -0
  8. package/build/dex/baseswap-v3/baseswap-v3-factory.js.map +1 -0
  9. package/build/dex/baseswap-v3/baseswap-v3-pool.d.ts +46 -0
  10. package/build/dex/baseswap-v3/baseswap-v3-pool.js +312 -0
  11. package/build/dex/baseswap-v3/baseswap-v3-pool.js.map +1 -0
  12. package/build/dex/baseswap-v3/baseswap-v3.d.ts +71 -0
  13. package/build/dex/baseswap-v3/baseswap-v3.js +752 -0
  14. package/build/dex/baseswap-v3/baseswap-v3.js.map +1 -0
  15. package/build/dex/baseswap-v3/config.d.ts +9 -0
  16. package/build/dex/baseswap-v3/config.js +48 -0
  17. package/build/dex/baseswap-v3/config.js.map +1 -0
  18. package/build/dex/baseswap-v3/constants.d.ts +28 -0
  19. package/build/dex/baseswap-v3/constants.js +35 -0
  20. package/build/dex/baseswap-v3/constants.js.map +1 -0
  21. package/build/dex/baseswap-v3/contract-math/BitMath.d.ts +4 -0
  22. package/build/dex/baseswap-v3/contract-math/BitMath.js +93 -0
  23. package/build/dex/baseswap-v3/contract-math/BitMath.js.map +1 -0
  24. package/build/dex/baseswap-v3/contract-math/FixedPoint128.d.ts +3 -0
  25. package/build/dex/baseswap-v3/contract-math/FixedPoint128.js +8 -0
  26. package/build/dex/baseswap-v3/contract-math/FixedPoint128.js.map +1 -0
  27. package/build/dex/baseswap-v3/contract-math/FixedPoint96.d.ts +4 -0
  28. package/build/dex/baseswap-v3/contract-math/FixedPoint96.js +9 -0
  29. package/build/dex/baseswap-v3/contract-math/FixedPoint96.js.map +1 -0
  30. package/build/dex/baseswap-v3/contract-math/FullMath.d.ts +4 -0
  31. package/build/dex/baseswap-v3/contract-math/FullMath.js +19 -0
  32. package/build/dex/baseswap-v3/contract-math/FullMath.js.map +1 -0
  33. package/build/dex/baseswap-v3/contract-math/LiquidityMath.d.ts +3 -0
  34. package/build/dex/baseswap-v3/contract-math/LiquidityMath.js +22 -0
  35. package/build/dex/baseswap-v3/contract-math/LiquidityMath.js.map +1 -0
  36. package/build/dex/baseswap-v3/contract-math/Oracle.d.ts +10 -0
  37. package/build/dex/baseswap-v3/contract-math/Oracle.js +133 -0
  38. package/build/dex/baseswap-v3/contract-math/Oracle.js.map +1 -0
  39. package/build/dex/baseswap-v3/contract-math/SqrtPriceMath.d.ts +10 -0
  40. package/build/dex/baseswap-v3/contract-math/SqrtPriceMath.js +91 -0
  41. package/build/dex/baseswap-v3/contract-math/SqrtPriceMath.js.map +1 -0
  42. package/build/dex/baseswap-v3/contract-math/SwapMath.d.ts +8 -0
  43. package/build/dex/baseswap-v3/contract-math/SwapMath.js +70 -0
  44. package/build/dex/baseswap-v3/contract-math/SwapMath.js.map +1 -0
  45. package/build/dex/baseswap-v3/contract-math/Tick.d.ts +7 -0
  46. package/build/dex/baseswap-v3/contract-math/Tick.js +45 -0
  47. package/build/dex/baseswap-v3/contract-math/Tick.js.map +1 -0
  48. package/build/dex/baseswap-v3/contract-math/TickBitMap.d.ts +7 -0
  49. package/build/dex/baseswap-v3/contract-math/TickBitMap.js +84 -0
  50. package/build/dex/baseswap-v3/contract-math/TickBitMap.js.map +1 -0
  51. package/build/dex/baseswap-v3/contract-math/TickMath.d.ts +8 -0
  52. package/build/dex/baseswap-v3/contract-math/TickMath.js +162 -0
  53. package/build/dex/baseswap-v3/contract-math/TickMath.js.map +1 -0
  54. package/build/dex/baseswap-v3/contract-math/UnsafeMath.d.ts +3 -0
  55. package/build/dex/baseswap-v3/contract-math/UnsafeMath.js +10 -0
  56. package/build/dex/baseswap-v3/contract-math/UnsafeMath.js.map +1 -0
  57. package/build/dex/baseswap-v3/contract-math/uniswap-v3-math.d.ts +37 -0
  58. package/build/dex/baseswap-v3/contract-math/uniswap-v3-math.js +393 -0
  59. package/build/dex/baseswap-v3/contract-math/uniswap-v3-math.js.map +1 -0
  60. package/build/dex/baseswap-v3/contract-math/utils.d.ts +7 -0
  61. package/build/dex/baseswap-v3/contract-math/utils.js +42 -0
  62. package/build/dex/baseswap-v3/contract-math/utils.js.map +1 -0
  63. package/build/dex/baseswap-v3/types.d.ts +164 -0
  64. package/build/dex/baseswap-v3/types.js +9 -0
  65. package/build/dex/baseswap-v3/types.js.map +1 -0
  66. package/build/dex/baseswap-v3/utils.d.ts +6 -0
  67. package/build/dex/baseswap-v3/utils.js +65 -0
  68. package/build/dex/baseswap-v3/utils.js.map +1 -0
  69. package/build/dex/index.js +2 -0
  70. package/build/dex/index.js.map +1 -1
  71. package/package.json +1 -1
  72. package/src/dex/balancer-v1/balancer-v1.ts +32 -13
  73. package/src/dex/balancer-v1/config.ts +2 -1
  74. package/src/dex/baseswap-v3/baseswap-v3-e2e.test.ts +129 -0
  75. package/src/dex/baseswap-v3/baseswap-v3-events.test.ts +141 -0
  76. package/src/dex/baseswap-v3/baseswap-v3-factory.ts +73 -0
  77. package/src/dex/baseswap-v3/baseswap-v3-integration.test.ts +472 -0
  78. package/src/dex/baseswap-v3/baseswap-v3-pool.ts +519 -0
  79. package/src/dex/baseswap-v3/baseswap-v3.ts +1243 -0
  80. package/src/dex/baseswap-v3/config.ts +53 -0
  81. package/src/dex/baseswap-v3/constants.ts +41 -0
  82. package/src/dex/baseswap-v3/contract-math/BitMath.ts +90 -0
  83. package/src/dex/baseswap-v3/contract-math/FixedPoint128.ts +3 -0
  84. package/src/dex/baseswap-v3/contract-math/FixedPoint96.ts +4 -0
  85. package/src/dex/baseswap-v3/contract-math/FullMath.ts +30 -0
  86. package/src/dex/baseswap-v3/contract-math/LiquidityMath.ts +17 -0
  87. package/src/dex/baseswap-v3/contract-math/Oracle.ts +226 -0
  88. package/src/dex/baseswap-v3/contract-math/SqrtPriceMath.ts +226 -0
  89. package/src/dex/baseswap-v3/contract-math/SwapMath.ts +139 -0
  90. package/src/dex/baseswap-v3/contract-math/Tick.ts +82 -0
  91. package/src/dex/baseswap-v3/contract-math/TickBitMap.ts +123 -0
  92. package/src/dex/baseswap-v3/contract-math/TickMath.ts +211 -0
  93. package/src/dex/baseswap-v3/contract-math/UnsafeMath.ts +5 -0
  94. package/src/dex/baseswap-v3/contract-math/uniswap-v3-math.ts +666 -0
  95. package/src/dex/baseswap-v3/contract-math/utils.ts +55 -0
  96. package/src/dex/baseswap-v3/types.ts +191 -0
  97. package/src/dex/baseswap-v3/utils.ts +83 -0
  98. package/src/dex/index.ts +2 -0
  99. package/tests/constants-e2e.ts +1 -1
@@ -0,0 +1,472 @@
1
+ /* eslint-disable no-console */
2
+ import dotenv from 'dotenv';
3
+ dotenv.config();
4
+
5
+ import { Interface, Result } from '@ethersproject/abi';
6
+ import { DummyDexHelper, IDexHelper } from '../../dex-helper/index';
7
+ import { Network, SwapSide } from '../../constants';
8
+ import { BI_POWS } from '../../bigint-constants';
9
+ import { BaseswapV3 } from './baseswap-v3';
10
+ import { checkPoolPrices, checkPoolsLiquidity } from '../../../tests/utils';
11
+ import { Tokens } from '../../../tests/constants-e2e';
12
+ import UniswapV3QuoterV2ABI from '../../abi/uniswap-v3/UniswapV3QuoterV2.abi.json';
13
+ import { Address } from '@paraswap/core';
14
+
15
+ const network = Network.BASE;
16
+ const TokenASymbol = 'USDC';
17
+ const TokenA = Tokens[network][TokenASymbol];
18
+
19
+ const QuoterV2 = '0x4fDBD73aD4B1DDde594BF05497C15f76308eFfb9';
20
+
21
+ const TokenBSymbol = 'WETH';
22
+ const TokenB = Tokens[network][TokenBSymbol];
23
+
24
+ const amounts = [
25
+ 0n,
26
+ 10_000n * BI_POWS[6],
27
+ 20_000n * BI_POWS[6],
28
+ 30_000n * BI_POWS[6],
29
+ ];
30
+
31
+ const amountsBuy = [0n, 1n * BI_POWS[18], 2n * BI_POWS[18], 3n * BI_POWS[18]];
32
+
33
+ const quoterIface = new Interface(UniswapV3QuoterV2ABI);
34
+
35
+ function getReaderCalldata(
36
+ exchangeAddress: string,
37
+ readerIface: Interface,
38
+ amounts: bigint[],
39
+ funcName: string,
40
+ tokenIn: Address,
41
+ tokenOut: Address,
42
+ fee: bigint,
43
+ ) {
44
+ return amounts.map(amount => ({
45
+ target: exchangeAddress,
46
+ callData: readerIface.encodeFunctionData(funcName, [
47
+ [tokenIn, tokenOut, amount.toString(), fee.toString(), 0],
48
+ ]),
49
+ }));
50
+ }
51
+
52
+ function decodeReaderResult(
53
+ results: Result,
54
+ readerIface: Interface,
55
+ funcName: string,
56
+ ) {
57
+ return results.map(result => {
58
+ const parsed = readerIface.decodeFunctionResult(funcName, result);
59
+ return BigInt(parsed[0]._hex);
60
+ });
61
+ }
62
+
63
+ async function checkOnChainPricing(
64
+ dexHelper: IDexHelper,
65
+ funcName: string,
66
+ blockNumber: number,
67
+ exchangeAddress: string,
68
+ prices: bigint[],
69
+ tokenIn: Address,
70
+ tokenOut: Address,
71
+ fee: bigint,
72
+ _amounts: bigint[],
73
+ ) {
74
+ // const exchangeAddress = '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6';
75
+ const readerIface = quoterIface;
76
+
77
+ const sum = prices.reduce((acc, curr) => (acc += curr), 0n);
78
+
79
+ if (sum === 0n) {
80
+ console.log(
81
+ `Prices were not calculated for tokenIn=${tokenIn}, tokenOut=${tokenOut}, fee=${fee.toString()}. Most likely price impact is too big for requested amount`,
82
+ );
83
+ return false;
84
+ }
85
+
86
+ const readerCallData = getReaderCalldata(
87
+ exchangeAddress,
88
+ readerIface,
89
+ _amounts.slice(1),
90
+ funcName,
91
+ tokenIn,
92
+ tokenOut,
93
+ fee,
94
+ );
95
+
96
+ let readerResult;
97
+ try {
98
+ readerResult = (
99
+ await dexHelper.multiContract.methods
100
+ .aggregate(readerCallData)
101
+ .call({}, blockNumber)
102
+ ).returnData;
103
+ } catch (e) {
104
+ console.log(
105
+ `Can not fetch on-chain pricing for fee ${fee}. It happens for low liquidity pools`,
106
+ e,
107
+ );
108
+ return false;
109
+ }
110
+
111
+ const expectedPrices = [0n].concat(
112
+ decodeReaderResult(readerResult, readerIface, funcName),
113
+ );
114
+
115
+ console.log('EXPECTED PRICES: ', expectedPrices);
116
+
117
+ let firstZeroIndex = prices.slice(1).indexOf(0n);
118
+
119
+ // we skipped first, so add +1 on result
120
+ firstZeroIndex = firstZeroIndex === -1 ? prices.length : firstZeroIndex;
121
+
122
+ // Compare only the ones for which we were able to calculate prices
123
+ expect(prices.slice(0, firstZeroIndex)).toEqual(
124
+ expectedPrices.slice(0, firstZeroIndex),
125
+ );
126
+ return true;
127
+ }
128
+
129
+ describe('BaseswapV3', function () {
130
+ const dexHelper = new DummyDexHelper(network);
131
+ const dexKey = 'BaseswapV3';
132
+
133
+ let blockNumber: number;
134
+ let baseswapV3: BaseswapV3;
135
+ let baseswapV3Mainnet: BaseswapV3;
136
+
137
+ beforeEach(async () => {
138
+ blockNumber = await dexHelper.web3Provider.eth.getBlockNumber();
139
+ baseswapV3 = new BaseswapV3(network, dexKey, dexHelper);
140
+ baseswapV3Mainnet = new BaseswapV3(
141
+ Network.BASE,
142
+ dexKey,
143
+ new DummyDexHelper(Network.BASE),
144
+ );
145
+ });
146
+
147
+ it('getPoolIdentifiers and getPricesVolume SELL', async function () {
148
+ const pools = await baseswapV3.getPoolIdentifiers(
149
+ TokenA,
150
+ TokenB,
151
+ SwapSide.SELL,
152
+ blockNumber,
153
+ );
154
+ console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `, pools);
155
+
156
+ expect(pools.length).toBeGreaterThan(0);
157
+
158
+ const poolPrices = await baseswapV3.getPricesVolume(
159
+ TokenA,
160
+ TokenB,
161
+ amounts,
162
+ SwapSide.SELL,
163
+ blockNumber,
164
+ pools,
165
+ );
166
+ console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `, poolPrices);
167
+
168
+ expect(poolPrices).not.toBeNull();
169
+ checkPoolPrices(poolPrices!, amounts, SwapSide.SELL, dexKey);
170
+
171
+ let falseChecksCounter = 0;
172
+ await Promise.all(
173
+ poolPrices!.map(async price => {
174
+ const fee = baseswapV3.eventPools[price.poolIdentifier!]!.feeCode;
175
+ const res = await checkOnChainPricing(
176
+ dexHelper,
177
+ 'quoteExactInputSingle',
178
+ blockNumber,
179
+ QuoterV2,
180
+ price.prices,
181
+ TokenA.address,
182
+ TokenB.address,
183
+ fee,
184
+ amounts,
185
+ );
186
+ if (res === false) falseChecksCounter++;
187
+ }),
188
+ );
189
+
190
+ expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
191
+ });
192
+
193
+ it('getPoolIdentifiers and getPricesVolume BUY', async function () {
194
+ const pools = await baseswapV3.getPoolIdentifiers(
195
+ TokenA,
196
+ TokenB,
197
+ SwapSide.BUY,
198
+ blockNumber,
199
+ );
200
+ console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `, pools);
201
+
202
+ expect(pools.length).toBeGreaterThan(0);
203
+
204
+ const poolPrices = await baseswapV3.getPricesVolume(
205
+ TokenA,
206
+ TokenB,
207
+ amountsBuy,
208
+ SwapSide.BUY,
209
+ blockNumber,
210
+ pools,
211
+ );
212
+ console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `, poolPrices);
213
+
214
+ expect(poolPrices).not.toBeNull();
215
+ checkPoolPrices(poolPrices!, amountsBuy, SwapSide.BUY, dexKey);
216
+
217
+ // Check if onchain pricing equals to calculated ones
218
+ let falseChecksCounter = 0;
219
+ await Promise.all(
220
+ poolPrices!.map(async price => {
221
+ const fee = baseswapV3.eventPools[price.poolIdentifier!]!.feeCode;
222
+ const res = await checkOnChainPricing(
223
+ dexHelper,
224
+ 'quoteExactOutputSingle',
225
+ blockNumber,
226
+ QuoterV2,
227
+ price.prices,
228
+ TokenA.address,
229
+ TokenB.address,
230
+ fee,
231
+ amountsBuy,
232
+ );
233
+ if (res === false) falseChecksCounter++;
234
+ }),
235
+ );
236
+ expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
237
+ });
238
+
239
+ it('getPoolIdentifiers and getPricesVolume SELL stable pairs', async function () {
240
+ const TokenASymbol = 'USDbC';
241
+ const TokenA = Tokens[network][TokenASymbol];
242
+
243
+ const TokenBSymbol = 'USDC';
244
+ const TokenB = Tokens[network][TokenBSymbol];
245
+
246
+ const amounts = [
247
+ 0n,
248
+ 6000000n,
249
+ 12000000n,
250
+ 18000000n,
251
+ 24000000n,
252
+ 30000000n,
253
+ 36000000n,
254
+ 42000000n,
255
+ 48000000n,
256
+ 54000000n,
257
+ 60000000n,
258
+ 66000000n,
259
+ 72000000n,
260
+ 78000000n,
261
+ 84000000n,
262
+ 90000000n,
263
+ 96000000n,
264
+ 102000000n,
265
+ 108000000n,
266
+ 114000000n,
267
+ 120000000n,
268
+ 126000000n,
269
+ 132000000n,
270
+ 138000000n,
271
+ 144000000n,
272
+ 150000000n,
273
+ 156000000n,
274
+ 162000000n,
275
+ 168000000n,
276
+ 174000000n,
277
+ 180000000n,
278
+ 186000000n,
279
+ 192000000n,
280
+ 198000000n,
281
+ 204000000n,
282
+ 210000000n,
283
+ 216000000n,
284
+ 222000000n,
285
+ 228000000n,
286
+ 234000000n,
287
+ 240000000n,
288
+ 246000000n,
289
+ 252000000n,
290
+ 258000000n,
291
+ 264000000n,
292
+ 270000000n,
293
+ 276000000n,
294
+ 282000000n,
295
+ 288000000n,
296
+ 294000000n,
297
+ 300000000n,
298
+ ];
299
+
300
+ const pools = await baseswapV3.getPoolIdentifiers(
301
+ TokenA,
302
+ TokenB,
303
+ SwapSide.SELL,
304
+ blockNumber,
305
+ );
306
+ console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `, pools);
307
+
308
+ expect(pools.length).toBeGreaterThan(0);
309
+
310
+ const poolPrices = await baseswapV3.getPricesVolume(
311
+ TokenA,
312
+ TokenB,
313
+ amounts,
314
+ SwapSide.SELL,
315
+ blockNumber,
316
+ pools,
317
+ );
318
+ console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `, poolPrices);
319
+
320
+ expect(poolPrices).not.toBeNull();
321
+ checkPoolPrices(
322
+ poolPrices!.filter(pp => pp.unit !== 0n),
323
+ amounts,
324
+ SwapSide.SELL,
325
+ dexKey,
326
+ );
327
+
328
+ // Check if onchain pricing equals to calculated ones
329
+ let falseChecksCounter = 0;
330
+ await Promise.all(
331
+ poolPrices!.map(async price => {
332
+ const fee = baseswapV3.eventPools[price.poolIdentifier!]!.feeCode;
333
+ const res = await checkOnChainPricing(
334
+ dexHelper,
335
+ 'quoteExactInputSingle',
336
+ blockNumber,
337
+ QuoterV2,
338
+ price.prices,
339
+ TokenA.address,
340
+ TokenB.address,
341
+ fee,
342
+ amounts,
343
+ );
344
+ if (res === false) falseChecksCounter++;
345
+ }),
346
+ );
347
+ expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
348
+ });
349
+
350
+ it('getPoolIdentifiers and getPricesVolume BUY stable pairs', async function () {
351
+ const TokenASymbol = 'DAI';
352
+ const TokenA = Tokens[network][TokenASymbol];
353
+
354
+ const TokenBSymbol = 'USDC';
355
+ const TokenB = Tokens[network][TokenBSymbol];
356
+
357
+ const amountsBuy = [
358
+ 0n,
359
+ 6000000n,
360
+ 12000000n,
361
+ 18000000n,
362
+ 24000000n,
363
+ 30000000n,
364
+ 36000000n,
365
+ 42000000n,
366
+ 48000000n,
367
+ 54000000n,
368
+ 60000000n,
369
+ 66000000n,
370
+ 72000000n,
371
+ 78000000n,
372
+ 84000000n,
373
+ 90000000n,
374
+ 96000000n,
375
+ 102000000n,
376
+ 108000000n,
377
+ 114000000n,
378
+ 120000000n,
379
+ 126000000n,
380
+ 132000000n,
381
+ 138000000n,
382
+ 144000000n,
383
+ 150000000n,
384
+ 156000000n,
385
+ 162000000n,
386
+ 168000000n,
387
+ 174000000n,
388
+ 180000000n,
389
+ 186000000n,
390
+ 192000000n,
391
+ 198000000n,
392
+ 204000000n,
393
+ 210000000n,
394
+ 216000000n,
395
+ 222000000n,
396
+ 228000000n,
397
+ 234000000n,
398
+ 240000000n,
399
+ 246000000n,
400
+ 252000000n,
401
+ 258000000n,
402
+ 264000000n,
403
+ 270000000n,
404
+ 276000000n,
405
+ 282000000n,
406
+ 288000000n,
407
+ 294000000n,
408
+ 300000000n,
409
+ ];
410
+
411
+ const pools = await baseswapV3.getPoolIdentifiers(
412
+ TokenA,
413
+ TokenB,
414
+ SwapSide.BUY,
415
+ blockNumber,
416
+ );
417
+ console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Identifiers: `, pools);
418
+
419
+ expect(pools.length).toBeGreaterThan(0);
420
+
421
+ const poolPrices = await baseswapV3.getPricesVolume(
422
+ TokenA,
423
+ TokenB,
424
+ amountsBuy,
425
+ SwapSide.BUY,
426
+ blockNumber,
427
+ pools,
428
+ );
429
+ console.log(`${TokenASymbol} <> ${TokenBSymbol} Pool Prices: `, poolPrices);
430
+
431
+ expect(poolPrices).not.toBeNull();
432
+ checkPoolPrices(
433
+ poolPrices!.filter(pp => pp.unit !== 0n),
434
+ amountsBuy,
435
+ SwapSide.BUY,
436
+ dexKey,
437
+ );
438
+
439
+ // Check if onchain pricing equals to calculated ones
440
+ let falseChecksCounter = 0;
441
+ await Promise.all(
442
+ poolPrices!.map(async price => {
443
+ const fee = baseswapV3.eventPools[price.poolIdentifier!]!.feeCode;
444
+ const res = await checkOnChainPricing(
445
+ dexHelper,
446
+ 'quoteExactOutputSingle',
447
+ blockNumber,
448
+ QuoterV2,
449
+ price.prices,
450
+ TokenA.address,
451
+ TokenB.address,
452
+ fee,
453
+ amountsBuy,
454
+ );
455
+ if (res === false) falseChecksCounter++;
456
+ }),
457
+ );
458
+ expect(falseChecksCounter).toBeLessThan(poolPrices!.length);
459
+ });
460
+
461
+ it('getTopPoolsForToken', async function () {
462
+ const poolLiquidity = await baseswapV3Mainnet.getTopPoolsForToken(
463
+ Tokens[Network.BASE]['USDC'].address,
464
+ 10,
465
+ );
466
+ console.log(`${TokenASymbol} Top Pools:`, poolLiquidity);
467
+
468
+ if (!baseswapV3.hasConstantPriceLargeAmounts) {
469
+ checkPoolsLiquidity(poolLiquidity, TokenA.address, dexKey);
470
+ }
471
+ });
472
+ });