@morpho-org/blue-sdk 1.11.2 → 1.12.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.
@@ -17,6 +17,7 @@ export declare const addresses: {
17
17
  compoundV2Bundler: "0x26bf52a84360ad3d01d7cdc28fc2ddc04d8c8647";
18
18
  adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC";
19
19
  publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D";
20
+ metaMorphoFactory: "0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101";
20
21
  wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
21
22
  morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999";
22
23
  dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F";
@@ -53,6 +54,7 @@ export declare const addresses: {
53
54
  compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA";
54
55
  adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687";
55
56
  publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467";
57
+ metaMorphoFactory: "0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101";
56
58
  wNative: "0x4200000000000000000000000000000000000006";
57
59
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
58
60
  verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b";
@@ -68,8 +70,9 @@ export interface ChainAddresses {
68
70
  aaveV3Bundler?: Address;
69
71
  compoundV3Bundler?: Address;
70
72
  compoundV2Bundler?: Address;
71
- adaptiveCurveIrm?: Address;
72
- publicAllocator?: Address;
73
+ adaptiveCurveIrm: Address;
74
+ publicAllocator: Address;
75
+ metaMorphoFactory: Address;
73
76
  wNative: Address;
74
77
  morphoToken?: Address;
75
78
  dai?: Address;
package/lib/addresses.js CHANGED
@@ -22,6 +22,7 @@ exports.addresses = {
22
22
  compoundV2Bundler: "0x26bf52a84360ad3d01d7cdc28fc2ddc04d8c8647",
23
23
  adaptiveCurveIrm: "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
24
24
  publicAllocator: "0xfd32fA2ca22c76dD6E550706Ad913FC6CE91c75D",
25
+ metaMorphoFactory: "0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101",
25
26
  wNative: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
26
27
  morphoToken: "0x9994E35Db50125E0DF82e4c2dde62496CE330999",
27
28
  dai: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
@@ -62,6 +63,7 @@ exports.addresses = {
62
63
  compoundV3Bundler: "0x1f8076e2EB6f10b12e6886f30D4909A91969F7dA",
63
64
  adaptiveCurveIrm: "0x46415998764C29aB2a25CbeA6254146D50D22687",
64
65
  publicAllocator: "0xA090dD1a701408Df1d4d0B85b716c87565f90467",
66
+ metaMorphoFactory: "0xA9c3D3a366466Fa809d1Ae982Fb2c46E5fC41101",
65
67
  wNative: "0x4200000000000000000000000000000000000006",
66
68
  usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
67
69
  verUsdc: "0x59aaF835D34b1E3dF2170e4872B785f11E2a964b",
@@ -249,10 +249,12 @@ export declare class Market implements InputMarket {
249
249
  borrowShares: bigint;
250
250
  }): bigint | null;
251
251
  /**
252
- * Returns the price deviation required for the given borrow position to be unhealthy (scaled by WAD).
252
+ * Returns the price variation required for the given position to reach its liquidation threshold (scaled by WAD).
253
+ * Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
254
+ * Returns null if the position is not a borrow.
253
255
  * @param position The borrow position to consider.
254
256
  */
255
- getPriceVariationToLiquidation(position: {
257
+ getPriceVariationToLiquidationPrice(position: {
256
258
  collateral: bigint;
257
259
  borrowShares: bigint;
258
260
  }): bigint | null;
@@ -336,11 +336,13 @@ class Market {
336
336
  return MarketUtils_1.MarketUtils.getLiquidationPrice(position, this, this.config);
337
337
  }
338
338
  /**
339
- * Returns the price deviation required for the given borrow position to be unhealthy (scaled by WAD).
339
+ * Returns the price variation required for the given position to reach its liquidation threshold (scaled by WAD).
340
+ * Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
341
+ * Returns null if the position is not a borrow.
340
342
  * @param position The borrow position to consider.
341
343
  */
342
- getPriceVariationToLiquidation(position) {
343
- return MarketUtils_1.MarketUtils.getPriceVariationToLiquidation(position, this, this.config);
344
+ getPriceVariationToLiquidationPrice(position) {
345
+ return MarketUtils_1.MarketUtils.getPriceVariationToLiquidationPrice(position, this, this.config);
344
346
  }
345
347
  /**
346
348
  * Returns the health factor of a given borrow position (scaled by WAD).
@@ -160,7 +160,7 @@ export declare namespace MarketUtils {
160
160
  /**
161
161
  * Returns the price of the collateral quoted in the loan token (e.g. ETH/DAI)
162
162
  * that set the user's position to be liquidatable.
163
- * Returns null if the user is not a borrower
163
+ * Returns null if the position is not a borrow.
164
164
  */
165
165
  function getLiquidationPrice({ collateral, borrowShares, }: {
166
166
  collateral: BigIntish;
@@ -172,10 +172,11 @@ export declare namespace MarketUtils {
172
172
  lltv: BigIntish;
173
173
  }): bigint | null;
174
174
  /**
175
- * Returns the price deviation required for the given borrow position to be unhealthy (scaled by WAD).
176
- * @param position The borrow position to consider.
175
+ * Returns the price variation required for the given position to reach its liquidation threshold (scaled by WAD).
176
+ * Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
177
+ * Returns null if the position is not a borrow.
177
178
  */
178
- function getPriceVariationToLiquidation(position: {
179
+ function getPriceVariationToLiquidationPrice(position: {
179
180
  collateral: BigIntish;
180
181
  borrowShares: BigIntish;
181
182
  }, market: {
@@ -184,7 +184,7 @@ var MarketUtils;
184
184
  /**
185
185
  * Returns the price of the collateral quoted in the loan token (e.g. ETH/DAI)
186
186
  * that set the user's position to be liquidatable.
187
- * Returns null if the user is not a borrower
187
+ * Returns null if the position is not a borrow.
188
188
  */
189
189
  function getLiquidationPrice({ collateral, borrowShares, }, market, marketConfig) {
190
190
  borrowShares = BigInt(borrowShares);
@@ -199,19 +199,20 @@ var MarketUtils;
199
199
  }
200
200
  MarketUtils.getLiquidationPrice = getLiquidationPrice;
201
201
  /**
202
- * Returns the price deviation required for the given borrow position to be unhealthy (scaled by WAD).
203
- * @param position The borrow position to consider.
202
+ * Returns the price variation required for the given position to reach its liquidation threshold (scaled by WAD).
203
+ * Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
204
+ * Returns null if the position is not a borrow.
204
205
  */
205
- function getPriceVariationToLiquidation(position, market, marketConfig) {
206
+ function getPriceVariationToLiquidationPrice(position, market, marketConfig) {
206
207
  market.price = BigInt(market.price);
207
208
  if (market.price === 0n)
208
209
  return null;
209
210
  const liquidationPrice = getLiquidationPrice(position, market, marketConfig);
210
211
  if (liquidationPrice == null)
211
212
  return null;
212
- return maths_1.MathLib.WAD - maths_1.MathLib.wDivUp(liquidationPrice, market.price);
213
+ return maths_1.MathLib.wDivUp(liquidationPrice, market.price) - maths_1.MathLib.WAD;
213
214
  }
214
- MarketUtils.getPriceVariationToLiquidation = getPriceVariationToLiquidation;
215
+ MarketUtils.getPriceVariationToLiquidationPrice = getPriceVariationToLiquidationPrice;
215
216
  function getHealthFactor({ collateral, borrowShares, }, market, marketConfig) {
216
217
  borrowShares = BigInt(borrowShares);
217
218
  market.totalBorrowShares = BigInt(market.totalBorrowShares);
@@ -69,10 +69,11 @@ export declare class AccrualPosition extends Position implements InputAccrualPos
69
69
  */
70
70
  get liquidationPrice(): bigint | null;
71
71
  /**
72
- * The variation of the price of the collateral quoted in loan assets that would allow this position to be liquidated,
73
- * relative to the current collateral price (scaled by WAD).
72
+ * The price variation required for the position to reach its liquidation threshold (scaled by WAD).
73
+ * Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
74
+ * Returns null if the position is not a borrow.
74
75
  */
75
- get priceVariationToLiquidation(): bigint | null;
76
+ get priceVariationToLiquidationPrice(): bigint | null;
76
77
  /**
77
78
  * This position's Loan-To-Value (debt over collateral power, scaled by WAD).
78
79
  * If the collateral price is 0, LTV is `MaxUint256`.
@@ -91,11 +91,12 @@ class AccrualPosition extends Position {
91
91
  return this.market.getLiquidationPrice(this);
92
92
  }
93
93
  /**
94
- * The variation of the price of the collateral quoted in loan assets that would allow this position to be liquidated,
95
- * relative to the current collateral price (scaled by WAD).
94
+ * The price variation required for the position to reach its liquidation threshold (scaled by WAD).
95
+ * Negative when healthy (the price needs to drop x%), positive when unhealthy (the price needs to soar x%).
96
+ * Returns null if the position is not a borrow.
96
97
  */
97
- get priceVariationToLiquidation() {
98
- return this.market.getPriceVariationToLiquidation(this);
98
+ get priceVariationToLiquidationPrice() {
99
+ return this.market.getPriceVariationToLiquidationPrice(this);
99
100
  }
100
101
  /**
101
102
  * This position's Loan-To-Value (debt over collateral power, scaled by WAD).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@morpho-org/blue-sdk",
3
- "version": "1.11.2",
3
+ "version": "1.12.1",
4
4
  "author": "Morpho Association <contact@morpho.org>",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -17,8 +17,8 @@
17
17
  "keccak256": "^1.0.6"
18
18
  },
19
19
  "devDependencies": {
20
- "@morpho-org/morpho-test": "^1.11.2",
21
- "@morpho-org/morpho-ts": "^1.11.2",
20
+ "@morpho-org/morpho-test": "^1.12.1",
21
+ "@morpho-org/morpho-ts": "^1.12.1",
22
22
  "@nomicfoundation/hardhat-ethers": "^3.0.6",
23
23
  "@nomicfoundation/hardhat-network-helpers": "^1.0.11",
24
24
  "@types/chai": "^4.3.14",
@@ -42,7 +42,7 @@
42
42
  "typescript": "^5.4.5"
43
43
  },
44
44
  "peerDependencies": {
45
- "@morpho-org/morpho-ts": "^1.11.2"
45
+ "@morpho-org/morpho-ts": "^1.12.1"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"
@@ -66,5 +66,5 @@
66
66
  ],
67
67
  "preset": "ts-jest"
68
68
  },
69
- "gitHead": "73b7dbbb6d497b9ba99dd35bda24c678c65c13e4"
69
+ "gitHead": "8f982e2dc5931ba1a117bc11887f8c528a201058"
70
70
  }