@gearbox-protocol/sdk 8.25.2 → 8.26.0

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,675 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var migration_exports = {};
20
+ __export(migration_exports, {
21
+ accountMigratorBotV310Abi: () => accountMigratorBotV310Abi,
22
+ accountMigratorPreviewerV310Abi: () => accountMigratorPreviewerV310Abi
23
+ });
24
+ module.exports = __toCommonJS(migration_exports);
25
+ const accountMigratorBotV310Abi = [
26
+ {
27
+ type: "constructor",
28
+ inputs: [
29
+ { name: "_mcFactory", internalType: "address", type: "address" },
30
+ { name: "_ioProxy", internalType: "address", type: "address" },
31
+ {
32
+ name: "_contractsRegisterOld",
33
+ internalType: "address",
34
+ type: "address"
35
+ }
36
+ ],
37
+ stateMutability: "nonpayable"
38
+ },
39
+ {
40
+ type: "function",
41
+ inputs: [],
42
+ name: "contractType",
43
+ outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }],
44
+ stateMutability: "view"
45
+ },
46
+ {
47
+ type: "function",
48
+ inputs: [],
49
+ name: "contractsRegisterOld",
50
+ outputs: [{ name: "", internalType: "address", type: "address" }],
51
+ stateMutability: "view"
52
+ },
53
+ {
54
+ type: "function",
55
+ inputs: [],
56
+ name: "mcFactory",
57
+ outputs: [{ name: "", internalType: "address", type: "address" }],
58
+ stateMutability: "view"
59
+ },
60
+ {
61
+ type: "function",
62
+ inputs: [
63
+ {
64
+ name: "params",
65
+ internalType: "struct MigrationParams",
66
+ type: "tuple",
67
+ components: [
68
+ { name: "accountOwner", internalType: "address", type: "address" },
69
+ {
70
+ name: "sourceCreditAccount",
71
+ internalType: "address",
72
+ type: "address"
73
+ },
74
+ {
75
+ name: "targetCreditManager",
76
+ internalType: "address",
77
+ type: "address"
78
+ },
79
+ {
80
+ name: "migratedCollaterals",
81
+ internalType: "struct MigratedCollateral[]",
82
+ type: "tuple[]",
83
+ components: [
84
+ { name: "collateral", internalType: "address", type: "address" },
85
+ { name: "amount", internalType: "uint256", type: "uint256" },
86
+ {
87
+ name: "targetQuotaIncrease",
88
+ internalType: "uint96",
89
+ type: "uint96"
90
+ },
91
+ {
92
+ name: "underlyingInSource",
93
+ internalType: "bool",
94
+ type: "bool"
95
+ },
96
+ {
97
+ name: "underlyingInTarget",
98
+ internalType: "bool",
99
+ type: "bool"
100
+ },
101
+ {
102
+ name: "phantomTokenParams",
103
+ internalType: "struct PhantomTokenParams",
104
+ type: "tuple",
105
+ components: [
106
+ {
107
+ name: "isPhantomToken",
108
+ internalType: "bool",
109
+ type: "bool"
110
+ },
111
+ {
112
+ name: "underlying",
113
+ internalType: "address",
114
+ type: "address"
115
+ },
116
+ {
117
+ name: "underlyingAmount",
118
+ internalType: "uint256",
119
+ type: "uint256"
120
+ }
121
+ ]
122
+ }
123
+ ]
124
+ },
125
+ {
126
+ name: "targetBorrowAmount",
127
+ internalType: "uint256",
128
+ type: "uint256"
129
+ },
130
+ {
131
+ name: "underlyingSwapCalls",
132
+ internalType: "struct MultiCall[]",
133
+ type: "tuple[]",
134
+ components: [
135
+ { name: "target", internalType: "address", type: "address" },
136
+ { name: "callData", internalType: "bytes", type: "bytes" }
137
+ ]
138
+ },
139
+ {
140
+ name: "extraOpeningCalls",
141
+ internalType: "struct MultiCall[]",
142
+ type: "tuple[]",
143
+ components: [
144
+ { name: "target", internalType: "address", type: "address" },
145
+ { name: "callData", internalType: "bytes", type: "bytes" }
146
+ ]
147
+ },
148
+ {
149
+ name: "uniqueTransferredTokens",
150
+ internalType: "address[]",
151
+ type: "address[]"
152
+ },
153
+ {
154
+ name: "numAddCollateralCalls",
155
+ internalType: "uint256",
156
+ type: "uint256"
157
+ },
158
+ {
159
+ name: "numRemoveQuotasCalls",
160
+ internalType: "uint256",
161
+ type: "uint256"
162
+ },
163
+ {
164
+ name: "numIncreaseQuotaCalls",
165
+ internalType: "uint256",
166
+ type: "uint256"
167
+ },
168
+ {
169
+ name: "numPhantomTokenCalls",
170
+ internalType: "uint256",
171
+ type: "uint256"
172
+ }
173
+ ]
174
+ }
175
+ ],
176
+ name: "migrate",
177
+ outputs: [],
178
+ stateMutability: "nonpayable"
179
+ },
180
+ {
181
+ type: "function",
182
+ inputs: [
183
+ {
184
+ name: "params",
185
+ internalType: "struct MigrationParams",
186
+ type: "tuple",
187
+ components: [
188
+ { name: "accountOwner", internalType: "address", type: "address" },
189
+ {
190
+ name: "sourceCreditAccount",
191
+ internalType: "address",
192
+ type: "address"
193
+ },
194
+ {
195
+ name: "targetCreditManager",
196
+ internalType: "address",
197
+ type: "address"
198
+ },
199
+ {
200
+ name: "migratedCollaterals",
201
+ internalType: "struct MigratedCollateral[]",
202
+ type: "tuple[]",
203
+ components: [
204
+ { name: "collateral", internalType: "address", type: "address" },
205
+ { name: "amount", internalType: "uint256", type: "uint256" },
206
+ {
207
+ name: "targetQuotaIncrease",
208
+ internalType: "uint96",
209
+ type: "uint96"
210
+ },
211
+ {
212
+ name: "underlyingInSource",
213
+ internalType: "bool",
214
+ type: "bool"
215
+ },
216
+ {
217
+ name: "underlyingInTarget",
218
+ internalType: "bool",
219
+ type: "bool"
220
+ },
221
+ {
222
+ name: "phantomTokenParams",
223
+ internalType: "struct PhantomTokenParams",
224
+ type: "tuple",
225
+ components: [
226
+ {
227
+ name: "isPhantomToken",
228
+ internalType: "bool",
229
+ type: "bool"
230
+ },
231
+ {
232
+ name: "underlying",
233
+ internalType: "address",
234
+ type: "address"
235
+ },
236
+ {
237
+ name: "underlyingAmount",
238
+ internalType: "uint256",
239
+ type: "uint256"
240
+ }
241
+ ]
242
+ }
243
+ ]
244
+ },
245
+ {
246
+ name: "targetBorrowAmount",
247
+ internalType: "uint256",
248
+ type: "uint256"
249
+ },
250
+ {
251
+ name: "underlyingSwapCalls",
252
+ internalType: "struct MultiCall[]",
253
+ type: "tuple[]",
254
+ components: [
255
+ { name: "target", internalType: "address", type: "address" },
256
+ { name: "callData", internalType: "bytes", type: "bytes" }
257
+ ]
258
+ },
259
+ {
260
+ name: "extraOpeningCalls",
261
+ internalType: "struct MultiCall[]",
262
+ type: "tuple[]",
263
+ components: [
264
+ { name: "target", internalType: "address", type: "address" },
265
+ { name: "callData", internalType: "bytes", type: "bytes" }
266
+ ]
267
+ },
268
+ {
269
+ name: "uniqueTransferredTokens",
270
+ internalType: "address[]",
271
+ type: "address[]"
272
+ },
273
+ {
274
+ name: "numAddCollateralCalls",
275
+ internalType: "uint256",
276
+ type: "uint256"
277
+ },
278
+ {
279
+ name: "numRemoveQuotasCalls",
280
+ internalType: "uint256",
281
+ type: "uint256"
282
+ },
283
+ {
284
+ name: "numIncreaseQuotaCalls",
285
+ internalType: "uint256",
286
+ type: "uint256"
287
+ },
288
+ {
289
+ name: "numPhantomTokenCalls",
290
+ internalType: "uint256",
291
+ type: "uint256"
292
+ }
293
+ ]
294
+ },
295
+ {
296
+ name: "priceUpdates",
297
+ internalType: "struct PriceUpdate[]",
298
+ type: "tuple[]",
299
+ components: [
300
+ { name: "priceFeed", internalType: "address", type: "address" },
301
+ { name: "data", internalType: "bytes", type: "bytes" }
302
+ ]
303
+ }
304
+ ],
305
+ name: "migrateCreditAccount",
306
+ outputs: [],
307
+ stateMutability: "nonpayable"
308
+ },
309
+ {
310
+ type: "function",
311
+ inputs: [],
312
+ name: "owner",
313
+ outputs: [{ name: "", internalType: "address", type: "address" }],
314
+ stateMutability: "view"
315
+ },
316
+ {
317
+ type: "function",
318
+ inputs: [
319
+ { name: "phantomToken", internalType: "address", type: "address" }
320
+ ],
321
+ name: "phantomTokenOverrides",
322
+ outputs: [
323
+ {
324
+ name: "",
325
+ internalType: "struct PhantomTokenOverride",
326
+ type: "tuple",
327
+ components: [
328
+ { name: "newToken", internalType: "address", type: "address" },
329
+ { name: "underlying", internalType: "address", type: "address" },
330
+ { name: "withdrawalCallData", internalType: "bytes", type: "bytes" }
331
+ ]
332
+ }
333
+ ],
334
+ stateMutability: "view"
335
+ },
336
+ {
337
+ type: "function",
338
+ inputs: [],
339
+ name: "renounceOwnership",
340
+ outputs: [],
341
+ stateMutability: "nonpayable"
342
+ },
343
+ {
344
+ type: "function",
345
+ inputs: [],
346
+ name: "requiredPermissions",
347
+ outputs: [{ name: "", internalType: "uint192", type: "uint192" }],
348
+ stateMutability: "view"
349
+ },
350
+ {
351
+ type: "function",
352
+ inputs: [],
353
+ name: "serialize",
354
+ outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
355
+ stateMutability: "view"
356
+ },
357
+ {
358
+ type: "function",
359
+ inputs: [
360
+ { name: "phantomToken", internalType: "address", type: "address" },
361
+ { name: "newToken", internalType: "address", type: "address" },
362
+ { name: "underlying", internalType: "address", type: "address" },
363
+ { name: "withdrawalCallData", internalType: "bytes", type: "bytes" }
364
+ ],
365
+ name: "setPhantomTokenOverride",
366
+ outputs: [],
367
+ stateMutability: "nonpayable"
368
+ },
369
+ {
370
+ type: "function",
371
+ inputs: [{ name: "newOwner", internalType: "address", type: "address" }],
372
+ name: "transferOwnership",
373
+ outputs: [],
374
+ stateMutability: "nonpayable"
375
+ },
376
+ {
377
+ type: "function",
378
+ inputs: [],
379
+ name: "version",
380
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
381
+ stateMutability: "view"
382
+ },
383
+ {
384
+ type: "event",
385
+ anonymous: false,
386
+ inputs: [
387
+ {
388
+ name: "previousOwner",
389
+ internalType: "address",
390
+ type: "address",
391
+ indexed: true
392
+ },
393
+ {
394
+ name: "newOwner",
395
+ internalType: "address",
396
+ type: "address",
397
+ indexed: true
398
+ }
399
+ ],
400
+ name: "OwnershipTransferred"
401
+ },
402
+ { type: "error", inputs: [], name: "ForceApproveFailed" },
403
+ { type: "error", inputs: [], name: "SafeTransferFromFailed" }
404
+ ];
405
+ const accountMigratorPreviewerV310Abi = [
406
+ {
407
+ type: "constructor",
408
+ inputs: [
409
+ { name: "_migratorBot", internalType: "address", type: "address" },
410
+ { name: "_router", internalType: "address", type: "address" }
411
+ ],
412
+ stateMutability: "nonpayable"
413
+ },
414
+ {
415
+ type: "function",
416
+ inputs: [],
417
+ name: "contractType",
418
+ outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }],
419
+ stateMutability: "view"
420
+ },
421
+ {
422
+ type: "function",
423
+ inputs: [],
424
+ name: "migratorBot",
425
+ outputs: [{ name: "", internalType: "address", type: "address" }],
426
+ stateMutability: "view"
427
+ },
428
+ {
429
+ type: "function",
430
+ inputs: [
431
+ { name: "sourceCreditAccount", internalType: "address", type: "address" },
432
+ { name: "targetCreditManager", internalType: "address", type: "address" },
433
+ {
434
+ name: "priceUpdates",
435
+ internalType: "struct PriceUpdate[]",
436
+ type: "tuple[]",
437
+ components: [
438
+ { name: "priceFeed", internalType: "address", type: "address" },
439
+ { name: "data", internalType: "bytes", type: "bytes" }
440
+ ]
441
+ }
442
+ ],
443
+ name: "previewMigration",
444
+ outputs: [
445
+ {
446
+ name: "result",
447
+ internalType: "struct PreviewMigrationResult",
448
+ type: "tuple",
449
+ components: [
450
+ { name: "success", internalType: "bool", type: "bool" },
451
+ {
452
+ name: "expectedTargetHF",
453
+ internalType: "uint256",
454
+ type: "uint256"
455
+ },
456
+ {
457
+ name: "expectedTargetSafeHF",
458
+ internalType: "uint256",
459
+ type: "uint256"
460
+ },
461
+ {
462
+ name: "expectedUnderlyingDust",
463
+ internalType: "uint256",
464
+ type: "uint256"
465
+ },
466
+ {
467
+ name: "failureStates",
468
+ internalType: "struct FailureStates",
469
+ type: "tuple",
470
+ components: [
471
+ { name: "targetHFTooLow", internalType: "bool", type: "bool" },
472
+ {
473
+ name: "targetSafeHFTooLow",
474
+ internalType: "bool",
475
+ type: "bool"
476
+ },
477
+ {
478
+ name: "sourceUnderlyingIsNotCollateral",
479
+ internalType: "bool",
480
+ type: "bool"
481
+ },
482
+ {
483
+ name: "migratedCollateralDoesNotExistInTarget",
484
+ internalType: "bool",
485
+ type: "bool"
486
+ },
487
+ {
488
+ name: "insufficientTargetQuotaLimits",
489
+ internalType: "bool",
490
+ type: "bool"
491
+ },
492
+ {
493
+ name: "insufficientTargetBorrowLiquidity",
494
+ internalType: "bool",
495
+ type: "bool"
496
+ },
497
+ {
498
+ name: "insufficientTargetDebtLimit",
499
+ internalType: "bool",
500
+ type: "bool"
501
+ },
502
+ {
503
+ name: "newTargetDebtOutOfLimits",
504
+ internalType: "bool",
505
+ type: "bool"
506
+ },
507
+ {
508
+ name: "noPathToSourceUnderlying",
509
+ internalType: "bool",
510
+ type: "bool"
511
+ },
512
+ {
513
+ name: "cannotSwapEnoughToCoverDebt",
514
+ internalType: "bool",
515
+ type: "bool"
516
+ },
517
+ {
518
+ name: "sourceHasNoMigratorBotAdapter",
519
+ internalType: "bool",
520
+ type: "bool"
521
+ }
522
+ ]
523
+ },
524
+ {
525
+ name: "migrationParams",
526
+ internalType: "struct MigrationParams",
527
+ type: "tuple",
528
+ components: [
529
+ {
530
+ name: "accountOwner",
531
+ internalType: "address",
532
+ type: "address"
533
+ },
534
+ {
535
+ name: "sourceCreditAccount",
536
+ internalType: "address",
537
+ type: "address"
538
+ },
539
+ {
540
+ name: "targetCreditManager",
541
+ internalType: "address",
542
+ type: "address"
543
+ },
544
+ {
545
+ name: "migratedCollaterals",
546
+ internalType: "struct MigratedCollateral[]",
547
+ type: "tuple[]",
548
+ components: [
549
+ {
550
+ name: "collateral",
551
+ internalType: "address",
552
+ type: "address"
553
+ },
554
+ { name: "amount", internalType: "uint256", type: "uint256" },
555
+ {
556
+ name: "targetQuotaIncrease",
557
+ internalType: "uint96",
558
+ type: "uint96"
559
+ },
560
+ {
561
+ name: "underlyingInSource",
562
+ internalType: "bool",
563
+ type: "bool"
564
+ },
565
+ {
566
+ name: "underlyingInTarget",
567
+ internalType: "bool",
568
+ type: "bool"
569
+ },
570
+ {
571
+ name: "phantomTokenParams",
572
+ internalType: "struct PhantomTokenParams",
573
+ type: "tuple",
574
+ components: [
575
+ {
576
+ name: "isPhantomToken",
577
+ internalType: "bool",
578
+ type: "bool"
579
+ },
580
+ {
581
+ name: "underlying",
582
+ internalType: "address",
583
+ type: "address"
584
+ },
585
+ {
586
+ name: "underlyingAmount",
587
+ internalType: "uint256",
588
+ type: "uint256"
589
+ }
590
+ ]
591
+ }
592
+ ]
593
+ },
594
+ {
595
+ name: "targetBorrowAmount",
596
+ internalType: "uint256",
597
+ type: "uint256"
598
+ },
599
+ {
600
+ name: "underlyingSwapCalls",
601
+ internalType: "struct MultiCall[]",
602
+ type: "tuple[]",
603
+ components: [
604
+ { name: "target", internalType: "address", type: "address" },
605
+ { name: "callData", internalType: "bytes", type: "bytes" }
606
+ ]
607
+ },
608
+ {
609
+ name: "extraOpeningCalls",
610
+ internalType: "struct MultiCall[]",
611
+ type: "tuple[]",
612
+ components: [
613
+ { name: "target", internalType: "address", type: "address" },
614
+ { name: "callData", internalType: "bytes", type: "bytes" }
615
+ ]
616
+ },
617
+ {
618
+ name: "uniqueTransferredTokens",
619
+ internalType: "address[]",
620
+ type: "address[]"
621
+ },
622
+ {
623
+ name: "numAddCollateralCalls",
624
+ internalType: "uint256",
625
+ type: "uint256"
626
+ },
627
+ {
628
+ name: "numRemoveQuotasCalls",
629
+ internalType: "uint256",
630
+ type: "uint256"
631
+ },
632
+ {
633
+ name: "numIncreaseQuotaCalls",
634
+ internalType: "uint256",
635
+ type: "uint256"
636
+ },
637
+ {
638
+ name: "numPhantomTokenCalls",
639
+ internalType: "uint256",
640
+ type: "uint256"
641
+ }
642
+ ]
643
+ }
644
+ ]
645
+ }
646
+ ],
647
+ stateMutability: "nonpayable"
648
+ },
649
+ {
650
+ type: "function",
651
+ inputs: [],
652
+ name: "router",
653
+ outputs: [{ name: "", internalType: "address", type: "address" }],
654
+ stateMutability: "view"
655
+ },
656
+ {
657
+ type: "function",
658
+ inputs: [],
659
+ name: "serialize",
660
+ outputs: [{ name: "", internalType: "bytes", type: "bytes" }],
661
+ stateMutability: "view"
662
+ },
663
+ {
664
+ type: "function",
665
+ inputs: [],
666
+ name: "version",
667
+ outputs: [{ name: "", internalType: "uint256", type: "uint256" }],
668
+ stateMutability: "view"
669
+ }
670
+ ];
671
+ // Annotate the CommonJS export names for ESM import in node:
672
+ 0 && (module.exports = {
673
+ accountMigratorBotV310Abi,
674
+ accountMigratorPreviewerV310Abi
675
+ });
@@ -28,6 +28,7 @@ var import_oracle = require("./oracle/index.js");
28
28
  var import_pool = require("./pool/index.js");
29
29
  class MarketSuite extends import_base.SDKConstruct {
30
30
  acl;
31
+ treasury;
31
32
  configurator;
32
33
  pool;
33
34
  priceOracle;
@@ -47,6 +48,7 @@ class MarketSuite extends import_base.SDKConstruct {
47
48
  }
48
49
  this.configurator = mc;
49
50
  this.acl = marketData.acl;
51
+ this.treasury = marketData.treasury;
50
52
  for (const t of marketData.tokens) {
51
53
  sdk.tokensMeta.upsert(t.addr, t);
52
54
  sdk.provider.addressLabels.set(t.addr, t.symbol);