@paraswap/dex-lib 2.16.2-balancer-v2-buy → 2.16.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 (80) hide show
  1. package/build/abi/uniswap-v3/UniswapV3Pool.abi.json +363 -67
  2. package/build/abi/uniswap-v3/UniswapV3Quoter.abi.json +119 -23
  3. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +285 -0
  4. package/build/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +583 -0
  5. package/build/config.js +5 -5
  6. package/build/config.js.map +1 -1
  7. package/build/dex/balancer-v2/balancer-v2.d.ts +8 -2
  8. package/build/dex/balancer-v2/balancer-v2.js +7 -1
  9. package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
  10. package/build/dex/balancer-v2/config.d.ts +7 -2
  11. package/build/dex/balancer-v2/config.js +30 -20
  12. package/build/dex/balancer-v2/config.js.map +1 -1
  13. package/build/dex/index.js +2 -0
  14. package/build/dex/index.js.map +1 -1
  15. package/build/dex/uniswap-v3/config.js +38 -0
  16. package/build/dex/uniswap-v3/config.js.map +1 -1
  17. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.d.ts +12 -0
  18. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js +23 -0
  19. package/build/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.js.map +1 -0
  20. package/build/dex/uniswap-v3/types.d.ts +3 -0
  21. package/build/dex/uniswap-v3/types.js.map +1 -1
  22. package/build/dex/uniswap-v3/uniswap-v3-pool.d.ts +2 -1
  23. package/build/dex/uniswap-v3/uniswap-v3-pool.js +3 -2
  24. package/build/dex/uniswap-v3/uniswap-v3-pool.js.map +1 -1
  25. package/build/dex/uniswap-v3/uniswap-v3.js +6 -3
  26. package/build/dex/uniswap-v3/uniswap-v3.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/abi/uniswap-v3/UniswapV3Pool.abi.json +363 -67
  29. package/src/abi/uniswap-v3/UniswapV3Quoter.abi.json +119 -23
  30. package/src/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json +285 -0
  31. package/src/abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json +583 -0
  32. package/src/config.ts +5 -6
  33. package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +7 -14
  34. package/src/dex/balancer-v2/balancer-v2.ts +4 -1
  35. package/src/dex/balancer-v2/config.ts +35 -23
  36. package/src/dex/index.ts +2 -0
  37. package/src/dex/uniswap-v3/config.ts +46 -0
  38. package/src/dex/uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3.ts +28 -0
  39. package/src/dex/uniswap-v3/types.ts +3 -0
  40. package/src/dex/uniswap-v3/uniswap-v3-e2e.test.ts +156 -0
  41. package/src/dex/uniswap-v3/uniswap-v3-pool.ts +3 -2
  42. package/src/dex/uniswap-v3/uniswap-v3.ts +7 -3
  43. package/.idea/aws.xml +0 -17
  44. package/.idea/codeStyles/Project.xml +0 -19
  45. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  46. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  47. package/.idea/misc.xml +0 -6
  48. package/.idea/modules.xml +0 -8
  49. package/.idea/paraswap-dex-lib.iml +0 -9
  50. package/.idea/runConfigurations.xml +0 -10
  51. package/.idea/vcs.xml +0 -6
  52. package/build/abi/woo-fi/WooFeeManager.abi.json +0 -318
  53. package/build/abi/woo-fi/WooPP.abi.json +0 -548
  54. package/build/abi/woo-fi/Wooracle.abi.json +0 -260
  55. package/build/dex/aave-v3/tokens/arbitrum.json +0 -50
  56. package/build/dex/aave-v3/tokens/avalanche.json +0 -74
  57. package/build/dex/aave-v3/tokens/fantom.json +0 -62
  58. package/build/dex/aave-v3/tokens/optimism.json +0 -50
  59. package/build/dex/aave-v3/tokens/polygon.json +0 -116
  60. package/build/dex/quickswap-v3.d.ts +0 -21
  61. package/build/dex/quickswap-v3.js +0 -40
  62. package/build/dex/quickswap-v3.js.map +0 -1
  63. package/build/dex/woo-fi/config.d.ts +0 -4
  64. package/build/dex/woo-fi/config.js +0 -141
  65. package/build/dex/woo-fi/config.js.map +0 -1
  66. package/build/dex/woo-fi/constants.d.ts +0 -5
  67. package/build/dex/woo-fi/constants.js +0 -20
  68. package/build/dex/woo-fi/constants.js.map +0 -1
  69. package/build/dex/woo-fi/types.d.ts +0 -48
  70. package/build/dex/woo-fi/types.js +0 -3
  71. package/build/dex/woo-fi/types.js.map +0 -1
  72. package/build/dex/woo-fi/woo-fi-decimal-math.d.ts +0 -14
  73. package/build/dex/woo-fi/woo-fi-decimal-math.js +0 -42
  74. package/build/dex/woo-fi/woo-fi-decimal-math.js.map +0 -1
  75. package/build/dex/woo-fi/woo-fi-math.d.ts +0 -31
  76. package/build/dex/woo-fi/woo-fi-math.js +0 -300
  77. package/build/dex/woo-fi/woo-fi-math.js.map +0 -1
  78. package/build/dex/woo-fi/woo-fi.d.ts +0 -65
  79. package/build/dex/woo-fi/woo-fi.js +0 -480
  80. package/build/dex/woo-fi/woo-fi.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { DexParams } from './types';
2
- import { AdapterMappings, DexConfigMap } from '../../types';
3
- import { Network, SwapSide } from '../../constants';
2
+ import { DexConfigMap } from '../../types';
3
+ import { Network } from '../../constants';
4
4
 
5
5
  export const BalancerConfig: DexConfigMap<DexParams> = {
6
6
  BalancerV2: {
@@ -42,25 +42,37 @@ export const BalancerConfig: DexConfigMap<DexParams> = {
42
42
  // },
43
43
  };
44
44
 
45
- export const Adapters: Record<number, AdapterMappings> = {
46
- [Network.MAINNET]: {
47
- [SwapSide.SELL]: [{ name: 'Adapter02', index: 9 }],
48
- [SwapSide.BUY]: [{ name: 'BuyAdapter', index: 9 }],
49
- },
50
- [Network.POLYGON]: {
51
- [SwapSide.SELL]: [{ name: 'PolygonAdapter01', index: 9 }],
52
- [SwapSide.BUY]: [{ name: 'PolygonBuyAdapter', index: 6 }],
53
- },
54
- [Network.FANTOM]:{
55
- [SwapSide.SELL]: [{ name: 'FantomAdapter01', index: 5 }],
56
- [SwapSide.BUY]: [{ name: 'FantomBuyAdapter', index: 3 }],
57
- },
58
- [Network.ARBITRUM]: {
59
- [SwapSide.SELL]: [{ name: 'ArbitrumAdapter01', index: 5 }],
60
- [SwapSide.BUY]: [{ name: 'ArbitrumBuyAdapter', index: 6 }],
61
- },
62
- [Network.OPTIMISM]: {
63
- [SwapSide.SELL]: [{ name: 'OptimismAdapter01', index: 4 }],
64
- [SwapSide.BUY]: [{ name: 'OptimismBuyAdapter', index: 5 }],
65
- },
45
+ export const Adapters: {
46
+ [chainId: number]: { name: string; index: number }[];
47
+ } = {
48
+ [Network.MAINNET]: [
49
+ {
50
+ name: 'Adapter02',
51
+ index: 9,
52
+ },
53
+ ],
54
+ [Network.POLYGON]: [
55
+ {
56
+ name: 'PolygonAdapter01',
57
+ index: 9,
58
+ },
59
+ ],
60
+ [Network.FANTOM]: [
61
+ {
62
+ name: 'FantomAdapter01',
63
+ index: 5,
64
+ },
65
+ ],
66
+ [Network.ARBITRUM]: [
67
+ {
68
+ name: 'ArbitrumAdapter01',
69
+ index: 5,
70
+ },
71
+ ],
72
+ [Network.OPTIMISM]: [
73
+ {
74
+ name: 'OptimismAdapter01',
75
+ index: 4,
76
+ },
77
+ ],
66
78
  };
package/src/dex/index.ts CHANGED
@@ -63,6 +63,7 @@ import { MaverickV1 } from './maverick-v1/maverick-v1';
63
63
  import { QuickSwapV3 } from './quickswap/quickswap-v3';
64
64
  import { ZyberSwapV3 } from './quickswap/zyberswap-v3';
65
65
  import { TraderJoeV2 } from './trader-joe-v2';
66
+ import { PancakeswapV3 } from './uniswap-v3/forks/pancakeswap-v3/pancakeswap-v3';
66
67
 
67
68
  const LegacyDexes = [
68
69
  CurveV2,
@@ -94,6 +95,7 @@ const Dexes = [
94
95
  BalancerV2,
95
96
  UniswapV2,
96
97
  UniswapV3,
98
+ PancakeswapV3,
97
99
  BiSwap,
98
100
  MDEX,
99
101
  Dfyn,
@@ -4,6 +4,7 @@ import { Network, SwapSide } from '../../constants';
4
4
  import { Address } from '../../types';
5
5
 
6
6
  const SUPPORTED_FEES = [10000n, 3000n, 500n, 100n];
7
+ const PANCAKE_SUPPORTED_FEES = [10000n, 2500n, 500n, 100n];
7
8
 
8
9
  // Pools that will be initialized on app startup
9
10
  // They are added for testing
@@ -22,6 +23,7 @@ export const PoolsToPreload: DexConfigMap<
22
23
  },
23
24
  ],
24
25
  },
26
+ PancakeswapV3: {},
25
27
  };
26
28
 
27
29
  export const UniswapV3Config: DexConfigMap<DexParams> = {
@@ -34,6 +36,8 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
34
36
  stateMulticall: '0x9c764D2e92dA68E4CDfD784B902283A095ff8b63',
35
37
  uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
36
38
  chunksCount: 10,
39
+ initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
40
+ subgraphURL: 'https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3',
37
41
  },
38
42
  [Network.BSC]: {
39
43
  factory: '0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7',
@@ -43,6 +47,9 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
43
47
  stateMulticall: '0x593F39A4Ba26A9c8ed2128ac95D109E8e403C485',
44
48
  uniswapMulticall: '0x963Df249eD09c358A4819E39d9Cd5736c3087184',
45
49
  chunksCount: 10,
50
+ initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
51
+ subgraphURL:
52
+ 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-bsc',
46
53
  },
47
54
  [Network.POLYGON]: {
48
55
  factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
@@ -52,6 +59,9 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
52
59
  stateMulticall: '0x6Dc993Fe1e945A640576B4Dca81281d8e998DF71',
53
60
  uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
54
61
  chunksCount: 10,
62
+ initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
63
+ subgraphURL:
64
+ 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon',
55
65
  },
56
66
  [Network.ARBITRUM]: {
57
67
  factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
@@ -61,6 +71,9 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
61
71
  stateMulticall: '0xaBB58098A7B5172A9b0B38a1925A522dbf0b4FC3',
62
72
  uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
63
73
  chunksCount: 10,
74
+ initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
75
+ subgraphURL:
76
+ 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-minimal',
64
77
  },
65
78
  [Network.OPTIMISM]: {
66
79
  factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984',
@@ -70,6 +83,39 @@ export const UniswapV3Config: DexConfigMap<DexParams> = {
70
83
  stateMulticall: '0x4FF0dEC5f9a763Aa1E5C2a962aa6f4eDFeE4f9eA',
71
84
  uniswapMulticall: '0x1F98415757620B543A52E61c46B32eB19261F984',
72
85
  chunksCount: 10,
86
+ initHash: `0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54`,
87
+ subgraphURL:
88
+ 'https://api.thegraph.com/subgraphs/name/ianlapham/optimism-post-regenesis',
89
+ },
90
+ },
91
+ PancakeswapV3: {
92
+ [Network.MAINNET]: {
93
+ factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865',
94
+ deployer: '0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9',
95
+ quoter: '0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997',
96
+ router: '0x1b81D678ffb9C0263b24A97847620C99d213eB14',
97
+ supportedFees: PANCAKE_SUPPORTED_FEES,
98
+ stateMulticall: '0x80898f80cFA3Fa3AbF410d90e69aDc432AE5D4c2',
99
+ uniswapMulticall: '0xac1cE734566f390A94b00eb9bf561c2625BF44ea',
100
+ chunksCount: 10,
101
+ initHash:
102
+ '0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2',
103
+ subgraphURL:
104
+ 'https://api.thegraph.com/subgraphs/name/pancakeswap/exchange-v3-eth',
105
+ },
106
+ [Network.BSC]: {
107
+ factory: '0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865',
108
+ deployer: '0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9',
109
+ quoter: '0xB048Bbc1Ee6b733FFfCFb9e9CeF7375518e25997',
110
+ router: '0x1b81D678ffb9C0263b24A97847620C99d213eB14',
111
+ supportedFees: PANCAKE_SUPPORTED_FEES,
112
+ stateMulticall: '0x9DAd2ED7ADc6eaacf81589Cd043579c9684E5C81',
113
+ uniswapMulticall: '0xac1cE734566f390A94b00eb9bf561c2625BF44ea',
114
+ chunksCount: 10,
115
+ initHash:
116
+ '0x6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2',
117
+ subgraphURL:
118
+ 'https://api.thegraph.com/subgraphs/name/pancakeswap/exchange-v3-bsc',
73
119
  },
74
120
  },
75
121
  };
@@ -0,0 +1,28 @@
1
+ import { UniswapV3 } from '../../uniswap-v3';
2
+ import { Network } from '../../../../constants';
3
+ import { IDexHelper } from '../../../../dex-helper';
4
+ import { Interface } from '@ethersproject/abi';
5
+ import PancakeswapV3RouterABI from '../../../../abi/uniswap-v3/pancakeswap-v3/PancakeswapV3Router.abi.json';
6
+ import PancakeswapV3QuoterV2ABI from '../../../../abi/uniswap-v3/pancakeswap-v3/PancakeswapV3QuoterV2.abi.json';
7
+ import { getDexKeysWithNetwork } from '../../../../utils';
8
+ import _ from 'lodash';
9
+ import { UniswapV3Config } from '../../config';
10
+
11
+ export class PancakeswapV3 extends UniswapV3 {
12
+ public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
13
+ getDexKeysWithNetwork(_.pick(UniswapV3Config, ['PancakeswapV3']));
14
+ constructor(
15
+ protected network: Network,
16
+ dexKey: string,
17
+ protected dexHelper: IDexHelper,
18
+ ) {
19
+ super(
20
+ network,
21
+ dexKey,
22
+ dexHelper,
23
+ undefined,
24
+ new Interface(PancakeswapV3RouterABI),
25
+ new Interface(PancakeswapV3QuoterV2ABI),
26
+ );
27
+ }
28
+ }
@@ -67,6 +67,9 @@ export type DexParams = {
67
67
  uniswapMulticall: Address;
68
68
  supportedFees: bigint[];
69
69
  chunksCount: number;
70
+ deployer?: Address;
71
+ subgraphURL: string;
72
+ initHash: string;
70
73
  };
71
74
 
72
75
  export type UniswapV3SellParam = {
@@ -203,3 +203,159 @@ describe('UniswapV3 E2E', () => {
203
203
  );
204
204
  });
205
205
  });
206
+
207
+ describe('PancakeswapV3 E2E', () => {
208
+ const dexKey = 'PancakeswapV3';
209
+
210
+ describe('PancakeswapV3 MAINNET', () => {
211
+ const network = Network.MAINNET;
212
+ const tokens = Tokens[network];
213
+ const holders = Holders[network];
214
+ const provider = new StaticJsonRpcProvider(
215
+ generateConfig(network).privateHttpProvider,
216
+ network,
217
+ );
218
+
219
+ const tokenASymbol: string = 'USDT';
220
+ const tokenBSymbol: string = 'USDC';
221
+ const nativeTokenSymbol = NativeTokenSymbols[network];
222
+
223
+ const tokenAAmount: string = '100000000';
224
+ const tokenBAmount: string = '100000000';
225
+ const nativeTokenAmount = '1000000000000000000';
226
+
227
+ const sideToContractMethods = new Map([
228
+ [
229
+ SwapSide.SELL,
230
+ [
231
+ ContractMethod.simpleSwap,
232
+ ContractMethod.multiSwap,
233
+ ContractMethod.megaSwap,
234
+ ],
235
+ ],
236
+ [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
237
+ ]);
238
+
239
+ sideToContractMethods.forEach((contractMethods, side) =>
240
+ contractMethods.forEach((contractMethod: ContractMethod) => {
241
+ describe(`${contractMethod}`, () => {
242
+ it(`${network} ${side} ${contractMethod} ${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
243
+ await testE2E(
244
+ tokens[nativeTokenSymbol],
245
+ tokens[tokenASymbol],
246
+ holders[nativeTokenSymbol],
247
+ side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
248
+ side,
249
+ dexKey,
250
+ contractMethod,
251
+ network,
252
+ provider,
253
+ );
254
+ });
255
+ it(`${network} ${side} ${contractMethod} ${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
256
+ await testE2E(
257
+ tokens[tokenASymbol],
258
+ tokens[nativeTokenSymbol],
259
+ holders[tokenASymbol],
260
+ side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
261
+ side,
262
+ dexKey,
263
+ contractMethod,
264
+ network,
265
+ provider,
266
+ );
267
+ });
268
+ it(`${network} ${side} ${contractMethod} ${tokenASymbol} -> ${tokenBSymbol}`, async () => {
269
+ await testE2E(
270
+ tokens[tokenASymbol],
271
+ tokens[tokenBSymbol],
272
+ holders[tokenASymbol],
273
+ side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
274
+ side,
275
+ dexKey,
276
+ contractMethod,
277
+ network,
278
+ provider,
279
+ );
280
+ });
281
+ });
282
+ }),
283
+ );
284
+ });
285
+
286
+ describe('PancakeswapV3 BSC', () => {
287
+ const network = Network.BSC;
288
+ const tokens = Tokens[network];
289
+ const holders = Holders[network];
290
+ const provider = new StaticJsonRpcProvider(
291
+ generateConfig(network).privateHttpProvider,
292
+ network,
293
+ );
294
+
295
+ const tokenASymbol: string = 'BUSD';
296
+ const tokenBSymbol: string = 'WBNB';
297
+ const nativeTokenSymbol = NativeTokenSymbols[network];
298
+
299
+ const tokenAAmount: string = '100000000000000000000';
300
+ const tokenBAmount: string = '1000000000000000000';
301
+ const nativeTokenAmount = '1000000000000000000';
302
+
303
+ const sideToContractMethods = new Map([
304
+ [
305
+ SwapSide.SELL,
306
+ [
307
+ ContractMethod.simpleSwap,
308
+ ContractMethod.multiSwap,
309
+ ContractMethod.megaSwap,
310
+ ],
311
+ ],
312
+ [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
313
+ ]);
314
+
315
+ sideToContractMethods.forEach((contractMethods, side) =>
316
+ contractMethods.forEach((contractMethod: ContractMethod) => {
317
+ describe(`${contractMethod}`, () => {
318
+ it(`${network} ${side} ${contractMethod} ${nativeTokenSymbol} -> ${tokenASymbol}`, async () => {
319
+ await testE2E(
320
+ tokens[nativeTokenSymbol],
321
+ tokens[tokenASymbol],
322
+ holders[nativeTokenSymbol],
323
+ side === SwapSide.SELL ? nativeTokenAmount : tokenAAmount,
324
+ side,
325
+ dexKey,
326
+ contractMethod,
327
+ network,
328
+ provider,
329
+ );
330
+ });
331
+ it(`${network} ${side} ${contractMethod} ${tokenASymbol} -> ${nativeTokenSymbol}`, async () => {
332
+ await testE2E(
333
+ tokens[tokenASymbol],
334
+ tokens[nativeTokenSymbol],
335
+ holders[tokenASymbol],
336
+ side === SwapSide.SELL ? tokenAAmount : nativeTokenAmount,
337
+ side,
338
+ dexKey,
339
+ contractMethod,
340
+ network,
341
+ provider,
342
+ );
343
+ });
344
+ it(`${network} ${side} ${contractMethod} ${tokenASymbol} -> ${tokenBSymbol}`, async () => {
345
+ await testE2E(
346
+ tokens[tokenASymbol],
347
+ tokens[tokenBSymbol],
348
+ holders[tokenASymbol],
349
+ side === SwapSide.SELL ? tokenAAmount : tokenBAmount,
350
+ side,
351
+ dexKey,
352
+ contractMethod,
353
+ network,
354
+ provider,
355
+ );
356
+ });
357
+ });
358
+ }),
359
+ );
360
+ });
361
+ });
@@ -68,7 +68,8 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
68
68
  token1: Address,
69
69
  logger: Logger,
70
70
  mapKey: string = '',
71
- readonly poolInitCodeHash = DEFAULT_POOL_INIT_CODE_HASH,
71
+ readonly poolInitCodeHash: string,
72
+ readonly poolDeployer?: string,
72
73
  ) {
73
74
  super(
74
75
  parentName,
@@ -538,7 +539,7 @@ export class UniswapV3EventPool extends StatefulEventSubscriber<PoolState> {
538
539
  );
539
540
 
540
541
  return ethers.utils.getCreate2Address(
541
- this.factoryAddress,
542
+ this.poolDeployer ? this.poolDeployer : this.factoryAddress,
542
543
  encodedKey,
543
544
  this.poolInitCodeHash,
544
545
  );
@@ -43,7 +43,6 @@ import UniswapV3StateMulticallABI from '../../abi/uniswap-v3/UniswapV3StateMulti
43
43
  import {
44
44
  UNISWAPV3_EFFICIENCY_FACTOR,
45
45
  UNISWAPV3_FUNCTION_CALL_GAS_COST,
46
- UNISWAPV3_SUBGRAPH_URL,
47
46
  UNISWAPV3_TICK_GAS_COST,
48
47
  } from './constants';
49
48
  import { DeepReadonly } from 'ts-essentials';
@@ -80,7 +79,7 @@ export class UniswapV3
80
79
  intervalTask?: NodeJS.Timeout;
81
80
 
82
81
  public static dexKeysWithNetwork: { key: string; networks: Network[] }[] =
83
- getDexKeysWithNetwork(UniswapV3Config);
82
+ getDexKeysWithNetwork(_.pick(UniswapV3Config, ['UniswapV3']));
84
83
 
85
84
  logger: Logger;
86
85
 
@@ -213,6 +212,8 @@ export class UniswapV3
213
212
  token1,
214
213
  this.logger,
215
214
  this.cacheStateKey,
215
+ this.config.initHash,
216
+ this.config.deployer,
216
217
  );
217
218
 
218
219
  try {
@@ -880,6 +881,9 @@ export class UniswapV3
880
881
  stateMulticall: this.config.stateMulticall.toLowerCase(),
881
882
  chunksCount: this.config.chunksCount,
882
883
  uniswapMulticall: this.config.uniswapMulticall,
884
+ deployer: this.config.deployer?.toLowerCase(),
885
+ initHash: this.config.initHash,
886
+ subgraphURL: this.config.subgraphURL,
883
887
  };
884
888
  return newConfig;
885
889
  }
@@ -943,7 +947,7 @@ export class UniswapV3
943
947
  ) {
944
948
  try {
945
949
  const res = await this.dexHelper.httpRequest.post(
946
- UNISWAPV3_SUBGRAPH_URL,
950
+ this.config.subgraphURL,
947
951
  { query, variables },
948
952
  undefined,
949
953
  { timeout: timeout },
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,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
- </state>
5
- </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>
package/.idea/misc.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager">
4
- <output url="file://$PROJECT_DIR$/out" />
5
- </component>
6
- </project>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" filepath="$PROJECT_DIR$/.idea/paraswap-dex-lib.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -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>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>