@1delta/margin-fetcher 0.0.37 → 0.0.39
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/dist/lending/aave-v2-type/publicCallParse.d.ts +4 -4
- package/dist/lending/aave-v2-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/aave-v2-type/publicCallParse.js +60 -32
- package/dist/lending/aave-v3-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/aave-v3-type/publicCallParse.js +46 -33
- package/dist/lending/addresses/meridian.d.ts +3 -0
- package/dist/lending/addresses/meridian.d.ts.map +1 -1
- package/dist/lending/addresses/meridian.js +4 -1
- package/dist/lending/fetchLenderAll.d.ts.map +1 -1
- package/dist/lending/fetchLenderAll.js +2 -0
- package/dist/lending/morpho/constants/markets.d.ts.map +1 -1
- package/dist/lending/morpho/constants/markets.js +30 -0
- package/dist/lending/morpho/fetchPublic.d.ts.map +1 -1
- package/dist/lending/morpho/fetchPublic.js +45 -13
- package/dist/lending/morpho/getMarketsFromChain.d.ts.map +1 -1
- package/dist/lending/user-data/morpho/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/morpho/userCallBuild.js +1 -0
- package/dist/prices/defillama/index.d.ts.map +1 -1
- package/dist/prices/defillama/index.js +14 -2
- package/dist/prices/main-prices/fetchOracleData.js +8 -6
- package/dist/utils/parsing.d.ts +1 -1
- package/dist/utils/parsing.d.ts.map +1 -1
- package/dist/utils/parsing.js +2 -2
- package/dist/yields/index.d.ts.map +1 -1
- package/dist/yields/index.js +28 -1
- package/package.json +1 -1
- package/src/lending/aave-v2-type/publicCallParse.ts +334 -92
- package/src/lending/aave-v3-type/publicCallParse.ts +80 -56
- package/src/lending/addresses/meridian.ts +4 -1
- package/src/lending/fetchLenderAll.ts +1 -0
- package/src/lending/morpho/constants/markets.ts +30 -0
- package/src/lending/morpho/fetchPublic.ts +50 -14
- package/src/lending/morpho/getMarketsFromChain.ts +0 -1
- package/src/lending/user-data/morpho/userCallBuild.ts +1 -0
- package/src/prices/defillama/index.ts +16 -2
- package/src/prices/main-prices/fetchOracleData.ts +7 -6
- package/src/utils/parsing.ts +2 -2
- package/src/yields/index.ts +39 -0
- package/test/flashLiquidity.test.ts +2 -2
- package/test/lenderData.test.ts +3 -3
- package/test/mainPrices.test.ts +4 -3
- package/test/mbChain.test.ts +3 -4
- package/test/morpho.test.ts +1 -1
- package/test/userDataAaveTelos.test.ts +85 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Lender } from
|
|
2
|
-
import { AaveV2GeneralPublicResponse } from
|
|
3
|
-
import { AdditionalYields } from
|
|
4
|
-
import { GenericTokenList } from
|
|
1
|
+
import { Lender } from '@1delta/lender-registry';
|
|
2
|
+
import { AaveV2GeneralPublicResponse } from './types';
|
|
3
|
+
import { AdditionalYields } from '../../types';
|
|
4
|
+
import { GenericTokenList } from '../types';
|
|
5
5
|
export declare const getAaveV2ReservesDataConverter: (lender: Lender, chainId: string, prices: {
|
|
6
6
|
[asset: string]: number;
|
|
7
7
|
}, additionalYields: AdditionalYields, tokenList?: GenericTokenList) => [(data: any[]) => AaveV2GeneralPublicResponse | undefined, number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v2-type/publicCallParse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v2-type/publicCallParse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAahD,OAAO,EACL,2BAA2B,EAI5B,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG3C,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,YAAW,gBAAqB,KAC/B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,2BAA2B,GAAG,SAAS,EAAE,MAAM,CAqgBnE,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Lender } from
|
|
2
|
-
import { getAaveAssets, LENDER_MODE_NO_MODE, toGenericPriceKey, toOracleKey } from
|
|
3
|
-
import { BPS, convertRateToApr, formatAaveRawApyToApr, parseRawAmount } from
|
|
4
|
-
import { AaveV2TypeGetReserveConfigurationData, AaveV2TypeGetReserveDataIndexes, AaveV2TypeIncentivesControllerPoolInfoIndexes } from
|
|
1
|
+
import { Lender } from '@1delta/lender-registry';
|
|
2
|
+
import { getAaveAssets, LENDER_MODE_NO_MODE, toGenericPriceKey, toOracleKey, } from '../../assets';
|
|
3
|
+
import { BPS, convertRateToApr, formatAaveRawApyToApr, parseRawAmount, } from '../../utils/parsing';
|
|
4
|
+
import { AaveV2TypeGetReserveConfigurationData, AaveV2TypeGetReserveDataIndexes, AaveV2TypeIncentivesControllerPoolInfoIndexes, } from './types';
|
|
5
|
+
import { Chain } from '@1delta/chain-registry';
|
|
5
6
|
export const getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields, tokenList = {}) => {
|
|
6
7
|
switch (lender) {
|
|
7
8
|
case Lender.AURELIUS: {
|
|
@@ -26,8 +27,11 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
26
27
|
const totalStableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalStableDebt]?.toString(), decimals);
|
|
27
28
|
const totalVariableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalVariableDebt]?.toString(), decimals);
|
|
28
29
|
const liquidity = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.availableLiquidity]?.toString(), decimals);
|
|
29
|
-
const totalAToken = Number(liquidity) +
|
|
30
|
-
|
|
30
|
+
const totalAToken = Number(liquidity) +
|
|
31
|
+
Number(totalStableDebt) +
|
|
32
|
+
Number(totalVariableDebt);
|
|
33
|
+
const oracleKey = toOracleKey(assetMeta?.assetGroup) ??
|
|
34
|
+
toGenericPriceKey(asset, chainId);
|
|
31
35
|
const price = prices[oracleKey] ?? 1;
|
|
32
36
|
const totalDepositsUSD = totalAToken * price;
|
|
33
37
|
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
@@ -53,14 +57,24 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
53
57
|
// rewards
|
|
54
58
|
rewards: {
|
|
55
59
|
WMNT: {
|
|
56
|
-
depositRate: convertRateToApr(parseRawAmount(emission0PerSecondCollateral)) /
|
|
57
|
-
|
|
60
|
+
depositRate: (convertRateToApr(parseRawAmount(emission0PerSecondCollateral)) /
|
|
61
|
+
totalDepositsUSD) *
|
|
62
|
+
prices['WMNT'],
|
|
63
|
+
variableBorrowRate: (convertRateToApr(parseRawAmount(emission0PerSecondDebt)) /
|
|
64
|
+
totalDebtUSD) *
|
|
65
|
+
prices['WMNT'],
|
|
58
66
|
stableBorrowRate: 0,
|
|
59
67
|
},
|
|
60
68
|
// oAU allows for a 50% discount to pruchase AU, hence the price is the price of AU divided by 2
|
|
61
69
|
OAU: {
|
|
62
|
-
depositRate: convertRateToApr(parseRawAmount(emission1PerSecondCollateral)) /
|
|
63
|
-
|
|
70
|
+
depositRate: ((convertRateToApr(parseRawAmount(emission1PerSecondCollateral)) /
|
|
71
|
+
totalDepositsUSD) *
|
|
72
|
+
(prices['AU'] ?? 0)) /
|
|
73
|
+
2,
|
|
74
|
+
variableBorrowRate: ((convertRateToApr(parseRawAmount(emission1PerSecondDebt)) /
|
|
75
|
+
totalDebtUSD) *
|
|
76
|
+
(prices['AU'] ?? 0)) /
|
|
77
|
+
2,
|
|
64
78
|
stableBorrowRate: 0,
|
|
65
79
|
},
|
|
66
80
|
},
|
|
@@ -70,9 +84,10 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
70
84
|
category: LENDER_MODE_NO_MODE,
|
|
71
85
|
// collateral factors
|
|
72
86
|
borrowCollateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData.ltv].toString()) / BPS,
|
|
73
|
-
collateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
collateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData
|
|
88
|
+
.liquidationThreshold].toString()) / BPS,
|
|
89
|
+
borrowFactor: 1,
|
|
90
|
+
},
|
|
76
91
|
},
|
|
77
92
|
liquidationBonus: Number(configData?.[AaveV2TypeGetReserveConfigurationData.liquidationBonus].toString()) / BPS,
|
|
78
93
|
// flags
|
|
@@ -102,22 +117,29 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
102
117
|
const rewardsPerSecond = Number(parseRawAmount(data[expectedNumberOfCalls - 2].toString(), 18));
|
|
103
118
|
const totalAllocPoint = Number(data[expectedNumberOfCalls - 1].toString());
|
|
104
119
|
const resultReserves = {};
|
|
105
|
-
const lendPrice = prices[
|
|
120
|
+
const lendPrice = prices['LEND'];
|
|
106
121
|
for (let i = 0; i < assetsToQuery.length; i++) {
|
|
107
122
|
const asset = assetsToQuery[i];
|
|
108
123
|
const reserveData = data[i * 4];
|
|
109
124
|
const configData = data[i * 4 + 1];
|
|
110
125
|
const collateralRewardIndex = i * 4 + 2;
|
|
111
126
|
const borrowRewardIndex = i * 4 + 3;
|
|
112
|
-
const collateralRewards = Number(data?.[collateralRewardIndex]?.[AaveV2TypeIncentivesControllerPoolInfoIndexes.allocPoint].toString()) /
|
|
113
|
-
|
|
127
|
+
const collateralRewards = (Number(data?.[collateralRewardIndex]?.[AaveV2TypeIncentivesControllerPoolInfoIndexes.allocPoint].toString()) /
|
|
128
|
+
totalAllocPoint) *
|
|
129
|
+
rewardsPerSecond;
|
|
130
|
+
const borrowRewards = (Number(data?.[borrowRewardIndex]?.[AaveV2TypeIncentivesControllerPoolInfoIndexes.allocPoint].toString()) /
|
|
131
|
+
totalAllocPoint) *
|
|
132
|
+
rewardsPerSecond;
|
|
114
133
|
const assetMeta = tokenList[asset];
|
|
115
134
|
const decimals = assetMeta?.decimals ?? 18;
|
|
116
135
|
const totalStableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalStableDebt]?.toString(), decimals);
|
|
117
136
|
const totalVariableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalVariableDebt]?.toString(), decimals);
|
|
118
137
|
const liquidity = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.availableLiquidity]?.toString(), decimals);
|
|
119
|
-
const totalAToken = Number(liquidity) +
|
|
120
|
-
|
|
138
|
+
const totalAToken = Number(liquidity) +
|
|
139
|
+
Number(totalStableDebt) +
|
|
140
|
+
Number(totalVariableDebt);
|
|
141
|
+
const oracleKey = toOracleKey(assetMeta?.assetGroup) ??
|
|
142
|
+
toGenericPriceKey(asset, chainId);
|
|
121
143
|
const price = prices?.[oracleKey] ?? 1;
|
|
122
144
|
const totalDepositsUSD = totalAToken * price;
|
|
123
145
|
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
@@ -143,7 +165,8 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
143
165
|
// rewards
|
|
144
166
|
rewards: {
|
|
145
167
|
LEND: {
|
|
146
|
-
depositRate: convertRateToApr(collateralRewards / totalDepositsUSD) *
|
|
168
|
+
depositRate: convertRateToApr(collateralRewards / totalDepositsUSD) *
|
|
169
|
+
lendPrice,
|
|
147
170
|
variableBorrowRate: convertRateToApr(totalDebtUSD > 0 ? borrowRewards / totalDebtUSD : 0) * lendPrice,
|
|
148
171
|
stableBorrowRate: 0,
|
|
149
172
|
},
|
|
@@ -154,9 +177,10 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
154
177
|
category: LENDER_MODE_NO_MODE,
|
|
155
178
|
// collateral factors
|
|
156
179
|
borrowCollateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData.ltv].toString()) / BPS,
|
|
157
|
-
collateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData
|
|
158
|
-
|
|
159
|
-
|
|
180
|
+
collateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData
|
|
181
|
+
.liquidationThreshold].toString()) / BPS,
|
|
182
|
+
borrowFactor: 1,
|
|
183
|
+
},
|
|
160
184
|
},
|
|
161
185
|
liquidationBonus: Number(configData?.[AaveV2TypeGetReserveConfigurationData.liquidationBonus].toString()) / BPS,
|
|
162
186
|
// flags
|
|
@@ -195,7 +219,8 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
195
219
|
const totalVariableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalVariableDebt]?.toString(), decimals);
|
|
196
220
|
const liquidity = Number(parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.availableLiquidity]?.toString(), decimals));
|
|
197
221
|
const totalAToken = liquidity + Number(totalStableDebt) + Number(totalVariableDebt);
|
|
198
|
-
const oracleKey = toOracleKey(assetMeta?.assetGroup) ??
|
|
222
|
+
const oracleKey = toOracleKey(assetMeta?.assetGroup) ??
|
|
223
|
+
toGenericPriceKey(asset, chainId);
|
|
199
224
|
const price = prices[oracleKey] ?? 1;
|
|
200
225
|
const totalDepositsUSD = Number(totalAToken) * price;
|
|
201
226
|
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
@@ -219,22 +244,25 @@ export const getAaveV2ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
219
244
|
stableBorrowRate: formatAaveRawApyToApr(reserveData?.[AaveV2TypeGetReserveDataIndexes.stableBorrowRate]?.toString()),
|
|
220
245
|
stakingYield: additionalYields.intrinsicYields[oracleKey] ?? 0,
|
|
221
246
|
// rewards
|
|
222
|
-
rewards: lender === Lender.MERIDIAN
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
247
|
+
rewards: lender === Lender.MERIDIAN && chainId === Chain.TAIKO_ALETHIA
|
|
248
|
+
? {
|
|
249
|
+
TAIKO: {
|
|
250
|
+
depositRate: additionalYields.lenderRewards[Lender.MERIDIAN]?.[asset]?.deposit ?? 0,
|
|
251
|
+
variableBorrowRate: additionalYields.lenderRewards[Lender.MERIDIAN]?.[asset]?.borrow ?? 0,
|
|
252
|
+
stableBorrowRate: 0,
|
|
253
|
+
},
|
|
227
254
|
}
|
|
228
|
-
|
|
255
|
+
: {},
|
|
229
256
|
decimals: Number(configData?.[AaveV2TypeGetReserveConfigurationData.decimals]),
|
|
230
257
|
config: {
|
|
231
258
|
[LENDER_MODE_NO_MODE]: {
|
|
232
259
|
category: LENDER_MODE_NO_MODE,
|
|
233
260
|
// collateral factors
|
|
234
261
|
borrowCollateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData.ltv].toString()) / BPS,
|
|
235
|
-
collateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData
|
|
236
|
-
|
|
237
|
-
|
|
262
|
+
collateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData
|
|
263
|
+
.liquidationThreshold].toString()) / BPS,
|
|
264
|
+
borrowFactor: 1,
|
|
265
|
+
},
|
|
238
266
|
},
|
|
239
267
|
liquidationBonus: Number(configData?.[AaveV2TypeGetReserveConfigurationData.liquidationBonus].toString()) / BPS,
|
|
240
268
|
// flags
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v3-type/publicCallParse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAK5B,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAOhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG3C,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,YAAW,gBAAqB,KAC/B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,2BAA2B,GAAG,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"publicCallParse.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v3-type/publicCallParse.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAK5B,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE9C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAOhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAG3C,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,YAAW,gBAAqB,KAC/B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,2BAA2B,GAAG,SAAS,EAAE,MAAM,CA0LnE,CAAA;AAkFD,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,GAAG,EACrB,MAAM,EAAE,GAAG,EACX,SAAS,EAAE,GAAG,GACb,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,SAAS,EAAE,MAAM,CAAC,CAuH5C"}
|
|
@@ -79,22 +79,8 @@ export const getAaveV3ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
79
79
|
resultReserves[asset] = {
|
|
80
80
|
...resultReserves[asset],
|
|
81
81
|
decimals: Number(configData?.[AaveV3GetreserveConfigDataIndexes.decimals]),
|
|
82
|
-
config:
|
|
83
|
-
|
|
84
|
-
BPS, Number(configData?.[AaveV3GetreserveConfigDataIndexes.liquidationThreshold]) / BPS),
|
|
85
|
-
...(eModeCategory !== 0
|
|
86
|
-
? {
|
|
87
|
-
[eModeCategory]: {
|
|
88
|
-
category: eModeCategory,
|
|
89
|
-
label: eModeConfigs[eModeCategory]?.label ?? 'Default',
|
|
90
|
-
borrowCollateralFactor: eModeConfigs[eModeCategory]?.borrowCollateralFactor ??
|
|
91
|
-
0,
|
|
92
|
-
collateralFactor: eModeConfigs[eModeCategory]?.collateralFactor ?? 0,
|
|
93
|
-
borrowFactor: 1,
|
|
94
|
-
},
|
|
95
|
-
}
|
|
96
|
-
: {}),
|
|
97
|
-
},
|
|
82
|
+
config: populateEModes(Number(configData?.[AaveV3GetreserveConfigDataIndexes.ltv]) /
|
|
83
|
+
BPS, Number(configData?.[AaveV3GetreserveConfigDataIndexes.liquidationThreshold]) / BPS, eModeCategory, eModeConfigs),
|
|
98
84
|
// flags
|
|
99
85
|
collateralActive: configData?.[AaveV3GetreserveConfigDataIndexes.usageAsCollateralEnabled],
|
|
100
86
|
borrowingEnabled: configData?.[AaveV3GetreserveConfigDataIndexes.borrowingEnabled],
|
|
@@ -120,7 +106,7 @@ export const getAaveV3ReservesDataConverter = (lender, chainId, prices, addition
|
|
|
120
106
|
}
|
|
121
107
|
}
|
|
122
108
|
};
|
|
123
|
-
const populateEModes = (borrowCollateralFactor, collateralFactor) => {
|
|
109
|
+
const populateEModes = (borrowCollateralFactor, collateralFactor, eModeCategory, eModeConfigs) => {
|
|
124
110
|
let data = {};
|
|
125
111
|
AAVE_V3_EMODES.forEach((e) => {
|
|
126
112
|
data[e] = {
|
|
@@ -129,6 +115,45 @@ const populateEModes = (borrowCollateralFactor, collateralFactor) => {
|
|
|
129
115
|
collateralFactor,
|
|
130
116
|
borrowFactor: 1,
|
|
131
117
|
};
|
|
118
|
+
if (e > 0)
|
|
119
|
+
data[e].debtDisabled = true;
|
|
120
|
+
if (e > 0 && e === eModeCategory && eModeConfigs[e]) {
|
|
121
|
+
data[e] = {
|
|
122
|
+
...data[e],
|
|
123
|
+
category: e,
|
|
124
|
+
label: eModeConfigs[e]?.label ?? 'Default',
|
|
125
|
+
borrowCollateralFactor: eModeConfigs[e]?.borrowCollateralFactor ?? 0,
|
|
126
|
+
collateralFactor: eModeConfigs[e]?.collateralFactor ?? 0,
|
|
127
|
+
borrowFactor: 1,
|
|
128
|
+
debtDisabled: false,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return data;
|
|
133
|
+
};
|
|
134
|
+
const populateEModes32 = (borrowCollateralFactor, collateralFactor, collateralBitmap, debtBitmap, assetIndex, eModeConfigs) => {
|
|
135
|
+
let data = {};
|
|
136
|
+
AAVE_V3_EMODES.forEach((e) => {
|
|
137
|
+
data[e] = {
|
|
138
|
+
category: e,
|
|
139
|
+
borrowCollateralFactor,
|
|
140
|
+
collateralFactor,
|
|
141
|
+
borrowFactor: 1,
|
|
142
|
+
};
|
|
143
|
+
if (e > 0)
|
|
144
|
+
data[e].debtDisabled = !!eModeConfigs[e];
|
|
145
|
+
if (e > 0 && eModeConfigs[e]) {
|
|
146
|
+
data[e] = {
|
|
147
|
+
...data[e],
|
|
148
|
+
category: e,
|
|
149
|
+
label: eModeConfigs[e]?.label ?? 'Default',
|
|
150
|
+
borrowCollateralFactor: eModeConfigs[e]?.borrowCollateralFactor ?? 0,
|
|
151
|
+
collateralFactor: eModeConfigs[e]?.collateralFactor ?? 0,
|
|
152
|
+
borrowFactor: 1,
|
|
153
|
+
collateralDisabled: !isReserveEnabledOnBitmap(collateralBitmap[e], assetIndex),
|
|
154
|
+
debtDisabled: !isReserveEnabledOnBitmap(debtBitmap[e], assetIndex),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
132
157
|
});
|
|
133
158
|
return data;
|
|
134
159
|
};
|
|
@@ -281,28 +306,16 @@ function parseAave32(chainId, lender, prices, additionalYields, tokenList) {
|
|
|
281
306
|
// rewards
|
|
282
307
|
rewards: {},
|
|
283
308
|
};
|
|
284
|
-
const
|
|
285
|
-
|
|
309
|
+
const assetIndex = lowerReservesList.indexOf(asset);
|
|
310
|
+
const activeEmodes = AAVE_V3_EMODES.map((mode) => isReserveEnabledOnBitmap(debtBitmap[mode], assetIndex) ||
|
|
311
|
+
isReserveEnabledOnBitmap(collateralBitmap[mode], assetIndex)
|
|
286
312
|
? mode
|
|
287
313
|
: -1).filter((m) => m !== undefined && m > 0);
|
|
288
314
|
const eModeCategory = activeEmodes.length === 0 ? 0 : activeEmodes[0]; // Number(emodeResult[index].toString())
|
|
289
315
|
resultReserves[asset] = {
|
|
290
316
|
...resultReserves[asset],
|
|
291
317
|
decimals: Number(configData?.[AaveV3GetreserveConfigDataIndexes.decimals]),
|
|
292
|
-
config:
|
|
293
|
-
...populateEModes(Number(configData?.[AaveV3GetreserveConfigDataIndexes.ltv]) / BPS, Number(configData?.[AaveV3GetreserveConfigDataIndexes.liquidationThreshold]) / BPS),
|
|
294
|
-
...(eModeCategory !== 0
|
|
295
|
-
? {
|
|
296
|
-
[eModeCategory]: {
|
|
297
|
-
category: eModeCategory,
|
|
298
|
-
label: eModeConfigs[eModeCategory]?.label ?? 'Default',
|
|
299
|
-
borrowCollateralFactor: eModeConfigs[eModeCategory]?.borrowCollateralFactor ?? 0,
|
|
300
|
-
collateralFactor: eModeConfigs[eModeCategory]?.collateralFactor ?? 0,
|
|
301
|
-
borrowFactor: 1,
|
|
302
|
-
},
|
|
303
|
-
}
|
|
304
|
-
: {}),
|
|
305
|
-
},
|
|
318
|
+
config: populateEModes32(Number(configData?.[AaveV3GetreserveConfigDataIndexes.ltv]) / BPS, Number(configData?.[AaveV3GetreserveConfigDataIndexes.liquidationThreshold]) / BPS, collateralBitmap, debtBitmap, assetIndex, eModeConfigs),
|
|
306
319
|
// flags
|
|
307
320
|
collateralActive: configData?.[AaveV3GetreserveConfigDataIndexes.usageAsCollateralEnabled],
|
|
308
321
|
borrowingEnabled: configData?.[AaveV3GetreserveConfigDataIndexes.borrowingEnabled],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meridian.d.ts","sourceRoot":"","sources":["../../../src/lending/addresses/meridian.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"meridian.d.ts","sourceRoot":"","sources":["../../../src/lending/addresses/meridian.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;CAajC,CAAA"}
|
|
@@ -4,7 +4,10 @@ export const addressesMeridianCore = {
|
|
|
4
4
|
[Chain.TAIKO_ALETHIA]: '0xd79417be2cE02fc22F2E520869b1DfC02a677751',
|
|
5
5
|
},
|
|
6
6
|
IncentivesController: {
|
|
7
|
-
[Chain.TAIKO_ALETHIA]: '0xb3020EbFD800B488B64E92A8717E826cBf0d63E2'
|
|
7
|
+
[Chain.TAIKO_ALETHIA]: '0xb3020EbFD800B488B64E92A8717E826cBf0d63E2',
|
|
8
|
+
[Chain.TELOS_EVM_MAINNET]: '0x406F044A5aBF071db08E4482c3487331Cf284ADc',
|
|
9
|
+
[Chain.FUSE_MAINNET]: '0xd2Fa60C6fab6EdF77E78A0908066d04a5F5EB1E0',
|
|
10
|
+
[Chain.METER_MAINNET]: '0xBAE27c0F27A7bff3f391A19E0dE2d241E2497a09',
|
|
8
11
|
},
|
|
9
12
|
MultiFeeDistribution: {
|
|
10
13
|
[Chain.TAIKO_ALETHIA]: '0xb0e103e2A80489Ba697D882EEd0Ba552389Ca31E'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchLenderAll.d.ts","sourceRoot":"","sources":["../../src/lending/fetchLenderAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"fetchLenderAll.d.ts","sourceRoot":"","sources":["../../src/lending/fetchLenderAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAGhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAc1C,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EACf,SAAS,MAAM,EAAE,EACjB,QAAQ;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACnC,kBAAkB,gBAAgB,EAClC,gBAAgB,sBAAsB,EACtC,YAAY,MAAM,OAAO,CAAC,gBAAgB,CAAC,KAC1C,OAAO,CAAC;IAAE,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,CAyBnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markets.d.ts","sourceRoot":"","sources":["../../../../src/lending/morpho/constants/markets.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,EAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"markets.d.ts","sourceRoot":"","sources":["../../../../src/lending/morpho/constants/markets.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,EAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CA2FvD,CAAA"}
|
|
@@ -17,6 +17,23 @@ export const MORPHO_MARKETS = {
|
|
|
17
17
|
'0x19e47d37453628ebf0fd18766ce6fee1b08ea46752a5da83ca0bfecb270d07e8',
|
|
18
18
|
'0x1c6b87ae1b97071ef444eedcba9f5a92cfe974edbbcaa1946644fc7ab0e283af',
|
|
19
19
|
'0x1da89208e6cb5173e97a83461853b8400de4f7c37542cf010a10579a5f7ca451',
|
|
20
|
+
'0x292f0a3ddfb642fbaadf258ebcccf9e4b0048a9dc5af93036288502bde1a71b1',
|
|
21
|
+
'0xace279b5c6eff0a1ce7287249369fa6f4d3d32225e1629b04ef308e0eb568fb0',
|
|
22
|
+
'0x96c7abf76aed53d50b2cc84e2ed17846e0d1c4cc28236d95b6eb3b12dcc86909',
|
|
23
|
+
'0x5fe3ac84f3a2c4e3102c3e6e9accb1ec90c30f6ee87ab1fcafc197b8addeb94c',
|
|
24
|
+
'0x707dddc200e95dc984feb185abf1321cabec8486dca5a9a96fb5202184106e54',
|
|
25
|
+
'0x87272614b7a2022c31ddd7bba8eb21d5ab40a6bcbea671264d59dc732053721d',
|
|
26
|
+
'0xe9a9bb9ed3cc53f4ee9da4eea0370c2c566873d5de807e16559a99907c9ae227',
|
|
27
|
+
'0xb39e45107152f02502c001a46e2d3513f429d2363323cdaffbc55a951a69b998',
|
|
28
|
+
'0x1f79fe1822f6bfe7a70f8e7e5e768efd0c3f10db52af97c2f14e4b71e3130e70',
|
|
29
|
+
'0xe500760b79e397869927a5275d64987325faae43326daf6be5a560184e30a521',
|
|
30
|
+
'0x86d7bc359391486de8cd1204da45c53d6ada60ab9764450dc691e1775b2e8d69',
|
|
31
|
+
'0x920244a8682a53b17fe15597b63abdaa3aecec44e070379c5e43897fb9f42a2b',
|
|
32
|
+
'0xd4fd53f612eaf411a1acea053cfa28cbfeea683273c4133bf115b47a20130305',
|
|
33
|
+
'0x1df0d0ebcdc52069692452cb9a3e5cf6c017b237378141eaf08a05ce17205ed6',
|
|
34
|
+
'0x888679b2af61343a4c7c0da0639fc5ca5fc5727e246371c4425e4d634c09e1f6',
|
|
35
|
+
'0xe0a1de770a9a72a083087fe1745c998426aaea984ddf155ea3d5fbba5b759713',
|
|
36
|
+
'0x1df0d0ebcdc52069692452cb9a3e5cf6c017b237378141eaf08a05ce17205ed6',
|
|
20
37
|
'0x216bd19960f140177a4a3fb9cf258edcbadb1f5d54740fc944503bff4a00e65e',
|
|
21
38
|
'0x2acd218c67daa94dd2f92e81f477ffc9f8507319f0f2d698eae5ed631ae14039',
|
|
22
39
|
'0x2b62c4153d81d5b5a233d1d2b7ef899d3fca4076d458e215ff3a00176b415b0d',
|
|
@@ -26,8 +43,11 @@ export const MORPHO_MARKETS = {
|
|
|
26
43
|
'0x53bf81793c2cc384c19a3bc9b032467e179a390a9225cd9542742ac10f539cc2',
|
|
27
44
|
'0x5ecb7a25d51c870ec57f810c880e3e20743e56d0524575b7b8934a778aaec1af',
|
|
28
45
|
'0x5ef35fe4418a6bcfcc70fe32efce30074f22e9a782f81d432c1e537ddbda11e2',
|
|
46
|
+
'0x64e7db7f042812d4335947a7cdf6af1093d29478aff5f1ccd93cc67f8aadfddc',
|
|
29
47
|
'0x65f2a559764859a559d8c39604cf665942bab7d10dfaa1b82e914c9d351038d4',
|
|
48
|
+
'0x707dddc200e95dc984feb185abf1321cabec8486dca5a9a96fb5202184106e54',
|
|
30
49
|
'0x7268244d330f1462f77ded7a14e2f868893e86e76e8b8eaa869405d588aff6ce',
|
|
50
|
+
'0x78f6b57d825ef01a5dc496ad1f426a6375c685047d07a30cd07ac5107ffc7976',
|
|
31
51
|
'0x83bab0d612f592d0f145b2ec82fd730144dfb3d72c8fc838b27555558e49c496',
|
|
32
52
|
'0x8eb8cfe3b1ac8f653608ae09fb099263fa2fe25d4a59305c309937292c2aeee9',
|
|
33
53
|
'0x964e7d1db11bdf32262c71274c297dcdb4710d73acb814f04fdca8b0c7cdf028',
|
|
@@ -35,6 +55,7 @@ export const MORPHO_MARKETS = {
|
|
|
35
55
|
'0xa24d04c3aff60d49b3475f0084334546cbf66182e788b6bf173e6f9990b2c816',
|
|
36
56
|
'0xa62327642e110efd38ba2d153867a8625c8dc40832e1d211ba4f4151c3de9050',
|
|
37
57
|
'0xa7fe39c692f0192fb2f281a6cc16c8b2e1c8f9b9f2bc418e0c0c1e9374bf4b04',
|
|
58
|
+
'0xace279b5c6eff0a1ce7287249369fa6f4d3d32225e1629b04ef308e0eb568fb0',
|
|
38
59
|
'0xb142d65d7c624def0a9f4b49115b83f400a86bd2904d4f3339ec4441e28483ea',
|
|
39
60
|
'0xb5b575e402c7c19def8661069c39464c8bf3297b638e64d841b09a4eb2807de5',
|
|
40
61
|
'0xbc15a1782163f4be46c23ac61f5da50fed96ad40293f86a5ce0501ce4a246b32',
|
|
@@ -47,6 +68,7 @@ export const MORPHO_MARKETS = {
|
|
|
47
68
|
'0xebeabb17bd69d4b8ed6929a821d69478b564f4cc604d0995944c9da8b5cb3f04',
|
|
48
69
|
'0xed00791e29eb08c9bc0d8b389fe1f00084699baf2a785ba2a42e915706b17b82',
|
|
49
70
|
'0xf25db2433ae650155eae04ebd8b3795d19bfcb318d22926a8a5e746e8028e0a8',
|
|
71
|
+
'0xfbe436e9aa361487f0c3e4ff94c88aea72887a4482c6b8bcfec60a8584cdb05e',
|
|
50
72
|
],
|
|
51
73
|
[Chain.OP_MAINNET]: [
|
|
52
74
|
'0x173b66359f0741b1c7f1963075cd271c739b6dc73b658e108a54ce6febeb279b',
|
|
@@ -60,4 +82,12 @@ export const MORPHO_MARKETS = {
|
|
|
60
82
|
'0xebaf3dc6fa2fb3f78d18c87adcc37c06fe64874c5b2d69619ef7696088780df9',
|
|
61
83
|
'0x5869019d7ec9f92db2e90c0156b542cda7c0a679c626eac842aa5117a0483d4a',
|
|
62
84
|
],
|
|
85
|
+
[Chain.HEMI_NETWORK]: [
|
|
86
|
+
'0x36931ab4ffe6fed55ab0624afd2bf6eb1cebdbd6d5c98334e949841e402f86ff',
|
|
87
|
+
'0x08abb2b634eb6454a5819dbaa5c0229136989a9990ed757727c406dbcb4e606b',
|
|
88
|
+
'0xf1b97d86baa12ef4622eeca186a49fa7f7ea1ac2aa55ea4c20a26e815ddd6bc6',
|
|
89
|
+
'0xb7dd4c2e7c164de474b28c354cddb137deb0ce2583b925d20c33322074c22178',
|
|
90
|
+
'0x4b670128dfaa02a92f833bb9b99949262b685c2d3f55d4f7c97da1849d2b6355',
|
|
91
|
+
'0x7c985a3ba92fa76a362f661b37a68c9955490eb659b7905aab6019b91042b452',
|
|
92
|
+
],
|
|
63
93
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchPublic.d.ts","sourceRoot":"","sources":["../../../src/lending/morpho/fetchPublic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchPublic.d.ts","sourceRoot":"","sources":["../../../src/lending/morpho/fetchPublic.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,EAAE,SAAS,MAAM,WAoDjE,CAAA;AAID,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,MAAM,gBAwDvD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Chain } from '@1delta/chain-registry';
|
|
1
2
|
export const query = (first, skip, chainId) => `
|
|
2
3
|
query GetMarkets {
|
|
3
4
|
markets(first: ${first}, skip: ${skip}, where: {
|
|
@@ -51,22 +52,53 @@ query GetMarkets {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
`;
|
|
54
|
-
const BASE_URL =
|
|
55
|
+
const BASE_URL = 'https://blue-api.morpho.org/graphql';
|
|
55
56
|
export async function fetchMorphoMarkets(chainId) {
|
|
56
|
-
|
|
57
|
+
if (chainId !== Chain.ETHEREUM_MAINNET) {
|
|
58
|
+
const requestBody = {
|
|
59
|
+
query: query(200, 0, chainId),
|
|
60
|
+
variables: {},
|
|
61
|
+
};
|
|
62
|
+
const response = await fetch(BASE_URL, {
|
|
63
|
+
method: 'POST',
|
|
64
|
+
headers: {
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
},
|
|
67
|
+
body: JSON.stringify(requestBody),
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
throw new Error(`Network error: ${response.status} - ${response.statusText}`);
|
|
71
|
+
}
|
|
72
|
+
const data = await response.json();
|
|
73
|
+
return data.data;
|
|
74
|
+
}
|
|
75
|
+
const requestBody0 = {
|
|
57
76
|
query: query(200, 0, chainId),
|
|
58
77
|
variables: {},
|
|
59
78
|
};
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
const requestBody1 = {
|
|
80
|
+
query: query(200, 200, chainId),
|
|
81
|
+
variables: {},
|
|
82
|
+
};
|
|
83
|
+
const [data0, data1] = await Promise.all([
|
|
84
|
+
fetch(BASE_URL, {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/json',
|
|
88
|
+
},
|
|
89
|
+
body: JSON.stringify(requestBody0),
|
|
90
|
+
}).then((x) => x.json()),
|
|
91
|
+
fetch(BASE_URL, {
|
|
92
|
+
method: 'POST',
|
|
93
|
+
headers: {
|
|
94
|
+
'Content-Type': 'application/json',
|
|
95
|
+
},
|
|
96
|
+
body: JSON.stringify(requestBody1),
|
|
97
|
+
}).then((x) => x.json()),
|
|
98
|
+
]);
|
|
99
|
+
return {
|
|
100
|
+
markets: {
|
|
101
|
+
items: [...data0.data.markets.items, ...data1.data.markets.items],
|
|
64
102
|
},
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
if (!response.ok) {
|
|
68
|
-
throw new Error(`Network error: ${response.status} - ${response.statusText}`);
|
|
69
|
-
}
|
|
70
|
-
const data = await response.json();
|
|
71
|
-
return data.data;
|
|
103
|
+
};
|
|
72
104
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMarketsFromChain.d.ts","sourceRoot":"","sources":["../../../src/lending/morpho/getMarketsFromChain.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAOrD,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EAAE,EACjB,gBAAgB,EAAE,gBAAgB,YAIjC,EACD,MAAM,EAAE,gBAAgB,YAAK,EAC7B,MAAM,EAAE,GAAG;;
|
|
1
|
+
{"version":3,"file":"getMarketsFromChain.d.ts","sourceRoot":"","sources":["../../../src/lending/morpho/getMarketsFromChain.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAA;AAOrD,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EAAE,EACjB,gBAAgB,EAAE,gBAAgB,YAIjC,EACD,MAAM,EAAE,gBAAgB,YAAK,EAC7B,MAAM,EAAE,GAAG;;GAuLZ;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,GAAG,EACX,gBAAgB,GAAE,gBAIjB,EACD,MAAM,GAAE,gBAAqB,GAC5B,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,SAAS,EAAE,MAAM,CAAC,CAqL5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/morpho/userCallBuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAI/C,eAAO,MAAM,WAAW,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/morpho/userCallBuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAI/C,eAAO,MAAM,WAAW,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAU9C,CAAA;AAyBD,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,EACf,SAAS,MAAM,EACf,QAAQ,MAAM,EACd,gBAAgB,MAAM,EAAE,KACvB,IAAI,EAIN,CAAA;AAED,eAAO,MAAM,2BAA2B,GACtC,SAAS,MAAM,EACf,SAAS,MAAM,EACf,QAAQ,MAAM,EACd,gBAAgB,MAAM,EAAE,KACvB,IAAI,EAaN,CAAA"}
|
|
@@ -2,6 +2,7 @@ import { Chain } from '@1delta/chain-registry';
|
|
|
2
2
|
import { chunk } from 'lodash';
|
|
3
3
|
import { morphoPools } from '@1delta/data-sdk';
|
|
4
4
|
export const MORPHO_LENS = {
|
|
5
|
+
[Chain.HEMI_NETWORK]: '0x1170Ef5B1A7f9c4F0ce34Ddf66CC0e6090Fd107E',
|
|
5
6
|
[Chain.BASE]: '0x05f3f58716a88A52493Be45aA0871c55b3748f18',
|
|
6
7
|
[Chain.POLYGON_MAINNET]: '0x04102873b1A80647879Aa8B8a119F07aE08f457a',
|
|
7
8
|
[Chain.OP_MAINNET]: '0x61895aEB0a42679E2Df8EE64334C405a8d47D244',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prices/defillama/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/prices/defillama/index.ts"],"names":[],"mappings":"AAgSA,wBAAsB,kBAAkB,iBA6CvC;AAED,wBAAsB,sBAAsB,iBAiD3C"}
|
|
@@ -125,6 +125,10 @@ const prefixBera = 'berachain:';
|
|
|
125
125
|
const WBERA = '0x6969696969696969696969696969696969696969';
|
|
126
126
|
const prefixCronos = 'cronos:';
|
|
127
127
|
const WCRO = '0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23';
|
|
128
|
+
const prefixTelos = 'telos:';
|
|
129
|
+
const wtlos = '0xd102ce6a4db07d247fcc28f366a623df0938ca9e';
|
|
130
|
+
const prefixManta = 'manta:';
|
|
131
|
+
const manta = '0x95cef13441be50d20ca4558cc0a27b601ac544e5';
|
|
128
132
|
// const prefixKaia = 'kaia:'
|
|
129
133
|
// const WKAIA = '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432'
|
|
130
134
|
const datasAvalanche = [WAVAX, SAVAX].map((d) => prefixAvalanche + d).join(',');
|
|
@@ -144,7 +148,9 @@ const datasHyperEvm = [WYPE, WSTHYPE, kHYPE]
|
|
|
144
148
|
const datasSolana = [JITOSOL, SOL].map((d) => prefixSolana + d).join(',');
|
|
145
149
|
const datasBera = [WBERA].map((d) => prefixBera + d).join(',');
|
|
146
150
|
const datasXdc = [WXDC].map((d) => prefixXdc + d).join(',');
|
|
147
|
-
const
|
|
151
|
+
const datasCronos = [WCRO].map((d) => prefixCronos + d).join(',');
|
|
152
|
+
const datasManta = [manta].map((d) => prefixManta + d).join(',');
|
|
153
|
+
const datasTelos = [wtlos].map((d) => prefixTelos + d).join(',');
|
|
148
154
|
// const datasKaia = [WKAIA].map((d) => prefixKaia + d).join(',')
|
|
149
155
|
const URL = `https://coins.llama.fi/prices/current/${[
|
|
150
156
|
datasEthereum,
|
|
@@ -162,7 +168,9 @@ const URL = `https://coins.llama.fi/prices/current/${[
|
|
|
162
168
|
datasSolana,
|
|
163
169
|
datasBera,
|
|
164
170
|
datasXdc,
|
|
165
|
-
|
|
171
|
+
datasCronos,
|
|
172
|
+
datasManta,
|
|
173
|
+
datasTelos,
|
|
166
174
|
].join(',')}?searchWidth=4h`;
|
|
167
175
|
const URL_HIST = (ref) => `https://coins.llama.fi/prices/historical/${ref}/${[
|
|
168
176
|
datasEthereum,
|
|
@@ -248,10 +256,12 @@ const SYMBOL_MAP = {
|
|
|
248
256
|
usual: 'Usual::USUAL',
|
|
249
257
|
woeth: 'Wrapped OETH::WOETH',
|
|
250
258
|
jitosol: 'Jito Staked SOL::JitoSOL',
|
|
259
|
+
manta: 'Manta::MANTA',
|
|
251
260
|
sol: 'SOL',
|
|
252
261
|
wcro: 'WCRO',
|
|
253
262
|
wxdc: 'WXDC',
|
|
254
263
|
wbera: 'WBERA',
|
|
264
|
+
wtlos: 'WTLOS',
|
|
255
265
|
};
|
|
256
266
|
export async function fetchDefillamaData() {
|
|
257
267
|
try {
|
|
@@ -271,6 +281,7 @@ export async function fetchDefillamaData() {
|
|
|
271
281
|
prices['CRO'] = prices['WCRO'];
|
|
272
282
|
prices['XDC'] = prices['WXDC'];
|
|
273
283
|
prices['BERA'] = prices['WBERA'];
|
|
284
|
+
prices['TLOS'] = prices['WTLOS'];
|
|
274
285
|
// prices['WKAIA'] = prices['KAIA']
|
|
275
286
|
prices['USDBC'] = prices['USDC'];
|
|
276
287
|
prices['BTCB'] = prices['WBTC'];
|
|
@@ -311,6 +322,7 @@ export async function fetchDefillamaHistData() {
|
|
|
311
322
|
histPrices['BERA'] = histPrices['WBERA'];
|
|
312
323
|
histPrices['CRO'] = histPrices['WCRO'];
|
|
313
324
|
histPrices['XDC'] = histPrices['WXDC'];
|
|
325
|
+
histPrices['TLOS'] = histPrices['WTLOS'];
|
|
314
326
|
// histPrices['WKAIA'] = histPrices['KAIA']
|
|
315
327
|
histPrices['LUSD'] = histPrices['USDT'];
|
|
316
328
|
histPrices['XDAI'] = histPrices['DAI'];
|