@strkfarm/sdk 2.0.0-dev.4 → 2.0.0-dev.5

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.
@@ -92638,21 +92638,35 @@ spurious results.`);
92638
92638
  vaultAllocator: config3.vaultAllocator,
92639
92639
  id: ""
92640
92640
  });
92641
- this.tokenMarketData = new TokenMarketData(this.config.pricer, this.config.networkConfig);
92641
+ this.tokenMarketData = new TokenMarketData(
92642
+ this.config.pricer,
92643
+ this.config.networkConfig
92644
+ );
92642
92645
  }
92643
92646
  async getAPY(supportedPosition) {
92644
92647
  const CACHE_KEY = `apy_${this.config.poolId.address}_${supportedPosition.asset.symbol}`;
92645
92648
  const cacheData = this.getCache(CACHE_KEY);
92646
- console.log(`${_VesuMultiplyAdapter.name}::getAPY cacheData: ${JSON.stringify(cacheData)}`, this.vesuAdapter.config.poolId.shortString(), this.vesuAdapter.config.collateral.symbol, this.vesuAdapter.config.debt.symbol);
92649
+ console.log(
92650
+ `${_VesuMultiplyAdapter.name}::getAPY cacheData: ${JSON.stringify(
92651
+ cacheData
92652
+ )}`,
92653
+ this.vesuAdapter.config.poolId.shortString(),
92654
+ this.vesuAdapter.config.collateral.symbol,
92655
+ this.vesuAdapter.config.debt.symbol
92656
+ );
92647
92657
  if (cacheData) {
92648
92658
  return cacheData;
92649
92659
  }
92650
92660
  try {
92651
92661
  const allVesuPools = await VesuAdapter.getVesuPools();
92652
92662
  const asset = supportedPosition.asset;
92653
- const pool = allVesuPools.pools.find((p) => this.vesuAdapter.config.poolId.eqString(num_exports.getHexString(p.id)));
92663
+ const pool = allVesuPools.pools.find(
92664
+ (p) => this.vesuAdapter.config.poolId.eqString(num_exports.getHexString(p.id))
92665
+ );
92654
92666
  if (!pool) {
92655
- logger2.warn(`VesuMultiplyAdapter: Pool not found for token ${asset.symbol}`);
92667
+ logger2.warn(
92668
+ `VesuMultiplyAdapter: Pool not found for token ${asset.symbol}`
92669
+ );
92656
92670
  return {
92657
92671
  apy: 0,
92658
92672
  type: "base" /* BASE */
@@ -92662,7 +92676,9 @@ spurious results.`);
92662
92676
  (a) => a.symbol.toLowerCase() === asset.symbol.toLowerCase()
92663
92677
  )?.stats;
92664
92678
  if (!assetStats) {
92665
- logger2.warn(`VesuMultiplyAdapter: Asset stats not found for token ${asset.symbol}`);
92679
+ logger2.warn(
92680
+ `VesuMultiplyAdapter: Asset stats not found for token ${asset.symbol}`
92681
+ );
92666
92682
  return {
92667
92683
  apy: 0,
92668
92684
  type: "base" /* BASE */
@@ -92673,7 +92689,9 @@ spurious results.`);
92673
92689
  apy = Number(assetStats.borrowApr?.value || 0) / 1e18;
92674
92690
  } else {
92675
92691
  const isAssetBTC = asset.symbol.toLowerCase().includes("btc");
92676
- const baseAPY = Number(isAssetBTC ? assetStats.btcFiSupplyApr?.value + assetStats.supplyApy?.value : assetStats.supplyApy?.value || 0) / 1e18;
92692
+ const baseAPY = Number(
92693
+ isAssetBTC ? assetStats.btcFiSupplyApr?.value + assetStats.supplyApy?.value : assetStats.supplyApy?.value || 0
92694
+ ) / 1e18;
92677
92695
  const rewardAPY = Number(assetStats.defiSpringSupplyApr?.value || "0") / 1e18;
92678
92696
  const isSupported = this.tokenMarketData.isAPYSupported(asset);
92679
92697
  apy = baseAPY + rewardAPY;
@@ -92689,7 +92707,10 @@ spurious results.`);
92689
92707
  this.setCache(CACHE_KEY, result2, 3e5);
92690
92708
  return result2;
92691
92709
  } catch (error2) {
92692
- logger2.error(`VesuMultiplyAdapter: Error getting APY for ${supportedPosition.asset.symbol}:`, error2);
92710
+ logger2.error(
92711
+ `VesuMultiplyAdapter: Error getting APY for ${supportedPosition.asset.symbol}:`,
92712
+ error2
92713
+ );
92693
92714
  throw error2;
92694
92715
  }
92695
92716
  }
@@ -92702,12 +92723,16 @@ spurious results.`);
92702
92723
  try {
92703
92724
  this.vesuAdapter.networkConfig = this.config.networkConfig;
92704
92725
  this.vesuAdapter.pricer = this.config.pricer;
92705
- const positions = await this.vesuAdapter.getPositions(this.config.networkConfig);
92726
+ const positions = await this.vesuAdapter.getPositions(
92727
+ this.config.networkConfig
92728
+ );
92706
92729
  let position = positions.find(
92707
92730
  (p) => p.token.address.eq(supportedPosition.asset.address)
92708
92731
  );
92709
92732
  if (!position) {
92710
- logger2.warn(`VesuMultiplyAdapter: Position not found for token ${supportedPosition.asset.symbol}`);
92733
+ logger2.warn(
92734
+ `VesuMultiplyAdapter: Position not found for token ${supportedPosition.asset.symbol}`
92735
+ );
92711
92736
  return {
92712
92737
  amount: new Web3Number("0", supportedPosition.asset.decimals),
92713
92738
  remarks: "Position not found"
@@ -92720,12 +92745,18 @@ spurious results.`);
92720
92745
  this.setCache(CACHE_KEY, position, 6e4);
92721
92746
  return position;
92722
92747
  } catch (error2) {
92723
- logger2.error(`VesuMultiplyAdapter: Error getting position for ${supportedPosition.asset.symbol}:`, error2);
92748
+ logger2.error(
92749
+ `VesuMultiplyAdapter: Error getting position for ${supportedPosition.asset.symbol}:`,
92750
+ error2
92751
+ );
92724
92752
  throw error2;
92725
92753
  }
92726
92754
  }
92727
92755
  async maxBorrowableAPY() {
92728
- const collateralAPY = await this.getAPY({ asset: this.config.collateral, isDebt: false });
92756
+ const collateralAPY = await this.getAPY({
92757
+ asset: this.config.collateral,
92758
+ isDebt: false
92759
+ });
92729
92760
  const apy = collateralAPY.apy * 0.8;
92730
92761
  return apy;
92731
92762
  }
@@ -92735,9 +92766,15 @@ spurious results.`);
92735
92766
  try {
92736
92767
  this.vesuAdapter.networkConfig = this.config.networkConfig;
92737
92768
  this.vesuAdapter.pricer = this.config.pricer;
92738
- const positions = await this.vesuAdapter.getPositions(this.config.networkConfig);
92739
- const collateralPosition = positions.find((p) => p.token.address.eq(collateral.address));
92740
- const debtPosition = positions.find((p) => p.token.address.eq(debt.address));
92769
+ const positions = await this.vesuAdapter.getPositions(
92770
+ this.config.networkConfig
92771
+ );
92772
+ const collateralPosition = positions.find(
92773
+ (p) => p.token.address.eq(collateral.address)
92774
+ );
92775
+ const debtPosition = positions.find(
92776
+ (p) => p.token.address.eq(debt.address)
92777
+ );
92741
92778
  if (!collateralPosition || !debtPosition) {
92742
92779
  throw new Error("Could not find current positions");
92743
92780
  }
@@ -92747,13 +92784,23 @@ spurious results.`);
92747
92784
  debt,
92748
92785
  maxBorrowableAPY
92749
92786
  );
92750
- logger2.verbose(`VesuMultiplyAdapter: Max borrowable: ${maxBorrowable.toNumber()}`);
92751
- const debtCap = await this.vesuAdapter.getDebtCap(this.config.networkConfig);
92787
+ logger2.verbose(
92788
+ `VesuMultiplyAdapter: Max borrowable: ${maxBorrowable.toNumber()}`
92789
+ );
92790
+ const debtCap = await this.vesuAdapter.getDebtCap(
92791
+ this.config.networkConfig
92792
+ );
92752
92793
  logger2.verbose(`VesuMultiplyAdapter: Debt cap: ${debtCap.toNumber()}`);
92753
92794
  const actualMaxBorrowable = maxBorrowable.minimum(debtCap);
92754
- logger2.verbose(`VesuMultiplyAdapter: Actual max borrowable: ${actualMaxBorrowable.toNumber()}`);
92755
- const maxLTV = await this.vesuAdapter.getLTVConfig(this.config.networkConfig);
92756
- const collateralPrice = await this.config.pricer.getPrice(collateral.symbol);
92795
+ logger2.verbose(
92796
+ `VesuMultiplyAdapter: Actual max borrowable: ${actualMaxBorrowable.toNumber()}`
92797
+ );
92798
+ const maxLTV = await this.vesuAdapter.getLTVConfig(
92799
+ this.config.networkConfig
92800
+ );
92801
+ const collateralPrice = await this.config.pricer.getPrice(
92802
+ collateral.symbol
92803
+ );
92757
92804
  if (collateralPrice.price === 0) {
92758
92805
  throw new Error("Collateral price is 0");
92759
92806
  }
@@ -92771,14 +92818,25 @@ spurious results.`);
92771
92818
  );
92772
92819
  const maxDepositAmount = amount ? amount.minimum(maxCollateralFromDebt) : maxCollateralFromDebt;
92773
92820
  const usdValue = await this.getUSDValue(collateral, maxDepositAmount);
92774
- logger2.verbose(`VesuMultiplyAdapter: Max deposit::USD value: ${usdValue}, amount: ${maxDepositAmount.toNumber()}`);
92775
- const apys = await Promise.all([this.getAPY({ asset: collateral, isDebt: false }), this.getAPY({ asset: debt, isDebt: true })]);
92776
- logger2.verbose(`VesuMultiplyAdapter: Apys: ${apys[0].apy}, ${apys[1].apy}`);
92821
+ logger2.verbose(
92822
+ `VesuMultiplyAdapter: Max deposit::USD value: ${usdValue}, amount: ${maxDepositAmount.toNumber()}`
92823
+ );
92824
+ const apys = await Promise.all([
92825
+ this.getAPY({ asset: collateral, isDebt: false }),
92826
+ this.getAPY({ asset: debt, isDebt: true })
92827
+ ]);
92828
+ logger2.verbose(
92829
+ `VesuMultiplyAdapter: Apys: ${apys[0].apy}, ${apys[1].apy}`
92830
+ );
92777
92831
  const borrowAmountUSD = actualMaxBorrowable.multipliedBy(debtPrice.price);
92778
- logger2.verbose(`VesuMultiplyAdapter: Borrow amount: ${actualMaxBorrowable.toNumber()}, borrow amount USD: ${borrowAmountUSD.toNumber()}`);
92832
+ logger2.verbose(
92833
+ `VesuMultiplyAdapter: Borrow amount: ${actualMaxBorrowable.toNumber()}, borrow amount USD: ${borrowAmountUSD.toNumber()}`
92834
+ );
92779
92835
  const netCollateralUSD = usdValue + borrowAmountUSD.toNumber();
92780
92836
  const netAPY = (apys[0].apy * netCollateralUSD + apys[1].apy * borrowAmountUSD.toNumber()) / usdValue;
92781
- logger2.verbose(`VesuMultiplyAdapter: Max deposit amount: ${maxDepositAmount.toNumber()}, netAPY: ${netAPY}`);
92837
+ logger2.verbose(
92838
+ `VesuMultiplyAdapter: Max deposit amount: ${maxDepositAmount.toNumber()}, netAPY: ${netAPY}`
92839
+ );
92782
92840
  return {
92783
92841
  tokenInfo: collateral,
92784
92842
  amount: maxDepositAmount,
@@ -92791,7 +92849,10 @@ spurious results.`);
92791
92849
  protocol: this.protocol
92792
92850
  };
92793
92851
  } catch (error2) {
92794
- logger2.error(`VesuMultiplyAdapter: Error calculating max deposit:`, error2);
92852
+ logger2.error(
92853
+ `VesuMultiplyAdapter: Error calculating max deposit:`,
92854
+ error2
92855
+ );
92795
92856
  throw error2;
92796
92857
  }
92797
92858
  }
@@ -92801,9 +92862,15 @@ spurious results.`);
92801
92862
  try {
92802
92863
  this.vesuAdapter.networkConfig = this.config.networkConfig;
92803
92864
  this.vesuAdapter.pricer = this.config.pricer;
92804
- const positions = await this.vesuAdapter.getPositions(this.config.networkConfig);
92805
- const collateralPosition = positions.find((p) => p.token.address.eq(collateral.address));
92806
- const debtPosition = positions.find((p) => p.token.address.eq(this.config.debt.address));
92865
+ const positions = await this.vesuAdapter.getPositions(
92866
+ this.config.networkConfig
92867
+ );
92868
+ const collateralPosition = positions.find(
92869
+ (p) => p.token.address.eq(collateral.address)
92870
+ );
92871
+ const debtPosition = positions.find(
92872
+ (p) => p.token.address.eq(this.config.debt.address)
92873
+ );
92807
92874
  if (!collateralPosition || !debtPosition) {
92808
92875
  throw new Error("Could not find current positions");
92809
92876
  }
@@ -92813,11 +92880,20 @@ spurious results.`);
92813
92880
  const result2 = maxWithdrawable.greaterThan(0) ? maxWithdrawable : new Web3Number("0", collateral.decimals);
92814
92881
  const usdValue = await this.getUSDValue(collateral, result2);
92815
92882
  const debtUSD = debtPosition.usdValue;
92816
- logger2.verbose(`VesuMultiplyAdapter: Debt USD: ${debtUSD}, collateral USD: ${usdValue}`);
92817
- const apys = await Promise.all([this.getAPY({ asset: collateral, isDebt: false }), this.getAPY({ asset: debt, isDebt: true })]);
92818
- logger2.verbose(`VesuMultiplyAdapter: Apys: ${apys[0].apy}, ${apys[1].apy}`);
92883
+ logger2.verbose(
92884
+ `VesuMultiplyAdapter: Debt USD: ${debtUSD}, collateral USD: ${usdValue}`
92885
+ );
92886
+ const apys = await Promise.all([
92887
+ this.getAPY({ asset: collateral, isDebt: false }),
92888
+ this.getAPY({ asset: debt, isDebt: true })
92889
+ ]);
92890
+ logger2.verbose(
92891
+ `VesuMultiplyAdapter: Apys: ${apys[0].apy}, ${apys[1].apy}`
92892
+ );
92819
92893
  const netAPY = usdValue - debtUSD > 0 ? (apys[0].apy * usdValue + apys[1].apy * debtUSD) / (usdValue - debtUSD) : 0;
92820
- logger2.verbose(`VesuMultiplyAdapter: Max withdraw amount: ${result2.toNumber()}, netAPY: ${netAPY}`);
92894
+ logger2.verbose(
92895
+ `VesuMultiplyAdapter: Max withdraw amount: ${result2.toNumber()}, netAPY: ${netAPY}`
92896
+ );
92821
92897
  return {
92822
92898
  tokenInfo: collateral,
92823
92899
  amount: result2,
@@ -92830,14 +92906,19 @@ spurious results.`);
92830
92906
  protocol: this.protocol
92831
92907
  };
92832
92908
  } catch (error2) {
92833
- logger2.error(`VesuMultiplyAdapter: Error calculating max withdraw:`, error2);
92909
+ logger2.error(
92910
+ `VesuMultiplyAdapter: Error calculating max withdraw:`,
92911
+ error2
92912
+ );
92834
92913
  throw error2;
92835
92914
  }
92836
92915
  }
92837
92916
  _getDepositLeaf() {
92838
92917
  const collateral = this.config.collateral;
92839
92918
  const debt = this.config.debt;
92840
- const { addr: vesuSingleton, isV2 } = getVesuSingletonAddress(this.config.poolId);
92919
+ const { addr: vesuSingleton, isV2 } = getVesuSingletonAddress(
92920
+ this.config.poolId
92921
+ );
92841
92922
  const vesuMultiply = isV2 ? this.vesuAdapter.VESU_MULTIPLY : this.vesuAdapter.VESU_MULTIPLY_V1;
92842
92923
  return [
92843
92924
  // Approval step for collateral
@@ -92901,7 +92982,9 @@ spurious results.`);
92901
92982
  ];
92902
92983
  }
92903
92984
  _getWithdrawLeaf() {
92904
- const { addr: vesuSingleton, isV2 } = getVesuSingletonAddress(this.config.poolId);
92985
+ const { addr: vesuSingleton, isV2 } = getVesuSingletonAddress(
92986
+ this.config.poolId
92987
+ );
92905
92988
  const vesuMultiply = isV2 ? this.vesuAdapter.VESU_MULTIPLY : this.vesuAdapter.VESU_MULTIPLY_V1;
92906
92989
  const collateral = this.config.collateral;
92907
92990
  const debt = this.config.debt;
@@ -92958,33 +93041,51 @@ spurious results.`);
92958
93041
  const leafConfigs = this._getDepositLeaf();
92959
93042
  const leaves = leafConfigs.map((config3) => {
92960
93043
  const { target, method, packedArguments, sanitizer, id } = config3;
92961
- const leaf = this.constructSimpleLeafData({
92962
- id,
92963
- target,
92964
- method,
92965
- packedArguments
92966
- }, sanitizer);
93044
+ const leaf = this.constructSimpleLeafData(
93045
+ {
93046
+ id,
93047
+ target,
93048
+ method,
93049
+ packedArguments
93050
+ },
93051
+ sanitizer
93052
+ );
92967
93053
  return leaf;
92968
93054
  });
92969
- return { leaves, callConstructor: this.getDepositCall.bind(this) };
93055
+ return {
93056
+ leaves,
93057
+ callConstructor: this.getDepositCall.bind(
93058
+ this
93059
+ )
93060
+ };
92970
93061
  }
92971
93062
  getWithdrawAdapter() {
92972
93063
  const leafConfigs = this._getWithdrawLeaf();
92973
93064
  const leaves = leafConfigs.map((config3) => {
92974
93065
  const { target, method, packedArguments, sanitizer, id } = config3;
92975
- const leaf = this.constructSimpleLeafData({
92976
- id,
92977
- target,
92978
- method,
92979
- packedArguments
92980
- }, sanitizer);
93066
+ const leaf = this.constructSimpleLeafData(
93067
+ {
93068
+ id,
93069
+ target,
93070
+ method,
93071
+ packedArguments
93072
+ },
93073
+ sanitizer
93074
+ );
92981
93075
  return leaf;
92982
93076
  });
92983
- return { leaves, callConstructor: this.getWithdrawCall.bind(this) };
93077
+ return {
93078
+ leaves,
93079
+ callConstructor: this.getWithdrawCall.bind(
93080
+ this
93081
+ )
93082
+ };
92984
93083
  }
92985
93084
  async getDepositCall(params) {
92986
93085
  const collateral = this.config.collateral;
92987
- const { addr: vesuSingleton, isV2 } = getVesuSingletonAddress(this.config.poolId);
93086
+ const { addr: vesuSingleton, isV2 } = getVesuSingletonAddress(
93087
+ this.config.poolId
93088
+ );
92988
93089
  const vesuMultiply = isV2 ? this.vesuAdapter.VESU_MULTIPLY : this.vesuAdapter.VESU_MULTIPLY_V1;
92989
93090
  const uint256MarginAmount = uint256_exports.bnToUint256(params.amount.toWei());
92990
93091
  return [
@@ -93056,7 +93157,9 @@ spurious results.`);
93056
93157
  ];
93057
93158
  }
93058
93159
  async getWithdrawCall(params) {
93059
- const { addr: vesuSingleton, isV2 } = getVesuSingletonAddress(this.config.poolId);
93160
+ const { addr: vesuSingleton, isV2 } = getVesuSingletonAddress(
93161
+ this.config.poolId
93162
+ );
93060
93163
  const vesuMultiply = isV2 ? this.vesuAdapter.VESU_MULTIPLY : this.vesuAdapter.VESU_MULTIPLY_V1;
93061
93164
  return [
93062
93165
  // Switch delegation on
@@ -93111,7 +93214,11 @@ spurious results.`);
93111
93214
  ];
93112
93215
  }
93113
93216
  async getMultiplyCallCalldata(params, isDeposit) {
93114
- logger2.verbose(`${_VesuMultiplyAdapter.name}::getMultiplyCallCalldata params: ${JSON.stringify(params)}, isDeposit: ${isDeposit}, collateral: ${this.config.collateral.symbol}, debt: ${this.config.debt.symbol}`);
93217
+ logger2.verbose(
93218
+ `${_VesuMultiplyAdapter.name}::getMultiplyCallCalldata params: ${JSON.stringify(
93219
+ params
93220
+ )}, isDeposit: ${isDeposit}, collateral: ${this.config.collateral.symbol}, debt: ${this.config.debt.symbol}`
93221
+ );
93115
93222
  const { isV2 } = getVesuSingletonAddress(this.config.poolId);
93116
93223
  const vesuMultiply = isV2 ? this.vesuAdapter.VESU_MULTIPLY : this.vesuAdapter.VESU_MULTIPLY_V1;
93117
93224
  const multiplyContract = new Contract({
@@ -93121,42 +93228,83 @@ spurious results.`);
93121
93228
  });
93122
93229
  let leverSwap = [];
93123
93230
  let leverSwapLimitAmount = Web3Number.fromWei(0, this.config.debt.decimals);
93124
- const existingPositions = await this.vesuAdapter.getPositions(this.config.networkConfig);
93125
- const collateralisation = await this.vesuAdapter.getCollateralization(this.config.networkConfig);
93231
+ const existingPositions = await this.vesuAdapter.getPositions(
93232
+ this.config.networkConfig
93233
+ );
93234
+ const collateralisation = await this.vesuAdapter.getCollateralization(
93235
+ this.config.networkConfig
93236
+ );
93126
93237
  const existingCollateralInfo = existingPositions[0];
93127
93238
  const existingDebtInfo = existingPositions[1];
93128
93239
  const isDexPriceRequired = existingDebtInfo.token.symbol !== "USDC";
93129
- logger2.debug(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
93130
- existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
93240
+ logger2.debug(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(
93241
+ existingCollateralInfo
93242
+ )},
93243
+ existingDebtInfo: ${JSON.stringify(
93244
+ existingDebtInfo
93245
+ )}, collateralisation: ${JSON.stringify(collateralisation)}`);
93131
93246
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : (await this.config.pricer.getPrice(this.config.collateral.symbol)).price;
93132
93247
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : (await this.config.pricer.getPrice(this.config.debt.symbol)).price;
93133
- logger2.debug(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
93134
- const legLTV = await this.vesuAdapter.getLTVConfig(this.config.networkConfig);
93135
- const ekuboQuoter = new EkuboQuoter(this.config.networkConfig, this.config.pricer);
93136
- const dexPrice = isDexPriceRequired ? await ekuboQuoter.getDexPrice(this.config.collateral, this.config.debt, this.config.quoteAmountToFetchPrice) : 1;
93137
- logger2.verbose(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall dexPrice: ${dexPrice}, ltv: ${legLTV}`);
93248
+ logger2.debug(
93249
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
93250
+ );
93251
+ const legLTV = await this.vesuAdapter.getLTVConfig(
93252
+ this.config.networkConfig
93253
+ );
93254
+ const ekuboQuoter = new EkuboQuoter(
93255
+ this.config.networkConfig,
93256
+ this.config.pricer
93257
+ );
93258
+ const dexPrice = isDexPriceRequired ? await ekuboQuoter.getDexPrice(
93259
+ this.config.collateral,
93260
+ this.config.debt,
93261
+ this.config.quoteAmountToFetchPrice
93262
+ ) : 1;
93263
+ logger2.verbose(
93264
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall dexPrice: ${dexPrice}, ltv: ${legLTV}`
93265
+ );
93138
93266
  const addedCollateral = params.amount.multipliedBy(isDeposit ? 1 : -1);
93139
- logger2.verbose(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
93267
+ logger2.verbose(
93268
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`
93269
+ );
93140
93270
  const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
93141
- logger2.verbose(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`);
93271
+ logger2.verbose(
93272
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`
93273
+ );
93142
93274
  const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.config.targetHealthFactor);
93143
- logger2.verbose(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`);
93275
+ logger2.verbose(
93276
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`
93277
+ );
93144
93278
  const denominatorPart = this.config.targetHealthFactor - legLTV / dexPrice;
93145
- logger2.verbose(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`);
93279
+ logger2.verbose(
93280
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`
93281
+ );
93146
93282
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
93147
- logger2.verbose(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
93148
- logger2.debug(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
93149
- let debtAmount = new Web3Number(x_debt_usd.dividedBy(debtPrice).toFixed(this.config.debt.decimals), this.config.debt.decimals);
93283
+ logger2.verbose(
93284
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`
93285
+ );
93286
+ logger2.debug(
93287
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`
93288
+ );
93289
+ let debtAmount = new Web3Number(
93290
+ x_debt_usd.dividedBy(debtPrice).toFixed(this.config.debt.decimals),
93291
+ this.config.debt.decimals
93292
+ );
93150
93293
  const marginAmount = addedCollateral;
93151
93294
  const collateralToken = this.config.collateral;
93152
93295
  const debtToken = this.config.debt;
93153
- const debtAmountInCollateralUnits = new Web3Number(debtAmount.multipliedBy(debtPrice).dividedBy(collateralPrice).multipliedBy(10 ** collateralToken.decimals).toFixed(0), collateralToken.decimals);
93296
+ const debtAmountInCollateralUnits = new Web3Number(
93297
+ debtAmount.multipliedBy(debtPrice).dividedBy(collateralPrice).multipliedBy(10 ** collateralToken.decimals).toFixed(0),
93298
+ collateralToken.decimals
93299
+ );
93154
93300
  const isIncrease = debtAmount.greaterThanOrEqualTo(0);
93155
93301
  if (isIncrease && debtAmount.lessThan(0)) {
93156
93302
  } else if (!isIncrease && debtAmount.greaterThan(0)) {
93157
93303
  debtAmount = Web3Number.fromWei(0, this.config.debt.decimals);
93158
93304
  }
93159
- logger2.verbose(`${_VesuMultiplyAdapter.name}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
93305
+ logger2.verbose(
93306
+ `${_VesuMultiplyAdapter.name}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`
93307
+ );
93160
93308
  if (!debtAmount.isZero()) {
93161
93309
  try {
93162
93310
  const swapQuote = await ekuboQuoter.getQuote(
@@ -93166,26 +93314,49 @@ spurious results.`);
93166
93314
  // negative for exact amount out
93167
93315
  );
93168
93316
  if (swapQuote.price_impact < 0.01) {
93169
- leverSwap = ekuboQuoter.getVesuMultiplyQuote(swapQuote, debtToken, collateralToken);
93317
+ leverSwap = debtAmount.isNegative() ? ekuboQuoter.getVesuMultiplyQuote(
93318
+ swapQuote,
93319
+ collateralToken,
93320
+ debtToken
93321
+ ) : ekuboQuoter.getVesuMultiplyQuote(
93322
+ swapQuote,
93323
+ debtToken,
93324
+ collateralToken
93325
+ );
93170
93326
  const MAX_SLIPPAGE = 2e-3;
93171
93327
  if (debtAmount.greaterThan(0)) {
93172
93328
  leverSwapLimitAmount = debtAmount.multipliedBy(1 + MAX_SLIPPAGE);
93173
93329
  } else if (debtAmount.lessThan(0)) {
93174
93330
  leverSwapLimitAmount = debtAmount.abs().multipliedBy(1 - MAX_SLIPPAGE);
93175
93331
  } else {
93176
- leverSwapLimitAmount = Web3Number.fromWei(0, this.config.debt.decimals);
93332
+ leverSwapLimitAmount = Web3Number.fromWei(
93333
+ 0,
93334
+ this.config.debt.decimals
93335
+ );
93177
93336
  }
93178
93337
  await new Promise((resolve) => setTimeout(resolve, 1e4));
93179
93338
  } else {
93180
- throw new Error(`VesuMultiplyAdapter: Price impact too high (${swapQuote.price_impact}), skipping swap`);
93339
+ throw new Error(
93340
+ `VesuMultiplyAdapter: Price impact too high (${swapQuote.price_impact}), skipping swap`
93341
+ );
93181
93342
  }
93182
93343
  } catch (error2) {
93183
- throw new Error(`VesuMultiplyAdapter: Failed to get swap quote: ${error2}`);
93344
+ throw new Error(
93345
+ `VesuMultiplyAdapter: Failed to get swap quote: ${error2}`
93346
+ );
93184
93347
  }
93185
93348
  }
93186
- const multiplyParams = await this.getLeverParams(isIncrease, params, leverSwap, leverSwapLimitAmount);
93349
+ const multiplyParams = await this.getLeverParams(
93350
+ isIncrease,
93351
+ params,
93352
+ leverSwap,
93353
+ leverSwapLimitAmount
93354
+ );
93187
93355
  const call = multiplyContract.populate("modify_lever", {
93188
- modify_lever_params: this.formatMultiplyParams(isIncrease, multiplyParams)
93356
+ modify_lever_params: this.formatMultiplyParams(
93357
+ isIncrease,
93358
+ multiplyParams
93359
+ )
93189
93360
  });
93190
93361
  return call.calldata;
93191
93362
  }
@@ -93199,7 +93370,10 @@ spurious results.`);
93199
93370
  add_margin: params.amount,
93200
93371
  // multiplied by collateral decimals in format
93201
93372
  margin_swap: [],
93202
- margin_swap_limit_amount: Web3Number.fromWei(0, this.config.collateral.decimals),
93373
+ margin_swap_limit_amount: Web3Number.fromWei(
93374
+ 0,
93375
+ this.config.collateral.decimals
93376
+ ),
93203
93377
  lever_swap: leverSwap,
93204
93378
  lever_swap_limit_amount: leverSwapLimitAmount
93205
93379
  } : {
@@ -93213,7 +93387,10 @@ spurious results.`);
93213
93387
  lever_swap_limit_amount: leverSwapLimitAmount,
93214
93388
  lever_swap_weights: [],
93215
93389
  withdraw_swap: [],
93216
- withdraw_swap_limit_amount: Web3Number.fromWei(0, this.config.collateral.decimals),
93390
+ withdraw_swap_limit_amount: Web3Number.fromWei(
93391
+ 0,
93392
+ this.config.collateral.decimals
93393
+ ),
93217
93394
  withdraw_swap_weights: [],
93218
93395
  close_position: false
93219
93396
  };
@@ -93229,12 +93406,16 @@ spurious results.`);
93229
93406
  });
93230
93407
  let leverSwap = [];
93231
93408
  let leverSwapLimitAmount = Web3Number.fromWei(0, this.config.debt.decimals);
93232
- const existingPositions = await this.vesuAdapter.getPositions(this.config.networkConfig);
93409
+ const existingPositions = await this.vesuAdapter.getPositions(
93410
+ this.config.networkConfig
93411
+ );
93233
93412
  const existingCollateralInfo = existingPositions[0];
93234
93413
  const existingDebtInfo = existingPositions[1];
93235
93414
  const collateralToken = this.config.collateral;
93236
93415
  const debtToken = this.config.debt;
93237
- const collateralPrice = await this.config.pricer.getPrice(collateralToken.symbol);
93416
+ const collateralPrice = await this.config.pricer.getPrice(
93417
+ collateralToken.symbol
93418
+ );
93238
93419
  const debtPrice = await this.config.pricer.getPrice(debtToken.symbol);
93239
93420
  const { deltadebtAmountUnits: debtAmountToRepay } = calculateDebtReductionAmountForWithdrawal(
93240
93421
  existingDebtInfo.amount,
@@ -93248,8 +93429,14 @@ spurious results.`);
93248
93429
  if (!debtAmountToRepay) {
93249
93430
  throw new Error("error calculating debt amount to repay");
93250
93431
  }
93251
- const ekuboQuoter = new EkuboQuoter(this.config.networkConfig, this.config.pricer);
93252
- const debtInDebtUnits = new Web3Number(debtAmountToRepay, debtToken.decimals).dividedBy(debtPrice.price).multipliedBy(10 ** debtToken.decimals);
93432
+ const ekuboQuoter = new EkuboQuoter(
93433
+ this.config.networkConfig,
93434
+ this.config.pricer
93435
+ );
93436
+ const debtInDebtUnits = new Web3Number(
93437
+ debtAmountToRepay,
93438
+ debtToken.decimals
93439
+ ).dividedBy(debtPrice.price).multipliedBy(10 ** debtToken.decimals);
93253
93440
  const swapQuote = await ekuboQuoter.getQuote(
93254
93441
  debtToken.address.address,
93255
93442
  collateralToken.address.address,
@@ -93257,12 +93444,23 @@ spurious results.`);
93257
93444
  );
93258
93445
  const MAX_SLIPPAGE = 2e-3;
93259
93446
  if (swapQuote.price_impact < 25e-4) {
93260
- leverSwap = ekuboQuoter.getVesuMultiplyQuote(swapQuote, collateralToken, debtToken);
93447
+ leverSwap = ekuboQuoter.getVesuMultiplyQuote(
93448
+ swapQuote,
93449
+ collateralToken,
93450
+ debtToken
93451
+ );
93261
93452
  } else {
93262
- logger2.error(`VesuMultiplyAdapter: Price impact too high (${swapQuote.price_impact}), skipping swap`);
93453
+ logger2.error(
93454
+ `VesuMultiplyAdapter: Price impact too high (${swapQuote.price_impact}), skipping swap`
93455
+ );
93263
93456
  }
93264
93457
  leverSwapLimitAmount = new Web3Number(debtAmountToRepay, debtToken.decimals).abs().multipliedBy(1 + MAX_SLIPPAGE);
93265
- const multiplyParams = await this.getLeverParams(false, params, leverSwap, leverSwapLimitAmount);
93458
+ const multiplyParams = await this.getLeverParams(
93459
+ false,
93460
+ params,
93461
+ leverSwap,
93462
+ leverSwapLimitAmount
93463
+ );
93266
93464
  const call = multiplyContract.populate("modify_lever", {
93267
93465
  modify_lever_params: this.formatMultiplyParams(false, multiplyParams)
93268
93466
  });
@@ -93272,100 +93470,132 @@ spurious results.`);
93272
93470
  if (isIncrease) {
93273
93471
  const _params2 = params;
93274
93472
  return {
93275
- action: new CairoCustomEnum({ IncreaseLever: {
93276
- pool_id: _params2.pool_id.toBigInt(),
93277
- collateral_asset: _params2.collateral_asset.toBigInt(),
93278
- debt_asset: _params2.debt_asset.toBigInt(),
93279
- user: _params2.user.toBigInt(),
93280
- add_margin: BigInt(_params2.add_margin.toWei()),
93281
- margin_swap: _params2.margin_swap.map((swap) => ({
93473
+ action: new CairoCustomEnum({
93474
+ IncreaseLever: {
93475
+ pool_id: _params2.pool_id.toBigInt(),
93476
+ collateral_asset: _params2.collateral_asset.toBigInt(),
93477
+ debt_asset: _params2.debt_asset.toBigInt(),
93478
+ user: _params2.user.toBigInt(),
93479
+ add_margin: BigInt(_params2.add_margin.toWei()),
93480
+ margin_swap: _params2.margin_swap.map((swap) => ({
93481
+ route: swap.route.map((route) => ({
93482
+ pool_key: {
93483
+ token0: route.pool_key.token0.toBigInt(),
93484
+ token1: route.pool_key.token1.toBigInt(),
93485
+ fee: route.pool_key.fee,
93486
+ tick_spacing: route.pool_key.tick_spacing,
93487
+ extension: BigInt(
93488
+ num_exports.hexToDecimalString(route.pool_key.extension)
93489
+ )
93490
+ },
93491
+ sqrt_ratio_limit: uint256_exports.bnToUint256(
93492
+ route.sqrt_ratio_limit.toWei()
93493
+ ),
93494
+ skip_ahead: BigInt(100)
93495
+ })),
93496
+ token_amount: {
93497
+ token: swap.token_amount.token.toBigInt(),
93498
+ amount: swap.token_amount.amount.toI129()
93499
+ }
93500
+ })),
93501
+ margin_swap_limit_amount: BigInt(
93502
+ _params2.margin_swap_limit_amount.toWei()
93503
+ ),
93504
+ lever_swap: _params2.lever_swap.map((swap) => ({
93505
+ route: swap.route.map((route) => ({
93506
+ pool_key: {
93507
+ token0: route.pool_key.token0.toBigInt(),
93508
+ token1: route.pool_key.token1.toBigInt(),
93509
+ fee: route.pool_key.fee,
93510
+ tick_spacing: route.pool_key.tick_spacing,
93511
+ extension: BigInt(
93512
+ num_exports.hexToDecimalString(route.pool_key.extension)
93513
+ )
93514
+ },
93515
+ sqrt_ratio_limit: uint256_exports.bnToUint256(
93516
+ route.sqrt_ratio_limit.toWei()
93517
+ ),
93518
+ skip_ahead: BigInt(0)
93519
+ })),
93520
+ token_amount: {
93521
+ token: swap.token_amount.token.toBigInt(),
93522
+ amount: swap.token_amount.amount.toI129()
93523
+ }
93524
+ })),
93525
+ lever_swap_limit_amount: BigInt(
93526
+ _params2.lever_swap_limit_amount.toWei()
93527
+ )
93528
+ }
93529
+ })
93530
+ };
93531
+ }
93532
+ const _params = params;
93533
+ return {
93534
+ action: new CairoCustomEnum({
93535
+ DecreaseLever: {
93536
+ pool_id: _params.pool_id.toBigInt(),
93537
+ collateral_asset: _params.collateral_asset.toBigInt(),
93538
+ debt_asset: _params.debt_asset.toBigInt(),
93539
+ user: _params.user.toBigInt(),
93540
+ sub_margin: BigInt(_params.sub_margin.toWei()),
93541
+ recipient: _params.recipient.toBigInt(),
93542
+ lever_swap: _params.lever_swap.map((swap) => ({
93282
93543
  route: swap.route.map((route) => ({
93283
93544
  pool_key: {
93284
93545
  token0: route.pool_key.token0.toBigInt(),
93285
93546
  token1: route.pool_key.token1.toBigInt(),
93286
93547
  fee: route.pool_key.fee,
93287
93548
  tick_spacing: route.pool_key.tick_spacing,
93288
- extension: BigInt(num_exports.hexToDecimalString(route.pool_key.extension))
93549
+ extension: ContractAddr.from(
93550
+ route.pool_key.extension
93551
+ ).toBigInt()
93289
93552
  },
93290
- sqrt_ratio_limit: uint256_exports.bnToUint256(route.sqrt_ratio_limit.toWei()),
93291
- skip_ahead: BigInt(100)
93553
+ sqrt_ratio_limit: uint256_exports.bnToUint256(
93554
+ route.sqrt_ratio_limit.toWei()
93555
+ ),
93556
+ skip_ahead: BigInt(route.skip_ahead.toWei())
93292
93557
  })),
93293
93558
  token_amount: {
93294
93559
  token: swap.token_amount.token.toBigInt(),
93295
93560
  amount: swap.token_amount.amount.toI129()
93296
93561
  }
93297
93562
  })),
93298
- margin_swap_limit_amount: BigInt(_params2.margin_swap_limit_amount.toWei()),
93299
- lever_swap: _params2.lever_swap.map((swap) => ({
93563
+ lever_swap_limit_amount: BigInt(
93564
+ _params.lever_swap_limit_amount.toWei()
93565
+ ),
93566
+ lever_swap_weights: _params.lever_swap_weights.map(
93567
+ (weight) => BigInt(weight.toWei())
93568
+ ),
93569
+ withdraw_swap: _params.withdraw_swap.map((swap) => ({
93300
93570
  route: swap.route.map((route) => ({
93301
93571
  pool_key: {
93302
93572
  token0: route.pool_key.token0.toBigInt(),
93303
93573
  token1: route.pool_key.token1.toBigInt(),
93304
93574
  fee: route.pool_key.fee,
93305
93575
  tick_spacing: route.pool_key.tick_spacing,
93306
- extension: BigInt(num_exports.hexToDecimalString(route.pool_key.extension))
93576
+ extension: ContractAddr.from(
93577
+ route.pool_key.extension
93578
+ ).toBigInt()
93307
93579
  },
93308
- sqrt_ratio_limit: uint256_exports.bnToUint256(route.sqrt_ratio_limit.toWei()),
93309
- skip_ahead: BigInt(0)
93580
+ sqrt_ratio_limit: uint256_exports.bnToUint256(
93581
+ route.sqrt_ratio_limit.toWei()
93582
+ ),
93583
+ skip_ahead: BigInt(route.skip_ahead.toWei())
93310
93584
  })),
93311
93585
  token_amount: {
93312
93586
  token: swap.token_amount.token.toBigInt(),
93313
93587
  amount: swap.token_amount.amount.toI129()
93314
93588
  }
93315
93589
  })),
93316
- lever_swap_limit_amount: BigInt(_params2.lever_swap_limit_amount.toWei())
93317
- } })
93318
- };
93319
- }
93320
- const _params = params;
93321
- return {
93322
- action: new CairoCustomEnum({ DecreaseLever: {
93323
- pool_id: _params.pool_id.toBigInt(),
93324
- collateral_asset: _params.collateral_asset.toBigInt(),
93325
- debt_asset: _params.debt_asset.toBigInt(),
93326
- user: _params.user.toBigInt(),
93327
- sub_margin: BigInt(_params.sub_margin.toWei()),
93328
- recipient: _params.recipient.toBigInt(),
93329
- lever_swap: _params.lever_swap.map((swap) => ({
93330
- route: swap.route.map((route) => ({
93331
- pool_key: {
93332
- token0: route.pool_key.token0.toBigInt(),
93333
- token1: route.pool_key.token1.toBigInt(),
93334
- fee: route.pool_key.fee,
93335
- tick_spacing: route.pool_key.tick_spacing,
93336
- extension: ContractAddr.from(route.pool_key.extension).toBigInt()
93337
- },
93338
- sqrt_ratio_limit: uint256_exports.bnToUint256(route.sqrt_ratio_limit.toWei()),
93339
- skip_ahead: BigInt(route.skip_ahead.toWei())
93340
- })),
93341
- token_amount: {
93342
- token: swap.token_amount.token.toBigInt(),
93343
- amount: swap.token_amount.amount.toI129()
93344
- }
93345
- })),
93346
- lever_swap_limit_amount: BigInt(_params.lever_swap_limit_amount.toWei()),
93347
- lever_swap_weights: _params.lever_swap_weights.map((weight) => BigInt(weight.toWei())),
93348
- withdraw_swap: _params.withdraw_swap.map((swap) => ({
93349
- route: swap.route.map((route) => ({
93350
- pool_key: {
93351
- token0: route.pool_key.token0.toBigInt(),
93352
- token1: route.pool_key.token1.toBigInt(),
93353
- fee: route.pool_key.fee,
93354
- tick_spacing: route.pool_key.tick_spacing,
93355
- extension: ContractAddr.from(route.pool_key.extension).toBigInt()
93356
- },
93357
- sqrt_ratio_limit: uint256_exports.bnToUint256(route.sqrt_ratio_limit.toWei()),
93358
- skip_ahead: BigInt(route.skip_ahead.toWei())
93359
- })),
93360
- token_amount: {
93361
- token: swap.token_amount.token.toBigInt(),
93362
- amount: swap.token_amount.amount.toI129()
93363
- }
93364
- })),
93365
- withdraw_swap_limit_amount: BigInt(_params.withdraw_swap_limit_amount.toWei()),
93366
- withdraw_swap_weights: _params.withdraw_swap_weights.map((weight) => BigInt(weight.toWei())),
93367
- close_position: _params.close_position
93368
- } })
93590
+ withdraw_swap_limit_amount: BigInt(
93591
+ _params.withdraw_swap_limit_amount.toWei()
93592
+ ),
93593
+ withdraw_swap_weights: _params.withdraw_swap_weights.map(
93594
+ (weight) => BigInt(weight.toWei())
93595
+ ),
93596
+ close_position: _params.close_position
93597
+ }
93598
+ })
93369
93599
  };
93370
93600
  }
93371
93601
  async getHealthFactor() {
@@ -93374,11 +93604,15 @@ spurious results.`);
93374
93604
  }
93375
93605
  async getNetAPY() {
93376
93606
  const positions = await this.getPositions();
93377
- logger2.verbose(`${this.name}::getNetAPY: positions: ${JSON.stringify(positions)}`);
93607
+ logger2.verbose(
93608
+ `${this.name}::getNetAPY: positions: ${JSON.stringify(positions)}`
93609
+ );
93378
93610
  const allZero = positions.every((p) => p.usdValue === 0);
93379
93611
  if (allZero) {
93380
93612
  const collateralUSD = 1e3;
93381
- const maxLTV = await this.vesuAdapter.getLTVConfig(this.config.networkConfig);
93613
+ const maxLTV = await this.vesuAdapter.getLTVConfig(
93614
+ this.config.networkConfig
93615
+ );
93382
93616
  const targetHF = this.config.targetHealthFactor;
93383
93617
  const maxDebt = HealthFactorMath.getMaxDebtAmountOnLooping(
93384
93618
  new Web3Number(collateralUSD, this.config.collateral.decimals),
@@ -93766,6 +94000,7 @@ spurious results.`);
93766
94000
  logger2.error("error initializing client");
93767
94001
  return null;
93768
94002
  }
94003
+ await new Promise((resolve) => setTimeout(resolve, 5e3));
93769
94004
  const orderhistory = await this.getOrderHistory(marketName);
93770
94005
  if (!orderhistory || orderhistory.length === 0) {
93771
94006
  logger2.error(`error getting order: ${orderId}`);
@@ -98141,7 +98376,7 @@ spurious results.`);
98141
98376
  const withdrawalFromExtended = await extendedAdapter.withdrawFromExtended(params.amount);
98142
98377
  if (withdrawalFromExtended) {
98143
98378
  const extendedHoldings2 = await extendedAdapter.getExtendedDepositAmount();
98144
- logger2.info(`extendedHoldings after withdrawal ${extendedHoldings2}`);
98379
+ logger2.info(`extendedHoldings after withdrawal ${extendedHoldings2?.availableForWithdrawal}`);
98145
98380
  await new Promise((resolve) => setTimeout(resolve, 1e4));
98146
98381
  const calls = await this.moveAssetsToVaultAllocator(params.amount, extendedAdapter);
98147
98382
  if (calls.length > 0) {