@morpho-org/blue-sdk 5.0.0 → 5.1.0-next.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.d.ts +122 -18
- package/lib/addresses.js +48 -8
- package/lib/errors.d.ts +16 -0
- package/lib/errors.js +32 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/market/Market.d.ts +22 -18
- package/lib/market/Market.js +35 -22
- package/lib/market/MarketUtils.d.ts +21 -3
- package/lib/market/MarketUtils.js +27 -3
- package/lib/position/Position.d.ts +4 -4
- package/lib/position/Position.js +3 -2
- package/lib/token/VaultToken.d.ts +3 -3
- package/lib/types.d.ts +1 -0
- package/lib/types.js +5 -0
- package/lib/utils.d.ts +15 -0
- package/lib/utils.js +77 -0
- package/lib/vault/Vault.d.ts +23 -3
- package/lib/vault/Vault.js +42 -17
- package/lib/vault/index.d.ts +1 -0
- package/lib/vault/index.js +1 -0
- package/lib/vault/v2/VaultV2.d.ts +87 -0
- package/lib/vault/v2/VaultV2.js +158 -0
- package/lib/vault/v2/VaultV2Adapter.d.ts +29 -0
- package/lib/vault/v2/VaultV2Adapter.js +16 -0
- package/lib/vault/v2/VaultV2MorphoVaultV1Adapter.d.ts +24 -0
- package/lib/vault/v2/VaultV2MorphoVaultV1Adapter.js +41 -0
- package/lib/vault/v2/index.d.ts +3 -0
- package/lib/vault/v2/index.js +19 -0
- package/package.json +4 -4
package/lib/addresses.d.ts
CHANGED
|
@@ -9,6 +9,30 @@ 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;
|
|
12
36
|
bundler3: {
|
|
13
37
|
bundler3: Address;
|
|
14
38
|
generalAdapter1: Address;
|
|
@@ -25,8 +49,6 @@ export interface ChainAddresses {
|
|
|
25
49
|
adaptiveCurveIrm: Address;
|
|
26
50
|
publicAllocator?: Address;
|
|
27
51
|
metaMorphoFactory?: Address;
|
|
28
|
-
vaultV2Factory?: Address;
|
|
29
|
-
morphoVaultV1AdapterFactory?: Address;
|
|
30
52
|
registryList?: Address;
|
|
31
53
|
chainlinkOracleFactory?: Address;
|
|
32
54
|
preLiquidationFactory?: Address;
|
|
@@ -42,11 +64,17 @@ export interface ChainAddresses {
|
|
|
42
64
|
usdc?: Address;
|
|
43
65
|
stEth?: Address;
|
|
44
66
|
wstEth?: Address;
|
|
67
|
+
vaultV2Factory?: Address;
|
|
68
|
+
morphoVaultV1AdapterFactory?: Address;
|
|
45
69
|
}
|
|
46
70
|
declare const _addressesRegistry: {
|
|
47
71
|
readonly 1: {
|
|
48
72
|
readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
49
73
|
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
76
|
+
*/
|
|
77
|
+
readonly bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077";
|
|
50
78
|
readonly bundler3: {
|
|
51
79
|
readonly bundler3: "0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245";
|
|
52
80
|
readonly generalAdapter1: "0x4A6c312ec70E8747a587EE860a0353cd42Be0aE0";
|
|
@@ -60,11 +88,29 @@ declare const _addressesRegistry: {
|
|
|
60
88
|
readonly aaveV3EtherFiMigrationAdapter: "0x4011dc6581fA05F9B0c7A12AdCd676e2b1a59ca3";
|
|
61
89
|
readonly aaveV3OptimizerMigrationAdapter: "0x9e2ea2d5785598a163D569D795f286F5C55ad972";
|
|
62
90
|
};
|
|
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";
|
|
63
111
|
readonly adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
64
112
|
readonly publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
|
|
65
113
|
readonly metaMorphoFactory: "0x1897A8997241C1cD4bD0698647e4EB7213535c24";
|
|
66
|
-
readonly vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405";
|
|
67
|
-
readonly morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394";
|
|
68
114
|
readonly registryList: "0x3696c5eAe4a7Ffd04Ea163564571E9CD8Ed9364e";
|
|
69
115
|
readonly chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766";
|
|
70
116
|
readonly preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476";
|
|
@@ -95,10 +141,16 @@ declare const _addressesRegistry: {
|
|
|
95
141
|
readonly crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14";
|
|
96
142
|
readonly "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e";
|
|
97
143
|
readonly "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726";
|
|
144
|
+
readonly vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405";
|
|
145
|
+
readonly morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394";
|
|
98
146
|
};
|
|
99
147
|
readonly 8453: {
|
|
100
148
|
readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
101
149
|
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
150
|
+
/**
|
|
151
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
152
|
+
*/
|
|
153
|
+
readonly bundler: "0x23055618898e202386e6c13955a58D3C68200BFB";
|
|
102
154
|
readonly bundler3: {
|
|
103
155
|
readonly bundler3: "0x6BFd8137e702540E7A42B74178A4a49Ba43920C4";
|
|
104
156
|
readonly generalAdapter1: "0xb98c948CFA24072e58935BC004a8A7b376AE746A";
|
|
@@ -107,11 +159,21 @@ declare const _addressesRegistry: {
|
|
|
107
159
|
readonly compoundV3MigrationAdapter: "0x85D4812Ef92c040d4270eD8547b6835e41FbbB70";
|
|
108
160
|
readonly aaveV3CoreMigrationAdapter: "0xb27Aa2a964eAd5ed661D86974b37e4fB995b36f5";
|
|
109
161
|
};
|
|
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";
|
|
110
174
|
readonly adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
|
|
111
175
|
readonly publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
|
|
112
176
|
readonly metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918";
|
|
113
|
-
readonly vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857";
|
|
114
|
-
readonly morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642";
|
|
115
177
|
readonly registryList: "0x5C2531Cbd2cf112Cf687da3Cd536708aDd7DB10a";
|
|
116
178
|
readonly chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d";
|
|
117
179
|
readonly preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef";
|
|
@@ -119,6 +181,8 @@ declare const _addressesRegistry: {
|
|
|
119
181
|
readonly usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
120
182
|
readonly verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b";
|
|
121
183
|
readonly testUsdc: "0xBC77067f829979812d795d516E523C4033b66409";
|
|
184
|
+
readonly vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857";
|
|
185
|
+
readonly morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642";
|
|
122
186
|
};
|
|
123
187
|
readonly 137: {
|
|
124
188
|
readonly morpho: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67";
|
|
@@ -430,11 +494,11 @@ declare const _deployments: {
|
|
|
430
494
|
readonly adaptiveCurveIrm: 18883124n;
|
|
431
495
|
readonly publicAllocator: 19375099n;
|
|
432
496
|
readonly metaMorphoFactory: 21439510n;
|
|
433
|
-
readonly vaultV2Factory: 23375073n;
|
|
434
|
-
readonly morphoVaultV1AdapterFactory: 23375073n;
|
|
435
497
|
readonly registryList: 23375119n;
|
|
436
498
|
readonly chainlinkOracleFactory: 19375066n;
|
|
437
499
|
readonly preLiquidationFactory: 21414664n;
|
|
500
|
+
readonly vaultV2Factory: 23375073n;
|
|
501
|
+
readonly morphoVaultV1AdapterFactory: 23375073n;
|
|
438
502
|
};
|
|
439
503
|
readonly 8453: {
|
|
440
504
|
readonly morpho: 13977148n;
|
|
@@ -450,11 +514,11 @@ declare const _deployments: {
|
|
|
450
514
|
readonly adaptiveCurveIrm: 13977152n;
|
|
451
515
|
readonly publicAllocator: 13979545n;
|
|
452
516
|
readonly metaMorphoFactory: 23928808n;
|
|
453
|
-
readonly vaultV2Factory: 35615206n;
|
|
454
|
-
readonly morphoVaultV1AdapterFactory: 35615206n;
|
|
455
517
|
readonly registryList: 35615358n;
|
|
456
518
|
readonly chainlinkOracleFactory: 13978286n;
|
|
457
519
|
readonly preLiquidationFactory: 23779056n;
|
|
520
|
+
readonly vaultV2Factory: 35615206n;
|
|
521
|
+
readonly morphoVaultV1AdapterFactory: 35615206n;
|
|
458
522
|
};
|
|
459
523
|
readonly 137: {
|
|
460
524
|
readonly morpho: 66931042n;
|
|
@@ -745,6 +809,10 @@ export declare let addressesRegistry: {
|
|
|
745
809
|
readonly 1: {
|
|
746
810
|
readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
747
811
|
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
812
|
+
/**
|
|
813
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
814
|
+
*/
|
|
815
|
+
readonly bundler: "0x4095F064B8d3c3548A3bebfd0Bbfd04750E30077";
|
|
748
816
|
readonly bundler3: {
|
|
749
817
|
readonly bundler3: "0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245";
|
|
750
818
|
readonly generalAdapter1: "0x4A6c312ec70E8747a587EE860a0353cd42Be0aE0";
|
|
@@ -758,11 +826,29 @@ export declare let addressesRegistry: {
|
|
|
758
826
|
readonly aaveV3EtherFiMigrationAdapter: "0x4011dc6581fA05F9B0c7A12AdCd676e2b1a59ca3";
|
|
759
827
|
readonly aaveV3OptimizerMigrationAdapter: "0x9e2ea2d5785598a163D569D795f286F5C55ad972";
|
|
760
828
|
};
|
|
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";
|
|
761
849
|
readonly adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
|
|
762
850
|
readonly publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
|
|
763
851
|
readonly metaMorphoFactory: "0x1897A8997241C1cD4bD0698647e4EB7213535c24";
|
|
764
|
-
readonly vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405";
|
|
765
|
-
readonly morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394";
|
|
766
852
|
readonly registryList: "0x3696c5eAe4a7Ffd04Ea163564571E9CD8Ed9364e";
|
|
767
853
|
readonly chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766";
|
|
768
854
|
readonly preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476";
|
|
@@ -793,10 +879,16 @@ export declare let addressesRegistry: {
|
|
|
793
879
|
readonly crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14";
|
|
794
880
|
readonly "stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e";
|
|
795
881
|
readonly "2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726";
|
|
882
|
+
readonly vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405";
|
|
883
|
+
readonly morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394";
|
|
796
884
|
};
|
|
797
885
|
readonly 8453: {
|
|
798
886
|
readonly morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb";
|
|
799
887
|
readonly permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
888
|
+
/**
|
|
889
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
890
|
+
*/
|
|
891
|
+
readonly bundler: "0x23055618898e202386e6c13955a58D3C68200BFB";
|
|
800
892
|
readonly bundler3: {
|
|
801
893
|
readonly bundler3: "0x6BFd8137e702540E7A42B74178A4a49Ba43920C4";
|
|
802
894
|
readonly generalAdapter1: "0xb98c948CFA24072e58935BC004a8A7b376AE746A";
|
|
@@ -805,11 +897,21 @@ export declare let addressesRegistry: {
|
|
|
805
897
|
readonly compoundV3MigrationAdapter: "0x85D4812Ef92c040d4270eD8547b6835e41FbbB70";
|
|
806
898
|
readonly aaveV3CoreMigrationAdapter: "0xb27Aa2a964eAd5ed661D86974b37e4fB995b36f5";
|
|
807
899
|
};
|
|
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";
|
|
808
912
|
readonly adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
|
|
809
913
|
readonly publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
|
|
810
914
|
readonly metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918";
|
|
811
|
-
readonly vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857";
|
|
812
|
-
readonly morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642";
|
|
813
915
|
readonly registryList: "0x5C2531Cbd2cf112Cf687da3Cd536708aDd7DB10a";
|
|
814
916
|
readonly chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d";
|
|
815
917
|
readonly preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef";
|
|
@@ -817,6 +919,8 @@ export declare let addressesRegistry: {
|
|
|
817
919
|
readonly usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
818
920
|
readonly verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b";
|
|
819
921
|
readonly testUsdc: "0xBC77067f829979812d795d516E523C4033b66409";
|
|
922
|
+
readonly vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857";
|
|
923
|
+
readonly morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642";
|
|
820
924
|
};
|
|
821
925
|
readonly 137: {
|
|
822
926
|
readonly morpho: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67";
|
|
@@ -1126,11 +1230,11 @@ export declare let deployments: {
|
|
|
1126
1230
|
readonly adaptiveCurveIrm: 18883124n;
|
|
1127
1231
|
readonly publicAllocator: 19375099n;
|
|
1128
1232
|
readonly metaMorphoFactory: 21439510n;
|
|
1129
|
-
readonly vaultV2Factory: 23375073n;
|
|
1130
|
-
readonly morphoVaultV1AdapterFactory: 23375073n;
|
|
1131
1233
|
readonly registryList: 23375119n;
|
|
1132
1234
|
readonly chainlinkOracleFactory: 19375066n;
|
|
1133
1235
|
readonly preLiquidationFactory: 21414664n;
|
|
1236
|
+
readonly vaultV2Factory: 23375073n;
|
|
1237
|
+
readonly morphoVaultV1AdapterFactory: 23375073n;
|
|
1134
1238
|
};
|
|
1135
1239
|
readonly 8453: {
|
|
1136
1240
|
readonly morpho: 13977148n;
|
|
@@ -1146,11 +1250,11 @@ export declare let deployments: {
|
|
|
1146
1250
|
readonly adaptiveCurveIrm: 13977152n;
|
|
1147
1251
|
readonly publicAllocator: 13979545n;
|
|
1148
1252
|
readonly metaMorphoFactory: 23928808n;
|
|
1149
|
-
readonly vaultV2Factory: 35615206n;
|
|
1150
|
-
readonly morphoVaultV1AdapterFactory: 35615206n;
|
|
1151
1253
|
readonly registryList: 35615358n;
|
|
1152
1254
|
readonly chainlinkOracleFactory: 13978286n;
|
|
1153
1255
|
readonly preLiquidationFactory: 23779056n;
|
|
1256
|
+
readonly vaultV2Factory: 35615206n;
|
|
1257
|
+
readonly morphoVaultV1AdapterFactory: 35615206n;
|
|
1154
1258
|
};
|
|
1155
1259
|
readonly 137: {
|
|
1156
1260
|
readonly morpho: 66931042n;
|
package/lib/addresses.js
CHANGED
|
@@ -20,6 +20,10 @@ 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",
|
|
23
27
|
bundler3: {
|
|
24
28
|
bundler3: "0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245",
|
|
25
29
|
generalAdapter1: "0x4A6c312ec70E8747a587EE860a0353cd42Be0aE0",
|
|
@@ -33,11 +37,29 @@ const _addressesRegistry = {
|
|
|
33
37
|
aaveV3EtherFiMigrationAdapter: "0x4011dc6581fA05F9B0c7A12AdCd676e2b1a59ca3",
|
|
34
38
|
aaveV3OptimizerMigrationAdapter: "0x9e2ea2d5785598a163D569D795f286F5C55ad972",
|
|
35
39
|
},
|
|
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",
|
|
36
60
|
adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
|
|
37
61
|
publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
|
|
38
62
|
metaMorphoFactory: "0x1897A8997241C1cD4bD0698647e4EB7213535c24",
|
|
39
|
-
vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405",
|
|
40
|
-
morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394",
|
|
41
63
|
registryList: "0x3696c5eAe4a7Ffd04Ea163564571E9CD8Ed9364e",
|
|
42
64
|
chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766",
|
|
43
65
|
preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476",
|
|
@@ -74,10 +96,16 @@ const _addressesRegistry = {
|
|
|
74
96
|
crvUSDETHCRV: "0x4eBdF703948ddCEA3B11f675B4D1Fba9d2414A14",
|
|
75
97
|
"stkcvx2BTC-f-morpho": "0x385E12cf4040543Bc8C18e05C1298Be5B04f3f5e",
|
|
76
98
|
"2BTC-f": "0xB7ECB2AA52AA64a717180E030241bC75Cd946726",
|
|
99
|
+
vaultV2Factory: "0xA1D94F746dEfa1928926b84fB2596c06926C0405",
|
|
100
|
+
morphoVaultV1AdapterFactory: "0xD1B8E2dee25c2b89DCD2f98448a7ce87d6F63394",
|
|
77
101
|
},
|
|
78
102
|
[chain_js_1.ChainId.BaseMainnet]: {
|
|
79
103
|
morpho: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
|
|
80
104
|
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated All bundles should use Bundler3 instead.
|
|
107
|
+
*/
|
|
108
|
+
bundler: "0x23055618898e202386e6c13955a58D3C68200BFB",
|
|
81
109
|
bundler3: {
|
|
82
110
|
bundler3: "0x6BFd8137e702540E7A42B74178A4a49Ba43920C4",
|
|
83
111
|
generalAdapter1: "0xb98c948CFA24072e58935BC004a8A7b376AE746A",
|
|
@@ -86,11 +114,21 @@ const _addressesRegistry = {
|
|
|
86
114
|
compoundV3MigrationAdapter: "0x85D4812Ef92c040d4270eD8547b6835e41FbbB70",
|
|
87
115
|
aaveV3CoreMigrationAdapter: "0xb27Aa2a964eAd5ed661D86974b37e4fB995b36f5",
|
|
88
116
|
},
|
|
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",
|
|
89
129
|
adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
|
|
90
130
|
publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
|
|
91
131
|
metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918",
|
|
92
|
-
vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857",
|
|
93
|
-
morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642",
|
|
94
132
|
registryList: "0x5C2531Cbd2cf112Cf687da3Cd536708aDd7DB10a",
|
|
95
133
|
chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d",
|
|
96
134
|
preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef",
|
|
@@ -99,6 +137,8 @@ const _addressesRegistry = {
|
|
|
99
137
|
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
100
138
|
verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b",
|
|
101
139
|
testUsdc: "0xBC77067f829979812d795d516E523C4033b66409",
|
|
140
|
+
vaultV2Factory: "0x4501125508079A99ebBebCE205DeC9593C2b5857",
|
|
141
|
+
morphoVaultV1AdapterFactory: "0xF42D9c36b34c9c2CF3Bc30eD2a52a90eEB604642",
|
|
102
142
|
},
|
|
103
143
|
[chain_js_1.ChainId.PolygonMainnet]: {
|
|
104
144
|
morpho: "0x1bF0c2541F820E775182832f06c0B7Fc27A25f67",
|
|
@@ -416,11 +456,11 @@ const _deployments = {
|
|
|
416
456
|
adaptiveCurveIrm: 18883124n,
|
|
417
457
|
publicAllocator: 19375099n,
|
|
418
458
|
metaMorphoFactory: 21439510n,
|
|
419
|
-
vaultV2Factory: 23375073n,
|
|
420
|
-
morphoVaultV1AdapterFactory: 23375073n,
|
|
421
459
|
registryList: 23375119n,
|
|
422
460
|
chainlinkOracleFactory: 19375066n,
|
|
423
461
|
preLiquidationFactory: 21414664n,
|
|
462
|
+
vaultV2Factory: 23375073n,
|
|
463
|
+
morphoVaultV1AdapterFactory: 23375073n,
|
|
424
464
|
},
|
|
425
465
|
[chain_js_1.ChainId.BaseMainnet]: {
|
|
426
466
|
morpho: 13977148n,
|
|
@@ -436,11 +476,11 @@ const _deployments = {
|
|
|
436
476
|
adaptiveCurveIrm: 13977152n,
|
|
437
477
|
publicAllocator: 13979545n,
|
|
438
478
|
metaMorphoFactory: 23928808n,
|
|
439
|
-
vaultV2Factory: 35615206n,
|
|
440
|
-
morphoVaultV1AdapterFactory: 35615206n,
|
|
441
479
|
registryList: 35615358n,
|
|
442
480
|
chainlinkOracleFactory: 13978286n,
|
|
443
481
|
preLiquidationFactory: 23779056n,
|
|
482
|
+
vaultV2Factory: 35615206n,
|
|
483
|
+
morphoVaultV1AdapterFactory: 35615206n,
|
|
444
484
|
},
|
|
445
485
|
[chain_js_1.ChainId.PolygonMainnet]: {
|
|
446
486
|
morpho: 66931042n,
|
package/lib/errors.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ 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
|
+
}
|
|
28
32
|
export declare namespace BlueErrors {
|
|
29
33
|
class AlreadySet extends Error {
|
|
30
34
|
readonly name: string;
|
|
@@ -65,6 +69,18 @@ export declare namespace BlueErrors {
|
|
|
65
69
|
constructor(deadline: bigint);
|
|
66
70
|
}
|
|
67
71
|
}
|
|
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
|
+
}
|
|
68
84
|
export interface ErrorClass<E extends Error> {
|
|
69
85
|
new (...args: any[]): E;
|
|
70
86
|
}
|
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.UnsupportedPreLiquidationParamsError = exports.UnsupportedChainIdError = exports.UnknownVaultConfigError = exports.UnknownMarketParamsError = exports.UnknownTokenPriceError = exports.UnknownTokenError = exports.UnknownDataError = void 0;
|
|
3
|
+
exports.VaultV2Errors = exports.BlueErrors = exports.UnsupportedVaultV2AdapterError = 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,6 +54,14 @@ 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;
|
|
57
65
|
var BlueErrors;
|
|
58
66
|
(function (BlueErrors) {
|
|
59
67
|
class AlreadySet extends Error {
|
|
@@ -133,6 +141,29 @@ var BlueErrors;
|
|
|
133
141
|
}
|
|
134
142
|
BlueErrors.ExpiredSignature = ExpiredSignature;
|
|
135
143
|
})(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 = {}));
|
|
136
167
|
function _try(accessor, ...errorClasses) {
|
|
137
168
|
const maybeCatchError = (error) => {
|
|
138
169
|
if (errorClasses.length === 0 ||
|
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.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { type RoundingDirection } from "../math/index.js";
|
|
2
2
|
import type { BigIntish } from "../types.js";
|
|
3
|
+
import { type CapacityLimit } from "../utils.js";
|
|
3
4
|
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
|
-
}
|
|
15
5
|
export interface MaxBorrowOptions {
|
|
16
6
|
maxLtv?: bigint;
|
|
17
7
|
}
|
|
@@ -98,9 +88,19 @@ export declare class Market implements IMarket {
|
|
|
98
88
|
*/
|
|
99
89
|
get utilization(): bigint;
|
|
100
90
|
/**
|
|
101
|
-
* The market's Annual Percentage Yield (APY) at the IRM's target utilization rate, if applicable.
|
|
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.
|
|
102
102
|
*/
|
|
103
|
-
get
|
|
103
|
+
get borrowRate(): bigint;
|
|
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).
|
|
@@ -135,7 +135,11 @@ export declare class Market implements IMarket {
|
|
|
135
135
|
* The market's current, instantaneous borrow-side Annual Percentage Yield (APY) (scaled by WAD).
|
|
136
136
|
* If interested in the APY at a specific timestamp, use `getBorrowApy(timestamp)` instead.
|
|
137
137
|
*/
|
|
138
|
-
get borrowApy():
|
|
138
|
+
get borrowApy(): bigint;
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated Use `getEndBorrowRate(timestamp)` instead.
|
|
141
|
+
*/
|
|
142
|
+
getBorrowRate(timestamp?: BigIntish): bigint;
|
|
139
143
|
/**
|
|
140
144
|
* Returns the instantaneous rate at which interest accrues for borrowers of this market,
|
|
141
145
|
* at the given timestamp, if the state remains unchanged (not accrued) (scaled by WAD).
|
|
@@ -169,12 +173,12 @@ export declare class Market implements IMarket {
|
|
|
169
173
|
};
|
|
170
174
|
/**
|
|
171
175
|
* The market's instantaneous borrow-side Annual Percentage Yield (APY) at the given timestamp,
|
|
172
|
-
* if the state remains unchanged (not accrued).
|
|
176
|
+
* if the state remains unchanged (not accrued) (scaled by WAD).
|
|
173
177
|
* @param timestamp The timestamp at which to calculate the borrow APY.
|
|
174
178
|
* Must be greater than or equal to `lastUpdate`.
|
|
175
179
|
* Defaults to `Time.timestamp()` (returns the current borrow APY).
|
|
176
180
|
*/
|
|
177
|
-
getBorrowApy(timestamp?: BigIntish):
|
|
181
|
+
getBorrowApy(timestamp?: BigIntish): bigint;
|
|
178
182
|
/**
|
|
179
183
|
* The market's instantaneous supply-side Annual Percentage Yield (APY) at the given timestamp,
|
|
180
184
|
* if the state remains unchanged (not accrued) (scaled by WAD).
|
|
@@ -185,12 +189,12 @@ export declare class Market implements IMarket {
|
|
|
185
189
|
getSupplyApy(timestamp?: BigIntish): bigint;
|
|
186
190
|
/**
|
|
187
191
|
* The market's experienced borrow-side Annual Percentage Yield (APY),
|
|
188
|
-
* if interest was to be accrued at the given timestamp.
|
|
192
|
+
* if interest was to be accrued at the given timestamp (scaled by WAD).
|
|
189
193
|
* @param timestamp The timestamp at which to calculate the borrow APY.
|
|
190
194
|
* Must be greater than or equal to `lastUpdate`.
|
|
191
195
|
* Defaults to `Time.timestamp()` (returns the current borrow APY).
|
|
192
196
|
*/
|
|
193
|
-
getAvgBorrowApy(timestamp?: BigIntish):
|
|
197
|
+
getAvgBorrowApy(timestamp?: BigIntish): bigint;
|
|
194
198
|
/**
|
|
195
199
|
* The market's experienced supply-side Annual Percentage Yield (APY),
|
|
196
200
|
* if interest was to be accrued at the given timestamp (scaled by WAD).
|