@defisaver/positions-sdk 2.1.127-midnight-6-dev → 2.1.127-midnight-8-dev

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.
@@ -3,7 +3,7 @@ export { CompoundMarkets, compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCo
3
3
  export { SparkMarkets } from './spark';
4
4
  export { CrvUsdMarkets } from './curveUsd';
5
5
  export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
6
- export { MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket } from './morphoMidnight';
6
+ export { MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket, morphoMidnightMarketCollateralParams, } from './morphoMidnight';
7
7
  export { LlamaLendMarkets } from './llamaLend';
8
8
  export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
9
9
  export { EulerV2Markets } from './euler';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findAaveV4SpokeByAddress = exports.AaveV4Spokes = exports.getFluidMarketInfoByAddress = exports.getFTokenAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.EulerV2Markets = exports.findLiquityV2MarketByAddress = exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.isTenorMidnightMarket = exports.findMorphoMidnightMarket = exports.MorphoMidnightMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = exports.AaveMarkets = void 0;
3
+ exports.findAaveV4SpokeByAddress = exports.AaveV4Spokes = exports.getFluidMarketInfoByAddress = exports.getFTokenAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.EulerV2Markets = exports.findLiquityV2MarketByAddress = exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.morphoMidnightMarketCollateralParams = exports.isTenorMidnightMarket = exports.findMorphoMidnightMarket = exports.MorphoMidnightMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = exports.AaveMarkets = void 0;
4
4
  var aave_1 = require("./aave");
5
5
  Object.defineProperty(exports, "AaveMarkets", { enumerable: true, get: function () { return aave_1.AaveMarkets; } });
6
6
  Object.defineProperty(exports, "aaveV1AssetsDefaultMarket", { enumerable: true, get: function () { return aave_1.aaveV1AssetsDefaultMarket; } });
@@ -26,6 +26,7 @@ var morphoMidnight_1 = require("./morphoMidnight");
26
26
  Object.defineProperty(exports, "MorphoMidnightMarkets", { enumerable: true, get: function () { return morphoMidnight_1.MorphoMidnightMarkets; } });
27
27
  Object.defineProperty(exports, "findMorphoMidnightMarket", { enumerable: true, get: function () { return morphoMidnight_1.findMorphoMidnightMarket; } });
28
28
  Object.defineProperty(exports, "isTenorMidnightMarket", { enumerable: true, get: function () { return morphoMidnight_1.isTenorMidnightMarket; } });
29
+ Object.defineProperty(exports, "morphoMidnightMarketCollateralParams", { enumerable: true, get: function () { return morphoMidnight_1.morphoMidnightMarketCollateralParams; } });
29
30
  var llamaLend_1 = require("./llamaLend");
30
31
  Object.defineProperty(exports, "LlamaLendMarkets", { enumerable: true, get: function () { return llamaLend_1.LlamaLendMarkets; } });
31
32
  var liquityV2_1 = require("./liquityV2");
@@ -1,4 +1,4 @@
1
- import { MorphoMidnightMarketData, NetworkNumber } from '../../types';
1
+ import { MorphoMidnightCollateralParams, MorphoMidnightMarketData, NetworkNumber } from '../../types';
2
2
  /**
3
3
  * Morpho Midnight core contract on Base. Every Midnight market trades against this one, whoever curates
4
4
  * its order book — it is part of the market struct the id is hashed from, and it is what offer tuples
@@ -51,3 +51,10 @@ export declare const MorphoMidnightMarkets: (networkId: NetworkNumber) => {
51
51
  };
52
52
  export declare const isTenorMidnightMarket: (market: Pick<MorphoMidnightMarketData, "curator"> | string) => boolean;
53
53
  export declare const findMorphoMidnightMarket: (marketId: string, network?: NetworkNumber) => MorphoMidnightMarketData | undefined;
54
+ /**
55
+ * The market's collateral set as the chain knows it: the listed collaterals followed by the curator's
56
+ * hidden ones. This — not `collaterals` — is what a `Market` struct takes, since the market id is the hash
57
+ * of that struct. Anything assembling one for a contract call goes through here so it can't quietly build
58
+ * a market of its own instead.
59
+ */
60
+ export declare const morphoMidnightMarketCollateralParams: (market: Pick<MorphoMidnightMarketData, "collaterals" | "hiddenCollaterals">) => MorphoMidnightCollateralParams[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findMorphoMidnightMarket = exports.isTenorMidnightMarket = exports.MorphoMidnightMarkets = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261217 = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261119 = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261022 = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260924 = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260827 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261217 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261119 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261022 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260924 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260827 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261217 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261119 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261022 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260924 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260827 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20261225 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20261127 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20261030 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20260925 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20260828 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20260731 = exports.MIDNIGHT_BASE = void 0;
3
+ exports.morphoMidnightMarketCollateralParams = exports.findMorphoMidnightMarket = exports.isTenorMidnightMarket = exports.MorphoMidnightMarkets = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261217 = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261119 = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261022 = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260924 = exports.MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260827 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261217 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261119 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261022 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260924 = exports.MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260827 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261217 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261119 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261022 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260924 = exports.MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260827 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20261225 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20261127 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20261030 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20260925 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20260828 = exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20260731 = exports.MIDNIGHT_BASE = void 0;
4
4
  const types_1 = require("../../types");
5
5
  const constants_1 = require("../../constants");
6
6
  /**
@@ -13,6 +13,12 @@ const USDC_BASE = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
13
13
  const WETH_BASE = '0x4200000000000000000000000000000000000006';
14
14
  const CBBTC_BASE = '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf';
15
15
  const CBETH_BASE = '0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22';
16
+ // Tenor's ERC-4626 collateral vaults, one per pair and shared by that pair's whole maturity ladder. Each
17
+ // is a collateral of its markets on-chain without being an asset the app deals in — see the note above
18
+ // the Tenor markets below, and https://www.docs.tenor.finance/technical-docs/addresses/#vaults.
19
+ const TENOR_CBBTC_USDC_VAULT_BASE = '0xf6a70085b7f79FA76B04EbF7A2D7D87C3c5c04BC';
20
+ const TENOR_WETH_USDC_VAULT_BASE = '0xe690a58EF52854513462745237F6A213a0d54dF1';
21
+ const TENOR_CBETH_WETH_VAULT_BASE = '0xFa750DD0099eAdB72d401244De73ce7B89edf90F';
16
22
  // Sourced from the official listing at https://markets.morpho.org/fixed/base
17
23
  // BASE — USDC/cbBTC, 86% LLTV, monthly maturity ladder
18
24
  const MORPHO_MIDNIGHT_CBBTC_USDC_860_20260731 = (networkId = types_1.NetworkNumber.Base) => ({
@@ -164,10 +170,14 @@ exports.MORPHO_MIDNIGHT_CBBTC_USDC_860_20261225 = MORPHO_MIDNIGHT_CBBTC_USDC_860
164
170
  // collaterals — the pair's own token at index 0, and Tenor's ERC-4626 vault at index 1 (98% LLTV; the
165
171
  // `metadata.vault` of the parent tenor market, listed at
166
172
  // https://www.docs.tenor.finance/technical-docs/addresses/#vaults). The vault is not an asset the app
167
- // deals in, so these are modelled as single-collateral markets: the app supplies and prices index 0, and
168
- // the SDK reads `prices[i]` / `collateral[i]` positionally, so listing the primary alone keeps those
169
- // lookups aligned. The on-chain take path is unaffected offer tuples carry the market's full collateral
170
- // set straight from the router's offer JSON, which is what the market hash is built from.
173
+ // deals in, so it is split out into `hiddenCollaterals` instead of `collaterals`: everything that renders
174
+ // or prices a position sees a single-collateral market, and because the vault stays the *suffix* of the
175
+ // set, the SDK's positional `prices[i]` / `collateral[i]` reads stay aligned with `collaterals`.
176
+ //
177
+ // It is only split out, never dropped: the market id is the hash of the full struct, so a `Market` handed
178
+ // to the core has to be `[...collaterals, ...hiddenCollaterals]` or the call addresses a market of its own
179
+ // making. The take path builds no struct — offer tuples carry the market's full collateral set straight
180
+ // from the router's offer JSON.
171
181
  const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260827 = (networkId = types_1.NetworkNumber.Base) => ({
172
182
  chainIds: [types_1.NetworkNumber.Base],
173
183
  label: 'Tenor cbBTC/USDC',
@@ -182,6 +192,12 @@ const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260827 = (networkId = types_1.Netwo
182
192
  liquidationCursor: '300000000000000000',
183
193
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
184
194
  }],
195
+ hiddenCollaterals: [{
196
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
197
+ lltv: 0.98,
198
+ liquidationCursor: '300000000000000000',
199
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
200
+ }],
185
201
  maturity: 1787788800, // 2026-08-27T00:00:00Z
186
202
  rcfThreshold: '3000000000',
187
203
  enterGate: constants_1.ZERO_ADDRESS,
@@ -205,6 +221,12 @@ const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260924 = (networkId = types_1.Netwo
205
221
  liquidationCursor: '300000000000000000',
206
222
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
207
223
  }],
224
+ hiddenCollaterals: [{
225
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
226
+ lltv: 0.98,
227
+ liquidationCursor: '300000000000000000',
228
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
229
+ }],
208
230
  maturity: 1790208000, // 2026-09-24T00:00:00Z
209
231
  rcfThreshold: '3000000000',
210
232
  enterGate: constants_1.ZERO_ADDRESS,
@@ -228,6 +250,12 @@ const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261022 = (networkId = types_1.Netwo
228
250
  liquidationCursor: '300000000000000000',
229
251
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
230
252
  }],
253
+ hiddenCollaterals: [{
254
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
255
+ lltv: 0.98,
256
+ liquidationCursor: '300000000000000000',
257
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
258
+ }],
231
259
  maturity: 1792627200, // 2026-10-22T00:00:00Z
232
260
  rcfThreshold: '3000000000',
233
261
  enterGate: constants_1.ZERO_ADDRESS,
@@ -251,6 +279,12 @@ const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261119 = (networkId = types_1.Netwo
251
279
  liquidationCursor: '300000000000000000',
252
280
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
253
281
  }],
282
+ hiddenCollaterals: [{
283
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
284
+ lltv: 0.98,
285
+ liquidationCursor: '300000000000000000',
286
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
287
+ }],
254
288
  maturity: 1795046400, // 2026-11-19T00:00:00Z
255
289
  rcfThreshold: '3000000000',
256
290
  enterGate: constants_1.ZERO_ADDRESS,
@@ -274,6 +308,12 @@ const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261217 = (networkId = types_1.Netwo
274
308
  liquidationCursor: '300000000000000000',
275
309
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
276
310
  }],
311
+ hiddenCollaterals: [{
312
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
313
+ lltv: 0.98,
314
+ liquidationCursor: '300000000000000000',
315
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
316
+ }],
277
317
  maturity: 1797465600, // 2026-12-17T00:00:00Z
278
318
  rcfThreshold: '3000000000',
279
319
  enterGate: constants_1.ZERO_ADDRESS,
@@ -297,6 +337,12 @@ const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260827 = (networkId = types_1.Networ
297
337
  liquidationCursor: '300000000000000000',
298
338
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
299
339
  }],
340
+ hiddenCollaterals: [{
341
+ token: TENOR_WETH_USDC_VAULT_BASE,
342
+ lltv: 0.98,
343
+ liquidationCursor: '300000000000000000',
344
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
345
+ }],
300
346
  maturity: 1787788800,
301
347
  rcfThreshold: '3000000000',
302
348
  enterGate: constants_1.ZERO_ADDRESS,
@@ -320,6 +366,12 @@ const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260924 = (networkId = types_1.Networ
320
366
  liquidationCursor: '300000000000000000',
321
367
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
322
368
  }],
369
+ hiddenCollaterals: [{
370
+ token: TENOR_WETH_USDC_VAULT_BASE,
371
+ lltv: 0.98,
372
+ liquidationCursor: '300000000000000000',
373
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
374
+ }],
323
375
  maturity: 1790208000,
324
376
  rcfThreshold: '3000000000',
325
377
  enterGate: constants_1.ZERO_ADDRESS,
@@ -343,6 +395,12 @@ const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261022 = (networkId = types_1.Networ
343
395
  liquidationCursor: '300000000000000000',
344
396
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
345
397
  }],
398
+ hiddenCollaterals: [{
399
+ token: TENOR_WETH_USDC_VAULT_BASE,
400
+ lltv: 0.98,
401
+ liquidationCursor: '300000000000000000',
402
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
403
+ }],
346
404
  maturity: 1792627200,
347
405
  rcfThreshold: '3000000000',
348
406
  enterGate: constants_1.ZERO_ADDRESS,
@@ -366,6 +424,12 @@ const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261119 = (networkId = types_1.Networ
366
424
  liquidationCursor: '300000000000000000',
367
425
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
368
426
  }],
427
+ hiddenCollaterals: [{
428
+ token: TENOR_WETH_USDC_VAULT_BASE,
429
+ lltv: 0.98,
430
+ liquidationCursor: '300000000000000000',
431
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
432
+ }],
369
433
  maturity: 1795046400,
370
434
  rcfThreshold: '3000000000',
371
435
  enterGate: constants_1.ZERO_ADDRESS,
@@ -389,6 +453,12 @@ const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261217 = (networkId = types_1.Networ
389
453
  liquidationCursor: '300000000000000000',
390
454
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
391
455
  }],
456
+ hiddenCollaterals: [{
457
+ token: TENOR_WETH_USDC_VAULT_BASE,
458
+ lltv: 0.98,
459
+ liquidationCursor: '300000000000000000',
460
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
461
+ }],
392
462
  maturity: 1797465600,
393
463
  rcfThreshold: '3000000000',
394
464
  enterGate: constants_1.ZERO_ADDRESS,
@@ -412,6 +482,12 @@ const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260827 = (networkId = types_1.Netwo
412
482
  liquidationCursor: '300000000000000000',
413
483
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
414
484
  }],
485
+ hiddenCollaterals: [{
486
+ token: TENOR_CBETH_WETH_VAULT_BASE,
487
+ lltv: 0.98,
488
+ liquidationCursor: '300000000000000000',
489
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
490
+ }],
415
491
  maturity: 1787788800,
416
492
  rcfThreshold: '4000000000000000000',
417
493
  enterGate: constants_1.ZERO_ADDRESS,
@@ -435,6 +511,12 @@ const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260924 = (networkId = types_1.Netwo
435
511
  liquidationCursor: '300000000000000000',
436
512
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
437
513
  }],
514
+ hiddenCollaterals: [{
515
+ token: TENOR_CBETH_WETH_VAULT_BASE,
516
+ lltv: 0.98,
517
+ liquidationCursor: '300000000000000000',
518
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
519
+ }],
438
520
  maturity: 1790208000,
439
521
  rcfThreshold: '4000000000000000000',
440
522
  enterGate: constants_1.ZERO_ADDRESS,
@@ -458,6 +540,12 @@ const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261022 = (networkId = types_1.Netwo
458
540
  liquidationCursor: '300000000000000000',
459
541
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
460
542
  }],
543
+ hiddenCollaterals: [{
544
+ token: TENOR_CBETH_WETH_VAULT_BASE,
545
+ lltv: 0.98,
546
+ liquidationCursor: '300000000000000000',
547
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
548
+ }],
461
549
  maturity: 1792627200,
462
550
  rcfThreshold: '4000000000000000000',
463
551
  enterGate: constants_1.ZERO_ADDRESS,
@@ -481,6 +569,12 @@ const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261119 = (networkId = types_1.Netwo
481
569
  liquidationCursor: '300000000000000000',
482
570
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
483
571
  }],
572
+ hiddenCollaterals: [{
573
+ token: TENOR_CBETH_WETH_VAULT_BASE,
574
+ lltv: 0.98,
575
+ liquidationCursor: '300000000000000000',
576
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
577
+ }],
484
578
  maturity: 1795046400,
485
579
  rcfThreshold: '4000000000000000000',
486
580
  enterGate: constants_1.ZERO_ADDRESS,
@@ -504,6 +598,12 @@ const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261217 = (networkId = types_1.Netwo
504
598
  liquidationCursor: '300000000000000000',
505
599
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
506
600
  }],
601
+ hiddenCollaterals: [{
602
+ token: TENOR_CBETH_WETH_VAULT_BASE,
603
+ lltv: 0.98,
604
+ liquidationCursor: '300000000000000000',
605
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
606
+ }],
507
607
  maturity: 1797465600,
508
608
  rcfThreshold: '4000000000000000000',
509
609
  enterGate: constants_1.ZERO_ADDRESS,
@@ -549,3 +649,11 @@ const isTenorMidnightMarket = (market) => (typeof market === 'string'
549
649
  exports.isTenorMidnightMarket = isTenorMidnightMarket;
550
650
  const findMorphoMidnightMarket = (marketId, network = types_1.NetworkNumber.Base) => Object.values((0, exports.MorphoMidnightMarkets)(network)).find((market) => market.marketId.toLowerCase() === marketId.toLowerCase());
551
651
  exports.findMorphoMidnightMarket = findMorphoMidnightMarket;
652
+ /**
653
+ * The market's collateral set as the chain knows it: the listed collaterals followed by the curator's
654
+ * hidden ones. This — not `collaterals` — is what a `Market` struct takes, since the market id is the hash
655
+ * of that struct. Anything assembling one for a contract call goes through here so it can't quietly build
656
+ * a market of its own instead.
657
+ */
658
+ const morphoMidnightMarketCollateralParams = (market) => [...market.collaterals, ...(market.hiddenCollaterals || [])];
659
+ exports.morphoMidnightMarketCollateralParams = morphoMidnightMarketCollateralParams;
@@ -72,7 +72,7 @@ function _getMorphoMidnightMarketData(provider, network, selectedMarket) {
72
72
  borrowRate: '0',
73
73
  totalSupply: (0, tokens_1.assetAmountInEth)(totalUnits, loanSym),
74
74
  totalBorrow: (0, tokens_1.assetAmountInEth)(totalDebt, loanSym),
75
- canBeSupplied: true,
75
+ canBeSupplied: false,
76
76
  canBeBorrowed: true,
77
77
  supplyIncentives: [],
78
78
  borrowIncentives: [],
@@ -38,6 +38,10 @@ export interface MorphoMidnightMarketData {
38
38
  midnight: EthAddress;
39
39
  loanToken: EthAddress;
40
40
  collaterals: MorphoMidnightCollateralParams[];
41
+ /**
42
+ * Tenor's curated markets list the curator's own vault share token next to the real collateral.
43
+ */
44
+ hiddenCollaterals?: MorphoMidnightCollateralParams[];
41
45
  maturity: number;
42
46
  rcfThreshold: number | string;
43
47
  enterGate: EthAddress;
@@ -3,7 +3,7 @@ export { CompoundMarkets, compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCo
3
3
  export { SparkMarkets } from './spark';
4
4
  export { CrvUsdMarkets } from './curveUsd';
5
5
  export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
6
- export { MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket } from './morphoMidnight';
6
+ export { MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket, morphoMidnightMarketCollateralParams, } from './morphoMidnight';
7
7
  export { LlamaLendMarkets } from './llamaLend';
8
8
  export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
9
9
  export { EulerV2Markets } from './euler';
@@ -3,7 +3,7 @@ export { CompoundMarkets, compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCo
3
3
  export { SparkMarkets } from './spark';
4
4
  export { CrvUsdMarkets } from './curveUsd';
5
5
  export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
6
- export { MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket } from './morphoMidnight';
6
+ export { MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket, morphoMidnightMarketCollateralParams, } from './morphoMidnight';
7
7
  export { LlamaLendMarkets } from './llamaLend';
8
8
  export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
9
9
  export { EulerV2Markets } from './euler';
@@ -1,4 +1,4 @@
1
- import { MorphoMidnightMarketData, NetworkNumber } from '../../types';
1
+ import { MorphoMidnightCollateralParams, MorphoMidnightMarketData, NetworkNumber } from '../../types';
2
2
  /**
3
3
  * Morpho Midnight core contract on Base. Every Midnight market trades against this one, whoever curates
4
4
  * its order book — it is part of the market struct the id is hashed from, and it is what offer tuples
@@ -51,3 +51,10 @@ export declare const MorphoMidnightMarkets: (networkId: NetworkNumber) => {
51
51
  };
52
52
  export declare const isTenorMidnightMarket: (market: Pick<MorphoMidnightMarketData, "curator"> | string) => boolean;
53
53
  export declare const findMorphoMidnightMarket: (marketId: string, network?: NetworkNumber) => MorphoMidnightMarketData | undefined;
54
+ /**
55
+ * The market's collateral set as the chain knows it: the listed collaterals followed by the curator's
56
+ * hidden ones. This — not `collaterals` — is what a `Market` struct takes, since the market id is the hash
57
+ * of that struct. Anything assembling one for a contract call goes through here so it can't quietly build
58
+ * a market of its own instead.
59
+ */
60
+ export declare const morphoMidnightMarketCollateralParams: (market: Pick<MorphoMidnightMarketData, "collaterals" | "hiddenCollaterals">) => MorphoMidnightCollateralParams[];
@@ -1,4 +1,4 @@
1
- import { MorphoMidnightVersions, NetworkNumber } from '../../types';
1
+ import { MorphoMidnightVersions, NetworkNumber, } from '../../types';
2
2
  import { ZERO_ADDRESS } from '../../constants';
3
3
  /**
4
4
  * Morpho Midnight core contract on Base. Every Midnight market trades against this one, whoever curates
@@ -10,6 +10,12 @@ const USDC_BASE = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';
10
10
  const WETH_BASE = '0x4200000000000000000000000000000000000006';
11
11
  const CBBTC_BASE = '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf';
12
12
  const CBETH_BASE = '0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22';
13
+ // Tenor's ERC-4626 collateral vaults, one per pair and shared by that pair's whole maturity ladder. Each
14
+ // is a collateral of its markets on-chain without being an asset the app deals in — see the note above
15
+ // the Tenor markets below, and https://www.docs.tenor.finance/technical-docs/addresses/#vaults.
16
+ const TENOR_CBBTC_USDC_VAULT_BASE = '0xf6a70085b7f79FA76B04EbF7A2D7D87C3c5c04BC';
17
+ const TENOR_WETH_USDC_VAULT_BASE = '0xe690a58EF52854513462745237F6A213a0d54dF1';
18
+ const TENOR_CBETH_WETH_VAULT_BASE = '0xFa750DD0099eAdB72d401244De73ce7B89edf90F';
13
19
  // Sourced from the official listing at https://markets.morpho.org/fixed/base
14
20
  // BASE — USDC/cbBTC, 86% LLTV, monthly maturity ladder
15
21
  export const MORPHO_MIDNIGHT_CBBTC_USDC_860_20260731 = (networkId = NetworkNumber.Base) => ({
@@ -155,10 +161,14 @@ export const MORPHO_MIDNIGHT_CBBTC_USDC_860_20261225 = (networkId = NetworkNumbe
155
161
  // collaterals — the pair's own token at index 0, and Tenor's ERC-4626 vault at index 1 (98% LLTV; the
156
162
  // `metadata.vault` of the parent tenor market, listed at
157
163
  // https://www.docs.tenor.finance/technical-docs/addresses/#vaults). The vault is not an asset the app
158
- // deals in, so these are modelled as single-collateral markets: the app supplies and prices index 0, and
159
- // the SDK reads `prices[i]` / `collateral[i]` positionally, so listing the primary alone keeps those
160
- // lookups aligned. The on-chain take path is unaffected offer tuples carry the market's full collateral
161
- // set straight from the router's offer JSON, which is what the market hash is built from.
164
+ // deals in, so it is split out into `hiddenCollaterals` instead of `collaterals`: everything that renders
165
+ // or prices a position sees a single-collateral market, and because the vault stays the *suffix* of the
166
+ // set, the SDK's positional `prices[i]` / `collateral[i]` reads stay aligned with `collaterals`.
167
+ //
168
+ // It is only split out, never dropped: the market id is the hash of the full struct, so a `Market` handed
169
+ // to the core has to be `[...collaterals, ...hiddenCollaterals]` or the call addresses a market of its own
170
+ // making. The take path builds no struct — offer tuples carry the market's full collateral set straight
171
+ // from the router's offer JSON.
162
172
  export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260827 = (networkId = NetworkNumber.Base) => ({
163
173
  chainIds: [NetworkNumber.Base],
164
174
  label: 'Tenor cbBTC/USDC',
@@ -173,6 +183,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260827 = (networkId = Networ
173
183
  liquidationCursor: '300000000000000000',
174
184
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
175
185
  }],
186
+ hiddenCollaterals: [{
187
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
188
+ lltv: 0.98,
189
+ liquidationCursor: '300000000000000000',
190
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
191
+ }],
176
192
  maturity: 1787788800, // 2026-08-27T00:00:00Z
177
193
  rcfThreshold: '3000000000',
178
194
  enterGate: ZERO_ADDRESS,
@@ -195,6 +211,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260924 = (networkId = Networ
195
211
  liquidationCursor: '300000000000000000',
196
212
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
197
213
  }],
214
+ hiddenCollaterals: [{
215
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
216
+ lltv: 0.98,
217
+ liquidationCursor: '300000000000000000',
218
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
219
+ }],
198
220
  maturity: 1790208000, // 2026-09-24T00:00:00Z
199
221
  rcfThreshold: '3000000000',
200
222
  enterGate: ZERO_ADDRESS,
@@ -217,6 +239,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261022 = (networkId = Networ
217
239
  liquidationCursor: '300000000000000000',
218
240
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
219
241
  }],
242
+ hiddenCollaterals: [{
243
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
244
+ lltv: 0.98,
245
+ liquidationCursor: '300000000000000000',
246
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
247
+ }],
220
248
  maturity: 1792627200, // 2026-10-22T00:00:00Z
221
249
  rcfThreshold: '3000000000',
222
250
  enterGate: ZERO_ADDRESS,
@@ -239,6 +267,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261119 = (networkId = Networ
239
267
  liquidationCursor: '300000000000000000',
240
268
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
241
269
  }],
270
+ hiddenCollaterals: [{
271
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
272
+ lltv: 0.98,
273
+ liquidationCursor: '300000000000000000',
274
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
275
+ }],
242
276
  maturity: 1795046400, // 2026-11-19T00:00:00Z
243
277
  rcfThreshold: '3000000000',
244
278
  enterGate: ZERO_ADDRESS,
@@ -261,6 +295,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261217 = (networkId = Networ
261
295
  liquidationCursor: '300000000000000000',
262
296
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
263
297
  }],
298
+ hiddenCollaterals: [{
299
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
300
+ lltv: 0.98,
301
+ liquidationCursor: '300000000000000000',
302
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
303
+ }],
264
304
  maturity: 1797465600, // 2026-12-17T00:00:00Z
265
305
  rcfThreshold: '3000000000',
266
306
  enterGate: ZERO_ADDRESS,
@@ -283,6 +323,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260827 = (networkId = Network
283
323
  liquidationCursor: '300000000000000000',
284
324
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
285
325
  }],
326
+ hiddenCollaterals: [{
327
+ token: TENOR_WETH_USDC_VAULT_BASE,
328
+ lltv: 0.98,
329
+ liquidationCursor: '300000000000000000',
330
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
331
+ }],
286
332
  maturity: 1787788800,
287
333
  rcfThreshold: '3000000000',
288
334
  enterGate: ZERO_ADDRESS,
@@ -305,6 +351,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260924 = (networkId = Network
305
351
  liquidationCursor: '300000000000000000',
306
352
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
307
353
  }],
354
+ hiddenCollaterals: [{
355
+ token: TENOR_WETH_USDC_VAULT_BASE,
356
+ lltv: 0.98,
357
+ liquidationCursor: '300000000000000000',
358
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
359
+ }],
308
360
  maturity: 1790208000,
309
361
  rcfThreshold: '3000000000',
310
362
  enterGate: ZERO_ADDRESS,
@@ -327,6 +379,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261022 = (networkId = Network
327
379
  liquidationCursor: '300000000000000000',
328
380
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
329
381
  }],
382
+ hiddenCollaterals: [{
383
+ token: TENOR_WETH_USDC_VAULT_BASE,
384
+ lltv: 0.98,
385
+ liquidationCursor: '300000000000000000',
386
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
387
+ }],
330
388
  maturity: 1792627200,
331
389
  rcfThreshold: '3000000000',
332
390
  enterGate: ZERO_ADDRESS,
@@ -349,6 +407,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261119 = (networkId = Network
349
407
  liquidationCursor: '300000000000000000',
350
408
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
351
409
  }],
410
+ hiddenCollaterals: [{
411
+ token: TENOR_WETH_USDC_VAULT_BASE,
412
+ lltv: 0.98,
413
+ liquidationCursor: '300000000000000000',
414
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
415
+ }],
352
416
  maturity: 1795046400,
353
417
  rcfThreshold: '3000000000',
354
418
  enterGate: ZERO_ADDRESS,
@@ -371,6 +435,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261217 = (networkId = Network
371
435
  liquidationCursor: '300000000000000000',
372
436
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
373
437
  }],
438
+ hiddenCollaterals: [{
439
+ token: TENOR_WETH_USDC_VAULT_BASE,
440
+ lltv: 0.98,
441
+ liquidationCursor: '300000000000000000',
442
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
443
+ }],
374
444
  maturity: 1797465600,
375
445
  rcfThreshold: '3000000000',
376
446
  enterGate: ZERO_ADDRESS,
@@ -393,6 +463,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260827 = (networkId = Networ
393
463
  liquidationCursor: '300000000000000000',
394
464
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
395
465
  }],
466
+ hiddenCollaterals: [{
467
+ token: TENOR_CBETH_WETH_VAULT_BASE,
468
+ lltv: 0.98,
469
+ liquidationCursor: '300000000000000000',
470
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
471
+ }],
396
472
  maturity: 1787788800,
397
473
  rcfThreshold: '4000000000000000000',
398
474
  enterGate: ZERO_ADDRESS,
@@ -415,6 +491,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260924 = (networkId = Networ
415
491
  liquidationCursor: '300000000000000000',
416
492
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
417
493
  }],
494
+ hiddenCollaterals: [{
495
+ token: TENOR_CBETH_WETH_VAULT_BASE,
496
+ lltv: 0.98,
497
+ liquidationCursor: '300000000000000000',
498
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
499
+ }],
418
500
  maturity: 1790208000,
419
501
  rcfThreshold: '4000000000000000000',
420
502
  enterGate: ZERO_ADDRESS,
@@ -437,6 +519,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261022 = (networkId = Networ
437
519
  liquidationCursor: '300000000000000000',
438
520
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
439
521
  }],
522
+ hiddenCollaterals: [{
523
+ token: TENOR_CBETH_WETH_VAULT_BASE,
524
+ lltv: 0.98,
525
+ liquidationCursor: '300000000000000000',
526
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
527
+ }],
440
528
  maturity: 1792627200,
441
529
  rcfThreshold: '4000000000000000000',
442
530
  enterGate: ZERO_ADDRESS,
@@ -459,6 +547,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261119 = (networkId = Networ
459
547
  liquidationCursor: '300000000000000000',
460
548
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
461
549
  }],
550
+ hiddenCollaterals: [{
551
+ token: TENOR_CBETH_WETH_VAULT_BASE,
552
+ lltv: 0.98,
553
+ liquidationCursor: '300000000000000000',
554
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
555
+ }],
462
556
  maturity: 1795046400,
463
557
  rcfThreshold: '4000000000000000000',
464
558
  enterGate: ZERO_ADDRESS,
@@ -481,6 +575,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261217 = (networkId = Networ
481
575
  liquidationCursor: '300000000000000000',
482
576
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
483
577
  }],
578
+ hiddenCollaterals: [{
579
+ token: TENOR_CBETH_WETH_VAULT_BASE,
580
+ lltv: 0.98,
581
+ liquidationCursor: '300000000000000000',
582
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
583
+ }],
484
584
  maturity: 1797465600,
485
585
  rcfThreshold: '4000000000000000000',
486
586
  enterGate: ZERO_ADDRESS,
@@ -522,3 +622,10 @@ export const isTenorMidnightMarket = (market) => (typeof market === 'string'
522
622
  ? TENOR_MARKET_IDS.has(market.toLowerCase())
523
623
  : market.curator === 'Tenor');
524
624
  export const findMorphoMidnightMarket = (marketId, network = NetworkNumber.Base) => Object.values(MorphoMidnightMarkets(network)).find((market) => market.marketId.toLowerCase() === marketId.toLowerCase());
625
+ /**
626
+ * The market's collateral set as the chain knows it: the listed collaterals followed by the curator's
627
+ * hidden ones. This — not `collaterals` — is what a `Market` struct takes, since the market id is the hash
628
+ * of that struct. Anything assembling one for a contract call goes through here so it can't quietly build
629
+ * a market of its own instead.
630
+ */
631
+ export const morphoMidnightMarketCollateralParams = (market) => [...market.collaterals, ...(market.hiddenCollaterals || [])];
@@ -61,7 +61,7 @@ export function _getMorphoMidnightMarketData(provider, network, selectedMarket)
61
61
  borrowRate: '0',
62
62
  totalSupply: assetAmountInEth(totalUnits, loanSym),
63
63
  totalBorrow: assetAmountInEth(totalDebt, loanSym),
64
- canBeSupplied: true,
64
+ canBeSupplied: false,
65
65
  canBeBorrowed: true,
66
66
  supplyIncentives: [],
67
67
  borrowIncentives: [],
@@ -38,6 +38,10 @@ export interface MorphoMidnightMarketData {
38
38
  midnight: EthAddress;
39
39
  loanToken: EthAddress;
40
40
  collaterals: MorphoMidnightCollateralParams[];
41
+ /**
42
+ * Tenor's curated markets list the curator's own vault share token next to the real collateral.
43
+ */
44
+ hiddenCollaterals?: MorphoMidnightCollateralParams[];
41
45
  maturity: number;
42
46
  rcfThreshold: number | string;
43
47
  enterGate: EthAddress;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.127-midnight-6-dev",
3
+ "version": "2.1.127-midnight-8-dev",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -17,7 +17,9 @@ export {
17
17
  export { SparkMarkets } from './spark';
18
18
  export { CrvUsdMarkets } from './curveUsd';
19
19
  export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
20
- export { MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket } from './morphoMidnight';
20
+ export {
21
+ MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket, morphoMidnightMarketCollateralParams,
22
+ } from './morphoMidnight';
21
23
  export { LlamaLendMarkets } from './llamaLend';
22
24
  export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
23
25
  export { EulerV2Markets } from './euler';
@@ -1,4 +1,6 @@
1
- import { MorphoMidnightMarketData, MorphoMidnightVersions, NetworkNumber } from '../../types';
1
+ import {
2
+ MorphoMidnightCollateralParams, MorphoMidnightMarketData, MorphoMidnightVersions, NetworkNumber,
3
+ } from '../../types';
2
4
  import { ZERO_ADDRESS } from '../../constants';
3
5
 
4
6
  /**
@@ -13,6 +15,13 @@ const WETH_BASE = '0x4200000000000000000000000000000000000006' as const;
13
15
  const CBBTC_BASE = '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' as const;
14
16
  const CBETH_BASE = '0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22' as const;
15
17
 
18
+ // Tenor's ERC-4626 collateral vaults, one per pair and shared by that pair's whole maturity ladder. Each
19
+ // is a collateral of its markets on-chain without being an asset the app deals in — see the note above
20
+ // the Tenor markets below, and https://www.docs.tenor.finance/technical-docs/addresses/#vaults.
21
+ const TENOR_CBBTC_USDC_VAULT_BASE = '0xf6a70085b7f79FA76B04EbF7A2D7D87C3c5c04BC' as const;
22
+ const TENOR_WETH_USDC_VAULT_BASE = '0xe690a58EF52854513462745237F6A213a0d54dF1' as const;
23
+ const TENOR_CBETH_WETH_VAULT_BASE = '0xFa750DD0099eAdB72d401244De73ce7B89edf90F' as const;
24
+
16
25
 
17
26
  // Sourced from the official listing at https://markets.morpho.org/fixed/base
18
27
 
@@ -168,10 +177,14 @@ export const MORPHO_MIDNIGHT_CBBTC_USDC_860_20261225 = (networkId = NetworkNumbe
168
177
  // collaterals — the pair's own token at index 0, and Tenor's ERC-4626 vault at index 1 (98% LLTV; the
169
178
  // `metadata.vault` of the parent tenor market, listed at
170
179
  // https://www.docs.tenor.finance/technical-docs/addresses/#vaults). The vault is not an asset the app
171
- // deals in, so these are modelled as single-collateral markets: the app supplies and prices index 0, and
172
- // the SDK reads `prices[i]` / `collateral[i]` positionally, so listing the primary alone keeps those
173
- // lookups aligned. The on-chain take path is unaffected offer tuples carry the market's full collateral
174
- // set straight from the router's offer JSON, which is what the market hash is built from.
180
+ // deals in, so it is split out into `hiddenCollaterals` instead of `collaterals`: everything that renders
181
+ // or prices a position sees a single-collateral market, and because the vault stays the *suffix* of the
182
+ // set, the SDK's positional `prices[i]` / `collateral[i]` reads stay aligned with `collaterals`.
183
+ //
184
+ // It is only split out, never dropped: the market id is the hash of the full struct, so a `Market` handed
185
+ // to the core has to be `[...collaterals, ...hiddenCollaterals]` or the call addresses a market of its own
186
+ // making. The take path builds no struct — offer tuples carry the market's full collateral set straight
187
+ // from the router's offer JSON.
175
188
 
176
189
  export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260827 = (networkId = NetworkNumber.Base): MorphoMidnightMarketData => ({
177
190
  chainIds: [NetworkNumber.Base],
@@ -187,6 +200,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260827 = (networkId = Networ
187
200
  liquidationCursor: '300000000000000000',
188
201
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
189
202
  }],
203
+ hiddenCollaterals: [{
204
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
205
+ lltv: 0.98,
206
+ liquidationCursor: '300000000000000000',
207
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
208
+ }],
190
209
  maturity: 1787788800, // 2026-08-27T00:00:00Z
191
210
  rcfThreshold: '3000000000',
192
211
  enterGate: ZERO_ADDRESS,
@@ -210,6 +229,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20260924 = (networkId = Networ
210
229
  liquidationCursor: '300000000000000000',
211
230
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
212
231
  }],
232
+ hiddenCollaterals: [{
233
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
234
+ lltv: 0.98,
235
+ liquidationCursor: '300000000000000000',
236
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
237
+ }],
213
238
  maturity: 1790208000, // 2026-09-24T00:00:00Z
214
239
  rcfThreshold: '3000000000',
215
240
  enterGate: ZERO_ADDRESS,
@@ -233,6 +258,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261022 = (networkId = Networ
233
258
  liquidationCursor: '300000000000000000',
234
259
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
235
260
  }],
261
+ hiddenCollaterals: [{
262
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
263
+ lltv: 0.98,
264
+ liquidationCursor: '300000000000000000',
265
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
266
+ }],
236
267
  maturity: 1792627200, // 2026-10-22T00:00:00Z
237
268
  rcfThreshold: '3000000000',
238
269
  enterGate: ZERO_ADDRESS,
@@ -256,6 +287,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261119 = (networkId = Networ
256
287
  liquidationCursor: '300000000000000000',
257
288
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
258
289
  }],
290
+ hiddenCollaterals: [{
291
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
292
+ lltv: 0.98,
293
+ liquidationCursor: '300000000000000000',
294
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
295
+ }],
259
296
  maturity: 1795046400, // 2026-11-19T00:00:00Z
260
297
  rcfThreshold: '3000000000',
261
298
  enterGate: ZERO_ADDRESS,
@@ -279,6 +316,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBBTC_USDC_860_20261217 = (networkId = Networ
279
316
  liquidationCursor: '300000000000000000',
280
317
  oracle: '0x663BECd10daE6C4A3Dcd89F1d76c1174199639B9',
281
318
  }],
319
+ hiddenCollaterals: [{
320
+ token: TENOR_CBBTC_USDC_VAULT_BASE,
321
+ lltv: 0.98,
322
+ liquidationCursor: '300000000000000000',
323
+ oracle: '0x4a24e4bf269cE26aAD2dF00437e7730d25FCdE26',
324
+ }],
282
325
  maturity: 1797465600, // 2026-12-17T00:00:00Z
283
326
  rcfThreshold: '3000000000',
284
327
  enterGate: ZERO_ADDRESS,
@@ -302,6 +345,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260827 = (networkId = Network
302
345
  liquidationCursor: '300000000000000000',
303
346
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
304
347
  }],
348
+ hiddenCollaterals: [{
349
+ token: TENOR_WETH_USDC_VAULT_BASE,
350
+ lltv: 0.98,
351
+ liquidationCursor: '300000000000000000',
352
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
353
+ }],
305
354
  maturity: 1787788800,
306
355
  rcfThreshold: '3000000000',
307
356
  enterGate: ZERO_ADDRESS,
@@ -325,6 +374,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20260924 = (networkId = Network
325
374
  liquidationCursor: '300000000000000000',
326
375
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
327
376
  }],
377
+ hiddenCollaterals: [{
378
+ token: TENOR_WETH_USDC_VAULT_BASE,
379
+ lltv: 0.98,
380
+ liquidationCursor: '300000000000000000',
381
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
382
+ }],
328
383
  maturity: 1790208000,
329
384
  rcfThreshold: '3000000000',
330
385
  enterGate: ZERO_ADDRESS,
@@ -348,6 +403,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261022 = (networkId = Network
348
403
  liquidationCursor: '300000000000000000',
349
404
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
350
405
  }],
406
+ hiddenCollaterals: [{
407
+ token: TENOR_WETH_USDC_VAULT_BASE,
408
+ lltv: 0.98,
409
+ liquidationCursor: '300000000000000000',
410
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
411
+ }],
351
412
  maturity: 1792627200,
352
413
  rcfThreshold: '3000000000',
353
414
  enterGate: ZERO_ADDRESS,
@@ -371,6 +432,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261119 = (networkId = Network
371
432
  liquidationCursor: '300000000000000000',
372
433
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
373
434
  }],
435
+ hiddenCollaterals: [{
436
+ token: TENOR_WETH_USDC_VAULT_BASE,
437
+ lltv: 0.98,
438
+ liquidationCursor: '300000000000000000',
439
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
440
+ }],
374
441
  maturity: 1795046400,
375
442
  rcfThreshold: '3000000000',
376
443
  enterGate: ZERO_ADDRESS,
@@ -394,6 +461,12 @@ export const MORPHO_MIDNIGHT_TENOR_WETH_USDC_860_20261217 = (networkId = Network
394
461
  liquidationCursor: '300000000000000000',
395
462
  oracle: '0xFEa2D58cEfCb9fcb597723c6bAE66fFE4193aFE4',
396
463
  }],
464
+ hiddenCollaterals: [{
465
+ token: TENOR_WETH_USDC_VAULT_BASE,
466
+ lltv: 0.98,
467
+ liquidationCursor: '300000000000000000',
468
+ oracle: '0x784519B1b59A1e1498f077066bB9336672bcc3EE',
469
+ }],
397
470
  maturity: 1797465600,
398
471
  rcfThreshold: '3000000000',
399
472
  enterGate: ZERO_ADDRESS,
@@ -417,6 +490,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260827 = (networkId = Networ
417
490
  liquidationCursor: '300000000000000000',
418
491
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
419
492
  }],
493
+ hiddenCollaterals: [{
494
+ token: TENOR_CBETH_WETH_VAULT_BASE,
495
+ lltv: 0.98,
496
+ liquidationCursor: '300000000000000000',
497
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
498
+ }],
420
499
  maturity: 1787788800,
421
500
  rcfThreshold: '4000000000000000000',
422
501
  enterGate: ZERO_ADDRESS,
@@ -440,6 +519,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20260924 = (networkId = Networ
440
519
  liquidationCursor: '300000000000000000',
441
520
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
442
521
  }],
522
+ hiddenCollaterals: [{
523
+ token: TENOR_CBETH_WETH_VAULT_BASE,
524
+ lltv: 0.98,
525
+ liquidationCursor: '300000000000000000',
526
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
527
+ }],
443
528
  maturity: 1790208000,
444
529
  rcfThreshold: '4000000000000000000',
445
530
  enterGate: ZERO_ADDRESS,
@@ -463,6 +548,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261022 = (networkId = Networ
463
548
  liquidationCursor: '300000000000000000',
464
549
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
465
550
  }],
551
+ hiddenCollaterals: [{
552
+ token: TENOR_CBETH_WETH_VAULT_BASE,
553
+ lltv: 0.98,
554
+ liquidationCursor: '300000000000000000',
555
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
556
+ }],
466
557
  maturity: 1792627200,
467
558
  rcfThreshold: '4000000000000000000',
468
559
  enterGate: ZERO_ADDRESS,
@@ -486,6 +577,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261119 = (networkId = Networ
486
577
  liquidationCursor: '300000000000000000',
487
578
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
488
579
  }],
580
+ hiddenCollaterals: [{
581
+ token: TENOR_CBETH_WETH_VAULT_BASE,
582
+ lltv: 0.98,
583
+ liquidationCursor: '300000000000000000',
584
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
585
+ }],
489
586
  maturity: 1795046400,
490
587
  rcfThreshold: '4000000000000000000',
491
588
  enterGate: ZERO_ADDRESS,
@@ -509,6 +606,12 @@ export const MORPHO_MIDNIGHT_TENOR_CBETH_WETH_945_20261217 = (networkId = Networ
509
606
  liquidationCursor: '300000000000000000',
510
607
  oracle: '0xB03855Ad5AFD6B8db8091DD5551CAC4ed621d9E6',
511
608
  }],
609
+ hiddenCollaterals: [{
610
+ token: TENOR_CBETH_WETH_VAULT_BASE,
611
+ lltv: 0.98,
612
+ liquidationCursor: '300000000000000000',
613
+ oracle: '0xa02f629871be35d6db0F88C944cF955554Ec87c0',
614
+ }],
512
615
  maturity: 1797465600,
513
616
  rcfThreshold: '4000000000000000000',
514
617
  enterGate: ZERO_ADDRESS,
@@ -560,3 +663,13 @@ export const isTenorMidnightMarket = (market: Pick<MorphoMidnightMarketData, 'cu
560
663
  export const findMorphoMidnightMarket = (marketId: string, network: NetworkNumber = NetworkNumber.Base): MorphoMidnightMarketData | undefined => Object.values(MorphoMidnightMarkets(network)).find(
561
664
  (market) => market.marketId.toLowerCase() === marketId.toLowerCase(),
562
665
  );
666
+
667
+ /**
668
+ * The market's collateral set as the chain knows it: the listed collaterals followed by the curator's
669
+ * hidden ones. This — not `collaterals` — is what a `Market` struct takes, since the market id is the hash
670
+ * of that struct. Anything assembling one for a contract call goes through here so it can't quietly build
671
+ * a market of its own instead.
672
+ */
673
+ export const morphoMidnightMarketCollateralParams = (
674
+ market: Pick<MorphoMidnightMarketData, 'collaterals' | 'hiddenCollaterals'>,
675
+ ): MorphoMidnightCollateralParams[] => [...market.collaterals, ...(market.hiddenCollaterals || [])];
@@ -65,7 +65,7 @@ export async function _getMorphoMidnightMarketData(provider: Client, network: Ne
65
65
  borrowRate: '0',
66
66
  totalSupply: assetAmountInEth(totalUnits, loanSym),
67
67
  totalBorrow: assetAmountInEth(totalDebt, loanSym),
68
- canBeSupplied: true,
68
+ canBeSupplied: false,
69
69
  canBeBorrowed: true,
70
70
  supplyIncentives: [],
71
71
  borrowIncentives: [],
@@ -48,6 +48,10 @@ export interface MorphoMidnightMarketData {
48
48
  midnight: EthAddress,
49
49
  loanToken: EthAddress,
50
50
  collaterals: MorphoMidnightCollateralParams[],
51
+ /**
52
+ * Tenor's curated markets list the curator's own vault share token next to the real collateral.
53
+ */
54
+ hiddenCollaterals?: MorphoMidnightCollateralParams[],
51
55
  maturity: number, // unix timestamp (seconds)
52
56
  rcfThreshold: number | string,
53
57
  enterGate: EthAddress,