@gearbox-protocol/sdk 3.0.0-next.104 → 3.0.0-next.105

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.
@@ -5,6 +5,7 @@ const sdk_gov_1 = require("@gearbox-protocol/sdk-gov");
5
5
  const formatter_1 = require("../utils/formatter");
6
6
  const math_1 = require("../utils/math");
7
7
  const price_1 = require("../utils/price");
8
+ const MAX_UINT16 = 65535;
8
9
  class CreditAccountData {
9
10
  isSuccessful;
10
11
  addr;
@@ -180,6 +181,8 @@ class CreditAccountData {
180
181
  return `${creditManager.toLowerCase()}:${borrower.toLowerCase()}`;
181
182
  }
182
183
  static calcHealthFactor({ assets, quotas, quotasInfo, liquidationThresholds, underlyingToken, debt, prices, }) {
184
+ if (debt === 0n)
185
+ return MAX_UINT16;
183
186
  const [, underlyingDecimals] = (0, sdk_gov_1.extractTokenData)(underlyingToken);
184
187
  const underlyingPrice = prices[underlyingToken] || 0n;
185
188
  const assetMoney = assets.reduce((acc, { token: tokenAddress, balance: amount }) => {
@@ -264,7 +264,7 @@ describe("CreditAccount calcHealthFactor test", () => {
264
264
  underlyingToken: "",
265
265
  debt: 0n,
266
266
  });
267
- (0, chai_1.expect)(result).to.be.eq(0);
267
+ (0, chai_1.expect)(result).to.be.eq(65535);
268
268
  });
269
269
  it("health factor after add collateral is calculated correctly", () => {
270
270
  const collateral = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-next.104",
3
+ "version": "3.0.0-next.105",
4
4
  "description": "Gearbox SDK",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",