@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.
- package/cjs/claiming/compV3.js +1 -0
- package/cjs/config/contracts.d.ts +0 -4
- package/cjs/config/contracts.js +0 -4
- package/cjs/helpers/morphoMidnightHelpers/tenor.d.ts +2 -6
- package/cjs/helpers/morphoMidnightHelpers/tenor.js +1 -5
- package/cjs/markets/aaveV4/index.d.ts +2 -0
- package/cjs/markets/aaveV4/index.js +13 -1
- package/cjs/markets/index.d.ts +1 -1
- package/cjs/markets/index.js +1 -2
- package/cjs/markets/morphoMidnight/index.d.ts +10 -92
- package/cjs/markets/morphoMidnight/index.js +60 -519
- package/cjs/morphoMidnight/index.js +1 -11
- package/cjs/types/aaveV4.d.ts +1 -0
- package/cjs/types/aaveV4.js +1 -0
- package/cjs/types/morphoMidnight.d.ts +4 -57
- package/cjs/types/morphoMidnight.js +0 -45
- package/esm/claiming/compV3.js +1 -0
- package/esm/config/contracts.d.ts +0 -4
- package/esm/config/contracts.js +0 -4
- package/esm/helpers/morphoMidnightHelpers/tenor.d.ts +2 -6
- package/esm/helpers/morphoMidnightHelpers/tenor.js +2 -6
- package/esm/markets/aaveV4/index.d.ts +2 -0
- package/esm/markets/aaveV4/index.js +11 -0
- package/esm/markets/index.d.ts +1 -1
- package/esm/markets/index.js +1 -1
- package/esm/markets/morphoMidnight/index.d.ts +10 -92
- package/esm/markets/morphoMidnight/index.js +59 -473
- package/esm/morphoMidnight/index.js +1 -11
- package/esm/types/aaveV4.d.ts +1 -0
- package/esm/types/aaveV4.js +1 -0
- package/esm/types/morphoMidnight.d.ts +4 -57
- package/esm/types/morphoMidnight.js +0 -45
- package/package.json +2 -2
- package/src/claiming/compV3.ts +1 -0
- package/src/config/contracts.ts +0 -4
- package/src/helpers/morphoMidnightHelpers/tenor.ts +2 -6
- package/src/markets/aaveV4/index.ts +12 -0
- package/src/markets/index.ts +0 -1
- package/src/markets/morphoMidnight/index.ts +61 -724
- package/src/morphoMidnight/index.ts +1 -8
- package/src/types/aaveV4.ts +1 -0
- package/src/types/morphoMidnight.ts +3 -59
|
@@ -71,12 +71,8 @@ export async function _getMorphoMidnightMarketData(provider: Client, network: Ne
|
|
|
71
71
|
borrowIncentives: [],
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
// `collaterals` is the full on-chain set, so `i` is the index `prices` is keyed by. Hidden entries
|
|
75
|
-
// (curator vaults, the loan token itself) are skipped rather than filtered out beforehand, which would
|
|
76
|
-
// shift every later collateral onto the wrong price.
|
|
77
74
|
const collateralSymbols: string[] = [];
|
|
78
75
|
collaterals.forEach((coll, i) => {
|
|
79
|
-
if (coll.hidden) return;
|
|
80
76
|
const collInfo = getAssetInfoByAddress(coll.token, network);
|
|
81
77
|
const collSym = wethToEth(collInfo.symbol);
|
|
82
78
|
collateralSymbols.push(collSym);
|
|
@@ -142,10 +138,8 @@ export async function _getMorphoMidnightAccountData(provider: Client, network: N
|
|
|
142
138
|
borrowedUsd: new Dec(debt).mul(loanTokenData.price).toString(),
|
|
143
139
|
};
|
|
144
140
|
|
|
145
|
-
// positionInfo.collateral is index-aligned with the market's
|
|
146
|
-
// unused), so hidden entries are skipped in place rather than filtered out first.
|
|
141
|
+
// positionInfo.collateral is index-aligned with the market's collateral set (0 where unused).
|
|
147
142
|
collaterals.forEach((coll, i) => {
|
|
148
|
-
if (coll.hidden) return;
|
|
149
143
|
const collInfo = getAssetInfoByAddress(coll.token, network);
|
|
150
144
|
const collSym = wethToEth(collInfo.symbol);
|
|
151
145
|
const rawAmount = positionInfo.collateral[i] ? positionInfo.collateral[i].toString() : '0';
|
|
@@ -234,7 +228,6 @@ export const _getMorphoMidnightAccountBalances = async (provider: Client, networ
|
|
|
234
228
|
|
|
235
229
|
const collateral: Record<string, string> = {};
|
|
236
230
|
collaterals.forEach((coll, i) => {
|
|
237
|
-
if (coll.hidden) return;
|
|
238
231
|
const collInfo = getAssetInfoByAddress(coll.token, network);
|
|
239
232
|
const rawAmount = positionInfo.collateral[i] ? positionInfo.collateral[i].toString() : '0';
|
|
240
233
|
collateral[addressMapping ? collInfo.address.toLowerCase() : wethToEth(collInfo.symbol)] = assetAmountInEth(rawAmount, wethToEth(collInfo.symbol));
|
package/src/types/aaveV4.ts
CHANGED
|
@@ -20,6 +20,7 @@ export enum AaveV4SpokesType {
|
|
|
20
20
|
AaveV4LidoSpoke = 'aave_v4_lido_spoke',
|
|
21
21
|
AaveV4LombardBtcSpoke = 'aave_v4_lombard_btc_spoke',
|
|
22
22
|
AaveV4MainSpoke = 'aave_v4_main_spoke',
|
|
23
|
+
AaveV4PaxgGoldSpoke = 'aave_v4_paxg_gold_spoke',
|
|
23
24
|
AaveV4USDGPendleSpoke = 'aave_v4_usdg_pendle_spoke',
|
|
24
25
|
AaveV4USDGMapleSpoke = 'aave_v4_usdg_maple_spoke',
|
|
25
26
|
}
|
|
@@ -39,51 +39,6 @@ export enum MorphoMidnightVersions {
|
|
|
39
39
|
MorphoMidnightTenorCbETHWETH_20261127_Base = 'morphomidnighttenorcbethweth_20261127_base',
|
|
40
40
|
MorphoMidnightTenorCbETHWETH_20261225_Base = 'morphomidnighttenorcbethweth_20261225_base',
|
|
41
41
|
MorphoMidnightTenorCbETHWETH_20270129_Base = 'morphomidnighttenorcbethweth_20270129_base',
|
|
42
|
-
// ETHEREUM
|
|
43
|
-
// Sourced from the official listing at https://markets.morpho.org/fixed?chains=1
|
|
44
|
-
MorphoMidnightWBTCUSDC_860_20260925_Eth = 'morphomidnightwbtcusdc_860_20260925_eth',
|
|
45
|
-
MorphoMidnightWBTCUSDC_860_20261030_Eth = 'morphomidnightwbtcusdc_860_20261030_eth',
|
|
46
|
-
MorphoMidnightWBTCUSDC_860_20261127_Eth = 'morphomidnightwbtcusdc_860_20261127_eth',
|
|
47
|
-
MorphoMidnightWBTCUSDC_860_20261225_Eth = 'morphomidnightwbtcusdc_860_20261225_eth',
|
|
48
|
-
MorphoMidnightWBTCUSDC_860_20270129_Eth = 'morphomidnightwbtcusdc_860_20270129_eth',
|
|
49
|
-
MorphoMidnightWBTCUSDC_860_20270226_Eth = 'morphomidnightwbtcusdc_860_20270226_eth',
|
|
50
|
-
MorphoMidnightWBTCUSDC_860_20270326_Eth = 'morphomidnightwbtcusdc_860_20270326_eth',
|
|
51
|
-
MorphoMidnightCbBTCUSDC_860_20260925_Eth = 'morphomidnightcbbtcusdc_860_20260925_eth',
|
|
52
|
-
MorphoMidnightCbBTCUSDC_860_20261030_Eth = 'morphomidnightcbbtcusdc_860_20261030_eth',
|
|
53
|
-
MorphoMidnightCbBTCUSDC_860_20261127_Eth = 'morphomidnightcbbtcusdc_860_20261127_eth',
|
|
54
|
-
MorphoMidnightCbBTCUSDC_860_20261225_Eth = 'morphomidnightcbbtcusdc_860_20261225_eth',
|
|
55
|
-
MorphoMidnightCbBTCUSDC_860_20270129_Eth = 'morphomidnightcbbtcusdc_860_20270129_eth',
|
|
56
|
-
MorphoMidnightCbBTCUSDC_860_20270226_Eth = 'morphomidnightcbbtcusdc_860_20270226_eth',
|
|
57
|
-
MorphoMidnightCbBTCUSDC_860_20270326_Eth = 'morphomidnightcbbtcusdc_860_20270326_eth',
|
|
58
|
-
// Tenor-hosted Midnight markets (same core, different order book)
|
|
59
|
-
MorphoMidnightTenorReUSDUSDC_20260925_Eth = 'morphomidnighttenorreusdusdc_20260925_eth',
|
|
60
|
-
MorphoMidnightTenorReUSDUSDC_20261030_Eth = 'morphomidnighttenorreusdusdc_20261030_eth',
|
|
61
|
-
MorphoMidnightTenorReUSDUSDC_20261127_Eth = 'morphomidnighttenorreusdusdc_20261127_eth',
|
|
62
|
-
MorphoMidnightTenorReUSDUSDC_20261225_Eth = 'morphomidnighttenorreusdusdc_20261225_eth',
|
|
63
|
-
MorphoMidnightTenorSiUSDUSDC_20260925_Eth = 'morphomidnighttenorsiusdusdc_20260925_eth',
|
|
64
|
-
MorphoMidnightTenorSiUSDUSDC_20261030_Eth = 'morphomidnighttenorsiusdusdc_20261030_eth',
|
|
65
|
-
MorphoMidnightTenorSiUSDUSDC_20261127_Eth = 'morphomidnighttenorsiusdusdc_20261127_eth',
|
|
66
|
-
MorphoMidnightTenorSiUSDUSDC_20261225_Eth = 'morphomidnighttenorsiusdusdc_20261225_eth',
|
|
67
|
-
MorphoMidnightTenorStrUSDUSDC_20260925_Eth = 'morphomidnighttenorstrusdusdc_20260925_eth',
|
|
68
|
-
MorphoMidnightTenorStrUSDUSDC_20261030_Eth = 'morphomidnighttenorstrusdusdc_20261030_eth',
|
|
69
|
-
MorphoMidnightTenorStrUSDUSDC_20261127_Eth = 'morphomidnighttenorstrusdusdc_20261127_eth',
|
|
70
|
-
MorphoMidnightTenorStrUSDUSDC_20261225_Eth = 'morphomidnighttenorstrusdusdc_20261225_eth',
|
|
71
|
-
MorphoMidnightTenorUSD3USDC_20260925_Eth = 'morphomidnighttenorusd3usdc_20260925_eth',
|
|
72
|
-
MorphoMidnightTenorUSD3USDC_20261030_Eth = 'morphomidnighttenorusd3usdc_20261030_eth',
|
|
73
|
-
MorphoMidnightTenorUSD3USDC_20261127_Eth = 'morphomidnighttenorusd3usdc_20261127_eth',
|
|
74
|
-
MorphoMidnightTenorUSD3USDC_20261225_Eth = 'morphomidnighttenorusd3usdc_20261225_eth',
|
|
75
|
-
MorphoMidnightTenorWETHUSDC_20260925_Eth = 'morphomidnighttenorwethusdc_20260925_eth',
|
|
76
|
-
MorphoMidnightTenorWETHUSDC_20261030_Eth = 'morphomidnighttenorwethusdc_20261030_eth',
|
|
77
|
-
MorphoMidnightTenorWETHUSDC_20261127_Eth = 'morphomidnighttenorwethusdc_20261127_eth',
|
|
78
|
-
MorphoMidnightTenorWETHUSDC_20261225_Eth = 'morphomidnighttenorwethusdc_20261225_eth',
|
|
79
|
-
MorphoMidnightTenorWsrUSDUSDC_20260925_Eth = 'morphomidnighttenorwsrusdusdc_20260925_eth',
|
|
80
|
-
MorphoMidnightTenorWsrUSDUSDC_20261030_Eth = 'morphomidnighttenorwsrusdusdc_20261030_eth',
|
|
81
|
-
MorphoMidnightTenorWsrUSDUSDC_20261127_Eth = 'morphomidnighttenorwsrusdusdc_20261127_eth',
|
|
82
|
-
MorphoMidnightTenorWsrUSDUSDC_20261225_Eth = 'morphomidnighttenorwsrusdusdc_20261225_eth',
|
|
83
|
-
MorphoMidnightTenorWstETHWETH_20260925_Eth = 'morphomidnighttenorwstethweth_20260925_eth',
|
|
84
|
-
MorphoMidnightTenorWstETHWETH_20261030_Eth = 'morphomidnighttenorwstethweth_20261030_eth',
|
|
85
|
-
MorphoMidnightTenorWstETHWETH_20261127_Eth = 'morphomidnighttenorwstethweth_20261127_eth',
|
|
86
|
-
MorphoMidnightTenorWstETHWETH_20261225_Eth = 'morphomidnighttenorwstethweth_20261225_eth',
|
|
87
42
|
}
|
|
88
43
|
|
|
89
44
|
export type MorphoMidnightCurator = 'Morpho' | 'Tenor';
|
|
@@ -93,13 +48,6 @@ export interface MorphoMidnightCollateralParams {
|
|
|
93
48
|
lltv: number | string,
|
|
94
49
|
liquidationCursor: number | string,
|
|
95
50
|
oracle: EthAddress,
|
|
96
|
-
/**
|
|
97
|
-
* A collateral the market carries on-chain but the app never surfaces: a curator's own vault share
|
|
98
|
-
* token (Tenor's collateral vaults) or the loan token itself (Morpho's mainnet ladders list USDC at
|
|
99
|
-
* 98% next to the real collateral). It is not an asset the app deals in — nothing renders, prices or
|
|
100
|
-
* supplies it — but it stays in `collaterals` because the market id is the hash of the full set.
|
|
101
|
-
*/
|
|
102
|
-
hidden?: boolean,
|
|
103
51
|
}
|
|
104
52
|
|
|
105
53
|
export interface MorphoMidnightMarketData {
|
|
@@ -110,15 +58,11 @@ export interface MorphoMidnightMarketData {
|
|
|
110
58
|
value: MorphoMidnightVersions,
|
|
111
59
|
midnight: EthAddress,
|
|
112
60
|
loanToken: EthAddress,
|
|
61
|
+
collaterals: MorphoMidnightCollateralParams[],
|
|
113
62
|
/**
|
|
114
|
-
*
|
|
115
|
-
* hashed from, so neither the set nor the order may be rearranged. Entries the app does not deal in
|
|
116
|
-
* are flagged `hidden` rather than kept in a second list: their on-chain position varies per market
|
|
117
|
-
* (Morpho's mainnet cbBTC ladder lists USDC first, its WBTC ladder second), so a separate list can
|
|
118
|
-
* only be re-joined by guessing, and every positional read — `MarketInfo.prices[i]`,
|
|
119
|
-
* `PositionInfo.collateral[i]`, the collateral index a supply call takes — indexes into *this* array.
|
|
63
|
+
* Tenor's curated markets list the curator's own vault share token next to the real collateral.
|
|
120
64
|
*/
|
|
121
|
-
|
|
65
|
+
hiddenCollaterals?: MorphoMidnightCollateralParams[],
|
|
122
66
|
maturity: number, // unix timestamp (seconds)
|
|
123
67
|
rcfThreshold: number | string,
|
|
124
68
|
enterGate: EthAddress,
|