@morpho-org/blue-sdk 5.2.0-next.0 → 5.2.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.
package/lib/addresses.js CHANGED
@@ -20,10 +20,6 @@ const _addressesRegistry = {
20
20
  [chain_js_1.ChainId.EthMainnet]: {
21
21
  morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
22
22
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
23
- /**
24
- * @deprecated All bundles should use Bundler3 instead.
25
- */
26
- bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077",
27
23
  bundler3: {
28
24
  bundler3: "0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245",
29
25
  generalAdapter1: "0x4A6c312ec70E8747a587EE860a0353cd42Be0aE0",
@@ -37,29 +33,12 @@ const _addressesRegistry = {
37
33
  aaveV3EtherFiMigrationAdapter: "0x4011dc6581fA05F9B0c7A12AdCd676e2b1a59ca3",
38
34
  aaveV3OptimizerMigrationAdapter: "0x9e2ea2d5785598a163D569D795f286F5C55ad972",
39
35
  },
40
- /**
41
- * @deprecated All bundles should use Bundler3 instead.
42
- */
43
- aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c",
44
- /**
45
- * @deprecated All bundles should use Bundler3 instead.
46
- */
47
- aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76",
48
- /**
49
- * @deprecated All bundles should use Bundler3 instead.
50
- */
51
- aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC",
52
- /**
53
- * @deprecated All bundles should use Bundler3 instead.
54
- */
55
- compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558",
56
- /**
57
- * @deprecated All bundles should use Bundler3 instead.
58
- */
59
- compoundV2Bundler: "0x26bF52a84360Ad3d01d7CDc28FC2dDC04d8c8647",
60
36
  adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
61
37
  publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
62
38
  metaMorphoFactory: "0x1897A8997241C1cD4bD0698647e4EB7213535c24",
39
+ vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405",
40
+ morphoMarketV1AdapterFactory: "0xb049465969ac6355127cDf9E88deE63d25204d5D",
41
+ morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394",
63
42
  registryList: "0x3696c5eAe4a7Ffd04Ea163564571E9CD8Ed9364e",
64
43
  chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766",
65
44
  preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476",
@@ -96,16 +75,10 @@ const _addressesRegistry = {
96
75
  crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14",
97
76
  "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e",
98
77
  "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726",
99
- vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405",
100
- morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394",
101
78
  },
102
79
  [chain_js_1.ChainId.BaseMainnet]: {
103
80
  morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
104
81
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
105
- /**
106
- * @deprecated All bundles should use Bundler3 instead.
107
- */
108
- bundler: "0x23055618898e202386e6c13955a58D3C68200BFB",
109
82
  bundler3: {
110
83
  bundler3: "0x6BFd8137e702540E7A42B74178A4a49Ba43920C4",
111
84
  generalAdapter1: "0xb98c948CFA24072e58935BC004a8A7b376AE746A",
@@ -114,21 +87,12 @@ const _addressesRegistry = {
114
87
  compoundV3MigrationAdapter: "0x85D4812Ef92c040d4270eD8547b6835e41FbbB70",
115
88
  aaveV3CoreMigrationAdapter: "0xb27Aa2a964eAd5ed661D86974b37e4fB995b36f5",
116
89
  },
117
- /**
118
- * @deprecated All bundles should use Bundler3 instead.
119
- */
120
- compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223",
121
- /**
122
- * @deprecated All bundles should use Bundler3 instead.
123
- */
124
- aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108",
125
- /**
126
- * @deprecated All bundles should use Bundler3 instead.
127
- */
128
- compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA",
129
90
  adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
130
91
  publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
131
92
  metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918",
93
+ vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857",
94
+ morphoMarketV1AdapterFactory: "0x133baC94306B99f6dAD85c381a5be851d8DD717c",
95
+ morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642",
132
96
  registryList: "0x5C2531Cbd2cf112Cf687da3Cd536708aDd7DB10a",
133
97
  chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d",
134
98
  preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef",
@@ -137,8 +101,6 @@ const _addressesRegistry = {
137
101
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
138
102
  verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b",
139
103
  testUsdc: "0xBC77067f829979812d795d516E523C4033b66409",
140
- vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857",
141
- morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642",
142
104
  },
143
105
  [chain_js_1.ChainId.PolygonMainnet]: {
144
106
  morpho: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67",
@@ -154,6 +116,10 @@ const _addressesRegistry = {
154
116
  adaptiveCurveIrm: "0xe675A2161D4a6E2de2eeD70ac98EEBf257FBF0B0",
155
117
  publicAllocator: "0xfac15aff53ADd2ff80C2962127C434E8615Df0d3",
156
118
  metaMorphoFactory: "0xa9c87daB340631C34BB738625C70499e29ddDC98",
119
+ vaultV2Factory: "0xC11a53eE9B1eCc7a068D8e40F8F17926584F97Cf",
120
+ morphoMarketV1AdapterFactory: "0xD1A0C86F28ecD1657Ad06415c2B230cC89D9b6dd",
121
+ morphoVaultV1AdapterFactory: "0xEb174FEA51Da241eB3B516959B216e013de2888a",
122
+ registryList: "0xb70a43821d2707fA9d0EDd9511CC499F468Ba564",
157
123
  chainlinkOracleFactory: "0x1ff7895Eb842794c5d07C4c547b6730e61295215",
158
124
  preLiquidationFactory: "0xeDadDe37D76c72b98725614d0b41C20Fe612d304",
159
125
  wNative: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
@@ -173,6 +139,10 @@ const _addressesRegistry = {
173
139
  adaptiveCurveIrm: "0x66F30587FB8D4206918deb78ecA7d5eBbafD06DA",
174
140
  publicAllocator: "0x769583Af5e9D03589F159EbEC31Cc2c23E8C355E",
175
141
  metaMorphoFactory: "0x878988f5f561081deEa117717052164ea1Ef0c82",
142
+ vaultV2Factory: "0x6b46fa3cc9EBF8aB230aBAc664E37F2966Bf7971",
143
+ morphoMarketV1AdapterFactory: "0x96456Bf888D4de607Bf3ca0b3C8e4DF9b0d0Ad47",
144
+ morphoVaultV1AdapterFactory: "0xD8Fc8a85779551e78B516da9f74061cb3b086793",
145
+ registryList: "0xc00eb3c7aD1aE986A7f05F5A9d71aCa39c763C65",
176
146
  chainlinkOracleFactory: "0x98Ce5D183DC0c176f54D37162F87e7eD7f2E41b5",
177
147
  preLiquidationFactory: "0x635c31B5DF1F7EFbCbC07E302335Ef4230758e3d",
178
148
  wNative: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
@@ -190,6 +160,10 @@ const _addressesRegistry = {
190
160
  adaptiveCurveIrm: "0x8cD70A8F399428456b29546BC5dBe10ab6a06ef6",
191
161
  publicAllocator: "0x0d68a97324E602E02799CD83B42D337207B40658",
192
162
  metaMorphoFactory: "0x3Bb6A6A0Bc85b367EFE0A5bAc81c5E52C892839a",
163
+ vaultV2Factory: "0x6128b680b277Bf4Df80DFE9D8c55A498660870ef",
164
+ morphoMarketV1AdapterFactory: "0x65956d5Ba4974983ecCe111612FC0A0c22650A11",
165
+ morphoVaultV1AdapterFactory: "0xEe9F7C64dD827ED7b5CAA2272936366FAca00CF3",
166
+ registryList: "0xD1346be260cd22Eab9E6163010b0D5CbfAAAD32b",
193
167
  chainlinkOracleFactory: "0x1ec408D4131686f727F3Fd6245CF85Bc5c9DAD70",
194
168
  preLiquidationFactory: "0x3d05C01EE8e97361b9E19D172128255eaE5F98B9",
195
169
  wNative: "0x4200000000000000000000000000000000000006",
@@ -205,6 +179,10 @@ const _addressesRegistry = {
205
179
  adaptiveCurveIrm: "0x34E99D604751a72cF8d0CFDf87069292d82De472",
206
180
  publicAllocator: "0xef9889B4e443DEd35FA0Bd060f2104Cca94e6A43",
207
181
  metaMorphoFactory: "0x4DBB3a642a2146d5413750Cca3647086D9ba5F12",
182
+ vaultV2Factory: "0x6846EA318B6B987Ee6b28eBFd87c3409F1d13108",
183
+ morphoMarketV1AdapterFactory: "0xAf93F2d8508053432659d509b0210fdF1472493D",
184
+ morphoVaultV1AdapterFactory: "0xbF7DEa3756668C7E396C655D646C039826ba8416",
185
+ registryList: "0x06A47994B4890dcA28C076969cedE1151d86EFCF",
208
186
  chainlinkOracleFactory: "0xd706690BA1Fe26b70c4AD89e60ff62cEB3A2eD02",
209
187
  preLiquidationFactory: "0xe3cE2051a24e58DBFC0eFBe4c2d9e89c5eAe4695",
210
188
  wNative: "0x4200000000000000000000000000000000000006",
@@ -264,6 +242,10 @@ const _addressesRegistry = {
264
242
  adaptiveCurveIrm: "0x9a6061d51743B31D2c3Be75D83781Fa423f53F0E",
265
243
  publicAllocator: "0xB0c9a107fA17c779B3378210A7a593e88938C7C9",
266
244
  metaMorphoFactory: "0xe9EdE3929F43a7062a007C3e8652e4ACa610Bdc0",
245
+ vaultV2Factory: "0xC9b34c108014B44e5a189A830e7e04c56704a0c9",
246
+ morphoMarketV1AdapterFactory: "0x117b92Ab1C025B175ED38a0CDe5A067a745224a0",
247
+ morphoVaultV1AdapterFactory: "0xf1Ab9e885C0faa0cbCEd407498BBA895537aD754",
248
+ registryList: "0xB9130D2A87d7c60ED7E7e4b25bdA6e3E6841becB",
267
249
  chainlinkOracleFactory: "0x43269546e1D586a1f7200a0AC07e26f9631f7539",
268
250
  preLiquidationFactory: "0xb04e4D3D59Ee47Ca9BA192707AF13A7D02969911",
269
251
  wNative: "0x4200000000000000000000000000000000000006",
@@ -361,6 +343,10 @@ const _addressesRegistry = {
361
343
  adaptiveCurveIrm: "0x4F708C0ae7deD3d74736594C2109C2E3c065B428",
362
344
  publicAllocator: "0x39EB6Da5e88194C82B13491Df2e8B3E213eD2412",
363
345
  metaMorphoFactory: "0x1c8De6889acee12257899BFeAa2b7e534de32E16",
346
+ vaultV2Factory: "0xFcb8b57E56787bB29e130Fca67f3c5a1232975D1",
347
+ morphoMarketV1AdapterFactory: "0x2e6BE3a3A27fb45c6AbA2D1833eeA48E8788538e",
348
+ morphoVaultV1AdapterFactory: "0xc8D22B1adD3D176600E9952e7876e9249254cAAF",
349
+ registryList: "0xA9132a09838fD20304dF2B2892679d06A4cc6371",
364
350
  chainlinkOracleFactory: "0x7D047fB910Bc187C18C81a69E30Fa164f8c536eC",
365
351
  preLiquidationFactory: "0x678EB53A3bB79111263f47B84989d16D81c36D85",
366
352
  wNative: "0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62",
@@ -416,14 +402,18 @@ const _addressesRegistry = {
416
402
  publicAllocator: "0x517505be22D9068687334e69ae7a02fC77edf4Fc",
417
403
  metaMorphoFactory: "0xec051b19d654C48c357dC974376DeB6272f24e53",
418
404
  vaultV2Factory: "0xD7217E5687FF1071356C780b5fe4803D9D967da7",
405
+ morphoMarketV1AdapterFactory: "0xc6b8B565C715134b0Ca3D6fa3D29B25759D0b9e2",
419
406
  morphoVaultV1AdapterFactory: "0xdf5202e29654e02011611A086f15477880580CAc",
420
407
  registryList: "0x857B55cEb57dA0C2A83EE08a8dB529B931089aee",
421
408
  chainlinkOracleFactory: "0xeb476f124FaD625178759d13557A72394A6f9aF5",
422
409
  preLiquidationFactory: "0x1b6782Ac7A859503cE953FBf4736311CC335B8f0",
423
410
  wNative: "0x5555555555555555555555555555555555555555",
411
+ // Must implement USDC permit version 2 (otherwise breaks permit signatures).
412
+ usdc: "0xb88339CB7199b77E23DB6E890353E22632Ba630f",
424
413
  },
425
414
  [chain_js_1.ChainId.SeiMainnet]: {
426
415
  morpho: "0xc9cDAc20FCeAAF616f7EB0bb6Cd2c69dcfa9094c",
416
+ permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
427
417
  bundler3: {
428
418
  bundler3: "0xF9457356F18A3349Bb317Ac144c3Bcc62e5761aD",
429
419
  generalAdapter1: "0x02e0e71e145f254820B9D89c9E6068f08256F601",
@@ -434,6 +424,7 @@ const _addressesRegistry = {
434
424
  chainlinkOracleFactory: "0x4bD68c2FF3274207EC07ED281C915758b6F23F07",
435
425
  preLiquidationFactory: "0x65eD61058cEB4895B7d62437BaCEA39b04f6D27B",
436
426
  wNative: "0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7",
427
+ usdc: "0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392",
437
428
  },
438
429
  };
439
430
  const _deployments = {
@@ -456,11 +447,12 @@ const _deployments = {
456
447
  adaptiveCurveIrm: 18883124n,
457
448
  publicAllocator: 19375099n,
458
449
  metaMorphoFactory: 21439510n,
450
+ vaultV2Factory: 23375073n,
451
+ morphoMarketV1AdapterFactory: 23375073n,
452
+ morphoVaultV1AdapterFactory: 23375073n,
459
453
  registryList: 23375119n,
460
454
  chainlinkOracleFactory: 19375066n,
461
455
  preLiquidationFactory: 21414664n,
462
- vaultV2Factory: 23375073n,
463
- morphoVaultV1AdapterFactory: 23375073n,
464
456
  },
465
457
  [chain_js_1.ChainId.BaseMainnet]: {
466
458
  morpho: 13977148n,
@@ -476,11 +468,12 @@ const _deployments = {
476
468
  adaptiveCurveIrm: 13977152n,
477
469
  publicAllocator: 13979545n,
478
470
  metaMorphoFactory: 23928808n,
471
+ vaultV2Factory: 35615206n,
472
+ morphoMarketV1AdapterFactory: 35615206n,
473
+ morphoVaultV1AdapterFactory: 35615206n,
479
474
  registryList: 35615358n,
480
475
  chainlinkOracleFactory: 13978286n,
481
476
  preLiquidationFactory: 23779056n,
482
- vaultV2Factory: 35615206n,
483
- morphoVaultV1AdapterFactory: 35615206n,
484
477
  },
485
478
  [chain_js_1.ChainId.PolygonMainnet]: {
486
479
  morpho: 66931042n,
@@ -496,6 +489,10 @@ const _deployments = {
496
489
  adaptiveCurveIrm: 66931042n,
497
490
  publicAllocator: 66931042n,
498
491
  metaMorphoFactory: 66931042n,
492
+ vaultV2Factory: 77371907n,
493
+ morphoMarketV1AdapterFactory: 77371907n,
494
+ morphoVaultV1AdapterFactory: 77371907n,
495
+ registryList: 77372020n,
499
496
  chainlinkOracleFactory: 66931042n,
500
497
  preLiquidationFactory: 68074185n,
501
498
  },
@@ -512,6 +509,10 @@ const _deployments = {
512
509
  adaptiveCurveIrm: 296446593n,
513
510
  publicAllocator: 296446593n,
514
511
  metaMorphoFactory: 296447195n,
512
+ vaultV2Factory: 387016724n,
513
+ morphoMarketV1AdapterFactory: 387016724n,
514
+ morphoVaultV1AdapterFactory: 387016724n,
515
+ registryList: 387017701n,
515
516
  chainlinkOracleFactory: 296447195n,
516
517
  preLiquidationFactory: 307326238n,
517
518
  },
@@ -526,6 +527,10 @@ const _deployments = {
526
527
  adaptiveCurveIrm: 130770075n,
527
528
  publicAllocator: 130770075n,
528
529
  metaMorphoFactory: 130770189n,
530
+ vaultV2Factory: 142122059n,
531
+ morphoMarketV1AdapterFactory: 142122059n,
532
+ morphoVaultV1AdapterFactory: 142122059n,
533
+ registryList: 142122170n,
529
534
  chainlinkOracleFactory: 130770189n,
530
535
  preLiquidationFactory: 132139369n,
531
536
  },
@@ -538,6 +543,10 @@ const _deployments = {
538
543
  adaptiveCurveIrm: 9025669n,
539
544
  publicAllocator: 9025669n,
540
545
  metaMorphoFactory: 9025733n,
546
+ vaultV2Factory: 20253005n,
547
+ morphoMarketV1AdapterFactory: 20253005n,
548
+ morphoVaultV1AdapterFactory: 20253005n,
549
+ registryList: 20253132n,
541
550
  chainlinkOracleFactory: 9025733n,
542
551
  preLiquidationFactory: 10273494n,
543
552
  },
@@ -589,6 +598,10 @@ const _deployments = {
589
598
  adaptiveCurveIrm: 9139027n,
590
599
  publicAllocator: 9139027n,
591
600
  metaMorphoFactory: 9316789n,
601
+ vaultV2Factory: 29092109n,
602
+ morphoMarketV1AdapterFactory: 29092109n,
603
+ morphoVaultV1AdapterFactory: 29092109n,
604
+ registryList: 29092328n,
592
605
  chainlinkOracleFactory: 9316789n,
593
606
  preLiquidationFactory: 9381237n,
594
607
  },
@@ -673,6 +686,10 @@ const _deployments = {
673
686
  adaptiveCurveIrm: 2741069n,
674
687
  publicAllocator: 2741069n,
675
688
  metaMorphoFactory: 2741420n,
689
+ vaultV2Factory: 13096629n,
690
+ morphoMarketV1AdapterFactory: 13096629n,
691
+ morphoVaultV1AdapterFactory: 13096629n,
692
+ registryList: 13096853n,
676
693
  chainlinkOracleFactory: 2741420n,
677
694
  preLiquidationFactory: 2741993n,
678
695
  },
@@ -722,6 +739,7 @@ const _deployments = {
722
739
  publicAllocator: 1988429n,
723
740
  metaMorphoFactory: 1988677n,
724
741
  vaultV2Factory: 14188393n,
742
+ morphoMarketV1AdapterFactory: 14188393n,
725
743
  morphoVaultV1AdapterFactory: 14188393n,
726
744
  registryList: 14188698n,
727
745
  chainlinkOracleFactory: 1988677n,
@@ -733,11 +751,13 @@ const _deployments = {
733
751
  bundler3: 168897284n,
734
752
  generalAdapter1: 168897284n,
735
753
  },
754
+ permit2: 118721449n,
736
755
  adaptiveCurveIrm: 166036723n,
737
756
  publicAllocator: 166036723n,
738
757
  metaMorphoFactory: 168896078n,
739
758
  chainlinkOracleFactory: 168896078n,
740
759
  preLiquidationFactory: 168897284n,
760
+ usdc: 154131168n,
741
761
  },
742
762
  };
743
763
  const getChainAddresses = (chainId) => {
package/lib/errors.d.ts CHANGED
@@ -25,10 +25,6 @@ export declare class UnsupportedPreLiquidationParamsError extends Error {
25
25
  readonly lltv: bigint;
26
26
  constructor(lltv: bigint);
27
27
  }
28
- export declare class UnsupportedVaultV2AdapterError extends Error {
29
- readonly address: Address;
30
- constructor(address: Address);
31
- }
32
28
  export declare namespace BlueErrors {
33
29
  class AlreadySet extends Error {
34
30
  readonly name: string;
@@ -69,18 +65,6 @@ export declare namespace BlueErrors {
69
65
  constructor(deadline: bigint);
70
66
  }
71
67
  }
72
- export declare namespace VaultV2Errors {
73
- class InvalidInterestAccrual extends Error {
74
- readonly vault: Address;
75
- readonly timestamp: bigint;
76
- readonly lastUpdate: bigint;
77
- constructor(vault: Address, timestamp: bigint, lastUpdate: bigint);
78
- }
79
- class UnsupportedLiquidityAdapter extends Error {
80
- readonly address: Address;
81
- constructor(address: Address);
82
- }
83
- }
84
68
  export interface ErrorClass<E extends Error> {
85
69
  new (...args: any[]): E;
86
70
  }
package/lib/errors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VaultV2Errors = exports.BlueErrors = exports.UnsupportedVaultV2AdapterError = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownMarketParamsError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownDataError = void 0;
3
+ exports.BlueErrors = exports.UnsupportedPreLiquidationParamsError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownMarketParamsError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownDataError = void 0;
4
4
  exports._try = _try;
5
5
  const viem_1 = require("viem");
6
6
  class UnknownDataError extends Error {
@@ -54,14 +54,6 @@ class UnsupportedPreLiquidationParamsError extends Error {
54
54
  }
55
55
  }
56
56
  exports.UnsupportedPreLiquidationParamsError = UnsupportedPreLiquidationParamsError;
57
- class UnsupportedVaultV2AdapterError extends Error {
58
- address;
59
- constructor(address) {
60
- super(`vault v2 adapter "${address}" is not supported`);
61
- this.address = address;
62
- }
63
- }
64
- exports.UnsupportedVaultV2AdapterError = UnsupportedVaultV2AdapterError;
65
57
  var BlueErrors;
66
58
  (function (BlueErrors) {
67
59
  class AlreadySet extends Error {
@@ -141,29 +133,6 @@ var BlueErrors;
141
133
  }
142
134
  BlueErrors.ExpiredSignature = ExpiredSignature;
143
135
  })(BlueErrors || (exports.BlueErrors = BlueErrors = {}));
144
- var VaultV2Errors;
145
- (function (VaultV2Errors) {
146
- class InvalidInterestAccrual extends Error {
147
- vault;
148
- timestamp;
149
- lastUpdate;
150
- constructor(vault, timestamp, lastUpdate) {
151
- super(`invalid interest accrual on vault ${vault}: accrual timestamp ${timestamp} can't be prior to last update ${lastUpdate}`);
152
- this.vault = vault;
153
- this.timestamp = timestamp;
154
- this.lastUpdate = lastUpdate;
155
- }
156
- }
157
- VaultV2Errors.InvalidInterestAccrual = InvalidInterestAccrual;
158
- class UnsupportedLiquidityAdapter extends Error {
159
- address;
160
- constructor(address) {
161
- super(`unsupported liquidity adapter "${address}"`);
162
- this.address = address;
163
- }
164
- }
165
- VaultV2Errors.UnsupportedLiquidityAdapter = UnsupportedLiquidityAdapter;
166
- })(VaultV2Errors || (exports.VaultV2Errors = VaultV2Errors = {}));
167
136
  function _try(accessor, ...errorClasses) {
168
137
  const maybeCatchError = (error) => {
169
138
  if (errorClasses.length === 0 ||
package/lib/index.d.ts CHANGED
@@ -11,4 +11,3 @@ export * from "./holding/index.js";
11
11
  export * from "./position/index.js";
12
12
  export * from "./vault/index.js";
13
13
  export * from "./preLiquidation.js";
14
- export * from "./utils.js";
package/lib/index.js CHANGED
@@ -27,4 +27,3 @@ __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);
@@ -1,7 +1,17 @@
1
1
  import { type RoundingDirection } from "../math/index.js";
2
2
  import type { BigIntish } from "../types.js";
3
- import { type CapacityLimit } from "../utils.js";
4
3
  import { type IMarketParams, MarketParams } from "./MarketParams.js";
4
+ export declare enum CapacityLimitReason {
5
+ liquidity = "Liquidity",
6
+ balance = "Balance",
7
+ position = "Position",
8
+ collateral = "Collateral",
9
+ cap = "Cap"
10
+ }
11
+ export interface CapacityLimit {
12
+ value: bigint;
13
+ limiter: CapacityLimitReason;
14
+ }
5
15
  export interface MaxBorrowOptions {
6
16
  maxLtv?: bigint;
7
17
  }
@@ -88,19 +98,9 @@ export declare class Market implements IMarket {
88
98
  */
89
99
  get utilization(): bigint;
90
100
  /**
91
- * The market's Annual Percentage Yield (APY) at the IRM's target utilization rate, if applicable (scaled by WAD).
92
- */
93
- get apyAtTarget(): bigint | undefined;
94
- /**
95
- * Returns the rate at which interest accrued for suppliers of this market,
96
- * since the last time the market was updated (scaled by WAD).
97
- * @deprecated There's no such thing as a supply rate in Morpho. Only the supply APY is meaningful.
98
- */
99
- get supplyRate(): bigint;
100
- /**
101
- * @deprecated Use `avgBorrowRate` instead.
101
+ * The market's Annual Percentage Yield (APY) at the IRM's target utilization rate, if applicable.
102
102
  */
103
- get borrowRate(): bigint;
103
+ get apyAtTarget(): number | undefined;
104
104
  /**
105
105
  * Returns the instantaneous rate at which interest accrues for borrowers of this market,
106
106
  * if `accrueInterest` was called immediately onchain (scaled by WAD).
@@ -127,19 +127,15 @@ export declare class Market implements IMarket {
127
127
  */
128
128
  get avgBorrowRate(): bigint;
129
129
  /**
130
- * The market's current, instantaneous supply-side Annual Percentage Yield (APY) (scaled by WAD).
130
+ * The market's current, instantaneous supply-side Annual Percentage Yield (APY).
131
131
  * If interested in the APY at a specific timestamp, use `getSupplyApy(timestamp)` instead.
132
132
  */
133
- get supplyApy(): bigint;
133
+ get supplyApy(): number;
134
134
  /**
135
- * The market's current, instantaneous borrow-side Annual Percentage Yield (APY) (scaled by WAD).
135
+ * The market's current, instantaneous borrow-side Annual Percentage Yield (APY).
136
136
  * If interested in the APY at a specific timestamp, use `getBorrowApy(timestamp)` instead.
137
137
  */
138
- get borrowApy(): bigint;
139
- /**
140
- * @deprecated Use `getEndBorrowRate(timestamp)` instead.
141
- */
142
- getBorrowRate(timestamp?: BigIntish): bigint;
138
+ get borrowApy(): number;
143
139
  /**
144
140
  * Returns the instantaneous rate at which interest accrues for borrowers of this market,
145
141
  * at the given timestamp, if the state remains unchanged (not accrued) (scaled by WAD).
@@ -173,36 +169,44 @@ export declare class Market implements IMarket {
173
169
  };
174
170
  /**
175
171
  * The market's instantaneous borrow-side Annual Percentage Yield (APY) at the given timestamp,
176
- * if the state remains unchanged (not accrued) (scaled by WAD).
172
+ * if the state remains unchanged (not accrued).
177
173
  * @param timestamp The timestamp at which to calculate the borrow APY.
178
174
  * Must be greater than or equal to `lastUpdate`.
179
175
  * Defaults to `Time.timestamp()` (returns the current borrow APY).
180
176
  */
181
- getBorrowApy(timestamp?: BigIntish): bigint;
177
+ getBorrowApy(timestamp?: BigIntish): number;
182
178
  /**
183
179
  * The market's instantaneous supply-side Annual Percentage Yield (APY) at the given timestamp,
184
- * if the state remains unchanged (not accrued) (scaled by WAD).
180
+ * if the state remains unchanged (not accrued).
185
181
  * @param timestamp The timestamp at which to calculate the supply APY.
186
182
  * Must be greater than or equal to `lastUpdate`.
187
183
  * Defaults to `Time.timestamp()` (returns the current supply APY).
188
184
  */
189
- getSupplyApy(timestamp?: BigIntish): bigint;
185
+ getSupplyApy(timestamp?: BigIntish): number;
190
186
  /**
191
187
  * The market's experienced borrow-side Annual Percentage Yield (APY),
192
- * if interest was to be accrued at the given timestamp (scaled by WAD).
188
+ * if interest was to be accrued at the given timestamp.
193
189
  * @param timestamp The timestamp at which to calculate the borrow APY.
194
190
  * Must be greater than or equal to `lastUpdate`.
195
191
  * Defaults to `Time.timestamp()` (returns the current borrow APY).
196
192
  */
197
- getAvgBorrowApy(timestamp?: BigIntish): bigint;
193
+ getAvgBorrowApy(timestamp?: BigIntish): number;
194
+ /**
195
+ * Returns the average rate at which interest _would_ accrue for suppliers of this market,
196
+ * if `accrueInterest` was called at the given timestamp (scaled by WAD).
197
+ * @param timestamp The timestamp at which to calculate the average supply rate.
198
+ * Must be greater than or equal to `lastUpdate`.
199
+ * Defaults to `Time.timestamp()` (returns the current average supply rate).
200
+ */
201
+ getAvgSupplyRate(timestamp?: BigIntish): bigint;
198
202
  /**
199
203
  * The market's experienced supply-side Annual Percentage Yield (APY),
200
- * if interest was to be accrued at the given timestamp (scaled by WAD).
204
+ * if interest was to be accrued at the given timestamp.
201
205
  * @param timestamp The timestamp at which to calculate the supply APY.
202
206
  * Must be greater than or equal to `lastUpdate`.
203
207
  * Defaults to `Time.timestamp()` (returns the current supply APY).
204
208
  */
205
- getAvgSupplyApy(timestamp?: BigIntish): bigint;
209
+ getAvgSupplyApy(timestamp?: BigIntish): number;
206
210
  /**
207
211
  * Returns a new market derived from this market, whose interest has been accrued up to the given timestamp.
208
212
  * @param timestamp The timestamp at which to accrue interest.