@paraswap/dex-lib 3.4.2-balancer-v2-single-swap.0 → 3.4.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 (110) hide show
  1. package/README.md +377 -377
  2. package/build/config.js +9 -5
  3. package/build/config.js.map +1 -1
  4. package/build/dex/algebra/algebra.js +25 -25
  5. package/build/dex/balancer-v1/balancer-v1.js +34 -34
  6. package/build/dex/balancer-v2/balancer-v2.d.ts +1 -1
  7. package/build/dex/balancer-v2/balancer-v2.js +65 -78
  8. package/build/dex/balancer-v2/balancer-v2.js.map +1 -1
  9. package/build/dex/camelot/camelot.js +27 -27
  10. package/build/dex/kyberdmm/kyberdmm.js +27 -27
  11. package/build/dex/pancakeswap-v3/pancakeswap-v3.js +25 -25
  12. package/build/dex/solidly/solidly.js +27 -27
  13. package/build/dex/solidly-v3/solidly-v3.js +25 -25
  14. package/build/dex/swaap-v2/config.js +15 -0
  15. package/build/dex/swaap-v2/config.js.map +1 -1
  16. package/build/dex/uniswap-v2/uniswap-v2.js +26 -26
  17. package/build/dex/uniswap-v3/uniswap-v3.js +25 -25
  18. package/funding.json +5 -5
  19. package/package.json +1 -1
  20. package/src/config.ts +500 -496
  21. package/src/constants.ts +67 -67
  22. package/src/dex/aave-v2/aave-v2.ts +409 -409
  23. package/src/dex/aave-v3/aave-v3.ts +320 -320
  24. package/src/dex/algebra/algebra.ts +1180 -1180
  25. package/src/dex/angle-staked-stable/angle-staked-stable.ts +347 -347
  26. package/src/dex/augustus-rfq.ts +180 -180
  27. package/src/dex/bProtocol/bProtocol.ts +108 -108
  28. package/src/dex/balancer-v1/balancer-v1.ts +572 -572
  29. package/src/dex/balancer-v2/balancer-v2-e2e.test.ts +1699 -1699
  30. package/src/dex/balancer-v2/balancer-v2.ts +1669 -1701
  31. package/src/dex/bancor/bancor.ts +128 -128
  32. package/src/dex/camelot/camelot.ts +873 -873
  33. package/src/dex/compound/compound.ts +107 -107
  34. package/src/dex/curve-v1/config.ts +1179 -1179
  35. package/src/dex/curve-v1/curve-v1-e2e.test.ts +507 -507
  36. package/src/dex/curve-v1/curve-v1.ts +1315 -1315
  37. package/src/dex/curve-v1-factory/config.ts +1018 -1018
  38. package/src/dex/curve-v1-factory/curve-v1-factory.ts +1288 -1288
  39. package/src/dex/curve-v2/curve-v2.ts +440 -440
  40. package/src/dex/dexalot/dexalot.ts +1100 -1100
  41. package/src/dex/dodo-v1/dodo-v1.ts +132 -132
  42. package/src/dex/dodo-v2.ts +266 -266
  43. package/src/dex/etherfi.ts +239 -239
  44. package/src/dex/generic-rfq/generic-rfq.ts +431 -431
  45. package/src/dex/gmx/gmx.ts +321 -321
  46. package/src/dex/hashflow/hashflow.ts +1135 -1135
  47. package/src/dex/idex.ts +254 -254
  48. package/src/dex/index.ts +357 -357
  49. package/src/dex/jarvis-v6/jarvis-v6.ts +509 -509
  50. package/src/dex/jarvis.ts +262 -262
  51. package/src/dex/kyberdmm/kyberdmm.ts +649 -649
  52. package/src/dex/lido/lido.ts +110 -110
  53. package/src/dex/maker-psm/maker-psm.ts +592 -592
  54. package/src/dex/maverick-v1/maverick-v1.ts +537 -537
  55. package/src/dex/nerve/config.ts +635 -635
  56. package/src/dex/nerve/nerve-e2e.test.ts +731 -731
  57. package/src/dex/nerve/nerve-events.test.ts +911 -911
  58. package/src/dex/nerve/nerve.ts +467 -467
  59. package/src/dex/onebit/onebit.ts +113 -113
  60. package/src/dex/pancakeswap-v3/pancakeswap-v3.ts +1150 -1150
  61. package/src/dex/paraswap-limit-orders/config.ts +60 -60
  62. package/src/dex/paraswap-limit-orders/paraswap-limit-orders-e2e.test.ts +137 -137
  63. package/src/dex/paraswap-limit-orders/paraswap-limit-orders-integration.test.ts +328 -328
  64. package/src/dex/paraswap-limit-orders/paraswap-limit-orders.ts +631 -631
  65. package/src/dex/polygon-migrator/polygon-migrator.ts +194 -194
  66. package/src/dex/quick-perps/quick-perps.ts +337 -337
  67. package/src/dex/quickswap/config.ts +16 -16
  68. package/src/dex/quickswap/quickswap-e2e.test.ts +384 -384
  69. package/src/dex/smoothy/smoothy.ts +110 -110
  70. package/src/dex/solidly/config.ts +225 -225
  71. package/src/dex/solidly/solidly-e2e.test.ts +1421 -1421
  72. package/src/dex/solidly/solidly-integration.test.ts +1753 -1753
  73. package/src/dex/solidly/solidly.ts +687 -687
  74. package/src/dex/solidly-v3/solidly-v3.ts +968 -968
  75. package/src/dex/spark/spark.ts +284 -284
  76. package/src/dex/stable-pool/stable-pool.ts +129 -129
  77. package/src/dex/swaap-v2/config.ts +15 -0
  78. package/src/dex/swaap-v2/swaap-v2-e2e.test.ts +233 -17
  79. package/src/dex/swaap-v2/swaap-v2-integration.test.ts +1 -1
  80. package/src/dex/swaap-v2/swaap-v2.ts +1056 -1056
  81. package/src/dex/swell/swell.ts +312 -312
  82. package/src/dex/synthetix/synthetix.ts +420 -420
  83. package/src/dex/trader-joe-v2.1/trader-joe-v2.1.ts +180 -180
  84. package/src/dex/uniswap-v2/config.ts +637 -637
  85. package/src/dex/uniswap-v2/constants.ts +58 -58
  86. package/src/dex/uniswap-v2/uniswap-v2-e2e-avalanche.test.ts +1257 -1257
  87. package/src/dex/uniswap-v2/uniswap-v2-e2e-base.test.ts +42 -42
  88. package/src/dex/uniswap-v2/uniswap-v2-e2e-bsc.test.ts +1295 -1295
  89. package/src/dex/uniswap-v2/uniswap-v2-e2e-mainnet.test.ts +1834 -1834
  90. package/src/dex/uniswap-v2/uniswap-v2-e2e-polygon.test.ts +871 -871
  91. package/src/dex/uniswap-v2/uniswap-v2.ts +1117 -1117
  92. package/src/dex/uniswap-v3/uniswap-v3.ts +1501 -1501
  93. package/src/dex/uniswap-v3.ts +242 -242
  94. package/src/dex/weth/config.ts +73 -73
  95. package/src/dex/weth/weth.ts +230 -230
  96. package/src/dex/wombat/wombat.ts +467 -467
  97. package/src/dex/woo-fi-v2/woo-fi-v2.ts +529 -529
  98. package/src/dex/wsteth/wsteth.ts +304 -304
  99. package/src/dex/zerox/index.ts +328 -328
  100. package/src/executor/Executor01BytecodeBuilder.ts +474 -474
  101. package/src/executor/Executor02BytecodeBuilder.ts +1392 -1392
  102. package/src/executor/ExecutorBytecodeBuilder.ts +390 -390
  103. package/src/executor/ExecutorDetector.ts +131 -131
  104. package/src/executor/constants.ts +66 -66
  105. package/src/executor/executor01-bytecode-builder-e2e.test.ts +1478 -1478
  106. package/src/executor/utils.ts +62 -62
  107. package/src/router/simpleswap.ts +366 -366
  108. package/src/types.ts +342 -342
  109. package/tests/constants-e2e.ts +1632 -1622
  110. package/tests/generate-new-limit-order.ts +107 -107
@@ -1,1834 +1,1834 @@
1
- import dotenv from 'dotenv';
2
- dotenv.config();
3
-
4
- import { testE2E } from '../../../tests/utils-e2e';
5
- import { Tokens, Holders } from '../../../tests/constants-e2e';
6
- import { Network, ContractMethod, SwapSide } from '../../constants';
7
- import { StaticJsonRpcProvider } from '@ethersproject/providers';
8
- import { generateConfig } from '../../config';
9
- import { UniswapV2FunctionsV6 } from './types';
10
-
11
- describe('UniswapV2 E2E Mainnet', () => {
12
- const network = Network.MAINNET;
13
- const tokens = Tokens[network];
14
- const holders = Holders[network];
15
- const provider = new StaticJsonRpcProvider(
16
- generateConfig(network).privateHttpProvider,
17
- network,
18
- );
19
-
20
- describe('UniswapV2', () => {
21
- const dexKey = 'UniswapV2';
22
-
23
- describe('UniswapV2 Simpleswap', () => {
24
- it('USDC -> USDT', async () => {
25
- await testE2E(
26
- tokens.USDC,
27
- tokens.USDT,
28
- holders.USDC,
29
- '1000000',
30
- SwapSide.SELL,
31
- dexKey,
32
- ContractMethod.simpleSwap,
33
- network,
34
- provider,
35
- );
36
- });
37
- it('ETH -> USDC', async () => {
38
- await testE2E(
39
- tokens.ETH,
40
- tokens.USDC,
41
- holders.ETH,
42
- '7000000000000000000',
43
- SwapSide.SELL,
44
- dexKey,
45
- ContractMethod.simpleSwap,
46
- network,
47
- provider,
48
- );
49
- });
50
- it('USDC -> ETH', async () => {
51
- await testE2E(
52
- tokens.USDC,
53
- tokens.ETH,
54
- holders.USDC,
55
- '2000000000',
56
- SwapSide.SELL,
57
- dexKey,
58
- ContractMethod.simpleSwap,
59
- network,
60
- provider,
61
- );
62
- });
63
- it('WBTC -> USDT', async () => {
64
- await testE2E(
65
- tokens.WBTC,
66
- tokens.USDT,
67
- holders.WBTC,
68
- '20000000',
69
- SwapSide.SELL,
70
- dexKey,
71
- ContractMethod.simpleSwap,
72
- network,
73
- provider,
74
- );
75
- });
76
- });
77
-
78
- describe('UniswapV2_special', () => {
79
- describe('SELL_V6', () => {
80
- it('EX1: USDC -> USDT', async () => {
81
- await testE2E(
82
- tokens.USDC,
83
- tokens.USDT,
84
- holders.USDC,
85
- '1000000',
86
- SwapSide.SELL,
87
- dexKey,
88
- ContractMethod.swapExactAmountIn,
89
- network,
90
- provider,
91
- );
92
- });
93
- it('EX1: ETH -> USDC', async () => {
94
- await testE2E(
95
- tokens.ETH,
96
- tokens.USDC,
97
- holders.ETH,
98
- '700000000000000000',
99
- SwapSide.SELL,
100
- dexKey,
101
- ContractMethod.swapExactAmountIn,
102
- network,
103
- provider,
104
- );
105
- });
106
- it('EX1: USDC -> ETH', async () => {
107
- await testE2E(
108
- tokens.USDC,
109
- tokens.ETH,
110
- holders.USDC,
111
- '2000000000',
112
- SwapSide.SELL,
113
- dexKey,
114
- ContractMethod.swapExactAmountIn,
115
- network,
116
- provider,
117
- );
118
- });
119
- it('EX1: WBTC -> USDT', async () => {
120
- await testE2E(
121
- tokens.WBTC,
122
- tokens.USDT,
123
- holders.WBTC,
124
- '20000000',
125
- SwapSide.SELL,
126
- dexKey,
127
- ContractMethod.swapExactAmountIn,
128
- network,
129
- provider,
130
- );
131
- });
132
- it('EX1: PSP -> WETH -> USDT', async () => {
133
- await testE2E(
134
- tokens.PSP,
135
- tokens.USDT,
136
- holders.PSP,
137
- '1000000000000000000',
138
- SwapSide.SELL,
139
- dexKey,
140
- ContractMethod.multiSwap,
141
- network,
142
- provider,
143
- );
144
- });
145
- // TODO: Update: goes through balancer only
146
- // it('EX2: USDT -> USDC', async () => {
147
- // await testE2E(
148
- // tokens.USDT,
149
- // tokens.USDC,
150
- // holders.USDT,
151
- // '1000000000000',
152
- // SwapSide.SELL,
153
- // [dexKey, 'BalancerV2' /* , 'TraderJoeV2.1' 'SolidlyV3'*/],
154
- // ContractMethod.multiSwap,
155
- // network,
156
- // provider,
157
- // );
158
- // });
159
- });
160
- describe('BUY_V6', () => {
161
- it('EX3: USDC -> USDT', async () => {
162
- await testE2E(
163
- tokens.USDC,
164
- tokens.USDT,
165
- holders.USDC,
166
- '1000000',
167
- SwapSide.BUY,
168
- dexKey,
169
- ContractMethod.swapExactAmountOut,
170
- network,
171
- provider,
172
- );
173
- });
174
- it('EX3: ETH -> DAI', async () => {
175
- await testE2E(
176
- tokens.ETH,
177
- tokens.DAI,
178
- holders.ETH,
179
- '7000000000000000',
180
- SwapSide.BUY,
181
- dexKey,
182
- ContractMethod.swapExactAmountOut,
183
- network,
184
- provider,
185
- );
186
- });
187
- it('EX3: USDC -> ETH', async () => {
188
- await testE2E(
189
- tokens.USDC,
190
- tokens.ETH,
191
- holders.USDC,
192
- '2000000000',
193
- SwapSide.BUY,
194
- dexKey,
195
- ContractMethod.swapExactAmountOut,
196
- network,
197
- provider,
198
- );
199
- });
200
- it('EX3: WBTC -> USDT', async () => {
201
- await testE2E(
202
- tokens.WBTC,
203
- tokens.USDT,
204
- holders.WBTC,
205
- '20000000',
206
- SwapSide.BUY,
207
- dexKey,
208
- ContractMethod.swapExactAmountOut,
209
- network,
210
- provider,
211
- );
212
- });
213
- // it('EX3: PSP -> WETH -> USDT', async () => {
214
- // await testE2E(
215
- // tokens.PSP,
216
- // tokens.USDT,
217
- // holders.PSP,
218
- // '1000000000000000000',
219
- // SwapSide.BUY,
220
- // dexKey,
221
- // ContractMethod.multiSwap,
222
- // network,
223
- // provider,
224
- // );
225
- // });
226
- // TODO: Update: goes through balancer only
227
- // it('EX2: USDT -> USDC', async () => {
228
- // await testE2E(
229
- // tokens.USDT,
230
- // tokens.USDC,
231
- // holders.USDT,
232
- // '1000000000000',
233
- // SwapSide.BUY,
234
- // [dexKey, 'BalancerV2' /* , 'TraderJoeV2.1' 'SolidlyV3'*/],
235
- // ContractMethod.multiSwap,
236
- // network,
237
- // provider,
238
- // );
239
- // });
240
- });
241
- });
242
-
243
- describe('Multiswap', () => {
244
- it('ETH -> TOKEN', async () => {
245
- await testE2E(
246
- tokens.ETH,
247
- tokens.WBTC,
248
- holders.ETH,
249
- '7000000000000000',
250
- SwapSide.SELL,
251
- dexKey,
252
- ContractMethod.multiSwap,
253
- network,
254
- provider,
255
- );
256
- });
257
- it('TOKEN -> ETH', async () => {
258
- await testE2E(
259
- tokens.BADGER,
260
- tokens.ETH,
261
- holders.BADGER,
262
- '700000000000000000000',
263
- SwapSide.SELL,
264
- dexKey,
265
- ContractMethod.multiSwap,
266
- network,
267
- provider,
268
- );
269
- });
270
- it('TOKEN -> TOKEN', async () => {
271
- await testE2E(
272
- tokens.USDC,
273
- tokens.WBTC,
274
- holders.USDC,
275
- '200000000',
276
- SwapSide.SELL,
277
- dexKey,
278
- ContractMethod.multiSwap,
279
- network,
280
- provider,
281
- );
282
- });
283
- });
284
-
285
- describe('swapOnUniswap', () => {
286
- it('ETH -> TOKEN', async () => {
287
- await testE2E(
288
- tokens.ETH,
289
- tokens.WBTC,
290
- holders.ETH,
291
- '7000000000000000',
292
- SwapSide.SELL,
293
- dexKey,
294
- ContractMethod.swapOnUniswap,
295
- network,
296
- provider,
297
- );
298
- });
299
- it('TOKEN[BADGER] -> ETH', async () => {
300
- await testE2E(
301
- tokens.BADGER,
302
- tokens.ETH,
303
- holders.BADGER,
304
- '700000000000000000000',
305
- SwapSide.SELL,
306
- dexKey,
307
- ContractMethod.swapOnUniswap,
308
- network,
309
- provider,
310
- );
311
- });
312
- it('TOKEN[USDC] -> ETH', async () => {
313
- await testE2E(
314
- tokens.USDC,
315
- tokens.ETH,
316
- holders.USDC,
317
- '200000000',
318
- SwapSide.SELL,
319
- dexKey,
320
- ContractMethod.swapOnUniswap,
321
- network,
322
- provider,
323
- );
324
- });
325
- it('TOKEN -> TOKEN', async () => {
326
- await testE2E(
327
- tokens.USDC,
328
- tokens.WBTC,
329
- holders.USDC,
330
- '200000000',
331
- SwapSide.SELL,
332
- dexKey,
333
- ContractMethod.swapOnUniswap,
334
- network,
335
- provider,
336
- );
337
- });
338
- });
339
-
340
- describe('swapOnUniswapFork', () => {
341
- it('ETH -> TOKEN', async () => {
342
- await testE2E(
343
- tokens.ETH,
344
- tokens.WBTC,
345
- holders.ETH,
346
- '7000000000000000',
347
- SwapSide.SELL,
348
- dexKey,
349
- ContractMethod.swapOnUniswapFork,
350
- network,
351
- provider,
352
- );
353
- });
354
- it('TOKEN -> ETH', async () => {
355
- await testE2E(
356
- tokens.BADGER,
357
- tokens.ETH,
358
- holders.BADGER,
359
- '700000000000000000000',
360
- SwapSide.SELL,
361
- dexKey,
362
- ContractMethod.swapOnUniswapFork,
363
- network,
364
- provider,
365
- );
366
- });
367
- it('TOKEN -> TOKEN', async () => {
368
- await testE2E(
369
- tokens.USDC,
370
- tokens.WBTC,
371
- holders.USDC,
372
- '200000000',
373
- SwapSide.SELL,
374
- dexKey,
375
- ContractMethod.swapOnUniswapFork,
376
- network,
377
- provider,
378
- );
379
- });
380
- });
381
-
382
- describe('swapOnUniswapV2Fork', () => {
383
- it('ETH -> TOKEN', async () => {
384
- await testE2E(
385
- tokens.ETH,
386
- tokens.WBTC,
387
- holders.ETH,
388
- '7000000000000000',
389
- SwapSide.SELL,
390
- dexKey,
391
- ContractMethod.swapOnUniswapV2Fork,
392
- network,
393
- provider,
394
- );
395
- });
396
- it('TOKEN -> ETH', async () => {
397
- await testE2E(
398
- tokens.BADGER,
399
- tokens.ETH,
400
- holders.BADGER,
401
- '700000000000000000000',
402
- SwapSide.SELL,
403
- dexKey,
404
- ContractMethod.swapOnUniswapV2Fork,
405
- network,
406
- provider,
407
- );
408
- });
409
- it('TOKEN -> TOKEN', async () => {
410
- await testE2E(
411
- tokens.USDC,
412
- tokens.WBTC,
413
- holders.USDC,
414
- '200000000',
415
- SwapSide.SELL,
416
- dexKey,
417
- ContractMethod.swapOnUniswapV2Fork,
418
- network,
419
- provider,
420
- );
421
- });
422
- });
423
-
424
- describe('buyOnUniswap', () => {
425
- it('TOKEN -> ETH', async () => {
426
- await testE2E(
427
- tokens.USDT,
428
- tokens.ETH,
429
- holders.USDT,
430
- '700000000000000000',
431
- SwapSide.BUY,
432
- dexKey,
433
- ContractMethod.buyOnUniswap,
434
- network,
435
- provider,
436
- );
437
- });
438
- it('ETH -> TOKEN[BADGER]', async () => {
439
- await testE2E(
440
- tokens.ETH,
441
- tokens.BADGER,
442
- holders.ETH,
443
- '700000000000000000000',
444
- SwapSide.BUY,
445
- dexKey,
446
- ContractMethod.buyOnUniswap,
447
- network,
448
- provider,
449
- );
450
- });
451
- it('TOKEN[USDC] -> ETH', async () => {
452
- await testE2E(
453
- tokens.USDC,
454
- tokens.ETH,
455
- holders.USDC,
456
- '2000000000000000000',
457
- SwapSide.BUY,
458
- dexKey,
459
- ContractMethod.buyOnUniswap,
460
- network,
461
- provider,
462
- );
463
- });
464
-
465
- it('TOKEN -> TOKEN', async () => {
466
- await testE2E(
467
- tokens.USDC,
468
- tokens.WBTC,
469
- holders.USDC,
470
- '200000000',
471
- SwapSide.BUY,
472
- dexKey,
473
- ContractMethod.buyOnUniswap,
474
- network,
475
- provider,
476
- );
477
- });
478
- });
479
-
480
- describe('buyOnUniswapFork', () => {
481
- it('TOKEN -> ETH', async () => {
482
- await testE2E(
483
- tokens.USDT,
484
- tokens.ETH,
485
- holders.USDT,
486
- '700000000000000000',
487
- SwapSide.BUY,
488
- dexKey,
489
- ContractMethod.buyOnUniswapFork,
490
- network,
491
- provider,
492
- );
493
- });
494
- it('ETH -> TOKEN[BADGER]', async () => {
495
- await testE2E(
496
- tokens.ETH,
497
- tokens.BADGER,
498
- holders.ETH,
499
- '700000000000000000000',
500
- SwapSide.BUY,
501
- dexKey,
502
- ContractMethod.buyOnUniswapFork,
503
- network,
504
- provider,
505
- );
506
- });
507
- it('TOKEN[USDC] -> ETH', async () => {
508
- await testE2E(
509
- tokens.USDC,
510
- tokens.ETH,
511
- holders.USDC,
512
- '2000000000000000000',
513
- SwapSide.BUY,
514
- dexKey,
515
- ContractMethod.buyOnUniswapFork,
516
- network,
517
- provider,
518
- );
519
- });
520
-
521
- it('TOKEN -> TOKEN', async () => {
522
- await testE2E(
523
- tokens.USDC,
524
- tokens.WBTC,
525
- holders.USDC,
526
- '200000000',
527
- SwapSide.BUY,
528
- dexKey,
529
- ContractMethod.buyOnUniswapFork,
530
- network,
531
- provider,
532
- );
533
- });
534
- });
535
-
536
- describe('buyOnUniswapV2Fork', () => {
537
- it('TOKEN -> ETH', async () => {
538
- await testE2E(
539
- tokens.USDT,
540
- tokens.ETH,
541
- holders.USDT,
542
- '700000000000000000',
543
- SwapSide.BUY,
544
- dexKey,
545
- ContractMethod.buyOnUniswapV2Fork,
546
- network,
547
- provider,
548
- );
549
- });
550
- it('ETH -> TOKEN[BADGER]', async () => {
551
- await testE2E(
552
- tokens.ETH,
553
- tokens.BADGER,
554
- holders.ETH,
555
- '700000000000000000000',
556
- SwapSide.BUY,
557
- dexKey,
558
- ContractMethod.buyOnUniswapV2Fork,
559
- network,
560
- provider,
561
- );
562
- });
563
- it('TOKEN[USDC] -> ETH', async () => {
564
- await testE2E(
565
- tokens.USDC,
566
- tokens.ETH,
567
- holders.USDC,
568
- '2000000000000000000',
569
- SwapSide.BUY,
570
- dexKey,
571
- ContractMethod.buyOnUniswapV2Fork,
572
- network,
573
- provider,
574
- );
575
- });
576
-
577
- it('TOKEN -> TOKEN', async () => {
578
- await testE2E(
579
- tokens.USDC,
580
- tokens.WBTC,
581
- holders.USDC,
582
- '200000000',
583
- SwapSide.BUY,
584
- dexKey,
585
- ContractMethod.buyOnUniswapV2Fork,
586
- network,
587
- provider,
588
- );
589
- });
590
- });
591
-
592
- describe('simpleBuy', () => {
593
- it('TOKEN -> ETH', async () => {
594
- await testE2E(
595
- tokens.USDT,
596
- tokens.ETH,
597
- holders.USDT,
598
- '700000000000000000',
599
- SwapSide.BUY,
600
- dexKey,
601
- ContractMethod.simpleBuy,
602
- network,
603
- provider,
604
- );
605
- });
606
- it('ETH -> TOKEN[BADGER]', async () => {
607
- await testE2E(
608
- tokens.ETH,
609
- tokens.BADGER,
610
- holders.ETH,
611
- '700000000000000000000',
612
- SwapSide.BUY,
613
- dexKey,
614
- ContractMethod.simpleBuy,
615
- network,
616
- provider,
617
- );
618
- });
619
- it('TOKEN[USDC] -> ETH', async () => {
620
- await testE2E(
621
- tokens.USDC,
622
- tokens.ETH,
623
- holders.USDC,
624
- '2000000000000000000',
625
- SwapSide.BUY,
626
- dexKey,
627
- ContractMethod.simpleBuy,
628
- network,
629
- provider,
630
- );
631
- });
632
- it('TOKEN -> TOKEN', async () => {
633
- await testE2E(
634
- tokens.USDC,
635
- tokens.WBTC,
636
- holders.USDC,
637
- '20000000',
638
- SwapSide.BUY,
639
- dexKey,
640
- ContractMethod.simpleBuy,
641
- network,
642
- provider,
643
- );
644
- });
645
- });
646
-
647
- describe('BuyMethod', () => {
648
- it('TOKEN -> ETH', async () => {
649
- await testE2E(
650
- tokens.USDT,
651
- tokens.ETH,
652
- holders.USDT,
653
- '700000000000000000',
654
- SwapSide.BUY,
655
- dexKey,
656
- ContractMethod.buy,
657
- network,
658
- provider,
659
- );
660
- });
661
- it('ETH -> TOKEN[BADGER]', async () => {
662
- await testE2E(
663
- tokens.ETH,
664
- tokens.BADGER,
665
- holders.ETH,
666
- '700000000000000000000',
667
- SwapSide.BUY,
668
- dexKey,
669
- ContractMethod.buy,
670
- network,
671
- provider,
672
- );
673
- });
674
- it('TOKEN[USDC] -> ETH', async () => {
675
- await testE2E(
676
- tokens.USDC,
677
- tokens.ETH,
678
- holders.USDC,
679
- '2000000000000000000',
680
- SwapSide.BUY,
681
- dexKey,
682
- ContractMethod.buy,
683
- network,
684
- provider,
685
- );
686
- });
687
- it('TOKEN -> TOKEN', async () => {
688
- await testE2E(
689
- tokens.USDC,
690
- tokens.WBTC,
691
- holders.USDC,
692
- '20000000',
693
- SwapSide.BUY,
694
- dexKey,
695
- ContractMethod.buy,
696
- network,
697
- provider,
698
- );
699
- });
700
- });
701
-
702
- describe('STETH->ETH', () => {
703
- it('simpleSwap', async () => {
704
- await testE2E(
705
- tokens.STETH,
706
- tokens.ETH,
707
- holders.STETH,
708
- '1000000000000000000',
709
- SwapSide.SELL,
710
- dexKey,
711
- ContractMethod.simpleSwap,
712
- network,
713
- provider,
714
- );
715
- });
716
- it('multiSwap', async () => {
717
- await testE2E(
718
- tokens.STETH,
719
- tokens.ETH,
720
- holders.STETH,
721
- '1000000000000000000',
722
- SwapSide.SELL,
723
- dexKey,
724
- ContractMethod.multiSwap,
725
- network,
726
- provider,
727
- );
728
- });
729
- it('megaSwap', async () => {
730
- await testE2E(
731
- tokens.STETH,
732
- tokens.ETH,
733
- holders.STETH,
734
- '1000000000000000000',
735
- SwapSide.SELL,
736
- dexKey,
737
- ContractMethod.megaSwap,
738
- network,
739
- provider,
740
- );
741
- });
742
- });
743
-
744
- describe('V6_swapExactAmountInOnUniswapV2', () => {
745
- it('WETH -> WBTC', async () => {
746
- await testE2E(
747
- tokens.WETH,
748
- tokens.WBTC,
749
- holders.WETH,
750
- '7000000000000000',
751
- SwapSide.SELL,
752
- dexKey,
753
- ContractMethod.swapExactAmountInOnUniswapV2,
754
- network,
755
- provider,
756
- );
757
- });
758
- it('WETH (amountIn=1000000000000) -> WBTC', async () => {
759
- await testE2E(
760
- tokens.WETH,
761
- tokens.WBTC,
762
- holders.WETH,
763
- '1000000000000',
764
- SwapSide.SELL,
765
- dexKey,
766
- ContractMethod.swapExactAmountInOnUniswapV2,
767
- network,
768
- provider,
769
- );
770
- });
771
- it('WBTC -> WETH', async () => {
772
- await testE2E(
773
- tokens.WBTC,
774
- tokens.WETH,
775
- holders.WBTC,
776
- '100000',
777
- SwapSide.SELL,
778
- dexKey,
779
- ContractMethod.swapExactAmountInOnUniswapV2,
780
- network,
781
- provider,
782
- );
783
- });
784
- it('ETH -> WBTC', async () => {
785
- await testE2E(
786
- tokens.ETH,
787
- tokens.WBTC,
788
- holders.ETH,
789
- '7000000000000000',
790
- SwapSide.SELL,
791
- dexKey,
792
- ContractMethod.swapExactAmountInOnUniswapV2,
793
- network,
794
- provider,
795
- );
796
- });
797
- it('WBTC -> ETH', async () => {
798
- await testE2E(
799
- tokens.WBTC,
800
- tokens.ETH,
801
- holders.WBTC,
802
- '100000',
803
- SwapSide.SELL,
804
- dexKey,
805
- ContractMethod.swapExactAmountInOnUniswapV2,
806
- network,
807
- provider,
808
- );
809
- });
810
- it('USDC -> WBTC', async () => {
811
- await testE2E(
812
- tokens.USDC,
813
- tokens.WBTC,
814
- holders.USDC,
815
- '200000000',
816
- SwapSide.SELL,
817
- dexKey,
818
- ContractMethod.swapExactAmountInOnUniswapV2,
819
- network,
820
- provider,
821
- );
822
- });
823
- it('WBTC -> USDC', async () => {
824
- await testE2E(
825
- tokens.WBTC,
826
- tokens.USDC,
827
- holders.WBTC,
828
- '100000',
829
- SwapSide.SELL,
830
- dexKey,
831
- ContractMethod.swapExactAmountInOnUniswapV2,
832
- network,
833
- provider,
834
- );
835
- });
836
- it('USDT -> USDC', async () => {
837
- await testE2E(
838
- tokens.USDT,
839
- tokens.USDC,
840
- holders.USDT,
841
- '100000',
842
- SwapSide.SELL,
843
- dexKey,
844
- ContractMethod.swapExactAmountInOnUniswapV2,
845
- network,
846
- provider,
847
- );
848
- });
849
- it('USDC -> USDT', async () => {
850
- await testE2E(
851
- tokens.USDC,
852
- tokens.USDT,
853
- holders.USDC,
854
- '100000',
855
- SwapSide.SELL,
856
- dexKey,
857
- ContractMethod.swapExactAmountInOnUniswapV2,
858
- network,
859
- provider,
860
- );
861
- });
862
- });
863
-
864
- describe('V6_swapExactAmountOutOnUniswapV2', () => {
865
- it('WETH -> WBTC', async () => {
866
- await testE2E(
867
- tokens.WETH,
868
- tokens.WBTC,
869
- holders.WETH,
870
- '1000000',
871
- SwapSide.BUY,
872
- dexKey,
873
- ContractMethod.swapExactAmountOutOnUniswapV2,
874
- network,
875
- provider,
876
- );
877
- });
878
- it('WBTC -> WETH', async () => {
879
- await testE2E(
880
- tokens.WBTC,
881
- tokens.WETH,
882
- holders.WBTC,
883
- '7000000000000000',
884
- SwapSide.BUY,
885
- dexKey,
886
- ContractMethod.swapExactAmountOutOnUniswapV2,
887
- network,
888
- provider,
889
- );
890
- });
891
- it('WBTC -> WETH (amountOut=1000000)', async () => {
892
- await testE2E(
893
- tokens.WBTC,
894
- tokens.WETH,
895
- holders.WBTC,
896
- '7000000000000000',
897
- SwapSide.BUY,
898
- dexKey,
899
- ContractMethod.swapExactAmountOutOnUniswapV2,
900
- network,
901
- provider,
902
- );
903
- });
904
- it('ETH -> WBTC', async () => {
905
- await testE2E(
906
- tokens.ETH,
907
- tokens.WBTC,
908
- holders.ETH,
909
- '1000000',
910
- SwapSide.BUY,
911
- dexKey,
912
- ContractMethod.swapExactAmountOutOnUniswapV2,
913
- network,
914
- provider,
915
- );
916
- });
917
- it('WBTC -> ETH ', async () => {
918
- await testE2E(
919
- tokens.WBTC,
920
- tokens.ETH,
921
- holders.WBTC,
922
- '7000000000000000',
923
- SwapSide.BUY,
924
- dexKey,
925
- ContractMethod.swapExactAmountOutOnUniswapV2,
926
- network,
927
- provider,
928
- );
929
- });
930
- it('USDC -> WBTC', async () => {
931
- await testE2E(
932
- tokens.USDC,
933
- tokens.WBTC,
934
- holders.USDC,
935
- '20000',
936
- SwapSide.BUY,
937
- dexKey,
938
- ContractMethod.swapExactAmountOutOnUniswapV2,
939
- network,
940
- provider,
941
- );
942
- });
943
- it('WBTC -> USDC', async () => {
944
- await testE2E(
945
- tokens.WBTC,
946
- tokens.USDC,
947
- holders.WBTC,
948
- '1000000',
949
- SwapSide.BUY,
950
- dexKey,
951
- ContractMethod.swapExactAmountOutOnUniswapV2,
952
- network,
953
- provider,
954
- );
955
- });
956
- it('USDT -> USDC', async () => {
957
- await testE2E(
958
- tokens.USDT,
959
- tokens.USDC,
960
- holders.USDT,
961
- '1000000',
962
- SwapSide.BUY,
963
- dexKey,
964
- ContractMethod.swapExactAmountOutOnUniswapV2,
965
- network,
966
- provider,
967
- );
968
- });
969
- it('USDC -> USDT', async () => {
970
- await testE2E(
971
- tokens.USDC,
972
- tokens.USDT,
973
- holders.USDC,
974
- '1000000',
975
- SwapSide.BUY,
976
- dexKey,
977
- ContractMethod.swapExactAmountOutOnUniswapV2,
978
- network,
979
- provider,
980
- );
981
- });
982
- });
983
- });
984
-
985
- describe('SushiSwap', () => {
986
- const dexKey = 'SushiSwap';
987
-
988
- describe('Simpleswap', () => {
989
- it('SushiSwap ETH -> TOKEN', async () => {
990
- await testE2E(
991
- tokens.ETH,
992
- tokens.USDC,
993
- holders.ETH,
994
- '7000000000000000000',
995
- SwapSide.SELL,
996
- dexKey,
997
- ContractMethod.simpleSwap,
998
- network,
999
- provider,
1000
- );
1001
- });
1002
- it('SushiSwap TOKEN -> ETH', async () => {
1003
- await testE2E(
1004
- tokens.USDC,
1005
- tokens.ETH,
1006
- holders.USDC,
1007
- '2000000000',
1008
- SwapSide.SELL,
1009
- dexKey,
1010
- ContractMethod.simpleSwap,
1011
- network,
1012
- provider,
1013
- );
1014
- });
1015
- it('SushiSwap TOKEN -> TOKEN', async () => {
1016
- await testE2E(
1017
- tokens.WBTC,
1018
- tokens.BADGER,
1019
- holders.WBTC,
1020
- '20000000',
1021
- SwapSide.SELL,
1022
- dexKey,
1023
- ContractMethod.simpleSwap,
1024
- network,
1025
- provider,
1026
- );
1027
- });
1028
- });
1029
-
1030
- describe('MultiSwap', () => {
1031
- it('SushiSwap ETH -> TOKEN', async () => {
1032
- await testE2E(
1033
- tokens.ETH,
1034
- tokens.WBTC,
1035
- holders.ETH,
1036
- '7000000000000000',
1037
- SwapSide.SELL,
1038
- dexKey,
1039
- ContractMethod.multiSwap,
1040
- network,
1041
- provider,
1042
- );
1043
- });
1044
- it('SushiSwap TOKEN -> ETH', async () => {
1045
- await testE2E(
1046
- tokens.BADGER,
1047
- tokens.ETH,
1048
- holders.BADGER,
1049
- '700000000000000000000',
1050
- SwapSide.SELL,
1051
- dexKey,
1052
- ContractMethod.multiSwap,
1053
- network,
1054
- provider,
1055
- );
1056
- });
1057
- it('SushiSwap TOKEN -> TOKEN', async () => {
1058
- await testE2E(
1059
- tokens.USDT,
1060
- tokens.WBTC,
1061
- holders.USDT,
1062
- '200000000',
1063
- SwapSide.SELL,
1064
- dexKey,
1065
- ContractMethod.multiSwap,
1066
- network,
1067
- provider,
1068
- );
1069
- });
1070
- });
1071
-
1072
- describe('swapOnUniswapFork', () => {
1073
- it('SushiSwap ETH -> TOKEN', async () => {
1074
- await testE2E(
1075
- tokens.ETH,
1076
- tokens.WBTC,
1077
- holders.ETH,
1078
- '7000000000000000',
1079
- SwapSide.SELL,
1080
- dexKey,
1081
- ContractMethod.swapOnUniswapFork,
1082
- network,
1083
- provider,
1084
- );
1085
- });
1086
- it('SushiSwap TOKEN -> ETH', async () => {
1087
- await testE2E(
1088
- tokens.BADGER,
1089
- tokens.ETH,
1090
- holders.BADGER,
1091
- '700000000000000000000',
1092
- SwapSide.SELL,
1093
- dexKey,
1094
- ContractMethod.swapOnUniswapFork,
1095
- network,
1096
- provider,
1097
- );
1098
- });
1099
- it('SushiSwap TOKEN -> TOKEN', async () => {
1100
- await testE2E(
1101
- tokens.USDT,
1102
- tokens.WBTC,
1103
- holders.USDT,
1104
- '2000000',
1105
- SwapSide.SELL,
1106
- dexKey,
1107
- ContractMethod.swapOnUniswapFork,
1108
- network,
1109
- provider,
1110
- );
1111
- });
1112
- });
1113
- describe('swapOnUniswapV2Fork', () => {
1114
- it('SAITAMA -> ETH', async () => {
1115
- await testE2E(
1116
- tokens.SAITAMA,
1117
- tokens.ETH,
1118
- holders.SAITAMA,
1119
- '11111111111000000000',
1120
- SwapSide.SELL,
1121
- dexKey,
1122
- ContractMethod.swapOnUniswapV2Fork,
1123
- network,
1124
- provider,
1125
- );
1126
- });
1127
- it('ETH -> SAITAMA', async () => {
1128
- await testE2E(
1129
- tokens.ETH,
1130
- tokens.SAITAMA,
1131
- holders.ETH,
1132
- '11111111111000000000',
1133
- SwapSide.SELL,
1134
- dexKey,
1135
- ContractMethod.swapOnUniswapV2Fork,
1136
- network,
1137
- provider,
1138
- );
1139
- });
1140
- });
1141
- describe('buyOnUniswapV2Fork', () => {
1142
- it('SAITAMA -> ETH', async () => {
1143
- await testE2E(
1144
- tokens.SAITAMA,
1145
- tokens.ETH,
1146
- holders.SAITAMA,
1147
- '60000000000000000',
1148
- SwapSide.BUY,
1149
- dexKey,
1150
- ContractMethod.buyOnUniswapV2Fork,
1151
- network,
1152
- provider,
1153
- );
1154
- });
1155
- it('ETH -> SAITAMA', async () => {
1156
- await testE2E(
1157
- tokens.ETH,
1158
- tokens.SAITAMA,
1159
- holders.ETH,
1160
- '11111111111000000000',
1161
- SwapSide.BUY,
1162
- dexKey,
1163
- ContractMethod.buyOnUniswapV2Fork,
1164
- network,
1165
- provider,
1166
- );
1167
- });
1168
- });
1169
- });
1170
-
1171
- describe('DefiSwap', () => {
1172
- const dexKey = 'DefiSwap';
1173
-
1174
- describe('Simpleswap', () => {
1175
- it('DefiSwap ETH -> TOKEN', async () => {
1176
- await testE2E(
1177
- tokens.ETH,
1178
- tokens.USDC,
1179
- holders.ETH,
1180
- '7000000000000000000',
1181
- SwapSide.SELL,
1182
- dexKey,
1183
- ContractMethod.simpleSwap,
1184
- network,
1185
- provider,
1186
- );
1187
- });
1188
- it('DefiSwap TOKEN -> ETH', async () => {
1189
- await testE2E(
1190
- tokens.USDC,
1191
- tokens.ETH,
1192
- holders.USDC,
1193
- '2000000000',
1194
- SwapSide.SELL,
1195
- dexKey,
1196
- ContractMethod.simpleSwap,
1197
- network,
1198
- provider,
1199
- );
1200
- });
1201
- it('DefiSwap TOKEN -> TOKEN', async () => {
1202
- await testE2E(
1203
- tokens.WBTC,
1204
- tokens.renBTC,
1205
- holders.WBTC,
1206
- '20000000',
1207
- SwapSide.SELL,
1208
- dexKey,
1209
- ContractMethod.simpleSwap,
1210
- network,
1211
- provider,
1212
- );
1213
- });
1214
- });
1215
-
1216
- describe('Multiswap', () => {
1217
- it('DefiSwap ETH -> TOKEN', async () => {
1218
- await testE2E(
1219
- tokens.ETH,
1220
- tokens.WBTC,
1221
- holders.ETH,
1222
- '7000000000000000',
1223
- SwapSide.SELL,
1224
- dexKey,
1225
- ContractMethod.multiSwap,
1226
- network,
1227
- provider,
1228
- );
1229
- });
1230
- it('DefiSwap TOKEN -> ETH', async () => {
1231
- await testE2E(
1232
- tokens.LINK,
1233
- tokens.ETH,
1234
- holders.LINK,
1235
- '700000000000000000000',
1236
- SwapSide.SELL,
1237
- dexKey,
1238
- ContractMethod.multiSwap,
1239
- network,
1240
- provider,
1241
- );
1242
- });
1243
- it('DefiSwap TOKEN -> TOKEN', async () => {
1244
- await testE2E(
1245
- tokens.USDC,
1246
- tokens.WBTC,
1247
- holders.USDC,
1248
- '200000000',
1249
- SwapSide.SELL,
1250
- dexKey,
1251
- ContractMethod.multiSwap,
1252
- network,
1253
- provider,
1254
- );
1255
- });
1256
- });
1257
-
1258
- describe('swapOnUniswapFork', () => {
1259
- it('DefiSwap ETH -> TOKEN', async () => {
1260
- await testE2E(
1261
- tokens.ETH,
1262
- tokens.WBTC,
1263
- holders.ETH,
1264
- '7000000000000000',
1265
- SwapSide.SELL,
1266
- dexKey,
1267
- ContractMethod.swapOnUniswapFork,
1268
- network,
1269
- provider,
1270
- );
1271
- });
1272
- it('DefiSwap TOKEN -> ETH', async () => {
1273
- await testE2E(
1274
- tokens.LINK,
1275
- tokens.ETH,
1276
- holders.LINK,
1277
- '700000000000000000000',
1278
- SwapSide.SELL,
1279
- dexKey,
1280
- ContractMethod.swapOnUniswapFork,
1281
- network,
1282
- provider,
1283
- );
1284
- });
1285
- it('DefiSwap TOKEN -> TOKEN', async () => {
1286
- await testE2E(
1287
- tokens.USDC,
1288
- tokens.WBTC,
1289
- holders.USDC,
1290
- '200000000',
1291
- SwapSide.SELL,
1292
- dexKey,
1293
- ContractMethod.swapOnUniswapFork,
1294
- network,
1295
- provider,
1296
- );
1297
- });
1298
- });
1299
- });
1300
-
1301
- describe('Verse', () => {
1302
- const dexKey = 'Verse';
1303
-
1304
- describe('Simpleswap', () => {
1305
- it('TOKEN -> ETH', async () => {
1306
- await testE2E(
1307
- tokens.USDT,
1308
- tokens.ETH,
1309
- holders.USDT,
1310
- '2000000',
1311
- SwapSide.SELL,
1312
- dexKey,
1313
- ContractMethod.simpleSwap,
1314
- network,
1315
- provider,
1316
- );
1317
- });
1318
- it('ETH -> TOKEN', async () => {
1319
- await testE2E(
1320
- tokens.ETH,
1321
- tokens.USDT,
1322
- holders.ETH,
1323
- '1000000000000000',
1324
- SwapSide.SELL,
1325
- dexKey,
1326
- ContractMethod.simpleSwap,
1327
- network,
1328
- provider,
1329
- );
1330
- });
1331
- it('TOKEN -> TOKEN', async () => {
1332
- await testE2E(
1333
- tokens.WETH,
1334
- tokens.USDT,
1335
- holders.WETH,
1336
- '100000000000000',
1337
- SwapSide.SELL,
1338
- dexKey,
1339
- ContractMethod.simpleSwap,
1340
- network,
1341
- provider,
1342
- );
1343
- });
1344
- });
1345
-
1346
- describe('Multiswap', () => {
1347
- it('TOKEN -> ETH', async () => {
1348
- await testE2E(
1349
- tokens.USDT,
1350
- tokens.ETH,
1351
- holders.USDT,
1352
- '20000000',
1353
- SwapSide.SELL,
1354
- dexKey,
1355
- ContractMethod.multiSwap,
1356
- network,
1357
- provider,
1358
- );
1359
- });
1360
- it('ETH -> TOKEN', async () => {
1361
- await testE2E(
1362
- tokens.ETH,
1363
- tokens.USDT,
1364
- holders.ETH,
1365
- '1000000000000',
1366
- SwapSide.SELL,
1367
- dexKey,
1368
- ContractMethod.multiSwap,
1369
- network,
1370
- provider,
1371
- );
1372
- });
1373
- it('TOKEN -> TOKEN', async () => {
1374
- await testE2E(
1375
- tokens.USDC,
1376
- tokens.USDT,
1377
- holders.USDC,
1378
- '50000000',
1379
- SwapSide.SELL,
1380
- dexKey,
1381
- ContractMethod.multiSwap,
1382
- network,
1383
- provider,
1384
- );
1385
- });
1386
- });
1387
-
1388
- describe('Megaswap', () => {
1389
- it('TOKEN -> ETH', async () => {
1390
- await testE2E(
1391
- tokens.USDT,
1392
- tokens.ETH,
1393
- holders.USDT,
1394
- '20000000',
1395
- SwapSide.SELL,
1396
- dexKey,
1397
- ContractMethod.megaSwap,
1398
- network,
1399
- provider,
1400
- );
1401
- });
1402
- it('ETH -> TOKEN', async () => {
1403
- await testE2E(
1404
- tokens.ETH,
1405
- tokens.USDT,
1406
- holders.ETH,
1407
- '1000000000000',
1408
- SwapSide.SELL,
1409
- dexKey,
1410
- ContractMethod.megaSwap,
1411
- network,
1412
- provider,
1413
- );
1414
- });
1415
- it('TOKEN -> TOKEN', async () => {
1416
- await testE2E(
1417
- tokens.USDC,
1418
- tokens.USDT,
1419
- holders.USDC,
1420
- '50000000',
1421
- SwapSide.SELL,
1422
- dexKey,
1423
- ContractMethod.megaSwap,
1424
- network,
1425
- provider,
1426
- );
1427
- });
1428
- });
1429
- });
1430
-
1431
- describe('ShibaSwap', () => {
1432
- const dexKey = 'ShibaSwap';
1433
-
1434
- describe('Simpleswap', () => {
1435
- it('TOKEN -> ETH', async () => {
1436
- await testE2E(
1437
- tokens.USDT,
1438
- tokens.ETH,
1439
- holders.USDT,
1440
- '20000000',
1441
- SwapSide.SELL,
1442
- dexKey,
1443
- ContractMethod.simpleSwap,
1444
- network,
1445
- provider,
1446
- );
1447
- });
1448
- it('ETH -> TOKEN', async () => {
1449
- await testE2E(
1450
- tokens.ETH,
1451
- tokens.USDT,
1452
- holders.ETH,
1453
- '1000000000000000000',
1454
- SwapSide.SELL,
1455
- dexKey,
1456
- ContractMethod.simpleSwap,
1457
- network,
1458
- provider,
1459
- );
1460
- });
1461
- it('TOKEN -> TOKEN', async () => {
1462
- await testE2E(
1463
- tokens.WETH,
1464
- tokens.USDT,
1465
- holders.WETH,
1466
- '1000000000000000000',
1467
- SwapSide.SELL,
1468
- dexKey,
1469
- ContractMethod.simpleSwap,
1470
- network,
1471
- provider,
1472
- );
1473
- });
1474
- });
1475
- describe('MultiSwap', () => {
1476
- it('TOKEN -> ETH', async () => {
1477
- await testE2E(
1478
- tokens.USDT,
1479
- tokens.ETH,
1480
- holders.USDT,
1481
- '20000000',
1482
- SwapSide.SELL,
1483
- dexKey,
1484
- ContractMethod.multiSwap,
1485
- network,
1486
- provider,
1487
- );
1488
- });
1489
- it('ETH -> TOKEN', async () => {
1490
- await testE2E(
1491
- tokens.ETH,
1492
- tokens.USDT,
1493
- holders.ETH,
1494
- '10000000000000000',
1495
- SwapSide.SELL,
1496
- dexKey,
1497
- ContractMethod.multiSwap,
1498
- network,
1499
- provider,
1500
- );
1501
- });
1502
- it('TOKEN -> TOKEN', async () => {
1503
- await testE2E(
1504
- tokens.USDC,
1505
- tokens.USDT,
1506
- holders.USDC,
1507
- '200000000',
1508
- SwapSide.SELL,
1509
- dexKey,
1510
- ContractMethod.multiSwap,
1511
- network,
1512
- provider,
1513
- );
1514
- });
1515
- });
1516
- describe('SimpleBuy', () => {
1517
- it('TOKEN -> ETH', async () => {
1518
- await testE2E(
1519
- tokens.USDT,
1520
- tokens.ETH,
1521
- holders.USDT,
1522
- '10000000000000000',
1523
- SwapSide.BUY,
1524
- dexKey,
1525
- ContractMethod.simpleBuy,
1526
- network,
1527
- provider,
1528
- );
1529
- });
1530
- it('ETH -> TOKEN', async () => {
1531
- await testE2E(
1532
- tokens.ETH,
1533
- tokens.USDT,
1534
- holders.ETH,
1535
- '20000000',
1536
- SwapSide.BUY,
1537
- dexKey,
1538
- ContractMethod.simpleBuy,
1539
- network,
1540
- provider,
1541
- );
1542
- });
1543
- it('TOKEN -> TOKEN', async () => {
1544
- await testE2E(
1545
- tokens.USDC,
1546
- tokens.USDT,
1547
- holders.USDC,
1548
- '2000000',
1549
- SwapSide.BUY,
1550
- dexKey,
1551
- ContractMethod.simpleBuy,
1552
- network,
1553
- provider,
1554
- );
1555
- });
1556
- });
1557
- describe('MegaSwap', () => {
1558
- it('TOKEN -> ETH', async () => {
1559
- await testE2E(
1560
- tokens.USDT,
1561
- tokens.ETH,
1562
- holders.USDT,
1563
- '20000000',
1564
- SwapSide.SELL,
1565
- dexKey,
1566
- ContractMethod.megaSwap,
1567
- network,
1568
- provider,
1569
- );
1570
- });
1571
- it('ETH -> TOKEN', async () => {
1572
- await testE2E(
1573
- tokens.ETH,
1574
- tokens.USDT,
1575
- holders.ETH,
1576
- '10000000000000000',
1577
- SwapSide.SELL,
1578
- dexKey,
1579
- ContractMethod.megaSwap,
1580
- network,
1581
- provider,
1582
- );
1583
- });
1584
- it('TOKEN -> TOKEN', async () => {
1585
- await testE2E(
1586
- tokens.USDC,
1587
- tokens.USDT,
1588
- holders.USDC,
1589
- '200000000',
1590
- SwapSide.SELL,
1591
- dexKey,
1592
- ContractMethod.megaSwap,
1593
- network,
1594
- provider,
1595
- );
1596
- });
1597
- });
1598
- });
1599
-
1600
- describe('PancakeSwapV2', () => {
1601
- const dexKey = 'PancakeSwapV2';
1602
-
1603
- describe('Simpleswap', () => {
1604
- it('TOKEN -> ETH', async () => {
1605
- await testE2E(
1606
- tokens.USDT,
1607
- tokens.ETH,
1608
- holders.USDT,
1609
- '200000000',
1610
- SwapSide.SELL,
1611
- dexKey,
1612
- ContractMethod.simpleSwap,
1613
- network,
1614
- provider,
1615
- );
1616
- });
1617
- it('ETH -> TOKEN', async () => {
1618
- await testE2E(
1619
- tokens.ETH,
1620
- tokens.USDT,
1621
- holders.ETH,
1622
- '500000000000000000',
1623
- SwapSide.SELL,
1624
- dexKey,
1625
- ContractMethod.simpleSwap,
1626
- network,
1627
- provider,
1628
- );
1629
- });
1630
- it('TOKEN -> TOKEN', async () => {
1631
- await testE2E(
1632
- tokens.USDC,
1633
- tokens.STG,
1634
- holders.USDC,
1635
- '50000',
1636
- SwapSide.SELL,
1637
- dexKey,
1638
- ContractMethod.simpleSwap,
1639
- network,
1640
- provider,
1641
- );
1642
- });
1643
- });
1644
-
1645
- describe('SimpleBuy', () => {
1646
- it('TOKEN -> ETH', async () => {
1647
- await testE2E(
1648
- tokens.USDT,
1649
- tokens.ETH,
1650
- holders.USDT,
1651
- '2000000000',
1652
- SwapSide.BUY,
1653
- dexKey,
1654
- ContractMethod.simpleBuy,
1655
- network,
1656
- provider,
1657
- );
1658
- });
1659
- it('ETH -> TOKEN', async () => {
1660
- await testE2E(
1661
- tokens.ETH,
1662
- tokens.USDT,
1663
- holders.ETH,
1664
- '1000000',
1665
- SwapSide.BUY,
1666
- dexKey,
1667
- ContractMethod.simpleBuy,
1668
- network,
1669
- provider,
1670
- );
1671
- });
1672
- it('TOKEN -> TOKEN', async () => {
1673
- await testE2E(
1674
- tokens.USDC,
1675
- tokens.STG,
1676
- holders.USDC,
1677
- '100000',
1678
- SwapSide.BUY,
1679
- dexKey,
1680
- ContractMethod.simpleBuy,
1681
- network,
1682
- provider,
1683
- );
1684
- });
1685
- });
1686
-
1687
- describe('Multiswap', () => {
1688
- it('TOKEN -> ETH', async () => {
1689
- await testE2E(
1690
- tokens.USDT,
1691
- tokens.ETH,
1692
- holders.USDT,
1693
- '200000000',
1694
- SwapSide.SELL,
1695
- dexKey,
1696
- ContractMethod.multiSwap,
1697
- network,
1698
- provider,
1699
- );
1700
- });
1701
- it('ETH -> TOKEN', async () => {
1702
- await testE2E(
1703
- tokens.ETH,
1704
- tokens.USDT,
1705
- holders.ETH,
1706
- '500000000000000000',
1707
- SwapSide.SELL,
1708
- dexKey,
1709
- ContractMethod.multiSwap,
1710
- network,
1711
- provider,
1712
- );
1713
- });
1714
- it('TOKEN -> TOKEN', async () => {
1715
- await testE2E(
1716
- tokens.USDC,
1717
- tokens.STG,
1718
- holders.USDC,
1719
- '1000000',
1720
- SwapSide.SELL,
1721
- dexKey,
1722
- ContractMethod.multiSwap,
1723
- network,
1724
- provider,
1725
- );
1726
- });
1727
- });
1728
- describe('MegaPath', () => {
1729
- it('TOKEN -> ETH', async () => {
1730
- await testE2E(
1731
- tokens.USDT,
1732
- tokens.ETH,
1733
- holders.USDT,
1734
- '200000000',
1735
- SwapSide.SELL,
1736
- dexKey,
1737
- ContractMethod.megaSwap,
1738
- network,
1739
- provider,
1740
- );
1741
- });
1742
- it('ETH -> TOKEN', async () => {
1743
- await testE2E(
1744
- tokens.ETH,
1745
- tokens.USDT,
1746
- holders.ETH,
1747
- '500000000000000000',
1748
- SwapSide.SELL,
1749
- dexKey,
1750
- ContractMethod.megaSwap,
1751
- network,
1752
- provider,
1753
- );
1754
- });
1755
- it('TOKEN -> TOKEN', async () => {
1756
- await testE2E(
1757
- tokens.USDC,
1758
- tokens.STG,
1759
- holders.USDC,
1760
- '1000000',
1761
- SwapSide.SELL,
1762
- dexKey,
1763
- ContractMethod.megaSwap,
1764
- network,
1765
- provider,
1766
- );
1767
- });
1768
- });
1769
- });
1770
-
1771
- describe(`Swapsicle`, () => {
1772
- const dexKey = 'Swapsicle';
1773
-
1774
- const sideToContractMethods = new Map([
1775
- [
1776
- SwapSide.SELL,
1777
- [
1778
- ContractMethod.simpleSwap,
1779
- ContractMethod.multiSwap,
1780
- ContractMethod.megaSwap,
1781
- ],
1782
- ],
1783
- [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
1784
- ]);
1785
-
1786
- const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [
1787
- [
1788
- { name: 'USDC', sellAmount: '7000', buyAmount: '10000' },
1789
- { name: 'WETH', sellAmount: '1000000000000000000', buyAmount: '4000' },
1790
- ],
1791
- ];
1792
-
1793
- sideToContractMethods.forEach((contractMethods, side) =>
1794
- describe(`${side}`, () => {
1795
- contractMethods.forEach((contractMethod: ContractMethod) => {
1796
- pairs.forEach(pair => {
1797
- describe(`${contractMethod}`, () => {
1798
- it(`${pair[0].name} -> ${pair[1].name}`, async () => {
1799
- await testE2E(
1800
- tokens[pair[0].name],
1801
- tokens[pair[1].name],
1802
- holders[pair[0].name],
1803
- side === SwapSide.SELL
1804
- ? pair[0].sellAmount
1805
- : pair[0].buyAmount,
1806
- side,
1807
- dexKey,
1808
- contractMethod,
1809
- network,
1810
- provider,
1811
- );
1812
- });
1813
- it(`${pair[1].name} -> ${pair[0].name}`, async () => {
1814
- await testE2E(
1815
- tokens[pair[1].name],
1816
- tokens[pair[0].name],
1817
- holders[pair[1].name],
1818
- side === SwapSide.SELL
1819
- ? pair[1].sellAmount
1820
- : pair[1].buyAmount,
1821
- side,
1822
- dexKey,
1823
- contractMethod,
1824
- network,
1825
- provider,
1826
- );
1827
- });
1828
- });
1829
- });
1830
- });
1831
- }),
1832
- );
1833
- });
1834
- });
1
+ import dotenv from 'dotenv';
2
+ dotenv.config();
3
+
4
+ import { testE2E } from '../../../tests/utils-e2e';
5
+ import { Tokens, Holders } from '../../../tests/constants-e2e';
6
+ import { Network, ContractMethod, SwapSide } from '../../constants';
7
+ import { StaticJsonRpcProvider } from '@ethersproject/providers';
8
+ import { generateConfig } from '../../config';
9
+ import { UniswapV2FunctionsV6 } from './types';
10
+
11
+ describe('UniswapV2 E2E Mainnet', () => {
12
+ const network = Network.MAINNET;
13
+ const tokens = Tokens[network];
14
+ const holders = Holders[network];
15
+ const provider = new StaticJsonRpcProvider(
16
+ generateConfig(network).privateHttpProvider,
17
+ network,
18
+ );
19
+
20
+ describe('UniswapV2', () => {
21
+ const dexKey = 'UniswapV2';
22
+
23
+ describe('UniswapV2 Simpleswap', () => {
24
+ it('USDC -> USDT', async () => {
25
+ await testE2E(
26
+ tokens.USDC,
27
+ tokens.USDT,
28
+ holders.USDC,
29
+ '1000000',
30
+ SwapSide.SELL,
31
+ dexKey,
32
+ ContractMethod.simpleSwap,
33
+ network,
34
+ provider,
35
+ );
36
+ });
37
+ it('ETH -> USDC', async () => {
38
+ await testE2E(
39
+ tokens.ETH,
40
+ tokens.USDC,
41
+ holders.ETH,
42
+ '7000000000000000000',
43
+ SwapSide.SELL,
44
+ dexKey,
45
+ ContractMethod.simpleSwap,
46
+ network,
47
+ provider,
48
+ );
49
+ });
50
+ it('USDC -> ETH', async () => {
51
+ await testE2E(
52
+ tokens.USDC,
53
+ tokens.ETH,
54
+ holders.USDC,
55
+ '2000000000',
56
+ SwapSide.SELL,
57
+ dexKey,
58
+ ContractMethod.simpleSwap,
59
+ network,
60
+ provider,
61
+ );
62
+ });
63
+ it('WBTC -> USDT', async () => {
64
+ await testE2E(
65
+ tokens.WBTC,
66
+ tokens.USDT,
67
+ holders.WBTC,
68
+ '20000000',
69
+ SwapSide.SELL,
70
+ dexKey,
71
+ ContractMethod.simpleSwap,
72
+ network,
73
+ provider,
74
+ );
75
+ });
76
+ });
77
+
78
+ describe('UniswapV2_special', () => {
79
+ describe('SELL_V6', () => {
80
+ it('EX1: USDC -> USDT', async () => {
81
+ await testE2E(
82
+ tokens.USDC,
83
+ tokens.USDT,
84
+ holders.USDC,
85
+ '1000000',
86
+ SwapSide.SELL,
87
+ dexKey,
88
+ ContractMethod.swapExactAmountIn,
89
+ network,
90
+ provider,
91
+ );
92
+ });
93
+ it('EX1: ETH -> USDC', async () => {
94
+ await testE2E(
95
+ tokens.ETH,
96
+ tokens.USDC,
97
+ holders.ETH,
98
+ '700000000000000000',
99
+ SwapSide.SELL,
100
+ dexKey,
101
+ ContractMethod.swapExactAmountIn,
102
+ network,
103
+ provider,
104
+ );
105
+ });
106
+ it('EX1: USDC -> ETH', async () => {
107
+ await testE2E(
108
+ tokens.USDC,
109
+ tokens.ETH,
110
+ holders.USDC,
111
+ '2000000000',
112
+ SwapSide.SELL,
113
+ dexKey,
114
+ ContractMethod.swapExactAmountIn,
115
+ network,
116
+ provider,
117
+ );
118
+ });
119
+ it('EX1: WBTC -> USDT', async () => {
120
+ await testE2E(
121
+ tokens.WBTC,
122
+ tokens.USDT,
123
+ holders.WBTC,
124
+ '20000000',
125
+ SwapSide.SELL,
126
+ dexKey,
127
+ ContractMethod.swapExactAmountIn,
128
+ network,
129
+ provider,
130
+ );
131
+ });
132
+ it('EX1: PSP -> WETH -> USDT', async () => {
133
+ await testE2E(
134
+ tokens.PSP,
135
+ tokens.USDT,
136
+ holders.PSP,
137
+ '1000000000000000000',
138
+ SwapSide.SELL,
139
+ dexKey,
140
+ ContractMethod.multiSwap,
141
+ network,
142
+ provider,
143
+ );
144
+ });
145
+ // TODO: Update: goes through balancer only
146
+ // it('EX2: USDT -> USDC', async () => {
147
+ // await testE2E(
148
+ // tokens.USDT,
149
+ // tokens.USDC,
150
+ // holders.USDT,
151
+ // '1000000000000',
152
+ // SwapSide.SELL,
153
+ // [dexKey, 'BalancerV2' /* , 'TraderJoeV2.1' 'SolidlyV3'*/],
154
+ // ContractMethod.multiSwap,
155
+ // network,
156
+ // provider,
157
+ // );
158
+ // });
159
+ });
160
+ describe('BUY_V6', () => {
161
+ it('EX3: USDC -> USDT', async () => {
162
+ await testE2E(
163
+ tokens.USDC,
164
+ tokens.USDT,
165
+ holders.USDC,
166
+ '1000000',
167
+ SwapSide.BUY,
168
+ dexKey,
169
+ ContractMethod.swapExactAmountOut,
170
+ network,
171
+ provider,
172
+ );
173
+ });
174
+ it('EX3: ETH -> DAI', async () => {
175
+ await testE2E(
176
+ tokens.ETH,
177
+ tokens.DAI,
178
+ holders.ETH,
179
+ '7000000000000000',
180
+ SwapSide.BUY,
181
+ dexKey,
182
+ ContractMethod.swapExactAmountOut,
183
+ network,
184
+ provider,
185
+ );
186
+ });
187
+ it('EX3: USDC -> ETH', async () => {
188
+ await testE2E(
189
+ tokens.USDC,
190
+ tokens.ETH,
191
+ holders.USDC,
192
+ '2000000000',
193
+ SwapSide.BUY,
194
+ dexKey,
195
+ ContractMethod.swapExactAmountOut,
196
+ network,
197
+ provider,
198
+ );
199
+ });
200
+ it('EX3: WBTC -> USDT', async () => {
201
+ await testE2E(
202
+ tokens.WBTC,
203
+ tokens.USDT,
204
+ holders.WBTC,
205
+ '20000000',
206
+ SwapSide.BUY,
207
+ dexKey,
208
+ ContractMethod.swapExactAmountOut,
209
+ network,
210
+ provider,
211
+ );
212
+ });
213
+ // it('EX3: PSP -> WETH -> USDT', async () => {
214
+ // await testE2E(
215
+ // tokens.PSP,
216
+ // tokens.USDT,
217
+ // holders.PSP,
218
+ // '1000000000000000000',
219
+ // SwapSide.BUY,
220
+ // dexKey,
221
+ // ContractMethod.multiSwap,
222
+ // network,
223
+ // provider,
224
+ // );
225
+ // });
226
+ // TODO: Update: goes through balancer only
227
+ // it('EX2: USDT -> USDC', async () => {
228
+ // await testE2E(
229
+ // tokens.USDT,
230
+ // tokens.USDC,
231
+ // holders.USDT,
232
+ // '1000000000000',
233
+ // SwapSide.BUY,
234
+ // [dexKey, 'BalancerV2' /* , 'TraderJoeV2.1' 'SolidlyV3'*/],
235
+ // ContractMethod.multiSwap,
236
+ // network,
237
+ // provider,
238
+ // );
239
+ // });
240
+ });
241
+ });
242
+
243
+ describe('Multiswap', () => {
244
+ it('ETH -> TOKEN', async () => {
245
+ await testE2E(
246
+ tokens.ETH,
247
+ tokens.WBTC,
248
+ holders.ETH,
249
+ '7000000000000000',
250
+ SwapSide.SELL,
251
+ dexKey,
252
+ ContractMethod.multiSwap,
253
+ network,
254
+ provider,
255
+ );
256
+ });
257
+ it('TOKEN -> ETH', async () => {
258
+ await testE2E(
259
+ tokens.BADGER,
260
+ tokens.ETH,
261
+ holders.BADGER,
262
+ '700000000000000000000',
263
+ SwapSide.SELL,
264
+ dexKey,
265
+ ContractMethod.multiSwap,
266
+ network,
267
+ provider,
268
+ );
269
+ });
270
+ it('TOKEN -> TOKEN', async () => {
271
+ await testE2E(
272
+ tokens.USDC,
273
+ tokens.WBTC,
274
+ holders.USDC,
275
+ '200000000',
276
+ SwapSide.SELL,
277
+ dexKey,
278
+ ContractMethod.multiSwap,
279
+ network,
280
+ provider,
281
+ );
282
+ });
283
+ });
284
+
285
+ describe('swapOnUniswap', () => {
286
+ it('ETH -> TOKEN', async () => {
287
+ await testE2E(
288
+ tokens.ETH,
289
+ tokens.WBTC,
290
+ holders.ETH,
291
+ '7000000000000000',
292
+ SwapSide.SELL,
293
+ dexKey,
294
+ ContractMethod.swapOnUniswap,
295
+ network,
296
+ provider,
297
+ );
298
+ });
299
+ it('TOKEN[BADGER] -> ETH', async () => {
300
+ await testE2E(
301
+ tokens.BADGER,
302
+ tokens.ETH,
303
+ holders.BADGER,
304
+ '700000000000000000000',
305
+ SwapSide.SELL,
306
+ dexKey,
307
+ ContractMethod.swapOnUniswap,
308
+ network,
309
+ provider,
310
+ );
311
+ });
312
+ it('TOKEN[USDC] -> ETH', async () => {
313
+ await testE2E(
314
+ tokens.USDC,
315
+ tokens.ETH,
316
+ holders.USDC,
317
+ '200000000',
318
+ SwapSide.SELL,
319
+ dexKey,
320
+ ContractMethod.swapOnUniswap,
321
+ network,
322
+ provider,
323
+ );
324
+ });
325
+ it('TOKEN -> TOKEN', async () => {
326
+ await testE2E(
327
+ tokens.USDC,
328
+ tokens.WBTC,
329
+ holders.USDC,
330
+ '200000000',
331
+ SwapSide.SELL,
332
+ dexKey,
333
+ ContractMethod.swapOnUniswap,
334
+ network,
335
+ provider,
336
+ );
337
+ });
338
+ });
339
+
340
+ describe('swapOnUniswapFork', () => {
341
+ it('ETH -> TOKEN', async () => {
342
+ await testE2E(
343
+ tokens.ETH,
344
+ tokens.WBTC,
345
+ holders.ETH,
346
+ '7000000000000000',
347
+ SwapSide.SELL,
348
+ dexKey,
349
+ ContractMethod.swapOnUniswapFork,
350
+ network,
351
+ provider,
352
+ );
353
+ });
354
+ it('TOKEN -> ETH', async () => {
355
+ await testE2E(
356
+ tokens.BADGER,
357
+ tokens.ETH,
358
+ holders.BADGER,
359
+ '700000000000000000000',
360
+ SwapSide.SELL,
361
+ dexKey,
362
+ ContractMethod.swapOnUniswapFork,
363
+ network,
364
+ provider,
365
+ );
366
+ });
367
+ it('TOKEN -> TOKEN', async () => {
368
+ await testE2E(
369
+ tokens.USDC,
370
+ tokens.WBTC,
371
+ holders.USDC,
372
+ '200000000',
373
+ SwapSide.SELL,
374
+ dexKey,
375
+ ContractMethod.swapOnUniswapFork,
376
+ network,
377
+ provider,
378
+ );
379
+ });
380
+ });
381
+
382
+ describe('swapOnUniswapV2Fork', () => {
383
+ it('ETH -> TOKEN', async () => {
384
+ await testE2E(
385
+ tokens.ETH,
386
+ tokens.WBTC,
387
+ holders.ETH,
388
+ '7000000000000000',
389
+ SwapSide.SELL,
390
+ dexKey,
391
+ ContractMethod.swapOnUniswapV2Fork,
392
+ network,
393
+ provider,
394
+ );
395
+ });
396
+ it('TOKEN -> ETH', async () => {
397
+ await testE2E(
398
+ tokens.BADGER,
399
+ tokens.ETH,
400
+ holders.BADGER,
401
+ '700000000000000000000',
402
+ SwapSide.SELL,
403
+ dexKey,
404
+ ContractMethod.swapOnUniswapV2Fork,
405
+ network,
406
+ provider,
407
+ );
408
+ });
409
+ it('TOKEN -> TOKEN', async () => {
410
+ await testE2E(
411
+ tokens.USDC,
412
+ tokens.WBTC,
413
+ holders.USDC,
414
+ '200000000',
415
+ SwapSide.SELL,
416
+ dexKey,
417
+ ContractMethod.swapOnUniswapV2Fork,
418
+ network,
419
+ provider,
420
+ );
421
+ });
422
+ });
423
+
424
+ describe('buyOnUniswap', () => {
425
+ it('TOKEN -> ETH', async () => {
426
+ await testE2E(
427
+ tokens.USDT,
428
+ tokens.ETH,
429
+ holders.USDT,
430
+ '700000000000000000',
431
+ SwapSide.BUY,
432
+ dexKey,
433
+ ContractMethod.buyOnUniswap,
434
+ network,
435
+ provider,
436
+ );
437
+ });
438
+ it('ETH -> TOKEN[BADGER]', async () => {
439
+ await testE2E(
440
+ tokens.ETH,
441
+ tokens.BADGER,
442
+ holders.ETH,
443
+ '700000000000000000000',
444
+ SwapSide.BUY,
445
+ dexKey,
446
+ ContractMethod.buyOnUniswap,
447
+ network,
448
+ provider,
449
+ );
450
+ });
451
+ it('TOKEN[USDC] -> ETH', async () => {
452
+ await testE2E(
453
+ tokens.USDC,
454
+ tokens.ETH,
455
+ holders.USDC,
456
+ '2000000000000000000',
457
+ SwapSide.BUY,
458
+ dexKey,
459
+ ContractMethod.buyOnUniswap,
460
+ network,
461
+ provider,
462
+ );
463
+ });
464
+
465
+ it('TOKEN -> TOKEN', async () => {
466
+ await testE2E(
467
+ tokens.USDC,
468
+ tokens.WBTC,
469
+ holders.USDC,
470
+ '200000000',
471
+ SwapSide.BUY,
472
+ dexKey,
473
+ ContractMethod.buyOnUniswap,
474
+ network,
475
+ provider,
476
+ );
477
+ });
478
+ });
479
+
480
+ describe('buyOnUniswapFork', () => {
481
+ it('TOKEN -> ETH', async () => {
482
+ await testE2E(
483
+ tokens.USDT,
484
+ tokens.ETH,
485
+ holders.USDT,
486
+ '700000000000000000',
487
+ SwapSide.BUY,
488
+ dexKey,
489
+ ContractMethod.buyOnUniswapFork,
490
+ network,
491
+ provider,
492
+ );
493
+ });
494
+ it('ETH -> TOKEN[BADGER]', async () => {
495
+ await testE2E(
496
+ tokens.ETH,
497
+ tokens.BADGER,
498
+ holders.ETH,
499
+ '700000000000000000000',
500
+ SwapSide.BUY,
501
+ dexKey,
502
+ ContractMethod.buyOnUniswapFork,
503
+ network,
504
+ provider,
505
+ );
506
+ });
507
+ it('TOKEN[USDC] -> ETH', async () => {
508
+ await testE2E(
509
+ tokens.USDC,
510
+ tokens.ETH,
511
+ holders.USDC,
512
+ '2000000000000000000',
513
+ SwapSide.BUY,
514
+ dexKey,
515
+ ContractMethod.buyOnUniswapFork,
516
+ network,
517
+ provider,
518
+ );
519
+ });
520
+
521
+ it('TOKEN -> TOKEN', async () => {
522
+ await testE2E(
523
+ tokens.USDC,
524
+ tokens.WBTC,
525
+ holders.USDC,
526
+ '200000000',
527
+ SwapSide.BUY,
528
+ dexKey,
529
+ ContractMethod.buyOnUniswapFork,
530
+ network,
531
+ provider,
532
+ );
533
+ });
534
+ });
535
+
536
+ describe('buyOnUniswapV2Fork', () => {
537
+ it('TOKEN -> ETH', async () => {
538
+ await testE2E(
539
+ tokens.USDT,
540
+ tokens.ETH,
541
+ holders.USDT,
542
+ '700000000000000000',
543
+ SwapSide.BUY,
544
+ dexKey,
545
+ ContractMethod.buyOnUniswapV2Fork,
546
+ network,
547
+ provider,
548
+ );
549
+ });
550
+ it('ETH -> TOKEN[BADGER]', async () => {
551
+ await testE2E(
552
+ tokens.ETH,
553
+ tokens.BADGER,
554
+ holders.ETH,
555
+ '700000000000000000000',
556
+ SwapSide.BUY,
557
+ dexKey,
558
+ ContractMethod.buyOnUniswapV2Fork,
559
+ network,
560
+ provider,
561
+ );
562
+ });
563
+ it('TOKEN[USDC] -> ETH', async () => {
564
+ await testE2E(
565
+ tokens.USDC,
566
+ tokens.ETH,
567
+ holders.USDC,
568
+ '2000000000000000000',
569
+ SwapSide.BUY,
570
+ dexKey,
571
+ ContractMethod.buyOnUniswapV2Fork,
572
+ network,
573
+ provider,
574
+ );
575
+ });
576
+
577
+ it('TOKEN -> TOKEN', async () => {
578
+ await testE2E(
579
+ tokens.USDC,
580
+ tokens.WBTC,
581
+ holders.USDC,
582
+ '200000000',
583
+ SwapSide.BUY,
584
+ dexKey,
585
+ ContractMethod.buyOnUniswapV2Fork,
586
+ network,
587
+ provider,
588
+ );
589
+ });
590
+ });
591
+
592
+ describe('simpleBuy', () => {
593
+ it('TOKEN -> ETH', async () => {
594
+ await testE2E(
595
+ tokens.USDT,
596
+ tokens.ETH,
597
+ holders.USDT,
598
+ '700000000000000000',
599
+ SwapSide.BUY,
600
+ dexKey,
601
+ ContractMethod.simpleBuy,
602
+ network,
603
+ provider,
604
+ );
605
+ });
606
+ it('ETH -> TOKEN[BADGER]', async () => {
607
+ await testE2E(
608
+ tokens.ETH,
609
+ tokens.BADGER,
610
+ holders.ETH,
611
+ '700000000000000000000',
612
+ SwapSide.BUY,
613
+ dexKey,
614
+ ContractMethod.simpleBuy,
615
+ network,
616
+ provider,
617
+ );
618
+ });
619
+ it('TOKEN[USDC] -> ETH', async () => {
620
+ await testE2E(
621
+ tokens.USDC,
622
+ tokens.ETH,
623
+ holders.USDC,
624
+ '2000000000000000000',
625
+ SwapSide.BUY,
626
+ dexKey,
627
+ ContractMethod.simpleBuy,
628
+ network,
629
+ provider,
630
+ );
631
+ });
632
+ it('TOKEN -> TOKEN', async () => {
633
+ await testE2E(
634
+ tokens.USDC,
635
+ tokens.WBTC,
636
+ holders.USDC,
637
+ '20000000',
638
+ SwapSide.BUY,
639
+ dexKey,
640
+ ContractMethod.simpleBuy,
641
+ network,
642
+ provider,
643
+ );
644
+ });
645
+ });
646
+
647
+ describe('BuyMethod', () => {
648
+ it('TOKEN -> ETH', async () => {
649
+ await testE2E(
650
+ tokens.USDT,
651
+ tokens.ETH,
652
+ holders.USDT,
653
+ '700000000000000000',
654
+ SwapSide.BUY,
655
+ dexKey,
656
+ ContractMethod.buy,
657
+ network,
658
+ provider,
659
+ );
660
+ });
661
+ it('ETH -> TOKEN[BADGER]', async () => {
662
+ await testE2E(
663
+ tokens.ETH,
664
+ tokens.BADGER,
665
+ holders.ETH,
666
+ '700000000000000000000',
667
+ SwapSide.BUY,
668
+ dexKey,
669
+ ContractMethod.buy,
670
+ network,
671
+ provider,
672
+ );
673
+ });
674
+ it('TOKEN[USDC] -> ETH', async () => {
675
+ await testE2E(
676
+ tokens.USDC,
677
+ tokens.ETH,
678
+ holders.USDC,
679
+ '2000000000000000000',
680
+ SwapSide.BUY,
681
+ dexKey,
682
+ ContractMethod.buy,
683
+ network,
684
+ provider,
685
+ );
686
+ });
687
+ it('TOKEN -> TOKEN', async () => {
688
+ await testE2E(
689
+ tokens.USDC,
690
+ tokens.WBTC,
691
+ holders.USDC,
692
+ '20000000',
693
+ SwapSide.BUY,
694
+ dexKey,
695
+ ContractMethod.buy,
696
+ network,
697
+ provider,
698
+ );
699
+ });
700
+ });
701
+
702
+ describe('STETH->ETH', () => {
703
+ it('simpleSwap', async () => {
704
+ await testE2E(
705
+ tokens.STETH,
706
+ tokens.ETH,
707
+ holders.STETH,
708
+ '1000000000000000000',
709
+ SwapSide.SELL,
710
+ dexKey,
711
+ ContractMethod.simpleSwap,
712
+ network,
713
+ provider,
714
+ );
715
+ });
716
+ it('multiSwap', async () => {
717
+ await testE2E(
718
+ tokens.STETH,
719
+ tokens.ETH,
720
+ holders.STETH,
721
+ '1000000000000000000',
722
+ SwapSide.SELL,
723
+ dexKey,
724
+ ContractMethod.multiSwap,
725
+ network,
726
+ provider,
727
+ );
728
+ });
729
+ it('megaSwap', async () => {
730
+ await testE2E(
731
+ tokens.STETH,
732
+ tokens.ETH,
733
+ holders.STETH,
734
+ '1000000000000000000',
735
+ SwapSide.SELL,
736
+ dexKey,
737
+ ContractMethod.megaSwap,
738
+ network,
739
+ provider,
740
+ );
741
+ });
742
+ });
743
+
744
+ describe('V6_swapExactAmountInOnUniswapV2', () => {
745
+ it('WETH -> WBTC', async () => {
746
+ await testE2E(
747
+ tokens.WETH,
748
+ tokens.WBTC,
749
+ holders.WETH,
750
+ '7000000000000000',
751
+ SwapSide.SELL,
752
+ dexKey,
753
+ ContractMethod.swapExactAmountInOnUniswapV2,
754
+ network,
755
+ provider,
756
+ );
757
+ });
758
+ it('WETH (amountIn=1000000000000) -> WBTC', async () => {
759
+ await testE2E(
760
+ tokens.WETH,
761
+ tokens.WBTC,
762
+ holders.WETH,
763
+ '1000000000000',
764
+ SwapSide.SELL,
765
+ dexKey,
766
+ ContractMethod.swapExactAmountInOnUniswapV2,
767
+ network,
768
+ provider,
769
+ );
770
+ });
771
+ it('WBTC -> WETH', async () => {
772
+ await testE2E(
773
+ tokens.WBTC,
774
+ tokens.WETH,
775
+ holders.WBTC,
776
+ '100000',
777
+ SwapSide.SELL,
778
+ dexKey,
779
+ ContractMethod.swapExactAmountInOnUniswapV2,
780
+ network,
781
+ provider,
782
+ );
783
+ });
784
+ it('ETH -> WBTC', async () => {
785
+ await testE2E(
786
+ tokens.ETH,
787
+ tokens.WBTC,
788
+ holders.ETH,
789
+ '7000000000000000',
790
+ SwapSide.SELL,
791
+ dexKey,
792
+ ContractMethod.swapExactAmountInOnUniswapV2,
793
+ network,
794
+ provider,
795
+ );
796
+ });
797
+ it('WBTC -> ETH', async () => {
798
+ await testE2E(
799
+ tokens.WBTC,
800
+ tokens.ETH,
801
+ holders.WBTC,
802
+ '100000',
803
+ SwapSide.SELL,
804
+ dexKey,
805
+ ContractMethod.swapExactAmountInOnUniswapV2,
806
+ network,
807
+ provider,
808
+ );
809
+ });
810
+ it('USDC -> WBTC', async () => {
811
+ await testE2E(
812
+ tokens.USDC,
813
+ tokens.WBTC,
814
+ holders.USDC,
815
+ '200000000',
816
+ SwapSide.SELL,
817
+ dexKey,
818
+ ContractMethod.swapExactAmountInOnUniswapV2,
819
+ network,
820
+ provider,
821
+ );
822
+ });
823
+ it('WBTC -> USDC', async () => {
824
+ await testE2E(
825
+ tokens.WBTC,
826
+ tokens.USDC,
827
+ holders.WBTC,
828
+ '100000',
829
+ SwapSide.SELL,
830
+ dexKey,
831
+ ContractMethod.swapExactAmountInOnUniswapV2,
832
+ network,
833
+ provider,
834
+ );
835
+ });
836
+ it('USDT -> USDC', async () => {
837
+ await testE2E(
838
+ tokens.USDT,
839
+ tokens.USDC,
840
+ holders.USDT,
841
+ '100000',
842
+ SwapSide.SELL,
843
+ dexKey,
844
+ ContractMethod.swapExactAmountInOnUniswapV2,
845
+ network,
846
+ provider,
847
+ );
848
+ });
849
+ it('USDC -> USDT', async () => {
850
+ await testE2E(
851
+ tokens.USDC,
852
+ tokens.USDT,
853
+ holders.USDC,
854
+ '100000',
855
+ SwapSide.SELL,
856
+ dexKey,
857
+ ContractMethod.swapExactAmountInOnUniswapV2,
858
+ network,
859
+ provider,
860
+ );
861
+ });
862
+ });
863
+
864
+ describe('V6_swapExactAmountOutOnUniswapV2', () => {
865
+ it('WETH -> WBTC', async () => {
866
+ await testE2E(
867
+ tokens.WETH,
868
+ tokens.WBTC,
869
+ holders.WETH,
870
+ '1000000',
871
+ SwapSide.BUY,
872
+ dexKey,
873
+ ContractMethod.swapExactAmountOutOnUniswapV2,
874
+ network,
875
+ provider,
876
+ );
877
+ });
878
+ it('WBTC -> WETH', async () => {
879
+ await testE2E(
880
+ tokens.WBTC,
881
+ tokens.WETH,
882
+ holders.WBTC,
883
+ '7000000000000000',
884
+ SwapSide.BUY,
885
+ dexKey,
886
+ ContractMethod.swapExactAmountOutOnUniswapV2,
887
+ network,
888
+ provider,
889
+ );
890
+ });
891
+ it('WBTC -> WETH (amountOut=1000000)', async () => {
892
+ await testE2E(
893
+ tokens.WBTC,
894
+ tokens.WETH,
895
+ holders.WBTC,
896
+ '7000000000000000',
897
+ SwapSide.BUY,
898
+ dexKey,
899
+ ContractMethod.swapExactAmountOutOnUniswapV2,
900
+ network,
901
+ provider,
902
+ );
903
+ });
904
+ it('ETH -> WBTC', async () => {
905
+ await testE2E(
906
+ tokens.ETH,
907
+ tokens.WBTC,
908
+ holders.ETH,
909
+ '1000000',
910
+ SwapSide.BUY,
911
+ dexKey,
912
+ ContractMethod.swapExactAmountOutOnUniswapV2,
913
+ network,
914
+ provider,
915
+ );
916
+ });
917
+ it('WBTC -> ETH ', async () => {
918
+ await testE2E(
919
+ tokens.WBTC,
920
+ tokens.ETH,
921
+ holders.WBTC,
922
+ '7000000000000000',
923
+ SwapSide.BUY,
924
+ dexKey,
925
+ ContractMethod.swapExactAmountOutOnUniswapV2,
926
+ network,
927
+ provider,
928
+ );
929
+ });
930
+ it('USDC -> WBTC', async () => {
931
+ await testE2E(
932
+ tokens.USDC,
933
+ tokens.WBTC,
934
+ holders.USDC,
935
+ '20000',
936
+ SwapSide.BUY,
937
+ dexKey,
938
+ ContractMethod.swapExactAmountOutOnUniswapV2,
939
+ network,
940
+ provider,
941
+ );
942
+ });
943
+ it('WBTC -> USDC', async () => {
944
+ await testE2E(
945
+ tokens.WBTC,
946
+ tokens.USDC,
947
+ holders.WBTC,
948
+ '1000000',
949
+ SwapSide.BUY,
950
+ dexKey,
951
+ ContractMethod.swapExactAmountOutOnUniswapV2,
952
+ network,
953
+ provider,
954
+ );
955
+ });
956
+ it('USDT -> USDC', async () => {
957
+ await testE2E(
958
+ tokens.USDT,
959
+ tokens.USDC,
960
+ holders.USDT,
961
+ '1000000',
962
+ SwapSide.BUY,
963
+ dexKey,
964
+ ContractMethod.swapExactAmountOutOnUniswapV2,
965
+ network,
966
+ provider,
967
+ );
968
+ });
969
+ it('USDC -> USDT', async () => {
970
+ await testE2E(
971
+ tokens.USDC,
972
+ tokens.USDT,
973
+ holders.USDC,
974
+ '1000000',
975
+ SwapSide.BUY,
976
+ dexKey,
977
+ ContractMethod.swapExactAmountOutOnUniswapV2,
978
+ network,
979
+ provider,
980
+ );
981
+ });
982
+ });
983
+ });
984
+
985
+ describe('SushiSwap', () => {
986
+ const dexKey = 'SushiSwap';
987
+
988
+ describe('Simpleswap', () => {
989
+ it('SushiSwap ETH -> TOKEN', async () => {
990
+ await testE2E(
991
+ tokens.ETH,
992
+ tokens.USDC,
993
+ holders.ETH,
994
+ '7000000000000000000',
995
+ SwapSide.SELL,
996
+ dexKey,
997
+ ContractMethod.simpleSwap,
998
+ network,
999
+ provider,
1000
+ );
1001
+ });
1002
+ it('SushiSwap TOKEN -> ETH', async () => {
1003
+ await testE2E(
1004
+ tokens.USDC,
1005
+ tokens.ETH,
1006
+ holders.USDC,
1007
+ '2000000000',
1008
+ SwapSide.SELL,
1009
+ dexKey,
1010
+ ContractMethod.simpleSwap,
1011
+ network,
1012
+ provider,
1013
+ );
1014
+ });
1015
+ it('SushiSwap TOKEN -> TOKEN', async () => {
1016
+ await testE2E(
1017
+ tokens.WBTC,
1018
+ tokens.BADGER,
1019
+ holders.WBTC,
1020
+ '20000000',
1021
+ SwapSide.SELL,
1022
+ dexKey,
1023
+ ContractMethod.simpleSwap,
1024
+ network,
1025
+ provider,
1026
+ );
1027
+ });
1028
+ });
1029
+
1030
+ describe('MultiSwap', () => {
1031
+ it('SushiSwap ETH -> TOKEN', async () => {
1032
+ await testE2E(
1033
+ tokens.ETH,
1034
+ tokens.WBTC,
1035
+ holders.ETH,
1036
+ '7000000000000000',
1037
+ SwapSide.SELL,
1038
+ dexKey,
1039
+ ContractMethod.multiSwap,
1040
+ network,
1041
+ provider,
1042
+ );
1043
+ });
1044
+ it('SushiSwap TOKEN -> ETH', async () => {
1045
+ await testE2E(
1046
+ tokens.BADGER,
1047
+ tokens.ETH,
1048
+ holders.BADGER,
1049
+ '700000000000000000000',
1050
+ SwapSide.SELL,
1051
+ dexKey,
1052
+ ContractMethod.multiSwap,
1053
+ network,
1054
+ provider,
1055
+ );
1056
+ });
1057
+ it('SushiSwap TOKEN -> TOKEN', async () => {
1058
+ await testE2E(
1059
+ tokens.USDT,
1060
+ tokens.WBTC,
1061
+ holders.USDT,
1062
+ '200000000',
1063
+ SwapSide.SELL,
1064
+ dexKey,
1065
+ ContractMethod.multiSwap,
1066
+ network,
1067
+ provider,
1068
+ );
1069
+ });
1070
+ });
1071
+
1072
+ describe('swapOnUniswapFork', () => {
1073
+ it('SushiSwap ETH -> TOKEN', async () => {
1074
+ await testE2E(
1075
+ tokens.ETH,
1076
+ tokens.WBTC,
1077
+ holders.ETH,
1078
+ '7000000000000000',
1079
+ SwapSide.SELL,
1080
+ dexKey,
1081
+ ContractMethod.swapOnUniswapFork,
1082
+ network,
1083
+ provider,
1084
+ );
1085
+ });
1086
+ it('SushiSwap TOKEN -> ETH', async () => {
1087
+ await testE2E(
1088
+ tokens.BADGER,
1089
+ tokens.ETH,
1090
+ holders.BADGER,
1091
+ '700000000000000000000',
1092
+ SwapSide.SELL,
1093
+ dexKey,
1094
+ ContractMethod.swapOnUniswapFork,
1095
+ network,
1096
+ provider,
1097
+ );
1098
+ });
1099
+ it('SushiSwap TOKEN -> TOKEN', async () => {
1100
+ await testE2E(
1101
+ tokens.USDT,
1102
+ tokens.WBTC,
1103
+ holders.USDT,
1104
+ '2000000',
1105
+ SwapSide.SELL,
1106
+ dexKey,
1107
+ ContractMethod.swapOnUniswapFork,
1108
+ network,
1109
+ provider,
1110
+ );
1111
+ });
1112
+ });
1113
+ describe('swapOnUniswapV2Fork', () => {
1114
+ it('SAITAMA -> ETH', async () => {
1115
+ await testE2E(
1116
+ tokens.SAITAMA,
1117
+ tokens.ETH,
1118
+ holders.SAITAMA,
1119
+ '11111111111000000000',
1120
+ SwapSide.SELL,
1121
+ dexKey,
1122
+ ContractMethod.swapOnUniswapV2Fork,
1123
+ network,
1124
+ provider,
1125
+ );
1126
+ });
1127
+ it('ETH -> SAITAMA', async () => {
1128
+ await testE2E(
1129
+ tokens.ETH,
1130
+ tokens.SAITAMA,
1131
+ holders.ETH,
1132
+ '11111111111000000000',
1133
+ SwapSide.SELL,
1134
+ dexKey,
1135
+ ContractMethod.swapOnUniswapV2Fork,
1136
+ network,
1137
+ provider,
1138
+ );
1139
+ });
1140
+ });
1141
+ describe('buyOnUniswapV2Fork', () => {
1142
+ it('SAITAMA -> ETH', async () => {
1143
+ await testE2E(
1144
+ tokens.SAITAMA,
1145
+ tokens.ETH,
1146
+ holders.SAITAMA,
1147
+ '60000000000000000',
1148
+ SwapSide.BUY,
1149
+ dexKey,
1150
+ ContractMethod.buyOnUniswapV2Fork,
1151
+ network,
1152
+ provider,
1153
+ );
1154
+ });
1155
+ it('ETH -> SAITAMA', async () => {
1156
+ await testE2E(
1157
+ tokens.ETH,
1158
+ tokens.SAITAMA,
1159
+ holders.ETH,
1160
+ '11111111111000000000',
1161
+ SwapSide.BUY,
1162
+ dexKey,
1163
+ ContractMethod.buyOnUniswapV2Fork,
1164
+ network,
1165
+ provider,
1166
+ );
1167
+ });
1168
+ });
1169
+ });
1170
+
1171
+ describe('DefiSwap', () => {
1172
+ const dexKey = 'DefiSwap';
1173
+
1174
+ describe('Simpleswap', () => {
1175
+ it('DefiSwap ETH -> TOKEN', async () => {
1176
+ await testE2E(
1177
+ tokens.ETH,
1178
+ tokens.USDC,
1179
+ holders.ETH,
1180
+ '7000000000000000000',
1181
+ SwapSide.SELL,
1182
+ dexKey,
1183
+ ContractMethod.simpleSwap,
1184
+ network,
1185
+ provider,
1186
+ );
1187
+ });
1188
+ it('DefiSwap TOKEN -> ETH', async () => {
1189
+ await testE2E(
1190
+ tokens.USDC,
1191
+ tokens.ETH,
1192
+ holders.USDC,
1193
+ '2000000000',
1194
+ SwapSide.SELL,
1195
+ dexKey,
1196
+ ContractMethod.simpleSwap,
1197
+ network,
1198
+ provider,
1199
+ );
1200
+ });
1201
+ it('DefiSwap TOKEN -> TOKEN', async () => {
1202
+ await testE2E(
1203
+ tokens.WBTC,
1204
+ tokens.renBTC,
1205
+ holders.WBTC,
1206
+ '20000000',
1207
+ SwapSide.SELL,
1208
+ dexKey,
1209
+ ContractMethod.simpleSwap,
1210
+ network,
1211
+ provider,
1212
+ );
1213
+ });
1214
+ });
1215
+
1216
+ describe('Multiswap', () => {
1217
+ it('DefiSwap ETH -> TOKEN', async () => {
1218
+ await testE2E(
1219
+ tokens.ETH,
1220
+ tokens.WBTC,
1221
+ holders.ETH,
1222
+ '7000000000000000',
1223
+ SwapSide.SELL,
1224
+ dexKey,
1225
+ ContractMethod.multiSwap,
1226
+ network,
1227
+ provider,
1228
+ );
1229
+ });
1230
+ it('DefiSwap TOKEN -> ETH', async () => {
1231
+ await testE2E(
1232
+ tokens.LINK,
1233
+ tokens.ETH,
1234
+ holders.LINK,
1235
+ '700000000000000000000',
1236
+ SwapSide.SELL,
1237
+ dexKey,
1238
+ ContractMethod.multiSwap,
1239
+ network,
1240
+ provider,
1241
+ );
1242
+ });
1243
+ it('DefiSwap TOKEN -> TOKEN', async () => {
1244
+ await testE2E(
1245
+ tokens.USDC,
1246
+ tokens.WBTC,
1247
+ holders.USDC,
1248
+ '200000000',
1249
+ SwapSide.SELL,
1250
+ dexKey,
1251
+ ContractMethod.multiSwap,
1252
+ network,
1253
+ provider,
1254
+ );
1255
+ });
1256
+ });
1257
+
1258
+ describe('swapOnUniswapFork', () => {
1259
+ it('DefiSwap ETH -> TOKEN', async () => {
1260
+ await testE2E(
1261
+ tokens.ETH,
1262
+ tokens.WBTC,
1263
+ holders.ETH,
1264
+ '7000000000000000',
1265
+ SwapSide.SELL,
1266
+ dexKey,
1267
+ ContractMethod.swapOnUniswapFork,
1268
+ network,
1269
+ provider,
1270
+ );
1271
+ });
1272
+ it('DefiSwap TOKEN -> ETH', async () => {
1273
+ await testE2E(
1274
+ tokens.LINK,
1275
+ tokens.ETH,
1276
+ holders.LINK,
1277
+ '700000000000000000000',
1278
+ SwapSide.SELL,
1279
+ dexKey,
1280
+ ContractMethod.swapOnUniswapFork,
1281
+ network,
1282
+ provider,
1283
+ );
1284
+ });
1285
+ it('DefiSwap TOKEN -> TOKEN', async () => {
1286
+ await testE2E(
1287
+ tokens.USDC,
1288
+ tokens.WBTC,
1289
+ holders.USDC,
1290
+ '200000000',
1291
+ SwapSide.SELL,
1292
+ dexKey,
1293
+ ContractMethod.swapOnUniswapFork,
1294
+ network,
1295
+ provider,
1296
+ );
1297
+ });
1298
+ });
1299
+ });
1300
+
1301
+ describe('Verse', () => {
1302
+ const dexKey = 'Verse';
1303
+
1304
+ describe('Simpleswap', () => {
1305
+ it('TOKEN -> ETH', async () => {
1306
+ await testE2E(
1307
+ tokens.USDT,
1308
+ tokens.ETH,
1309
+ holders.USDT,
1310
+ '2000000',
1311
+ SwapSide.SELL,
1312
+ dexKey,
1313
+ ContractMethod.simpleSwap,
1314
+ network,
1315
+ provider,
1316
+ );
1317
+ });
1318
+ it('ETH -> TOKEN', async () => {
1319
+ await testE2E(
1320
+ tokens.ETH,
1321
+ tokens.USDT,
1322
+ holders.ETH,
1323
+ '1000000000000000',
1324
+ SwapSide.SELL,
1325
+ dexKey,
1326
+ ContractMethod.simpleSwap,
1327
+ network,
1328
+ provider,
1329
+ );
1330
+ });
1331
+ it('TOKEN -> TOKEN', async () => {
1332
+ await testE2E(
1333
+ tokens.WETH,
1334
+ tokens.USDT,
1335
+ holders.WETH,
1336
+ '100000000000000',
1337
+ SwapSide.SELL,
1338
+ dexKey,
1339
+ ContractMethod.simpleSwap,
1340
+ network,
1341
+ provider,
1342
+ );
1343
+ });
1344
+ });
1345
+
1346
+ describe('Multiswap', () => {
1347
+ it('TOKEN -> ETH', async () => {
1348
+ await testE2E(
1349
+ tokens.USDT,
1350
+ tokens.ETH,
1351
+ holders.USDT,
1352
+ '20000000',
1353
+ SwapSide.SELL,
1354
+ dexKey,
1355
+ ContractMethod.multiSwap,
1356
+ network,
1357
+ provider,
1358
+ );
1359
+ });
1360
+ it('ETH -> TOKEN', async () => {
1361
+ await testE2E(
1362
+ tokens.ETH,
1363
+ tokens.USDT,
1364
+ holders.ETH,
1365
+ '1000000000000',
1366
+ SwapSide.SELL,
1367
+ dexKey,
1368
+ ContractMethod.multiSwap,
1369
+ network,
1370
+ provider,
1371
+ );
1372
+ });
1373
+ it('TOKEN -> TOKEN', async () => {
1374
+ await testE2E(
1375
+ tokens.USDC,
1376
+ tokens.USDT,
1377
+ holders.USDC,
1378
+ '50000000',
1379
+ SwapSide.SELL,
1380
+ dexKey,
1381
+ ContractMethod.multiSwap,
1382
+ network,
1383
+ provider,
1384
+ );
1385
+ });
1386
+ });
1387
+
1388
+ describe('Megaswap', () => {
1389
+ it('TOKEN -> ETH', async () => {
1390
+ await testE2E(
1391
+ tokens.USDT,
1392
+ tokens.ETH,
1393
+ holders.USDT,
1394
+ '20000000',
1395
+ SwapSide.SELL,
1396
+ dexKey,
1397
+ ContractMethod.megaSwap,
1398
+ network,
1399
+ provider,
1400
+ );
1401
+ });
1402
+ it('ETH -> TOKEN', async () => {
1403
+ await testE2E(
1404
+ tokens.ETH,
1405
+ tokens.USDT,
1406
+ holders.ETH,
1407
+ '1000000000000',
1408
+ SwapSide.SELL,
1409
+ dexKey,
1410
+ ContractMethod.megaSwap,
1411
+ network,
1412
+ provider,
1413
+ );
1414
+ });
1415
+ it('TOKEN -> TOKEN', async () => {
1416
+ await testE2E(
1417
+ tokens.USDC,
1418
+ tokens.USDT,
1419
+ holders.USDC,
1420
+ '50000000',
1421
+ SwapSide.SELL,
1422
+ dexKey,
1423
+ ContractMethod.megaSwap,
1424
+ network,
1425
+ provider,
1426
+ );
1427
+ });
1428
+ });
1429
+ });
1430
+
1431
+ describe('ShibaSwap', () => {
1432
+ const dexKey = 'ShibaSwap';
1433
+
1434
+ describe('Simpleswap', () => {
1435
+ it('TOKEN -> ETH', async () => {
1436
+ await testE2E(
1437
+ tokens.USDT,
1438
+ tokens.ETH,
1439
+ holders.USDT,
1440
+ '20000000',
1441
+ SwapSide.SELL,
1442
+ dexKey,
1443
+ ContractMethod.simpleSwap,
1444
+ network,
1445
+ provider,
1446
+ );
1447
+ });
1448
+ it('ETH -> TOKEN', async () => {
1449
+ await testE2E(
1450
+ tokens.ETH,
1451
+ tokens.USDT,
1452
+ holders.ETH,
1453
+ '1000000000000000000',
1454
+ SwapSide.SELL,
1455
+ dexKey,
1456
+ ContractMethod.simpleSwap,
1457
+ network,
1458
+ provider,
1459
+ );
1460
+ });
1461
+ it('TOKEN -> TOKEN', async () => {
1462
+ await testE2E(
1463
+ tokens.WETH,
1464
+ tokens.USDT,
1465
+ holders.WETH,
1466
+ '1000000000000000000',
1467
+ SwapSide.SELL,
1468
+ dexKey,
1469
+ ContractMethod.simpleSwap,
1470
+ network,
1471
+ provider,
1472
+ );
1473
+ });
1474
+ });
1475
+ describe('MultiSwap', () => {
1476
+ it('TOKEN -> ETH', async () => {
1477
+ await testE2E(
1478
+ tokens.USDT,
1479
+ tokens.ETH,
1480
+ holders.USDT,
1481
+ '20000000',
1482
+ SwapSide.SELL,
1483
+ dexKey,
1484
+ ContractMethod.multiSwap,
1485
+ network,
1486
+ provider,
1487
+ );
1488
+ });
1489
+ it('ETH -> TOKEN', async () => {
1490
+ await testE2E(
1491
+ tokens.ETH,
1492
+ tokens.USDT,
1493
+ holders.ETH,
1494
+ '10000000000000000',
1495
+ SwapSide.SELL,
1496
+ dexKey,
1497
+ ContractMethod.multiSwap,
1498
+ network,
1499
+ provider,
1500
+ );
1501
+ });
1502
+ it('TOKEN -> TOKEN', async () => {
1503
+ await testE2E(
1504
+ tokens.USDC,
1505
+ tokens.USDT,
1506
+ holders.USDC,
1507
+ '200000000',
1508
+ SwapSide.SELL,
1509
+ dexKey,
1510
+ ContractMethod.multiSwap,
1511
+ network,
1512
+ provider,
1513
+ );
1514
+ });
1515
+ });
1516
+ describe('SimpleBuy', () => {
1517
+ it('TOKEN -> ETH', async () => {
1518
+ await testE2E(
1519
+ tokens.USDT,
1520
+ tokens.ETH,
1521
+ holders.USDT,
1522
+ '10000000000000000',
1523
+ SwapSide.BUY,
1524
+ dexKey,
1525
+ ContractMethod.simpleBuy,
1526
+ network,
1527
+ provider,
1528
+ );
1529
+ });
1530
+ it('ETH -> TOKEN', async () => {
1531
+ await testE2E(
1532
+ tokens.ETH,
1533
+ tokens.USDT,
1534
+ holders.ETH,
1535
+ '20000000',
1536
+ SwapSide.BUY,
1537
+ dexKey,
1538
+ ContractMethod.simpleBuy,
1539
+ network,
1540
+ provider,
1541
+ );
1542
+ });
1543
+ it('TOKEN -> TOKEN', async () => {
1544
+ await testE2E(
1545
+ tokens.USDC,
1546
+ tokens.USDT,
1547
+ holders.USDC,
1548
+ '2000000',
1549
+ SwapSide.BUY,
1550
+ dexKey,
1551
+ ContractMethod.simpleBuy,
1552
+ network,
1553
+ provider,
1554
+ );
1555
+ });
1556
+ });
1557
+ describe('MegaSwap', () => {
1558
+ it('TOKEN -> ETH', async () => {
1559
+ await testE2E(
1560
+ tokens.USDT,
1561
+ tokens.ETH,
1562
+ holders.USDT,
1563
+ '20000000',
1564
+ SwapSide.SELL,
1565
+ dexKey,
1566
+ ContractMethod.megaSwap,
1567
+ network,
1568
+ provider,
1569
+ );
1570
+ });
1571
+ it('ETH -> TOKEN', async () => {
1572
+ await testE2E(
1573
+ tokens.ETH,
1574
+ tokens.USDT,
1575
+ holders.ETH,
1576
+ '10000000000000000',
1577
+ SwapSide.SELL,
1578
+ dexKey,
1579
+ ContractMethod.megaSwap,
1580
+ network,
1581
+ provider,
1582
+ );
1583
+ });
1584
+ it('TOKEN -> TOKEN', async () => {
1585
+ await testE2E(
1586
+ tokens.USDC,
1587
+ tokens.USDT,
1588
+ holders.USDC,
1589
+ '200000000',
1590
+ SwapSide.SELL,
1591
+ dexKey,
1592
+ ContractMethod.megaSwap,
1593
+ network,
1594
+ provider,
1595
+ );
1596
+ });
1597
+ });
1598
+ });
1599
+
1600
+ describe('PancakeSwapV2', () => {
1601
+ const dexKey = 'PancakeSwapV2';
1602
+
1603
+ describe('Simpleswap', () => {
1604
+ it('TOKEN -> ETH', async () => {
1605
+ await testE2E(
1606
+ tokens.USDT,
1607
+ tokens.ETH,
1608
+ holders.USDT,
1609
+ '200000000',
1610
+ SwapSide.SELL,
1611
+ dexKey,
1612
+ ContractMethod.simpleSwap,
1613
+ network,
1614
+ provider,
1615
+ );
1616
+ });
1617
+ it('ETH -> TOKEN', async () => {
1618
+ await testE2E(
1619
+ tokens.ETH,
1620
+ tokens.USDT,
1621
+ holders.ETH,
1622
+ '500000000000000000',
1623
+ SwapSide.SELL,
1624
+ dexKey,
1625
+ ContractMethod.simpleSwap,
1626
+ network,
1627
+ provider,
1628
+ );
1629
+ });
1630
+ it('TOKEN -> TOKEN', async () => {
1631
+ await testE2E(
1632
+ tokens.USDC,
1633
+ tokens.STG,
1634
+ holders.USDC,
1635
+ '50000',
1636
+ SwapSide.SELL,
1637
+ dexKey,
1638
+ ContractMethod.simpleSwap,
1639
+ network,
1640
+ provider,
1641
+ );
1642
+ });
1643
+ });
1644
+
1645
+ describe('SimpleBuy', () => {
1646
+ it('TOKEN -> ETH', async () => {
1647
+ await testE2E(
1648
+ tokens.USDT,
1649
+ tokens.ETH,
1650
+ holders.USDT,
1651
+ '2000000000',
1652
+ SwapSide.BUY,
1653
+ dexKey,
1654
+ ContractMethod.simpleBuy,
1655
+ network,
1656
+ provider,
1657
+ );
1658
+ });
1659
+ it('ETH -> TOKEN', async () => {
1660
+ await testE2E(
1661
+ tokens.ETH,
1662
+ tokens.USDT,
1663
+ holders.ETH,
1664
+ '1000000',
1665
+ SwapSide.BUY,
1666
+ dexKey,
1667
+ ContractMethod.simpleBuy,
1668
+ network,
1669
+ provider,
1670
+ );
1671
+ });
1672
+ it('TOKEN -> TOKEN', async () => {
1673
+ await testE2E(
1674
+ tokens.USDC,
1675
+ tokens.STG,
1676
+ holders.USDC,
1677
+ '100000',
1678
+ SwapSide.BUY,
1679
+ dexKey,
1680
+ ContractMethod.simpleBuy,
1681
+ network,
1682
+ provider,
1683
+ );
1684
+ });
1685
+ });
1686
+
1687
+ describe('Multiswap', () => {
1688
+ it('TOKEN -> ETH', async () => {
1689
+ await testE2E(
1690
+ tokens.USDT,
1691
+ tokens.ETH,
1692
+ holders.USDT,
1693
+ '200000000',
1694
+ SwapSide.SELL,
1695
+ dexKey,
1696
+ ContractMethod.multiSwap,
1697
+ network,
1698
+ provider,
1699
+ );
1700
+ });
1701
+ it('ETH -> TOKEN', async () => {
1702
+ await testE2E(
1703
+ tokens.ETH,
1704
+ tokens.USDT,
1705
+ holders.ETH,
1706
+ '500000000000000000',
1707
+ SwapSide.SELL,
1708
+ dexKey,
1709
+ ContractMethod.multiSwap,
1710
+ network,
1711
+ provider,
1712
+ );
1713
+ });
1714
+ it('TOKEN -> TOKEN', async () => {
1715
+ await testE2E(
1716
+ tokens.USDC,
1717
+ tokens.STG,
1718
+ holders.USDC,
1719
+ '1000000',
1720
+ SwapSide.SELL,
1721
+ dexKey,
1722
+ ContractMethod.multiSwap,
1723
+ network,
1724
+ provider,
1725
+ );
1726
+ });
1727
+ });
1728
+ describe('MegaPath', () => {
1729
+ it('TOKEN -> ETH', async () => {
1730
+ await testE2E(
1731
+ tokens.USDT,
1732
+ tokens.ETH,
1733
+ holders.USDT,
1734
+ '200000000',
1735
+ SwapSide.SELL,
1736
+ dexKey,
1737
+ ContractMethod.megaSwap,
1738
+ network,
1739
+ provider,
1740
+ );
1741
+ });
1742
+ it('ETH -> TOKEN', async () => {
1743
+ await testE2E(
1744
+ tokens.ETH,
1745
+ tokens.USDT,
1746
+ holders.ETH,
1747
+ '500000000000000000',
1748
+ SwapSide.SELL,
1749
+ dexKey,
1750
+ ContractMethod.megaSwap,
1751
+ network,
1752
+ provider,
1753
+ );
1754
+ });
1755
+ it('TOKEN -> TOKEN', async () => {
1756
+ await testE2E(
1757
+ tokens.USDC,
1758
+ tokens.STG,
1759
+ holders.USDC,
1760
+ '1000000',
1761
+ SwapSide.SELL,
1762
+ dexKey,
1763
+ ContractMethod.megaSwap,
1764
+ network,
1765
+ provider,
1766
+ );
1767
+ });
1768
+ });
1769
+ });
1770
+
1771
+ describe(`Swapsicle`, () => {
1772
+ const dexKey = 'Swapsicle';
1773
+
1774
+ const sideToContractMethods = new Map([
1775
+ [
1776
+ SwapSide.SELL,
1777
+ [
1778
+ ContractMethod.simpleSwap,
1779
+ ContractMethod.multiSwap,
1780
+ ContractMethod.megaSwap,
1781
+ ],
1782
+ ],
1783
+ [SwapSide.BUY, [ContractMethod.simpleBuy, ContractMethod.buy]],
1784
+ ]);
1785
+
1786
+ const pairs: { name: string; sellAmount: string; buyAmount: string }[][] = [
1787
+ [
1788
+ { name: 'USDC', sellAmount: '7000', buyAmount: '10000' },
1789
+ { name: 'WETH', sellAmount: '1000000000000000000', buyAmount: '4000' },
1790
+ ],
1791
+ ];
1792
+
1793
+ sideToContractMethods.forEach((contractMethods, side) =>
1794
+ describe(`${side}`, () => {
1795
+ contractMethods.forEach((contractMethod: ContractMethod) => {
1796
+ pairs.forEach(pair => {
1797
+ describe(`${contractMethod}`, () => {
1798
+ it(`${pair[0].name} -> ${pair[1].name}`, async () => {
1799
+ await testE2E(
1800
+ tokens[pair[0].name],
1801
+ tokens[pair[1].name],
1802
+ holders[pair[0].name],
1803
+ side === SwapSide.SELL
1804
+ ? pair[0].sellAmount
1805
+ : pair[0].buyAmount,
1806
+ side,
1807
+ dexKey,
1808
+ contractMethod,
1809
+ network,
1810
+ provider,
1811
+ );
1812
+ });
1813
+ it(`${pair[1].name} -> ${pair[0].name}`, async () => {
1814
+ await testE2E(
1815
+ tokens[pair[1].name],
1816
+ tokens[pair[0].name],
1817
+ holders[pair[1].name],
1818
+ side === SwapSide.SELL
1819
+ ? pair[1].sellAmount
1820
+ : pair[1].buyAmount,
1821
+ side,
1822
+ dexKey,
1823
+ contractMethod,
1824
+ network,
1825
+ provider,
1826
+ );
1827
+ });
1828
+ });
1829
+ });
1830
+ });
1831
+ }),
1832
+ );
1833
+ });
1834
+ });