@gearbox-protocol/sdk 3.0.0-vfour.225 → 3.0.0-vfour.227

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.
@@ -118,7 +118,7 @@ var AccountOpener = class extends sdk.SDKConstruct {
118
118
  const { minDebt, underlying } = cm.creditFacade;
119
119
  const expectedBalances = [];
120
120
  const leftoverBalances = [];
121
- for (const t of Object.keys(cm.collateralTokens)) {
121
+ for (const t of cm.creditManager.collateralTokens) {
122
122
  const token = t;
123
123
  expectedBalances.push({
124
124
  token,
@@ -351,12 +351,15 @@ var AccountOpener = class extends sdk.SDKConstruct {
351
351
  return this.#borrower;
352
352
  }
353
353
  #getCollateralQuota(cm, collateral, amount, debt) {
354
- const { underlying, collateralTokens } = cm;
354
+ const {
355
+ underlying,
356
+ creditManager: { liquidationThresholds }
357
+ } = cm;
355
358
  const inUnderlying = collateral.toLowerCase() === underlying.toLowerCase();
356
359
  if (inUnderlying) {
357
360
  return [];
358
361
  }
359
- const collateralLT = BigInt(collateralTokens[collateral]);
362
+ const collateralLT = BigInt(liquidationThresholds.mustGet(collateral));
360
363
  const market = this.sdk.marketRegister.findByCreditManager(
361
364
  cm.creditManager.address
362
365
  );
@@ -388,7 +391,7 @@ async function calcLiquidatableLTs(sdk$1, ca, factor = 9990n, logger) {
388
391
  const weightedBalances = ca.tokens.map((t) => {
389
392
  const { token, balance } = t;
390
393
  const balanceU = market.priceOracle.convertToUnderlying(token, balance);
391
- const lt = BigInt(cm.collateralTokens[token]);
394
+ const lt = BigInt(cm.creditManager.liquidationThresholds.mustGet(token));
392
395
  return {
393
396
  token,
394
397
  weightedBalance: balanceU * lt / sdk.PERCENTAGE_FACTOR,