@paraswap/dex-lib 2.42.23 → 2.42.24-smardex

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 (65) hide show
  1. package/build/abi/smardex/all/smardex-router.json +479 -0
  2. package/build/abi/smardex/layer-1/smardex-factory.json +176 -0
  3. package/build/abi/smardex/layer-1/smardex-pool.json +768 -0
  4. package/build/abi/smardex/layer-2/smardex-factory.json +265 -0
  5. package/build/abi/smardex/layer-2/smardex-pool.json +898 -0
  6. package/build/config.js +20 -10
  7. package/build/config.js.map +1 -1
  8. package/build/dex/dexalot/constants.js +1 -1
  9. package/build/dex/index.js +2 -0
  10. package/build/dex/index.js.map +1 -1
  11. package/build/dex/smardex/config.d.ts +4 -0
  12. package/build/dex/smardex/config.js +64 -0
  13. package/build/dex/smardex/config.js.map +1 -0
  14. package/build/dex/smardex/constants.d.ts +18 -0
  15. package/build/dex/smardex/constants.js +34 -0
  16. package/build/dex/smardex/constants.js.map +1 -0
  17. package/build/dex/smardex/sdk/constants.d.ts +6 -0
  18. package/build/dex/smardex/sdk/constants.js +13 -0
  19. package/build/dex/smardex/sdk/constants.js.map +1 -0
  20. package/build/dex/smardex/sdk/core.d.ts +113 -0
  21. package/build/dex/smardex/sdk/core.js +499 -0
  22. package/build/dex/smardex/sdk/core.js.map +1 -0
  23. package/build/dex/smardex/sdk/errors.d.ts +15 -0
  24. package/build/dex/smardex/sdk/errors.js +22 -0
  25. package/build/dex/smardex/sdk/errors.js.map +1 -0
  26. package/build/dex/smardex/sdk/types.d.ts +62 -0
  27. package/build/dex/smardex/sdk/types.js +3 -0
  28. package/build/dex/smardex/sdk/types.js.map +1 -0
  29. package/build/dex/smardex/sdk/utils.d.ts +44 -0
  30. package/build/dex/smardex/sdk/utils.js +133 -0
  31. package/build/dex/smardex/sdk/utils.js.map +1 -0
  32. package/build/dex/smardex/smardex-event-pool.d.ts +28 -0
  33. package/build/dex/smardex/smardex-event-pool.js +135 -0
  34. package/build/dex/smardex/smardex-event-pool.js.map +1 -0
  35. package/build/dex/smardex/smardex.d.ts +66 -0
  36. package/build/dex/smardex/smardex.js +567 -0
  37. package/build/dex/smardex/smardex.js.map +1 -0
  38. package/build/dex/smardex/types.d.ts +55 -0
  39. package/build/dex/smardex/types.js +3 -0
  40. package/build/dex/smardex/types.js.map +1 -0
  41. package/build/types.d.ts +1 -0
  42. package/package.json +1 -1
  43. package/src/abi/smardex/all/smardex-router.json +479 -0
  44. package/src/abi/smardex/layer-1/smardex-factory.json +176 -0
  45. package/src/abi/smardex/layer-1/smardex-pool.json +768 -0
  46. package/src/abi/smardex/layer-2/smardex-factory.json +265 -0
  47. package/src/abi/smardex/layer-2/smardex-pool.json +898 -0
  48. package/src/config.ts +21 -10
  49. package/src/dex/dexalot/constants.ts +1 -1
  50. package/src/dex/index.ts +2 -0
  51. package/src/dex/smardex/config.ts +67 -0
  52. package/src/dex/smardex/constants.ts +36 -0
  53. package/src/dex/smardex/sdk/constants.ts +10 -0
  54. package/src/dex/smardex/sdk/core.ts +832 -0
  55. package/src/dex/smardex/sdk/errors.ts +18 -0
  56. package/src/dex/smardex/sdk/types.ts +68 -0
  57. package/src/dex/smardex/sdk/utils.ts +156 -0
  58. package/src/dex/smardex/smardex-e2e.test.ts +275 -0
  59. package/src/dex/smardex/smardex-event-pool.ts +185 -0
  60. package/src/dex/smardex/smardex-events.test.ts +296 -0
  61. package/src/dex/smardex/smardex-integration.test.ts +258 -0
  62. package/src/dex/smardex/smardex.ts +842 -0
  63. package/src/dex/smardex/types.ts +69 -0
  64. package/src/types.ts +1 -0
  65. package/tests/constants-e2e.ts +25 -0
@@ -0,0 +1,69 @@
1
+ import { Address, NumberAsString } from '../../types';
2
+ import {
3
+ UniswapV2Data,
4
+ DexParams as UniswapV2DexParams,
5
+ UniswapPool,
6
+ } from '../uniswap-v2/types';
7
+ import { UniswapV2Pair } from '../uniswap-v2/uniswap-v2';
8
+ import { SmardexEventPool } from './smardex-event-pool';
9
+
10
+ export interface SmardexPoolState extends SmardexFees {
11
+ reserves0: string;
12
+ reserves1: string;
13
+ fictiveReserves0: string;
14
+ fictiveReserves1: string;
15
+ priceAverage0: string;
16
+ priceAverage1: string;
17
+ priceAverageLastTimestamp: number;
18
+ }
19
+
20
+ // export interface SmardexData extends UniswapV2Data {
21
+ export interface SmardexData extends Omit<UniswapV2Data, 'feeFactor'> {
22
+ deadline: number;
23
+ receiver: Address;
24
+ }
25
+
26
+ export type SellOnSmardexParam = [
27
+ amountIn: NumberAsString,
28
+ amountOutMin: NumberAsString,
29
+ path: Address[],
30
+ receiver: Address,
31
+ deadline: number,
32
+ ];
33
+
34
+ export type BuyOnSmardexParam = [
35
+ amountIn: NumberAsString,
36
+ amountOutMin: NumberAsString,
37
+ path: Address[],
38
+ receiver: Address,
39
+ deadline: number,
40
+ ];
41
+
42
+ export type SmardexParam = SellOnSmardexParam | BuyOnSmardexParam;
43
+
44
+ export type DexParams = Omit<UniswapV2DexParams, 'feeCode'>;
45
+
46
+ export type SmardexFees = {
47
+ feesLP: bigint;
48
+ feesPool: bigint;
49
+ };
50
+ export interface SmardexPoolOrderedParams extends SmardexFees {
51
+ fromToken: string;
52
+ toToken: string;
53
+ token0: string;
54
+ token1: string;
55
+ reserves0: bigint;
56
+ reserves1: bigint;
57
+ fictiveReserves0: bigint;
58
+ fictiveReserves1: bigint;
59
+ priceAverage0: bigint;
60
+ priceAverage1: bigint;
61
+ priceAverageLastTimestamp: number;
62
+ exchange: string;
63
+ }
64
+
65
+ export interface SmardexPair extends Omit<UniswapV2Pair, 'pool'> {
66
+ pool?: SmardexEventPool;
67
+ }
68
+
69
+ export type SmardexPool = UniswapPool;
package/src/types.ts CHANGED
@@ -277,6 +277,7 @@ export type Config = {
277
277
  uniswapV3EventLoggingSampleRate?: number;
278
278
  swaapV2AuthToken?: string;
279
279
  dexalotAuthToken?: string;
280
+ smardexSubgraphAuthToken?: string;
280
281
  forceRpcFallbackDexs: string[];
281
282
  };
282
283
 
@@ -65,6 +65,10 @@ export const Tokens: {
65
65
  address: '0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
66
66
  decimals: 18,
67
67
  },
68
+ SDEX: {
69
+ address: '0x5DE8ab7E27f6E7A1fFf3E5B337584Aa43961BEeF',
70
+ decimals: 18,
71
+ },
68
72
  wstETH: {
69
73
  address: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
70
74
  decimals: 18,
@@ -453,6 +457,10 @@ export const Tokens: {
453
457
  address: '0xa3fa99a148fa48d14ed51d610c367c61876997f1',
454
458
  decimals: 18,
455
459
  },
460
+ SDEX: {
461
+ address: '0x6899fAcE15c14348E1759371049ab64A3a06bFA6',
462
+ decimals: 18,
463
+ },
456
464
  },
457
465
  [Network.FANTOM]: {
458
466
  FTM: { address: ETHER_ADDRESS, decimals: 18 },
@@ -611,6 +619,10 @@ export const Tokens: {
611
619
  address: '0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe',
612
620
  decimals: 18,
613
621
  },
622
+ SDEX: {
623
+ address: '0xFdc66A08B0d0Dc44c17bbd471B88f49F50CdD20F',
624
+ decimals: 18,
625
+ },
614
626
  },
615
627
  [Network.AVALANCHE]: {
616
628
  USDCe: {
@@ -857,6 +869,10 @@ export const Tokens: {
857
869
  address: '0x32eb7902d4134bf98a28b963d26de779af92a212',
858
870
  decimals: 18,
859
871
  },
872
+ SDEX: {
873
+ address: '0xabD587f2607542723b17f14d00d99b987C29b074',
874
+ decimals: 18,
875
+ },
860
876
  },
861
877
  [Network.OPTIMISM]: {
862
878
  DAI: {
@@ -964,6 +980,10 @@ export const Tokens: {
964
980
  address: '0xbeFD5C25A59ef2C1316c5A4944931171F30Cd3E4',
965
981
  decimals: 18,
966
982
  },
983
+ SDEX: {
984
+ address: '0xFd4330b0312fdEEC6d4225075b82E00493FF2e3f',
985
+ decimals: 18,
986
+ },
967
987
  ETH: { address: ETHER_ADDRESS, decimals: 18 },
968
988
  },
969
989
  };
@@ -1035,6 +1055,7 @@ export const Holders: {
1035
1055
  wibBTC: '0xFbdCA68601f835b27790D98bbb8eC7f05FDEaA9B',
1036
1056
  MATIC: '0x7073783eee7e9b3e6e4ddac4d7f49dc46044dd9a',
1037
1057
  POL: '0x57B6Ad484ccdd902C4419424bA648ba6Ed45dc68',
1058
+ SDEX: '0xB0470cF15B22a6A32c49a7C20E3821B944A76058',
1038
1059
  },
1039
1060
  [Network.ROPSTEN]: {
1040
1061
  ETH: '0x43262A12d8610AA70C15DbaeAC321d51613c9071',
@@ -1070,6 +1091,7 @@ export const Holders: {
1070
1091
  amUSDT: '0x832b11846a27b3ba25d68ae80c39fab155d18c49',
1071
1092
  amUSDC: '0x6e7f19cd23049c7118e14470e2bf85d2e26ee0ae',
1072
1093
  MAI: '0x9a8cf02f3e56c664ce75e395d0e4f3dc3dafe138',
1094
+ SDEX: '0xB0470cF15B22a6A32c49a7C20E3821B944A76058',
1073
1095
  },
1074
1096
  [Network.FANTOM]: {
1075
1097
  DAI: '0x370f4b2dcf75c94d8d4450b493661a9c6170d0b5',
@@ -1113,6 +1135,7 @@ export const Holders: {
1113
1135
  FRAX: '0xEB4576fE753DAB07635c0Bb6c8f0A355e1Db5d31',
1114
1136
  frxETH: '0xf324adC872005197A6f7DAE214d3b63aa0C3625F',
1115
1137
  USDFI: '0x2E00D722e091836B39Db3e4dcE6eE51c90c5B221',
1138
+ SDEX: '0xB0470cF15B22a6A32c49a7C20E3821B944A76058',
1116
1139
  },
1117
1140
  [Network.AVALANCHE]: {
1118
1141
  AVAX: '0xD6216fC19DB775Df9774a6E33526131dA7D19a2c',
@@ -1172,6 +1195,7 @@ export const Holders: {
1172
1195
  ZYB: '0x3ec0eddcd1e25025077327886a78133589082fb2',
1173
1196
  WBTC: '0xd9d611c6943585bc0e18e51034af8fa28778f7da',
1174
1197
  RDNT: '0x62383739d68dd0f844103db8dfb05a7eded5bbe6',
1198
+ SDEX: '0xb0470cf15b22a6a32c49a7c20e3821b944a76058',
1175
1199
  },
1176
1200
  [Network.OPTIMISM]: {
1177
1201
  ETH: '0x9ef21bE1C270AA1c3c3d750F458442397fBFFCB6',
@@ -1207,6 +1231,7 @@ export const Holders: {
1207
1231
  DAI: '0x20f03e26968b179025f65c1f4afadfd3959c8d03',
1208
1232
  BAL: '0x854b004700885a61107b458f11ecc169a019b764',
1209
1233
  GOLD: '0x1374c25b3710758c326ee0c70ec48b595d5ccf8c',
1234
+ SDEX: '0xa5d378c05192e3f1f365d6298921879c4d51c5a3',
1210
1235
  },
1211
1236
  };
1212
1237