@1delta/margin-fetcher 0.0.149 → 0.0.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/dist/assets/index.d.ts +7 -1
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/index.js +167 -49
- package/dist/index.js.map +1 -1
- package/dist/lending/aave-v2-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/aave-v3-type/publicCallParse.d.ts.map +1 -1
- package/dist/lending/addresses/compoundV2.d.ts +4 -0
- package/dist/lending/addresses/compoundV2.d.ts.map +1 -1
- package/dist/lending/compound-v2/publicCallParse.d.ts +1 -1
- package/dist/lending/compound-v2/publicCallParse.d.ts.map +1 -1
- package/dist/lending/compound-v3/publicCallParse.d.ts.map +1 -1
- package/dist/lending/init/publicCallParse.d.ts.map +1 -1
- package/dist/lending/lista/getMarketsFromChain.d.ts.map +1 -1
- package/dist/lending/meta/index.d.ts +1 -0
- package/dist/lending/meta/index.d.ts.map +1 -1
- package/dist/lending/morpho/convertPublic.d.ts.map +1 -1
- package/dist/lending/morpho/getMarketsFromChain.d.ts.map +1 -1
- package/dist/types/lender/aave-v2-types.d.ts +9 -6
- package/dist/types/lender/aave-v2-types.d.ts.map +1 -1
- package/dist/types/lender/aave-v3-types.d.ts +9 -6
- package/dist/types/lender/aave-v3-types.d.ts.map +1 -1
- package/dist/types/lender/compound-v2-types.d.ts +8 -6
- package/dist/types/lender/compound-v2-types.d.ts.map +1 -1
- package/dist/types/lender/compound-v3-types.d.ts +2 -6
- package/dist/types/lender/compound-v3-types.d.ts.map +1 -1
- package/dist/types/lender/init-types.d.ts +2 -6
- package/dist/types/lender/init-types.d.ts.map +1 -1
- package/dist/types/lender/morpho-types.d.ts +2 -0
- package/dist/types/lender/morpho-types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/assets/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/** No specific configuration */
|
|
2
2
|
export declare const LENDER_MODE_NO_MODE = 0;
|
|
3
|
-
export declare function getAaveStyleProtocolTokenMap(chainId: string, lender: string):
|
|
3
|
+
export declare function getAaveStyleProtocolTokenMap(chainId: string, lender: string): {
|
|
4
|
+
[underlying: string]: {
|
|
5
|
+
aToken: string;
|
|
6
|
+
sToken: string;
|
|
7
|
+
vToken: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
4
10
|
export declare const getAaveAssets: (chainId: string | undefined, lendingProtocol: string | undefined) => string[];
|
|
5
11
|
export declare const getCompoundV3Assets: (chainId: string | undefined, lendingProtocol: string | undefined) => string[];
|
|
6
12
|
export declare function getAaveTypePoolDataProviderAddress(chainId: string, lender: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAQA,gCAAgC;AAChC,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAQA,gCAAgC;AAChC,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;EAE3E;AAED,eAAO,MAAM,aAAa,GACxB,SAAS,MAAM,GAAG,SAAS,EAC3B,iBAAiB,MAAM,GAAG,SAAS,KAClC,MAAM,EAIR,CAAA;AAED,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,GAAG,SAAS,EAC3B,iBAAiB,MAAM,GAAG,SAAS,KAClC,MAAM,EAIR,CAAA;AAED,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,UAIf;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,MAAM,CAGR;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,GAAG,MAAM,WAEpC,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,cAAc,MAAM,EAAE,SAAS,MAAM,WAEtE,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -6276,6 +6276,7 @@ function initializeLenderData({
|
|
|
6276
6276
|
compoundV3BaseDataOverride,
|
|
6277
6277
|
morphoPoolsOverride,
|
|
6278
6278
|
compoundV2TokensOverride,
|
|
6279
|
+
compoundV2TokenArrayOverride,
|
|
6279
6280
|
compoundV2PoolsOverride,
|
|
6280
6281
|
initConfigOverride,
|
|
6281
6282
|
aaveReservesOverride,
|
|
@@ -6293,6 +6294,7 @@ function initializeLenderData({
|
|
|
6293
6294
|
if (morphoPoolsOverride) data.morphoPools = morphoPoolsOverride;
|
|
6294
6295
|
if (compoundV3BaseDataOverride) data.compoundV3BaseData = compoundV3BaseDataOverride;
|
|
6295
6296
|
if (compoundV2TokensOverride) data.compoundV2Tokens = compoundV2TokensOverride;
|
|
6297
|
+
if (compoundV2TokenArrayOverride) data.compoundV2TokenArray = compoundV2TokenArrayOverride;
|
|
6296
6298
|
if (compoundV2PoolsOverride) data.compoundV2Pools = compoundV2PoolsOverride;
|
|
6297
6299
|
if (initConfigOverride) data.initConfig = initConfigOverride;
|
|
6298
6300
|
if (aaveReservesOverride) data.aaveReserves = aaveReservesOverride;
|
|
@@ -6315,6 +6317,7 @@ var morphoPools = () => getGlobalData2()?.morphoPools;
|
|
|
6315
6317
|
var compoundV3BaseData = () => getGlobalData2()?.compoundV3BaseData;
|
|
6316
6318
|
var compoundV2Pools = () => getGlobalData2()?.compoundV2Pools;
|
|
6317
6319
|
var compoundV2Tokens = () => getGlobalData2()?.compoundV2Tokens;
|
|
6320
|
+
var compoundV2TokenArray = () => getGlobalData2()?.compoundV2TokenArray;
|
|
6318
6321
|
var initConfig = () => getGlobalData2()?.initConfig;
|
|
6319
6322
|
var { uniq } = lodash;
|
|
6320
6323
|
var COMPOUND_V3_KEY = "COMPOUND_V3";
|
|
@@ -7982,6 +7985,7 @@ var getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
7982
7985
|
/** AAVE V2 style with rewards from state */
|
|
7983
7986
|
default: {
|
|
7984
7987
|
const assetsToQuery = getAaveAssets(chainId, lender);
|
|
7988
|
+
const aaveTokenMap = getAaveStyleProtocolTokenMap(chainId, lender);
|
|
7985
7989
|
const expectedNumberOfCalls = assetsToQuery.length * 2;
|
|
7986
7990
|
return [
|
|
7987
7991
|
(data) => {
|
|
@@ -8014,6 +8018,8 @@ var getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
8014
8018
|
const price = prices[oracleKey] ?? 0;
|
|
8015
8019
|
const totalDepositsUSD = Number(totalAToken) * price;
|
|
8016
8020
|
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
8021
|
+
const collateralActive = configData?.[5 /* usageAsCollateralEnabled */];
|
|
8022
|
+
const borrowingEnabled = configData?.[6 /* borrowingEnabled */];
|
|
8017
8023
|
resultReserves[asset] = {
|
|
8018
8024
|
poolId: asset,
|
|
8019
8025
|
underlying: asset,
|
|
@@ -8060,19 +8066,34 @@ var getAaveV2ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
8060
8066
|
collateralFactor: Number(
|
|
8061
8067
|
configData?.[2 /* liquidationThreshold */].toString()
|
|
8062
8068
|
) / BPS,
|
|
8063
|
-
borrowFactor: 1
|
|
8069
|
+
borrowFactor: 1,
|
|
8070
|
+
collateralDisabled: !collateralActive,
|
|
8071
|
+
debtDisabled: !borrowingEnabled
|
|
8064
8072
|
}
|
|
8065
8073
|
},
|
|
8066
8074
|
liquidationBonus: Number(
|
|
8067
8075
|
configData?.[3 /* liquidationBonus */].toString()
|
|
8068
8076
|
) / BPS,
|
|
8069
8077
|
// flags
|
|
8070
|
-
collateralActive
|
|
8071
|
-
borrowingEnabled
|
|
8078
|
+
collateralActive,
|
|
8079
|
+
borrowingEnabled,
|
|
8072
8080
|
hasStable: configData?.[7 /* stableBorrowRateEnabled */],
|
|
8073
8081
|
isActive: configData?.[8 /* isActive */],
|
|
8074
8082
|
isFrozen: configData?.[9 /* isFrozen */]
|
|
8075
8083
|
};
|
|
8084
|
+
const aaveTokens3 = aaveTokenMap[asset];
|
|
8085
|
+
if (!!aaveTokens3) {
|
|
8086
|
+
resultReserves[asset] = {
|
|
8087
|
+
...resultReserves[asset],
|
|
8088
|
+
params: {
|
|
8089
|
+
metadata: {
|
|
8090
|
+
aToken: aaveTokens3.aToken,
|
|
8091
|
+
vToken: aaveTokens3.vToken,
|
|
8092
|
+
sToken: aaveTokens3.sToken
|
|
8093
|
+
}
|
|
8094
|
+
}
|
|
8095
|
+
};
|
|
8096
|
+
}
|
|
8076
8097
|
}
|
|
8077
8098
|
return {
|
|
8078
8099
|
data: resultReserves,
|
|
@@ -8107,6 +8128,7 @@ var getAaveV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
8107
8128
|
const assetsToQuery = getAaveAssets(chainId, lender);
|
|
8108
8129
|
const allModes = AAVE_V3_EMODES(chainId, lender);
|
|
8109
8130
|
const expectedNumberOfCalls = assetsToQuery.length * 6 + allModes.length + 1;
|
|
8131
|
+
const aaveTokenMap = getAaveStyleProtocolTokenMap(chainId, lender);
|
|
8110
8132
|
return [
|
|
8111
8133
|
(data) => {
|
|
8112
8134
|
if (data.length !== expectedNumberOfCalls) {
|
|
@@ -8154,6 +8176,8 @@ var getAaveV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
8154
8176
|
);
|
|
8155
8177
|
const liquidity = Number(totalDeposits) - Number(totalDebt) - Number(totalDebtStable);
|
|
8156
8178
|
const price = prices[toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset, chainId)] ?? 0;
|
|
8179
|
+
const usageAsCollateralEnabled = configData?.[5 /* usageAsCollateralEnabled */];
|
|
8180
|
+
const borrowingEnabled = configData?.[6 /* borrowingEnabled */];
|
|
8157
8181
|
resultReserves[asset] = {
|
|
8158
8182
|
poolId: asset,
|
|
8159
8183
|
underlying: asset,
|
|
@@ -8195,11 +8219,13 @@ var getAaveV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
8195
8219
|
) / BPS,
|
|
8196
8220
|
eModeCategory,
|
|
8197
8221
|
eModeConfigs,
|
|
8198
|
-
allModes
|
|
8222
|
+
allModes,
|
|
8223
|
+
usageAsCollateralEnabled,
|
|
8224
|
+
borrowingEnabled
|
|
8199
8225
|
),
|
|
8200
8226
|
// flags
|
|
8201
|
-
collateralActive:
|
|
8202
|
-
borrowingEnabled
|
|
8227
|
+
collateralActive: usageAsCollateralEnabled,
|
|
8228
|
+
borrowingEnabled,
|
|
8203
8229
|
hasStable: configData?.[7 /* stableBorrowRateEnabled */],
|
|
8204
8230
|
isActive: configData?.[8 /* isActive */],
|
|
8205
8231
|
isFrozen: configData?.[9 /* isFrozen */],
|
|
@@ -8213,6 +8239,19 @@ var getAaveV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
8213
8239
|
)
|
|
8214
8240
|
)
|
|
8215
8241
|
};
|
|
8242
|
+
const aaveTokens3 = aaveTokenMap[asset];
|
|
8243
|
+
if (!!aaveTokens3) {
|
|
8244
|
+
resultReserves[asset] = {
|
|
8245
|
+
...resultReserves[asset],
|
|
8246
|
+
params: {
|
|
8247
|
+
metadata: {
|
|
8248
|
+
aToken: aaveTokens3.aToken,
|
|
8249
|
+
vToken: aaveTokens3.vToken,
|
|
8250
|
+
sToken: aaveTokens3.sToken
|
|
8251
|
+
}
|
|
8252
|
+
}
|
|
8253
|
+
};
|
|
8254
|
+
}
|
|
8216
8255
|
}
|
|
8217
8256
|
return {
|
|
8218
8257
|
data: resultReserves,
|
|
@@ -8224,7 +8263,7 @@ var getAaveV3ReservesDataConverter = (lender, chainId, prices, additionalYields,
|
|
|
8224
8263
|
}
|
|
8225
8264
|
}
|
|
8226
8265
|
};
|
|
8227
|
-
var populateEModes = (borrowCollateralFactor, collateralFactor, eModeCategory, eModeConfigs, allModes) => {
|
|
8266
|
+
var populateEModes = (borrowCollateralFactor, collateralFactor, eModeCategory, eModeConfigs, allModes, usageAsCollateralEnabled, borrowingEnabled) => {
|
|
8228
8267
|
let data = {};
|
|
8229
8268
|
allModes.forEach((e) => {
|
|
8230
8269
|
if (e === 0)
|
|
@@ -8233,7 +8272,9 @@ var populateEModes = (borrowCollateralFactor, collateralFactor, eModeCategory, e
|
|
|
8233
8272
|
category: e,
|
|
8234
8273
|
borrowCollateralFactor,
|
|
8235
8274
|
collateralFactor,
|
|
8236
|
-
borrowFactor: 1
|
|
8275
|
+
borrowFactor: 1,
|
|
8276
|
+
collateralDisabled: !usageAsCollateralEnabled,
|
|
8277
|
+
debtDisabled: !borrowingEnabled
|
|
8237
8278
|
};
|
|
8238
8279
|
if (e > 0 && eModeConfigs[e]?.label && eModeConfigs[e]?.label !== "") {
|
|
8239
8280
|
data[e] = {};
|
|
@@ -8243,6 +8284,8 @@ var populateEModes = (borrowCollateralFactor, collateralFactor, eModeCategory, e
|
|
|
8243
8284
|
data[e].borrowFactor = 1;
|
|
8244
8285
|
data[e].collateralFactor = collateralFactor;
|
|
8245
8286
|
data[e].borrowCollateralFactor = borrowCollateralFactor;
|
|
8287
|
+
data[e].collateralDisabled = !usageAsCollateralEnabled;
|
|
8288
|
+
data[e].debtDisabled = !borrowingEnabled;
|
|
8246
8289
|
if (e > 0 && e === eModeCategory && eModeConfigs[e]) {
|
|
8247
8290
|
data[e] = {
|
|
8248
8291
|
...data[e],
|
|
@@ -8257,7 +8300,7 @@ var populateEModes = (borrowCollateralFactor, collateralFactor, eModeCategory, e
|
|
|
8257
8300
|
});
|
|
8258
8301
|
return data;
|
|
8259
8302
|
};
|
|
8260
|
-
var populateEModes32 = (borrowCollateralFactor, collateralFactor, collateralBitmap, debtBitmap, assetIndex, eModeConfigs, allModes) => {
|
|
8303
|
+
var populateEModes32 = (borrowCollateralFactor, collateralFactor, collateralBitmap, debtBitmap, assetIndex, eModeConfigs, allModes, usageAsCollateralEnabled, borrowingEnabled) => {
|
|
8261
8304
|
let data = {};
|
|
8262
8305
|
allModes.forEach((e) => {
|
|
8263
8306
|
if (e === 0)
|
|
@@ -8266,7 +8309,9 @@ var populateEModes32 = (borrowCollateralFactor, collateralFactor, collateralBitm
|
|
|
8266
8309
|
category: e,
|
|
8267
8310
|
borrowCollateralFactor,
|
|
8268
8311
|
collateralFactor,
|
|
8269
|
-
borrowFactor: 1
|
|
8312
|
+
borrowFactor: 1,
|
|
8313
|
+
collateralDisabled: !usageAsCollateralEnabled,
|
|
8314
|
+
debtDisabled: !borrowingEnabled
|
|
8270
8315
|
};
|
|
8271
8316
|
if (e > 0) {
|
|
8272
8317
|
if (eModeConfigs[e]?.label && eModeConfigs[e]?.label !== "") {
|
|
@@ -8306,6 +8351,7 @@ function isReserveEnabledOnBitmap(bitmap, reserveIndex) {
|
|
|
8306
8351
|
}
|
|
8307
8352
|
function parseYLDRCall(chainId, lender, additionalYields, prices, tokenList) {
|
|
8308
8353
|
const assetsToQuery = getAaveAssets(chainId, lender);
|
|
8354
|
+
const aaveTokenMap = getAaveStyleProtocolTokenMap(chainId, lender);
|
|
8309
8355
|
const expectedNumberOfCalls = assetsToQuery.length * 2;
|
|
8310
8356
|
return [
|
|
8311
8357
|
(data) => {
|
|
@@ -8332,6 +8378,8 @@ function parseYLDRCall(chainId, lender, additionalYields, prices, tokenList) {
|
|
|
8332
8378
|
const price = prices[oracleKey] ?? 0;
|
|
8333
8379
|
const totalDepositsUSD = Number(totalAToken) * price;
|
|
8334
8380
|
const totalDebtUSD = Number(totalVariableDebt) * price;
|
|
8381
|
+
const usageAsCollateralEnabled = configData?.[5 /* usageAsCollateralEnabled */];
|
|
8382
|
+
const borrowingEnabled = configData?.[6 /* borrowingEnabled */];
|
|
8335
8383
|
resultReserves[asset] = {
|
|
8336
8384
|
poolId: asset,
|
|
8337
8385
|
underlying: asset,
|
|
@@ -8370,19 +8418,34 @@ function parseYLDRCall(chainId, lender, additionalYields, prices, tokenList) {
|
|
|
8370
8418
|
collateralFactor: Number(
|
|
8371
8419
|
configData?.[2 /* liquidationThreshold */]?.toString()
|
|
8372
8420
|
) / BPS,
|
|
8373
|
-
borrowFactor: 1
|
|
8421
|
+
borrowFactor: 1,
|
|
8422
|
+
collateralDisabled: !usageAsCollateralEnabled,
|
|
8423
|
+
debtDisabled: !borrowingEnabled
|
|
8374
8424
|
}
|
|
8375
8425
|
},
|
|
8376
8426
|
liquidationBonus: Number(
|
|
8377
8427
|
configData?.[3 /* liquidationBonus */]?.toString()
|
|
8378
8428
|
) / BPS,
|
|
8379
8429
|
// flags
|
|
8380
|
-
collateralActive:
|
|
8381
|
-
borrowingEnabled
|
|
8430
|
+
collateralActive: usageAsCollateralEnabled,
|
|
8431
|
+
borrowingEnabled,
|
|
8382
8432
|
hasStable: false,
|
|
8383
8433
|
isActive: configData?.[7 /* isActive */],
|
|
8384
8434
|
isFrozen: configData?.[8 /* isFrozen */]
|
|
8385
8435
|
};
|
|
8436
|
+
const aaveTokens3 = aaveTokenMap[asset];
|
|
8437
|
+
if (!!aaveTokens3) {
|
|
8438
|
+
resultReserves[asset] = {
|
|
8439
|
+
...resultReserves[asset],
|
|
8440
|
+
params: {
|
|
8441
|
+
metadata: {
|
|
8442
|
+
aToken: aaveTokens3.aToken,
|
|
8443
|
+
vToken: aaveTokens3.vToken,
|
|
8444
|
+
sToken: aaveTokens3.sToken
|
|
8445
|
+
}
|
|
8446
|
+
}
|
|
8447
|
+
};
|
|
8448
|
+
}
|
|
8386
8449
|
}
|
|
8387
8450
|
return {
|
|
8388
8451
|
data: resultReserves,
|
|
@@ -8395,6 +8458,7 @@ function parseYLDRCall(chainId, lender, additionalYields, prices, tokenList) {
|
|
|
8395
8458
|
}
|
|
8396
8459
|
function parseAave32(chainId, lender, prices, additionalYields, tokenList) {
|
|
8397
8460
|
const assetsToQuery = getAaveAssets(chainId, lender);
|
|
8461
|
+
const aaveTokenMap = getAaveStyleProtocolTokenMap(chainId, lender);
|
|
8398
8462
|
const allModes = AAVE_V3_EMODES(chainId, lender);
|
|
8399
8463
|
const expectedNumberOfCalls = assetsToQuery.length * 5 + allModes.length * 3 + 2;
|
|
8400
8464
|
return [
|
|
@@ -8480,10 +8544,8 @@ function parseAave32(chainId, lender, prices, additionalYields, tokenList) {
|
|
|
8480
8544
|
rewards: {}
|
|
8481
8545
|
};
|
|
8482
8546
|
const assetIndex = lowerReservesList.indexOf(asset);
|
|
8483
|
-
const
|
|
8484
|
-
|
|
8485
|
-
).filter((m) => m !== void 0 && m > 0);
|
|
8486
|
-
activeEmodes.length === 0 ? 0 : activeEmodes[0];
|
|
8547
|
+
const usageAsCollateralEnabled = configData?.[5 /* usageAsCollateralEnabled */];
|
|
8548
|
+
const borrowingEnabled = configData?.[6 /* borrowingEnabled */];
|
|
8487
8549
|
resultReserves[asset] = {
|
|
8488
8550
|
...resultReserves[asset],
|
|
8489
8551
|
decimals: Number(
|
|
@@ -8498,11 +8560,13 @@ function parseAave32(chainId, lender, prices, additionalYields, tokenList) {
|
|
|
8498
8560
|
debtBitmap,
|
|
8499
8561
|
assetIndex,
|
|
8500
8562
|
eModeConfigs,
|
|
8501
|
-
allModes
|
|
8563
|
+
allModes,
|
|
8564
|
+
usageAsCollateralEnabled,
|
|
8565
|
+
borrowingEnabled
|
|
8502
8566
|
),
|
|
8503
8567
|
// flags
|
|
8504
|
-
collateralActive:
|
|
8505
|
-
borrowingEnabled
|
|
8568
|
+
collateralActive: usageAsCollateralEnabled,
|
|
8569
|
+
borrowingEnabled,
|
|
8506
8570
|
hasStable: configData?.[7 /* stableBorrowRateEnabled */],
|
|
8507
8571
|
isActive: configData?.[8 /* isActive */],
|
|
8508
8572
|
isFrozen: configData?.[9 /* isFrozen */],
|
|
@@ -8516,6 +8580,19 @@ function parseAave32(chainId, lender, prices, additionalYields, tokenList) {
|
|
|
8516
8580
|
)
|
|
8517
8581
|
)
|
|
8518
8582
|
};
|
|
8583
|
+
const aaveTokens3 = aaveTokenMap[asset];
|
|
8584
|
+
if (!!aaveTokens3) {
|
|
8585
|
+
resultReserves[asset] = {
|
|
8586
|
+
...resultReserves[asset],
|
|
8587
|
+
params: {
|
|
8588
|
+
metadata: {
|
|
8589
|
+
aToken: aaveTokens3.aToken,
|
|
8590
|
+
vToken: aaveTokens3.vToken,
|
|
8591
|
+
sToken: aaveTokens3.sToken
|
|
8592
|
+
}
|
|
8593
|
+
}
|
|
8594
|
+
};
|
|
8595
|
+
}
|
|
8519
8596
|
}
|
|
8520
8597
|
return {
|
|
8521
8598
|
data: resultReserves,
|
|
@@ -8609,7 +8686,9 @@ var getInitReservesDataConverter = (lender, chainId, prices, additionalYields, t
|
|
|
8609
8686
|
),
|
|
8610
8687
|
maxHealthAfterLiq: Number(
|
|
8611
8688
|
parseRawAmount(multicallData.maxHealthAfterLiq, 18)
|
|
8612
|
-
)
|
|
8689
|
+
),
|
|
8690
|
+
debtDisabled: false,
|
|
8691
|
+
collateralDisabled: false
|
|
8613
8692
|
};
|
|
8614
8693
|
if (!eModes[mode]) eModes[mode] = modeData;
|
|
8615
8694
|
result[asset].config[mode] = modeData;
|
|
@@ -8680,7 +8759,9 @@ var getCompoundV3ReservesDataConverter = (lender, chainId, prices, additionalYie
|
|
|
8680
8759
|
resultsAssetInfo.liquidateCollateralFactor.toString(),
|
|
8681
8760
|
COMET_RISK_DECIMALS
|
|
8682
8761
|
),
|
|
8683
|
-
borrowFactor: 1
|
|
8762
|
+
borrowFactor: 1,
|
|
8763
|
+
collateralDisabled: false,
|
|
8764
|
+
debtDisabled: true
|
|
8684
8765
|
}
|
|
8685
8766
|
},
|
|
8686
8767
|
supplyCap: parseRawAmount(
|
|
@@ -8744,7 +8825,10 @@ var getCompoundV3ReservesDataConverter = (lender, chainId, prices, additionalYie
|
|
|
8744
8825
|
// collateral factors
|
|
8745
8826
|
borrowCollateralFactor: 0,
|
|
8746
8827
|
collateralFactor: 0,
|
|
8747
|
-
borrowFactor: 1
|
|
8828
|
+
borrowFactor: 1,
|
|
8829
|
+
// base asset: borrowable, no collateral
|
|
8830
|
+
collateralDisabled: true,
|
|
8831
|
+
debtDisabled: false
|
|
8748
8832
|
}
|
|
8749
8833
|
},
|
|
8750
8834
|
// interest rates
|
|
@@ -10948,7 +11032,9 @@ function convertMarketsToMorphoResponse(response, chainId, additionalYields = {
|
|
|
10948
11032
|
category: 0,
|
|
10949
11033
|
borrowCollateralFactor: 0,
|
|
10950
11034
|
collateralFactor: 0,
|
|
10951
|
-
borrowFactor: 1
|
|
11035
|
+
borrowFactor: 1,
|
|
11036
|
+
collateralDisabled: true,
|
|
11037
|
+
debtDisabled: false
|
|
10952
11038
|
}
|
|
10953
11039
|
},
|
|
10954
11040
|
collateralActive: false,
|
|
@@ -10989,7 +11075,9 @@ function convertMarketsToMorphoResponse(response, chainId, additionalYields = {
|
|
|
10989
11075
|
category: 0,
|
|
10990
11076
|
borrowCollateralFactor: ltv,
|
|
10991
11077
|
collateralFactor: ltv,
|
|
10992
|
-
borrowFactor: 1
|
|
11078
|
+
borrowFactor: 1,
|
|
11079
|
+
collateralDisabled: false,
|
|
11080
|
+
debtDisabled: true
|
|
10993
11081
|
}
|
|
10994
11082
|
},
|
|
10995
11083
|
collateralActive: true,
|
|
@@ -11647,7 +11735,9 @@ function getMorphoMarketDataConverter(lender, chainId, prices, additionalYields
|
|
|
11647
11735
|
category: 0,
|
|
11648
11736
|
borrowCollateralFactor: 0,
|
|
11649
11737
|
collateralFactor: 0,
|
|
11650
|
-
borrowFactor: 1
|
|
11738
|
+
borrowFactor: 1,
|
|
11739
|
+
collateralDisabled: true,
|
|
11740
|
+
debtDisabled: false
|
|
11651
11741
|
}
|
|
11652
11742
|
},
|
|
11653
11743
|
collateralActive: false,
|
|
@@ -11683,7 +11773,9 @@ function getMorphoMarketDataConverter(lender, chainId, prices, additionalYields
|
|
|
11683
11773
|
category: 0,
|
|
11684
11774
|
borrowCollateralFactor: ltv,
|
|
11685
11775
|
collateralFactor: ltv,
|
|
11686
|
-
borrowFactor: 1
|
|
11776
|
+
borrowFactor: 1,
|
|
11777
|
+
collateralDisabled: false,
|
|
11778
|
+
debtDisabled: true
|
|
11687
11779
|
}
|
|
11688
11780
|
},
|
|
11689
11781
|
collateralActive: true,
|
|
@@ -11808,7 +11900,9 @@ function getListaMarketDataConverter(lender, chainId, prices, additionalYields =
|
|
|
11808
11900
|
category: 0,
|
|
11809
11901
|
borrowCollateralFactor: 0,
|
|
11810
11902
|
collateralFactor: 0,
|
|
11811
|
-
borrowFactor: 1
|
|
11903
|
+
borrowFactor: 1,
|
|
11904
|
+
collateralDisabled: true,
|
|
11905
|
+
debtDisabled: false
|
|
11812
11906
|
}
|
|
11813
11907
|
},
|
|
11814
11908
|
collateralActive: false,
|
|
@@ -11843,7 +11937,9 @@ function getListaMarketDataConverter(lender, chainId, prices, additionalYields =
|
|
|
11843
11937
|
category: 0,
|
|
11844
11938
|
borrowCollateralFactor: ltv,
|
|
11845
11939
|
collateralFactor: ltv,
|
|
11846
|
-
borrowFactor: 1
|
|
11940
|
+
borrowFactor: 1,
|
|
11941
|
+
collateralDisabled: false,
|
|
11942
|
+
debtDisabled: true
|
|
11847
11943
|
}
|
|
11848
11944
|
},
|
|
11849
11945
|
collateralActive: true,
|
|
@@ -12041,12 +12137,12 @@ function getCompoundV2Comptroller(chainId, lender = Lender.VENUS) {
|
|
|
12041
12137
|
function getCompoundV2CollateralTokens(chainId, lender = Lender.VENUS) {
|
|
12042
12138
|
return compoundV2Tokens()?.[lender]?.[chainId];
|
|
12043
12139
|
}
|
|
12044
|
-
function getCompoundV2Reserves(chainId, lender = Lender.VENUS) {
|
|
12045
|
-
return compoundV2Reserves()?.[lender]?.[chainId];
|
|
12046
|
-
}
|
|
12047
12140
|
function getCompoundV2Lens(chainId, lender) {
|
|
12048
12141
|
return COMPOUND_V2_LENS[lender]?.[chainId];
|
|
12049
12142
|
}
|
|
12143
|
+
function getCompoundV2Tokens(chainId, lender = Lender.VENUS) {
|
|
12144
|
+
return compoundV2TokenArray()?.[lender]?.[chainId];
|
|
12145
|
+
}
|
|
12050
12146
|
|
|
12051
12147
|
// src/abis/compound-v2/VenusLensLegacy.ts
|
|
12052
12148
|
var VenusLensLegacyAbi = [
|
|
@@ -12396,8 +12492,15 @@ function parseMoonwellMarket(input, token) {
|
|
|
12396
12492
|
// src/lending/compound-v2/publicCallParse.ts
|
|
12397
12493
|
var PRICE_DECIMALS = 18;
|
|
12398
12494
|
var RESERVE_MANTISSA_DECIMALS = 18;
|
|
12399
|
-
function
|
|
12400
|
-
const {
|
|
12495
|
+
function convertSingleEntry(opts) {
|
|
12496
|
+
const {
|
|
12497
|
+
entryRaw,
|
|
12498
|
+
reader,
|
|
12499
|
+
asset,
|
|
12500
|
+
prices,
|
|
12501
|
+
additionalYields,
|
|
12502
|
+
cToken
|
|
12503
|
+
} = opts;
|
|
12401
12504
|
const decs = asset.decimals;
|
|
12402
12505
|
const currentEntry = reader(entryRaw, asset);
|
|
12403
12506
|
const borrowCollateralFactor = parseRawAmount(
|
|
@@ -12418,6 +12521,8 @@ function convertSingleReserveEntry(opts) {
|
|
|
12418
12521
|
const pausedActions = currentEntry.pausedActions;
|
|
12419
12522
|
const allPaused = pausedActions[0 /* MINT */] && pausedActions[2 /* BORROW */] && pausedActions[1 /* REDEEM */] && pausedActions[3 /* REPAY */];
|
|
12420
12523
|
const poolId = asset.address;
|
|
12524
|
+
const collateralActive = Boolean(currentEntry?.isListed);
|
|
12525
|
+
const borrowingEnabled = Boolean(currentEntry?.isBorrowAllowed) && !pausedActions[2 /* BORROW */];
|
|
12421
12526
|
return {
|
|
12422
12527
|
poolId,
|
|
12423
12528
|
asset,
|
|
@@ -12440,7 +12545,9 @@ function convertSingleReserveEntry(opts) {
|
|
|
12440
12545
|
// collateral factors
|
|
12441
12546
|
borrowCollateralFactor: Number(borrowCollateralFactor),
|
|
12442
12547
|
collateralFactor: Number(borrowCollateralFactor),
|
|
12443
|
-
borrowFactor: 1
|
|
12548
|
+
borrowFactor: 1,
|
|
12549
|
+
collateralDisabled: !collateralActive,
|
|
12550
|
+
debtDisabled: !borrowingEnabled
|
|
12444
12551
|
}
|
|
12445
12552
|
},
|
|
12446
12553
|
hasStable: false,
|
|
@@ -12449,36 +12556,41 @@ function convertSingleReserveEntry(opts) {
|
|
|
12449
12556
|
// compSupplySpeed: parseRawAmount(currentEntry?.venusSupplySpeed?.toString(), 5),
|
|
12450
12557
|
// compBorrowSpeed: parseRawAmount(currentEntry?.venusBorrowSpeed?.toString(), 5),
|
|
12451
12558
|
isActive: Boolean(currentEntry?.isListed) && !allPaused,
|
|
12452
|
-
collateralActive: Boolean(currentEntry?.isListed),
|
|
12453
12559
|
isFrozen: pausedActions[0 /* MINT */] && pausedActions[2 /* BORROW */],
|
|
12454
12560
|
rewards: {},
|
|
12455
|
-
|
|
12456
|
-
|
|
12457
|
-
cTokenDecimals: Number(currentEntry?.cTokenDecimals?.toString())
|
|
12458
|
-
},
|
|
12459
|
-
borrowingEnabled: Boolean(currentEntry?.isBorrowAllowed) && !pausedActions[2 /* BORROW */]
|
|
12561
|
+
collateralActive,
|
|
12562
|
+
borrowingEnabled,
|
|
12460
12563
|
// borrowCap example left commented as in original:
|
|
12461
12564
|
// borrowCap: parseRawAmount(currentEntry?.borrowCap?.toString(), decs),
|
|
12565
|
+
params: {
|
|
12566
|
+
metadata: {
|
|
12567
|
+
cToken,
|
|
12568
|
+
exchangeRate: exchangeRateRaw.toString(),
|
|
12569
|
+
cTokenDecimals: Number(currentEntry?.cTokenDecimals?.toString())
|
|
12570
|
+
}
|
|
12571
|
+
}
|
|
12462
12572
|
};
|
|
12463
12573
|
}
|
|
12464
|
-
var
|
|
12465
|
-
const
|
|
12466
|
-
const expectedNumberOfCalls =
|
|
12574
|
+
var getCompoundV2DataConverter = (lender, chainId, prices, additionalYields, tokenList = {}) => {
|
|
12575
|
+
const compoundV2Tokens2 = getCompoundV2Tokens(chainId, lender);
|
|
12576
|
+
const expectedNumberOfCalls = compoundV2Tokens2.length;
|
|
12467
12577
|
const reader = getReader(lender);
|
|
12468
12578
|
return [
|
|
12469
12579
|
(data) => {
|
|
12470
12580
|
if (data.length !== expectedNumberOfCalls) return void 0;
|
|
12471
12581
|
const out = { data: {}, chainId };
|
|
12472
|
-
for (let i = 0; i <
|
|
12473
|
-
const
|
|
12582
|
+
for (let i = 0; i < compoundV2Tokens2.length; i++) {
|
|
12583
|
+
const { underlying, cToken } = compoundV2Tokens2[i];
|
|
12584
|
+
const poolId = underlying;
|
|
12474
12585
|
const asset = tokenList[poolId];
|
|
12475
12586
|
const entryRaw = data[i];
|
|
12476
|
-
out.data[poolId] =
|
|
12587
|
+
out.data[poolId] = convertSingleEntry({
|
|
12477
12588
|
entryRaw,
|
|
12478
12589
|
reader,
|
|
12479
12590
|
asset,
|
|
12480
12591
|
prices,
|
|
12481
|
-
additionalYields
|
|
12592
|
+
additionalYields,
|
|
12593
|
+
cToken
|
|
12482
12594
|
});
|
|
12483
12595
|
}
|
|
12484
12596
|
return out;
|
|
@@ -13386,7 +13498,7 @@ function getLenderDataConverter(lender, chainId, prices, additionalYields, token
|
|
|
13386
13498
|
);
|
|
13387
13499
|
}
|
|
13388
13500
|
if (isCompoundV2Type(lender))
|
|
13389
|
-
return
|
|
13501
|
+
return getCompoundV2DataConverter(
|
|
13390
13502
|
lender,
|
|
13391
13503
|
chainId,
|
|
13392
13504
|
prices,
|
|
@@ -19406,6 +19518,7 @@ var compoundV3Reserves2 = baseUrl + "/data/compound-v3-reserves.json";
|
|
|
19406
19518
|
var initConfig2 = baseUrl + "/data/init-config.json";
|
|
19407
19519
|
var aaveTokens2 = baseUrl + "/data/aave-tokens.json";
|
|
19408
19520
|
var compoundV2CTokens = baseUrl + "/data/compound-v2-c-tokens.json";
|
|
19521
|
+
var compoundV2TokenArray2 = baseUrl + "/data/compound-v2-tokens.json";
|
|
19409
19522
|
var compoundV3Base = baseUrl + "/data/compound-v3-base-data.json";
|
|
19410
19523
|
var baseUrlChains = "https://raw.githubusercontent.com/1delta-DAO/chains/main";
|
|
19411
19524
|
var chains = baseUrlChains + "/data.json";
|
|
@@ -19427,6 +19540,7 @@ async function fetchLenderMetaFromDirAndInitialize() {
|
|
|
19427
19540
|
initConfigOverride,
|
|
19428
19541
|
aaveTokensOverride,
|
|
19429
19542
|
compoundV2TokensOverride,
|
|
19543
|
+
compoundV2TokenArrayOverride,
|
|
19430
19544
|
compoundV3BaseDataOverride,
|
|
19431
19545
|
aaveOraclesOverride,
|
|
19432
19546
|
morphoTypeOraclesOverride,
|
|
@@ -19440,6 +19554,7 @@ async function fetchLenderMetaFromDirAndInitialize() {
|
|
|
19440
19554
|
compoundV3BaseDataOverride,
|
|
19441
19555
|
morphoPoolsOverride,
|
|
19442
19556
|
compoundV2TokensOverride,
|
|
19557
|
+
compoundV2TokenArrayOverride,
|
|
19443
19558
|
compoundV2PoolsOverride,
|
|
19444
19559
|
initConfigOverride,
|
|
19445
19560
|
aaveReservesOverride,
|
|
@@ -19464,6 +19579,7 @@ async function fetchLenderMetaFromDir() {
|
|
|
19464
19579
|
initConfig2,
|
|
19465
19580
|
aaveTokens2,
|
|
19466
19581
|
compoundV2CTokens,
|
|
19582
|
+
compoundV2TokenArray2,
|
|
19467
19583
|
compoundV3Base,
|
|
19468
19584
|
aaveOracles2,
|
|
19469
19585
|
morphoTypeOracles2,
|
|
@@ -19482,6 +19598,7 @@ async function fetchLenderMetaFromDir() {
|
|
|
19482
19598
|
initConfigOverride,
|
|
19483
19599
|
aaveTokensOverride,
|
|
19484
19600
|
compoundV2TokensOverride,
|
|
19601
|
+
compoundV2TokenArrayOverride,
|
|
19485
19602
|
compoundV3BaseDataOverride,
|
|
19486
19603
|
aaveOraclesOverride,
|
|
19487
19604
|
morphoTypeOraclesOverride,
|
|
@@ -19500,6 +19617,7 @@ async function fetchLenderMetaFromDir() {
|
|
|
19500
19617
|
initConfigOverride,
|
|
19501
19618
|
aaveTokensOverride,
|
|
19502
19619
|
compoundV2TokensOverride,
|
|
19620
|
+
compoundV2TokenArrayOverride,
|
|
19503
19621
|
compoundV3BaseDataOverride,
|
|
19504
19622
|
aaveOraclesOverride,
|
|
19505
19623
|
morphoTypeOraclesOverride,
|