@paraswap/dex-lib 4.2.9 → 4.2.10-miro-migrator.1

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.
@@ -0,0 +1,540 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "components": [
6
+ { "internalType": "address", "name": "xyz", "type": "address" },
7
+ { "internalType": "address", "name": "weth", "type": "address" },
8
+ {
9
+ "internalType": "address",
10
+ "name": "bridgeStaking",
11
+ "type": "address"
12
+ },
13
+ {
14
+ "internalType": "uint256",
15
+ "name": "destChainId",
16
+ "type": "uint256"
17
+ }
18
+ ],
19
+ "internalType": "struct IMiroMigrator.BridgeConfig[]",
20
+ "name": "_bridgeConfigs",
21
+ "type": "tuple[]"
22
+ },
23
+ { "internalType": "address", "name": "sePSP1", "type": "address" },
24
+ { "internalType": "address", "name": "sePSP2", "type": "address" },
25
+ { "internalType": "address", "name": "seXYZ", "type": "address" },
26
+ {
27
+ "internalType": "contract IAcrossSpokePool",
28
+ "name": "spokePool",
29
+ "type": "address"
30
+ }
31
+ ],
32
+ "stateMutability": "nonpayable",
33
+ "type": "constructor"
34
+ },
35
+ { "inputs": [], "name": "EnforcedPause", "type": "error" },
36
+ { "inputs": [], "name": "ExpectedPause", "type": "error" },
37
+ { "inputs": [], "name": "InsufficientMsgValue", "type": "error" },
38
+ { "inputs": [], "name": "InvalidDestinationChainId", "type": "error" },
39
+ {
40
+ "inputs": [
41
+ { "internalType": "address", "name": "owner", "type": "address" }
42
+ ],
43
+ "name": "OwnableInvalidOwner",
44
+ "type": "error"
45
+ },
46
+ {
47
+ "inputs": [
48
+ { "internalType": "address", "name": "account", "type": "address" }
49
+ ],
50
+ "name": "OwnableUnauthorizedAccount",
51
+ "type": "error"
52
+ },
53
+ {
54
+ "anonymous": false,
55
+ "inputs": [
56
+ {
57
+ "indexed": true,
58
+ "internalType": "address",
59
+ "name": "user",
60
+ "type": "address"
61
+ },
62
+ {
63
+ "indexed": true,
64
+ "internalType": "uint256",
65
+ "name": "amount",
66
+ "type": "uint256"
67
+ }
68
+ ],
69
+ "name": "Migrated",
70
+ "type": "event"
71
+ },
72
+ {
73
+ "anonymous": false,
74
+ "inputs": [
75
+ {
76
+ "indexed": true,
77
+ "internalType": "address",
78
+ "name": "previousOwner",
79
+ "type": "address"
80
+ },
81
+ {
82
+ "indexed": true,
83
+ "internalType": "address",
84
+ "name": "newOwner",
85
+ "type": "address"
86
+ }
87
+ ],
88
+ "name": "OwnershipTransferred",
89
+ "type": "event"
90
+ },
91
+ {
92
+ "anonymous": false,
93
+ "inputs": [
94
+ {
95
+ "indexed": false,
96
+ "internalType": "address",
97
+ "name": "account",
98
+ "type": "address"
99
+ }
100
+ ],
101
+ "name": "Paused",
102
+ "type": "event"
103
+ },
104
+ {
105
+ "anonymous": false,
106
+ "inputs": [
107
+ {
108
+ "indexed": true,
109
+ "internalType": "address",
110
+ "name": "user",
111
+ "type": "address"
112
+ },
113
+ {
114
+ "indexed": true,
115
+ "internalType": "uint256",
116
+ "name": "xyzAmount",
117
+ "type": "uint256"
118
+ },
119
+ {
120
+ "indexed": true,
121
+ "internalType": "uint256",
122
+ "name": "wethAmount",
123
+ "type": "uint256"
124
+ },
125
+ {
126
+ "indexed": false,
127
+ "internalType": "uint256",
128
+ "name": "destChainId",
129
+ "type": "uint256"
130
+ },
131
+ {
132
+ "indexed": false,
133
+ "internalType": "bytes",
134
+ "name": "message",
135
+ "type": "bytes"
136
+ }
137
+ ],
138
+ "name": "StakeBridgingInitiated",
139
+ "type": "event"
140
+ },
141
+ {
142
+ "anonymous": false,
143
+ "inputs": [
144
+ {
145
+ "indexed": false,
146
+ "internalType": "address",
147
+ "name": "account",
148
+ "type": "address"
149
+ }
150
+ ],
151
+ "name": "Unpaused",
152
+ "type": "event"
153
+ },
154
+ {
155
+ "inputs": [],
156
+ "name": "BURN_ADDR",
157
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
158
+ "stateMutability": "view",
159
+ "type": "function"
160
+ },
161
+ {
162
+ "inputs": [],
163
+ "name": "PSP",
164
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
165
+ "stateMutability": "view",
166
+ "type": "function"
167
+ },
168
+ {
169
+ "inputs": [],
170
+ "name": "SE_PSP1",
171
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
172
+ "stateMutability": "view",
173
+ "type": "function"
174
+ },
175
+ {
176
+ "inputs": [],
177
+ "name": "SE_PSP2",
178
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
179
+ "stateMutability": "view",
180
+ "type": "function"
181
+ },
182
+ {
183
+ "inputs": [],
184
+ "name": "SE_XYZ",
185
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
186
+ "stateMutability": "view",
187
+ "type": "function"
188
+ },
189
+ {
190
+ "inputs": [],
191
+ "name": "SPOKE_POOL",
192
+ "outputs": [
193
+ {
194
+ "internalType": "contract IAcrossSpokePool",
195
+ "name": "",
196
+ "type": "address"
197
+ }
198
+ ],
199
+ "stateMutability": "view",
200
+ "type": "function"
201
+ },
202
+ {
203
+ "inputs": [],
204
+ "name": "WETH",
205
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
206
+ "stateMutability": "view",
207
+ "type": "function"
208
+ },
209
+ {
210
+ "inputs": [],
211
+ "name": "XYZ",
212
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
213
+ "stateMutability": "view",
214
+ "type": "function"
215
+ },
216
+ {
217
+ "inputs": [
218
+ { "internalType": "uint256", "name": "chainId", "type": "uint256" }
219
+ ],
220
+ "name": "bridgeConfigs",
221
+ "outputs": [
222
+ { "internalType": "address", "name": "xyz", "type": "address" },
223
+ { "internalType": "address", "name": "weth", "type": "address" },
224
+ { "internalType": "address", "name": "bridgeStaking", "type": "address" },
225
+ { "internalType": "uint256", "name": "destChainId", "type": "uint256" }
226
+ ],
227
+ "stateMutability": "view",
228
+ "type": "function"
229
+ },
230
+ {
231
+ "inputs": [
232
+ { "internalType": "uint256", "name": "xyzAmount", "type": "uint256" },
233
+ { "internalType": "uint256", "name": "wethAmount", "type": "uint256" },
234
+ { "internalType": "uint256", "name": "destChainId", "type": "uint256" },
235
+ {
236
+ "internalType": "uint256",
237
+ "name": "minDestBptAmount",
238
+ "type": "uint256"
239
+ },
240
+ { "internalType": "address", "name": "beneficiary", "type": "address" },
241
+ {
242
+ "components": [
243
+ {
244
+ "internalType": "uint256",
245
+ "name": "relayerFee",
246
+ "type": "uint256"
247
+ },
248
+ {
249
+ "internalType": "address",
250
+ "name": "exclusiveRelayer",
251
+ "type": "address"
252
+ },
253
+ {
254
+ "internalType": "uint32",
255
+ "name": "quoteTimestamp",
256
+ "type": "uint32"
257
+ },
258
+ {
259
+ "internalType": "uint32",
260
+ "name": "fillDeadline",
261
+ "type": "uint32"
262
+ },
263
+ {
264
+ "internalType": "uint32",
265
+ "name": "exclusivityDeadline",
266
+ "type": "uint32"
267
+ }
268
+ ],
269
+ "internalType": "struct IMiroMigrator.BridgeData",
270
+ "name": "xyzBridgeData",
271
+ "type": "tuple"
272
+ },
273
+ {
274
+ "components": [
275
+ {
276
+ "internalType": "uint256",
277
+ "name": "relayerFee",
278
+ "type": "uint256"
279
+ },
280
+ {
281
+ "internalType": "address",
282
+ "name": "exclusiveRelayer",
283
+ "type": "address"
284
+ },
285
+ {
286
+ "internalType": "uint32",
287
+ "name": "quoteTimestamp",
288
+ "type": "uint32"
289
+ },
290
+ {
291
+ "internalType": "uint32",
292
+ "name": "fillDeadline",
293
+ "type": "uint32"
294
+ },
295
+ {
296
+ "internalType": "uint32",
297
+ "name": "exclusivityDeadline",
298
+ "type": "uint32"
299
+ }
300
+ ],
301
+ "internalType": "struct IMiroMigrator.BridgeData",
302
+ "name": "wethBridgeData",
303
+ "type": "tuple"
304
+ },
305
+ { "internalType": "bytes", "name": "permitData", "type": "bytes" }
306
+ ],
307
+ "name": "bridgeXYZAndStake",
308
+ "outputs": [],
309
+ "stateMutability": "payable",
310
+ "type": "function"
311
+ },
312
+ {
313
+ "inputs": [
314
+ { "internalType": "uint256", "name": "pspAmount", "type": "uint256" },
315
+ { "internalType": "uint256", "name": "wethAmount", "type": "uint256" },
316
+ { "internalType": "uint256", "name": "minBptOut", "type": "uint256" },
317
+ { "internalType": "bytes", "name": "permitData", "type": "bytes" }
318
+ ],
319
+ "name": "migratePSPtoSeXYZ",
320
+ "outputs": [],
321
+ "stateMutability": "payable",
322
+ "type": "function"
323
+ },
324
+ {
325
+ "inputs": [
326
+ { "internalType": "uint256", "name": "pspAmount", "type": "uint256" },
327
+ { "internalType": "bytes", "name": "permitData", "type": "bytes" }
328
+ ],
329
+ "name": "migratePSPtoXYZ",
330
+ "outputs": [],
331
+ "stateMutability": "nonpayable",
332
+ "type": "function"
333
+ },
334
+ {
335
+ "inputs": [
336
+ { "internalType": "uint256", "name": "sePSP1Amount", "type": "uint256" },
337
+ { "internalType": "uint256", "name": "wethAmount", "type": "uint256" },
338
+ { "internalType": "uint256", "name": "minBptOut", "type": "uint256" },
339
+ { "internalType": "bytes", "name": "permitData", "type": "bytes" }
340
+ ],
341
+ "name": "migrateSePSP1toSeXYZ",
342
+ "outputs": [],
343
+ "stateMutability": "payable",
344
+ "type": "function"
345
+ },
346
+ {
347
+ "inputs": [
348
+ { "internalType": "uint256", "name": "sePSP1Amount", "type": "uint256" },
349
+ { "internalType": "bytes", "name": "permitData", "type": "bytes" }
350
+ ],
351
+ "name": "migrateSePSP1toXYZ",
352
+ "outputs": [],
353
+ "stateMutability": "nonpayable",
354
+ "type": "function"
355
+ },
356
+ {
357
+ "inputs": [
358
+ { "internalType": "uint256", "name": "sePSP2Amount", "type": "uint256" },
359
+ { "internalType": "uint256", "name": "minPspAmount", "type": "uint256" },
360
+ { "internalType": "uint256", "name": "minWethAmount", "type": "uint256" },
361
+ { "internalType": "uint256", "name": "minBptOut", "type": "uint256" },
362
+ { "internalType": "bytes", "name": "permitData", "type": "bytes" }
363
+ ],
364
+ "name": "migrateSePSP2toSeXYZ",
365
+ "outputs": [],
366
+ "stateMutability": "nonpayable",
367
+ "type": "function"
368
+ },
369
+ {
370
+ "inputs": [
371
+ { "internalType": "uint256", "name": "sePSP2Amount", "type": "uint256" },
372
+ { "internalType": "uint256", "name": "minPspAmount", "type": "uint256" },
373
+ { "internalType": "uint256", "name": "minWethAmount", "type": "uint256" },
374
+ { "internalType": "uint256", "name": "destChainId", "type": "uint256" },
375
+ {
376
+ "internalType": "uint256",
377
+ "name": "minDestBptAmount",
378
+ "type": "uint256"
379
+ },
380
+ { "internalType": "address", "name": "beneficiary", "type": "address" },
381
+ {
382
+ "components": [
383
+ {
384
+ "internalType": "uint256",
385
+ "name": "relayerFee",
386
+ "type": "uint256"
387
+ },
388
+ {
389
+ "internalType": "address",
390
+ "name": "exclusiveRelayer",
391
+ "type": "address"
392
+ },
393
+ {
394
+ "internalType": "uint32",
395
+ "name": "quoteTimestamp",
396
+ "type": "uint32"
397
+ },
398
+ {
399
+ "internalType": "uint32",
400
+ "name": "fillDeadline",
401
+ "type": "uint32"
402
+ },
403
+ {
404
+ "internalType": "uint32",
405
+ "name": "exclusivityDeadline",
406
+ "type": "uint32"
407
+ }
408
+ ],
409
+ "internalType": "struct IMiroMigrator.BridgeData",
410
+ "name": "xyzBridgeData",
411
+ "type": "tuple"
412
+ },
413
+ {
414
+ "components": [
415
+ {
416
+ "internalType": "uint256",
417
+ "name": "relayerFee",
418
+ "type": "uint256"
419
+ },
420
+ {
421
+ "internalType": "address",
422
+ "name": "exclusiveRelayer",
423
+ "type": "address"
424
+ },
425
+ {
426
+ "internalType": "uint32",
427
+ "name": "quoteTimestamp",
428
+ "type": "uint32"
429
+ },
430
+ {
431
+ "internalType": "uint32",
432
+ "name": "fillDeadline",
433
+ "type": "uint32"
434
+ },
435
+ {
436
+ "internalType": "uint32",
437
+ "name": "exclusivityDeadline",
438
+ "type": "uint32"
439
+ }
440
+ ],
441
+ "internalType": "struct IMiroMigrator.BridgeData",
442
+ "name": "wethBridgeData",
443
+ "type": "tuple"
444
+ },
445
+ { "internalType": "bytes", "name": "permitData", "type": "bytes" }
446
+ ],
447
+ "name": "migrateSePSP2toSeXYZAndBridge",
448
+ "outputs": [],
449
+ "stateMutability": "nonpayable",
450
+ "type": "function"
451
+ },
452
+ {
453
+ "inputs": [],
454
+ "name": "owner",
455
+ "outputs": [{ "internalType": "address", "name": "", "type": "address" }],
456
+ "stateMutability": "view",
457
+ "type": "function"
458
+ },
459
+ {
460
+ "inputs": [],
461
+ "name": "pause",
462
+ "outputs": [],
463
+ "stateMutability": "nonpayable",
464
+ "type": "function"
465
+ },
466
+ {
467
+ "inputs": [],
468
+ "name": "paused",
469
+ "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
470
+ "stateMutability": "view",
471
+ "type": "function"
472
+ },
473
+ {
474
+ "inputs": [
475
+ { "internalType": "address", "name": "token", "type": "address" },
476
+ { "internalType": "address", "name": "to", "type": "address" }
477
+ ],
478
+ "name": "reClaimERC20",
479
+ "outputs": [],
480
+ "stateMutability": "nonpayable",
481
+ "type": "function"
482
+ },
483
+ {
484
+ "inputs": [{ "internalType": "address", "name": "to", "type": "address" }],
485
+ "name": "reClaimETH",
486
+ "outputs": [],
487
+ "stateMutability": "nonpayable",
488
+ "type": "function"
489
+ },
490
+ {
491
+ "inputs": [],
492
+ "name": "renounceOwnership",
493
+ "outputs": [],
494
+ "stateMutability": "nonpayable",
495
+ "type": "function"
496
+ },
497
+ {
498
+ "inputs": [
499
+ {
500
+ "components": [
501
+ { "internalType": "address", "name": "xyz", "type": "address" },
502
+ { "internalType": "address", "name": "weth", "type": "address" },
503
+ {
504
+ "internalType": "address",
505
+ "name": "bridgeStaking",
506
+ "type": "address"
507
+ },
508
+ {
509
+ "internalType": "uint256",
510
+ "name": "destChainId",
511
+ "type": "uint256"
512
+ }
513
+ ],
514
+ "internalType": "struct IMiroMigrator.BridgeConfig[]",
515
+ "name": "_bridgeConfigs",
516
+ "type": "tuple[]"
517
+ }
518
+ ],
519
+ "name": "setBridgeConfigs",
520
+ "outputs": [],
521
+ "stateMutability": "nonpayable",
522
+ "type": "function"
523
+ },
524
+ {
525
+ "inputs": [
526
+ { "internalType": "address", "name": "newOwner", "type": "address" }
527
+ ],
528
+ "name": "transferOwnership",
529
+ "outputs": [],
530
+ "stateMutability": "nonpayable",
531
+ "type": "function"
532
+ },
533
+ {
534
+ "inputs": [],
535
+ "name": "unpause",
536
+ "outputs": [],
537
+ "stateMutability": "nonpayable",
538
+ "type": "function"
539
+ }
540
+ ]
@@ -109,6 +109,7 @@ const wrapped_m_m_1 = require("./usual/wrapped-m-m");
109
109
  const usual_pp_1 = require("./usual-pp/usual-pp");
110
110
  const ekubo_1 = require("./ekubo/ekubo");
111
111
  const uniswap_v4_1 = require("./uniswap-v4/uniswap-v4");
112
+ const miro_migrator_1 = require("./miro-migrator/miro-migrator");
112
113
  const LegacyDexes = [
113
114
  curve_v2_1.CurveV2,
114
115
  stable_pool_1.StablePool,
@@ -208,6 +209,7 @@ const Dexes = [
208
209
  usual_m_usd0_1.UsualMUsd0,
209
210
  usual_pp_1.UsualPP,
210
211
  ekubo_1.Ekubo,
212
+ miro_migrator_1.MiroMigrator,
211
213
  ];
212
214
  class DexAdapterService {
213
215
  dexHelper;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dex/index.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,kDAA8C;AAE9C,qDAAiD;AACjD,2DAAuD;AACvD,sCAAmC;AACnC,0EAAsE;AACtE,wDAAoD;AACpD,2DAAuD;AACvD,uDAA0D;AAC1D,wDAAoD;AACpD,sDAAwD;AACxD,sDAAsD;AACtD,gDAA6C;AAC7C,4CAAyC;AACzC,4CAAyC;AACzC,4CAAyC;AACzC,kDAA+C;AAC/C,+CAA2C;AAC3C,+CAA2C;AAC3C,kDAA8C;AAC9C,+CAA2C;AAC3C,uCAAmC;AACnC,+CAA4C;AAC5C,yCAAsC;AAEtC,4CAAwC;AA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,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AArLD,8CAqLC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dex/index.ts"],"names":[],"mappings":";;;;;;AAAA,oDAAuB;AAEvB,kDAA8C;AAE9C,qDAAiD;AACjD,2DAAuD;AACvD,sCAAmC;AACnC,0EAAsE;AACtE,wDAAoD;AACpD,2DAAuD;AACvD,uDAA0D;AAC1D,wDAAoD;AACpD,sDAAwD;AACxD,sDAAsD;AACtD,gDAA6C;AAC7C,4CAAyC;AACzC,4CAAyC;AACzC,4CAAyC;AACzC,kDAA+C;AAC/C,+CAA2C;AAC3C,+CAA2C;AAC3C,kDAA8C;AAC9C,+CAA2C;AAC3C,uCAAmC;AACnC,+CAA4C;AAC5C,yCAAsC;AAEtC,4CAAwC;AAExC,sCAAmC;AACnC,sDAAmD;AACnD,qDAAiD;AACjD,kDAA+C;AAC/C,mCAAgC;AAChC,qDAAgD;AAChD,yFAAoF;AACpF,iDAAkD;AAClD,+CAA4C;AAC5C,wDAAoD;AACpD,4DAAyD;AACzD,0DAAuD;AACvD,8DAA2D;AAC3D,kEAA+D;AAC/D,sEAAmE;AACnE,kEAA+D;AAC/D,wEAAqE;AACrE,qDAAkD;AAClD,0DAAuD;AACvD,kEAA+D;AAC/D,sEAAmE;AACnE,2DAAuD;AACvD,uDAA0D;AAC1D,kDAA8C;AAC9C,0EAAqE;AACrE,2DAAwD;AACxD,0EAAqE;AACrE,gFAA0E;AAC1E,4DAA4D;AAC5D,2DAAuD;AACvD,4CAAyC;AACzC,+CAA4C;AAC5C,+CAA4C;AAC5C,kDAA+C;AAC/C,kDAA+C;AAC/C,iEAA6D;AAC7D,2DAAuD;AACvD,2DAAuD;AACvD,2DAAuD;AACvD,2DAAuD;AACvD,kDAA8C;AAC9C,uEAAiE;AACjE,uEAAiE;AACjE,oEAAgE;AAChE,+CAA4C;AAC5C,0EAAsE;AACtE,mFAA8E;AAC9E,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AAO,IAAI,CAAC,cAAc,CAAC;QAC7B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,MAAc,EAAE,IAAc;QACvC,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1D,OAAO,IAAI,KAAK,oBAAQ,CAAC,IAAI;YAC3B,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC;YAClC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IACtC,CAAC;IAED,qCAAqC,CAAC,MAAc;QAClD,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACrC,OAAO,CAAC,CAAC,GAAG,CAAC,4BAA4B,CAAC;QAC5C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AArLD,8CAqLC"}
@@ -0,0 +1,3 @@
1
+ import { DexParams } from './types';
2
+ import { DexConfigMap } from '../../types';
3
+ export declare const MiroMigratorConfig: DexConfigMap<DexParams>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MiroMigratorConfig = void 0;
4
+ const constants_1 = require("../../constants");
5
+ exports.MiroMigratorConfig = {
6
+ MiroMigrator: {
7
+ [constants_1.Network.OPTIMISM]: {
8
+ migratorAddress: '0x5032433fB65D7db8e8B90Cb239d50fDFD941fb6b',
9
+ pspTokenAddress: '0x326Aec8d7d99d1D6022c57C5f6194D2a7867227d',
10
+ xyzTokenAddress: '0xa2781111F824Ca1Cd98454B2C9722BAefC898e99',
11
+ },
12
+ },
13
+ };
14
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/config.ts"],"names":[],"mappings":";;;AAEA,+CAA0C;AAE7B,QAAA,kBAAkB,GAA4B;IACzD,YAAY,EAAE;QACZ,CAAC,mBAAO,CAAC,QAAQ,CAAC,EAAE;YAClB,eAAe,EAAE,4CAA4C;YAC7D,eAAe,EAAE,4CAA4C;YAC7D,eAAe,EAAE,4CAA4C;SAC9D;KACF;CACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const MIRO_MIGRATION_GAS_COST = 90000;
2
+ export declare const TRANSFER_TOPIC = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TRANSFER_TOPIC = exports.MIRO_MIGRATION_GAS_COST = void 0;
4
+ exports.MIRO_MIGRATION_GAS_COST = 90_000;
5
+ exports.TRANSFER_TOPIC = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef';
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,MAAM,CAAC;AAEjC,QAAA,cAAc,GACzB,oEAAoE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { DeepReadonly } from 'ts-essentials';
3
+ import { Log, Logger } from '../../types';
4
+ import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
+ import { IDexHelper } from '../../dex-helper/idex-helper';
6
+ import { PoolState } from './types';
7
+ export declare class MiroMigratorEventPool extends StatefulEventSubscriber<PoolState> {
8
+ readonly parentName: string;
9
+ protected network: number;
10
+ protected dexHelper: IDexHelper;
11
+ protected migratorInterface: Interface;
12
+ protected migratorAddress: string;
13
+ protected xyzInterface: Interface;
14
+ protected xyzAddress: string;
15
+ protected transferTopic: string;
16
+ handlers: {
17
+ [event: string]: (event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>) => DeepReadonly<PoolState> | null;
18
+ };
19
+ logDecoder: (log: Log) => any;
20
+ addressesSubscribed: string[];
21
+ constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, migratorInterface: Interface, migratorAddress: string, xyzInterface: Interface, xyzAddress: string, transferTopic: string);
22
+ /**
23
+ * The function is called every time any of the subscribed
24
+ * addresses release log. The function accepts the current
25
+ * state, updates the state according to the log, and returns
26
+ * the updated state.
27
+ * @param state - Current state of event subscriber
28
+ * @param log - Log released by one of the subscribed addresses
29
+ * @returns Updates state of the event subscriber after the log
30
+ */
31
+ protected processLog(state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState> | null>;
32
+ /**
33
+ * The function generates state using on-chain calls. This
34
+ * function is called to regenerate state if the event based
35
+ * system fails to fetch events and the local state is no
36
+ * more correct.
37
+ * @param blockNumber - Blocknumber for which the state should
38
+ * should be generated
39
+ * @returns state of the event subscriber at blocknumber
40
+ */
41
+ generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<PoolState>>;
42
+ getOrGenerateState(blockNumber: number): Promise<PoolState>;
43
+ handleTransferTo(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState>>;
44
+ handleTransferFrom(event: any, state: DeepReadonly<PoolState>, log: Readonly<Log>): Promise<DeepReadonly<PoolState>>;
45
+ }
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MiroMigratorEventPool = void 0;
4
+ const utils_1 = require("../../utils");
5
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
6
+ const decoders_1 = require("../../lib/decoders");
7
+ class MiroMigratorEventPool extends stateful_event_subscriber_1.StatefulEventSubscriber {
8
+ parentName;
9
+ network;
10
+ dexHelper;
11
+ migratorInterface;
12
+ migratorAddress;
13
+ xyzInterface;
14
+ xyzAddress;
15
+ transferTopic;
16
+ handlers = {};
17
+ logDecoder;
18
+ addressesSubscribed;
19
+ constructor(parentName, network, dexHelper, logger, migratorInterface, migratorAddress, xyzInterface, xyzAddress, transferTopic) {
20
+ super(parentName, 'POOL_NAME', dexHelper, logger); // TODO add pool name
21
+ this.parentName = parentName;
22
+ this.network = network;
23
+ this.dexHelper = dexHelper;
24
+ this.migratorInterface = migratorInterface;
25
+ this.migratorAddress = migratorAddress;
26
+ this.xyzInterface = xyzInterface;
27
+ this.xyzAddress = xyzAddress;
28
+ this.transferTopic = transferTopic;
29
+ this.logDecoder = (log) => this.migratorInterface.parseLog(log);
30
+ this.addressesSubscribed = [migratorAddress];
31
+ }
32
+ /**
33
+ * The function is called every time any of the subscribed
34
+ * addresses release log. The function accepts the current
35
+ * state, updates the state according to the log, and returns
36
+ * the updated state.
37
+ * @param state - Current state of event subscriber
38
+ * @param log - Log released by one of the subscribed addresses
39
+ * @returns Updates state of the event subscriber after the log
40
+ */
41
+ async processLog(state, log) {
42
+ try {
43
+ const event = this.logDecoder(log);
44
+ // TODO test this one and refactor
45
+ if (log.topics[0] === this.transferTopic &&
46
+ event.args.to.toLowerCase() === this.migratorAddress.toLowerCase()) {
47
+ return this.handleTransferTo(event, state, log);
48
+ }
49
+ if (log.topics[0] === this.transferTopic &&
50
+ event.args.from.toLowerCase() === this.migratorAddress.toLowerCase()) {
51
+ return this.handleTransferFrom(event, state, log);
52
+ }
53
+ return null;
54
+ }
55
+ catch (e) {
56
+ (0, utils_1.catchParseLogError)(e, this.logger);
57
+ return null;
58
+ }
59
+ }
60
+ /**
61
+ * The function generates state using on-chain calls. This
62
+ * function is called to regenerate state if the event based
63
+ * system fails to fetch events and the local state is no
64
+ * more correct.
65
+ * @param blockNumber - Blocknumber for which the state should
66
+ * should be generated
67
+ * @returns state of the event subscriber at blocknumber
68
+ */
69
+ async generateState(blockNumber = 'latest') {
70
+ const calls = [
71
+ {
72
+ target: this.xyzAddress,
73
+ callData: this.xyzInterface.encodeFunctionData('balanceOf', [
74
+ this.migratorAddress,
75
+ ]),
76
+ decodeFunction: decoders_1.uint256ToBigInt,
77
+ },
78
+ ];
79
+ const [balance] = await this.dexHelper.multiWrapper.tryAggregate(true, calls, blockNumber);
80
+ return { balance: balance.returnData };
81
+ }
82
+ async getOrGenerateState(blockNumber) {
83
+ let state = this.getState(blockNumber);
84
+ if (!state) {
85
+ state = await this.generateState(blockNumber);
86
+ this.setState(state, blockNumber);
87
+ }
88
+ return state;
89
+ }
90
+ async handleTransferTo(event, state, log) {
91
+ return {
92
+ balance: state.balance + BigInt(event.args.value),
93
+ };
94
+ }
95
+ async handleTransferFrom(event, state, log) {
96
+ return {
97
+ balance: state.balance - BigInt(event.args.value),
98
+ };
99
+ }
100
+ }
101
+ exports.MiroMigratorEventPool = MiroMigratorEventPool;
102
+ //# sourceMappingURL=miro-migrator-pool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miro-migrator-pool.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator-pool.ts"],"names":[],"mappings":";;;AAGA,uCAAiD;AACjD,+EAA0E;AAG1E,iDAAqD;AAErD,MAAa,qBAAsB,SAAQ,mDAAkC;IAchE;IACC;IACA;IAEA;IACA;IACA;IACA;IACA;IArBZ,QAAQ,GAMJ,EAAE,CAAC;IAEP,UAAU,CAAoB;IAE9B,mBAAmB,CAAW;IAE9B,YACW,UAAkB,EACjB,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,iBAA4B,EAC5B,eAAuB,EACvB,YAAuB,EACvB,UAAkB,EAClB,aAAqB;QAE/B,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,qBAAqB;QAV/D,eAAU,GAAV,UAAU,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAErB,sBAAiB,GAAjB,iBAAiB,CAAW;QAC5B,oBAAe,GAAf,eAAe,CAAQ;QACvB,iBAAY,GAAZ,YAAY,CAAW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;YACZ;gBACE,MAAM,EAAE,IAAI,CAAC,UAAU;gBACvB,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,WAAW,EAAE;oBAC1D,IAAI,CAAC,eAAe;iBACrB,CAAC;gBACF,cAAc,EAAE,0BAAe;aAChC;SACF,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,YAAY,CAC9D,IAAI,EACJ,KAAK,EACL,WAAW,CACZ,CAAC;QAEF,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,WAAmB;QAC1C,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,KAAU,EACV,KAA8B,EAC9B,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,KAAU,EACV,KAA8B,EAC9B,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;CACF;AA9HD,sDA8HC"}
@@ -0,0 +1,27 @@
1
+ import { Interface } from '@ethersproject/abi';
2
+ import { DeepReadonly } from 'ts-essentials';
3
+ import { Log, Logger } from '../../types';
4
+ import { StatefulEventSubscriber } from '../../stateful-event-subscriber';
5
+ import { IDexHelper } from '../../dex-helper/idex-helper';
6
+ import { MiroMigratorState } from './types';
7
+ export declare class MiroMigratorEventState extends StatefulEventSubscriber<MiroMigratorState> {
8
+ readonly parentName: string;
9
+ protected network: number;
10
+ protected dexHelper: IDexHelper;
11
+ protected migratorInterface: Interface;
12
+ protected migratorAddress: string;
13
+ protected xyzInterface: Interface;
14
+ protected xyzAddress: string;
15
+ protected transferTopic: string;
16
+ handlers: {
17
+ [event: string]: (event: any, state: DeepReadonly<MiroMigratorState>, log: Readonly<Log>) => DeepReadonly<MiroMigratorState> | null;
18
+ };
19
+ logDecoder: (log: Log) => any;
20
+ addressesSubscribed: string[];
21
+ constructor(parentName: string, network: number, dexHelper: IDexHelper, logger: Logger, migratorInterface: Interface, migratorAddress: string, xyzInterface: Interface, xyzAddress: string, transferTopic: string);
22
+ protected processLog(state: DeepReadonly<MiroMigratorState>, log: Readonly<Log>): Promise<DeepReadonly<MiroMigratorState> | null>;
23
+ generateState(blockNumber?: number | 'latest'): Promise<DeepReadonly<MiroMigratorState>>;
24
+ getOrGenerateState(blockNumber: number): Promise<MiroMigratorState>;
25
+ handleTransferTo(event: any, state: DeepReadonly<MiroMigratorState>, log: Readonly<Log>): Promise<DeepReadonly<MiroMigratorState>>;
26
+ handleTransferFrom(event: any, state: DeepReadonly<MiroMigratorState>, log: Readonly<Log>): Promise<DeepReadonly<MiroMigratorState>>;
27
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MiroMigratorEventState = void 0;
4
+ const utils_1 = require("../../utils");
5
+ const stateful_event_subscriber_1 = require("../../stateful-event-subscriber");
6
+ const decoders_1 = require("../../lib/decoders");
7
+ class MiroMigratorEventState extends stateful_event_subscriber_1.StatefulEventSubscriber {
8
+ parentName;
9
+ network;
10
+ dexHelper;
11
+ migratorInterface;
12
+ migratorAddress;
13
+ xyzInterface;
14
+ xyzAddress;
15
+ transferTopic;
16
+ handlers = {};
17
+ logDecoder;
18
+ addressesSubscribed;
19
+ constructor(parentName, network, dexHelper, logger, migratorInterface, migratorAddress, xyzInterface, xyzAddress, transferTopic) {
20
+ super(parentName, 'miro_migrator_state', dexHelper, logger);
21
+ this.parentName = parentName;
22
+ this.network = network;
23
+ this.dexHelper = dexHelper;
24
+ this.migratorInterface = migratorInterface;
25
+ this.migratorAddress = migratorAddress;
26
+ this.xyzInterface = xyzInterface;
27
+ this.xyzAddress = xyzAddress;
28
+ this.transferTopic = transferTopic;
29
+ this.logDecoder = (log) => this.migratorInterface.parseLog(log);
30
+ this.addressesSubscribed = [migratorAddress];
31
+ }
32
+ async processLog(state, log) {
33
+ try {
34
+ const event = this.logDecoder(log);
35
+ if (log.topics[0] === this.transferTopic &&
36
+ event.args.to.toLowerCase() === this.migratorAddress.toLowerCase()) {
37
+ return this.handleTransferTo(event, state, log);
38
+ }
39
+ if (log.topics[0] === this.transferTopic &&
40
+ event.args.from.toLowerCase() === this.migratorAddress.toLowerCase()) {
41
+ return this.handleTransferFrom(event, state, log);
42
+ }
43
+ return null;
44
+ }
45
+ catch (e) {
46
+ (0, utils_1.catchParseLogError)(e, this.logger);
47
+ return null;
48
+ }
49
+ }
50
+ async generateState(blockNumber = 'latest') {
51
+ const calls = [
52
+ {
53
+ target: this.xyzAddress,
54
+ callData: this.xyzInterface.encodeFunctionData('balanceOf', [
55
+ this.migratorAddress,
56
+ ]),
57
+ decodeFunction: decoders_1.uint256ToBigInt,
58
+ },
59
+ ];
60
+ const [balance] = await this.dexHelper.multiWrapper.tryAggregate(true, calls, blockNumber);
61
+ return { balance: balance.returnData };
62
+ }
63
+ async getOrGenerateState(blockNumber) {
64
+ let state = this.getState(blockNumber);
65
+ if (!state) {
66
+ state = await this.generateState(blockNumber);
67
+ this.setState(state, blockNumber);
68
+ }
69
+ return state;
70
+ }
71
+ async handleTransferTo(event, state, log) {
72
+ return {
73
+ balance: state.balance + BigInt(event.args.value),
74
+ };
75
+ }
76
+ async handleTransferFrom(event, state, log) {
77
+ return {
78
+ balance: state.balance - BigInt(event.args.value),
79
+ };
80
+ }
81
+ }
82
+ exports.MiroMigratorEventState = MiroMigratorEventState;
83
+ //# sourceMappingURL=miro-migrator-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miro-migrator-state.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator-state.ts"],"names":[],"mappings":";;;AAGA,uCAAiD;AACjD,+EAA0E;AAG1E,iDAAqD;AAErD,MAAa,sBAAuB,SAAQ,mDAA0C;IAczE;IACC;IACA;IAEA;IACA;IACA;IACA;IACA;IArBZ,QAAQ,GAMJ,EAAE,CAAC;IAEP,UAAU,CAAoB;IAE9B,mBAAmB,CAAW;IAE9B,YACW,UAAkB,EACjB,OAAe,EACf,SAAqB,EAC/B,MAAc,EACJ,iBAA4B,EAC5B,eAAuB,EACvB,YAAuB,EACvB,UAAkB,EAClB,aAAqB;QAE/B,KAAK,CAAC,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;QAVnD,eAAU,GAAV,UAAU,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;QACf,cAAS,GAAT,SAAS,CAAY;QAErB,sBAAiB,GAAjB,iBAAiB,CAAW;QAC5B,oBAAe,GAAf,eAAe,CAAQ;QACvB,iBAAY,GAAZ,YAAY,CAAW;QACvB,eAAU,GAAV,UAAU,CAAQ;QAClB,kBAAa,GAAb,aAAa,CAAQ;QAG/B,IAAI,CAAC,UAAU,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrE,IAAI,CAAC,mBAAmB,GAAG,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC;IAES,KAAK,CAAC,UAAU,CACxB,KAAsC,EACtC,GAAkB;QAElB,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,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kBAAkB,CAAC,WAAmB;QAC1C,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;YAC9C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,gBAAgB,CACpB,KAAU,EACV,KAAsC,EACtC,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,KAAU,EACV,KAAsC,EACtC,GAAkB;QAElB,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SAClD,CAAC;IACJ,CAAC;CACF;AA3GD,wDA2GC"}
@@ -0,0 +1,41 @@
1
+ import { Token, Address, ExchangePrices, PoolPrices, AdapterExchangeParam, SimpleExchangeParam, PoolLiquidity, Logger, NumberAsString, DexExchangeParam } from '../../types';
2
+ import { SwapSide, Network } from '../../constants';
3
+ import { IDex } from '../../dex/idex';
4
+ import { IDexHelper } from '../../dex-helper/idex-helper';
5
+ import { MiroMigratorData } from './types';
6
+ import { SimpleExchange } from '../simple-exchange';
7
+ import { Interface } from '@ethersproject/abi';
8
+ import { MiroMigratorEventState } from './miro-migrator-state';
9
+ export declare class MiroMigrator extends SimpleExchange implements IDex<MiroMigratorData> {
10
+ readonly network: Network;
11
+ readonly dexKey: string;
12
+ readonly dexHelper: IDexHelper;
13
+ readonly migratorAddress: string;
14
+ readonly pspTokenAddress: string;
15
+ readonly xyzTokenAddress: string;
16
+ protected unitPrice: bigint;
17
+ protected migratorInterface: Interface;
18
+ readonly hasConstantPriceLargeAmounts = true;
19
+ readonly isFeeOnTransferSupported = false;
20
+ static dexKeysWithNetwork: {
21
+ key: string;
22
+ networks: Network[];
23
+ }[];
24
+ readonly eventPool: MiroMigratorEventState;
25
+ logger: Logger;
26
+ constructor(network: Network, dexKey: string, dexHelper: IDexHelper, migratorAddress?: string, pspTokenAddress?: string, xyzTokenAddress?: string, unitPrice?: bigint, migratorInterface?: Interface);
27
+ isPSP(tokenAddress: Address): boolean;
28
+ isXYZ(tokenAddress: Address): boolean;
29
+ isAppropriatePair(srcToken: Token, destToken: Token): boolean;
30
+ getAdapters(side: SwapSide): {
31
+ name: string;
32
+ index: number;
33
+ }[] | null;
34
+ getPoolIdentifiers(srcToken: Token, destToken: Token, side: SwapSide, blockNumber: number): Promise<string[]>;
35
+ getPricesVolume(srcToken: Token, destToken: Token, amounts: bigint[], side: SwapSide, blockNumber: number, limitPools?: string[]): Promise<null | ExchangePrices<MiroMigratorData>>;
36
+ getCalldataGasCost(poolPrices: PoolPrices<MiroMigratorData>): number | number[];
37
+ getAdapterParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: MiroMigratorData, side: SwapSide): AdapterExchangeParam;
38
+ getSimpleParam(srcToken: string, destToken: string, srcAmount: string, destAmount: string, data: MiroMigratorData, side: SwapSide): Promise<SimpleExchangeParam>;
39
+ getDexParam(srcToken: Address, destToken: Address, srcAmount: NumberAsString, destAmount: NumberAsString, recipient: Address, data: MiroMigratorData, side: SwapSide): DexExchangeParam;
40
+ getTopPoolsForToken(tokenAddress: Address, limit: number): Promise<PoolLiquidity[]>;
41
+ }
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.MiroMigrator = void 0;
40
+ const CALLDATA_GAS_COST = __importStar(require("../../calldata-gas-cost"));
41
+ const utils_1 = require("../../utils");
42
+ const types_1 = require("./types");
43
+ const simple_exchange_1 = require("../simple-exchange");
44
+ const config_1 = require("./config");
45
+ const bigint_constants_1 = require("../../bigint-constants");
46
+ const abi_1 = require("@ethersproject/abi");
47
+ const MiroMigrator_abi_json_1 = __importDefault(require("../../abi/miro-migrator/MiroMigrator.abi.json"));
48
+ const erc20_json_1 = __importDefault(require("../../abi/erc20.json"));
49
+ const constants_1 = require("./constants");
50
+ const miro_migrator_state_1 = require("./miro-migrator-state");
51
+ class MiroMigrator extends simple_exchange_1.SimpleExchange {
52
+ network;
53
+ dexKey;
54
+ dexHelper;
55
+ migratorAddress;
56
+ pspTokenAddress;
57
+ xyzTokenAddress;
58
+ unitPrice;
59
+ migratorInterface;
60
+ hasConstantPriceLargeAmounts = true;
61
+ isFeeOnTransferSupported = false;
62
+ static dexKeysWithNetwork = (0, utils_1.getDexKeysWithNetwork)(config_1.MiroMigratorConfig);
63
+ eventPool;
64
+ logger;
65
+ constructor(network, dexKey, dexHelper, migratorAddress = config_1.MiroMigratorConfig[dexKey][network]
66
+ .migratorAddress, pspTokenAddress = config_1.MiroMigratorConfig[dexKey][network]
67
+ .pspTokenAddress, xyzTokenAddress = config_1.MiroMigratorConfig[dexKey][network]
68
+ .xyzTokenAddress, unitPrice = bigint_constants_1.BI_POWS[18], migratorInterface = new abi_1.Interface(MiroMigrator_abi_json_1.default)) {
69
+ super(dexHelper, dexKey);
70
+ this.network = network;
71
+ this.dexKey = dexKey;
72
+ this.dexHelper = dexHelper;
73
+ this.migratorAddress = migratorAddress;
74
+ this.pspTokenAddress = pspTokenAddress;
75
+ this.xyzTokenAddress = xyzTokenAddress;
76
+ this.unitPrice = unitPrice;
77
+ this.migratorInterface = migratorInterface;
78
+ this.logger = dexHelper.getLogger(dexKey);
79
+ this.eventPool = new miro_migrator_state_1.MiroMigratorEventState(this.dexKey, this.network, this.dexHelper, this.logger, this.migratorInterface, this.migratorAddress, new abi_1.Interface(erc20_json_1.default), this.xyzTokenAddress, constants_1.TRANSFER_TOPIC);
80
+ }
81
+ isPSP(tokenAddress) {
82
+ return this.pspTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
83
+ }
84
+ isXYZ(tokenAddress) {
85
+ return this.xyzTokenAddress.toLowerCase() === tokenAddress.toLowerCase();
86
+ }
87
+ isAppropriatePair(srcToken, destToken) {
88
+ return this.isPSP(srcToken.address) && this.isXYZ(destToken.address);
89
+ }
90
+ getAdapters(side) {
91
+ return null;
92
+ }
93
+ async getPoolIdentifiers(srcToken, destToken, side, blockNumber) {
94
+ if (this.isAppropriatePair(srcToken, destToken)) {
95
+ return [`${this.dexKey}_${srcToken.address}_${destToken.address}`];
96
+ }
97
+ return [];
98
+ }
99
+ async getPricesVolume(srcToken, destToken, amounts, side, blockNumber, limitPools) {
100
+ if (!this.isAppropriatePair(srcToken, destToken)) {
101
+ return null;
102
+ }
103
+ const state = this.eventPool.getState(blockNumber);
104
+ this.logger.debug(srcToken, destToken, amounts, state);
105
+ return [
106
+ {
107
+ prices: amounts,
108
+ unit: this.unitPrice,
109
+ gasCost: constants_1.MIRO_MIGRATION_GAS_COST, // TODO: investigate this one
110
+ exchange: this.dexKey,
111
+ poolAddresses: [this.migratorAddress],
112
+ data: null,
113
+ },
114
+ ];
115
+ }
116
+ getCalldataGasCost(poolPrices) {
117
+ return CALLDATA_GAS_COST.DEX_NO_PAYLOAD;
118
+ }
119
+ getAdapterParam(srcToken, destToken, srcAmount, destAmount, data, side) {
120
+ return {
121
+ targetExchange: this.migratorAddress,
122
+ payload: '0x',
123
+ networkFee: '0',
124
+ };
125
+ }
126
+ async getSimpleParam(srcToken, destToken, srcAmount, destAmount, data, side) {
127
+ const swapData = this.migratorInterface.encodeFunctionData(types_1.MiroMigratorFunctions.migratePSPtoXYZ, [srcAmount, '0x']);
128
+ return this.buildSimpleParamWithoutWETHConversion(srcToken, srcAmount, destToken, destAmount, swapData, this.migratorAddress);
129
+ }
130
+ getDexParam(srcToken, destToken, srcAmount, destAmount, recipient, data, side) {
131
+ const swapData = this.migratorInterface.encodeFunctionData(types_1.MiroMigratorFunctions.migratePSPtoXYZ, [srcAmount, '0x']);
132
+ return {
133
+ needWrapNative: this.needWrapNative,
134
+ dexFuncHasRecipient: false,
135
+ exchangeData: swapData,
136
+ targetExchange: this.migratorAddress,
137
+ returnAmountPos: undefined,
138
+ };
139
+ }
140
+ async getTopPoolsForToken(tokenAddress, limit) {
141
+ return [
142
+ {
143
+ exchange: this.dexKey,
144
+ address: this.xyzTokenAddress,
145
+ connectorTokens: [
146
+ {
147
+ address: this.pspTokenAddress,
148
+ decimals: 18,
149
+ },
150
+ ],
151
+ liquidityUSD: 1000000000, // Just returning a big number so this DEX will be preferred
152
+ },
153
+ ];
154
+ }
155
+ }
156
+ exports.MiroMigrator = MiroMigrator;
157
+ //# sourceMappingURL=miro-migrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miro-migrator.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/miro-migrator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,2EAA6D;AAC7D,uCAAoD;AAGpD,mCAAkE;AAClE,wDAAoD;AACpD,qCAA8C;AAC9C,6DAAiD;AACjD,4CAA+C;AAC/C,0GAA4E;AAC5E,sEAA4C;AAC5C,2CAAsE;AACtE,+DAA+D;AAE/D,MAAa,YACX,SAAQ,gCAAc;IAcX;IACA;IACA;IACA;IAEA;IAEA;IAEC;IACA;IArBH,4BAA4B,GAAG,IAAI,CAAC;IAEpC,wBAAwB,GAAG,KAAK,CAAC;IAEnC,MAAM,CAAC,kBAAkB,GAC9B,IAAA,6BAAqB,EAAC,2BAAkB,CAAC,CAAC;IAC5B,SAAS,CAAyB;IAElD,MAAM,CAAS;IAEf,YACW,OAAgB,EAChB,MAAc,EACd,SAAqB,EACrB,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACT,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACT,kBAA0B,2BAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;SACnE,eAAe,EACR,YAAY,0BAAO,CAAC,EAAE,CAAC,EACvB,oBAAoB,IAAI,eAAS,CAAC,+BAAe,CAAC;QAE5D,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAZhB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAQ;QACd,cAAS,GAAT,SAAS,CAAY;QACrB,oBAAe,GAAf,eAAe,CACN;QACT,oBAAe,GAAf,eAAe,CAC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AAS,EACT,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,CAAC,eAAe,CACrB,CAAC;IACJ,CAAC;IAED,WAAW,CACT,QAAiB,EACjB,SAAkB,EAClB,SAAyB,EACzB,UAA0B,EAC1B,SAAkB,EAClB,IAAsB,EACtB,IAAc;QAEd,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC,kBAAkB,CACxD,6BAAqB,CAAC,eAAe,EACrC,CAAC,SAAS,EAAE,IAAI,CAAC,CAClB,CAAC;QAEF,OAAO;YACL,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,mBAAmB,EAAE,KAAK;YAC1B,YAAY,EAAE,QAAQ;YACtB,cAAc,EAAE,IAAI,CAAC,eAAe;YACpC,eAAe,EAAE,SAAS;SAC3B,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,YAAqB,EACrB,KAAa;QAEb,OAAO;YACL;gBACE,QAAQ,EAAE,IAAI,CAAC,MAAM;gBACrB,OAAO,EAAE,IAAI,CAAC,eAAe;gBAC7B,eAAe,EAAE;oBACf;wBACE,OAAO,EAAE,IAAI,CAAC,eAAe;wBAC7B,QAAQ,EAAE,EAAE;qBACb;iBACF;gBACD,YAAY,EAAE,UAAU,EAAE,4DAA4D;aACvF;SACF,CAAC;IACJ,CAAC;;AAvLH,oCAwLC"}
@@ -0,0 +1,13 @@
1
+ import { Address } from '../../types';
2
+ export type MiroMigratorState = {
3
+ balance: bigint;
4
+ };
5
+ export type MiroMigratorData = null;
6
+ export type DexParams = {
7
+ migratorAddress: Address;
8
+ pspTokenAddress: Address;
9
+ xyzTokenAddress: Address;
10
+ };
11
+ export declare enum MiroMigratorFunctions {
12
+ migratePSPtoXYZ = "migratePSPtoXYZ"
13
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MiroMigratorFunctions = void 0;
4
+ var MiroMigratorFunctions;
5
+ (function (MiroMigratorFunctions) {
6
+ MiroMigratorFunctions["migratePSPtoXYZ"] = "migratePSPtoXYZ";
7
+ })(MiroMigratorFunctions || (exports.MiroMigratorFunctions = MiroMigratorFunctions = {}));
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/dex/miro-migrator/types.ts"],"names":[],"mappings":";;;AAcA,IAAY,qBAEX;AAFD,WAAY,qBAAqB;IAC/B,4DAAmC,CAAA;AACrC,CAAC,EAFW,qBAAqB,qCAArB,qBAAqB,QAEhC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraswap/dex-lib",
3
- "version": "4.2.9",
3
+ "version": "4.2.10-miro-migrator.1",
4
4
  "main": "build/index.js",
5
5
  "types": "build/index.d.ts",
6
6
  "repository": "https://github.com/paraswap/paraswap-dex-lib",
@@ -1,2 +0,0 @@
1
- import { UnoptimizedRate } from '../../types';
2
- export declare function uniswapV4Merge(or: UnoptimizedRate): UnoptimizedRate;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.uniswapV4Merge = uniswapV4Merge;
7
- const lodash_1 = __importDefault(require("lodash"));
8
- const config_1 = require("./config");
9
- const UniswapV4AndForks = Object.keys(config_1.UniswapV4Config);
10
- function uniswapV4Merge(or) {
11
- const fixRoute = (rawRate) => {
12
- let lastExchange = false;
13
- let optimizedRate = new Array();
14
- rawRate.forEach((s) => {
15
- if (s.swapExchanges.length !== 1 ||
16
- !UniswapV4AndForks.includes(s.swapExchanges[0].exchange.toLowerCase())) {
17
- lastExchange = false;
18
- optimizedRate.push(s);
19
- }
20
- else if (lastExchange &&
21
- lastExchange.swapExchanges[0].exchange.toLowerCase() ===
22
- s.swapExchanges[0].exchange.toLowerCase() &&
23
- lodash_1.default.last(lastExchange.swapExchanges[0].data.path).tokenOut.toLowerCase() ===
24
- s.swapExchanges[0].data.path[0].tokenIn.toLowerCase()) {
25
- lastExchange.swapExchanges[0].data.path.push(s.swapExchanges[0].data.path[0]);
26
- lastExchange.swapExchanges[0].poolAddresses.push(s.swapExchanges[0].poolAddresses[0]);
27
- lastExchange.swapExchanges[0].data.gasUSD = (parseFloat(lastExchange.swapExchanges[0].data.gasUSD) +
28
- parseFloat(s.swapExchanges[0].data.gasUSD)).toFixed(6);
29
- lastExchange.destToken = s.destToken;
30
- lastExchange.destDecimals = s.destDecimals;
31
- lastExchange.swapExchanges[0].destAmount =
32
- s.swapExchanges[0].destAmount;
33
- }
34
- else {
35
- lastExchange = lodash_1.default.cloneDeep(s);
36
- optimizedRate.push(lastExchange);
37
- }
38
- });
39
- return optimizedRate;
40
- };
41
- or.bestRoute = or.bestRoute.map(r => ({
42
- ...r,
43
- swaps: fixRoute(r.swaps),
44
- }));
45
- return or;
46
- }
47
- //# sourceMappingURL=optimizer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"optimizer.js","sourceRoot":"","sources":["../../../src/dex/uniswap-v4/optimizer.ts"],"names":[],"mappings":";;;;;AAMA,wCA8CC;AAnDD,oDAAuB;AACvB,qCAA2C;AAE3C,MAAM,iBAAiB,GAAG,MAAM,CAAC,IAAI,CAAC,wBAAe,CAAC,CAAC;AAEvD,SAAgB,cAAc,CAAC,EAAmB;IAChD,MAAM,QAAQ,GAAG,CAAC,OAAsB,EAAiB,EAAE;QACzD,IAAI,YAAY,GAAwB,KAAK,CAAC;QAC9C,IAAI,aAAa,GAAG,IAAI,KAAK,EAAe,CAAC;QAC7C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAc,EAAE,EAAE;YACjC,IACE,CAAC,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC;gBAC5B,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,C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