@morpho-org/blue-sdk 3.0.0-next.9 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/addresses.d.ts +28 -0
- package/lib/addresses.js +28 -0
- package/lib/chain.d.ts +2 -1
- package/lib/chain.js +8 -0
- package/lib/errors.d.ts +9 -0
- package/lib/errors.js +20 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/market/Market.d.ts +1 -1
- package/lib/market/MarketUtils.d.ts +2 -2
- package/lib/market/MarketUtils.js +1 -5
- package/lib/position/Position.d.ts +20 -13
- package/lib/position/Position.js +52 -38
- package/lib/position/PreLiquidationPosition.d.ts +60 -0
- package/lib/position/PreLiquidationPosition.js +102 -0
- package/lib/position/index.d.ts +1 -0
- package/lib/position/index.js +1 -0
- package/lib/preLiquidation.d.ts +15 -0
- package/lib/preLiquidation.js +85 -0
- package/package.json +4 -4
- package/lib/tsconfig.tsbuildinfo +0 -1
package/lib/addresses.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export interface ChainAddresses {
|
|
|
35
35
|
publicAllocator?: Address;
|
|
36
36
|
metaMorphoFactory?: Address;
|
|
37
37
|
chainlinkOracleFactory?: Address;
|
|
38
|
+
preLiquidationFactory?: Address;
|
|
38
39
|
wNative?: Address;
|
|
39
40
|
morphoToken?: Address;
|
|
40
41
|
/**
|
|
@@ -78,6 +79,7 @@ export declare const addressesRegistry: {
|
|
|
78
79
|
readonly publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
|
|
79
80
|
readonly metaMorphoFactory: "0x1897A8997241C1cD4bD0698647e4EB7213535c24";
|
|
80
81
|
readonly chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766";
|
|
82
|
+
readonly preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476";
|
|
81
83
|
readonly wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
|
|
82
84
|
readonly morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999";
|
|
83
85
|
readonly dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F";
|
|
@@ -128,6 +130,7 @@ export declare const addressesRegistry: {
|
|
|
128
130
|
readonly publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
|
|
129
131
|
readonly metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918";
|
|
130
132
|
readonly chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d";
|
|
133
|
+
readonly preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef";
|
|
131
134
|
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
132
135
|
readonly usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
133
136
|
readonly verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b";
|
|
@@ -148,6 +151,7 @@ export declare const addressesRegistry: {
|
|
|
148
151
|
readonly publicAllocator: "0xfac15aff53ADd2ff80C2962127C434E8615Df0d3";
|
|
149
152
|
readonly metaMorphoFactory: "0xa9c87daB340631C34BB738625C70499e29ddDC98";
|
|
150
153
|
readonly chainlinkOracleFactory: "0x1ff7895Eb842794c5d07C4c547b6730e61295215";
|
|
154
|
+
readonly preLiquidationFactory: "0xeDadDe37D76c72b98725614d0b41C20Fe612d304";
|
|
151
155
|
readonly wNative: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270";
|
|
152
156
|
};
|
|
153
157
|
readonly 42161: {
|
|
@@ -162,6 +166,7 @@ export declare const addressesRegistry: {
|
|
|
162
166
|
readonly publicAllocator: "0x769583Af5e9D03589F159EbEC31Cc2c23E8C355E";
|
|
163
167
|
readonly metaMorphoFactory: "0x878988f5f561081deEa117717052164ea1Ef0c82";
|
|
164
168
|
readonly chainlinkOracleFactory: "0x98Ce5D183DC0c176f54D37162F87e7eD7f2E41b5";
|
|
169
|
+
readonly preLiquidationFactory: "0x635c31B5DF1F7EFbCbC07E302335Ef4230758e3d";
|
|
165
170
|
readonly wNative: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
|
|
166
171
|
readonly usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831";
|
|
167
172
|
};
|
|
@@ -177,6 +182,7 @@ export declare const addressesRegistry: {
|
|
|
177
182
|
readonly publicAllocator: "0x0d68a97324E602E02799CD83B42D337207B40658";
|
|
178
183
|
readonly metaMorphoFactory: "0x3Bb6A6A0Bc85b367EFE0A5bAc81c5E52C892839a";
|
|
179
184
|
readonly chainlinkOracleFactory: "0x1ec408D4131686f727F3Fd6245CF85Bc5c9DAD70";
|
|
185
|
+
readonly preLiquidationFactory: "0x3d05C01EE8e97361b9E19D172128255eaE5F98B9";
|
|
180
186
|
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
181
187
|
readonly usdc: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85";
|
|
182
188
|
};
|
|
@@ -190,6 +196,7 @@ export declare const addressesRegistry: {
|
|
|
190
196
|
readonly publicAllocator: "0xef9889B4e443DEd35FA0Bd060f2104Cca94e6A43";
|
|
191
197
|
readonly metaMorphoFactory: "0x4DBB3a642a2146d5413750Cca3647086D9ba5F12";
|
|
192
198
|
readonly chainlinkOracleFactory: "0xd706690BA1Fe26b70c4AD89e60ff62cEB3A2eD02";
|
|
199
|
+
readonly preLiquidationFactory: "0xe3cE2051a24e58DBFC0eFBe4c2d9e89c5eAe4695";
|
|
193
200
|
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
194
201
|
};
|
|
195
202
|
readonly 252: {
|
|
@@ -202,6 +209,7 @@ export declare const addressesRegistry: {
|
|
|
202
209
|
readonly publicAllocator: "0x37a888192165fC39884f87c64E2476BfD2C09675";
|
|
203
210
|
readonly metaMorphoFactory: "0x27D4Af0AC9E7FDfA6D0853236f249CC27AE79488";
|
|
204
211
|
readonly chainlinkOracleFactory: "0x39d8622C607A691D7705E8842fbB12E3c38dCD41";
|
|
212
|
+
readonly preLiquidationFactory: "0xe3cE2051a24e58DBFC0eFBe4c2d9e89c5eAe4695";
|
|
205
213
|
readonly wNative: "0xfc00000000000000000000000000000000000006";
|
|
206
214
|
};
|
|
207
215
|
readonly 534352: {
|
|
@@ -214,6 +222,7 @@ export declare const addressesRegistry: {
|
|
|
214
222
|
readonly publicAllocator: "0x8a7f671E45E51dE245649Cf916cA0256FB8a9927";
|
|
215
223
|
readonly metaMorphoFactory: "0x56b65742ade55015e6480959808229Ad6dbc9295";
|
|
216
224
|
readonly chainlinkOracleFactory: "0xb5961902E60b188b1c665B7b72Ef616656A9e24E";
|
|
225
|
+
readonly preLiquidationFactory: "0xeD960178e4aDA0296786Fa79D84e8FDF7bd44B25";
|
|
217
226
|
readonly wNative: "0x5300000000000000000000000000000000000004";
|
|
218
227
|
readonly usdc: "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4";
|
|
219
228
|
};
|
|
@@ -227,6 +236,7 @@ export declare const addressesRegistry: {
|
|
|
227
236
|
readonly publicAllocator: "0x85416891752a6B81106c1C2999AE1AF5d8Cd3357";
|
|
228
237
|
readonly metaMorphoFactory: "0xd3f39505d0c48AFED3549D625982FdC38Ea9904b";
|
|
229
238
|
readonly chainlinkOracleFactory: "0x3FFFE273ee348b9E1ef89533025C7f165B17B439";
|
|
239
|
+
readonly preLiquidationFactory: "0x30607fEa77168d2c0401B6f60F0B40E32F9339E3";
|
|
230
240
|
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
231
241
|
readonly usdc: "0xF1815bd50389c46847f0Bda824eC8da914045D14";
|
|
232
242
|
};
|
|
@@ -240,6 +250,7 @@ export declare const addressesRegistry: {
|
|
|
240
250
|
readonly publicAllocator: "0xB0c9a107fA17c779B3378210A7a593e88938C7C9";
|
|
241
251
|
readonly metaMorphoFactory: "0xe9EdE3929F43a7062a007C3e8652e4ACa610Bdc0";
|
|
242
252
|
readonly chainlinkOracleFactory: "0x43269546e1D586a1f7200a0AC07e26f9631f7539";
|
|
253
|
+
readonly preLiquidationFactory: "0xb04e4D3D59Ee47Ca9BA192707AF13A7D02969911";
|
|
243
254
|
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
244
255
|
readonly usdc: "0x078D782b760474a361dDA0AF3839290b0EF57AD6";
|
|
245
256
|
};
|
|
@@ -253,6 +264,7 @@ export declare const addressesRegistry: {
|
|
|
253
264
|
readonly publicAllocator: "0x6Cef2EDC70D87E8f1623f3096efF05d066E59B36";
|
|
254
265
|
readonly metaMorphoFactory: "0x0cE9e3512CB4df8ae7e265e62Fb9258dc14f12e8";
|
|
255
266
|
readonly chainlinkOracleFactory: "0x7DA59Fa482F1F49fADc486d8e47BADc506fEb86d";
|
|
267
|
+
readonly preLiquidationFactory: "0xc72129DA4CC808e955699111b8c22B22Ca8A10b8";
|
|
256
268
|
readonly wNative: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38";
|
|
257
269
|
};
|
|
258
270
|
readonly 43111: {
|
|
@@ -265,6 +277,7 @@ export declare const addressesRegistry: {
|
|
|
265
277
|
readonly publicAllocator: "0x4107Ea1746909028d6212B315dE5fE9538F9eb39";
|
|
266
278
|
readonly metaMorphoFactory: "0x8e52179BeB18E882040b01632440d8Ca0f01da82";
|
|
267
279
|
readonly chainlinkOracleFactory: "0xB3cb32E6185446a6Bc7A047E4FfA138fA939e133";
|
|
280
|
+
readonly preLiquidationFactory: "0x40F2896C551194e364F7C846046C34d8a9FE97e4";
|
|
268
281
|
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
269
282
|
readonly usdc: "0xad11a8BEb98bbf61dbb1aa0F6d6F2ECD87b35afA";
|
|
270
283
|
};
|
|
@@ -278,6 +291,7 @@ export declare const addressesRegistry: {
|
|
|
278
291
|
readonly publicAllocator: "0xEE868Bf3359DA30c10ea472EAEBFC0a06E8F0120";
|
|
279
292
|
readonly metaMorphoFactory: "0xae5b0884bfff430493D6C844B9fd052Af7d79278";
|
|
280
293
|
readonly chainlinkOracleFactory: "0xf9380f7898423Bd7FDe3C9fDD1b2671A2471f39D";
|
|
294
|
+
readonly preLiquidationFactory: "0x249E4808264c545861e43728186a731dE7c7D745";
|
|
281
295
|
readonly wNative: "0x4200000000000000000000000000000000000006";
|
|
282
296
|
};
|
|
283
297
|
readonly 21000000: {
|
|
@@ -290,9 +304,23 @@ export declare const addressesRegistry: {
|
|
|
290
304
|
readonly publicAllocator: "0xDFde06e2B2A2D718eE5560b73dA4F830E56A2f10";
|
|
291
305
|
readonly metaMorphoFactory: "0xe430821595602eA5DD0cD350f86987437c7362fA";
|
|
292
306
|
readonly chainlinkOracleFactory: "0x16278156D366fC91536b6b81482ffaC47EEa06D6";
|
|
307
|
+
readonly preLiquidationFactory: "0xb9065AC18d3EBdb3263B77B587f9c5CD570545D1";
|
|
293
308
|
readonly wNative: "0xda5dDd7270381A7C2717aD10D1c0ecB19e3CDFb2";
|
|
294
309
|
readonly usdc: "0xDF0B24095e15044538866576754F3C964e902Ee6";
|
|
295
310
|
};
|
|
311
|
+
readonly 98866: {
|
|
312
|
+
readonly morpho: "0x42b18785CE0Aed7BF7Ca43a39471ED4C0A3e0bB5";
|
|
313
|
+
readonly bundler3: {
|
|
314
|
+
readonly bundler3: "0x5437C8788f4CFbaA55be6FBf30379bc7dd7f69C3";
|
|
315
|
+
readonly generalAdapter1: "0x65ff368930Cb7eB4CA5C5eBC58bb69E6Ed198BA5";
|
|
316
|
+
};
|
|
317
|
+
readonly adaptiveCurveIrm: "0x7420302Ddd469031Cd2282cd64225cCd46F581eA";
|
|
318
|
+
readonly publicAllocator: "0x58485338D93F4e3b4Bf2Af1C9f9C0aDF087AEf1C";
|
|
319
|
+
readonly metaMorphoFactory: "0x2525D453D9BA13921D5aB5D8c12F9202b0e19456";
|
|
320
|
+
readonly chainlinkOracleFactory: "0x133F742c0D36864F37e15C33a18bA6fdc950ED0f";
|
|
321
|
+
readonly preLiquidationFactory: "0xF184156Cf6Ad4D3dA7F6449D40755A0f9de97ef3";
|
|
322
|
+
readonly wNative: "0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1";
|
|
323
|
+
};
|
|
296
324
|
};
|
|
297
325
|
export declare const addresses: Record<number, ChainAddresses>;
|
|
298
326
|
export type AddressLabel = DottedKeys<(typeof addressesRegistry)[ChainId]>;
|
package/lib/addresses.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.addressesRegistry = {
|
|
|
40
40
|
publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
|
|
41
41
|
metaMorphoFactory: "0x1897A8997241C1cD4bD0698647e4EB7213535c24",
|
|
42
42
|
chainlinkOracleFactory: "0x3A7bB36Ee3f3eE32A60e9f2b33c1e5f2E83ad766",
|
|
43
|
+
preLiquidationFactory: "0x6FF33615e792E35ed1026ea7cACCf42D9BF83476",
|
|
43
44
|
wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
44
45
|
morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999",
|
|
45
46
|
// Must implement DAI specific permit (otherwise breaks permit signatures).
|
|
@@ -96,6 +97,7 @@ exports.addressesRegistry = {
|
|
|
96
97
|
publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
|
|
97
98
|
metaMorphoFactory: "0xFf62A7c278C62eD665133147129245053Bbf5918",
|
|
98
99
|
chainlinkOracleFactory: "0x2DC205F24BCb6B311E5cdf0745B0741648Aebd3d",
|
|
100
|
+
preLiquidationFactory: "0x8cd16b62E170Ee0bA83D80e1F80E6085367e2aef",
|
|
99
101
|
wNative: "0x4200000000000000000000000000000000000006",
|
|
100
102
|
// Must implement USDC permit version 2 (otherwise breaks permit signatures).
|
|
101
103
|
usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
@@ -117,6 +119,7 @@ exports.addressesRegistry = {
|
|
|
117
119
|
publicAllocator: "0xfac15aff53ADd2ff80C2962127C434E8615Df0d3",
|
|
118
120
|
metaMorphoFactory: "0xa9c87daB340631C34BB738625C70499e29ddDC98",
|
|
119
121
|
chainlinkOracleFactory: "0x1ff7895Eb842794c5d07C4c547b6730e61295215",
|
|
122
|
+
preLiquidationFactory: "0xeDadDe37D76c72b98725614d0b41C20Fe612d304",
|
|
120
123
|
wNative: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
|
|
121
124
|
},
|
|
122
125
|
[chain_js_1.ChainId.ArbitrumMainnet]: {
|
|
@@ -131,6 +134,7 @@ exports.addressesRegistry = {
|
|
|
131
134
|
publicAllocator: "0x769583Af5e9D03589F159EbEC31Cc2c23E8C355E",
|
|
132
135
|
metaMorphoFactory: "0x878988f5f561081deEa117717052164ea1Ef0c82",
|
|
133
136
|
chainlinkOracleFactory: "0x98Ce5D183DC0c176f54D37162F87e7eD7f2E41b5",
|
|
137
|
+
preLiquidationFactory: "0x635c31B5DF1F7EFbCbC07E302335Ef4230758e3d",
|
|
134
138
|
wNative: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
135
139
|
// Must implement USDC permit version 2 (otherwise breaks permit signatures).
|
|
136
140
|
usdc: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
@@ -147,6 +151,7 @@ exports.addressesRegistry = {
|
|
|
147
151
|
publicAllocator: "0x0d68a97324E602E02799CD83B42D337207B40658",
|
|
148
152
|
metaMorphoFactory: "0x3Bb6A6A0Bc85b367EFE0A5bAc81c5E52C892839a",
|
|
149
153
|
chainlinkOracleFactory: "0x1ec408D4131686f727F3Fd6245CF85Bc5c9DAD70",
|
|
154
|
+
preLiquidationFactory: "0x3d05C01EE8e97361b9E19D172128255eaE5F98B9",
|
|
150
155
|
wNative: "0x4200000000000000000000000000000000000006",
|
|
151
156
|
// Must implement USDC permit version 2 (otherwise breaks permit signatures).
|
|
152
157
|
usdc: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
|
|
@@ -161,6 +166,7 @@ exports.addressesRegistry = {
|
|
|
161
166
|
publicAllocator: "0xef9889B4e443DEd35FA0Bd060f2104Cca94e6A43",
|
|
162
167
|
metaMorphoFactory: "0x4DBB3a642a2146d5413750Cca3647086D9ba5F12",
|
|
163
168
|
chainlinkOracleFactory: "0xd706690BA1Fe26b70c4AD89e60ff62cEB3A2eD02",
|
|
169
|
+
preLiquidationFactory: "0xe3cE2051a24e58DBFC0eFBe4c2d9e89c5eAe4695",
|
|
164
170
|
wNative: "0x4200000000000000000000000000000000000006",
|
|
165
171
|
},
|
|
166
172
|
[chain_js_1.ChainId.FraxtalMainnet]: {
|
|
@@ -173,6 +179,7 @@ exports.addressesRegistry = {
|
|
|
173
179
|
publicAllocator: "0x37a888192165fC39884f87c64E2476BfD2C09675",
|
|
174
180
|
metaMorphoFactory: "0x27D4Af0AC9E7FDfA6D0853236f249CC27AE79488",
|
|
175
181
|
chainlinkOracleFactory: "0x39d8622C607A691D7705E8842fbB12E3c38dCD41",
|
|
182
|
+
preLiquidationFactory: "0xe3cE2051a24e58DBFC0eFBe4c2d9e89c5eAe4695",
|
|
176
183
|
wNative: "0xfc00000000000000000000000000000000000006",
|
|
177
184
|
},
|
|
178
185
|
[chain_js_1.ChainId.ScrollMainnet]: {
|
|
@@ -185,6 +192,7 @@ exports.addressesRegistry = {
|
|
|
185
192
|
publicAllocator: "0x8a7f671E45E51dE245649Cf916cA0256FB8a9927",
|
|
186
193
|
metaMorphoFactory: "0x56b65742ade55015e6480959808229Ad6dbc9295",
|
|
187
194
|
chainlinkOracleFactory: "0xb5961902E60b188b1c665B7b72Ef616656A9e24E",
|
|
195
|
+
preLiquidationFactory: "0xeD960178e4aDA0296786Fa79D84e8FDF7bd44B25",
|
|
188
196
|
wNative: "0x5300000000000000000000000000000000000004",
|
|
189
197
|
// Must implement USDC permit version 2 (otherwise breaks permit signatures).
|
|
190
198
|
usdc: "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4",
|
|
@@ -199,6 +207,7 @@ exports.addressesRegistry = {
|
|
|
199
207
|
publicAllocator: "0x85416891752a6B81106c1C2999AE1AF5d8Cd3357",
|
|
200
208
|
metaMorphoFactory: "0xd3f39505d0c48AFED3549D625982FdC38Ea9904b",
|
|
201
209
|
chainlinkOracleFactory: "0x3FFFE273ee348b9E1ef89533025C7f165B17B439",
|
|
210
|
+
preLiquidationFactory: "0x30607fEa77168d2c0401B6f60F0B40E32F9339E3",
|
|
202
211
|
wNative: "0x4200000000000000000000000000000000000006",
|
|
203
212
|
// Must implement USDC permit version 2 (otherwise breaks permit signatures).
|
|
204
213
|
usdc: "0xF1815bd50389c46847f0Bda824eC8da914045D14",
|
|
@@ -213,6 +222,7 @@ exports.addressesRegistry = {
|
|
|
213
222
|
publicAllocator: "0xB0c9a107fA17c779B3378210A7a593e88938C7C9",
|
|
214
223
|
metaMorphoFactory: "0xe9EdE3929F43a7062a007C3e8652e4ACa610Bdc0",
|
|
215
224
|
chainlinkOracleFactory: "0x43269546e1D586a1f7200a0AC07e26f9631f7539",
|
|
225
|
+
preLiquidationFactory: "0xb04e4D3D59Ee47Ca9BA192707AF13A7D02969911",
|
|
216
226
|
wNative: "0x4200000000000000000000000000000000000006",
|
|
217
227
|
// Must implement USDC permit version 2 (otherwise breaks permit signatures).
|
|
218
228
|
usdc: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
|
|
@@ -227,6 +237,7 @@ exports.addressesRegistry = {
|
|
|
227
237
|
publicAllocator: "0x6Cef2EDC70D87E8f1623f3096efF05d066E59B36",
|
|
228
238
|
metaMorphoFactory: "0x0cE9e3512CB4df8ae7e265e62Fb9258dc14f12e8",
|
|
229
239
|
chainlinkOracleFactory: "0x7DA59Fa482F1F49fADc486d8e47BADc506fEb86d",
|
|
240
|
+
preLiquidationFactory: "0xc72129DA4CC808e955699111b8c22B22Ca8A10b8",
|
|
230
241
|
wNative: "0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38",
|
|
231
242
|
},
|
|
232
243
|
[chain_js_1.ChainId.HemiMainnet]: {
|
|
@@ -239,6 +250,7 @@ exports.addressesRegistry = {
|
|
|
239
250
|
publicAllocator: "0x4107Ea1746909028d6212B315dE5fE9538F9eb39",
|
|
240
251
|
metaMorphoFactory: "0x8e52179BeB18E882040b01632440d8Ca0f01da82",
|
|
241
252
|
chainlinkOracleFactory: "0xB3cb32E6185446a6Bc7A047E4FfA138fA939e133",
|
|
253
|
+
preLiquidationFactory: "0x40F2896C551194e364F7C846046C34d8a9FE97e4",
|
|
242
254
|
wNative: "0x4200000000000000000000000000000000000006",
|
|
243
255
|
// Must implement USDC permit version 2 (otherwise breaks permit signatures).
|
|
244
256
|
usdc: "0xad11a8BEb98bbf61dbb1aa0F6d6F2ECD87b35afA",
|
|
@@ -253,6 +265,7 @@ exports.addressesRegistry = {
|
|
|
253
265
|
publicAllocator: "0xEE868Bf3359DA30c10ea472EAEBFC0a06E8F0120",
|
|
254
266
|
metaMorphoFactory: "0xae5b0884bfff430493D6C844B9fd052Af7d79278",
|
|
255
267
|
chainlinkOracleFactory: "0xf9380f7898423Bd7FDe3C9fDD1b2671A2471f39D",
|
|
268
|
+
preLiquidationFactory: "0x249E4808264c545861e43728186a731dE7c7D745",
|
|
256
269
|
wNative: "0x4200000000000000000000000000000000000006",
|
|
257
270
|
},
|
|
258
271
|
[chain_js_1.ChainId.CornMainnet]: {
|
|
@@ -265,10 +278,24 @@ exports.addressesRegistry = {
|
|
|
265
278
|
publicAllocator: "0xDFde06e2B2A2D718eE5560b73dA4F830E56A2f10",
|
|
266
279
|
metaMorphoFactory: "0xe430821595602eA5DD0cD350f86987437c7362fA",
|
|
267
280
|
chainlinkOracleFactory: "0x16278156D366fC91536b6b81482ffaC47EEa06D6",
|
|
281
|
+
preLiquidationFactory: "0xb9065AC18d3EBdb3263B77B587f9c5CD570545D1",
|
|
268
282
|
wNative: "0xda5dDd7270381A7C2717aD10D1c0ecB19e3CDFb2",
|
|
269
283
|
// Must implement USDC permit version 2 (otherwise breaks permit signatures).
|
|
270
284
|
usdc: "0xDF0B24095e15044538866576754F3C964e902Ee6",
|
|
271
285
|
},
|
|
286
|
+
[chain_js_1.ChainId.PlumeMainnet]: {
|
|
287
|
+
morpho: "0x42b18785CE0Aed7BF7Ca43a39471ED4C0A3e0bB5",
|
|
288
|
+
bundler3: {
|
|
289
|
+
bundler3: "0x5437C8788f4CFbaA55be6FBf30379bc7dd7f69C3",
|
|
290
|
+
generalAdapter1: "0x65ff368930Cb7eB4CA5C5eBC58bb69E6Ed198BA5",
|
|
291
|
+
},
|
|
292
|
+
adaptiveCurveIrm: "0x7420302Ddd469031Cd2282cd64225cCd46F581eA",
|
|
293
|
+
publicAllocator: "0x58485338D93F4e3b4Bf2Af1C9f9C0aDF087AEf1C",
|
|
294
|
+
metaMorphoFactory: "0x2525D453D9BA13921D5aB5D8c12F9202b0e19456",
|
|
295
|
+
chainlinkOracleFactory: "0x133F742c0D36864F37e15C33a18bA6fdc950ED0f",
|
|
296
|
+
preLiquidationFactory: "0xF184156Cf6Ad4D3dA7F6449D40755A0f9de97ef3",
|
|
297
|
+
wNative: "0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1",
|
|
298
|
+
},
|
|
272
299
|
};
|
|
273
300
|
exports.addresses = exports.addressesRegistry;
|
|
274
301
|
const getChainAddresses = (chainId) => {
|
|
@@ -313,6 +340,7 @@ exports.unwrappedTokensMapping = {
|
|
|
313
340
|
[chain_js_1.ChainId.HemiMainnet]: {},
|
|
314
341
|
[chain_js_1.ChainId.ModeMainnet]: {},
|
|
315
342
|
[chain_js_1.ChainId.CornMainnet]: {},
|
|
343
|
+
[chain_js_1.ChainId.PlumeMainnet]: {},
|
|
316
344
|
};
|
|
317
345
|
function getUnwrappedToken(wrappedToken, chainId) {
|
|
318
346
|
return exports.unwrappedTokensMapping[chainId][wrappedToken];
|
package/lib/chain.d.ts
CHANGED
package/lib/chain.js
CHANGED
|
@@ -17,6 +17,7 @@ var ChainId;
|
|
|
17
17
|
ChainId[ChainId["HemiMainnet"] = 43111] = "HemiMainnet";
|
|
18
18
|
ChainId[ChainId["ModeMainnet"] = 34443] = "ModeMainnet";
|
|
19
19
|
ChainId[ChainId["CornMainnet"] = 21000000] = "CornMainnet";
|
|
20
|
+
ChainId[ChainId["PlumeMainnet"] = 98866] = "PlumeMainnet";
|
|
20
21
|
})(ChainId || (exports.ChainId = ChainId = {}));
|
|
21
22
|
var ChainUtils;
|
|
22
23
|
(function (ChainUtils) {
|
|
@@ -131,5 +132,12 @@ var ChainUtils;
|
|
|
131
132
|
explorerUrl: "https://cornscan.io",
|
|
132
133
|
identifier: "corn",
|
|
133
134
|
},
|
|
135
|
+
[ChainId.PlumeMainnet]: {
|
|
136
|
+
name: "Plume",
|
|
137
|
+
id: ChainId.PlumeMainnet,
|
|
138
|
+
nativeCurrency: { name: "Plume", symbol: "PLUME", decimals: 18 },
|
|
139
|
+
explorerUrl: "https://phoenix-explorer.plumenetwork.xyz",
|
|
140
|
+
identifier: "plume",
|
|
141
|
+
},
|
|
134
142
|
};
|
|
135
143
|
})(ChainUtils || (exports.ChainUtils = ChainUtils = {}));
|
package/lib/errors.d.ts
CHANGED
|
@@ -21,7 +21,16 @@ export declare class UnsupportedChainIdError extends Error {
|
|
|
21
21
|
readonly chainId: number;
|
|
22
22
|
constructor(chainId: number);
|
|
23
23
|
}
|
|
24
|
+
export declare class UnsupportedPreLiquidationParamsError extends Error {
|
|
25
|
+
readonly lltv: bigint;
|
|
26
|
+
constructor(lltv: bigint);
|
|
27
|
+
}
|
|
24
28
|
export declare namespace BlueErrors {
|
|
29
|
+
class AlreadySet extends Error {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly value: string;
|
|
32
|
+
constructor(name: string, value: string);
|
|
33
|
+
}
|
|
25
34
|
class InvalidInterestAccrual extends Error {
|
|
26
35
|
readonly marketId: MarketId;
|
|
27
36
|
readonly timestamp: bigint;
|
package/lib/errors.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BlueErrors = 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
|
+
const viem_1 = require("viem");
|
|
5
6
|
class UnknownDataError extends Error {
|
|
6
7
|
}
|
|
7
8
|
exports.UnknownDataError = UnknownDataError;
|
|
@@ -45,8 +46,26 @@ class UnsupportedChainIdError extends Error {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
exports.UnsupportedChainIdError = UnsupportedChainIdError;
|
|
49
|
+
class UnsupportedPreLiquidationParamsError extends Error {
|
|
50
|
+
lltv;
|
|
51
|
+
constructor(lltv) {
|
|
52
|
+
super(`unsupported pre liquidation params for lltv ${(0, viem_1.formatUnits)(lltv, 16)}%`);
|
|
53
|
+
this.lltv = lltv;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.UnsupportedPreLiquidationParamsError = UnsupportedPreLiquidationParamsError;
|
|
48
57
|
var BlueErrors;
|
|
49
58
|
(function (BlueErrors) {
|
|
59
|
+
class AlreadySet extends Error {
|
|
60
|
+
name;
|
|
61
|
+
value;
|
|
62
|
+
constructor(name, value) {
|
|
63
|
+
super(`${name} is already set to ${value}`);
|
|
64
|
+
this.name = name;
|
|
65
|
+
this.value = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
BlueErrors.AlreadySet = AlreadySet;
|
|
50
69
|
class InvalidInterestAccrual extends Error {
|
|
51
70
|
marketId;
|
|
52
71
|
timestamp;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -26,3 +26,4 @@ __exportStar(require("./user/index.js"), exports);
|
|
|
26
26
|
__exportStar(require("./holding/index.js"), exports);
|
|
27
27
|
__exportStar(require("./position/index.js"), exports);
|
|
28
28
|
__exportStar(require("./vault/index.js"), exports);
|
|
29
|
+
__exportStar(require("./preLiquidation.js"), exports);
|
package/lib/market/Market.d.ts
CHANGED
|
@@ -275,7 +275,7 @@ export declare class Market implements IMarket {
|
|
|
275
275
|
getHealthFactor(position: {
|
|
276
276
|
collateral: bigint;
|
|
277
277
|
borrowShares: bigint;
|
|
278
|
-
}): bigint |
|
|
278
|
+
}): bigint | undefined;
|
|
279
279
|
/**
|
|
280
280
|
* Returns the loan-to-value ratio of a given borrow position (scaled by WAD).
|
|
281
281
|
* @param position The borrow position to consider.
|
|
@@ -225,8 +225,8 @@ export declare namespace MarketUtils {
|
|
|
225
225
|
}): bigint | null | undefined;
|
|
226
226
|
/**
|
|
227
227
|
* Returns the health factor of a given borrow position (scaled by WAD).
|
|
228
|
+
* If the debt is 0, health factor is `MaxUint256`.
|
|
228
229
|
* Returns `undefined` iff the market's price is undefined.
|
|
229
|
-
* Returns null if the position is not a borrow.
|
|
230
230
|
*/
|
|
231
231
|
function getHealthFactor({ collateral, borrowShares, }: {
|
|
232
232
|
collateral: BigIntish;
|
|
@@ -237,7 +237,7 @@ export declare namespace MarketUtils {
|
|
|
237
237
|
price?: BigIntish;
|
|
238
238
|
}, marketParams: {
|
|
239
239
|
lltv: BigIntish;
|
|
240
|
-
}): bigint |
|
|
240
|
+
}): bigint | undefined;
|
|
241
241
|
/**
|
|
242
242
|
* Returns the loan-to-value ratio of a given borrow position (scaled by WAD).
|
|
243
243
|
* Returns `undefined` iff the market's price is undefined.
|
|
@@ -272,14 +272,10 @@ var MarketUtils;
|
|
|
272
272
|
MarketUtils.getPriceVariationToLiquidationPrice = getPriceVariationToLiquidationPrice;
|
|
273
273
|
/**
|
|
274
274
|
* Returns the health factor of a given borrow position (scaled by WAD).
|
|
275
|
+
* If the debt is 0, health factor is `MaxUint256`.
|
|
275
276
|
* Returns `undefined` iff the market's price is undefined.
|
|
276
|
-
* Returns null if the position is not a borrow.
|
|
277
277
|
*/
|
|
278
278
|
function getHealthFactor({ collateral, borrowShares, }, market, marketParams) {
|
|
279
|
-
borrowShares = BigInt(borrowShares);
|
|
280
|
-
market.totalBorrowShares = BigInt(market.totalBorrowShares);
|
|
281
|
-
if (borrowShares === 0n || market.totalBorrowShares === 0n)
|
|
282
|
-
return null;
|
|
283
279
|
const borrowAssets = toBorrowAssets(borrowShares, market);
|
|
284
280
|
if (borrowAssets === 0n)
|
|
285
281
|
return index_js_1.MathLib.MAX_UINT_256;
|
|
@@ -33,66 +33,73 @@ export declare class Position implements IPosition {
|
|
|
33
33
|
export interface IAccrualPosition extends Omit<IPosition, "marketId"> {
|
|
34
34
|
}
|
|
35
35
|
export declare class AccrualPosition extends Position implements IAccrualPosition {
|
|
36
|
+
protected readonly _market: Market;
|
|
37
|
+
constructor(position: IAccrualPosition, market: IMarket);
|
|
36
38
|
/**
|
|
37
39
|
* The market on which this position is held.
|
|
38
40
|
*/
|
|
39
|
-
|
|
40
|
-
constructor(position: IAccrualPosition, market: IMarket);
|
|
41
|
+
get market(): Market;
|
|
41
42
|
get supplyAssets(): bigint;
|
|
42
43
|
get borrowAssets(): bigint;
|
|
43
44
|
/**
|
|
44
45
|
* The value of this position's collateral quoted in loan assets.
|
|
45
|
-
* `undefined`
|
|
46
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
46
47
|
*/
|
|
47
48
|
get collateralValue(): bigint | undefined;
|
|
48
49
|
/**
|
|
49
50
|
* The maximum amount of loan assets that can be borrowed against this position's collateral.
|
|
50
|
-
* `undefined`
|
|
51
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
51
52
|
*/
|
|
52
53
|
get maxBorrowAssets(): bigint | undefined;
|
|
53
54
|
/**
|
|
54
55
|
* The maximum additional amount of assets that can be borrowed against this position's collateral.
|
|
55
|
-
* `undefined`
|
|
56
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
56
57
|
*/
|
|
57
58
|
get maxBorrowableAssets(): bigint | undefined;
|
|
58
59
|
/**
|
|
59
60
|
* The maximum amount of collateral that can be seized in exchange for the outstanding debt.
|
|
60
|
-
* `undefined`
|
|
61
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
61
62
|
*/
|
|
62
63
|
get seizableCollateral(): bigint | undefined;
|
|
63
64
|
/**
|
|
64
65
|
* The maximum amount of collateral that can be withdrawn.
|
|
65
|
-
* `undefined`
|
|
66
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
66
67
|
*/
|
|
67
68
|
get withdrawableCollateral(): bigint | undefined;
|
|
68
69
|
/**
|
|
69
70
|
* Whether this position is healthy.
|
|
70
|
-
* `undefined`
|
|
71
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
71
72
|
*/
|
|
72
73
|
get isHealthy(): boolean | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Whether this position can be liquidated.
|
|
76
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
77
|
+
*/
|
|
78
|
+
get isLiquidatable(): boolean | undefined;
|
|
73
79
|
/**
|
|
74
80
|
* The price of the collateral quoted in loan assets that would allow this position to be liquidated.
|
|
81
|
+
* `null` if the position has no borrow.
|
|
75
82
|
*/
|
|
76
83
|
get liquidationPrice(): bigint | null;
|
|
77
84
|
/**
|
|
78
85
|
* The price variation required for the position to reach its liquidation threshold (scaled by WAD).
|
|
79
86
|
* Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
|
|
80
|
-
* `undefined`
|
|
81
|
-
*
|
|
87
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
88
|
+
* `null` if the position is not a borrow.
|
|
82
89
|
*/
|
|
83
90
|
get priceVariationToLiquidationPrice(): bigint | null | undefined;
|
|
84
91
|
/**
|
|
85
92
|
* This position's Loan-To-Value (debt over collateral power, scaled by WAD).
|
|
86
93
|
* If the collateral price is 0, LTV is `MaxUint256`.
|
|
87
|
-
* `undefined`
|
|
94
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
88
95
|
*/
|
|
89
96
|
get ltv(): bigint | null | undefined;
|
|
90
97
|
/**
|
|
91
98
|
* This position's health factor (collateral power over debt, scaled by WAD).
|
|
92
99
|
* If the debt is 0, health factor is `MaxUint256`.
|
|
93
|
-
* `undefined`
|
|
100
|
+
* `undefined` if the market's oracle is undefined or reverts.
|
|
94
101
|
*/
|
|
95
|
-
get healthFactor(): bigint |
|
|
102
|
+
get healthFactor(): bigint | undefined;
|
|
96
103
|
/**
|
|
97
104
|
* The percentage of this position's borrow power currently used (scaled by WAD).
|
|
98
105
|
* If the collateral price is 0, usage is `MaxUint256`.
|