@1delta/margin-fetcher 0.0.85 → 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 CHANGED
@@ -11997,6 +11997,7 @@ var getCompoundV2ReservesDataConverter = (lender, chainId, prices, additionalYie
11997
11997
  const totalDebt = Number(
11998
11998
  parseRawAmount(currentEntry?.totalBorrows?.toString(), decs)
11999
11999
  );
12000
+ const liquidity = totalSupplyUnderlying - totalDebt;
12000
12001
  const price = prices[asset.assetGroup] ?? 0;
12001
12002
  const pausedActions = decodePausedActions(currentEntry.pausedActions);
12002
12003
  const allPaused = pausedActions[0 /* MINT */] && pausedActions[2 /* BORROW */] && pausedActions[1 /* REDEEM */] && pausedActions[3 /* REPAY */];
@@ -12014,7 +12015,8 @@ var getCompoundV2ReservesDataConverter = (lender, chainId, prices, additionalYie
12014
12015
  Lender.COMPOUND_V2
12015
12016
  ),
12016
12017
  stableBorrowRate: 0,
12017
- // deposits
12018
+ totalLiquidity: liquidity,
12019
+ totalLiquidityUSD: liquidity * price,
12018
12020
  totalDebt,
12019
12021
  totalDebtUSD: totalDebt * price,
12020
12022
  totalDeposits: totalSupplyUnderlying,
@@ -17583,9 +17585,15 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
17583
17585
  }
17584
17586
  const assetMeta = asset;
17585
17587
  const decimals = assetMeta?.decimals ?? 18;
17586
- const currentATokenBalance = parseRawAmount(currentATokenBalanceRaw, decimals);
17587
- const currentStableDebt = parseRawAmount(currentStableDebtRaw, decimals);
17588
- const currentVariableDebt = parseRawAmount(currentVariableDebtRaw, decimals);
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
+ );
17589
17597
  const key = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset.address, chainId);
17590
17598
  const price = prices[key] ?? 1;
17591
17599
  const priceHist = pricesHist?.[key] ?? price;
@@ -17596,9 +17604,9 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
17596
17604
  depositsRaw: currentATokenBalanceRaw,
17597
17605
  debtStable: currentStableDebt,
17598
17606
  debt: currentVariableDebt,
17599
- depositsUSD: Number(currentATokenBalance) * price,
17600
- debtStableUSD: Number(currentStableDebt) * price,
17601
- debtUSD: Number(currentVariableDebt) * price,
17607
+ depositsUSD: currentATokenBalance * price,
17608
+ debtStableUSD: currentStableDebt * price,
17609
+ debtUSD: currentVariableDebt * price,
17602
17610
  stableBorrowRate: reserveData[5 /* stableBorrowRate */]?.toString(),
17603
17611
  collateralEnabled: Boolean(
17604
17612
  reserveData[8 /* usageAsCollateralEnabled */]
@@ -17607,8 +17615,8 @@ function createAaveV2Entry(i, data, chainId, asset, prices, pricesHist, claimabl
17607
17615
  };
17608
17616
  return {
17609
17617
  dataForAsset,
17610
- addedDeposits: Number(currentATokenBalance) * priceHist,
17611
- addedDebt: (Number(currentVariableDebt) + Number(currentStableDebt)) * priceHist
17618
+ addedDeposits: currentATokenBalance * priceHist,
17619
+ addedDebt: (currentVariableDebt + currentStableDebt) * priceHist
17612
17620
  };
17613
17621
  }
17614
17622
 
@@ -18297,8 +18305,8 @@ var getCompoundV2UserDataConverter = (lender, chainId, account, prices, pricesHi
18297
18305
  }
18298
18306
  };
18299
18307
  function createCompoundV2Entry(i, data, assetsIn, vToken, asset, prices, pricesHist, claimableRewards) {
18300
- const depositsRaw = data[2 * i];
18301
- const borrowsRaw = data[2 * i + 1];
18308
+ const depositsRaw = data[2 * i].toString();
18309
+ const borrowsRaw = data[2 * i + 1].toString();
18302
18310
  if (depositsRaw === "0" && borrowsRaw === "0") {
18303
18311
  return {
18304
18312
  dataForAsset: void 0,
@@ -18308,8 +18316,8 @@ function createCompoundV2Entry(i, data, assetsIn, vToken, asset, prices, pricesH
18308
18316
  }
18309
18317
  const assetMeta = asset;
18310
18318
  const decimals = assetMeta?.decimals ?? 18;
18311
- const currentATokenBalance = parseRawAmount(depositsRaw, decimals);
18312
- const currentVariableDebt = parseRawAmount(borrowsRaw, decimals);
18319
+ const currentATokenBalance = Number(parseRawAmount(depositsRaw, decimals));
18320
+ const currentVariableDebt = Number(parseRawAmount(borrowsRaw, decimals));
18313
18321
  const key = toOracleKey(assetMeta?.assetGroup) ?? toGenericPriceKey(asset.address, asset.chainId);
18314
18322
  const price = prices[key] ?? 1;
18315
18323
  const priceHist = pricesHist?.[key] ?? price;
@@ -18320,16 +18328,16 @@ function createCompoundV2Entry(i, data, assetsIn, vToken, asset, prices, pricesH
18320
18328
  depositsRaw,
18321
18329
  debtStable: 0,
18322
18330
  debt: currentVariableDebt,
18323
- depositsUSD: Number(currentATokenBalance) * price,
18331
+ depositsUSD: currentATokenBalance * price,
18324
18332
  debtStableUSD: 0,
18325
- debtUSD: Number(currentVariableDebt) * price,
18333
+ debtUSD: currentVariableDebt * price,
18326
18334
  collateralEnabled: Boolean(assetsIn?.includes(vToken)),
18327
18335
  claimableRewards
18328
18336
  };
18329
18337
  return {
18330
18338
  dataForAsset,
18331
- addedDeposits: Number(currentATokenBalance) * priceHist,
18332
- addedDebt: Number(currentVariableDebt) * priceHist
18339
+ addedDeposits: currentATokenBalance * priceHist,
18340
+ addedDebt: currentVariableDebt * priceHist
18333
18341
  };
18334
18342
  }
18335
18343