@paraswap/dex-lib 4.0.3 → 4.0.5-balancer-v3.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.
Files changed (57) hide show
  1. package/build/dex/balancer-v3/balancer-v3-pool.d.ts +1 -0
  2. package/build/dex/balancer-v3/balancer-v3-pool.js +29 -11
  3. package/build/dex/balancer-v3/balancer-v3-pool.js.map +1 -1
  4. package/build/dex/balancer-v3/config.js +1 -5
  5. package/build/dex/balancer-v3/config.js.map +1 -1
  6. package/build/dex/balancer-v3/getOnChainState.d.ts +9 -0
  7. package/build/dex/balancer-v3/getOnChainState.js +38 -5
  8. package/build/dex/balancer-v3/getOnChainState.js.map +1 -1
  9. package/build/dex/balancer-v3/types.d.ts +1 -0
  10. package/build/dex/bebop/bebop.js +1 -1
  11. package/build/dex/bebop/bebop.js.map +1 -1
  12. package/build/dex/cables/cables.d.ts +4 -2
  13. package/build/dex/cables/cables.js +90 -155
  14. package/build/dex/cables/cables.js.map +1 -1
  15. package/build/dex/cables/constants.d.ts +0 -1
  16. package/build/dex/cables/constants.js +2 -3
  17. package/build/dex/cables/constants.js.map +1 -1
  18. package/build/dex/cables/rate-fetcher.js +26 -10
  19. package/build/dex/cables/rate-fetcher.js.map +1 -1
  20. package/build/dex/cables/types.d.ts +15 -28
  21. package/build/dex/cables/types.js +2 -13
  22. package/build/dex/cables/types.js.map +1 -1
  23. package/build/dex/dexalot/dexalot.js.map +1 -1
  24. package/build/dex/index.js +2 -0
  25. package/build/dex/index.js.map +1 -1
  26. package/build/executor/Executor01BytecodeBuilder.js +11 -6
  27. package/build/executor/Executor01BytecodeBuilder.js.map +1 -1
  28. package/build/executor/Executor02BytecodeBuilder.js +11 -6
  29. package/build/executor/Executor02BytecodeBuilder.js.map +1 -1
  30. package/build/executor/Executor03BytecodeBuilder.js +11 -6
  31. package/build/executor/Executor03BytecodeBuilder.js.map +1 -1
  32. package/build/types.d.ts +1 -0
  33. package/package.json +1 -1
  34. package/src/abi/cables/CablesMainnetRFQ.json +1083 -0
  35. package/src/dex/balancer-v3/balancer-v3-e2e.test.ts +30 -6
  36. package/src/dex/balancer-v3/balancer-v3-integration.test.ts +229 -1
  37. package/src/dex/balancer-v3/balancer-v3-pool.ts +52 -10
  38. package/src/dex/balancer-v3/config.ts +1 -5
  39. package/src/dex/balancer-v3/getOnChainState.ts +80 -6
  40. package/src/dex/balancer-v3/types.ts +1 -0
  41. package/src/dex/bebop/bebop.ts +1 -1
  42. package/src/dex/cables/cables-e2e.test.ts +207 -0
  43. package/src/dex/cables/cables-integration.test.ts +391 -0
  44. package/src/dex/cables/cables.ts +823 -0
  45. package/src/dex/cables/config.ts +13 -0
  46. package/src/dex/cables/constants.ts +33 -0
  47. package/src/dex/cables/rate-fetcher.ts +212 -0
  48. package/src/dex/cables/types.ts +113 -0
  49. package/src/dex/cables/validators.test.ts +151 -0
  50. package/src/dex/cables/validators.ts +61 -0
  51. package/src/dex/dexalot/dexalot.ts +1 -0
  52. package/src/dex/index.ts +2 -0
  53. package/src/executor/Executor01BytecodeBuilder.ts +15 -11
  54. package/src/executor/Executor02BytecodeBuilder.ts +13 -9
  55. package/src/executor/Executor03BytecodeBuilder.ts +16 -9
  56. package/src/types.ts +1 -0
  57. package/tests/constants-e2e.ts +13 -2
@@ -331,24 +331,31 @@ export class Executor03BytecodeBuilder extends ExecutorBytecodeBuilder<
331
331
  let fromAmountPos = 0;
332
332
  let toAmountPos = 0;
333
333
  if (insertAmount) {
334
- const fromAmount = ethers.utils.defaultAbiCoder.encode(
335
- ['uint256'],
336
- [swap.swapExchanges[swapExchangeIndex].srcAmount],
337
- );
334
+ if (exchangeParam.insertFromAmountPos) {
335
+ fromAmountPos = exchangeParam.insertFromAmountPos;
336
+ } else {
337
+ const fromAmount = ethers.utils.defaultAbiCoder.encode(
338
+ ['uint256'],
339
+ [swap.swapExchanges[swapExchangeIndex].srcAmount],
340
+ );
341
+
342
+ const fromAmountIndex = exchangeData
343
+ .replace('0x', '')
344
+ .indexOf(fromAmount.replace('0x', ''));
345
+
346
+ fromAmountPos =
347
+ (fromAmountIndex !== -1 ? fromAmountIndex : exchangeData.length) / 2;
348
+ }
349
+
338
350
  const toAmount = ethers.utils.defaultAbiCoder.encode(
339
351
  ['uint256'],
340
352
  [swap.swapExchanges[swapExchangeIndex].destAmount],
341
353
  );
342
354
 
343
- const fromAmountIndex = exchangeData
344
- .replace('0x', '')
345
- .indexOf(fromAmount.replace('0x', ''));
346
355
  const toAmountIndex = exchangeData
347
356
  .replace('0x', '')
348
357
  .indexOf(toAmount.replace('0x', ''));
349
358
 
350
- fromAmountPos =
351
- (fromAmountIndex !== -1 ? fromAmountIndex : exchangeData.length) / 2;
352
359
  toAmountPos =
353
360
  (toAmountIndex !== -1 ? toAmountIndex : exchangeData.length) / 2;
354
361
  }
package/src/types.ts CHANGED
@@ -173,6 +173,7 @@ export type DexExchangeParam = {
173
173
  swappedAmountNotPresentInExchangeData?: boolean;
174
174
  preSwapUnwrapCalldata?: string;
175
175
  returnAmountPos: number | undefined;
176
+ insertFromAmountPos?: number;
176
177
  permit2Approval?: boolean;
177
178
  };
178
179
 
@@ -550,6 +550,11 @@ export const Tokens: {
550
550
  decimals: 18,
551
551
  symbol: 'USD0++',
552
552
  },
553
+ wUSDL: {
554
+ address: '0x7751e2f4b8ae93ef6b79d86419d42fe3295a4559',
555
+ decimals: 18,
556
+ symbol: 'wUSDL',
557
+ },
553
558
  },
554
559
  [Network.POLYGON]: {
555
560
  jGBP: {
@@ -1516,6 +1521,10 @@ export const Tokens: {
1516
1521
  address: '0xc6b7aca6de8a6044e0e32d0c841a89244a10d284',
1517
1522
  decimals: 6,
1518
1523
  },
1524
+ GNO: {
1525
+ address: '0x9c58bacc331c9aa871afd802db6379a98e80cedb',
1526
+ decimals: 18,
1527
+ },
1519
1528
  wstETH: {
1520
1529
  address: '0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6',
1521
1530
  decimals: 18,
@@ -1676,6 +1685,7 @@ export const Holders: {
1676
1685
  [network: number]: { [tokenAddress: string]: Address };
1677
1686
  } = {
1678
1687
  [Network.MAINNET]: {
1688
+ wUSDL: '0x50fc9731dAcE42CaA45D166bfF404bBB7464bF21',
1679
1689
  USDS: '0xB1796E8f1eEcF23027c1E3C00fE303629A189d10',
1680
1690
  sUSDS: '0xd564B3aE673CAa49D054Bf185bD72a6853763eE7',
1681
1691
  SKY: '0x0ddda327A6614130CCb20bc0097313A282176A01',
@@ -1900,7 +1910,7 @@ export const Holders: {
1900
1910
  BETS: '0x8cc2284c90d05578633418f9cde104f402375a65',
1901
1911
  HATCHY: '0x14ec295ec8def851ec6e2959df872dd24e422631',
1902
1912
  USDCe: '0x3a2434c698f8d79af1f5a9e43013157ca8b11a66',
1903
- USDC: '0xcc2da711D621A4491b338CAC88B9C0954db3e75B',
1913
+ USDC: '0x64b4dE1b00EF830f3CC2FD68ee056aAD76C45BF6',
1904
1914
  USDTe: '0x84d34f4f83a87596cd3fb6887cff8f17bf5a7b83',
1905
1915
  WETHe: '0x9bdB521a97E95177BF252C253E256A60C3e14447',
1906
1916
  POPS: '0x5268c2331658cb0b2858cfa9db27d8f22f5434bc',
@@ -1916,7 +1926,7 @@ export const Holders: {
1916
1926
  TSD: '0x691A89db352B72dDb249bFe16503494eC0D920A4',
1917
1927
  THO: '0xc40d16c47394a506d451475c8a7c46c1175c1da1',
1918
1928
  aAvaUSDT: '0x50B1Ba98Cf117c9682048D56628B294ebbAA4ec2',
1919
- USDT: '0x0d0707963952f2fba59dd06f2b425ace40b492fe',
1929
+ USDT: '0xCddc5d0Ebeb71a08ffF26909AA6c0d4e256b4fE1',
1920
1930
  aAvaWAVAX: '0x1B18Df70863636AEe4BfBAb6F7C70ceBCA9bA404',
1921
1931
  oldFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
1922
1932
  newFRAX: '0x4e3376018add04ebe4c46bf6f924ddec8c67aa7b',
@@ -2011,6 +2021,7 @@ export const Holders: {
2011
2021
  USDC: '0x99b31498b0a1dae01fc3433e3cb60f095340935c',
2012
2022
  },
2013
2023
  [Network.GNOSIS]: {
2024
+ GNO: '0x458cD345B4C05e8DF39d0A07220feb4Ec19F5e6f',
2014
2025
  COW: '0x4fFAD6ac852c0Af0AA301376F4C5Dea3a928b120',
2015
2026
  XDAI: '0x9fc062032d4F2Fe7dAA601bd8B06C45F9c8f17Be',
2016
2027
  WXDAI: '0xBA12222222228d8Ba445958a75a0704d566BF2C8',