@gearbox-protocol/sdk 3.0.0-next.134 → 3.0.0-next.136

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.
@@ -333,7 +333,10 @@ class CreditAccountData {
333
333
  const underlyingTokenLC = underlyingToken.toLowerCase();
334
334
  const [, underlyingDecimals = 18] = (0, sdk_gov_1.extractTokenData)(underlyingTokenLC);
335
335
  const { balance: underlyingBalance = 0n } = assets[underlyingTokenLC] || {};
336
- const effectiveDebt = ((debt - underlyingBalance) * sdk_gov_1.WAD) / 10n ** BigInt(underlyingDecimals);
336
+ // effectiveDebt = Debt - underlyingBalance*LTunderlying
337
+ const ltUnderlying = liquidationThresholds[underlyingTokenLC] || 0n;
338
+ const effectiveDebt = ((debt - (underlyingBalance * ltUnderlying) / sdk_gov_1.PERCENTAGE_FACTOR) * sdk_gov_1.WAD) /
339
+ 10n ** BigInt(underlyingDecimals);
337
340
  const targetTokenLC = targetToken.toLowerCase();
338
341
  const [, targetDecimals = 18] = (0, sdk_gov_1.extractTokenData)(targetTokenLC);
339
342
  const { balance: targetBalance = 0n } = assets[targetTokenLC] || {};
@@ -341,9 +344,9 @@ class CreditAccountData {
341
344
  const lpLT = liquidationThresholds[targetTokenLC] || 0n;
342
345
  if (targetBalance <= 0n || lpLT <= 0n)
343
346
  return 0n;
347
+ // priceTarget = effectiveDebt / (lpLT*targetBalance)
344
348
  return ((effectiveDebt * sdk_gov_1.PRICE_DECIMALS * sdk_gov_1.PERCENTAGE_FACTOR) /
345
- effectiveTargetBalance /
346
- lpLT);
349
+ (effectiveTargetBalance * lpLT));
347
350
  }
348
351
  }
349
352
  exports.CreditAccountData = CreditAccountData;
@@ -2,6 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TokenData = void 0;
4
4
  const config_1 = require("../config");
5
+ const ALIASES = {
6
+ USDC_e: "USDC.e",
7
+ };
5
8
  class TokenData {
6
9
  title;
7
10
  symbol;
@@ -11,7 +14,7 @@ class TokenData {
11
14
  constructor(payload) {
12
15
  const symbol = payload.symbol;
13
16
  const title = payload.title || symbol;
14
- this.title = title;
17
+ this.title = ALIASES[title] || title;
15
18
  this.address = payload.addr.toLowerCase();
16
19
  this.symbol = symbol;
17
20
  this.decimals = payload.decimals;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.134",
3
+ "version": "3.0.0-next.136",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",