@morpho-org/blue-sdk 4.14.0-next.1 → 5.0.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.
@@ -9,30 +9,6 @@ export declare const NATIVE_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEe
9
9
  export interface ChainAddresses {
10
10
  morpho: Address;
11
11
  permit2?: Address;
12
- /**
13
- * @deprecated All bundles should use Bundler3 instead.
14
- */
15
- bundler?: Address;
16
- /**
17
- * @deprecated All bundles should use Bundler3 instead.
18
- */
19
- aaveV3OptimizerBundler?: Address;
20
- /**
21
- * @deprecated All bundles should use Bundler3 instead.
22
- */
23
- aaveV2Bundler?: Address;
24
- /**
25
- * @deprecated All bundles should use Bundler3 instead.
26
- */
27
- aaveV3Bundler?: Address;
28
- /**
29
- * @deprecated All bundles should use Bundler3 instead.
30
- */
31
- compoundV3Bundler?: Address;
32
- /**
33
- * @deprecated All bundles should use Bundler3 instead.
34
- */
35
- compoundV2Bundler?: Address;
36
12
  bundler3: {
37
13
  bundler3: Address;
38
14
  generalAdapter1: Address;
@@ -49,6 +25,8 @@ export interface ChainAddresses {
49
25
  adaptiveCurveIrm: Address;
50
26
  publicAllocator?: Address;
51
27
  metaMorphoFactory?: Address;
28
+ vaultV2Factory?: Address;
29
+ morphoVaultV1AdapterFactory?: Address;
52
30
  registryList?: Address;
53
31
  chainlinkOracleFactory?: Address;
54
32
  preLiquidationFactory?: Address;
@@ -64,17 +42,11 @@ export interface ChainAddresses {
64
42
  usdc?: Address;
65
43
  stEth?: Address;
66
44
  wstEth?: Address;
67
- vaultV2Factory?: Address;
68
- morphoVaultV1AdapterFactory?: Address;
69
45
  }
70
46
  declare const _addressesRegistry: {
71
47
  readonly 1: {
72
48
  readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
73
49
  readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
74
- /**
75
- * @deprecated All bundles should use Bundler3 instead.
76
- */
77
- readonly bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077";
78
50
  readonly bundler3: {
79
51
  readonly bundler3: "0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245";
80
52
  readonly generalAdapter1: "0x4A6c312ec70E8747a587EE860a0353cd42Be0aE0";
@@ -88,29 +60,11 @@ declare const _addressesRegistry: {
88
60
  readonly aaveV3EtherFiMigrationAdapter: "0x4011dc6581fA05F9B0c7A12AdCd676e2b1a59ca3";
89
61
  readonly aaveV3OptimizerMigrationAdapter: "0x9e2ea2d5785598a163D569D795f286F5C55ad972";
90
62
  };
91
- /**
92
- * @deprecated All bundles should use Bundler3 instead.
93
- */
94
- readonly aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c";
95
- /**
96
- * @deprecated All bundles should use Bundler3 instead.
97
- */
98
- readonly aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76";
99
- /**
100
- * @deprecated All bundles should use Bundler3 instead.
101
- */
102
- readonly aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC";
103
- /**
104
- * @deprecated All bundles should use Bundler3 instead.
105
- */
106
- readonly compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558";
107
- /**
108
- * @deprecated All bundles should use Bundler3 instead.
109
- */
110
- readonly compoundV2Bundler: "0x26bF52a84360Ad3d01d7CDc28FC2dDC04d8c8647";
111
63
  readonly adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
112
64
  readonly publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
113
65
  readonly metaMorphoFactory: "0x1897A8997241C1cD4bD0698647e4EB7213535c24";
66
+ readonly vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405";
67
+ readonly morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394";
114
68
  readonly registryList: "0x3696c5eAe4a7Ffd04Ea163564571E9CD8Ed9364e";
115
69
  readonly chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766";
116
70
  readonly preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476";
@@ -141,16 +95,10 @@ declare const _addressesRegistry: {
141
95
  readonly crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14";
142
96
  readonly "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e";
143
97
  readonly "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726";
144
- readonly vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405";
145
- readonly morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394";
146
98
  };
147
99
  readonly 8453: {
148
100
  readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
149
101
  readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
150
- /**
151
- * @deprecated All bundles should use Bundler3 instead.
152
- */
153
- readonly bundler: "0x23055618898e202386e6c13955a58D3C68200BFB";
154
102
  readonly bundler3: {
155
103
  readonly bundler3: "0x6BFd8137e702540E7A42B74178A4a49Ba43920C4";
156
104
  readonly generalAdapter1: "0xb98c948CFA24072e58935BC004a8A7b376AE746A";
@@ -159,21 +107,11 @@ declare const _addressesRegistry: {
159
107
  readonly compoundV3MigrationAdapter: "0x85D4812Ef92c040d4270eD8547b6835e41FbbB70";
160
108
  readonly aaveV3CoreMigrationAdapter: "0xb27Aa2a964eAd5ed661D86974b37e4fB995b36f5";
161
109
  };
162
- /**
163
- * @deprecated All bundles should use Bundler3 instead.
164
- */
165
- readonly compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223";
166
- /**
167
- * @deprecated All bundles should use Bundler3 instead.
168
- */
169
- readonly aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108";
170
- /**
171
- * @deprecated All bundles should use Bundler3 instead.
172
- */
173
- readonly compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA";
174
110
  readonly adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
175
111
  readonly publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
176
112
  readonly metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918";
113
+ readonly vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857";
114
+ readonly morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642";
177
115
  readonly registryList: "0x5C2531Cbd2cf112Cf687da3Cd536708aDd7DB10a";
178
116
  readonly chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d";
179
117
  readonly preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef";
@@ -181,8 +119,6 @@ declare const _addressesRegistry: {
181
119
  readonly usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
182
120
  readonly verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b";
183
121
  readonly testUsdc: "0xBC77067f829979812d795d516E523C4033b66409";
184
- readonly vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857";
185
- readonly morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642";
186
122
  };
187
123
  readonly 137: {
188
124
  readonly morpho: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67";
@@ -494,11 +430,11 @@ declare const _deployments: {
494
430
  readonly adaptiveCurveIrm: 18883124n;
495
431
  readonly publicAllocator: 19375099n;
496
432
  readonly metaMorphoFactory: 21439510n;
433
+ readonly vaultV2Factory: 23375073n;
434
+ readonly morphoVaultV1AdapterFactory: 23375073n;
497
435
  readonly registryList: 23375119n;
498
436
  readonly chainlinkOracleFactory: 19375066n;
499
437
  readonly preLiquidationFactory: 21414664n;
500
- readonly vaultV2Factory: 23375073n;
501
- readonly morphoVaultV1AdapterFactory: 23375073n;
502
438
  };
503
439
  readonly 8453: {
504
440
  readonly morpho: 13977148n;
@@ -514,11 +450,11 @@ declare const _deployments: {
514
450
  readonly adaptiveCurveIrm: 13977152n;
515
451
  readonly publicAllocator: 13979545n;
516
452
  readonly metaMorphoFactory: 23928808n;
453
+ readonly vaultV2Factory: 35615206n;
454
+ readonly morphoVaultV1AdapterFactory: 35615206n;
517
455
  readonly registryList: 35615358n;
518
456
  readonly chainlinkOracleFactory: 13978286n;
519
457
  readonly preLiquidationFactory: 23779056n;
520
- readonly vaultV2Factory: 35615206n;
521
- readonly morphoVaultV1AdapterFactory: 35615206n;
522
458
  };
523
459
  readonly 137: {
524
460
  readonly morpho: 66931042n;
@@ -809,10 +745,6 @@ export declare let addressesRegistry: {
809
745
  readonly 1: {
810
746
  readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
811
747
  readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
812
- /**
813
- * @deprecated All bundles should use Bundler3 instead.
814
- */
815
- readonly bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077";
816
748
  readonly bundler3: {
817
749
  readonly bundler3: "0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245";
818
750
  readonly generalAdapter1: "0x4A6c312ec70E8747a587EE860a0353cd42Be0aE0";
@@ -826,29 +758,11 @@ export declare let addressesRegistry: {
826
758
  readonly aaveV3EtherFiMigrationAdapter: "0x4011dc6581fA05F9B0c7A12AdCd676e2b1a59ca3";
827
759
  readonly aaveV3OptimizerMigrationAdapter: "0x9e2ea2d5785598a163D569D795f286F5C55ad972";
828
760
  };
829
- /**
830
- * @deprecated All bundles should use Bundler3 instead.
831
- */
832
- readonly aaveV3OptimizerBundler: "0x16F38d2E764E7BeBF625a8E995b34968226D2F9c";
833
- /**
834
- * @deprecated All bundles should use Bundler3 instead.
835
- */
836
- readonly aaveV2Bundler: "0xb3dCc75DB379925edFd3007511A8CE0cB4aa8e76";
837
- /**
838
- * @deprecated All bundles should use Bundler3 instead.
839
- */
840
- readonly aaveV3Bundler: "0x98ccB155E86bb478d514a827d16f58c6912f9BDC";
841
- /**
842
- * @deprecated All bundles should use Bundler3 instead.
843
- */
844
- readonly compoundV3Bundler: "0x3a0e2E9FB9c95fBc843daF166276C90B6C479558";
845
- /**
846
- * @deprecated All bundles should use Bundler3 instead.
847
- */
848
- readonly compoundV2Bundler: "0x26bF52a84360Ad3d01d7CDc28FC2dDC04d8c8647";
849
761
  readonly adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
850
762
  readonly publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
851
763
  readonly metaMorphoFactory: "0x1897A8997241C1cD4bD0698647e4EB7213535c24";
764
+ readonly vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405";
765
+ readonly morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394";
852
766
  readonly registryList: "0x3696c5eAe4a7Ffd04Ea163564571E9CD8Ed9364e";
853
767
  readonly chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766";
854
768
  readonly preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476";
@@ -879,16 +793,10 @@ export declare let addressesRegistry: {
879
793
  readonly crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14";
880
794
  readonly "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e";
881
795
  readonly "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726";
882
- readonly vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405";
883
- readonly morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394";
884
796
  };
885
797
  readonly 8453: {
886
798
  readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
887
799
  readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
888
- /**
889
- * @deprecated All bundles should use Bundler3 instead.
890
- */
891
- readonly bundler: "0x23055618898e202386e6c13955a58D3C68200BFB";
892
800
  readonly bundler3: {
893
801
  readonly bundler3: "0x6BFd8137e702540E7A42B74178A4a49Ba43920C4";
894
802
  readonly generalAdapter1: "0xb98c948CFA24072e58935BC004a8A7b376AE746A";
@@ -897,21 +805,11 @@ export declare let addressesRegistry: {
897
805
  readonly compoundV3MigrationAdapter: "0x85D4812Ef92c040d4270eD8547b6835e41FbbB70";
898
806
  readonly aaveV3CoreMigrationAdapter: "0xb27Aa2a964eAd5ed661D86974b37e4fB995b36f5";
899
807
  };
900
- /**
901
- * @deprecated All bundles should use Bundler3 instead.
902
- */
903
- readonly compoundV2Bundler: "0x123f3167a416cA19365dE03a65e0AF3532af7223";
904
- /**
905
- * @deprecated All bundles should use Bundler3 instead.
906
- */
907
- readonly aaveV3Bundler: "0xcAe2929baBc60Be34818EaA5F40bF69265677108";
908
- /**
909
- * @deprecated All bundles should use Bundler3 instead.
910
- */
911
- readonly compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA";
912
808
  readonly adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
913
809
  readonly publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
914
810
  readonly metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918";
811
+ readonly vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857";
812
+ readonly morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642";
915
813
  readonly registryList: "0x5C2531Cbd2cf112Cf687da3Cd536708aDd7DB10a";
916
814
  readonly chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d";
917
815
  readonly preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef";
@@ -919,8 +817,6 @@ export declare let addressesRegistry: {
919
817
  readonly usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
920
818
  readonly verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b";
921
819
  readonly testUsdc: "0xBC77067f829979812d795d516E523C4033b66409";
922
- readonly vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857";
923
- readonly morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642";
924
820
  };
925
821
  readonly 137: {
926
822
  readonly morpho: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67";
@@ -1230,11 +1126,11 @@ export declare let deployments: {
1230
1126
  readonly adaptiveCurveIrm: 18883124n;
1231
1127
  readonly publicAllocator: 19375099n;
1232
1128
  readonly metaMorphoFactory: 21439510n;
1129
+ readonly vaultV2Factory: 23375073n;
1130
+ readonly morphoVaultV1AdapterFactory: 23375073n;
1233
1131
  readonly registryList: 23375119n;
1234
1132
  readonly chainlinkOracleFactory: 19375066n;
1235
1133
  readonly preLiquidationFactory: 21414664n;
1236
- readonly vaultV2Factory: 23375073n;
1237
- readonly morphoVaultV1AdapterFactory: 23375073n;
1238
1134
  };
1239
1135
  readonly 8453: {
1240
1136
  readonly morpho: 13977148n;
@@ -1250,11 +1146,11 @@ export declare let deployments: {
1250
1146
  readonly adaptiveCurveIrm: 13977152n;
1251
1147
  readonly publicAllocator: 13979545n;
1252
1148
  readonly metaMorphoFactory: 23928808n;
1149
+ readonly vaultV2Factory: 35615206n;
1150
+ readonly morphoVaultV1AdapterFactory: 35615206n;
1253
1151
  readonly registryList: 35615358n;
1254
1152
  readonly chainlinkOracleFactory: 13978286n;
1255
1153
  readonly preLiquidationFactory: 23779056n;
1256
- readonly vaultV2Factory: 35615206n;
1257
- readonly morphoVaultV1AdapterFactory: 35615206n;
1258
1154
  };
1259
1155
  readonly 137: {
1260
1156
  readonly morpho: 66931042n;
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,11 @@ 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
+ morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394",
63
41
  registryList: "0x3696c5eAe4a7Ffd04Ea163564571E9CD8Ed9364e",
64
42
  chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766",
65
43
  preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476",
@@ -96,16 +74,10 @@ const _addressesRegistry = {
96
74
  crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14",
97
75
  "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e",
98
76
  "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726",
99
- vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405",
100
- morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394",
101
77
  },
102
78
  [chain_js_1.ChainId.BaseMainnet]: {
103
79
  morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
104
80
  permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
105
- /**
106
- * @deprecated All bundles should use Bundler3 instead.
107
- */
108
- bundler: "0x23055618898e202386e6c13955a58D3C68200BFB",
109
81
  bundler3: {
110
82
  bundler3: "0x6BFd8137e702540E7A42B74178A4a49Ba43920C4",
111
83
  generalAdapter1: "0xb98c948CFA24072e58935BC004a8A7b376AE746A",
@@ -114,21 +86,11 @@ const _addressesRegistry = {
114
86
  compoundV3MigrationAdapter: "0x85D4812Ef92c040d4270eD8547b6835e41FbbB70",
115
87
  aaveV3CoreMigrationAdapter: "0xb27Aa2a964eAd5ed661D86974b37e4fB995b36f5",
116
88
  },
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
89
  adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
130
90
  publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
131
91
  metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918",
92
+ vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857",
93
+ morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642",
132
94
  registryList: "0x5C2531Cbd2cf112Cf687da3Cd536708aDd7DB10a",
133
95
  chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d",
134
96
  preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef",
@@ -137,8 +99,6 @@ const _addressesRegistry = {
137
99
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
138
100
  verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b",
139
101
  testUsdc: "0xBC77067f829979812d795d516E523C4033b66409",
140
- vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857",
141
- morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642",
142
102
  },
143
103
  [chain_js_1.ChainId.PolygonMainnet]: {
144
104
  morpho: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67",
@@ -456,11 +416,11 @@ const _deployments = {
456
416
  adaptiveCurveIrm: 18883124n,
457
417
  publicAllocator: 19375099n,
458
418
  metaMorphoFactory: 21439510n,
419
+ vaultV2Factory: 23375073n,
420
+ morphoVaultV1AdapterFactory: 23375073n,
459
421
  registryList: 23375119n,
460
422
  chainlinkOracleFactory: 19375066n,
461
423
  preLiquidationFactory: 21414664n,
462
- vaultV2Factory: 23375073n,
463
- morphoVaultV1AdapterFactory: 23375073n,
464
424
  },
465
425
  [chain_js_1.ChainId.BaseMainnet]: {
466
426
  morpho: 13977148n,
@@ -476,11 +436,11 @@ const _deployments = {
476
436
  adaptiveCurveIrm: 13977152n,
477
437
  publicAllocator: 13979545n,
478
438
  metaMorphoFactory: 23928808n,
439
+ vaultV2Factory: 35615206n,
440
+ morphoVaultV1AdapterFactory: 35615206n,
479
441
  registryList: 35615358n,
480
442
  chainlinkOracleFactory: 13978286n,
481
443
  preLiquidationFactory: 23779056n,
482
- vaultV2Factory: 35615206n,
483
- morphoVaultV1AdapterFactory: 35615206n,
484
444
  },
485
445
  [chain_js_1.ChainId.PolygonMainnet]: {
486
446
  morpho: 66931042n,
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;
package/lib/errors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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 {
package/lib/index.d.ts CHANGED
@@ -11,5 +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 "./vault-v2/index.js";
15
- export * from "./utils.js";
package/lib/index.js CHANGED
@@ -27,5 +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("./vault-v2/index.js"), exports);
31
- __exportStar(require("./utils.js"), exports);
@@ -98,19 +98,9 @@ export declare class Market implements IMarket {
98
98
  */
99
99
  get utilization(): bigint;
100
100
  /**
101
- * The market's Annual Percentage Yield (APY) at the IRM's target utilization rate, if applicable (scaled by WAD).
101
+ * The market's Annual Percentage Yield (APY) at the IRM's target utilization rate, if applicable.
102
102
  */
103
- get apyAtTarget(): bigint | undefined;
104
- /**
105
- * Returns the rate at which interest accrued for suppliers of this market,
106
- * since the last time the market was updated (scaled by WAD).
107
- * @deprecated There's no such thing as a supply rate in Morpho. Only the supply APY is meaningful.
108
- */
109
- get supplyRate(): bigint;
110
- /**
111
- * @deprecated Use `avgBorrowRate` instead.
112
- */
113
- get borrowRate(): bigint;
103
+ get apyAtTarget(): number | undefined;
114
104
  /**
115
105
  * Returns the instantaneous rate at which interest accrues for borrowers of this market,
116
106
  * if `accrueInterest` was called immediately onchain (scaled by WAD).
@@ -145,11 +135,7 @@ export declare class Market implements IMarket {
145
135
  * The market's current, instantaneous borrow-side Annual Percentage Yield (APY) (scaled by WAD).
146
136
  * If interested in the APY at a specific timestamp, use `getBorrowApy(timestamp)` instead.
147
137
  */
148
- get borrowApy(): bigint;
149
- /**
150
- * @deprecated Use `getEndBorrowRate(timestamp)` instead.
151
- */
152
- getBorrowRate(timestamp?: BigIntish): bigint;
138
+ get borrowApy(): number;
153
139
  /**
154
140
  * Returns the instantaneous rate at which interest accrues for borrowers of this market,
155
141
  * at the given timestamp, if the state remains unchanged (not accrued) (scaled by WAD).
@@ -183,12 +169,12 @@ export declare class Market implements IMarket {
183
169
  };
184
170
  /**
185
171
  * The market's instantaneous borrow-side Annual Percentage Yield (APY) at the given timestamp,
186
- * if the state remains unchanged (not accrued) (scaled by WAD).
172
+ * if the state remains unchanged (not accrued).
187
173
  * @param timestamp The timestamp at which to calculate the borrow APY.
188
174
  * Must be greater than or equal to `lastUpdate`.
189
175
  * Defaults to `Time.timestamp()` (returns the current borrow APY).
190
176
  */
191
- getBorrowApy(timestamp?: BigIntish): bigint;
177
+ getBorrowApy(timestamp?: BigIntish): number;
192
178
  /**
193
179
  * The market's instantaneous supply-side Annual Percentage Yield (APY) at the given timestamp,
194
180
  * if the state remains unchanged (not accrued) (scaled by WAD).
@@ -199,12 +185,12 @@ export declare class Market implements IMarket {
199
185
  getSupplyApy(timestamp?: BigIntish): bigint;
200
186
  /**
201
187
  * The market's experienced borrow-side Annual Percentage Yield (APY),
202
- * if interest was to be accrued at the given timestamp (scaled by WAD).
188
+ * if interest was to be accrued at the given timestamp.
203
189
  * @param timestamp The timestamp at which to calculate the borrow APY.
204
190
  * Must be greater than or equal to `lastUpdate`.
205
191
  * Defaults to `Time.timestamp()` (returns the current borrow APY).
206
192
  */
207
- getAvgBorrowApy(timestamp?: BigIntish): bigint;
193
+ getAvgBorrowApy(timestamp?: BigIntish): number;
208
194
  /**
209
195
  * The market's experienced supply-side Annual Percentage Yield (APY),
210
196
  * if interest was to be accrued at the given timestamp (scaled by WAD).
@@ -94,27 +94,13 @@ class Market {
94
94
  return MarketUtils_js_1.MarketUtils.getUtilization(this);
95
95
  }
96
96
  /**
97
- * The market's Annual Percentage Yield (APY) at the IRM's target utilization rate, if applicable (scaled by WAD).
97
+ * The market's Annual Percentage Yield (APY) at the IRM's target utilization rate, if applicable.
98
98
  */
99
99
  get apyAtTarget() {
100
100
  if (this.rateAtTarget == null)
101
101
  return;
102
102
  return MarketUtils_js_1.MarketUtils.rateToApy(this.rateAtTarget);
103
103
  }
104
- /**
105
- * Returns the rate at which interest accrued for suppliers of this market,
106
- * since the last time the market was updated (scaled by WAD).
107
- * @deprecated There's no such thing as a supply rate in Morpho. Only the supply APY is meaningful.
108
- */
109
- get supplyRate() {
110
- return MarketUtils_js_1.MarketUtils.getSupplyRate(this.avgBorrowRate, this);
111
- }
112
- /**
113
- * @deprecated Use `avgBorrowRate` instead.
114
- */
115
- get borrowRate() {
116
- return this.getAccrualBorrowRates().avgBorrowRate;
117
- }
118
104
  /**
119
105
  * Returns the instantaneous rate at which interest accrues for borrowers of this market,
120
106
  * if `accrueInterest` was called immediately onchain (scaled by WAD).
@@ -158,12 +144,6 @@ class Market {
158
144
  get borrowApy() {
159
145
  return this.getBorrowApy();
160
146
  }
161
- /**
162
- * @deprecated Use `getEndBorrowRate(timestamp)` instead.
163
- */
164
- getBorrowRate(timestamp = morpho_ts_1.Time.timestamp()) {
165
- return this.getAccrualBorrowRates(timestamp).endBorrowRate;
166
- }
167
147
  /**
168
148
  * Returns the instantaneous rate at which interest accrues for borrowers of this market,
169
149
  * at the given timestamp, if the state remains unchanged (not accrued) (scaled by WAD).
@@ -211,7 +191,7 @@ class Market {
211
191
  }
212
192
  /**
213
193
  * The market's instantaneous borrow-side Annual Percentage Yield (APY) at the given timestamp,
214
- * if the state remains unchanged (not accrued) (scaled by WAD).
194
+ * if the state remains unchanged (not accrued).
215
195
  * @param timestamp The timestamp at which to calculate the borrow APY.
216
196
  * Must be greater than or equal to `lastUpdate`.
217
197
  * Defaults to `Time.timestamp()` (returns the current borrow APY).
@@ -233,7 +213,7 @@ class Market {
233
213
  }
234
214
  /**
235
215
  * The market's experienced borrow-side Annual Percentage Yield (APY),
236
- * if interest was to be accrued at the given timestamp (scaled by WAD).
216
+ * if interest was to be accrued at the given timestamp.
237
217
  * @param timestamp The timestamp at which to calculate the borrow APY.
238
218
  * Must be greater than or equal to `lastUpdate`.
239
219
  * Defaults to `Time.timestamp()` (returns the current borrow APY).
@@ -26,29 +26,11 @@ export declare namespace MarketUtils {
26
26
  totalBorrowAssets: BigIntish;
27
27
  }): bigint;
28
28
  /**
29
- * Returns the rate at which interest accrued for suppliers on the corresponding market,
30
- * since the last time the market was updated (scaled by WAD).
31
- * @param borrowRate The average borrow rate since the last market update (scaled by WAD).
32
- * @param market The market state.
33
- * @deprecated There's no such thing as a supply rate in Morpho. Only the supply APY is meaningful.
34
- */
35
- function getSupplyRate(borrowRate: BigIntish, { utilization, fee }: {
36
- utilization: BigIntish;
37
- fee: BigIntish;
38
- }): bigint;
39
- /**
40
- * Returns the per-second rate continuously compounded over the given period, as calculated in Morpho Blue (scaled by WAD).
41
- * @param rate The per-second rate to compound (scaled by WAD).
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
- */
45
- function compoundRate(rate: BigIntish, period?: BigIntish): bigint;
46
- /**
47
- * Returns the per-second rate continuously compounded over a year (scaled by WAD),
29
+ * Returns the per-second rate continuously compounded over a year,
48
30
  * 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).
31
+ * @param rate The per-second rate to compound annually.
50
32
  */
51
- function rateToApy(rate: BigIntish): bigint;
33
+ function rateToApy(rate: BigIntish): number;
52
34
  /**
53
35
  * Returns the interest accrued on both sides of the given market
54
36
  * as well as the supply shares minted to the fee recipient.
@@ -6,7 +6,6 @@ const utils_1 = require("@noble/hashes/utils");
6
6
  const viem_1 = require("viem");
7
7
  const constants_js_1 = require("../constants.js");
8
8
  const index_js_1 = require("../math/index.js");
9
- const utils_js_1 = require("../utils.js");
10
9
  /**
11
10
  * Namespace of utility functions to ease market-related calculations.
12
11
  */
@@ -52,35 +51,12 @@ var MarketUtils;
52
51
  }
53
52
  MarketUtils.getUtilization = getUtilization;
54
53
  /**
55
- * Returns the rate at which interest accrued for suppliers on the corresponding market,
56
- * since the last time the market was updated (scaled by WAD).
57
- * @param borrowRate The average borrow rate since the last market update (scaled by WAD).
58
- * @param market The market state.
59
- * @deprecated There's no such thing as a supply rate in Morpho. Only the supply APY is meaningful.
60
- */
61
- function getSupplyRate(borrowRate, { utilization, fee }) {
62
- const borrowRateWithoutFees = index_js_1.MathLib.wMulUp(borrowRate, utilization);
63
- return index_js_1.MathLib.wMulUp(borrowRateWithoutFees, index_js_1.MathLib.WAD - BigInt(fee));
64
- }
65
- MarketUtils.getSupplyRate = getSupplyRate;
66
- /**
67
- * Returns the per-second rate continuously compounded over the given period, as calculated in Morpho Blue (scaled by WAD).
68
- * @param rate The per-second rate to compound (scaled by WAD).
69
- * @param period The period to compound the rate over (in seconds). Defaults to 1 year.
70
- * @deprecated The compounded rate is inaccurate if rate * period >> 0. If interested in the APY, use `rateToApy` instead.
71
- */
72
- function compoundRate(rate, period = constants_js_1.SECONDS_PER_YEAR) {
73
- return index_js_1.MathLib.wTaylorCompounded(rate, period);
74
- }
75
- MarketUtils.compoundRate = compoundRate;
76
- /**
77
- * Returns the per-second rate continuously compounded over a year (scaled by WAD),
54
+ * Returns the per-second rate continuously compounded over a year,
78
55
  * as calculated in Morpho Blue assuming the market is frequently accrued onchain.
79
- * @param rate The per-second rate to compound annually (scaled by WAD).
56
+ * @param rate The per-second rate to compound annually.
80
57
  */
81
- // TODO: return a Number for APYs.
82
58
  function rateToApy(rate) {
83
- return (0, utils_js_1.safeParseNumber)(Math.expm1(+(0, viem_1.formatEther)(BigInt(rate) * constants_js_1.SECONDS_PER_YEAR)));
59
+ return Math.expm1(+(0, viem_1.formatEther)(BigInt(rate) * constants_js_1.SECONDS_PER_YEAR));
84
60
  }
85
61
  MarketUtils.rateToApy = rateToApy;
86
62
  /**
package/lib/types.d.ts CHANGED
@@ -23,5 +23,4 @@ export declare enum TransactionType {
23
23
  export type Loadable<T> = T | undefined;
24
24
  export type Failable<T> = T | null;
25
25
  export type Fetchable<T> = Failable<Loadable<T>>;
26
- export declare function isFetched<T>(v: Fetchable<T>): v is T;
27
26
  export declare const isMarketId: (value: unknown) => value is MarketId;
package/lib/types.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isMarketId = exports.TransactionType = void 0;
4
- exports.isFetched = isFetched;
5
4
  /**
6
5
  * The possible transaction type on the Blue contract
7
6
  */
@@ -14,9 +13,5 @@ var TransactionType;
14
13
  TransactionType["Borrow"] = "Borrow";
15
14
  TransactionType["Repay"] = "Repay";
16
15
  })(TransactionType || (exports.TransactionType = TransactionType = {}));
17
- // TODO: replace with isDefined
18
- function isFetched(v) {
19
- return v !== undefined && v !== null;
20
- }
21
16
  const isMarketId = (value) => typeof value === "string" && /^0x[0-9A-Fa-f]{64}$/.test(value);
22
17
  exports.isMarketId = isMarketId;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@morpho-org/blue-sdk",
3
3
  "description": "Framework-agnostic package that defines Morpho-related entity classes (such as `Market`, `Token`, `Vault`).",
4
- "version": "4.14.0-next.1",
4
+ "version": "5.0.0",
5
5
  "author": "Morpho Association <contact@morpho.org>",
6
6
  "contributors": [
7
7
  "Rubilmax <rmilon@gmail.com>"
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "typescript": "^5.7.2",
32
- "viem": "^2.33.3",
32
+ "viem": "^2.23.0",
33
33
  "vitest": "^3.0.5",
34
34
  "@morpho-org/morpho-ts": "^2.4.3",
35
35
  "@morpho-org/test": "^2.6.0"
package/lib/utils.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare const safeParseNumber: (value: number, decimals?: number) => bigint;
2
- export declare const safeParseUnits: (strValue: string, decimals?: number) => bigint;
package/lib/utils.js DELETED
@@ -1,67 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.safeParseUnits = exports.safeParseNumber = void 0;
4
- // Alternative to Number.toFixed that doesn't use scientific notation for excessively small or large numbers.
5
- const toFixed = (x, decimals) => new Intl.NumberFormat("en-US", {
6
- style: "decimal",
7
- useGrouping: false,
8
- maximumFractionDigits: decimals,
9
- minimumFractionDigits: decimals,
10
- }).format(x);
11
- const safeParseNumber = (value, decimals = 18) => (0, exports.safeParseUnits)(toFixed(value, decimals), decimals);
12
- exports.safeParseNumber = safeParseNumber;
13
- const safeParseUnits = (strValue, decimals = 18) => {
14
- if (!/[-+]?[0-9]*\.?[0-9]+/.test(strValue))
15
- throw Error(`invalid number: ${strValue}`);
16
- let [whole, dec = ""] = strValue.split(".");
17
- dec = dec.slice(0, decimals);
18
- return parseUnits([whole || "0", dec].filter((v) => v.length > 0).join("."), decimals);
19
- };
20
- exports.safeParseUnits = safeParseUnits;
21
- /**
22
- * Multiplies a string representation of a number by a given exponent of base 10 (10exponent).
23
- *
24
- * - Docs: https://viem.sh/docs/utilities/parseUnits
25
- *
26
- * @example
27
- * import { parseUnits } from 'viem'
28
- *
29
- * parseUnits('420', 9)
30
- * // 420000000000n
31
- */
32
- // TODO: get rid of this copy.
33
- function parseUnits(value, decimals) {
34
- let [integer, fraction = "0"] = value.split(".");
35
- const negative = integer.startsWith("-");
36
- if (negative)
37
- integer = integer.slice(1);
38
- // trim trailing zeros.
39
- fraction = fraction.replace(/(0+)$/, "");
40
- // round off if the fraction is larger than the number of decimals.
41
- if (decimals === 0) {
42
- if (Math.round(Number(`.${fraction}`)) === 1)
43
- integer = `${BigInt(integer) + 1n}`;
44
- fraction = "";
45
- }
46
- else if (fraction.length > decimals) {
47
- const [left, unit, right] = [
48
- fraction.slice(0, decimals - 1),
49
- fraction.slice(decimals - 1, decimals),
50
- fraction.slice(decimals),
51
- ];
52
- const rounded = Math.round(Number(`${unit}.${right}`));
53
- if (rounded > 9)
54
- fraction = `${BigInt(left) + BigInt(1)}0`.padStart(left.length + 1, "0");
55
- else
56
- fraction = `${left}${rounded}`;
57
- if (fraction.length > decimals) {
58
- fraction = fraction.slice(1);
59
- integer = `${BigInt(integer) + 1n}`;
60
- }
61
- fraction = fraction.slice(0, decimals);
62
- }
63
- else {
64
- fraction = fraction.padEnd(decimals, "0");
65
- }
66
- return BigInt(`${negative ? "-" : ""}${integer}${fraction}`);
67
- }
@@ -1,56 +0,0 @@
1
- import type { Address } from "viem";
2
- import { type RoundingDirection } from "../math";
3
- import { type IToken, WrappedToken } from "../token";
4
- import type { BigIntish } from "../types";
5
- import type { IAccrualVaultV2Adapter } from "./VaultV2Adapter";
6
- export interface IVaultV2 extends IToken {
7
- asset: Address;
8
- totalSupply: bigint;
9
- totalAssets: bigint;
10
- performanceFee: bigint;
11
- managementFee: bigint;
12
- virtualShares: bigint;
13
- lastUpdate: bigint;
14
- adapters: Address[];
15
- maxRate: bigint;
16
- liquidityAdapter: Address;
17
- performanceFeeRecipient: Address;
18
- managementFeeRecipient: Address;
19
- }
20
- export declare class VaultV2 extends WrappedToken implements IVaultV2 {
21
- readonly asset: Address;
22
- /**
23
- * The ERC4626 vault's total supply of shares.
24
- */
25
- totalSupply: bigint;
26
- /**
27
- * The ERC4626 vault's total assets, without accrued interest
28
- */
29
- totalAssets: bigint;
30
- virtualShares: bigint;
31
- lastUpdate: bigint;
32
- adapters: Address[];
33
- maxRate: bigint;
34
- performanceFee: bigint;
35
- managementFee: bigint;
36
- liquidityAdapter: Address;
37
- performanceFeeRecipient: Address;
38
- managementFeeRecipient: Address;
39
- constructor({ totalSupply, asset, totalAssets, virtualShares, lastUpdate, adapters, maxRate, performanceFee, managementFee, liquidityAdapter, performanceFeeRecipient, managementFeeRecipient, ...config }: IVaultV2);
40
- toAssets(shares: bigint): bigint;
41
- toShares(assets: bigint): bigint;
42
- protected _wrap(amount: bigint, rounding: RoundingDirection): bigint;
43
- protected _unwrap(amount: bigint, rounding: RoundingDirection): bigint;
44
- }
45
- export interface IAccrualVaultV2 extends Omit<IVaultV2, "adapters"> {
46
- }
47
- export declare class AccrualVaultV2 extends VaultV2 implements IAccrualVaultV2 {
48
- readonly accrualAdapters: IAccrualVaultV2Adapter[];
49
- readonly assetBalance: bigint;
50
- constructor(vault: IAccrualVaultV2, accrualAdapters: IAccrualVaultV2Adapter[], assetBalance: bigint);
51
- accrueInterest(timestamp: BigIntish): {
52
- vault: AccrualVaultV2;
53
- performanceFeeShares: bigint;
54
- managementFeeShares: bigint;
55
- };
56
- }
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AccrualVaultV2 = exports.VaultV2 = void 0;
4
- const math_1 = require("../math");
5
- const token_1 = require("../token");
6
- class VaultV2 extends token_1.WrappedToken {
7
- asset;
8
- /**
9
- * The ERC4626 vault's total supply of shares.
10
- */
11
- totalSupply;
12
- /**
13
- * The ERC4626 vault's total assets, without accrued interest
14
- */
15
- totalAssets;
16
- virtualShares;
17
- lastUpdate;
18
- adapters;
19
- maxRate;
20
- performanceFee;
21
- managementFee;
22
- liquidityAdapter;
23
- performanceFeeRecipient;
24
- managementFeeRecipient;
25
- constructor({ totalSupply, asset, totalAssets, virtualShares, lastUpdate, adapters, maxRate, performanceFee, managementFee, liquidityAdapter, performanceFeeRecipient, managementFeeRecipient, ...config }) {
26
- super(config, asset);
27
- this.totalSupply = totalSupply;
28
- this.totalAssets = totalAssets;
29
- this.virtualShares = virtualShares;
30
- this.lastUpdate = lastUpdate;
31
- this.asset = asset;
32
- this.maxRate = maxRate;
33
- this.adapters = adapters;
34
- this.performanceFee = performanceFee;
35
- this.managementFee = managementFee;
36
- this.liquidityAdapter = liquidityAdapter;
37
- this.performanceFeeRecipient = performanceFeeRecipient;
38
- this.managementFeeRecipient = managementFeeRecipient;
39
- }
40
- toAssets(shares) {
41
- return this._unwrap(shares, "Down");
42
- }
43
- toShares(assets) {
44
- return this._wrap(assets, "Down");
45
- }
46
- _wrap(amount, rounding) {
47
- return math_1.MathLib.mulDiv(amount, this.totalSupply + this.virtualShares, this.totalAssets + 1n, rounding);
48
- }
49
- _unwrap(amount, rounding) {
50
- return math_1.MathLib.mulDiv(amount, this.totalAssets + 1n, this.totalSupply + this.virtualShares, rounding);
51
- }
52
- }
53
- exports.VaultV2 = VaultV2;
54
- class AccrualVaultV2 extends VaultV2 {
55
- accrualAdapters;
56
- assetBalance;
57
- constructor(vault, accrualAdapters, assetBalance) {
58
- super({ ...vault, adapters: accrualAdapters.map((a) => a.address) });
59
- this.accrualAdapters = accrualAdapters;
60
- this.assetBalance = assetBalance;
61
- }
62
- accrueInterest(timestamp) {
63
- const vault = new AccrualVaultV2(this, this.accrualAdapters, this.assetBalance);
64
- const elapsed = BigInt(timestamp) - vault.lastUpdate;
65
- if (elapsed <= 0n)
66
- return { vault, performanceFeeShares: 0n, managementFeeShares: 0n };
67
- const realAssets = vault.accrualAdapters.reduce((curr, adapter) => curr + adapter.realAssets(timestamp), vault.assetBalance);
68
- const maxTotalAssets = vault.totalAssets +
69
- math_1.MathLib.wMulDown(vault.totalAssets * elapsed, vault.maxRate);
70
- const newTotalAssets = math_1.MathLib.min(realAssets, maxTotalAssets);
71
- const interest = math_1.MathLib.zeroFloorSub(newTotalAssets, vault.totalAssets);
72
- const performanceFeeAssets = interest > 0n && vault.performanceFee > 0n
73
- ? math_1.MathLib.wMulDown(interest, vault.performanceFee)
74
- : 0n;
75
- const managementFeeAssets = elapsed > 0n && vault.managementFee > 0n
76
- ? math_1.MathLib.wMulDown(newTotalAssets * elapsed, vault.managementFee)
77
- : 0n;
78
- const newTotalAssetsWithoutFees = newTotalAssets - performanceFeeAssets - managementFeeAssets;
79
- const performanceFeeShares = math_1.MathLib.mulDivDown(performanceFeeAssets, vault.totalSupply + vault.virtualShares, newTotalAssetsWithoutFees + 1n);
80
- const managementFeeShares = math_1.MathLib.mulDivDown(managementFeeAssets, vault.totalSupply + vault.virtualShares, newTotalAssetsWithoutFees + 1n);
81
- vault.totalAssets = newTotalAssets;
82
- if (performanceFeeShares)
83
- vault.totalSupply += performanceFeeShares;
84
- if (managementFeeShares)
85
- vault.totalSupply += managementFeeShares;
86
- vault.lastUpdate = BigInt(timestamp);
87
- return { vault, performanceFeeShares, managementFeeShares };
88
- }
89
- }
90
- exports.AccrualVaultV2 = AccrualVaultV2;
@@ -1,18 +0,0 @@
1
- import type { Address, Hash } from "viem";
2
- import type { BigIntish } from "../types";
3
- export interface IVaultV2Adapter {
4
- address: Address;
5
- parentVault: Address;
6
- adapterId: Hash;
7
- skimRecipient: Address;
8
- }
9
- export declare abstract class VaultV2Adapter implements IVaultV2Adapter {
10
- readonly address: Address;
11
- readonly parentVault: Address;
12
- readonly adapterId: Hash;
13
- skimRecipient: Address;
14
- constructor({ address, parentVault, adapterId, skimRecipient, }: IVaultV2Adapter);
15
- }
16
- export interface IAccrualVaultV2Adapter extends IVaultV2Adapter {
17
- realAssets(timestamp: BigIntish): bigint;
18
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VaultV2Adapter = void 0;
4
- class VaultV2Adapter {
5
- address;
6
- parentVault;
7
- adapterId;
8
- skimRecipient;
9
- constructor({ address, parentVault, adapterId, skimRecipient, }) {
10
- this.address = address;
11
- this.parentVault = parentVault;
12
- this.adapterId = adapterId;
13
- this.skimRecipient = skimRecipient;
14
- }
15
- }
16
- exports.VaultV2Adapter = VaultV2Adapter;
@@ -1,21 +0,0 @@
1
- import type { Address } from "viem";
2
- import { VaultV2Adapter } from "./VaultV2Adapter";
3
- export interface IVaultV2MorphoVaultV1Adapter extends IVaultV2Adapter {
4
- morphoVaultV1: Address;
5
- }
6
- import type { BigIntish } from "../types";
7
- import type { AccrualVault } from "../vault";
8
- import type { IAccrualVaultV2Adapter, IVaultV2Adapter } from "./VaultV2Adapter";
9
- export declare class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter implements IVaultV2MorphoVaultV1Adapter {
10
- readonly morphoVaultV1: Address;
11
- constructor({ morphoVaultV1, ...vaultV2Adapter }: IVaultV2MorphoVaultV1Adapter);
12
- ids(): `0x${string}`[];
13
- }
14
- export interface IAccrualVaultV2MorphoVaultV1Adapter extends IVaultV2MorphoVaultV1Adapter {
15
- }
16
- export declare class AccrualVaultV2MorphoVaultV1Adapter extends VaultV2MorphoVaultV1Adapter implements IAccrualVaultV2MorphoVaultV1Adapter, IAccrualVaultV2Adapter {
17
- vaultV1: AccrualVault;
18
- shares: bigint;
19
- constructor(adapter: IAccrualVaultV2MorphoVaultV1Adapter, vaultV1: AccrualVault, shares: bigint);
20
- realAssets(timestamp: BigIntish): bigint;
21
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AccrualVaultV2MorphoVaultV1Adapter = exports.VaultV2MorphoVaultV1Adapter = void 0;
4
- const VaultV2Adapter_1 = require("./VaultV2Adapter");
5
- class VaultV2MorphoVaultV1Adapter extends VaultV2Adapter_1.VaultV2Adapter {
6
- morphoVaultV1;
7
- constructor({ morphoVaultV1, ...vaultV2Adapter }) {
8
- super(vaultV2Adapter);
9
- this.morphoVaultV1 = morphoVaultV1;
10
- }
11
- ids() {
12
- return [this.adapterId];
13
- }
14
- }
15
- exports.VaultV2MorphoVaultV1Adapter = VaultV2MorphoVaultV1Adapter;
16
- class AccrualVaultV2MorphoVaultV1Adapter extends VaultV2MorphoVaultV1Adapter {
17
- vaultV1;
18
- shares;
19
- constructor(adapter, vaultV1, shares) {
20
- super(adapter);
21
- this.vaultV1 = vaultV1;
22
- this.shares = shares;
23
- }
24
- realAssets(timestamp) {
25
- return this.vaultV1.accrueInterest(timestamp).toAssets(this.shares);
26
- }
27
- }
28
- exports.AccrualVaultV2MorphoVaultV1Adapter = AccrualVaultV2MorphoVaultV1Adapter;
@@ -1,3 +0,0 @@
1
- export * from "./VaultV2.js";
2
- export * from "./VaultV2Adapter.js";
3
- export * from "./VaultV2MorphoVaultV1Adapter.js";
@@ -1,19 +0,0 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./VaultV2.js"), exports);
18
- __exportStar(require("./VaultV2Adapter.js"), exports);
19
- __exportStar(require("./VaultV2MorphoVaultV1Adapter.js"), exports);