@1delta/margin-fetcher 0.0.38 → 0.0.40
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/publicCallBuild.d.ts +2 -2
- package/dist/lending/aave-v2-type/publicCallBuild.d.ts.map +1 -1
- package/dist/lending/aave-v2-type/publicCallBuild.js +1 -81
- package/dist/lending/aave-v2-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/aave-v2-type/publicCallParse.js +2 -196
- 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/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/aave-v2-type/userCallBuild.d.ts.map +1 -1
- package/dist/lending/user-data/aave-v2-type/userCallBuild.js +1 -67
- package/dist/lending/user-data/aave-v2-type/userCallParse.d.ts.map +1 -1
- package/dist/lending/user-data/aave-v2-type/userCallParse.js +0 -158
- 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/main-prices/fetchOracleData.js +7 -7
- 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/publicCallBuild.ts +0 -86
- package/src/lending/aave-v2-type/publicCallParse.ts +0 -357
- package/src/lending/aave-v3-type/publicCallParse.ts +80 -56
- 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/aave-v2-type/userCallBuild.ts +0 -77
- package/src/lending/user-data/aave-v2-type/userCallParse.ts +0 -262
- package/src/lending/user-data/morpho/userCallBuild.ts +1 -0
- package/src/prices/main-prices/fetchOracleData.ts +7 -7
- package/src/utils/parsing.ts +2 -2
- package/src/yields/index.ts +39 -0
- package/test/lenderData.test.ts +3 -3
- package/test/mainPrices.test.ts +1 -1
- package/test/mbChain.test.ts +3 -4
- package/test/morpho.test.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Lender } from '@1delta/lender-registry';
|
|
2
2
|
export declare const buildAaveV2StyleLenderReserveCall: (chainId: string, lender: Lender) => {
|
|
3
|
-
address:
|
|
3
|
+
address: string;
|
|
4
4
|
name: string;
|
|
5
|
-
params:
|
|
5
|
+
params: string[];
|
|
6
6
|
}[];
|
|
7
7
|
//# sourceMappingURL=publicCallBuild.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicCallBuild.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v2-type/publicCallBuild.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publicCallBuild.d.ts","sourceRoot":"","sources":["../../../src/lending/aave-v2-type/publicCallBuild.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,eAAO,MAAM,iCAAiC,GAC5C,SAAS,MAAM,EACf,QAAQ,MAAM;;;;GAqBf,CAAA"}
|
|
@@ -1,88 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getAaveAssets, getAaveStyleProtocolTokenMap, getAaveTypePoolDataProviderAddress, } from '../../assets';
|
|
3
|
-
import { Lender } from '@1delta/lender-registry';
|
|
4
|
-
import { getAaveTypeIncentivesControllerAddress } from '../addresses';
|
|
1
|
+
import { getAaveAssets, getAaveTypePoolDataProviderAddress, } from '../../assets';
|
|
5
2
|
export const buildAaveV2StyleLenderReserveCall = (chainId, lender) => {
|
|
6
3
|
const providerAddress = getAaveTypePoolDataProviderAddress(chainId, lender);
|
|
7
4
|
const underlyingTokensArray = getAaveAssets(chainId, lender);
|
|
8
5
|
switch (lender) {
|
|
9
|
-
case Lender.AURELIUS: {
|
|
10
|
-
const aaveprotocolTokens = getAaveStyleProtocolTokenMap(chainId, lender);
|
|
11
|
-
const incentivesController = getAaveTypeIncentivesControllerAddress(chainId, lender);
|
|
12
|
-
const [reward0, reward1] = AURELIUS_REWARD_ASSETS.map((t) => t.address);
|
|
13
|
-
return [
|
|
14
|
-
...underlyingTokensArray.flatMap((asset) => [
|
|
15
|
-
{
|
|
16
|
-
address: providerAddress,
|
|
17
|
-
name: 'getReserveData',
|
|
18
|
-
params: [asset],
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
address: providerAddress,
|
|
22
|
-
name: 'getReserveConfigurationData',
|
|
23
|
-
params: [asset],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
address: incentivesController,
|
|
27
|
-
name: 'getRewardsData',
|
|
28
|
-
params: [aaveprotocolTokens[asset].aToken, reward0],
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
address: incentivesController,
|
|
32
|
-
name: 'getRewardsData',
|
|
33
|
-
params: [aaveprotocolTokens[asset].aToken, reward1],
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
address: incentivesController,
|
|
37
|
-
name: 'getRewardsData',
|
|
38
|
-
params: [aaveprotocolTokens[asset].vToken, reward0],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
address: incentivesController,
|
|
42
|
-
name: 'getRewardsData',
|
|
43
|
-
params: [aaveprotocolTokens[asset].vToken, reward1],
|
|
44
|
-
},
|
|
45
|
-
]),
|
|
46
|
-
];
|
|
47
|
-
}
|
|
48
|
-
case Lender.LENDLE: {
|
|
49
|
-
const incentivesController = getAaveTypeIncentivesControllerAddress(chainId, lender);
|
|
50
|
-
const aaveprotocolTokens = getAaveStyleProtocolTokenMap(chainId, lender);
|
|
51
|
-
return [
|
|
52
|
-
...underlyingTokensArray.flatMap((asset) => [
|
|
53
|
-
{
|
|
54
|
-
address: providerAddress,
|
|
55
|
-
name: 'getReserveData',
|
|
56
|
-
params: [asset],
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
address: providerAddress,
|
|
60
|
-
name: 'getReserveConfigurationData',
|
|
61
|
-
params: [asset],
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
address: incentivesController,
|
|
65
|
-
name: 'poolInfo',
|
|
66
|
-
params: [aaveprotocolTokens[asset].aToken],
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
address: incentivesController,
|
|
70
|
-
name: 'poolInfo',
|
|
71
|
-
params: [aaveprotocolTokens[asset].vToken],
|
|
72
|
-
},
|
|
73
|
-
]),
|
|
74
|
-
{
|
|
75
|
-
address: incentivesController,
|
|
76
|
-
name: 'rewardsPerSecond',
|
|
77
|
-
params: [],
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
address: incentivesController,
|
|
81
|
-
name: 'totalAllocPoint',
|
|
82
|
-
params: [],
|
|
83
|
-
},
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
6
|
default:
|
|
87
7
|
return [
|
|
88
8
|
...underlyingTokensArray.flatMap((tk) => [
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAYhD,OAAO,EACL,2BAA2B,EAG5B,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,CAkKnE,CAAA"}
|
|
@@ -1,204 +1,10 @@
|
|
|
1
1
|
import { Lender } from '@1delta/lender-registry';
|
|
2
2
|
import { getAaveAssets, LENDER_MODE_NO_MODE, toGenericPriceKey, toOracleKey, } from '../../assets';
|
|
3
|
-
import { BPS,
|
|
4
|
-
import { AaveV2TypeGetReserveConfigurationData, AaveV2TypeGetReserveDataIndexes,
|
|
3
|
+
import { BPS, formatAaveRawApyToApr, parseRawAmount, } from '../../utils/parsing';
|
|
4
|
+
import { AaveV2TypeGetReserveConfigurationData, AaveV2TypeGetReserveDataIndexes, } from './types';
|
|
5
5
|
import { Chain } from '@1delta/chain-registry';
|
|
6
6
|
export const getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields, tokenList = {}) => {
|
|
7
7
|
switch (lender) {
|
|
8
|
-
case Lender.AURELIUS: {
|
|
9
|
-
const assetsToQuery = getAaveAssets(chainId, lender);
|
|
10
|
-
const expectedNumberOfCalls = assetsToQuery.length * 6;
|
|
11
|
-
return [
|
|
12
|
-
(data) => {
|
|
13
|
-
if (data.length !== expectedNumberOfCalls) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
const resultReserves = {};
|
|
17
|
-
for (let i = 0; i < assetsToQuery.length; i++) {
|
|
18
|
-
const asset = assetsToQuery[i];
|
|
19
|
-
const reserveData = data[i * 6];
|
|
20
|
-
const configData = data[i * 6 + 1];
|
|
21
|
-
const [, emission0PerSecondCollateral, ,] = data[i * 6 + 2];
|
|
22
|
-
const [, emission1PerSecondCollateral, ,] = data[i * 6 + 3];
|
|
23
|
-
const [, emission0PerSecondDebt, ,] = data[i * 6 + 4];
|
|
24
|
-
const [, emission1PerSecondDebt, ,] = data[i * 6 + 5];
|
|
25
|
-
const assetMeta = tokenList[asset];
|
|
26
|
-
const decimals = assetMeta?.decimals ?? 18;
|
|
27
|
-
const totalStableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalStableDebt]?.toString(), decimals);
|
|
28
|
-
const totalVariableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalVariableDebt]?.toString(), decimals);
|
|
29
|
-
const liquidity = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.availableLiquidity]?.toString(), decimals);
|
|
30
|
-
const totalAToken = Number(liquidity) +
|
|
31
|
-
Number(totalStableDebt) +
|
|
32
|
-
Number(totalVariableDebt);
|
|
33
|
-
const oracleKey = toOracleKey(assetMeta?.assetGroup) ??
|
|
34
|
-
toGenericPriceKey(asset, chainId);
|
|
35
|
-
const price = prices[oracleKey] ?? 1;
|
|
36
|
-
const totalDepositsUSD = totalAToken * price;
|
|
37
|
-
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
38
|
-
resultReserves[asset] = {
|
|
39
|
-
poolId: asset,
|
|
40
|
-
underlying: asset,
|
|
41
|
-
asset: assetMeta,
|
|
42
|
-
// token amounts
|
|
43
|
-
totalDeposits: totalAToken,
|
|
44
|
-
totalDebtStable: totalStableDebt,
|
|
45
|
-
totalDebt: totalVariableDebt,
|
|
46
|
-
totalLiquidity: liquidity,
|
|
47
|
-
// USD amounts
|
|
48
|
-
totalDepositsUSD,
|
|
49
|
-
totalDebtStableUSD: Number(totalStableDebt) * price,
|
|
50
|
-
totalDebtUSD,
|
|
51
|
-
totalLiquidityUSD: Number(liquidity) * price,
|
|
52
|
-
// rates
|
|
53
|
-
depositRate: formatAaveRawApyToApr(reserveData?.[AaveV2TypeGetReserveDataIndexes.liquidityRate]?.toString()),
|
|
54
|
-
variableBorrowRate: formatAaveRawApyToApr(reserveData?.[AaveV2TypeGetReserveDataIndexes.variableBorrowRate]?.toString()),
|
|
55
|
-
stableBorrowRate: formatAaveRawApyToApr(reserveData?.[AaveV2TypeGetReserveDataIndexes.stableBorrowRate]?.toString()),
|
|
56
|
-
stakingYield: additionalYields.intrinsicYields[oracleKey] ?? 0,
|
|
57
|
-
// rewards
|
|
58
|
-
rewards: {
|
|
59
|
-
WMNT: {
|
|
60
|
-
depositRate: (convertRateToApr(parseRawAmount(emission0PerSecondCollateral)) /
|
|
61
|
-
totalDepositsUSD) *
|
|
62
|
-
prices['WMNT'],
|
|
63
|
-
variableBorrowRate: (convertRateToApr(parseRawAmount(emission0PerSecondDebt)) /
|
|
64
|
-
totalDebtUSD) *
|
|
65
|
-
prices['WMNT'],
|
|
66
|
-
stableBorrowRate: 0,
|
|
67
|
-
},
|
|
68
|
-
// oAU allows for a 50% discount to pruchase AU, hence the price is the price of AU divided by 2
|
|
69
|
-
OAU: {
|
|
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,
|
|
78
|
-
stableBorrowRate: 0,
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
decimals: Number(configData?.[AaveV2TypeGetReserveConfigurationData.decimals]),
|
|
82
|
-
config: {
|
|
83
|
-
[LENDER_MODE_NO_MODE]: {
|
|
84
|
-
category: LENDER_MODE_NO_MODE,
|
|
85
|
-
// collateral factors
|
|
86
|
-
borrowCollateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData.ltv].toString()) / BPS,
|
|
87
|
-
collateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData
|
|
88
|
-
.liquidationThreshold].toString()) / BPS,
|
|
89
|
-
borrowFactor: 1,
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
liquidationBonus: Number(configData?.[AaveV2TypeGetReserveConfigurationData.liquidationBonus].toString()) / BPS,
|
|
93
|
-
// flags
|
|
94
|
-
collateralActive: configData?.[AaveV2TypeGetReserveConfigurationData.usageAsCollateralEnabled],
|
|
95
|
-
borrowingEnabled: configData?.[AaveV2TypeGetReserveConfigurationData.borrowingEnabled],
|
|
96
|
-
hasStable: configData?.[AaveV2TypeGetReserveConfigurationData.stableBorrowRateEnabled],
|
|
97
|
-
isActive: configData?.[AaveV2TypeGetReserveConfigurationData.isActive],
|
|
98
|
-
isFrozen: configData?.[AaveV2TypeGetReserveConfigurationData.isFrozen],
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
data: resultReserves,
|
|
103
|
-
chainId,
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
expectedNumberOfCalls,
|
|
107
|
-
];
|
|
108
|
-
}
|
|
109
|
-
case Lender.LENDLE: {
|
|
110
|
-
const assetsToQuery = getAaveAssets(chainId, lender);
|
|
111
|
-
const expectedNumberOfCalls = assetsToQuery.length * 4 + 2;
|
|
112
|
-
return [
|
|
113
|
-
(data) => {
|
|
114
|
-
if (data.length !== expectedNumberOfCalls) {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
const rewardsPerSecond = Number(parseRawAmount(data[expectedNumberOfCalls - 2].toString(), 18));
|
|
118
|
-
const totalAllocPoint = Number(data[expectedNumberOfCalls - 1].toString());
|
|
119
|
-
const resultReserves = {};
|
|
120
|
-
const lendPrice = prices['LEND'];
|
|
121
|
-
for (let i = 0; i < assetsToQuery.length; i++) {
|
|
122
|
-
const asset = assetsToQuery[i];
|
|
123
|
-
const reserveData = data[i * 4];
|
|
124
|
-
const configData = data[i * 4 + 1];
|
|
125
|
-
const collateralRewardIndex = i * 4 + 2;
|
|
126
|
-
const borrowRewardIndex = i * 4 + 3;
|
|
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;
|
|
133
|
-
const assetMeta = tokenList[asset];
|
|
134
|
-
const decimals = assetMeta?.decimals ?? 18;
|
|
135
|
-
const totalStableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalStableDebt]?.toString(), decimals);
|
|
136
|
-
const totalVariableDebt = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.totalVariableDebt]?.toString(), decimals);
|
|
137
|
-
const liquidity = parseRawAmount(reserveData?.[AaveV2TypeGetReserveDataIndexes.availableLiquidity]?.toString(), decimals);
|
|
138
|
-
const totalAToken = Number(liquidity) +
|
|
139
|
-
Number(totalStableDebt) +
|
|
140
|
-
Number(totalVariableDebt);
|
|
141
|
-
const oracleKey = toOracleKey(assetMeta?.assetGroup) ??
|
|
142
|
-
toGenericPriceKey(asset, chainId);
|
|
143
|
-
const price = prices?.[oracleKey] ?? 1;
|
|
144
|
-
const totalDepositsUSD = totalAToken * price;
|
|
145
|
-
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
146
|
-
resultReserves[asset] = {
|
|
147
|
-
poolId: asset,
|
|
148
|
-
underlying: asset,
|
|
149
|
-
asset: assetMeta,
|
|
150
|
-
// token amounts
|
|
151
|
-
totalDeposits: totalAToken,
|
|
152
|
-
totalDebtStable: totalStableDebt,
|
|
153
|
-
totalDebt: totalVariableDebt,
|
|
154
|
-
totalLiquidity: liquidity,
|
|
155
|
-
// USD amounts
|
|
156
|
-
totalDepositsUSD,
|
|
157
|
-
totalDebtStableUSD: Number(totalStableDebt) * price,
|
|
158
|
-
totalDebtUSD,
|
|
159
|
-
totalLiquidityUSD: Number(liquidity) * price,
|
|
160
|
-
// rates
|
|
161
|
-
depositRate: formatAaveRawApyToApr(reserveData?.[AaveV2TypeGetReserveDataIndexes.liquidityRate]?.toString()),
|
|
162
|
-
variableBorrowRate: formatAaveRawApyToApr(reserveData?.[AaveV2TypeGetReserveDataIndexes.variableBorrowRate]?.toString()),
|
|
163
|
-
stableBorrowRate: formatAaveRawApyToApr(reserveData?.[AaveV2TypeGetReserveDataIndexes.stableBorrowRate]?.toString()),
|
|
164
|
-
stakingYield: additionalYields.intrinsicYields[oracleKey] ?? 0,
|
|
165
|
-
// rewards
|
|
166
|
-
rewards: {
|
|
167
|
-
LEND: {
|
|
168
|
-
depositRate: convertRateToApr(collateralRewards / totalDepositsUSD) *
|
|
169
|
-
lendPrice,
|
|
170
|
-
variableBorrowRate: convertRateToApr(totalDebtUSD > 0 ? borrowRewards / totalDebtUSD : 0) * lendPrice,
|
|
171
|
-
stableBorrowRate: 0,
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
decimals: Number(configData?.[AaveV2TypeGetReserveConfigurationData.decimals]),
|
|
175
|
-
config: {
|
|
176
|
-
[LENDER_MODE_NO_MODE]: {
|
|
177
|
-
category: LENDER_MODE_NO_MODE,
|
|
178
|
-
// collateral factors
|
|
179
|
-
borrowCollateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData.ltv].toString()) / BPS,
|
|
180
|
-
collateralFactor: Number(configData?.[AaveV2TypeGetReserveConfigurationData
|
|
181
|
-
.liquidationThreshold].toString()) / BPS,
|
|
182
|
-
borrowFactor: 1,
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
liquidationBonus: Number(configData?.[AaveV2TypeGetReserveConfigurationData.liquidationBonus].toString()) / BPS,
|
|
186
|
-
// flags
|
|
187
|
-
collateralActive: configData?.[AaveV2TypeGetReserveConfigurationData.usageAsCollateralEnabled],
|
|
188
|
-
borrowingEnabled: configData?.[AaveV2TypeGetReserveConfigurationData.borrowingEnabled],
|
|
189
|
-
hasStable: configData?.[AaveV2TypeGetReserveConfigurationData.stableBorrowRateEnabled],
|
|
190
|
-
isActive: configData?.[AaveV2TypeGetReserveConfigurationData.isActive],
|
|
191
|
-
isFrozen: configData?.[AaveV2TypeGetReserveConfigurationData.isFrozen],
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
return {
|
|
195
|
-
data: resultReserves,
|
|
196
|
-
chainId,
|
|
197
|
-
};
|
|
198
|
-
},
|
|
199
|
-
expectedNumberOfCalls,
|
|
200
|
-
];
|
|
201
|
-
}
|
|
202
8
|
/** AAVE V2 style with rewards from state */
|
|
203
9
|
default: {
|
|
204
10
|
const assetsToQuery = getAaveAssets(chainId, lender);
|
|
@@ -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":"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/aave-v2-type/userCallBuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"userCallBuild.d.ts","sourceRoot":"","sources":["../../../../src/lending/user-data/aave-v2-type/userCallBuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAqBhD,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,EACf,QAAQ,MAAM,EACd,SAAS,MAAM,EACf,SAAS,MAAM,EAAE,KAChB,IAAI,EAON,CAAA"}
|