@paraswap/dex-lib 2.42.26 → 2.42.27

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 (66) hide show
  1. package/build/abi/smardex/all/smardex-router.json +648 -0
  2. package/build/abi/smardex/layer-1/smardex-factory.json +242 -0
  3. package/build/abi/smardex/layer-1/smardex-pool.json +506 -0
  4. package/build/abi/smardex/layer-2/smardex-factory.json +185 -0
  5. package/build/abi/smardex/layer-2/smardex-pool.json +578 -0
  6. package/build/config.js +20 -10
  7. package/build/config.js.map +1 -1
  8. package/build/dex/index.js +2 -0
  9. package/build/dex/index.js.map +1 -1
  10. package/build/dex/smardex/config.d.ts +4 -0
  11. package/build/dex/smardex/config.js +64 -0
  12. package/build/dex/smardex/config.js.map +1 -0
  13. package/build/dex/smardex/constants.d.ts +18 -0
  14. package/build/dex/smardex/constants.js +33 -0
  15. package/build/dex/smardex/constants.js.map +1 -0
  16. package/build/dex/smardex/sdk/constants.d.ts +6 -0
  17. package/build/dex/smardex/sdk/constants.js +13 -0
  18. package/build/dex/smardex/sdk/constants.js.map +1 -0
  19. package/build/dex/smardex/sdk/core.d.ts +113 -0
  20. package/build/dex/smardex/sdk/core.js +499 -0
  21. package/build/dex/smardex/sdk/core.js.map +1 -0
  22. package/build/dex/smardex/sdk/errors.d.ts +15 -0
  23. package/build/dex/smardex/sdk/errors.js +22 -0
  24. package/build/dex/smardex/sdk/errors.js.map +1 -0
  25. package/build/dex/smardex/sdk/types.d.ts +62 -0
  26. package/build/dex/smardex/sdk/types.js +3 -0
  27. package/build/dex/smardex/sdk/types.js.map +1 -0
  28. package/build/dex/smardex/sdk/utils.d.ts +44 -0
  29. package/build/dex/smardex/sdk/utils.js +133 -0
  30. package/build/dex/smardex/sdk/utils.js.map +1 -0
  31. package/build/dex/smardex/smardex-event-pool.d.ts +28 -0
  32. package/build/dex/smardex/smardex-event-pool.js +119 -0
  33. package/build/dex/smardex/smardex-event-pool.js.map +1 -0
  34. package/build/dex/smardex/smardex.d.ts +65 -0
  35. package/build/dex/smardex/smardex.js +519 -0
  36. package/build/dex/smardex/smardex.js.map +1 -0
  37. package/build/dex/smardex/types.d.ts +55 -0
  38. package/build/dex/smardex/types.js +3 -0
  39. package/build/dex/smardex/types.js.map +1 -0
  40. package/build/types.d.ts +1 -0
  41. package/package.json +3 -2
  42. package/src/abi/smardex/all/smardex-router.json +648 -0
  43. package/src/abi/smardex/layer-1/smardex-factory.json +242 -0
  44. package/src/abi/smardex/layer-1/smardex-pool.json +506 -0
  45. package/src/abi/smardex/layer-2/smardex-factory.json +185 -0
  46. package/src/abi/smardex/layer-2/smardex-pool.json +578 -0
  47. package/src/config.ts +21 -10
  48. package/src/dex/index.ts +2 -0
  49. package/src/dex/smardex/config.ts +67 -0
  50. package/src/dex/smardex/constants.ts +35 -0
  51. package/src/dex/smardex/sdk/constants.ts +10 -0
  52. package/src/dex/smardex/sdk/core.ts +832 -0
  53. package/src/dex/smardex/sdk/errors.ts +18 -0
  54. package/src/dex/smardex/sdk/types.ts +68 -0
  55. package/src/dex/smardex/sdk/utils.ts +156 -0
  56. package/src/dex/smardex/smardex-e2e.test.ts +275 -0
  57. package/src/dex/smardex/smardex-event-pool.ts +164 -0
  58. package/src/dex/smardex/smardex-events.test.ts +297 -0
  59. package/src/dex/smardex/smardex-integration.test.ts +258 -0
  60. package/src/dex/smardex/smardex.ts +770 -0
  61. package/src/dex/smardex/types.ts +69 -0
  62. package/src/types.ts +1 -0
  63. package/tests/constants-e2e.ts +26 -1
  64. package/.vscode/launch.json +0 -54
  65. package/.vscode/settings.json +0 -2
  66. package/.vscode/tasks.json +0 -15
@@ -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 },
@@ -615,6 +623,10 @@ export const Tokens: {
615
623
  address: '0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe',
616
624
  decimals: 18,
617
625
  },
626
+ SDEX: {
627
+ address: '0xFdc66A08B0d0Dc44c17bbd471B88f49F50CdD20F',
628
+ decimals: 18,
629
+ },
618
630
  },
619
631
  [Network.AVALANCHE]: {
620
632
  USDCe: {
@@ -869,6 +881,10 @@ export const Tokens: {
869
881
  address: '0x32eb7902d4134bf98a28b963d26de779af92a212',
870
882
  decimals: 18,
871
883
  },
884
+ SDEX: {
885
+ address: '0xabD587f2607542723b17f14d00d99b987C29b074',
886
+ decimals: 18,
887
+ },
872
888
  },
873
889
  [Network.OPTIMISM]: {
874
890
  DAI: {
@@ -976,6 +992,10 @@ export const Tokens: {
976
992
  address: '0xbeFD5C25A59ef2C1316c5A4944931171F30Cd3E4',
977
993
  decimals: 18,
978
994
  },
995
+ SDEX: {
996
+ address: '0xFd4330b0312fdEEC6d4225075b82E00493FF2e3f',
997
+ decimals: 18,
998
+ },
979
999
  ETH: { address: ETHER_ADDRESS, decimals: 18 },
980
1000
  },
981
1001
  };
@@ -1047,6 +1067,7 @@ export const Holders: {
1047
1067
  wibBTC: '0xFbdCA68601f835b27790D98bbb8eC7f05FDEaA9B',
1048
1068
  MATIC: '0x7073783eee7e9b3e6e4ddac4d7f49dc46044dd9a',
1049
1069
  POL: '0x57B6Ad484ccdd902C4419424bA648ba6Ed45dc68',
1070
+ SDEX: '0xB0470cF15B22a6A32c49a7C20E3821B944A76058',
1050
1071
  },
1051
1072
  [Network.ROPSTEN]: {
1052
1073
  ETH: '0x43262A12d8610AA70C15DbaeAC321d51613c9071',
@@ -1082,6 +1103,7 @@ export const Holders: {
1082
1103
  amUSDT: '0x832b11846a27b3ba25d68ae80c39fab155d18c49',
1083
1104
  amUSDC: '0x6e7f19cd23049c7118e14470e2bf85d2e26ee0ae',
1084
1105
  MAI: '0x9a8cf02f3e56c664ce75e395d0e4f3dc3dafe138',
1106
+ SDEX: '0xB0470cF15B22a6A32c49a7C20E3821B944A76058',
1085
1107
  },
1086
1108
  [Network.FANTOM]: {
1087
1109
  DAI: '0x370f4b2dcf75c94d8d4450b493661a9c6170d0b5',
@@ -1125,6 +1147,7 @@ export const Holders: {
1125
1147
  FRAX: '0xEB4576fE753DAB07635c0Bb6c8f0A355e1Db5d31',
1126
1148
  frxETH: '0xf324adC872005197A6f7DAE214d3b63aa0C3625F',
1127
1149
  USDFI: '0x2E00D722e091836B39Db3e4dcE6eE51c90c5B221',
1150
+ SDEX: '0xB0470cF15B22a6A32c49a7C20E3821B944A76058',
1128
1151
  BNBx: '0xFF4606bd3884554CDbDabd9B6e25E2faD4f6fc54',
1129
1152
  },
1130
1153
  [Network.AVALANCHE]: {
@@ -1186,6 +1209,7 @@ export const Holders: {
1186
1209
  ZYB: '0x3ec0eddcd1e25025077327886a78133589082fb2',
1187
1210
  WBTC: '0xd9d611c6943585bc0e18e51034af8fa28778f7da',
1188
1211
  RDNT: '0x62383739d68dd0f844103db8dfb05a7eded5bbe6',
1212
+ SDEX: '0xb0470cf15b22a6a32c49a7c20e3821b944a76058',
1189
1213
  wstETH: '0x916792f7734089470de27297903bed8a4630b26d',
1190
1214
  },
1191
1215
  [Network.OPTIMISM]: {
@@ -1218,10 +1242,11 @@ export const Holders: {
1218
1242
  ETH: '0xdd9176ea3e7559d6b68b537ef555d3e89403f742',
1219
1243
  MAV: '0x7499785aa5d1bdf0a0ac862c1ef3698d3cba6568',
1220
1244
  USDC: '0xaac391f166f33cdaefaa4afa6616a3bea66b694d',
1221
- USDbC: '0xc9d05a1c3c8e01dcb701d6185cdc21a5bb94becb',
1245
+ USDbC: '0xc68a33de9ceac7bdaed242ae1dc40d673ed4f643',
1222
1246
  DAI: '0x20f03e26968b179025f65c1f4afadfd3959c8d03',
1223
1247
  BAL: '0x854b004700885a61107b458f11ecc169a019b764',
1224
1248
  GOLD: '0x1374c25b3710758c326ee0c70ec48b595d5ccf8c',
1249
+ SDEX: '0xa5d378c05192e3f1f365d6298921879c4d51c5a3',
1225
1250
  },
1226
1251
  };
1227
1252
 
@@ -1,54 +0,0 @@
1
- {
2
- "version": "0.2.0",
3
- "configurations": [
4
- {
5
- "type": "node",
6
- "request": "launch",
7
- "name": "Current",
8
- "program": "${file}",
9
- "preLaunchTask": "npm: build",
10
- "sourceMaps": true,
11
- "smartStep": true,
12
- "internalConsoleOptions": "openOnSessionStart",
13
- "outFiles": ["${workspaceFolder}/build/**/*.js"]
14
- },
15
- {
16
- "type": "node",
17
- "request": "launch",
18
- "name": "Debug dex integration",
19
- "program": "${workspaceFolder}/node_modules/ts-node/dist/bin.js",
20
- "args": [
21
- "--project",
22
- "tsconfig.json",
23
- // "${workspaceFolder}/src/dex/algebra/scripts/validate-state.ts",
24
- "${workspaceFolder}/scripts/dex-integration.ts",
25
- "test",
26
- "wombat"
27
- ],
28
- "console": "integratedTerminal",
29
- "internalConsoleOptions": "neverOpen",
30
- "runtimeArgs": ["--nolazy"],
31
- "sourceMaps": true,
32
- "smartStep": true,
33
- "skipFiles": ["<node_internals>/**"],
34
- "cwd": "${workspaceFolder}"
35
- },
36
- {
37
- "type": "node",
38
- "name": "Jest file",
39
- "request": "launch",
40
- "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/jest",
41
- "args": [
42
- "${fileBasenameNoExtension}",
43
- "--runInBand",
44
- "--watch",
45
- "--coverage=false",
46
- "--no-cache"
47
- ],
48
- "cwd": "${workspaceRoot}",
49
- "console": "integratedTerminal",
50
- "internalConsoleOptions": "neverOpen",
51
- "sourceMaps": true
52
- }
53
- ]
54
- }
@@ -1,2 +0,0 @@
1
- {
2
- }
@@ -1,15 +0,0 @@
1
- {
2
- "version": "2.0.0",
3
- "tasks": [
4
- {
5
- "label": "tsc: build - tsconfig.json",
6
- "type": "typescript",
7
- "tsconfig": "tsconfig.json",
8
- "problemMatcher": ["$tsc"],
9
- "group": {
10
- "kind": "build",
11
- "isDefault": true
12
- }
13
- }
14
- ]
15
- }