@paraswap/dex-lib 2.15.1 → 2.15.2

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 (42) hide show
  1. package/.idea/modules.xml +1 -1
  2. package/.vscode/launch.json +21 -0
  3. package/build/dex/aave-v3/tokens/arbitrum.json +20 -20
  4. package/build/dex/aave-v3/tokens/avalanche.json +20 -44
  5. package/build/dex/aave-v3/tokens/fantom.json +30 -30
  6. package/build/dex/aave-v3/tokens/mainnet.json +44 -0
  7. package/build/dex/aave-v3/tokens/optimism.json +18 -18
  8. package/build/dex/aave-v3/tokens/polygon.json +42 -60
  9. package/build/dex/balancer-v2/VirtualBoostedPool.d.ts +79 -0
  10. package/build/dex/balancer-v2/VirtualBoostedPool.js +382 -0
  11. package/build/dex/balancer-v2/VirtualBoostedPool.js.map +1 -0
  12. package/build/dex/generic-rfq/rate-fetcher.js +2 -2
  13. package/build/dex/generic-rfq/rate-fetcher.js.map +1 -1
  14. package/build/dex/hashflow/hashflow.js.map +1 -1
  15. package/build/dex/hashflow/validators.js.map +1 -1
  16. package/build/dex/test-aave-v3/config.d.ts +4 -0
  17. package/build/dex/test-aave-v3/config.js +15 -0
  18. package/build/dex/test-aave-v3/config.js.map +1 -0
  19. package/build/dex/test-aave-v3/test-aave-v3-pool.d.ts +39 -0
  20. package/build/dex/test-aave-v3/test-aave-v3-pool.js +63 -0
  21. package/build/dex/test-aave-v3/test-aave-v3-pool.js.map +1 -0
  22. package/build/dex/test-aave-v3/test-aave-v3.d.ts +37 -0
  23. package/build/dex/test-aave-v3/test-aave-v3.js +126 -0
  24. package/build/dex/test-aave-v3/test-aave-v3.js.map +1 -0
  25. package/build/dex/test-aave-v3/types.d.ts +6 -0
  26. package/build/dex/test-aave-v3/types.js +3 -0
  27. package/build/dex/test-aave-v3/types.js.map +1 -0
  28. package/build/lib/fetcher/fetcher.js +1 -2
  29. package/build/lib/fetcher/fetcher.js.map +1 -1
  30. package/package.json +1 -1
  31. package/src/dex/generic-rfq/generic-rfq-e2e.test.ts +26 -10
  32. package/src/dex/generic-rfq/rate-fetcher.ts +8 -4
  33. package/src/dex/hashflow/hashflow.ts +1 -1
  34. package/src/dex/hashflow/validators.ts +18 -14
  35. package/src/lib/fetcher/fetcher.ts +40 -35
  36. package/tests/constants-e2e.ts +4 -0
  37. package/tests/utils-e2e.ts +35 -11
  38. package/.idea/aws.xml +0 -17
  39. package/.idea/codeStyles/Project.xml +0 -19
  40. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  41. package/.idea/paraswap-dex-lib.iml +0 -9
  42. package/.idea/runConfigurations.xml +0 -10
@@ -30,6 +30,7 @@ import axios from 'axios';
30
30
  import { SmartToken, StateOverrides } from './smart-tokens';
31
31
  import { GIFTER_ADDRESS } from './constants-e2e';
32
32
  import { sleep } from './utils';
33
+ import { assert } from 'ts-essentials';
33
34
 
34
35
  export const testingEndpoint = process.env.E2E_TEST_ENDPOINT;
35
36
 
@@ -282,8 +283,8 @@ export async function testE2E(
282
283
 
283
284
  export type TestParamE2E = {
284
285
  config: Config;
285
- srcToken: SmartToken;
286
- destToken: SmartToken;
286
+ srcToken: Token | SmartToken;
287
+ destToken: Token | SmartToken;
287
288
  senderAddress: Address;
288
289
  thirdPartyAddress?: Address;
289
290
  _amount: string;
@@ -345,7 +346,11 @@ export async function newTestE2E({
345
346
  }
346
347
 
347
348
  if (useTenderly && adapterBytecode) {
348
- const deployTx = await (ts as TenderlySimulation).simulate(
349
+ assert(
350
+ ts instanceof TenderlySimulation,
351
+ '`ts` is not an instance of TenderlySimulation',
352
+ );
353
+ const deployTx = await ts.simulate(
349
354
  deployAdapterParams(adapterBytecode, network),
350
355
  );
351
356
 
@@ -360,13 +365,22 @@ export async function newTestE2E({
360
365
  'gas',
361
366
  );
362
367
 
363
- const whitelistTx = await (ts as TenderlySimulation).simulate(
368
+ const whitelistTx = await ts.simulate(
364
369
  whiteListAdapterParams(adapterAddress, network),
365
370
  );
366
371
  expect(whitelistTx.success).toEqual(true);
367
372
  }
368
373
 
369
374
  if (useTenderly && thirdPartyAddress) {
375
+ assert(
376
+ destToken instanceof SmartToken,
377
+ '`destToken` is not an instance of SmartToken',
378
+ );
379
+ assert(
380
+ ts instanceof TenderlySimulation,
381
+ '`ts` is not an instance of TenderlySimulation',
382
+ );
383
+
370
384
  const stateOverrides: StateOverrides = {
371
385
  networkID: `${network}`,
372
386
  stateOverrides: {},
@@ -383,7 +397,7 @@ export async function newTestE2E({
383
397
  : (BigInt(MAX_UINT) / 4n).toString(),
384
398
  );
385
399
 
386
- await (ts as TenderlySimulation).simulate(giftTx, stateOverrides);
400
+ await ts.simulate(giftTx, stateOverrides);
387
401
  }
388
402
 
389
403
  const useAPI = testingEndpoint && !poolIdentifiers;
@@ -402,8 +416,8 @@ export async function newTestE2E({
402
416
  }
403
417
  try {
404
418
  const priceRoute = await paraswap.getPrices(
405
- srcToken.token,
406
- destToken.token,
419
+ skipTenderly ? (srcToken as Token) : (srcToken as SmartToken).token,
420
+ skipTenderly ? (destToken as Token) : (destToken as SmartToken).token,
407
421
  amount,
408
422
  swapSide,
409
423
  contractMethod,
@@ -428,6 +442,19 @@ export async function newTestE2E({
428
442
  );
429
443
 
430
444
  if (useTenderly) {
445
+ assert(
446
+ srcToken instanceof SmartToken,
447
+ '`srcToken` is not an instance of SmartToken',
448
+ );
449
+ assert(
450
+ destToken instanceof SmartToken,
451
+ '`destToken` is not an instance of SmartToken',
452
+ );
453
+ assert(
454
+ ts instanceof TenderlySimulation,
455
+ '`ts` is not an instance of TenderlySimulation',
456
+ );
457
+
431
458
  const stateOverrides: StateOverrides = {
432
459
  networkID: `${network}`,
433
460
  stateOverrides: {},
@@ -456,10 +483,7 @@ export async function newTestE2E({
456
483
  srcToken.applyOverrides(stateOverrides);
457
484
  destToken.applyOverrides(stateOverrides);
458
485
 
459
- const swapTx = await (ts as TenderlySimulation).simulate(
460
- swapParams,
461
- stateOverrides,
462
- );
486
+ const swapTx = await ts.simulate(swapParams, stateOverrides);
463
487
  console.log(`${srcToken.address}_${destToken.address}_${dexKey!}`);
464
488
  // Only log gas estimate if testing against API
465
489
  if (useAPI)
package/.idea/aws.xml DELETED
@@ -1,17 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="accountSettings">
4
- <option name="activeProfile" value="profile:default" />
5
- <option name="activeRegion" value="us-east-1" />
6
- <option name="recentlyUsedProfiles">
7
- <list>
8
- <option value="profile:default" />
9
- </list>
10
- </option>
11
- <option name="recentlyUsedRegions">
12
- <list>
13
- <option value="us-east-1" />
14
- </list>
15
- </option>
16
- </component>
17
- </project>
@@ -1,19 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <ScalaCodeStyleSettings>
4
- <option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
5
- </ScalaCodeStyleSettings>
6
- <TypeScriptCodeStyleSettings version="0">
7
- <option name="SPACE_WITHIN_ARRAY_INITIALIZER_BRACKETS" value="true" />
8
- <option name="USE_DOUBLE_QUOTES" value="false" />
9
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
10
- </TypeScriptCodeStyleSettings>
11
- <codeStyleSettings language="TypeScript">
12
- <indentOptions>
13
- <option name="INDENT_SIZE" value="2" />
14
- <option name="CONTINUATION_INDENT_SIZE" value="2" />
15
- <option name="TAB_SIZE" value="2" />
16
- </indentOptions>
17
- </codeStyleSettings>
18
- </code_scheme>
19
- </component>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
@@ -1,10 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="RunConfigurationProducerService">
4
- <option name="ignoredProducers">
5
- <set>
6
- <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
7
- </set>
8
- </option>
9
- </component>
10
- </project>