@morpho-org/blue-sdk 4.8.1 → 4.9.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.
- package/lib/addresses.d.ts +639 -5
- package/lib/addresses.js +322 -9
- package/lib/chain.d.ts +233 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/market/Market.js +3 -3
- package/lib/market/MarketUtils.d.ts +7 -1
- package/lib/market/MarketUtils.js +13 -1
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +67 -0
- package/package.json +2 -2
package/lib/addresses.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.unwrappedTokensMapping = exports.addresses = exports.addressesRegistry = exports.convexWrapperTokens = exports.getPermissionedCoinbaseTokens = exports.permissionedCoinbaseTokens = exports.permissionedBackedTokens = exports.permissionedWrapperTokens = exports.erc20WrapperTokens = exports.getChainAddresses = exports.NATIVE_ADDRESS = void 0;
|
|
6
|
+
exports.unwrappedTokensMapping = exports.deployments = exports.addresses = exports.addressesRegistry = exports.convexWrapperTokens = exports.getPermissionedCoinbaseTokens = exports.permissionedCoinbaseTokens = exports.permissionedBackedTokens = exports.permissionedWrapperTokens = exports.erc20WrapperTokens = exports.getChainAddresses = exports.NATIVE_ADDRESS = void 0;
|
|
7
7
|
exports.getUnwrappedToken = getUnwrappedToken;
|
|
8
8
|
exports.registerCustomAddresses = registerCustomAddresses;
|
|
9
9
|
const morpho_ts_1 = require("@morpho-org/morpho-ts");
|
|
@@ -37,10 +37,25 @@ const _addressesRegistry = {
|
|
|
37
37
|
aaveV3EtherFiMigrationAdapter: "0x4011dc6581fA05F9B0c7A12AdCd676e2b1a59ca3",
|
|
38
38
|
aaveV3OptimizerMigrationAdapter: "0x9e2ea2d5785598a163D569D795f286F5C55ad972",
|
|
39
39
|
},
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
42
|
+
*/
|
|
40
43
|
aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c",
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
46
|
+
*/
|
|
41
47
|
aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76",
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
50
|
+
*/
|
|
42
51
|
aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC",
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
54
|
+
*/
|
|
43
55
|
compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558",
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
58
|
+
*/
|
|
44
59
|
compoundV2Bundler: "0x26bF52a84360Ad3d01d7CDc28FC2dDC04d8c8647",
|
|
45
60
|
adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
|
|
46
61
|
publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
|
|
@@ -96,8 +111,17 @@ const _addressesRegistry = {
|
|
|
96
111
|
compoundV3MigrationAdapter: "0x85D4812Ef92c040d4270eD8547b6835e41FbbB70",
|
|
97
112
|
aaveV3CoreMigrationAdapter: "0xb27Aa2a964eAd5ed661D86974b37e4fB995b36f5",
|
|
98
113
|
},
|
|
114
|
+
/**
|
|
115
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
116
|
+
*/
|
|
99
117
|
compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223",
|
|
118
|
+
/**
|
|
119
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
120
|
+
*/
|
|
100
121
|
aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108",
|
|
122
|
+
/**
|
|
123
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
124
|
+
*/
|
|
101
125
|
compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA",
|
|
102
126
|
adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
|
|
103
127
|
publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
|
|
@@ -189,7 +213,7 @@ const _addressesRegistry = {
|
|
|
189
213
|
publicAllocator: "0x37a888192165fC39884f87c64E2476BfD2C09675",
|
|
190
214
|
metaMorphoFactory: "0x27D4Af0AC9E7FDfA6D0853236f249CC27AE79488",
|
|
191
215
|
chainlinkOracleFactory: "0x39d8622C607A691D7705E8842fbB12E3c38dCD41",
|
|
192
|
-
preLiquidationFactory: "
|
|
216
|
+
preLiquidationFactory: "0x373ccddcd3F09D2e1430B3F2b290B9bF56Ae7336",
|
|
193
217
|
wNative: "0xFC00000000000000000000000000000000000006",
|
|
194
218
|
},
|
|
195
219
|
[chain_js_1.ChainId.ScrollMainnet]: {
|
|
@@ -389,6 +413,288 @@ const _addressesRegistry = {
|
|
|
389
413
|
wNative: "0x5555555555555555555555555555555555555555",
|
|
390
414
|
},
|
|
391
415
|
};
|
|
416
|
+
const _deployments = {
|
|
417
|
+
[chain_js_1.ChainId.EthMainnet]: {
|
|
418
|
+
morpho: 18883124n,
|
|
419
|
+
permit2: 15986406n,
|
|
420
|
+
bundler3: {
|
|
421
|
+
bundler3: 21643807n,
|
|
422
|
+
generalAdapter1: 21872136n,
|
|
423
|
+
paraswapAdapter: 21643807n,
|
|
424
|
+
erc20WrapperAdapter: 21872136n,
|
|
425
|
+
compoundV2MigrationAdapter: 21643807n,
|
|
426
|
+
compoundV3MigrationAdapter: 21643807n,
|
|
427
|
+
aaveV2MigrationAdapter: 21643807n,
|
|
428
|
+
aaveV3CoreMigrationAdapter: 21643807n,
|
|
429
|
+
aaveV3PrimeMigrationAdapter: 21643807n,
|
|
430
|
+
aaveV3EtherFiMigrationAdapter: 21643807n,
|
|
431
|
+
aaveV3OptimizerMigrationAdapter: 21643807n,
|
|
432
|
+
},
|
|
433
|
+
adaptiveCurveIrm: 18883124n,
|
|
434
|
+
publicAllocator: 19375099n,
|
|
435
|
+
metaMorphoFactory: 21439510n,
|
|
436
|
+
chainlinkOracleFactory: 19375066n,
|
|
437
|
+
preLiquidationFactory: 21414664n,
|
|
438
|
+
},
|
|
439
|
+
[chain_js_1.ChainId.BaseMainnet]: {
|
|
440
|
+
morpho: 13977148n,
|
|
441
|
+
permit2: 1425180n,
|
|
442
|
+
bundler3: {
|
|
443
|
+
bundler3: 25161671n,
|
|
444
|
+
generalAdapter1: 26539234n,
|
|
445
|
+
paraswapAdapter: 25161671n,
|
|
446
|
+
erc20WrapperAdapter: 26539234n,
|
|
447
|
+
compoundV3MigrationAdapter: 25161671n,
|
|
448
|
+
aaveV3CoreMigrationAdapter: 25161671n,
|
|
449
|
+
},
|
|
450
|
+
adaptiveCurveIrm: 13977152n,
|
|
451
|
+
publicAllocator: 13979545n,
|
|
452
|
+
metaMorphoFactory: 23928808n,
|
|
453
|
+
chainlinkOracleFactory: 13978286n,
|
|
454
|
+
preLiquidationFactory: 23779056n,
|
|
455
|
+
},
|
|
456
|
+
[chain_js_1.ChainId.PolygonMainnet]: {
|
|
457
|
+
morpho: 66931042n,
|
|
458
|
+
bundler3: {
|
|
459
|
+
bundler3: 68074185n,
|
|
460
|
+
generalAdapter1: 68074185n,
|
|
461
|
+
paraswapAdapter: 68074185n,
|
|
462
|
+
compoundV3MigrationAdapter: 68690465n,
|
|
463
|
+
aaveV2MigrationAdapter: 68690465n,
|
|
464
|
+
aaveV3CoreMigrationAdapter: 68690465n,
|
|
465
|
+
},
|
|
466
|
+
permit2: 35701901n,
|
|
467
|
+
adaptiveCurveIrm: 66931042n,
|
|
468
|
+
publicAllocator: 66931042n,
|
|
469
|
+
metaMorphoFactory: 66931042n,
|
|
470
|
+
chainlinkOracleFactory: 66931042n,
|
|
471
|
+
preLiquidationFactory: 68074185n,
|
|
472
|
+
},
|
|
473
|
+
[chain_js_1.ChainId.ArbitrumMainnet]: {
|
|
474
|
+
morpho: 296446593n,
|
|
475
|
+
bundler3: {
|
|
476
|
+
bundler3: 307326238n,
|
|
477
|
+
generalAdapter1: 307326238n,
|
|
478
|
+
paraswapAdapter: 307326988n,
|
|
479
|
+
aaveV3CoreMigrationAdapter: 358694526n,
|
|
480
|
+
compoundV3MigrationAdapter: 358693964n,
|
|
481
|
+
},
|
|
482
|
+
permit2: 38692735n,
|
|
483
|
+
adaptiveCurveIrm: 296446593n,
|
|
484
|
+
publicAllocator: 296446593n,
|
|
485
|
+
metaMorphoFactory: 296447195n,
|
|
486
|
+
chainlinkOracleFactory: 296447195n,
|
|
487
|
+
preLiquidationFactory: 307326238n,
|
|
488
|
+
},
|
|
489
|
+
[chain_js_1.ChainId.OptimismMainnet]: {
|
|
490
|
+
morpho: 130770075n,
|
|
491
|
+
bundler3: {
|
|
492
|
+
bundler3: 132139369n,
|
|
493
|
+
generalAdapter1: 132139369n,
|
|
494
|
+
paraswapAdapter: 132139438n,
|
|
495
|
+
},
|
|
496
|
+
permit2: 38854427n,
|
|
497
|
+
adaptiveCurveIrm: 130770075n,
|
|
498
|
+
publicAllocator: 130770075n,
|
|
499
|
+
metaMorphoFactory: 130770189n,
|
|
500
|
+
chainlinkOracleFactory: 130770189n,
|
|
501
|
+
preLiquidationFactory: 132139369n,
|
|
502
|
+
},
|
|
503
|
+
[chain_js_1.ChainId.WorldChainMainnet]: {
|
|
504
|
+
morpho: 9025669n,
|
|
505
|
+
bundler3: {
|
|
506
|
+
bundler3: 10273494n,
|
|
507
|
+
generalAdapter1: 10273494n,
|
|
508
|
+
},
|
|
509
|
+
adaptiveCurveIrm: 9025669n,
|
|
510
|
+
publicAllocator: 9025669n,
|
|
511
|
+
metaMorphoFactory: 9025733n,
|
|
512
|
+
chainlinkOracleFactory: 9025733n,
|
|
513
|
+
preLiquidationFactory: 10273494n,
|
|
514
|
+
},
|
|
515
|
+
[chain_js_1.ChainId.FraxtalMainnet]: {
|
|
516
|
+
morpho: 15317931n,
|
|
517
|
+
bundler3: {
|
|
518
|
+
bundler3: 16536231n,
|
|
519
|
+
generalAdapter1: 16536231n,
|
|
520
|
+
},
|
|
521
|
+
adaptiveCurveIrm: 15317931n,
|
|
522
|
+
publicAllocator: 15317931n,
|
|
523
|
+
metaMorphoFactory: 15318007n,
|
|
524
|
+
chainlinkOracleFactory: 15318007n,
|
|
525
|
+
preLiquidationFactory: 16536231n,
|
|
526
|
+
},
|
|
527
|
+
[chain_js_1.ChainId.ScrollMainnet]: {
|
|
528
|
+
morpho: 12842868n,
|
|
529
|
+
bundler3: {
|
|
530
|
+
bundler3: 13504587n,
|
|
531
|
+
generalAdapter1: 13504587n,
|
|
532
|
+
},
|
|
533
|
+
adaptiveCurveIrm: 12842868n,
|
|
534
|
+
publicAllocator: 12842868n,
|
|
535
|
+
metaMorphoFactory: 12842903n,
|
|
536
|
+
chainlinkOracleFactory: 12842903n,
|
|
537
|
+
preLiquidationFactory: 13504587n,
|
|
538
|
+
},
|
|
539
|
+
[chain_js_1.ChainId.InkMainnet]: {
|
|
540
|
+
morpho: 4078776n,
|
|
541
|
+
bundler3: {
|
|
542
|
+
bundler3: 6385077n,
|
|
543
|
+
generalAdapter1: 6385077n,
|
|
544
|
+
},
|
|
545
|
+
adaptiveCurveIrm: 4078776n,
|
|
546
|
+
publicAllocator: 4078776n,
|
|
547
|
+
metaMorphoFactory: 4078830n,
|
|
548
|
+
chainlinkOracleFactory: 4078830n,
|
|
549
|
+
preLiquidationFactory: 6385077n,
|
|
550
|
+
},
|
|
551
|
+
[chain_js_1.ChainId.Unichain]: {
|
|
552
|
+
morpho: 9139027n,
|
|
553
|
+
bundler3: {
|
|
554
|
+
bundler3: 9381237n,
|
|
555
|
+
generalAdapter1: 9381237n,
|
|
556
|
+
paraswapAdapter: 20872902n,
|
|
557
|
+
compoundV3MigrationAdapter: 22019479n,
|
|
558
|
+
},
|
|
559
|
+
adaptiveCurveIrm: 9139027n,
|
|
560
|
+
publicAllocator: 9139027n,
|
|
561
|
+
metaMorphoFactory: 9316789n,
|
|
562
|
+
chainlinkOracleFactory: 9316789n,
|
|
563
|
+
preLiquidationFactory: 9381237n,
|
|
564
|
+
},
|
|
565
|
+
[chain_js_1.ChainId.SonicMainnet]: {
|
|
566
|
+
morpho: 9100931n,
|
|
567
|
+
bundler3: {
|
|
568
|
+
bundler3: 9102286n,
|
|
569
|
+
generalAdapter1: 9102286n,
|
|
570
|
+
},
|
|
571
|
+
adaptiveCurveIrm: 9100931n,
|
|
572
|
+
publicAllocator: 9100931n,
|
|
573
|
+
metaMorphoFactory: 9101319n,
|
|
574
|
+
chainlinkOracleFactory: 9101319n,
|
|
575
|
+
preLiquidationFactory: 9102286n,
|
|
576
|
+
},
|
|
577
|
+
[chain_js_1.ChainId.HemiMainnet]: {
|
|
578
|
+
morpho: 1188872n,
|
|
579
|
+
bundler3: {
|
|
580
|
+
bundler3: 1188907n,
|
|
581
|
+
generalAdapter1: 1188907n,
|
|
582
|
+
},
|
|
583
|
+
adaptiveCurveIrm: 1188872n,
|
|
584
|
+
publicAllocator: 1188872n,
|
|
585
|
+
metaMorphoFactory: 1188885n,
|
|
586
|
+
chainlinkOracleFactory: 1188885n,
|
|
587
|
+
preLiquidationFactory: 1188907n,
|
|
588
|
+
},
|
|
589
|
+
[chain_js_1.ChainId.ModeMainnet]: {
|
|
590
|
+
morpho: 19983370n,
|
|
591
|
+
bundler3: {
|
|
592
|
+
bundler3: 19983599n,
|
|
593
|
+
generalAdapter1: 19983599n,
|
|
594
|
+
},
|
|
595
|
+
adaptiveCurveIrm: 19983370n,
|
|
596
|
+
publicAllocator: 19983370n,
|
|
597
|
+
metaMorphoFactory: 19983443n,
|
|
598
|
+
chainlinkOracleFactory: 19983443n,
|
|
599
|
+
preLiquidationFactory: 19983599n,
|
|
600
|
+
},
|
|
601
|
+
[chain_js_1.ChainId.CornMainnet]: {
|
|
602
|
+
morpho: 251401n,
|
|
603
|
+
bundler3: {
|
|
604
|
+
bundler3: 253107n,
|
|
605
|
+
generalAdapter1: 253107n,
|
|
606
|
+
},
|
|
607
|
+
adaptiveCurveIrm: 251401n,
|
|
608
|
+
publicAllocator: 251401n,
|
|
609
|
+
metaMorphoFactory: 253027n,
|
|
610
|
+
chainlinkOracleFactory: 253027n,
|
|
611
|
+
preLiquidationFactory: 253107n,
|
|
612
|
+
},
|
|
613
|
+
[chain_js_1.ChainId.PlumeMainnet]: {
|
|
614
|
+
morpho: 765994n,
|
|
615
|
+
bundler3: {
|
|
616
|
+
bundler3: 789925n,
|
|
617
|
+
generalAdapter1: 789925n,
|
|
618
|
+
},
|
|
619
|
+
adaptiveCurveIrm: 765994n,
|
|
620
|
+
publicAllocator: 765994n,
|
|
621
|
+
metaMorphoFactory: 766078n,
|
|
622
|
+
chainlinkOracleFactory: 766078n,
|
|
623
|
+
preLiquidationFactory: 789925n,
|
|
624
|
+
},
|
|
625
|
+
[chain_js_1.ChainId.CampMainnet]: {
|
|
626
|
+
morpho: 4804080n,
|
|
627
|
+
bundler3: {
|
|
628
|
+
bundler3: 4804690n,
|
|
629
|
+
generalAdapter1: 4804690n,
|
|
630
|
+
},
|
|
631
|
+
adaptiveCurveIrm: 4804080n,
|
|
632
|
+
publicAllocator: 4804080n,
|
|
633
|
+
metaMorphoFactory: 4804270n,
|
|
634
|
+
chainlinkOracleFactory: 4804270n,
|
|
635
|
+
preLiquidationFactory: 4804690n,
|
|
636
|
+
},
|
|
637
|
+
[chain_js_1.ChainId.KatanaMainnet]: {
|
|
638
|
+
morpho: 2741069n,
|
|
639
|
+
bundler3: {
|
|
640
|
+
bundler3: 2741993n,
|
|
641
|
+
generalAdapter1: 2741993n,
|
|
642
|
+
},
|
|
643
|
+
adaptiveCurveIrm: 2741069n,
|
|
644
|
+
publicAllocator: 2741069n,
|
|
645
|
+
metaMorphoFactory: 2741420n,
|
|
646
|
+
chainlinkOracleFactory: 2741420n,
|
|
647
|
+
preLiquidationFactory: 2741993n,
|
|
648
|
+
},
|
|
649
|
+
[chain_js_1.ChainId.EtherlinkMainnet]: {
|
|
650
|
+
morpho: 21047448n,
|
|
651
|
+
bundler3: {
|
|
652
|
+
bundler3: 21050766n,
|
|
653
|
+
generalAdapter1: 21050766n,
|
|
654
|
+
},
|
|
655
|
+
adaptiveCurveIrm: 21047448n,
|
|
656
|
+
publicAllocator: 21047448n,
|
|
657
|
+
metaMorphoFactory: 21050315n,
|
|
658
|
+
chainlinkOracleFactory: 21050315n,
|
|
659
|
+
preLiquidationFactory: 21050766n,
|
|
660
|
+
},
|
|
661
|
+
[chain_js_1.ChainId.TacMainnet]: {
|
|
662
|
+
morpho: 853025n,
|
|
663
|
+
bundler3: {
|
|
664
|
+
bundler3: 978967n,
|
|
665
|
+
generalAdapter1: 978967n,
|
|
666
|
+
},
|
|
667
|
+
adaptiveCurveIrm: 853025n,
|
|
668
|
+
publicAllocator: 853025n,
|
|
669
|
+
metaMorphoFactory: 978654n,
|
|
670
|
+
chainlinkOracleFactory: 978654n,
|
|
671
|
+
preLiquidationFactory: 978967n,
|
|
672
|
+
},
|
|
673
|
+
[chain_js_1.ChainId.LiskMainnet]: {
|
|
674
|
+
morpho: 15731231n,
|
|
675
|
+
bundler3: {
|
|
676
|
+
bundler3: 15731595n,
|
|
677
|
+
generalAdapter1: 15731595n,
|
|
678
|
+
},
|
|
679
|
+
adaptiveCurveIrm: 15731231n,
|
|
680
|
+
publicAllocator: 15731231n,
|
|
681
|
+
metaMorphoFactory: 15731333n,
|
|
682
|
+
chainlinkOracleFactory: 15731333n,
|
|
683
|
+
preLiquidationFactory: 15731595n,
|
|
684
|
+
},
|
|
685
|
+
[chain_js_1.ChainId.HyperliquidMainnet]: {
|
|
686
|
+
morpho: 1988429n,
|
|
687
|
+
bundler3: {
|
|
688
|
+
bundler3: 1988956n,
|
|
689
|
+
generalAdapter1: 1988956n,
|
|
690
|
+
},
|
|
691
|
+
adaptiveCurveIrm: 1988429n,
|
|
692
|
+
publicAllocator: 1988429n,
|
|
693
|
+
metaMorphoFactory: 1988677n,
|
|
694
|
+
chainlinkOracleFactory: 1988677n,
|
|
695
|
+
preLiquidationFactory: 1988956n,
|
|
696
|
+
},
|
|
697
|
+
};
|
|
392
698
|
const getChainAddresses = (chainId) => {
|
|
393
699
|
const chainAddresses = exports.addresses[chainId];
|
|
394
700
|
if (chainAddresses == null)
|
|
@@ -535,6 +841,7 @@ exports.convexWrapperTokens = {
|
|
|
535
841
|
};
|
|
536
842
|
exports.addressesRegistry = (0, morpho_ts_1.deepFreeze)(_addressesRegistry);
|
|
537
843
|
exports.addresses = exports.addressesRegistry;
|
|
844
|
+
exports.deployments = (0, morpho_ts_1.deepFreeze)(_deployments);
|
|
538
845
|
exports.unwrappedTokensMapping = (0, morpho_ts_1.deepFreeze)(_unwrappedTokensMapping);
|
|
539
846
|
/**
|
|
540
847
|
* Registers custom addresses and unwrapped token mappings to extend
|
|
@@ -544,8 +851,11 @@ exports.unwrappedTokensMapping = (0, morpho_ts_1.deepFreeze)(_unwrappedTokensMap
|
|
|
544
851
|
* @param options.unwrappedTokens - A mapping of chain IDs to token address maps,
|
|
545
852
|
* where each entry maps wrapped tokens to their unwrapped equivalents.
|
|
546
853
|
* @param options.addresses - Custom address entries to merge into the default registry.
|
|
547
|
-
*
|
|
548
|
-
*
|
|
854
|
+
* Can be a subset of `ChainAddresses` if chain is already known.
|
|
855
|
+
* Must provide all required addresses if chain is unknown.
|
|
856
|
+
* @param options.deployments - Custom deployment entries to merge into the default registry.
|
|
857
|
+
* Can be a subset of `ChainDeployments` if chain is already known.
|
|
858
|
+
* Must provide all required deployments if chain is unknown.
|
|
549
859
|
*
|
|
550
860
|
* @throws {Error} If attempting to override an existing address.
|
|
551
861
|
*
|
|
@@ -561,16 +871,19 @@ exports.unwrappedTokensMapping = (0, morpho_ts_1.deepFreeze)(_unwrappedTokensMap
|
|
|
561
871
|
* });
|
|
562
872
|
* ```
|
|
563
873
|
*/
|
|
564
|
-
function registerCustomAddresses({ unwrappedTokens, addresses: customAddresses, } = {}) {
|
|
874
|
+
function registerCustomAddresses({ unwrappedTokens, addresses: customAddresses, deployments: customDeployments, } = {}) {
|
|
875
|
+
const customizer = (type) =>
|
|
565
876
|
// biome-ignore lint/suspicious/noExplicitAny: type is not trivial and not important here
|
|
566
|
-
|
|
877
|
+
(objValue, srcValue, key) => {
|
|
567
878
|
if (objValue !== undefined &&
|
|
568
879
|
!(0, lodash_isplainobject_1.default)(objValue) &&
|
|
569
880
|
objValue !== srcValue)
|
|
570
|
-
throw new Error(`Cannot override existing
|
|
881
|
+
throw new Error(`Cannot override existing ${type}: ${key}`);
|
|
571
882
|
};
|
|
572
883
|
if (customAddresses)
|
|
573
|
-
exports.addresses = exports.addressesRegistry = (0, morpho_ts_1.deepFreeze)((0, lodash_mergewith_1.default)({}, exports.addressesRegistry, customAddresses, customizer));
|
|
884
|
+
exports.addresses = exports.addressesRegistry = (0, morpho_ts_1.deepFreeze)((0, lodash_mergewith_1.default)({}, exports.addressesRegistry, customAddresses, customizer("address")));
|
|
885
|
+
if (customDeployments)
|
|
886
|
+
exports.deployments = (0, morpho_ts_1.deepFreeze)((0, lodash_mergewith_1.default)({}, exports.deployments, customDeployments, customizer("deployment")));
|
|
574
887
|
if (unwrappedTokens)
|
|
575
|
-
exports.unwrappedTokensMapping = (0, morpho_ts_1.deepFreeze)((0, lodash_mergewith_1.default)({}, exports.unwrappedTokensMapping, unwrappedTokens, customizer));
|
|
888
|
+
exports.unwrappedTokensMapping = (0, morpho_ts_1.deepFreeze)((0, lodash_mergewith_1.default)({}, exports.unwrappedTokensMapping, unwrappedTokens, customizer("unwrapped token")));
|
|
576
889
|
}
|
package/lib/chain.d.ts
CHANGED
|
@@ -37,5 +37,237 @@ export declare namespace ChainUtils {
|
|
|
37
37
|
const getExplorerUrl: (chainId: ChainId) => string;
|
|
38
38
|
const getExplorerAddressUrl: (chainId: ChainId, address: string) => string;
|
|
39
39
|
const getExplorerTransactionUrl: (chainId: ChainId, tx: string) => string;
|
|
40
|
-
const CHAIN_METADATA:
|
|
40
|
+
const CHAIN_METADATA: {
|
|
41
|
+
1: {
|
|
42
|
+
name: string;
|
|
43
|
+
id: ChainId.EthMainnet;
|
|
44
|
+
nativeCurrency: {
|
|
45
|
+
name: string;
|
|
46
|
+
symbol: string;
|
|
47
|
+
decimals: number;
|
|
48
|
+
};
|
|
49
|
+
explorerUrl: string;
|
|
50
|
+
identifier: string;
|
|
51
|
+
};
|
|
52
|
+
8453: {
|
|
53
|
+
name: string;
|
|
54
|
+
id: ChainId.BaseMainnet;
|
|
55
|
+
nativeCurrency: {
|
|
56
|
+
name: string;
|
|
57
|
+
symbol: string;
|
|
58
|
+
decimals: number;
|
|
59
|
+
};
|
|
60
|
+
explorerUrl: string;
|
|
61
|
+
identifier: string;
|
|
62
|
+
};
|
|
63
|
+
137: {
|
|
64
|
+
name: string;
|
|
65
|
+
id: ChainId.PolygonMainnet;
|
|
66
|
+
nativeCurrency: {
|
|
67
|
+
name: string;
|
|
68
|
+
symbol: string;
|
|
69
|
+
decimals: number;
|
|
70
|
+
};
|
|
71
|
+
explorerUrl: string;
|
|
72
|
+
identifier: string;
|
|
73
|
+
};
|
|
74
|
+
42161: {
|
|
75
|
+
name: string;
|
|
76
|
+
id: ChainId.ArbitrumMainnet;
|
|
77
|
+
nativeCurrency: {
|
|
78
|
+
name: string;
|
|
79
|
+
symbol: string;
|
|
80
|
+
decimals: number;
|
|
81
|
+
};
|
|
82
|
+
explorerUrl: string;
|
|
83
|
+
identifier: string;
|
|
84
|
+
};
|
|
85
|
+
10: {
|
|
86
|
+
name: string;
|
|
87
|
+
id: ChainId.OptimismMainnet;
|
|
88
|
+
nativeCurrency: {
|
|
89
|
+
name: string;
|
|
90
|
+
symbol: string;
|
|
91
|
+
decimals: number;
|
|
92
|
+
};
|
|
93
|
+
explorerUrl: string;
|
|
94
|
+
identifier: string;
|
|
95
|
+
};
|
|
96
|
+
480: {
|
|
97
|
+
name: string;
|
|
98
|
+
id: ChainId.WorldChainMainnet;
|
|
99
|
+
nativeCurrency: {
|
|
100
|
+
name: string;
|
|
101
|
+
symbol: string;
|
|
102
|
+
decimals: number;
|
|
103
|
+
};
|
|
104
|
+
explorerUrl: string;
|
|
105
|
+
identifier: string;
|
|
106
|
+
};
|
|
107
|
+
252: {
|
|
108
|
+
name: string;
|
|
109
|
+
id: ChainId.FraxtalMainnet;
|
|
110
|
+
nativeCurrency: {
|
|
111
|
+
name: string;
|
|
112
|
+
symbol: string;
|
|
113
|
+
decimals: number;
|
|
114
|
+
};
|
|
115
|
+
explorerUrl: string;
|
|
116
|
+
identifier: string;
|
|
117
|
+
};
|
|
118
|
+
534352: {
|
|
119
|
+
name: string;
|
|
120
|
+
id: ChainId.ScrollMainnet;
|
|
121
|
+
nativeCurrency: {
|
|
122
|
+
name: string;
|
|
123
|
+
symbol: string;
|
|
124
|
+
decimals: number;
|
|
125
|
+
};
|
|
126
|
+
explorerUrl: string;
|
|
127
|
+
identifier: string;
|
|
128
|
+
};
|
|
129
|
+
57073: {
|
|
130
|
+
name: string;
|
|
131
|
+
id: ChainId.InkMainnet;
|
|
132
|
+
nativeCurrency: {
|
|
133
|
+
name: string;
|
|
134
|
+
symbol: string;
|
|
135
|
+
decimals: number;
|
|
136
|
+
};
|
|
137
|
+
explorerUrl: string;
|
|
138
|
+
identifier: string;
|
|
139
|
+
};
|
|
140
|
+
130: {
|
|
141
|
+
name: string;
|
|
142
|
+
id: ChainId.Unichain;
|
|
143
|
+
nativeCurrency: {
|
|
144
|
+
name: string;
|
|
145
|
+
symbol: string;
|
|
146
|
+
decimals: number;
|
|
147
|
+
};
|
|
148
|
+
explorerUrl: string;
|
|
149
|
+
identifier: string;
|
|
150
|
+
};
|
|
151
|
+
146: {
|
|
152
|
+
name: string;
|
|
153
|
+
id: ChainId.SonicMainnet;
|
|
154
|
+
nativeCurrency: {
|
|
155
|
+
name: string;
|
|
156
|
+
symbol: string;
|
|
157
|
+
decimals: number;
|
|
158
|
+
};
|
|
159
|
+
explorerUrl: string;
|
|
160
|
+
identifier: string;
|
|
161
|
+
};
|
|
162
|
+
43111: {
|
|
163
|
+
name: string;
|
|
164
|
+
id: ChainId.HemiMainnet;
|
|
165
|
+
nativeCurrency: {
|
|
166
|
+
name: string;
|
|
167
|
+
symbol: string;
|
|
168
|
+
decimals: number;
|
|
169
|
+
};
|
|
170
|
+
explorerUrl: string;
|
|
171
|
+
identifier: string;
|
|
172
|
+
};
|
|
173
|
+
34443: {
|
|
174
|
+
name: string;
|
|
175
|
+
id: ChainId.ModeMainnet;
|
|
176
|
+
nativeCurrency: {
|
|
177
|
+
name: string;
|
|
178
|
+
symbol: string;
|
|
179
|
+
decimals: number;
|
|
180
|
+
};
|
|
181
|
+
explorerUrl: string;
|
|
182
|
+
identifier: string;
|
|
183
|
+
};
|
|
184
|
+
21000000: {
|
|
185
|
+
name: string;
|
|
186
|
+
id: ChainId.CornMainnet;
|
|
187
|
+
nativeCurrency: {
|
|
188
|
+
name: string;
|
|
189
|
+
symbol: string;
|
|
190
|
+
decimals: number;
|
|
191
|
+
};
|
|
192
|
+
explorerUrl: string;
|
|
193
|
+
identifier: string;
|
|
194
|
+
};
|
|
195
|
+
98866: {
|
|
196
|
+
name: string;
|
|
197
|
+
id: ChainId.PlumeMainnet;
|
|
198
|
+
nativeCurrency: {
|
|
199
|
+
name: string;
|
|
200
|
+
symbol: string;
|
|
201
|
+
decimals: number;
|
|
202
|
+
};
|
|
203
|
+
explorerUrl: string;
|
|
204
|
+
identifier: string;
|
|
205
|
+
};
|
|
206
|
+
123420001114: {
|
|
207
|
+
name: string;
|
|
208
|
+
id: ChainId.CampMainnet;
|
|
209
|
+
nativeCurrency: {
|
|
210
|
+
name: string;
|
|
211
|
+
symbol: string;
|
|
212
|
+
decimals: number;
|
|
213
|
+
};
|
|
214
|
+
explorerUrl: string;
|
|
215
|
+
identifier: string;
|
|
216
|
+
};
|
|
217
|
+
747474: {
|
|
218
|
+
name: string;
|
|
219
|
+
id: ChainId.KatanaMainnet;
|
|
220
|
+
nativeCurrency: {
|
|
221
|
+
name: string;
|
|
222
|
+
symbol: string;
|
|
223
|
+
decimals: number;
|
|
224
|
+
};
|
|
225
|
+
explorerUrl: string;
|
|
226
|
+
identifier: string;
|
|
227
|
+
};
|
|
228
|
+
42793: {
|
|
229
|
+
name: string;
|
|
230
|
+
id: ChainId.EtherlinkMainnet;
|
|
231
|
+
nativeCurrency: {
|
|
232
|
+
name: string;
|
|
233
|
+
symbol: string;
|
|
234
|
+
decimals: number;
|
|
235
|
+
};
|
|
236
|
+
explorerUrl: string;
|
|
237
|
+
identifier: string;
|
|
238
|
+
};
|
|
239
|
+
239: {
|
|
240
|
+
name: string;
|
|
241
|
+
id: ChainId.TacMainnet;
|
|
242
|
+
nativeCurrency: {
|
|
243
|
+
name: string;
|
|
244
|
+
symbol: string;
|
|
245
|
+
decimals: number;
|
|
246
|
+
};
|
|
247
|
+
explorerUrl: string;
|
|
248
|
+
identifier: string;
|
|
249
|
+
};
|
|
250
|
+
1135: {
|
|
251
|
+
name: string;
|
|
252
|
+
id: ChainId.LiskMainnet;
|
|
253
|
+
nativeCurrency: {
|
|
254
|
+
name: string;
|
|
255
|
+
symbol: string;
|
|
256
|
+
decimals: number;
|
|
257
|
+
};
|
|
258
|
+
explorerUrl: string;
|
|
259
|
+
identifier: string;
|
|
260
|
+
};
|
|
261
|
+
999: {
|
|
262
|
+
name: string;
|
|
263
|
+
id: ChainId.HyperliquidMainnet;
|
|
264
|
+
nativeCurrency: {
|
|
265
|
+
name: string;
|
|
266
|
+
symbol: string;
|
|
267
|
+
decimals: number;
|
|
268
|
+
};
|
|
269
|
+
explorerUrl: string;
|
|
270
|
+
identifier: string;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
41
273
|
}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -27,3 +27,4 @@ __exportStar(require("./holding/index.js"), exports);
|
|
|
27
27
|
__exportStar(require("./position/index.js"), exports);
|
|
28
28
|
__exportStar(require("./vault/index.js"), exports);
|
|
29
29
|
__exportStar(require("./preLiquidation.js"), exports);
|
|
30
|
+
__exportStar(require("./utils.js"), exports);
|
package/lib/market/Market.js
CHANGED
|
@@ -99,7 +99,7 @@ class Market {
|
|
|
99
99
|
get apyAtTarget() {
|
|
100
100
|
if (this.rateAtTarget == null)
|
|
101
101
|
return;
|
|
102
|
-
return MarketUtils_js_1.MarketUtils.
|
|
102
|
+
return MarketUtils_js_1.MarketUtils.rateToApy(this.rateAtTarget);
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* Returns the rate at which interest accrued for suppliers of this market,
|
|
@@ -218,7 +218,7 @@ class Market {
|
|
|
218
218
|
*/
|
|
219
219
|
getBorrowApy(timestamp = morpho_ts_1.Time.timestamp()) {
|
|
220
220
|
const borrowRate = this.getEndBorrowRate(timestamp);
|
|
221
|
-
return MarketUtils_js_1.MarketUtils.
|
|
221
|
+
return MarketUtils_js_1.MarketUtils.rateToApy(borrowRate);
|
|
222
222
|
}
|
|
223
223
|
/**
|
|
224
224
|
* The market's instantaneous supply-side Annual Percentage Yield (APY) at the given timestamp,
|
|
@@ -240,7 +240,7 @@ class Market {
|
|
|
240
240
|
*/
|
|
241
241
|
getAvgBorrowApy(timestamp = morpho_ts_1.Time.timestamp()) {
|
|
242
242
|
const borrowRate = this.getAvgBorrowRate(timestamp);
|
|
243
|
-
return MarketUtils_js_1.MarketUtils.
|
|
243
|
+
return MarketUtils_js_1.MarketUtils.rateToApy(borrowRate);
|
|
244
244
|
}
|
|
245
245
|
/**
|
|
246
246
|
* The market's experienced supply-side Annual Percentage Yield (APY),
|
|
@@ -38,11 +38,17 @@ export declare namespace MarketUtils {
|
|
|
38
38
|
}): bigint;
|
|
39
39
|
/**
|
|
40
40
|
* Returns the per-second rate continuously compounded over the given period, as calculated in Morpho Blue (scaled by WAD).
|
|
41
|
-
* If the period is 1 year, the compounded rate correspond to the Annual Percentage Yield (APY)
|
|
42
41
|
* @param rate The per-second rate to compound (scaled by WAD).
|
|
43
42
|
* @param period The period to compound the rate over (in seconds). Defaults to 1 year.
|
|
43
|
+
* @deprecated The compounded rate is inaccurate if rate * period >> 0. If interested in the APY, use `rateToApy` instead.
|
|
44
44
|
*/
|
|
45
45
|
function compoundRate(rate: BigIntish, period?: BigIntish): bigint;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the per-second rate continuously compounded over a year (scaled by WAD),
|
|
48
|
+
* as calculated in Morpho Blue assuming the market is frequently accrued onchain.
|
|
49
|
+
* @param rate The per-second rate to compound annually (scaled by WAD).
|
|
50
|
+
*/
|
|
51
|
+
function rateToApy(rate: BigIntish): bigint;
|
|
46
52
|
/**
|
|
47
53
|
* Returns the interest accrued on both sides of the given market
|
|
48
54
|
* as well as the supply shares minted to the fee recipient.
|