@1delta/margin-fetcher 0.0.86 → 0.0.87
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 +20 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17585,9 +17585,15 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
|
|
|
17585
17585
|
}
|
|
17586
17586
|
const assetMeta = asset;
|
|
17587
17587
|
const decimals = assetMeta?.decimals ?? 18;
|
|
17588
|
-
const currentATokenBalance =
|
|
17589
|
-
|
|
17590
|
-
|
|
17588
|
+
const currentATokenBalance = Number(
|
|
17589
|
+
parseRawAmount(currentATokenBalanceRaw, decimals)
|
|
17590
|
+
);
|
|
17591
|
+
const currentStableDebt = Number(
|
|
17592
|
+
parseRawAmount(currentStableDebtRaw, decimals)
|
|
17593
|
+
);
|
|
17594
|
+
const currentVariableDebt = Number(
|
|
17595
|
+
parseRawAmount(currentVariableDebtRaw, decimals)
|
|
17596
|
+
);
|
|
17591
17597
|
const key = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset.address, chainId);
|
|
17592
17598
|
const price = prices[key] ?? 1;
|
|
17593
17599
|
const priceHist = pricesHist?.[key] ?? price;
|
|
@@ -17598,9 +17604,9 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
|
|
|
17598
17604
|
depositsRaw: currentATokenBalanceRaw,
|
|
17599
17605
|
debtStable: currentStableDebt,
|
|
17600
17606
|
debt: currentVariableDebt,
|
|
17601
|
-
depositsUSD:
|
|
17602
|
-
debtStableUSD:
|
|
17603
|
-
debtUSD:
|
|
17607
|
+
depositsUSD: currentATokenBalance * price,
|
|
17608
|
+
debtStableUSD: currentStableDebt * price,
|
|
17609
|
+
debtUSD: currentVariableDebt * price,
|
|
17604
17610
|
stableBorrowRate: reserveData[5 /* stableBorrowRate */]?.toString(),
|
|
17605
17611
|
collateralEnabled: Boolean(
|
|
17606
17612
|
reserveData[8 /* usageAsCollateralEnabled */]
|
|
@@ -17609,8 +17615,8 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
|
|
|
17609
17615
|
};
|
|
17610
17616
|
return {
|
|
17611
17617
|
dataForAsset,
|
|
17612
|
-
addedDeposits:
|
|
17613
|
-
addedDebt: (
|
|
17618
|
+
addedDeposits: currentATokenBalance * priceHist,
|
|
17619
|
+
addedDebt: (currentVariableDebt + currentStableDebt) * priceHist
|
|
17614
17620
|
};
|
|
17615
17621
|
}
|
|
17616
17622
|
|
|
@@ -18310,8 +18316,8 @@ function createCompoundV2Entry(i, data, assetsIn, vToken, asset, prices, pricesH
|
|
|
18310
18316
|
}
|
|
18311
18317
|
const assetMeta = asset;
|
|
18312
18318
|
const decimals = assetMeta?.decimals ?? 18;
|
|
18313
|
-
const currentATokenBalance = parseRawAmount(depositsRaw, decimals);
|
|
18314
|
-
const currentVariableDebt = parseRawAmount(borrowsRaw, decimals);
|
|
18319
|
+
const currentATokenBalance = Number(parseRawAmount(depositsRaw, decimals));
|
|
18320
|
+
const currentVariableDebt = Number(parseRawAmount(borrowsRaw, decimals));
|
|
18315
18321
|
const key = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset.address, asset.chainId);
|
|
18316
18322
|
const price = prices[key] ?? 1;
|
|
18317
18323
|
const priceHist = pricesHist?.[key] ?? price;
|
|
@@ -18322,16 +18328,16 @@ function createCompoundV2Entry(i, data, assetsIn, vToken, asset, prices, pricesH
|
|
|
18322
18328
|
depositsRaw,
|
|
18323
18329
|
debtStable: 0,
|
|
18324
18330
|
debt: currentVariableDebt,
|
|
18325
|
-
depositsUSD:
|
|
18331
|
+
depositsUSD: currentATokenBalance * price,
|
|
18326
18332
|
debtStableUSD: 0,
|
|
18327
|
-
debtUSD:
|
|
18333
|
+
debtUSD: currentVariableDebt * price,
|
|
18328
18334
|
collateralEnabled: Boolean(assetsIn?.includes(vToken)),
|
|
18329
18335
|
claimableRewards
|
|
18330
18336
|
};
|
|
18331
18337
|
return {
|
|
18332
18338
|
dataForAsset,
|
|
18333
|
-
addedDeposits:
|
|
18334
|
-
addedDebt:
|
|
18339
|
+
addedDeposits: currentATokenBalance * priceHist,
|
|
18340
|
+
addedDebt: currentVariableDebt * priceHist
|
|
18335
18341
|
};
|
|
18336
18342
|
}
|
|
18337
18343
|
|