@1delta/margin-fetcher 0.0.86 → 0.0.88
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/index.js +27 -17
- package/dist/index.js.map +1 -1
- package/dist/lending/compound-v2/publicCallParse.d.ts.map +1 -1
- package/dist/prices/main-prices/fetchOracleData.d.ts.map +1 -1
- package/dist/types/lender/compound-v2-types.d.ts +1 -0
- package/dist/types/lender/compound-v2-types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12001,7 +12001,9 @@ var getCompoundV2ReservesDataConverter = (lender, chainId, prices, additionalYie
|
|
|
12001
12001
|
const price = prices[asset.assetGroup] ?? 0;
|
|
12002
12002
|
const pausedActions = decodePausedActions(currentEntry.pausedActions);
|
|
12003
12003
|
const allPaused = pausedActions[0 /* MINT */] && pausedActions[2 /* BORROW */] && pausedActions[1 /* REDEEM */] && pausedActions[3 /* REPAY */];
|
|
12004
|
-
|
|
12004
|
+
const poolId = asset.address;
|
|
12005
|
+
returnData.data[poolId] = {
|
|
12006
|
+
poolId,
|
|
12005
12007
|
asset,
|
|
12006
12008
|
// interest rates
|
|
12007
12009
|
depositRate: calculateRateForCompound(
|
|
@@ -17585,9 +17587,15 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
|
|
|
17585
17587
|
}
|
|
17586
17588
|
const assetMeta = asset;
|
|
17587
17589
|
const decimals = assetMeta?.decimals ?? 18;
|
|
17588
|
-
const currentATokenBalance =
|
|
17589
|
-
|
|
17590
|
-
|
|
17590
|
+
const currentATokenBalance = Number(
|
|
17591
|
+
parseRawAmount(currentATokenBalanceRaw, decimals)
|
|
17592
|
+
);
|
|
17593
|
+
const currentStableDebt = Number(
|
|
17594
|
+
parseRawAmount(currentStableDebtRaw, decimals)
|
|
17595
|
+
);
|
|
17596
|
+
const currentVariableDebt = Number(
|
|
17597
|
+
parseRawAmount(currentVariableDebtRaw, decimals)
|
|
17598
|
+
);
|
|
17591
17599
|
const key = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset.address, chainId);
|
|
17592
17600
|
const price = prices[key] ?? 1;
|
|
17593
17601
|
const priceHist = pricesHist?.[key] ?? price;
|
|
@@ -17598,9 +17606,9 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
|
|
|
17598
17606
|
depositsRaw: currentATokenBalanceRaw,
|
|
17599
17607
|
debtStable: currentStableDebt,
|
|
17600
17608
|
debt: currentVariableDebt,
|
|
17601
|
-
depositsUSD:
|
|
17602
|
-
debtStableUSD:
|
|
17603
|
-
debtUSD:
|
|
17609
|
+
depositsUSD: currentATokenBalance * price,
|
|
17610
|
+
debtStableUSD: currentStableDebt * price,
|
|
17611
|
+
debtUSD: currentVariableDebt * price,
|
|
17604
17612
|
stableBorrowRate: reserveData[5 /* stableBorrowRate */]?.toString(),
|
|
17605
17613
|
collateralEnabled: Boolean(
|
|
17606
17614
|
reserveData[8 /* usageAsCollateralEnabled */]
|
|
@@ -17609,8 +17617,8 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
|
|
|
17609
17617
|
};
|
|
17610
17618
|
return {
|
|
17611
17619
|
dataForAsset,
|
|
17612
|
-
addedDeposits:
|
|
17613
|
-
addedDebt: (
|
|
17620
|
+
addedDeposits: currentATokenBalance * priceHist,
|
|
17621
|
+
addedDebt: (currentVariableDebt + currentStableDebt) * priceHist
|
|
17614
17622
|
};
|
|
17615
17623
|
}
|
|
17616
17624
|
|
|
@@ -18310,8 +18318,8 @@ function createCompoundV2Entry(i, data, assetsIn, vToken, asset, prices, pricesH
|
|
|
18310
18318
|
}
|
|
18311
18319
|
const assetMeta = asset;
|
|
18312
18320
|
const decimals = assetMeta?.decimals ?? 18;
|
|
18313
|
-
const currentATokenBalance = parseRawAmount(depositsRaw, decimals);
|
|
18314
|
-
const currentVariableDebt = parseRawAmount(borrowsRaw, decimals);
|
|
18321
|
+
const currentATokenBalance = Number(parseRawAmount(depositsRaw, decimals));
|
|
18322
|
+
const currentVariableDebt = Number(parseRawAmount(borrowsRaw, decimals));
|
|
18315
18323
|
const key = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset.address, asset.chainId);
|
|
18316
18324
|
const price = prices[key] ?? 1;
|
|
18317
18325
|
const priceHist = pricesHist?.[key] ?? price;
|
|
@@ -18322,16 +18330,16 @@ function createCompoundV2Entry(i, data, assetsIn, vToken, asset, prices, pricesH
|
|
|
18322
18330
|
depositsRaw,
|
|
18323
18331
|
debtStable: 0,
|
|
18324
18332
|
debt: currentVariableDebt,
|
|
18325
|
-
depositsUSD:
|
|
18333
|
+
depositsUSD: currentATokenBalance * price,
|
|
18326
18334
|
debtStableUSD: 0,
|
|
18327
|
-
debtUSD:
|
|
18335
|
+
debtUSD: currentVariableDebt * price,
|
|
18328
18336
|
collateralEnabled: Boolean(assetsIn?.includes(vToken)),
|
|
18329
18337
|
claimableRewards
|
|
18330
18338
|
};
|
|
18331
18339
|
return {
|
|
18332
18340
|
dataForAsset,
|
|
18333
|
-
addedDeposits:
|
|
18334
|
-
addedDebt:
|
|
18341
|
+
addedDeposits: currentATokenBalance * priceHist,
|
|
18342
|
+
addedDebt: currentVariableDebt * priceHist
|
|
18335
18343
|
};
|
|
18336
18344
|
}
|
|
18337
18345
|
|
|
@@ -21626,10 +21634,11 @@ var fetchMainPrices = async (chainIds, rpcOverrides, lists = {}) => {
|
|
|
21626
21634
|
uniswapV3Calls,
|
|
21627
21635
|
api3,
|
|
21628
21636
|
rwa,
|
|
21629
|
-
comet
|
|
21637
|
+
comet,
|
|
21638
|
+
compoundV2
|
|
21630
21639
|
}
|
|
21631
21640
|
} of chainResults) {
|
|
21632
|
-
const morphoOffset = chainlink.calls.length + aaveCalls.length + uniswapCalls.length + uniswapV3Calls.length + api3.calls.length + comet.calls.length + rwa.calls.length;
|
|
21641
|
+
const morphoOffset = chainlink.calls.length + aaveCalls.length + uniswapCalls.length + uniswapV3Calls.length + api3.calls.length + comet.calls.length + compoundV2.calls.length + rwa.calls.length;
|
|
21633
21642
|
const morphoResult = result.slice(morphoOffset);
|
|
21634
21643
|
const morphoData = parseMorphoResults(
|
|
21635
21644
|
chainId,
|
|
@@ -21908,6 +21917,7 @@ function getExponentForOracle(chainId, fork) {
|
|
|
21908
21917
|
if (chainId === Chain.XDC_NETWORK) return 0n;
|
|
21909
21918
|
if (chainId === Chain.TELOS_EVM_MAINNET) return 10n;
|
|
21910
21919
|
if (chainId === Chain.SONIC_MAINNET && fork === Lender.POLTER) return 10n;
|
|
21920
|
+
if (chainId === Chain.ARBITRUM_ONE && fork === Lender.RADIANT_V2) return 10n;
|
|
21911
21921
|
return AAVE_V2_LENDERS.includes(fork) ? 0n : 10n;
|
|
21912
21922
|
}
|
|
21913
21923
|
var parseAaveResults = (chainId, data, queries, list = {}) => {
|