@defisaver/positions-sdk 2.1.151-midnight-2-dev → 2.1.151

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.
Files changed (42) hide show
  1. package/cjs/claiming/compV3.js +1 -0
  2. package/cjs/config/contracts.d.ts +0 -4
  3. package/cjs/config/contracts.js +0 -4
  4. package/cjs/helpers/morphoMidnightHelpers/tenor.d.ts +2 -6
  5. package/cjs/helpers/morphoMidnightHelpers/tenor.js +1 -5
  6. package/cjs/markets/aaveV4/index.d.ts +2 -0
  7. package/cjs/markets/aaveV4/index.js +13 -1
  8. package/cjs/markets/index.d.ts +1 -1
  9. package/cjs/markets/index.js +1 -2
  10. package/cjs/markets/morphoMidnight/index.d.ts +10 -92
  11. package/cjs/markets/morphoMidnight/index.js +60 -519
  12. package/cjs/morphoMidnight/index.js +1 -11
  13. package/cjs/types/aaveV4.d.ts +1 -0
  14. package/cjs/types/aaveV4.js +1 -0
  15. package/cjs/types/morphoMidnight.d.ts +4 -57
  16. package/cjs/types/morphoMidnight.js +0 -45
  17. package/esm/claiming/compV3.js +1 -0
  18. package/esm/config/contracts.d.ts +0 -4
  19. package/esm/config/contracts.js +0 -4
  20. package/esm/helpers/morphoMidnightHelpers/tenor.d.ts +2 -6
  21. package/esm/helpers/morphoMidnightHelpers/tenor.js +2 -6
  22. package/esm/markets/aaveV4/index.d.ts +2 -0
  23. package/esm/markets/aaveV4/index.js +11 -0
  24. package/esm/markets/index.d.ts +1 -1
  25. package/esm/markets/index.js +1 -1
  26. package/esm/markets/morphoMidnight/index.d.ts +10 -92
  27. package/esm/markets/morphoMidnight/index.js +59 -473
  28. package/esm/morphoMidnight/index.js +1 -11
  29. package/esm/types/aaveV4.d.ts +1 -0
  30. package/esm/types/aaveV4.js +1 -0
  31. package/esm/types/morphoMidnight.d.ts +4 -57
  32. package/esm/types/morphoMidnight.js +0 -45
  33. package/package.json +2 -2
  34. package/src/claiming/compV3.ts +1 -0
  35. package/src/config/contracts.ts +0 -4
  36. package/src/helpers/morphoMidnightHelpers/tenor.ts +2 -6
  37. package/src/markets/aaveV4/index.ts +12 -0
  38. package/src/markets/index.ts +0 -1
  39. package/src/markets/morphoMidnight/index.ts +61 -724
  40. package/src/morphoMidnight/index.ts +1 -8
  41. package/src/types/aaveV4.ts +1 -0
  42. package/src/types/morphoMidnight.ts +3 -59
@@ -67,13 +67,8 @@ export function _getMorphoMidnightMarketData(provider, network, selectedMarket)
67
67
  supplyIncentives: [],
68
68
  borrowIncentives: [],
69
69
  };
70
- // `collaterals` is the full on-chain set, so `i` is the index `prices` is keyed by. Hidden entries
71
- // (curator vaults, the loan token itself) are skipped rather than filtered out beforehand, which would
72
- // shift every later collateral onto the wrong price.
73
70
  const collateralSymbols = [];
74
71
  collaterals.forEach((coll, i) => {
75
- if (coll.hidden)
76
- return;
77
72
  const collInfo = getAssetInfoByAddress(coll.token, network);
78
73
  const collSym = wethToEth(collInfo.symbol);
79
74
  collateralSymbols.push(collSym);
@@ -136,11 +131,8 @@ export function _getMorphoMidnightAccountData(provider, network, account, select
136
131
  suppliedUsd: new Dec(credit).mul(loanTokenData.price).toString(),
137
132
  borrowedUsd: new Dec(debt).mul(loanTokenData.price).toString(),
138
133
  };
139
- // positionInfo.collateral is index-aligned with the market's full on-chain collateral set (0 where
140
- // unused), so hidden entries are skipped in place rather than filtered out first.
134
+ // positionInfo.collateral is index-aligned with the market's collateral set (0 where unused).
141
135
  collaterals.forEach((coll, i) => {
142
- if (coll.hidden)
143
- return;
144
136
  const collInfo = getAssetInfoByAddress(coll.token, network);
145
137
  const collSym = wethToEth(collInfo.symbol);
146
138
  const rawAmount = positionInfo.collateral[i] ? positionInfo.collateral[i].toString() : '0';
@@ -220,8 +212,6 @@ export const _getMorphoMidnightAccountBalances = (provider, network, block, addr
220
212
  };
221
213
  const collateral = {};
222
214
  collaterals.forEach((coll, i) => {
223
- if (coll.hidden)
224
- return;
225
215
  const collInfo = getAssetInfoByAddress(coll.token, network);
226
216
  const rawAmount = positionInfo.collateral[i] ? positionInfo.collateral[i].toString() : '0';
227
217
  collateral[addressMapping ? collInfo.address.toLowerCase() : wethToEth(collInfo.symbol)] = assetAmountInEth(rawAmount, wethToEth(collInfo.symbol));
@@ -16,6 +16,7 @@ export declare enum AaveV4SpokesType {
16
16
  AaveV4LidoSpoke = "aave_v4_lido_spoke",
17
17
  AaveV4LombardBtcSpoke = "aave_v4_lombard_btc_spoke",
18
18
  AaveV4MainSpoke = "aave_v4_main_spoke",
19
+ AaveV4PaxgGoldSpoke = "aave_v4_paxg_gold_spoke",
19
20
  AaveV4USDGPendleSpoke = "aave_v4_usdg_pendle_spoke",
20
21
  AaveV4USDGMapleSpoke = "aave_v4_usdg_maple_spoke"
21
22
  }
@@ -17,6 +17,7 @@ export var AaveV4SpokesType;
17
17
  AaveV4SpokesType["AaveV4LidoSpoke"] = "aave_v4_lido_spoke";
18
18
  AaveV4SpokesType["AaveV4LombardBtcSpoke"] = "aave_v4_lombard_btc_spoke";
19
19
  AaveV4SpokesType["AaveV4MainSpoke"] = "aave_v4_main_spoke";
20
+ AaveV4SpokesType["AaveV4PaxgGoldSpoke"] = "aave_v4_paxg_gold_spoke";
20
21
  AaveV4SpokesType["AaveV4USDGPendleSpoke"] = "aave_v4_usdg_pendle_spoke";
21
22
  AaveV4SpokesType["AaveV4USDGMapleSpoke"] = "aave_v4_usdg_maple_spoke";
22
23
  })(AaveV4SpokesType || (AaveV4SpokesType = {}));
@@ -31,49 +31,7 @@ export declare enum MorphoMidnightVersions {
31
31
  MorphoMidnightTenorCbETHWETH_20261030_Base = "morphomidnighttenorcbethweth_20261030_base",
32
32
  MorphoMidnightTenorCbETHWETH_20261127_Base = "morphomidnighttenorcbethweth_20261127_base",
33
33
  MorphoMidnightTenorCbETHWETH_20261225_Base = "morphomidnighttenorcbethweth_20261225_base",
34
- MorphoMidnightTenorCbETHWETH_20270129_Base = "morphomidnighttenorcbethweth_20270129_base",
35
- MorphoMidnightWBTCUSDC_860_20260925_Eth = "morphomidnightwbtcusdc_860_20260925_eth",
36
- MorphoMidnightWBTCUSDC_860_20261030_Eth = "morphomidnightwbtcusdc_860_20261030_eth",
37
- MorphoMidnightWBTCUSDC_860_20261127_Eth = "morphomidnightwbtcusdc_860_20261127_eth",
38
- MorphoMidnightWBTCUSDC_860_20261225_Eth = "morphomidnightwbtcusdc_860_20261225_eth",
39
- MorphoMidnightWBTCUSDC_860_20270129_Eth = "morphomidnightwbtcusdc_860_20270129_eth",
40
- MorphoMidnightWBTCUSDC_860_20270226_Eth = "morphomidnightwbtcusdc_860_20270226_eth",
41
- MorphoMidnightWBTCUSDC_860_20270326_Eth = "morphomidnightwbtcusdc_860_20270326_eth",
42
- MorphoMidnightCbBTCUSDC_860_20260925_Eth = "morphomidnightcbbtcusdc_860_20260925_eth",
43
- MorphoMidnightCbBTCUSDC_860_20261030_Eth = "morphomidnightcbbtcusdc_860_20261030_eth",
44
- MorphoMidnightCbBTCUSDC_860_20261127_Eth = "morphomidnightcbbtcusdc_860_20261127_eth",
45
- MorphoMidnightCbBTCUSDC_860_20261225_Eth = "morphomidnightcbbtcusdc_860_20261225_eth",
46
- MorphoMidnightCbBTCUSDC_860_20270129_Eth = "morphomidnightcbbtcusdc_860_20270129_eth",
47
- MorphoMidnightCbBTCUSDC_860_20270226_Eth = "morphomidnightcbbtcusdc_860_20270226_eth",
48
- MorphoMidnightCbBTCUSDC_860_20270326_Eth = "morphomidnightcbbtcusdc_860_20270326_eth",
49
- MorphoMidnightTenorReUSDUSDC_20260925_Eth = "morphomidnighttenorreusdusdc_20260925_eth",
50
- MorphoMidnightTenorReUSDUSDC_20261030_Eth = "morphomidnighttenorreusdusdc_20261030_eth",
51
- MorphoMidnightTenorReUSDUSDC_20261127_Eth = "morphomidnighttenorreusdusdc_20261127_eth",
52
- MorphoMidnightTenorReUSDUSDC_20261225_Eth = "morphomidnighttenorreusdusdc_20261225_eth",
53
- MorphoMidnightTenorSiUSDUSDC_20260925_Eth = "morphomidnighttenorsiusdusdc_20260925_eth",
54
- MorphoMidnightTenorSiUSDUSDC_20261030_Eth = "morphomidnighttenorsiusdusdc_20261030_eth",
55
- MorphoMidnightTenorSiUSDUSDC_20261127_Eth = "morphomidnighttenorsiusdusdc_20261127_eth",
56
- MorphoMidnightTenorSiUSDUSDC_20261225_Eth = "morphomidnighttenorsiusdusdc_20261225_eth",
57
- MorphoMidnightTenorStrUSDUSDC_20260925_Eth = "morphomidnighttenorstrusdusdc_20260925_eth",
58
- MorphoMidnightTenorStrUSDUSDC_20261030_Eth = "morphomidnighttenorstrusdusdc_20261030_eth",
59
- MorphoMidnightTenorStrUSDUSDC_20261127_Eth = "morphomidnighttenorstrusdusdc_20261127_eth",
60
- MorphoMidnightTenorStrUSDUSDC_20261225_Eth = "morphomidnighttenorstrusdusdc_20261225_eth",
61
- MorphoMidnightTenorUSD3USDC_20260925_Eth = "morphomidnighttenorusd3usdc_20260925_eth",
62
- MorphoMidnightTenorUSD3USDC_20261030_Eth = "morphomidnighttenorusd3usdc_20261030_eth",
63
- MorphoMidnightTenorUSD3USDC_20261127_Eth = "morphomidnighttenorusd3usdc_20261127_eth",
64
- MorphoMidnightTenorUSD3USDC_20261225_Eth = "morphomidnighttenorusd3usdc_20261225_eth",
65
- MorphoMidnightTenorWETHUSDC_20260925_Eth = "morphomidnighttenorwethusdc_20260925_eth",
66
- MorphoMidnightTenorWETHUSDC_20261030_Eth = "morphomidnighttenorwethusdc_20261030_eth",
67
- MorphoMidnightTenorWETHUSDC_20261127_Eth = "morphomidnighttenorwethusdc_20261127_eth",
68
- MorphoMidnightTenorWETHUSDC_20261225_Eth = "morphomidnighttenorwethusdc_20261225_eth",
69
- MorphoMidnightTenorWsrUSDUSDC_20260925_Eth = "morphomidnighttenorwsrusdusdc_20260925_eth",
70
- MorphoMidnightTenorWsrUSDUSDC_20261030_Eth = "morphomidnighttenorwsrusdusdc_20261030_eth",
71
- MorphoMidnightTenorWsrUSDUSDC_20261127_Eth = "morphomidnighttenorwsrusdusdc_20261127_eth",
72
- MorphoMidnightTenorWsrUSDUSDC_20261225_Eth = "morphomidnighttenorwsrusdusdc_20261225_eth",
73
- MorphoMidnightTenorWstETHWETH_20260925_Eth = "morphomidnighttenorwstethweth_20260925_eth",
74
- MorphoMidnightTenorWstETHWETH_20261030_Eth = "morphomidnighttenorwstethweth_20261030_eth",
75
- MorphoMidnightTenorWstETHWETH_20261127_Eth = "morphomidnighttenorwstethweth_20261127_eth",
76
- MorphoMidnightTenorWstETHWETH_20261225_Eth = "morphomidnighttenorwstethweth_20261225_eth"
34
+ MorphoMidnightTenorCbETHWETH_20270129_Base = "morphomidnighttenorcbethweth_20270129_base"
77
35
  }
78
36
  export type MorphoMidnightCurator = 'Morpho' | 'Tenor';
79
37
  export interface MorphoMidnightCollateralParams {
@@ -81,13 +39,6 @@ export interface MorphoMidnightCollateralParams {
81
39
  lltv: number | string;
82
40
  liquidationCursor: number | string;
83
41
  oracle: EthAddress;
84
- /**
85
- * A collateral the market carries on-chain but the app never surfaces: a curator's own vault share
86
- * token (Tenor's collateral vaults) or the loan token itself (Morpho's mainnet ladders list USDC at
87
- * 98% next to the real collateral). It is not an asset the app deals in — nothing renders, prices or
88
- * supplies it — but it stays in `collaterals` because the market id is the hash of the full set.
89
- */
90
- hidden?: boolean;
91
42
  }
92
43
  export interface MorphoMidnightMarketData {
93
44
  chainIds: NetworkNumber[];
@@ -97,15 +48,11 @@ export interface MorphoMidnightMarketData {
97
48
  value: MorphoMidnightVersions;
98
49
  midnight: EthAddress;
99
50
  loanToken: EthAddress;
51
+ collaterals: MorphoMidnightCollateralParams[];
100
52
  /**
101
- * Every collateral the market carries on-chain, in the chain's own order which is what the id is
102
- * hashed from, so neither the set nor the order may be rearranged. Entries the app does not deal in
103
- * are flagged `hidden` rather than kept in a second list: their on-chain position varies per market
104
- * (Morpho's mainnet cbBTC ladder lists USDC first, its WBTC ladder second), so a separate list can
105
- * only be re-joined by guessing, and every positional read — `MarketInfo.prices[i]`,
106
- * `PositionInfo.collateral[i]`, the collateral index a supply call takes — indexes into *this* array.
53
+ * Tenor's curated markets list the curator's own vault share token next to the real collateral.
107
54
  */
108
- collaterals: MorphoMidnightCollateralParams[];
55
+ hiddenCollaterals?: MorphoMidnightCollateralParams[];
109
56
  maturity: number;
110
57
  rcfThreshold: number | string;
111
58
  enterGate: EthAddress;
@@ -36,51 +36,6 @@ export var MorphoMidnightVersions;
36
36
  MorphoMidnightVersions["MorphoMidnightTenorCbETHWETH_20261127_Base"] = "morphomidnighttenorcbethweth_20261127_base";
37
37
  MorphoMidnightVersions["MorphoMidnightTenorCbETHWETH_20261225_Base"] = "morphomidnighttenorcbethweth_20261225_base";
38
38
  MorphoMidnightVersions["MorphoMidnightTenorCbETHWETH_20270129_Base"] = "morphomidnighttenorcbethweth_20270129_base";
39
- // ETHEREUM
40
- // Sourced from the official listing at https://markets.morpho.org/fixed?chains=1
41
- MorphoMidnightVersions["MorphoMidnightWBTCUSDC_860_20260925_Eth"] = "morphomidnightwbtcusdc_860_20260925_eth";
42
- MorphoMidnightVersions["MorphoMidnightWBTCUSDC_860_20261030_Eth"] = "morphomidnightwbtcusdc_860_20261030_eth";
43
- MorphoMidnightVersions["MorphoMidnightWBTCUSDC_860_20261127_Eth"] = "morphomidnightwbtcusdc_860_20261127_eth";
44
- MorphoMidnightVersions["MorphoMidnightWBTCUSDC_860_20261225_Eth"] = "morphomidnightwbtcusdc_860_20261225_eth";
45
- MorphoMidnightVersions["MorphoMidnightWBTCUSDC_860_20270129_Eth"] = "morphomidnightwbtcusdc_860_20270129_eth";
46
- MorphoMidnightVersions["MorphoMidnightWBTCUSDC_860_20270226_Eth"] = "morphomidnightwbtcusdc_860_20270226_eth";
47
- MorphoMidnightVersions["MorphoMidnightWBTCUSDC_860_20270326_Eth"] = "morphomidnightwbtcusdc_860_20270326_eth";
48
- MorphoMidnightVersions["MorphoMidnightCbBTCUSDC_860_20260925_Eth"] = "morphomidnightcbbtcusdc_860_20260925_eth";
49
- MorphoMidnightVersions["MorphoMidnightCbBTCUSDC_860_20261030_Eth"] = "morphomidnightcbbtcusdc_860_20261030_eth";
50
- MorphoMidnightVersions["MorphoMidnightCbBTCUSDC_860_20261127_Eth"] = "morphomidnightcbbtcusdc_860_20261127_eth";
51
- MorphoMidnightVersions["MorphoMidnightCbBTCUSDC_860_20261225_Eth"] = "morphomidnightcbbtcusdc_860_20261225_eth";
52
- MorphoMidnightVersions["MorphoMidnightCbBTCUSDC_860_20270129_Eth"] = "morphomidnightcbbtcusdc_860_20270129_eth";
53
- MorphoMidnightVersions["MorphoMidnightCbBTCUSDC_860_20270226_Eth"] = "morphomidnightcbbtcusdc_860_20270226_eth";
54
- MorphoMidnightVersions["MorphoMidnightCbBTCUSDC_860_20270326_Eth"] = "morphomidnightcbbtcusdc_860_20270326_eth";
55
- // Tenor-hosted Midnight markets (same core, different order book)
56
- MorphoMidnightVersions["MorphoMidnightTenorReUSDUSDC_20260925_Eth"] = "morphomidnighttenorreusdusdc_20260925_eth";
57
- MorphoMidnightVersions["MorphoMidnightTenorReUSDUSDC_20261030_Eth"] = "morphomidnighttenorreusdusdc_20261030_eth";
58
- MorphoMidnightVersions["MorphoMidnightTenorReUSDUSDC_20261127_Eth"] = "morphomidnighttenorreusdusdc_20261127_eth";
59
- MorphoMidnightVersions["MorphoMidnightTenorReUSDUSDC_20261225_Eth"] = "morphomidnighttenorreusdusdc_20261225_eth";
60
- MorphoMidnightVersions["MorphoMidnightTenorSiUSDUSDC_20260925_Eth"] = "morphomidnighttenorsiusdusdc_20260925_eth";
61
- MorphoMidnightVersions["MorphoMidnightTenorSiUSDUSDC_20261030_Eth"] = "morphomidnighttenorsiusdusdc_20261030_eth";
62
- MorphoMidnightVersions["MorphoMidnightTenorSiUSDUSDC_20261127_Eth"] = "morphomidnighttenorsiusdusdc_20261127_eth";
63
- MorphoMidnightVersions["MorphoMidnightTenorSiUSDUSDC_20261225_Eth"] = "morphomidnighttenorsiusdusdc_20261225_eth";
64
- MorphoMidnightVersions["MorphoMidnightTenorStrUSDUSDC_20260925_Eth"] = "morphomidnighttenorstrusdusdc_20260925_eth";
65
- MorphoMidnightVersions["MorphoMidnightTenorStrUSDUSDC_20261030_Eth"] = "morphomidnighttenorstrusdusdc_20261030_eth";
66
- MorphoMidnightVersions["MorphoMidnightTenorStrUSDUSDC_20261127_Eth"] = "morphomidnighttenorstrusdusdc_20261127_eth";
67
- MorphoMidnightVersions["MorphoMidnightTenorStrUSDUSDC_20261225_Eth"] = "morphomidnighttenorstrusdusdc_20261225_eth";
68
- MorphoMidnightVersions["MorphoMidnightTenorUSD3USDC_20260925_Eth"] = "morphomidnighttenorusd3usdc_20260925_eth";
69
- MorphoMidnightVersions["MorphoMidnightTenorUSD3USDC_20261030_Eth"] = "morphomidnighttenorusd3usdc_20261030_eth";
70
- MorphoMidnightVersions["MorphoMidnightTenorUSD3USDC_20261127_Eth"] = "morphomidnighttenorusd3usdc_20261127_eth";
71
- MorphoMidnightVersions["MorphoMidnightTenorUSD3USDC_20261225_Eth"] = "morphomidnighttenorusd3usdc_20261225_eth";
72
- MorphoMidnightVersions["MorphoMidnightTenorWETHUSDC_20260925_Eth"] = "morphomidnighttenorwethusdc_20260925_eth";
73
- MorphoMidnightVersions["MorphoMidnightTenorWETHUSDC_20261030_Eth"] = "morphomidnighttenorwethusdc_20261030_eth";
74
- MorphoMidnightVersions["MorphoMidnightTenorWETHUSDC_20261127_Eth"] = "morphomidnighttenorwethusdc_20261127_eth";
75
- MorphoMidnightVersions["MorphoMidnightTenorWETHUSDC_20261225_Eth"] = "morphomidnighttenorwethusdc_20261225_eth";
76
- MorphoMidnightVersions["MorphoMidnightTenorWsrUSDUSDC_20260925_Eth"] = "morphomidnighttenorwsrusdusdc_20260925_eth";
77
- MorphoMidnightVersions["MorphoMidnightTenorWsrUSDUSDC_20261030_Eth"] = "morphomidnighttenorwsrusdusdc_20261030_eth";
78
- MorphoMidnightVersions["MorphoMidnightTenorWsrUSDUSDC_20261127_Eth"] = "morphomidnighttenorwsrusdusdc_20261127_eth";
79
- MorphoMidnightVersions["MorphoMidnightTenorWsrUSDUSDC_20261225_Eth"] = "morphomidnighttenorwsrusdusdc_20261225_eth";
80
- MorphoMidnightVersions["MorphoMidnightTenorWstETHWETH_20260925_Eth"] = "morphomidnighttenorwstethweth_20260925_eth";
81
- MorphoMidnightVersions["MorphoMidnightTenorWstETHWETH_20261030_Eth"] = "morphomidnighttenorwstethweth_20261030_eth";
82
- MorphoMidnightVersions["MorphoMidnightTenorWstETHWETH_20261127_Eth"] = "morphomidnighttenorwstethweth_20261127_eth";
83
- MorphoMidnightVersions["MorphoMidnightTenorWstETHWETH_20261225_Eth"] = "morphomidnighttenorwstethweth_20261225_eth";
84
39
  })(MorphoMidnightVersions || (MorphoMidnightVersions = {}));
85
40
  /**
86
41
  * How much weight `borrowRate` / `debtBase` / `debtInterest` carry on a given position. They fall back to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.151-midnight-2-dev",
3
+ "version": "2.1.151",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -21,7 +21,7 @@
21
21
  "author": "",
22
22
  "license": "ISC",
23
23
  "dependencies": {
24
- "@defisaver/tokens": "^1.7.44",
24
+ "@defisaver/tokens": "^1.7.45",
25
25
  "@types/lodash": "^4.17.15",
26
26
  "@types/memoizee": "^0.4.12",
27
27
  "decimal.js": "^10.6.0",
@@ -9,6 +9,7 @@ import { ClaimType } from '../types/claiming';
9
9
  // Not decodable by name, since the error lives in CometRewards' ABI and we call through CompV3View.
10
10
  const NOT_SUPPORTED_ERROR_SIG = '0x9c58e3b6';
11
11
 
12
+ // Only an actual on-chain revert counts - viem reports transport failures as ContractFunctionExecutionError too.
12
13
  const isMarketWithoutRewardsConfig = (err: unknown) => {
13
14
  if (!(err instanceof BaseError)) return false;
14
15
  const revert = err.walk((e) => e instanceof ContractFunctionRevertedError);
@@ -1128,10 +1128,6 @@ export const MorphoBlueView = {
1128
1128
  export const MidnightView = {
1129
1129
  "abi": [{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"getMarketInfo","outputs":[{"components":[{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"uint128","name":"totalUnits","type":"uint128"},{"internalType":"uint128","name":"lossFactor","type":"uint128"},{"internalType":"uint128","name":"withdrawable","type":"uint128"},{"internalType":"uint128","name":"continuousFeeCredit","type":"uint128"},{"internalType":"uint16[7]","name":"settlementFees","type":"uint16[7]"},{"internalType":"uint32","name":"continuousFee","type":"uint32"},{"internalType":"uint8","name":"tickSpacing","type":"uint8"},{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"internalType":"struct MidnightView.MarketInfo","name":"info","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"internalType":"address","name":"_user","type":"address"}],"name":"getPositionInfo","outputs":[{"components":[{"internalType":"uint128","name":"credit","type":"uint128"},{"internalType":"uint128","name":"pendingFee","type":"uint128"},{"internalType":"uint128","name":"debt","type":"uint128"},{"internalType":"uint128","name":"collateralBitmap","type":"uint128"},{"internalType":"uint128[]","name":"collateral","type":"uint128[]"},{"internalType":"uint256","name":"ratio","type":"uint256"}],"internalType":"struct MidnightView.PositionInfo","name":"pos","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"internalType":"address","name":"_user","type":"address"}],"name":"getRatio","outputs":[{"internalType":"uint256","name":"ratio","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"midnight","type":"address"},{"internalType":"address","name":"loanToken","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"},{"internalType":"uint256","name":"liquidationCursor","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct CollateralParams[]","name":"collateralParams","type":"tuple[]"},{"internalType":"uint256","name":"maturity","type":"uint256"},{"internalType":"uint256","name":"rcfThreshold","type":"uint256"},{"internalType":"address","name":"enterGate","type":"address"},{"internalType":"address","name":"liquidatorGate","type":"address"}],"internalType":"struct Market","name":"_market","type":"tuple"}],"name":"toId","outputs":[{"internalType":"bytes32","name":"id","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"}],"name":"toMarket","outputs":[{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"midnight","type":"address"},{"internalType":"address","name":"loanToken","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"lltv","type":"uint256"},{"internalType":"uint256","name":"liquidationCursor","type":"uint256"},{"internalType":"address","name":"oracle","type":"address"}],"internalType":"struct CollateralParams[]","name":"collateralParams","type":"tuple[]"},{"internalType":"uint256","name":"maturity","type":"uint256"},{"internalType":"uint256","name":"rcfThreshold","type":"uint256"},{"internalType":"address","name":"enterGate","type":"address"},{"internalType":"address","name":"liquidatorGate","type":"address"}],"internalType":"struct Market","name":"market","type":"tuple"}],"stateMutability":"view","type":"function"}],
1130
1130
  "networks": {
1131
- "1": {
1132
- "address": "0xB64FBf011343961D9AC4A04b714414E35ebE6BE0",
1133
- "createdBlock": 25938908,
1134
- },
1135
1131
  "8453": {
1136
1132
  "address": "0x3aa272f329E8B562A3bA56Bb6979a44D23A28839",
1137
1133
  "createdBlock": 48932293,
@@ -8,7 +8,7 @@ import {
8
8
  MorphoMidnightParsedBook,
9
9
  NetworkNumber,
10
10
  } from '../../types';
11
- import { isTenorMidnightMarket, midnightCoreAddress } from '../../markets/morphoMidnight';
11
+ import { isTenorMidnightMarket, MIDNIGHT_BASE } from '../../markets/morphoMidnight';
12
12
  import type {
13
13
  MorphoMidnightBorrowQuote,
14
14
  MorphoMidnightPaybackQuote,
@@ -83,15 +83,11 @@ interface TenorOfferFill {
83
83
  /**
84
84
  * Tenor's offer JSON is flat (market fields live on the offer). Morpho's is nested, and that nested
85
85
  * shape is what the app encodes for `Midnight.take`. Map Tenor into that shape so recipes stay on one encoder.
86
- *
87
- * The core address is the one field Tenor's offer does not carry, so it is derived from the offer's own
88
- * `chain_id` rather than the caller's network — an offer names the chain it was made on, and taking it
89
- * against another chain's core would address a market that does not exist.
90
86
  */
91
87
  export const tenorOfferToApiOffer = (offer: TenorOffer) => ({
92
88
  market: {
93
89
  chain_id: offer.chain_id,
94
- midnight: midnightCoreAddress(Number(offer.chain_id) as NetworkNumber),
90
+ midnight: MIDNIGHT_BASE,
95
91
  loan_token: offer.loan_token_address,
96
92
  collaterals: offer.collaterals || [],
97
93
  maturity: offer.maturity,
@@ -181,6 +181,17 @@ export const AAVE_V4_MAIN_SPOKE = (networkId: NetworkNumber): AaveV4SpokeInfo =>
181
181
  ],
182
182
  });
183
183
 
184
+ export const AAVE_V4_PAXG_GOLD_SPOKE = (networkId: NetworkNumber): AaveV4SpokeInfo => ({
185
+ chainIds: [NetworkNumber.Eth],
186
+ label: 'PAXG Gold',
187
+ value: AaveV4SpokesType.AaveV4PaxgGoldSpoke,
188
+ url: 'paxg-gold',
189
+ address: '0xAD75cE6354f87F3135cE10621d385d8D1e2562C2',
190
+ hubs: [
191
+ AAVE_V4_PAXOS_HUB(NetworkNumber.Eth).address,
192
+ ],
193
+ });
194
+
184
195
  export const AAVE_V4_USDG_PENDLE_SPOKE = (networkId: NetworkNumber): AaveV4SpokeInfo => ({
185
196
  chainIds: [NetworkNumber.Eth],
186
197
  label: 'USDG Pendle',
@@ -216,6 +227,7 @@ export const AaveV4Spokes = (networkId: NetworkNumber) => ({
216
227
  [AaveV4SpokesType.AaveV4LidoSpoke]: AAVE_V4_LIDO_SPOKE(networkId),
217
228
  [AaveV4SpokesType.AaveV4LombardBtcSpoke]: AAVE_V4_LOMBARD_BTC_SPOKE(networkId),
218
229
  [AaveV4SpokesType.AaveV4MainSpoke]: AAVE_V4_MAIN_SPOKE(networkId),
230
+ [AaveV4SpokesType.AaveV4PaxgGoldSpoke]: AAVE_V4_PAXG_GOLD_SPOKE(networkId),
219
231
  [AaveV4SpokesType.AaveV4USDGPendleSpoke]: AAVE_V4_USDG_PENDLE_SPOKE(networkId),
220
232
  [AaveV4SpokesType.AaveV4USDGMapleSpoke]: AAVE_V4_USDG_MAPLE_SPOKE(networkId),
221
233
  }) as const;
@@ -19,7 +19,6 @@ export { CrvUsdMarkets } from './curveUsd';
19
19
  export { MorphoBlueMarkets, findMorphoBlueMarket } from './morphoBlue';
20
20
  export {
21
21
  MorphoMidnightMarkets, findMorphoMidnightMarket, isTenorMidnightMarket, morphoMidnightMarketCollateralParams,
22
- morphoMidnightVisibleCollaterals,
23
22
  } from './morphoMidnight';
24
23
  export { LlamaLendMarkets } from './llamaLend';
25
24
  export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';