@paraswap/dex-lib 3.8.23 → 3.8.25

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 (53) hide show
  1. package/build/abi/infusion/InfusionFactory.json +147 -0
  2. package/build/abi/infusion/InfusionPair.json +658 -0
  3. package/build/abi/infusion/InfusionRouter.json +442 -0
  4. package/build/dex/index.js +4 -0
  5. package/build/dex/index.js.map +1 -1
  6. package/build/dex/infusion/config.d.ts +3 -0
  7. package/build/dex/infusion/config.js +20 -0
  8. package/build/dex/infusion/config.js.map +1 -0
  9. package/build/dex/infusion/infusion-stable-pool.d.ts +4 -0
  10. package/build/dex/infusion/infusion-stable-pool.js +74 -0
  11. package/build/dex/infusion/infusion-stable-pool.js.map +1 -0
  12. package/build/dex/infusion/infusion.d.ts +51 -0
  13. package/build/dex/infusion/infusion.js +457 -0
  14. package/build/dex/infusion/infusion.js.map +1 -0
  15. package/build/dex/infusion/types.d.ts +45 -0
  16. package/build/dex/infusion/types.js +3 -0
  17. package/build/dex/infusion/types.js.map +1 -0
  18. package/build/dex/infusion/utils/isStablePair.d.ts +2 -0
  19. package/build/dex/infusion/utils/isStablePair.js +18 -0
  20. package/build/dex/infusion/utils/isStablePair.js.map +1 -0
  21. package/build/dex/lite-psm/lite-psm.js +2 -5
  22. package/build/dex/lite-psm/lite-psm.js.map +1 -1
  23. package/build/dex/maker-psm/maker-psm.js +2 -6
  24. package/build/dex/maker-psm/maker-psm.js.map +1 -1
  25. package/build/dex/oswap/oswap-pool.js +8 -8
  26. package/build/dex/oswap/oswap-pool.js.map +1 -1
  27. package/build/dex/oswap/oswap.d.ts +5 -5
  28. package/build/dex/oswap/oswap.js +62 -46
  29. package/build/dex/oswap/oswap.js.map +1 -1
  30. package/build/dex/oswap/types.d.ts +4 -4
  31. package/package.json +1 -1
  32. package/src/abi/infusion/InfusionFactory.json +147 -0
  33. package/src/abi/infusion/InfusionPair.json +658 -0
  34. package/src/abi/infusion/InfusionRouter.json +442 -0
  35. package/src/abi/oswap/oswap.abi.json +452 -0
  36. package/src/dex/index.ts +4 -0
  37. package/src/dex/infusion/config.ts +21 -0
  38. package/src/dex/infusion/infusion-e2e.test.ts +110 -0
  39. package/src/dex/infusion/infusion-integration.test.ts +232 -0
  40. package/src/dex/infusion/infusion-stable-pool.ts +91 -0
  41. package/src/dex/infusion/infusion.ts +652 -0
  42. package/src/dex/infusion/types.ts +60 -0
  43. package/src/dex/infusion/utils/isStablePair.ts +18 -0
  44. package/src/dex/lite-psm/lite-psm.ts +2 -5
  45. package/src/dex/maker-psm/maker-psm.ts +2 -6
  46. package/src/dex/oswap/config.ts +32 -0
  47. package/src/dex/oswap/oswap-e2e.test.ts +91 -0
  48. package/src/dex/oswap/oswap-events.test.ts +88 -0
  49. package/src/dex/oswap/oswap-integration.test.ts +291 -0
  50. package/src/dex/oswap/oswap-pool.ts +190 -0
  51. package/src/dex/oswap/oswap.ts +414 -0
  52. package/src/dex/oswap/types.ts +29 -0
  53. package/tests/constants-e2e.ts +1 -1
@@ -0,0 +1,452 @@
1
+ [
2
+ {
3
+ "inputs": [],
4
+ "stateMutability": "nonpayable",
5
+ "type": "constructor"
6
+ },
7
+ {
8
+ "anonymous": false,
9
+ "inputs": [
10
+ {
11
+ "indexed": false,
12
+ "internalType": "address",
13
+ "name": "previousAdmin",
14
+ "type": "address"
15
+ },
16
+ {
17
+ "indexed": false,
18
+ "internalType": "address",
19
+ "name": "newAdmin",
20
+ "type": "address"
21
+ }
22
+ ],
23
+ "name": "AdminChanged",
24
+ "type": "event"
25
+ },
26
+ {
27
+ "anonymous": false,
28
+ "inputs": [
29
+ {
30
+ "indexed": false,
31
+ "internalType": "address",
32
+ "name": "previousAdmin",
33
+ "type": "address"
34
+ },
35
+ {
36
+ "indexed": false,
37
+ "internalType": "address",
38
+ "name": "newAdmin",
39
+ "type": "address"
40
+ }
41
+ ],
42
+ "name": "OperatorChanged",
43
+ "type": "event"
44
+ },
45
+ {
46
+ "anonymous": false,
47
+ "inputs": [
48
+ {
49
+ "indexed": false,
50
+ "internalType": "uint256",
51
+ "name": "traderate0",
52
+ "type": "uint256"
53
+ },
54
+ {
55
+ "indexed": false,
56
+ "internalType": "uint256",
57
+ "name": "traderate1",
58
+ "type": "uint256"
59
+ }
60
+ ],
61
+ "name": "TraderateChanged",
62
+ "type": "event"
63
+ },
64
+ {
65
+ "inputs": [],
66
+ "name": "approveStETH",
67
+ "outputs": [],
68
+ "stateMutability": "nonpayable",
69
+ "type": "function"
70
+ },
71
+ {
72
+ "inputs": [
73
+ {
74
+ "internalType": "uint256[]",
75
+ "name": "requestIds",
76
+ "type": "uint256[]"
77
+ }
78
+ ],
79
+ "name": "claimStETHWithdrawalForETH",
80
+ "outputs": [],
81
+ "stateMutability": "nonpayable",
82
+ "type": "function"
83
+ },
84
+ {
85
+ "inputs": [
86
+ {
87
+ "internalType": "uint256[]",
88
+ "name": "requestIds",
89
+ "type": "uint256[]"
90
+ }
91
+ ],
92
+ "name": "claimStETHWithdrawalForWETH",
93
+ "outputs": [],
94
+ "stateMutability": "nonpayable",
95
+ "type": "function"
96
+ },
97
+ {
98
+ "inputs": [
99
+ {
100
+ "internalType": "uint256",
101
+ "name": "amount",
102
+ "type": "uint256"
103
+ }
104
+ ],
105
+ "name": "depositETHForStETH",
106
+ "outputs": [],
107
+ "stateMutability": "nonpayable",
108
+ "type": "function"
109
+ },
110
+ {
111
+ "inputs": [
112
+ {
113
+ "internalType": "uint256",
114
+ "name": "amount",
115
+ "type": "uint256"
116
+ }
117
+ ],
118
+ "name": "depositWETHForStETH",
119
+ "outputs": [],
120
+ "stateMutability": "nonpayable",
121
+ "type": "function"
122
+ },
123
+ {
124
+ "inputs": [],
125
+ "name": "minimumFunds",
126
+ "outputs": [
127
+ {
128
+ "internalType": "uint256",
129
+ "name": "",
130
+ "type": "uint256"
131
+ }
132
+ ],
133
+ "stateMutability": "view",
134
+ "type": "function"
135
+ },
136
+ {
137
+ "inputs": [],
138
+ "name": "operator",
139
+ "outputs": [
140
+ {
141
+ "internalType": "address",
142
+ "name": "",
143
+ "type": "address"
144
+ }
145
+ ],
146
+ "stateMutability": "view",
147
+ "type": "function"
148
+ },
149
+ {
150
+ "inputs": [],
151
+ "name": "owner",
152
+ "outputs": [
153
+ {
154
+ "internalType": "address",
155
+ "name": "",
156
+ "type": "address"
157
+ }
158
+ ],
159
+ "stateMutability": "view",
160
+ "type": "function"
161
+ },
162
+ {
163
+ "inputs": [
164
+ {
165
+ "internalType": "uint256[]",
166
+ "name": "amounts",
167
+ "type": "uint256[]"
168
+ }
169
+ ],
170
+ "name": "requestStETHWithdrawalForETH",
171
+ "outputs": [
172
+ {
173
+ "internalType": "uint256[]",
174
+ "name": "requestIds",
175
+ "type": "uint256[]"
176
+ }
177
+ ],
178
+ "stateMutability": "nonpayable",
179
+ "type": "function"
180
+ },
181
+ {
182
+ "inputs": [
183
+ {
184
+ "internalType": "uint256",
185
+ "name": "_minimumFunds",
186
+ "type": "uint256"
187
+ }
188
+ ],
189
+ "name": "setMinimumFunds",
190
+ "outputs": [],
191
+ "stateMutability": "nonpayable",
192
+ "type": "function"
193
+ },
194
+ {
195
+ "inputs": [
196
+ {
197
+ "internalType": "address",
198
+ "name": "newOperator",
199
+ "type": "address"
200
+ }
201
+ ],
202
+ "name": "setOperator",
203
+ "outputs": [],
204
+ "stateMutability": "nonpayable",
205
+ "type": "function"
206
+ },
207
+ {
208
+ "inputs": [
209
+ {
210
+ "internalType": "address",
211
+ "name": "newOwner",
212
+ "type": "address"
213
+ }
214
+ ],
215
+ "name": "setOwner",
216
+ "outputs": [],
217
+ "stateMutability": "nonpayable",
218
+ "type": "function"
219
+ },
220
+ {
221
+ "inputs": [
222
+ {
223
+ "internalType": "uint256",
224
+ "name": "buyT1",
225
+ "type": "uint256"
226
+ },
227
+ {
228
+ "internalType": "uint256",
229
+ "name": "sellT1",
230
+ "type": "uint256"
231
+ }
232
+ ],
233
+ "name": "setPrices",
234
+ "outputs": [],
235
+ "stateMutability": "nonpayable",
236
+ "type": "function"
237
+ },
238
+ {
239
+ "inputs": [],
240
+ "name": "steth",
241
+ "outputs": [
242
+ {
243
+ "internalType": "contract IERC20",
244
+ "name": "",
245
+ "type": "address"
246
+ }
247
+ ],
248
+ "stateMutability": "view",
249
+ "type": "function"
250
+ },
251
+ {
252
+ "inputs": [
253
+ {
254
+ "internalType": "uint256",
255
+ "name": "amountIn",
256
+ "type": "uint256"
257
+ },
258
+ {
259
+ "internalType": "uint256",
260
+ "name": "amountOutMin",
261
+ "type": "uint256"
262
+ },
263
+ {
264
+ "internalType": "address[]",
265
+ "name": "path",
266
+ "type": "address[]"
267
+ },
268
+ {
269
+ "internalType": "address",
270
+ "name": "to",
271
+ "type": "address"
272
+ },
273
+ {
274
+ "internalType": "uint256",
275
+ "name": "deadline",
276
+ "type": "uint256"
277
+ }
278
+ ],
279
+ "name": "swapExactTokensForTokens",
280
+ "outputs": [
281
+ {
282
+ "internalType": "uint256[]",
283
+ "name": "amounts",
284
+ "type": "uint256[]"
285
+ }
286
+ ],
287
+ "stateMutability": "nonpayable",
288
+ "type": "function"
289
+ },
290
+ {
291
+ "inputs": [
292
+ {
293
+ "internalType": "uint256",
294
+ "name": "amountOut",
295
+ "type": "uint256"
296
+ },
297
+ {
298
+ "internalType": "uint256",
299
+ "name": "amountInMax",
300
+ "type": "uint256"
301
+ },
302
+ {
303
+ "internalType": "address[]",
304
+ "name": "path",
305
+ "type": "address[]"
306
+ },
307
+ {
308
+ "internalType": "address",
309
+ "name": "to",
310
+ "type": "address"
311
+ },
312
+ {
313
+ "internalType": "uint256",
314
+ "name": "deadline",
315
+ "type": "uint256"
316
+ }
317
+ ],
318
+ "name": "swapTokensForExactTokens",
319
+ "outputs": [
320
+ {
321
+ "internalType": "uint256[]",
322
+ "name": "amounts",
323
+ "type": "uint256[]"
324
+ }
325
+ ],
326
+ "stateMutability": "nonpayable",
327
+ "type": "function"
328
+ },
329
+ {
330
+ "inputs": [],
331
+ "name": "token0",
332
+ "outputs": [
333
+ {
334
+ "internalType": "contract IERC20",
335
+ "name": "",
336
+ "type": "address"
337
+ }
338
+ ],
339
+ "stateMutability": "view",
340
+ "type": "function"
341
+ },
342
+ {
343
+ "inputs": [],
344
+ "name": "token1",
345
+ "outputs": [
346
+ {
347
+ "internalType": "contract IERC20",
348
+ "name": "",
349
+ "type": "address"
350
+ }
351
+ ],
352
+ "stateMutability": "view",
353
+ "type": "function"
354
+ },
355
+ {
356
+ "inputs": [],
357
+ "name": "traderate0",
358
+ "outputs": [
359
+ {
360
+ "internalType": "uint256",
361
+ "name": "",
362
+ "type": "uint256"
363
+ }
364
+ ],
365
+ "stateMutability": "view",
366
+ "type": "function"
367
+ },
368
+ {
369
+ "inputs": [],
370
+ "name": "traderate1",
371
+ "outputs": [
372
+ {
373
+ "internalType": "uint256",
374
+ "name": "",
375
+ "type": "uint256"
376
+ }
377
+ ],
378
+ "stateMutability": "view",
379
+ "type": "function"
380
+ },
381
+ {
382
+ "inputs": [
383
+ {
384
+ "internalType": "address",
385
+ "name": "to",
386
+ "type": "address"
387
+ },
388
+ {
389
+ "internalType": "uint256",
390
+ "name": "amount",
391
+ "type": "uint256"
392
+ }
393
+ ],
394
+ "name": "transferEth",
395
+ "outputs": [],
396
+ "stateMutability": "nonpayable",
397
+ "type": "function"
398
+ },
399
+ {
400
+ "inputs": [
401
+ {
402
+ "internalType": "address",
403
+ "name": "token",
404
+ "type": "address"
405
+ },
406
+ {
407
+ "internalType": "address",
408
+ "name": "to",
409
+ "type": "address"
410
+ },
411
+ {
412
+ "internalType": "uint256",
413
+ "name": "amount",
414
+ "type": "uint256"
415
+ }
416
+ ],
417
+ "name": "transferToken",
418
+ "outputs": [],
419
+ "stateMutability": "nonpayable",
420
+ "type": "function"
421
+ },
422
+ {
423
+ "inputs": [],
424
+ "name": "weth",
425
+ "outputs": [
426
+ {
427
+ "internalType": "contract IWEth",
428
+ "name": "",
429
+ "type": "address"
430
+ }
431
+ ],
432
+ "stateMutability": "view",
433
+ "type": "function"
434
+ },
435
+ {
436
+ "inputs": [],
437
+ "name": "withdrawal",
438
+ "outputs": [
439
+ {
440
+ "internalType": "contract IStETHWithdrawal",
441
+ "name": "",
442
+ "type": "address"
443
+ }
444
+ ],
445
+ "stateMutability": "view",
446
+ "type": "function"
447
+ },
448
+ {
449
+ "stateMutability": "payable",
450
+ "type": "receive"
451
+ }
452
+ ]
package/src/dex/index.ts CHANGED
@@ -60,6 +60,7 @@ import { GenericRFQ } from './generic-rfq/generic-rfq';
60
60
  import { WstETH } from './wsteth/wsteth';
61
61
  import { Camelot } from './camelot/camelot';
62
62
  import { Hashflow } from './hashflow/hashflow';
63
+ import { Infusion } from './infusion/infusion';
63
64
  import { SolidlyEthereum } from './solidly/solidly-ethereum';
64
65
  import { MaverickV1 } from './maverick-v1/maverick-v1';
65
66
  import { MaverickV2 } from './maverick-v2/maverick-v2';
@@ -82,6 +83,7 @@ import { EtherFi } from './etherfi';
82
83
  import { Spark } from './spark/spark';
83
84
  import { VelodromeSlipstream } from './uniswap-v3/forks/velodrome-slipstream/velodrome-slipstream';
84
85
  import { AaveV3Stata } from './aave-v3-stata/aave-v3-stata';
86
+ import { OSwap } from './oswap/oswap';
85
87
  import { ConcentratorArusd } from './concentrator-arusd/concentrator-arusd';
86
88
  import { FxProtocolRusd } from './fx-protocol-rusd/fx-protocol-rusd';
87
89
  import { LitePsm } from './lite-psm/lite-psm';
@@ -148,6 +150,7 @@ const Dexes = [
148
150
  CurveV1StableNg,
149
151
  WstETH,
150
152
  Hashflow,
153
+ Infusion,
151
154
  MaverickV1,
152
155
  MaverickV2,
153
156
  Camelot,
@@ -162,6 +165,7 @@ const Dexes = [
162
165
  PharaohV1,
163
166
  Spark,
164
167
  AaveV3Stata,
168
+ OSwap,
165
169
  ConcentratorArusd,
166
170
  FxProtocolRusd,
167
171
  LitePsm,
@@ -0,0 +1,21 @@
1
+ import { DexParams } from './types';
2
+ import { DexConfigMap, AdapterMappings } from '../../types';
3
+ import { Network, SwapSide } from '../../constants';
4
+
5
+ export const InfusionConfig: DexConfigMap<DexParams> = {
6
+ Infusion: {
7
+ [Network.BASE]: {
8
+ subgraphURL:
9
+ 'https://api.goldsky.com/api/public/project_clvn0ei0x2qro0130fpihh83o/subgraphs/infusion-subgraph/1.0.0/gn',
10
+ factoryAddress: '0x2D9A3a2bd6400eE28d770c7254cA840c82faf23f',
11
+ router: '0x1E891C9F96DcA29Da8B97bE3403D16135EBe8028',
12
+ initCode:
13
+ '0xc1ac28b1c4ebe53c0cff67bab5878c4eb68759bb1e9f73977cd266b247d149f0',
14
+ // updatable fees on the factory without event
15
+ stableFee: 2,
16
+ volatileFee: 2,
17
+ poolGasCost: 180 * 1000,
18
+ feeCode: 2,
19
+ },
20
+ },
21
+ };
@@ -0,0 +1,110 @@
1
+ /* eslint-disable no-console */
2
+ import dotenv from 'dotenv';
3
+ dotenv.config();
4
+
5
+ import { testE2E } from '../../../tests/utils-e2e';
6
+ import {
7
+ Tokens,
8
+ Holders,
9
+ NativeTokenSymbols,
10
+ } from '../../../tests/constants-e2e';
11
+ import { Network, ContractMethod, SwapSide } from '../../constants';
12
+ import { StaticJsonRpcProvider } from '@ethersproject/providers';
13
+ import { generateConfig } from '../../config';
14
+
15
+ describe('Infusion E2E', () => {
16
+ describe('Base', () => {
17
+ const network = Network.BASE;
18
+ const tokens = Tokens[network];
19
+ const holders = Holders[network];
20
+ const provider = new StaticJsonRpcProvider(
21
+ generateConfig(network).privateHttpProvider,
22
+ network,
23
+ );
24
+
25
+ describe('Infusion', () => {
26
+ const dexKey = 'Infusion';
27
+
28
+ describe('swapExactAmountIn', () => {
29
+ it('ETH -> USDC', async () => {
30
+ await testE2E(
31
+ tokens.ETH,
32
+ tokens.USDC,
33
+ holders.ETH,
34
+ '3000000000000000000',
35
+ SwapSide.SELL,
36
+ dexKey,
37
+ ContractMethod.swapExactAmountIn,
38
+ network,
39
+ provider,
40
+ );
41
+ });
42
+ it('USDC -> ETH', async () => {
43
+ await testE2E(
44
+ tokens.USDC,
45
+ tokens.ETH,
46
+ holders.USDC,
47
+ '9900000000',
48
+ SwapSide.SELL,
49
+ dexKey,
50
+ ContractMethod.swapExactAmountIn,
51
+ network,
52
+ provider,
53
+ );
54
+ });
55
+ it('WETH -> USDC', async () => {
56
+ await testE2E(
57
+ tokens.WETH,
58
+ tokens.USDC,
59
+ holders.WETH,
60
+ '3000000000000000000',
61
+ SwapSide.SELL,
62
+ dexKey,
63
+ ContractMethod.swapExactAmountIn,
64
+ network,
65
+ provider,
66
+ );
67
+ });
68
+ it('USDC -> WETH', async () => {
69
+ await testE2E(
70
+ tokens.USDC,
71
+ tokens.WETH,
72
+ holders.USDC,
73
+ '3000000',
74
+ SwapSide.SELL,
75
+ dexKey,
76
+ ContractMethod.swapExactAmountIn,
77
+ network,
78
+ provider,
79
+ );
80
+ });
81
+ it('USDbC -> USDC', async () => {
82
+ await testE2E(
83
+ tokens.USDbC,
84
+ tokens.USDC,
85
+ holders.USDbC,
86
+ '9900000000',
87
+ SwapSide.SELL,
88
+ dexKey,
89
+ ContractMethod.swapExactAmountIn,
90
+ network,
91
+ provider,
92
+ );
93
+ });
94
+ it('USDC -> USDbC', async () => {
95
+ await testE2E(
96
+ tokens.USDC,
97
+ tokens.USDbC,
98
+ holders.USDC,
99
+ '9900000000',
100
+ SwapSide.SELL,
101
+ dexKey,
102
+ ContractMethod.swapExactAmountIn,
103
+ network,
104
+ provider,
105
+ );
106
+ });
107
+ });
108
+ });
109
+ });
110
+ });