@paraswap/dex-lib 3.11.7-cables.0 → 3.11.7

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.
@@ -148,18 +148,6 @@ describe('SwaapV2 E2E', () => {
148
148
  buyAmount: '150000000000000000000',
149
149
  },
150
150
  ],
151
- [
152
- {
153
- name: 'WMATIC',
154
- sellAmount: '150000000000000000000',
155
- buyAmount: '100000000',
156
- },
157
- {
158
- name: 'USDCe',
159
- sellAmount: '100000000',
160
- buyAmount: '150000000000000000000',
161
- },
162
- ],
163
151
  ];
164
152
 
165
153
  sideToContractMethods.forEach((contractMethods, side) =>
@@ -228,12 +216,12 @@ describe('SwaapV2 E2E', () => {
228
216
  {
229
217
  name: 'WETH',
230
218
  sellAmount: '10000000000000000',
231
- buyAmount: '1000000000000000000',
219
+ buyAmount: '100000',
232
220
  },
233
221
  {
234
222
  name: 'USDC',
235
- sellAmount: '1000000',
236
- buyAmount: '1000000',
223
+ sellAmount: '100000',
224
+ buyAmount: '10000000000000000',
237
225
  },
238
226
  ],
239
227
  ];
@@ -304,12 +292,12 @@ describe('SwaapV2 E2E', () => {
304
292
  {
305
293
  name: 'WETH',
306
294
  sellAmount: '100000000000000000',
307
- buyAmount: '1000000000000000',
295
+ buyAmount: '100000',
308
296
  },
309
297
  {
310
298
  name: 'USDC',
311
- sellAmount: '10000000',
312
- buyAmount: '1000000',
299
+ sellAmount: '100000',
300
+ buyAmount: '100000000000000000',
313
301
  },
314
302
  ],
315
303
  ];
@@ -379,13 +367,13 @@ describe('SwaapV2 E2E', () => {
379
367
  [
380
368
  {
381
369
  name: 'WBNB',
382
- sellAmount: '1000000000000000000',
383
- buyAmount: '100000000000000000000',
370
+ sellAmount: '100000000000000000',
371
+ buyAmount: '100000000000000000',
384
372
  },
385
373
  {
386
374
  name: 'USDT',
387
- sellAmount: '100000000000000000000',
388
- buyAmount: '1000000000000000000',
375
+ sellAmount: '100000000000000000',
376
+ buyAmount: '100000000000000000',
389
377
  },
390
378
  ],
391
379
  ];
@@ -455,12 +443,88 @@ describe('SwaapV2 E2E', () => {
455
443
  [
456
444
  {
457
445
  name: 'WETH',
446
+ sellAmount: '10000000000000000',
447
+ buyAmount: '100000',
448
+ },
449
+ {
450
+ name: 'USDC',
451
+ sellAmount: '100000',
452
+ buyAmount: '10000000000000000',
453
+ },
454
+ ],
455
+ ];
456
+
457
+ sideToContractMethods.forEach((contractMethods, side) =>
458
+ describe(`${side}`, () => {
459
+ contractMethods.forEach((contractMethod: ContractMethod) => {
460
+ pairs.forEach(pair => {
461
+ describe(`${contractMethod}`, () => {
462
+ it(`${pair[0].name} -> ${pair[1].name}`, async () => {
463
+ await testE2E(
464
+ tokens[pair[0].name],
465
+ tokens[pair[1].name],
466
+ holders[pair[0].name],
467
+ side === SwapSide.SELL
468
+ ? pair[0].sellAmount
469
+ : pair[0].buyAmount,
470
+ side,
471
+ dexKey,
472
+ contractMethod,
473
+ network,
474
+ provider,
475
+ undefined,
476
+ undefined,
477
+ undefined,
478
+ undefined,
479
+ sleepMs,
480
+ );
481
+ });
482
+ it(`${pair[1].name} -> ${pair[0].name}`, async () => {
483
+ await testE2E(
484
+ tokens[pair[1].name],
485
+ tokens[pair[0].name],
486
+ holders[pair[1].name],
487
+ side === SwapSide.SELL
488
+ ? pair[1].sellAmount
489
+ : pair[1].buyAmount,
490
+ side,
491
+ dexKey,
492
+ contractMethod,
493
+ network,
494
+ provider,
495
+ undefined,
496
+ undefined,
497
+ undefined,
498
+ undefined,
499
+ sleepMs,
500
+ );
501
+ });
502
+ });
503
+ });
504
+ });
505
+ }),
506
+ );
507
+ });
508
+
509
+ describe('Avalanche', () => {
510
+ const network = Network.AVALANCHE;
511
+ const provider = new StaticJsonRpcProvider(
512
+ generateConfig(network).privateHttpProvider,
513
+ network,
514
+ );
515
+ const tokens = Tokens[network];
516
+ const holders = Holders[network];
517
+
518
+ const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [
519
+ [
520
+ {
521
+ name: 'WAVAX',
458
522
  sellAmount: '1000000000000000000',
459
- buyAmount: '100000000',
523
+ buyAmount: '1000000',
460
524
  },
461
525
  {
462
526
  name: 'USDC',
463
- sellAmount: '45410357',
527
+ sellAmount: '1000000',
464
528
  buyAmount: '1000000000000000000',
465
529
  },
466
530
  ],
@@ -178,4 +178,42 @@ describe('Swaap V2', function () {
178
178
  }
179
179
  });
180
180
  });
181
+
182
+ describe('Avalanche', () => {
183
+ const network = Network.AVALANCHE;
184
+ const dexHelper = new DummyDexHelper(network);
185
+
186
+ beforeAll(async () => {
187
+ swaapV2 = new SwaapV2(network, dexKey, dexHelper);
188
+ if (swaapV2.initializePricing) {
189
+ await swaapV2.initializePricing(0);
190
+ await sleep(5000);
191
+ }
192
+ });
193
+
194
+ const tokens = Tokens[network];
195
+ const srcTokenSymbol = 'USDC';
196
+
197
+ it('getTopPoolsForToken', async function () {
198
+ // We have to check without calling initializePricing, because
199
+ // pool-tracker is not calling that function
200
+ const swaapV2 = new SwaapV2(network, dexKey, dexHelper);
201
+ const poolLiquidity = await swaapV2.getTopPoolsForToken(
202
+ tokens[srcTokenSymbol].address,
203
+ 10,
204
+ );
205
+ console.log(
206
+ `${srcTokenSymbol} Top Pools:`,
207
+ util.inspect(poolLiquidity, false, null, true),
208
+ );
209
+
210
+ if (!swaapV2.hasConstantPriceLargeAmounts) {
211
+ checkPoolsLiquidity(
212
+ poolLiquidity,
213
+ tokens[srcTokenSymbol].address,
214
+ dexKey,
215
+ );
216
+ }
217
+ });
218
+ });
181
219
  });
@@ -1844,7 +1844,7 @@ export const Holders: {
1844
1844
  BETS: '0x8cc2284c90d05578633418f9cde104f402375a65',
1845
1845
  HATCHY: '0x14ec295ec8def851ec6e2959df872dd24e422631',
1846
1846
  USDCe: '0x3a2434c698f8d79af1f5a9e43013157ca8b11a66',
1847
- USDC: '0x64b4dE1b00EF830f3CC2FD68ee056aAD76C45BF6',
1847
+ USDC: '0xcc2da711D621A4491b338CAC88B9C0954db3e75B',
1848
1848
  USDTe: '0x84d34f4f83a87596cd3fb6887cff8f17bf5a7b83',
1849
1849
  WETHe: '0x9bdB521a97E95177BF252C253E256A60C3e14447',
1850
1850
  POPS: '0x5268c2331658cb0b2858cfa9db27d8f22f5434bc',
@@ -1860,7 +1860,7 @@ export const Holders: {
1860
1860
  TSD: '0x691A89db352B72dDb249bFe16503494eC0D920A4',
1861
1861
  THO: '0xc40d16c47394a506d451475c8a7c46c1175c1da1',
1862
1862
  aAvaUSDT: '0x50B1Ba98Cf117c9682048D56628B294ebbAA4ec2',
1863
- USDT: '0xCddc5d0Ebeb71a08ffF26909AA6c0d4e256b4fE1',
1863
+ USDT: '0x0d0707963952f2fba59dd06f2b425ace40b492fe',
1864
1864
  aAvaWAVAX: '0x1B18Df70863636AEe4BfBAb6F7C70ceBCA9bA404',
1865
1865
  oldFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
1866
1866
  newFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',