@strkfarm/sdk 2.0.0-staging.23 → 2.0.0-staging.25

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
@@ -17999,6 +17999,7 @@ var xSTRKSTRK = {
17999
17999
  notARisks: getNoRiskTags(_lstPoolRiskFactors)
18000
18000
  },
18001
18001
  apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
18002
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
18002
18003
  additionalInfo: {
18003
18004
  newBounds: {
18004
18005
  lower: -1,
@@ -18151,6 +18152,7 @@ var createLSTStrategy = (params) => ({
18151
18152
  ),
18152
18153
  Global.getDefaultTokens().find((t) => t.symbol === params.depositToken1Symbol)
18153
18154
  ],
18155
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
18154
18156
  additionalInfo: {
18155
18157
  ...xSTRKSTRK.additionalInfo,
18156
18158
  quoteAsset: Global.getDefaultTokens().find(
@@ -31938,7 +31940,6 @@ function MetaVaultDescription(allowedSources) {
31938
31940
  const containerStyle = {
31939
31941
  maxWidth: "800px",
31940
31942
  margin: "0 auto",
31941
- backgroundColor: "#111",
31942
31943
  color: "#eee",
31943
31944
  fontFamily: "Arial, sans-serif",
31944
31945
  borderRadius: "12px"
@@ -32131,6 +32132,7 @@ var createUniversalStrategy = (params) => ({
32131
32132
  risk: getUniversalRisk(),
32132
32133
  auditUrl: AUDIT_URL3,
32133
32134
  protocols: [Protocols.VESU],
32135
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
32134
32136
  curator: {
32135
32137
  name: "Unwrap Labs",
32136
32138
  logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
@@ -32241,23 +32243,36 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32241
32243
  constructor(config, pricer, metadata) {
32242
32244
  super(config, pricer, metadata);
32243
32245
  this.quoteAmountToFetchPrice = new Web3Number(1, 18);
32244
- const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
32246
+ const STRKToken = Global.getDefaultTokens().find(
32247
+ (token) => token.symbol === "STRK"
32248
+ );
32245
32249
  const underlyingToken = this.getLSTUnderlyingTokenInfo();
32246
32250
  if (underlyingToken.address.eq(STRKToken.address)) {
32247
32251
  this.quoteAmountToFetchPrice = new Web3Number(100, 18);
32248
32252
  } else {
32249
- this.quoteAmountToFetchPrice = new Web3Number(0.01, this.asset().decimals);
32253
+ this.quoteAmountToFetchPrice = new Web3Number(
32254
+ 0.01,
32255
+ this.asset().decimals
32256
+ );
32250
32257
  }
32251
32258
  }
32252
32259
  asset() {
32253
- return this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId).config.collateral;
32260
+ return this.getVesuSameTokenAdapter(
32261
+ this.metadata.additionalInfo.defaultPoolId
32262
+ ).config.collateral;
32254
32263
  }
32255
32264
  getTag() {
32256
32265
  return `${_UniversalLstMultiplierStrategy.name}:${this.metadata.name}`;
32257
32266
  }
32258
32267
  // Vesu adapter with LST and base token match
32259
32268
  getVesuSameTokenAdapter(poolId) {
32260
- const baseAdapter = this.getAdapter(getVesuLegId("vesu_leg1" /* VESU_LEG1 */, this.metadata.additionalInfo.underlyingToken.symbol, poolId.toString()));
32269
+ const baseAdapter = this.getAdapter(
32270
+ getVesuLegId(
32271
+ "vesu_leg1" /* VESU_LEG1 */,
32272
+ this.metadata.additionalInfo.underlyingToken.symbol,
32273
+ poolId.toString()
32274
+ )
32275
+ );
32261
32276
  baseAdapter.networkConfig = this.config;
32262
32277
  baseAdapter.pricer = this.pricer;
32263
32278
  return baseAdapter;
@@ -32300,27 +32315,43 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32300
32315
  lstUnderlyingTokenInfo.address.address,
32301
32316
  this.quoteAmountToFetchPrice
32302
32317
  );
32303
- const outputAmount = Web3Number.fromWei(quote.total_calculated, lstUnderlyingTokenInfo.decimals);
32318
+ const outputAmount = Web3Number.fromWei(
32319
+ quote.total_calculated,
32320
+ lstUnderlyingTokenInfo.decimals
32321
+ );
32304
32322
  const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
32305
32323
  logger.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
32306
32324
  return price;
32307
32325
  }
32308
32326
  async getAvnuSwapMultiplyCall(params) {
32309
- assert(params.isDeposit, "Only deposit is supported in getAvnuSwapMultiplyCall");
32310
- const maxBorrowableAmounts = await this.getMaxBorrowableAmount({ isAPYComputation: false });
32327
+ assert(
32328
+ params.isDeposit,
32329
+ "Only deposit is supported in getAvnuSwapMultiplyCall"
32330
+ );
32331
+ const maxBorrowableAmounts = await this.getMaxBorrowableAmount({
32332
+ isAPYComputation: false
32333
+ });
32311
32334
  const allVesuAdapters = this.getVesuAdapters();
32312
32335
  let remainingAmount = params.leg1DepositAmount;
32313
32336
  const lstExRate = await this.getLSTExchangeRate();
32314
- const baseAssetPrice = await this.pricer.getPrice(this.getLSTUnderlyingTokenInfo().symbol);
32337
+ const baseAssetPrice = await this.pricer.getPrice(
32338
+ this.getLSTUnderlyingTokenInfo().symbol
32339
+ );
32315
32340
  const lstPrice = baseAssetPrice.price * lstExRate;
32316
32341
  for (let i = 0; i < maxBorrowableAmounts.maxBorrowables.length; i++) {
32317
32342
  const maxBorrowable = maxBorrowableAmounts.maxBorrowables[i];
32318
- const vesuAdapter = allVesuAdapters.find((adapter) => adapter.config.debt.address.eq(maxBorrowable.borrowableAsset.address));
32343
+ const vesuAdapter = allVesuAdapters.find(
32344
+ (adapter) => adapter.config.debt.address.eq(maxBorrowable.borrowableAsset.address)
32345
+ );
32319
32346
  if (!vesuAdapter) {
32320
- throw new Error(`${this.getTag()}::getAvnuSwapMultiplyCall: vesuAdapter not found for borrowable asset: ${maxBorrowable.borrowableAsset.symbol}`);
32347
+ throw new Error(
32348
+ `${this.getTag()}::getAvnuSwapMultiplyCall: vesuAdapter not found for borrowable asset: ${maxBorrowable.borrowableAsset.symbol}`
32349
+ );
32321
32350
  }
32322
32351
  const maxLTV = await vesuAdapter.getLTVConfig(this.config);
32323
- const debtPrice = await this.pricer.getPrice(maxBorrowable.borrowableAsset.symbol);
32352
+ const debtPrice = await this.pricer.getPrice(
32353
+ maxBorrowable.borrowableAsset.symbol
32354
+ );
32324
32355
  const maxAmountToDeposit = HealthFactorMath.getMinCollateralRequiredOnLooping(
32325
32356
  maxBorrowable.amount,
32326
32357
  debtPrice.price,
@@ -32330,7 +32361,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32330
32361
  this.asset()
32331
32362
  );
32332
32363
  const amountToDeposit = remainingAmount.minimum(maxAmountToDeposit);
32333
- logger.verbose(`${this.getTag()}::getAvnuSwapMultiplyCall::${vesuAdapter.config.debt.symbol}:: remainingAmount: ${remainingAmount}, amountToDeposit: ${amountToDeposit}, depositAmount: ${amountToDeposit}, maxBorrowable: ${maxBorrowable.amount}`);
32364
+ logger.verbose(
32365
+ `${this.getTag()}::getAvnuSwapMultiplyCall::${vesuAdapter.config.debt.symbol}:: remainingAmount: ${remainingAmount}, amountToDeposit: ${amountToDeposit}, depositAmount: ${amountToDeposit}, maxBorrowable: ${maxBorrowable.amount}`
32366
+ );
32334
32367
  const call = await this._getAvnuDepositSwapLegCall({
32335
32368
  isDeposit: params.isDeposit,
32336
32369
  // adjust decimals of debt asset
@@ -32342,36 +32375,60 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32342
32375
  remainingAmount = remainingAmount.minus(amountToDeposit);
32343
32376
  return { call, vesuAdapter };
32344
32377
  }
32345
- throw new Error(`${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`);
32378
+ throw new Error(
32379
+ `${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`
32380
+ );
32346
32381
  }
32347
32382
  async _getAvnuDepositSwapLegCall(params) {
32348
32383
  const { vesuAdapter } = params;
32349
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`);
32350
- assert(params.isDeposit, "Only deposit is supported in _getAvnuDepositSwapLegCall");
32384
+ logger.verbose(
32385
+ `${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`
32386
+ );
32387
+ assert(
32388
+ params.isDeposit,
32389
+ "Only deposit is supported in _getAvnuDepositSwapLegCall"
32390
+ );
32351
32391
  const legLTV = await vesuAdapter.getLTVConfig(this.config);
32352
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`);
32392
+ logger.verbose(
32393
+ `${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`
32394
+ );
32353
32395
  const existingPositions = await vesuAdapter.getPositions(this.config);
32354
- const collateralisation = await vesuAdapter.getCollateralization(this.config);
32396
+ const collateralisation = await vesuAdapter.getCollateralization(
32397
+ this.config
32398
+ );
32355
32399
  const existingCollateralInfo = existingPositions[0];
32356
32400
  const existingDebtInfo = existingPositions[1];
32357
32401
  logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32358
32402
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32359
32403
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32360
32404
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32361
- logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32405
+ logger.debug(
32406
+ `${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
32407
+ );
32362
32408
  const debtTokenInfo = vesuAdapter.config.debt;
32363
32409
  let newDepositAmount = params.leg1DepositAmount;
32364
- const totalCollateral = existingCollateralInfo.amount.plus(params.leg1DepositAmount);
32365
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`);
32410
+ const totalCollateral = existingCollateralInfo.amount.plus(
32411
+ params.leg1DepositAmount
32412
+ );
32413
+ logger.verbose(
32414
+ `${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`
32415
+ );
32366
32416
  const totalDebtAmount = new Web3Number(
32367
32417
  totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF).toString(),
32368
32418
  debtTokenInfo.decimals
32369
32419
  );
32370
32420
  let debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
32371
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}, initial computed debt: ${debtAmount}`);
32372
- const maxBorrowable = await this.getMaxBorrowableAmountByVesuAdapter(vesuAdapter, false);
32421
+ logger.verbose(
32422
+ `${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}, initial computed debt: ${debtAmount}`
32423
+ );
32424
+ const maxBorrowable = await this.getMaxBorrowableAmountByVesuAdapter(
32425
+ vesuAdapter,
32426
+ false
32427
+ );
32373
32428
  if (debtAmount.gt(0) && maxBorrowable.amount.eq(0)) {
32374
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`);
32429
+ logger.verbose(
32430
+ `${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`
32431
+ );
32375
32432
  return void 0;
32376
32433
  } else if (debtAmount.gt(0) && maxBorrowable.amount.gt(0)) {
32377
32434
  debtAmount = maxBorrowable.amount.minimum(debtAmount);
@@ -32384,16 +32441,24 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32384
32441
  collateralPrice,
32385
32442
  this.asset()
32386
32443
  );
32387
- newDepositAmount = totalCollateralRequired.minus(existingCollateralInfo.amount);
32444
+ newDepositAmount = totalCollateralRequired.minus(
32445
+ existingCollateralInfo.amount
32446
+ );
32388
32447
  if (newDepositAmount.lt(0)) {
32389
- throw new Error(`${this.getTag()}::_getAvnuDepositSwapLegCall newDepositAmount is less than 0, newDepositAmount: ${newDepositAmount}, totalCollateralRequired: ${totalCollateralRequired}, existingCollateralInfo.amount: ${existingCollateralInfo.amount}`);
32448
+ throw new Error(
32449
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newDepositAmount is less than 0, newDepositAmount: ${newDepositAmount}, totalCollateralRequired: ${totalCollateralRequired}, existingCollateralInfo.amount: ${existingCollateralInfo.amount}`
32450
+ );
32390
32451
  }
32391
32452
  if (newDebtUSDValue.toNumber() < 100) {
32392
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newDebtUSDValue is less than 100, skipping`);
32453
+ logger.verbose(
32454
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newDebtUSDValue is less than 100, skipping`
32455
+ );
32393
32456
  return void 0;
32394
32457
  }
32395
32458
  }
32396
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`);
32459
+ logger.verbose(
32460
+ `${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`
32461
+ );
32397
32462
  if (debtAmount.lt(0)) {
32398
32463
  const lstDEXPrice = await this.getLSTDexPrice();
32399
32464
  const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
@@ -32402,7 +32467,10 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32402
32467
  leg1DepositAmount: debtAmountInLST,
32403
32468
  poolId: vesuAdapter.config.poolId
32404
32469
  });
32405
- assert(calls.length == 1, `Expected 1 call for unwind, got ${calls.length}`);
32470
+ assert(
32471
+ calls.length == 1,
32472
+ `Expected 1 call for unwind, got ${calls.length}`
32473
+ );
32406
32474
  return calls[0];
32407
32475
  }
32408
32476
  const STEP0 = "approve_token1" /* APPROVE_TOKEN1 */;
@@ -32410,18 +32478,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32410
32478
  const manageCall0 = manage0Info.callConstructor({
32411
32479
  amount: newDepositAmount
32412
32480
  });
32413
- const STEP1 = getVesuLegId("vesu_leg1" /* VESU_LEG1 */, vesuAdapter.config.debt.symbol, vesuAdapter.config.poolId.toString());
32481
+ const STEP1 = getVesuLegId(
32482
+ "vesu_leg1" /* VESU_LEG1 */,
32483
+ vesuAdapter.config.debt.symbol,
32484
+ vesuAdapter.config.poolId.toString()
32485
+ );
32414
32486
  const manage1Info = this.getProofs(STEP1);
32415
- const manageCall1 = manage1Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
32416
- collateralAmount: newDepositAmount,
32417
- isAddCollateral: params.isDeposit,
32418
- debtAmount,
32419
- isBorrow: params.isDeposit
32420
- }));
32487
+ const manageCall1 = manage1Info.callConstructor(
32488
+ VesuAdapter.getDefaultModifyPositionCallParams({
32489
+ collateralAmount: newDepositAmount,
32490
+ isAddCollateral: params.isDeposit,
32491
+ debtAmount,
32492
+ isBorrow: params.isDeposit
32493
+ })
32494
+ );
32421
32495
  const proofIds = [STEP0, STEP1];
32422
32496
  const manageCalls = [manageCall0, manageCall1];
32423
32497
  if (debtAmount.gt(0)) {
32424
- const STEP2 = getAvnuManageIDs("avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */, vesuAdapter.config.debt.symbol);
32498
+ const STEP2 = getAvnuManageIDs(
32499
+ "avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
32500
+ vesuAdapter.config.debt.symbol
32501
+ );
32425
32502
  const manage2Info = this.getProofs(STEP2);
32426
32503
  const manageCall2 = manage2Info.callConstructor({
32427
32504
  amount: debtAmount
@@ -32437,7 +32514,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32437
32514
  );
32438
32515
  const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
32439
32516
  const minAmountWei = minAmount.toWei();
32440
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`);
32517
+ logger.verbose(
32518
+ `${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`
32519
+ );
32441
32520
  const swapInfo = await avnuModule.getSwapInfo(
32442
32521
  quote,
32443
32522
  this.metadata.additionalInfo.vaultAllocator.address,
@@ -32445,8 +32524,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32445
32524
  this.address.address,
32446
32525
  minAmountWei
32447
32526
  );
32448
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`);
32449
- const STEP3 = getAvnuManageIDs("avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, vesuAdapter.config.debt.symbol);
32527
+ logger.verbose(
32528
+ `${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`
32529
+ );
32530
+ const STEP3 = getAvnuManageIDs(
32531
+ "avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */,
32532
+ vesuAdapter.config.debt.symbol
32533
+ );
32450
32534
  const manage3Info = this.getProofs(STEP3);
32451
32535
  const manageCall3 = manage3Info.callConstructor({
32452
32536
  props: swapInfo
@@ -32456,22 +32540,32 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32456
32540
  manageCalls.push(manageCall2, manageCall3);
32457
32541
  const newCollateral = minAmount.plus(totalCollateral);
32458
32542
  const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
32459
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`);
32543
+ logger.verbose(
32544
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`
32545
+ );
32460
32546
  if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
32461
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`);
32547
+ logger.verbose(
32548
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`
32549
+ );
32462
32550
  const STEP4 = "approve_token1" /* APPROVE_TOKEN1 */;
32463
32551
  const manage4Info = this.getProofs(STEP4);
32464
32552
  const manageCall4 = manage4Info.callConstructor({
32465
32553
  amount: minAmount
32466
32554
  });
32467
- const STEP5 = getVesuLegId("vesu_leg1" /* VESU_LEG1 */, vesuAdapter.config.debt.symbol, vesuAdapter.config.poolId.toString());
32555
+ const STEP5 = getVesuLegId(
32556
+ "vesu_leg1" /* VESU_LEG1 */,
32557
+ vesuAdapter.config.debt.symbol,
32558
+ vesuAdapter.config.poolId.toString()
32559
+ );
32468
32560
  const manage5Info = this.getProofs(STEP5);
32469
- const manageCall5 = manage5Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
32470
- collateralAmount: minAmount,
32471
- isAddCollateral: true,
32472
- debtAmount: Web3Number.fromWei("0", this.asset().decimals),
32473
- isBorrow: params.isDeposit
32474
- }));
32561
+ const manageCall5 = manage5Info.callConstructor(
32562
+ VesuAdapter.getDefaultModifyPositionCallParams({
32563
+ collateralAmount: minAmount,
32564
+ isAddCollateral: true,
32565
+ debtAmount: Web3Number.fromWei("0", this.asset().decimals),
32566
+ isBorrow: params.isDeposit
32567
+ })
32568
+ );
32475
32569
  proofIds.push(STEP4, STEP5);
32476
32570
  manageCalls.push(manageCall4, manageCall5);
32477
32571
  }
@@ -32479,11 +32573,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32479
32573
  const manageCall = this.getManageCall(proofIds, manageCalls);
32480
32574
  return manageCall;
32481
32575
  }
32482
- // todo unwind or not deposit when the yield is bad.
32576
+ // todo unwind or not deposit when the yield is bad.
32483
32577
  async getLSTMultiplierRebalanceCall() {
32484
32578
  let shouldRebalance = false;
32485
32579
  const calls = [];
32486
- const allVesuAdapters = this.getVesuAdapters().filter((vesuAdapter) => vesuAdapter.config.debt.symbol === "LBTC");
32580
+ const allVesuAdapters = this.getVesuAdapters().filter(
32581
+ (vesuAdapter) => vesuAdapter.config.debt.symbol === "LBTC"
32582
+ );
32487
32583
  for (const vesuAdapter of allVesuAdapters) {
32488
32584
  const call = await this._getLSTMultiplierRebalanceCall(vesuAdapter);
32489
32585
  if (call.shouldRebalance && call.manageCall) {
@@ -32495,18 +32591,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32495
32591
  }
32496
32592
  async _getLSTMultiplierRebalanceCall(vesuAdapter) {
32497
32593
  const positions = await vesuAdapter.getPositions(this.config);
32498
- assert(positions.length == 2, "Rebalance call is only supported for 2 positions");
32594
+ assert(
32595
+ positions.length == 2,
32596
+ "Rebalance call is only supported for 2 positions"
32597
+ );
32499
32598
  const existingCollateralInfo = positions[0];
32500
32599
  const existingDebtInfo = positions[1];
32501
32600
  const unusedBalance = await this.getUnusedBalance();
32502
32601
  const healthFactor = await vesuAdapter.getHealthFactor();
32503
- const collateralisation = await vesuAdapter.getCollateralization(this.config);
32602
+ const collateralisation = await vesuAdapter.getCollateralization(
32603
+ this.config
32604
+ );
32504
32605
  logger.debug(`${this.getTag()}::getVesuMultiplyCall::${vesuAdapter.config.debt.symbol} existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32505
32606
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32506
32607
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32507
32608
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32508
- logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32509
- logger.debug(`${this.getTag()}::getVesuMultiplyCall healthFactor: ${healthFactor}`);
32609
+ logger.debug(
32610
+ `${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
32611
+ );
32612
+ logger.debug(
32613
+ `${this.getTag()}::getVesuMultiplyCall healthFactor: ${healthFactor}`
32614
+ );
32510
32615
  const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
32511
32616
  const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
32512
32617
  if (isHFTooLow || isHFTooHigh || 1) {
@@ -32514,7 +32619,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32514
32619
  isDeposit: true,
32515
32620
  leg1DepositAmount: unusedBalance.amount,
32516
32621
  minHF: 1.02,
32517
- // todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
32622
+ // todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
32518
32623
  vesuAdapter
32519
32624
  });
32520
32625
  return { shouldRebalance: true, manageCall };
@@ -32525,29 +32630,44 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32525
32630
  async getVesuAUM(adapter, priceType = "AVNU_PRICE" /* AVNU_PRICE */) {
32526
32631
  const legAUM = await adapter.getPositions(this.config);
32527
32632
  const underlying = this.asset();
32528
- assert(underlying.symbol.startsWith("x"), "Underlying is not an LST of Endur");
32633
+ assert(
32634
+ underlying.symbol.startsWith("x"),
32635
+ "Underlying is not an LST of Endur"
32636
+ );
32529
32637
  let vesuAum = Web3Number.fromWei("0", underlying.decimals);
32530
32638
  let tokenUnderlyingPrice;
32531
32639
  if (priceType === "ENDUR_PRICE" /* ENDUR_PRICE */) {
32532
32640
  tokenUnderlyingPrice = await this.getLSTExchangeRate();
32533
32641
  if (tokenUnderlyingPrice === 0) {
32534
- throw new Error(`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Endur) is 0`);
32642
+ throw new Error(
32643
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Endur) is 0`
32644
+ );
32535
32645
  }
32536
32646
  const avnuRate = await this.getLSTAvnuRate();
32537
32647
  if (avnuRate === 0) {
32538
- throw new Error(`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`);
32648
+ throw new Error(
32649
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
32650
+ );
32539
32651
  }
32540
32652
  const diff = Math.abs(tokenUnderlyingPrice - avnuRate) / tokenUnderlyingPrice;
32541
32653
  if (diff > 0.02) {
32542
- throw new Error(`${this.getTag()}::getVesuAUM: Endur and Avnu prices differ by more than 2% (Endur: ${tokenUnderlyingPrice}, Avnu: ${avnuRate})`);
32654
+ throw new Error(
32655
+ `${this.getTag()}::getVesuAUM: Endur and Avnu prices differ by more than 2% (Endur: ${tokenUnderlyingPrice}, Avnu: ${avnuRate})`
32656
+ );
32543
32657
  }
32544
- logger.verbose(`${this.getTag()} tokenUnderlyingPrice (Endur): ${tokenUnderlyingPrice}, avnuRate: ${avnuRate}, diff: ${diff}`);
32658
+ logger.verbose(
32659
+ `${this.getTag()} tokenUnderlyingPrice (Endur): ${tokenUnderlyingPrice}, avnuRate: ${avnuRate}, diff: ${diff}`
32660
+ );
32545
32661
  } else {
32546
32662
  tokenUnderlyingPrice = await this.getLSTAvnuRate();
32547
32663
  if (tokenUnderlyingPrice === 0) {
32548
- throw new Error(`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`);
32664
+ throw new Error(
32665
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
32666
+ );
32549
32667
  }
32550
- logger.verbose(`${this.getTag()} tokenUnderlyingPrice (Avnu): ${tokenUnderlyingPrice}`);
32668
+ logger.verbose(
32669
+ `${this.getTag()} tokenUnderlyingPrice (Avnu): ${tokenUnderlyingPrice}`
32670
+ );
32551
32671
  }
32552
32672
  if (legAUM[0].token.address.eq(underlying.address)) {
32553
32673
  vesuAum = vesuAum.plus(legAUM[0].amount);
@@ -32559,9 +32679,10 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32559
32679
  } else {
32560
32680
  vesuAum = vesuAum.minus(legAUM[1].amount.dividedBy(tokenUnderlyingPrice));
32561
32681
  }
32562
- ;
32563
32682
  const priceTypeLabel = priceType === "ENDUR_PRICE" /* ENDUR_PRICE */ ? "Endur Price" : "Avnu Price";
32564
- logger.verbose(`${this.getTag()} Vesu AUM (${priceTypeLabel}): ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
32683
+ logger.verbose(
32684
+ `${this.getTag()} Vesu AUM (${priceTypeLabel}): ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`
32685
+ );
32565
32686
  return vesuAum;
32566
32687
  }
32567
32688
  async getTVLUnrealized() {
@@ -32592,11 +32713,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32592
32713
  return minOutputAmount;
32593
32714
  }
32594
32715
  // todo add a function to findout max borrowable amount without fucking yield
32595
- // if the current net yield < LST yield, add a function to calculate how much to unwind.
32716
+ // if the current net yield < LST yield, add a function to calculate how much to unwind.
32596
32717
  /**
32597
32718
  * Uses vesu's multiple call to create leverage on LST
32598
32719
  * Deposit amount is in LST
32599
- * @param params
32720
+ * @param params
32600
32721
  */
32601
32722
  async getVesuMultiplyCall(params) {
32602
32723
  const maxEkuboPriceImpact = params.maxEkuboPriceImpact || 0.01;
@@ -32605,32 +32726,54 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32605
32726
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
32606
32727
  if (!params.isDeposit) {
32607
32728
  const unusedBalance = await this.getUnusedBalance();
32608
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall unusedBalance: ${unusedBalance.amount.toString()}, required: ${params.leg1DepositAmount.toString()}`);
32729
+ logger.verbose(
32730
+ `${this.getTag()}::getVesuMultiplyCall unusedBalance: ${unusedBalance.amount.toString()}, required: ${params.leg1DepositAmount.toString()}`
32731
+ );
32609
32732
  }
32610
32733
  const existingPositions = await vesuAdapter1.getPositions(this.config);
32611
- const collateralisation = await vesuAdapter1.getCollateralization(this.config);
32734
+ const collateralisation = await vesuAdapter1.getCollateralization(
32735
+ this.config
32736
+ );
32612
32737
  const existingCollateralInfo = existingPositions[0];
32613
32738
  const existingDebtInfo = existingPositions[1];
32614
32739
  logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32615
32740
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32616
32741
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32617
32742
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32618
- logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32743
+ logger.debug(
32744
+ `${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
32745
+ );
32619
32746
  const dexPrice = await this.getLSTDexPrice();
32620
- const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
32621
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
32747
+ const addedCollateral = params.leg1DepositAmount.multipliedBy(
32748
+ params.isDeposit ? 1 : -1
32749
+ );
32750
+ logger.verbose(
32751
+ `${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`
32752
+ );
32622
32753
  const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
32623
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`);
32754
+ logger.verbose(
32755
+ `${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`
32756
+ );
32624
32757
  const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
32625
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`);
32758
+ logger.verbose(
32759
+ `${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`
32760
+ );
32626
32761
  const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
32627
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`);
32762
+ logger.verbose(
32763
+ `${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`
32764
+ );
32628
32765
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
32629
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
32630
- logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
32766
+ logger.verbose(
32767
+ `${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`
32768
+ );
32769
+ logger.debug(
32770
+ `${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`
32771
+ );
32631
32772
  let debtAmount = x_debt_usd.dividedBy(debtPrice);
32632
32773
  const marginAmount = addedCollateral;
32633
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
32774
+ logger.verbose(
32775
+ `${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`
32776
+ );
32634
32777
  if (marginAmount.lt(0) && debtAmount.gt(0)) {
32635
32778
  debtAmount = Web3Number.fromWei(0, this.asset().decimals);
32636
32779
  }
@@ -32644,31 +32787,49 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32644
32787
  });
32645
32788
  }
32646
32789
  getLSTUnderlyingTokenInfo() {
32647
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32790
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32791
+ this.metadata.additionalInfo.defaultPoolId
32792
+ );
32648
32793
  return vesuAdapter1.config.debt;
32649
32794
  }
32650
32795
  async getMaxBorrowableAmount(params = { isAPYComputation: false }) {
32651
32796
  const vesuAdapters = this.getVesuAdapters();
32652
- let netMaxBorrowableAmount = Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals);
32797
+ let netMaxBorrowableAmount = Web3Number.fromWei(
32798
+ "0",
32799
+ this.getLSTUnderlyingTokenInfo().decimals
32800
+ );
32653
32801
  const maxBorrowables = [];
32654
32802
  for (const vesuAdapter of vesuAdapters) {
32655
- const output = await this.getMaxBorrowableAmountByVesuAdapter(vesuAdapter, params.isAPYComputation);
32803
+ const output = await this.getMaxBorrowableAmountByVesuAdapter(
32804
+ vesuAdapter,
32805
+ params.isAPYComputation
32806
+ );
32656
32807
  const ltv = await vesuAdapter.getLTVConfig(this.config);
32657
32808
  maxBorrowables.push({ ...output, ltv });
32658
32809
  }
32659
32810
  maxBorrowables.sort((a, b) => b.amount.toNumber() - a.amount.toNumber());
32660
- netMaxBorrowableAmount = maxBorrowables.reduce((acc, curr) => acc.plus(curr.amount), Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals));
32811
+ netMaxBorrowableAmount = maxBorrowables.reduce(
32812
+ (acc, curr) => acc.plus(curr.amount),
32813
+ Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals)
32814
+ );
32661
32815
  return { netMaxBorrowableAmount, maxBorrowables };
32662
32816
  }
32663
- // recursively, using binary search computes max swappable.
32817
+ // recursively, using binary search computes max swappable.
32664
32818
  // @dev assumes 1 token of from == 1 token of to
32665
32819
  async getMaxSwappableWithMaxSlippage(fromToken, toToken, maxSlippage, maxAmount) {
32666
32820
  const output = await findMaxInputWithSlippage({
32667
32821
  apiGetOutput: async (inputAmount) => {
32668
32822
  const ekuboQuoter = new EkuboQuoter(this.config);
32669
32823
  await new Promise((resolve) => setTimeout(resolve, 1e3));
32670
- const quote = await ekuboQuoter.getQuote(fromToken.address.address, toToken.address.address, new Web3Number(inputAmount.toFixed(9), fromToken.decimals));
32671
- return Web3Number.fromWei(quote.total_calculated.toString(), toToken.decimals).toNumber();
32824
+ const quote = await ekuboQuoter.getQuote(
32825
+ fromToken.address.address,
32826
+ toToken.address.address,
32827
+ new Web3Number(inputAmount.toFixed(9), fromToken.decimals)
32828
+ );
32829
+ return Web3Number.fromWei(
32830
+ quote.total_calculated.toString(),
32831
+ toToken.decimals
32832
+ ).toNumber();
32672
32833
  },
32673
32834
  maxInput: maxAmount.toNumber(),
32674
32835
  maxSlippagePercent: maxSlippage,
@@ -32678,38 +32839,84 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32678
32839
  return new Web3Number(output.optimalInput, fromToken.decimals);
32679
32840
  }
32680
32841
  async getMaxBorrowableAmountByVesuAdapter(vesuAdapter, isAPYComputation) {
32681
- const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
32842
+ const lstAPY = await this.getLSTAPR(
32843
+ this.getLSTUnderlyingTokenInfo().address
32844
+ );
32682
32845
  const maxInterestRate = lstAPY * 0.8;
32683
- const { maxDebtToHave: maxBorrowableAmount, currentDebt } = await vesuAdapter.getMaxBorrowableByInterestRate(this.config, vesuAdapter.config.debt, maxInterestRate);
32846
+ const { maxDebtToHave: maxBorrowableAmount, currentDebt } = await vesuAdapter.getMaxBorrowableByInterestRate(
32847
+ this.config,
32848
+ vesuAdapter.config.debt,
32849
+ maxInterestRate
32850
+ );
32684
32851
  const debtCap = await vesuAdapter.getDebtCap(this.config);
32685
32852
  if (currentDebt.gte(debtCap)) {
32686
- return { amount: Web3Number.fromWei("0", vesuAdapter.config.debt.decimals), dexSwappableAmount: Web3Number.fromWei("0", vesuAdapter.config.debt.decimals), maxBorrowableAmount: Web3Number.fromWei("0", vesuAdapter.config.debt.decimals), borrowableAsset: vesuAdapter.config.debt };
32853
+ return {
32854
+ amount: Web3Number.fromWei("0", vesuAdapter.config.debt.decimals),
32855
+ dexSwappableAmount: Web3Number.fromWei(
32856
+ "0",
32857
+ vesuAdapter.config.debt.decimals
32858
+ ),
32859
+ maxBorrowableAmount: Web3Number.fromWei(
32860
+ "0",
32861
+ vesuAdapter.config.debt.decimals
32862
+ ),
32863
+ borrowableAsset: vesuAdapter.config.debt
32864
+ };
32687
32865
  }
32688
32866
  const availableToBorrow = debtCap.minus(currentDebt);
32689
32867
  const maxBorrowable = maxBorrowableAmount.minimum(availableToBorrow).multipliedBy(0.999);
32690
- if (vesuAdapter.config.debt.address.eq(this.getLSTUnderlyingTokenInfo().address) || isAPYComputation) {
32691
- return { amount: maxBorrowable, dexSwappableAmount: maxBorrowable, maxBorrowableAmount: maxBorrowable, borrowableAsset: vesuAdapter.config.debt };
32868
+ if (vesuAdapter.config.debt.address.eq(
32869
+ this.getLSTUnderlyingTokenInfo().address
32870
+ ) || isAPYComputation) {
32871
+ return {
32872
+ amount: maxBorrowable,
32873
+ dexSwappableAmount: maxBorrowable,
32874
+ maxBorrowableAmount: maxBorrowable,
32875
+ borrowableAsset: vesuAdapter.config.debt
32876
+ };
32692
32877
  }
32693
32878
  try {
32694
- const maxSwappable = await this.getMaxSwappableWithMaxSlippage(vesuAdapter.config.debt, this.getLSTUnderlyingTokenInfo(), 2e-4, maxBorrowable);
32695
- return { amount: maxBorrowable.minimum(maxSwappable), dexSwappableAmount: maxSwappable, maxBorrowableAmount: maxBorrowable, borrowableAsset: vesuAdapter.config.debt };
32879
+ const maxSwappable = await this.getMaxSwappableWithMaxSlippage(
32880
+ vesuAdapter.config.debt,
32881
+ this.getLSTUnderlyingTokenInfo(),
32882
+ 2e-4,
32883
+ maxBorrowable
32884
+ );
32885
+ return {
32886
+ amount: maxBorrowable.minimum(maxSwappable),
32887
+ dexSwappableAmount: maxSwappable,
32888
+ maxBorrowableAmount: maxBorrowable,
32889
+ borrowableAsset: vesuAdapter.config.debt
32890
+ };
32696
32891
  } catch (error) {
32697
32892
  logger.warn(`${this.getTag()}: Failed to get max swappable: ${error}`);
32698
- const maxSwappable = Web3Number.fromWei("0", vesuAdapter.config.debt.decimals);
32699
- return { amount: maxBorrowable.minimum(maxSwappable), dexSwappableAmount: maxSwappable, maxBorrowableAmount: maxBorrowable, borrowableAsset: vesuAdapter.config.debt };
32893
+ const maxSwappable = Web3Number.fromWei(
32894
+ "0",
32895
+ vesuAdapter.config.debt.decimals
32896
+ );
32897
+ return {
32898
+ amount: maxBorrowable.minimum(maxSwappable),
32899
+ dexSwappableAmount: maxSwappable,
32900
+ maxBorrowableAmount: maxBorrowable,
32901
+ borrowableAsset: vesuAdapter.config.debt
32902
+ };
32700
32903
  }
32701
32904
  }
32702
32905
  // todo how much to unwind to get back healthy APY zone again
32703
32906
  // if net APY < LST APR + 0.5%, we need to unwind to get back to LST APR + 1% atleast or 0 vesu position
32704
- // For xSTRK, simply deposit in Vesu if looping is not viable
32907
+ // For xSTRK, simply deposit in Vesu if looping is not viable
32705
32908
  /**
32706
32909
  * Gets LST APR for the strategy's underlying asset from Endur API
32707
32910
  * @returns Promise<number> The LST APR (not divided by 1e18)
32708
32911
  */
32709
32912
  async getLSTAPR(_address) {
32710
32913
  try {
32711
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32712
- const apr = await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
32914
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32915
+ this.metadata.additionalInfo.defaultPoolId
32916
+ );
32917
+ const apr = await LSTAPRService.getLSTAPR(
32918
+ vesuAdapter1.config.debt.address
32919
+ );
32713
32920
  if (!apr) {
32714
32921
  throw new Error("Failed to get LST APR");
32715
32922
  }
@@ -32722,19 +32929,37 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32722
32929
  // todo undo this
32723
32930
  async netAPY() {
32724
32931
  const unusedBalance = await this.getUnusedBalance();
32725
- const maxNewDeposits = await this.maxNewDeposits({ isAPYComputation: true });
32726
- const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
32932
+ const maxNewDeposits = await this.maxNewDeposits({
32933
+ isAPYComputation: true
32934
+ });
32935
+ const lstAPY = await this.getLSTAPR(
32936
+ this.getLSTUnderlyingTokenInfo().address
32937
+ );
32727
32938
  if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
32728
- logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
32939
+ logger.verbose(
32940
+ `${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`
32941
+ );
32729
32942
  const output = await super.netAPY();
32730
32943
  output.splits.push({ apy: lstAPY, id: "lst_apy" });
32731
32944
  return output;
32732
32945
  } else {
32733
- logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
32946
+ logger.verbose(
32947
+ `${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`
32948
+ );
32734
32949
  const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
32735
- const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
32950
+ const weights = positions.map(
32951
+ (p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1)
32952
+ );
32736
32953
  const aum = weights.reduce((acc, curr) => acc + curr, 0);
32737
- const output = await this.returnNetAPY(baseAPYs, rewardAPYs, weights, new Web3Number(aum.toFixed(9), this.getLSTUnderlyingTokenInfo().decimals));
32954
+ const output = await this.returnNetAPY(
32955
+ baseAPYs,
32956
+ rewardAPYs,
32957
+ weights,
32958
+ new Web3Number(
32959
+ aum.toFixed(9),
32960
+ this.getLSTUnderlyingTokenInfo().decimals
32961
+ )
32962
+ );
32738
32963
  output.splits.push({ apy: lstAPY, id: "lst_apy" });
32739
32964
  return output;
32740
32965
  }
@@ -32744,9 +32969,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32744
32969
  let numerator = 0;
32745
32970
  let ltv = void 0;
32746
32971
  for (let adapter of this.getVesuAdapters()) {
32747
- const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find((b) => b.borrowableAsset.address.eq(adapter.config.debt.address));
32972
+ const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find(
32973
+ (b) => b.borrowableAsset.address.eq(adapter.config.debt.address)
32974
+ );
32748
32975
  if (!maxBorrowableAmountInfo || !maxBorrowableAmountInfo?.amount) {
32749
- throw new Error(`Max borrowable amount not found for adapter: ${adapter.config.debt.symbol}`);
32976
+ throw new Error(
32977
+ `Max borrowable amount not found for adapter: ${adapter.config.debt.symbol}`
32978
+ );
32750
32979
  }
32751
32980
  numerator += this.metadata.additionalInfo.targetHealthFactor * maxBorrowableAmountInfo.amount.toNumber() / maxBorrowableAmountInfo.ltv;
32752
32981
  }
@@ -32755,7 +32984,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32755
32984
  // todo revisit cases where 0th adapters is used
32756
32985
  async getUnusedBalanceAPY() {
32757
32986
  const unusedBalance = await this.getUnusedBalance();
32758
- const vesuAdapter = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32987
+ const vesuAdapter = this.getVesuSameTokenAdapter(
32988
+ this.metadata.additionalInfo.defaultPoolId
32989
+ );
32759
32990
  const underlying = vesuAdapter.config.debt;
32760
32991
  const lstAPY = await this.getLSTAPR(underlying.address);
32761
32992
  return {
@@ -32764,11 +32995,16 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32764
32995
  };
32765
32996
  }
32766
32997
  async getLSTAvnuRate() {
32767
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32998
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32999
+ this.metadata.additionalInfo.defaultPoolId
33000
+ );
32768
33001
  const lstTokenInfo = vesuAdapter1.config.collateral;
32769
33002
  const underlyingTokenInfo = vesuAdapter1.config.debt;
32770
33003
  const avnuModule = new AvnuWrapper();
32771
- const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(lstTokenInfo.priceCheckAmount, underlyingTokenInfo.decimals) : new Web3Number(1, underlyingTokenInfo.decimals);
33004
+ const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(
33005
+ lstTokenInfo.priceCheckAmount,
33006
+ underlyingTokenInfo.decimals
33007
+ ) : new Web3Number(1, underlyingTokenInfo.decimals);
32772
33008
  const quote = await avnuModule.getQuotes(
32773
33009
  underlyingTokenInfo.address.address,
32774
33010
  lstTokenInfo.address.address,
@@ -32782,40 +33018,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32782
33018
  ).toNumber();
32783
33019
  assert(lstAmountNumber > 0, "Avnu LST amount is zero");
32784
33020
  const exchangeRate = underlyingAmountNumber / lstAmountNumber;
32785
- logger.verbose(`${this.getTag()}:: LST Avnu Exchange Rate: ${exchangeRate}`);
33021
+ logger.verbose(
33022
+ `${this.getTag()}:: LST Avnu Exchange Rate: ${exchangeRate}`
33023
+ );
32786
33024
  return exchangeRate;
32787
33025
  }
32788
33026
  async getLSTExchangeRate() {
32789
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
33027
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
33028
+ this.metadata.additionalInfo.defaultPoolId
33029
+ );
32790
33030
  const lstTokenInfo = vesuAdapter1.config.collateral;
32791
33031
  const lstABI = new import_starknet19.Contract({
32792
33032
  abi: erc4626_abi_default,
32793
33033
  address: lstTokenInfo.address.address,
32794
33034
  providerOrAccount: this.config.provider
32795
33035
  });
32796
- const price = await lstABI.call("convert_to_assets", [import_starknet19.uint256.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())]);
33036
+ const price = await lstABI.call("convert_to_assets", [
33037
+ import_starknet19.uint256.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())
33038
+ ]);
32797
33039
  const exchangeRate = Number(import_starknet19.uint256.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
32798
33040
  logger.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
32799
33041
  return exchangeRate;
32800
33042
  }
32801
33043
  /**
32802
- *
33044
+ *
32803
33045
  * @param params marginAmount is in LST, debtAmount is in underlying
32804
33046
  */
32805
33047
  async getModifyLeverCall(params) {
32806
- logger.verbose(`${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`);
32807
- assert(!params.marginAmount.isZero() || !params.debtAmount.isZero(), "Deposit/debt must be non-0");
33048
+ logger.verbose(
33049
+ `${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`
33050
+ );
33051
+ assert(
33052
+ !params.marginAmount.isZero() || !params.debtAmount.isZero(),
33053
+ "Deposit/debt must be non-0"
33054
+ );
32808
33055
  const vesuAdapter1 = this.getVesuSameTokenAdapter(params.poolId);
32809
33056
  const lstTokenInfo = this.asset();
32810
33057
  const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
32811
33058
  const maxAmounts = lstTokenInfo.symbol == "xSTRK" ? 5e5 : 0.5;
32812
33059
  if (params.marginAmount.greaterThan(maxAmounts)) {
32813
- throw new Error(`Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`);
33060
+ throw new Error(
33061
+ `Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`
33062
+ );
32814
33063
  }
32815
33064
  const proofsIDs = [];
32816
33065
  const manageCalls = [];
32817
33066
  if (params.marginAmount.greaterThan(0)) {
32818
- const STEP1_ID = getVesuGenericLegId(params.poolId.toString(), "multiple_approve" /* MULTIPLE_APPROVE */);
33067
+ const STEP1_ID = getVesuGenericLegId(
33068
+ params.poolId.toString(),
33069
+ "multiple_approve" /* MULTIPLE_APPROVE */
33070
+ );
32819
33071
  const manage1Info = this.getProofs(STEP1_ID);
32820
33072
  const depositAmount = params.marginAmount;
32821
33073
  const manageCall1 = manage1Info.callConstructor({
@@ -32836,31 +33088,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32836
33088
  params.debtAmount
32837
33089
  // negative for exact amount out
32838
33090
  );
32839
- logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`);
32840
- assert(leverSwapQuote.price_impact <= params.maxEkuboPriceImpact, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
32841
- const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
32842
- logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`);
33091
+ logger.verbose(
33092
+ `${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`
33093
+ );
33094
+ assert(
33095
+ leverSwapQuote.price_impact <= params.maxEkuboPriceImpact,
33096
+ "getIncreaseLeverCall: Price impact is too high [Debt swap]"
33097
+ );
33098
+ const leverSwap = ekuboQuoter.getVesuMultiplyQuote(
33099
+ leverSwapQuote,
33100
+ fromToken,
33101
+ toToken
33102
+ );
33103
+ logger.verbose(
33104
+ `${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`
33105
+ );
32843
33106
  let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
32844
33107
  const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
32845
33108
  minLSTReceived = minLSTReceivedAsPerTruePrice;
32846
- logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
33109
+ logger.verbose(
33110
+ `${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`
33111
+ );
32847
33112
  let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
32848
33113
  const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
32849
- logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
33114
+ logger.verbose(
33115
+ `${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`
33116
+ );
32850
33117
  maxUsedCollateral = maxUsedCollateralInLST;
32851
- const STEP2_ID = getVesuGenericLegId(params.poolId.toString(), "switch_delegation_on" /* SWITCH_DELEGATION_ON */);
33118
+ const STEP2_ID = getVesuGenericLegId(
33119
+ params.poolId.toString(),
33120
+ "switch_delegation_on" /* SWITCH_DELEGATION_ON */
33121
+ );
32852
33122
  const manage2Info = this.getProofs(STEP2_ID);
32853
33123
  const manageCall2 = manage2Info.callConstructor({
32854
33124
  delegation: true
32855
33125
  });
32856
- const STEP3_ID = getVesuLegId("multiply_vesu" /* MULTIPLY_VESU */, vesuAdapter1.config.debt.symbol, vesuAdapter1.config.poolId.toString());
33126
+ const STEP3_ID = getVesuLegId(
33127
+ "multiply_vesu" /* MULTIPLY_VESU */,
33128
+ vesuAdapter1.config.debt.symbol,
33129
+ vesuAdapter1.config.poolId.toString()
33130
+ );
32857
33131
  const manage3Info = this.getProofs(STEP3_ID);
32858
33132
  const multiplyParams = params.isIncrease ? {
32859
33133
  isIncrease: true,
32860
33134
  increaseParams: {
32861
33135
  add_margin: params.marginAmount,
32862
33136
  margin_swap: [],
32863
- margin_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
33137
+ margin_swap_limit_amount: Web3Number.fromWei(
33138
+ 0,
33139
+ this.asset().decimals
33140
+ ),
32864
33141
  lever_swap: leverSwap,
32865
33142
  lever_swap_limit_amount: minLSTReceived
32866
33143
  }
@@ -32872,15 +33149,21 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32872
33149
  lever_swap_limit_amount: maxUsedCollateral,
32873
33150
  // only required for close position
32874
33151
  lever_swap_weights: [],
32875
- // no need to swap collateral to anything, and any residuals return our contract anyways.
33152
+ // no need to swap collateral to anything, and any residuals return our contract anyways.
32876
33153
  withdraw_swap: [],
32877
- withdraw_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
33154
+ withdraw_swap_limit_amount: Web3Number.fromWei(
33155
+ 0,
33156
+ this.asset().decimals
33157
+ ),
32878
33158
  withdraw_swap_weights: [],
32879
33159
  close_position: false
32880
33160
  }
32881
33161
  };
32882
33162
  const manageCall3 = manage3Info.callConstructor(multiplyParams);
32883
- const STEP4_ID = getVesuGenericLegId(params.poolId.toString(), "switch_delegation_off" /* SWITCH_DELEGATION_OFF */);
33163
+ const STEP4_ID = getVesuGenericLegId(
33164
+ params.poolId.toString(),
33165
+ "switch_delegation_off" /* SWITCH_DELEGATION_OFF */
33166
+ );
32884
33167
  const manage4Info = this.getProofs(STEP4_ID);
32885
33168
  const manageCall4 = manage4Info.callConstructor({
32886
33169
  delegation: false
@@ -32894,7 +33177,6 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
32894
33177
  const containerStyle = {
32895
33178
  maxWidth: "800px",
32896
33179
  margin: "0 auto",
32897
- backgroundColor: "#111",
32898
33180
  color: "#eee",
32899
33181
  fontFamily: "Arial, sans-serif",
32900
33182
  borderRadius: "12px"
@@ -32917,21 +33199,52 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
32917
33199
  " to create leverage. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield."
32918
33200
  ] }),
32919
33201
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: [
32920
- "This vault uses Vesu for lending and borrowing. The oracle used by this pool is a ",
32921
- highlightTextWithLinks("conversion rate oracle", [{ highlight: "conversion rate oracle", link: "https://docs.pragma.build/starknet/development#conversion-rate" }]),
33202
+ "This vault uses Vesu for lending and borrowing. The oracle used by this pool is a",
33203
+ " ",
33204
+ highlightTextWithLinks("conversion rate oracle", [
33205
+ {
33206
+ highlight: "conversion rate oracle",
33207
+ link: "https://docs.pragma.build/starknet/development#conversion-rate"
33208
+ }
33209
+ ]),
32922
33210
  " ",
32923
33211
  "which is resilient to liquidity issues and price volatility, hence reducing the risk of liquidation. However, overtime, if left un-monitored, debt can increase enough to trigger a liquidation. But no worries, our continuous monitoring systems look for situations with reduced health factor and balance collateral/debt to bring it back to safe levels. With Troves, you can have a peaceful sleep."
32924
33212
  ] }),
32925
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
32926
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
32927
- " Requests can take up to ",
32928
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
32929
- " to process as the vault unwinds and settles routing."
32930
- ] }) }),
32931
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
32932
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Debt limits:" }),
32933
- " Pools on Vesu have debt caps that are gradually increased over time. Until caps are raised, deposited LSTs remain in the vault, generating a shared net return for all depositors. There is no additional fee taken by Troves on LST APY, its only on added gain."
32934
- ] }) })
33213
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
33214
+ "div",
33215
+ {
33216
+ style: {
33217
+ backgroundColor: "#222",
33218
+ padding: "10px",
33219
+ borderRadius: "8px",
33220
+ marginBottom: "20px",
33221
+ border: "1px solid #444"
33222
+ },
33223
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
33224
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
33225
+ " Requests can take up to",
33226
+ " ",
33227
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
33228
+ " to process as the vault unwinds and settles routing."
33229
+ ] })
33230
+ }
33231
+ ),
33232
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
33233
+ "div",
33234
+ {
33235
+ style: {
33236
+ backgroundColor: "#222",
33237
+ padding: "10px",
33238
+ borderRadius: "8px",
33239
+ marginBottom: "20px",
33240
+ border: "1px solid #444"
33241
+ },
33242
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
33243
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Debt limits:" }),
33244
+ " Pools on Vesu have debt caps that are gradually increased over time. Until caps are raised, deposited LSTs remain in the vault, generating a shared net return for all depositors. There is no additional fee taken by Troves on LST APY, its only on added gain."
33245
+ ] })
33246
+ }
33247
+ )
32935
33248
  ] });
32936
33249
  }
32937
33250
  function getDescription2(tokenSymbol, underlyingSymbol) {
@@ -32947,31 +33260,76 @@ function getVesuLegId(baseID, debtTokenSymbol, poolId) {
32947
33260
  return `${baseID}_${debtTokenSymbol.toLowerCase()}_${poolId.slice(-4).toLowerCase()}`;
32948
33261
  }
32949
33262
  function addVesuLeaves(poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter) {
32950
- const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
32951
- const underlyingToken = Global.getDefaultTokens().find((token) => token.symbol === underlyingSymbol);
33263
+ const lstToken = Global.getDefaultTokens().find(
33264
+ (token) => token.symbol === lstSymbol
33265
+ );
33266
+ const underlyingToken = Global.getDefaultTokens().find(
33267
+ (token) => token.symbol === underlyingSymbol
33268
+ );
32952
33269
  const vesuAdapterLST = new VesuAdapter({
32953
33270
  poolId,
32954
33271
  collateral: lstToken,
32955
33272
  debt: underlyingToken,
32956
33273
  vaultAllocator: vaultSettings.vaultAllocator,
32957
- id: getVesuLegId("vesu_leg1" /* VESU_LEG1 */, underlyingToken.symbol, poolId.toString())
33274
+ id: getVesuLegId(
33275
+ "vesu_leg1" /* VESU_LEG1 */,
33276
+ underlyingToken.symbol,
33277
+ poolId.toString()
33278
+ )
32958
33279
  });
32959
- vaultSettings.adapters.push(...[{
32960
- id: getVesuLegId("vesu_leg1" /* VESU_LEG1 */, underlyingToken.symbol, poolId.toString()),
32961
- adapter: vesuAdapterLST
32962
- }]);
33280
+ vaultSettings.adapters.push(
33281
+ ...[
33282
+ {
33283
+ id: getVesuLegId(
33284
+ "vesu_leg1" /* VESU_LEG1 */,
33285
+ underlyingToken.symbol,
33286
+ poolId.toString()
33287
+ ),
33288
+ adapter: vesuAdapterLST
33289
+ }
33290
+ ]
33291
+ );
32963
33292
  const { isV2, addr: poolAddr } = getVesuSingletonAddress(poolId);
32964
33293
  const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
32965
- const leafIdApprove = getVesuGenericLegId(poolId.toString(), "multiple_approve" /* MULTIPLE_APPROVE */);
32966
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter));
32967
- const leafIdDelegationOn = getVesuGenericLegId(poolId.toString(), "switch_delegation_on" /* SWITCH_DELEGATION_ON */);
32968
- vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST));
32969
- const leafIdDelegationOff = getVesuGenericLegId(poolId.toString(), "switch_delegation_off" /* SWITCH_DELEGATION_OFF */);
32970
- vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST));
32971
- const multiplID = getVesuLegId("multiply_vesu" /* MULTIPLY_VESU */, underlyingToken.symbol, poolId.toString());
32972
- vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST));
32973
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
32974
- vaultSettings.leafAdapters.push(vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST));
33294
+ const leafIdApprove = getVesuGenericLegId(
33295
+ poolId.toString(),
33296
+ "multiple_approve" /* MULTIPLE_APPROVE */
33297
+ );
33298
+ vaultSettings.leafAdapters.push(
33299
+ commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter)
33300
+ );
33301
+ const leafIdDelegationOn = getVesuGenericLegId(
33302
+ poolId.toString(),
33303
+ "switch_delegation_on" /* SWITCH_DELEGATION_ON */
33304
+ );
33305
+ vaultSettings.leafAdapters.push(
33306
+ vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST)
33307
+ );
33308
+ const leafIdDelegationOff = getVesuGenericLegId(
33309
+ poolId.toString(),
33310
+ "switch_delegation_off" /* SWITCH_DELEGATION_OFF */
33311
+ );
33312
+ vaultSettings.leafAdapters.push(
33313
+ vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST)
33314
+ );
33315
+ const multiplID = getVesuLegId(
33316
+ "multiply_vesu" /* MULTIPLY_VESU */,
33317
+ underlyingToken.symbol,
33318
+ poolId.toString()
33319
+ );
33320
+ vaultSettings.leafAdapters.push(
33321
+ vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST)
33322
+ );
33323
+ vaultSettings.leafAdapters.push(
33324
+ commonAdapter.getApproveAdapter(
33325
+ lstToken.address,
33326
+ poolAddr,
33327
+ "approve_token1" /* APPROVE_TOKEN1 */
33328
+ ).bind(commonAdapter)
33329
+ );
33330
+ vaultSettings.leafAdapters.push(
33331
+ vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST)
33332
+ );
32975
33333
  return vesuAdapterLST;
32976
33334
  }
32977
33335
  function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId) {
@@ -32980,8 +33338,12 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
32980
33338
  if (!pool1.eq(defaultPoolId)) {
32981
33339
  throw new Error(`Dont include default pool id in supported pool ids`);
32982
33340
  }
32983
- const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
32984
- const underlyingToken = Global.getDefaultTokens().find((token) => token.symbol === underlyingSymbol);
33341
+ const lstToken = Global.getDefaultTokens().find(
33342
+ (token) => token.symbol === lstSymbol
33343
+ );
33344
+ const underlyingToken = Global.getDefaultTokens().find(
33345
+ (token) => token.symbol === underlyingSymbol
33346
+ );
32985
33347
  const commonAdapter = new CommonAdapter({
32986
33348
  manager: vaultSettings.manager,
32987
33349
  asset: lstToken.address,
@@ -32989,28 +33351,106 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
32989
33351
  vaultAddress: vaultSettings.vaultAddress,
32990
33352
  vaultAllocator: vaultSettings.vaultAllocator
32991
33353
  });
32992
- vaultSettings.adapters.push(...[{
32993
- id: "common_adapter" /* COMMON */,
32994
- adapter: commonAdapter
32995
- }]);
32996
- vaultSettings.borrowable_assets.map((borrowableAsset) => addVesuLeaves(borrowableAsset.poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter));
32997
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, AVNU_EXCHANGE, "avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */).bind(commonAdapter));
32998
- const uniqueBorrowableAssets = [...new Set(vaultSettings.borrowable_assets.map((borrowableAsset) => borrowableAsset.token.symbol))];
33354
+ vaultSettings.adapters.push(
33355
+ ...[
33356
+ {
33357
+ id: "common_adapter" /* COMMON */,
33358
+ adapter: commonAdapter
33359
+ }
33360
+ ]
33361
+ );
33362
+ vaultSettings.borrowable_assets.map(
33363
+ (borrowableAsset) => addVesuLeaves(
33364
+ borrowableAsset.poolId,
33365
+ lstSymbol,
33366
+ underlyingSymbol,
33367
+ vaultSettings,
33368
+ commonAdapter
33369
+ )
33370
+ );
33371
+ vaultSettings.leafAdapters.push(
33372
+ commonAdapter.getApproveAdapter(
33373
+ lstToken.address,
33374
+ AVNU_EXCHANGE,
33375
+ "avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */
33376
+ ).bind(commonAdapter)
33377
+ );
33378
+ const uniqueBorrowableAssets = [
33379
+ ...new Set(
33380
+ vaultSettings.borrowable_assets.map(
33381
+ (borrowableAsset) => borrowableAsset.token.symbol
33382
+ )
33383
+ )
33384
+ ];
32999
33385
  for (let borrowableAssetSymbol of uniqueBorrowableAssets) {
33000
- const borrowableAsset = Global.getDefaultTokens().find((token) => token.symbol === borrowableAssetSymbol);
33386
+ const borrowableAsset = Global.getDefaultTokens().find(
33387
+ (token) => token.symbol === borrowableAssetSymbol
33388
+ );
33001
33389
  const debtAsset = borrowableAsset;
33002
- const approve_debt_token_id = getAvnuManageIDs("avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */, debtAsset.symbol);
33003
- const swap_debt_token_id = getAvnuManageIDs("avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, debtAsset.symbol);
33004
- const swap_lst_token_id = getAvnuManageIDs("avnu_mul_swap_withdr" /* AVNU_MULTIPLY_SWAP_WITHDRAW */, debtAsset.symbol);
33005
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(debtAsset.address, AVNU_EXCHANGE, approve_debt_token_id).bind(commonAdapter));
33006
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(debtAsset.address, lstToken.address, swap_debt_token_id, false).bind(commonAdapter));
33007
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(lstToken.address, debtAsset.address, swap_lst_token_id, false).bind(commonAdapter));
33008
- }
33009
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
33010
- vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
33011
- const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
33012
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_EXCHANGE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
33013
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */, false).bind(commonAdapter));
33390
+ const approve_debt_token_id = getAvnuManageIDs(
33391
+ "avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
33392
+ debtAsset.symbol
33393
+ );
33394
+ const swap_debt_token_id = getAvnuManageIDs(
33395
+ "avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */,
33396
+ debtAsset.symbol
33397
+ );
33398
+ const swap_lst_token_id = getAvnuManageIDs(
33399
+ "avnu_mul_swap_withdr" /* AVNU_MULTIPLY_SWAP_WITHDRAW */,
33400
+ debtAsset.symbol
33401
+ );
33402
+ vaultSettings.leafAdapters.push(
33403
+ commonAdapter.getApproveAdapter(
33404
+ debtAsset.address,
33405
+ AVNU_EXCHANGE,
33406
+ approve_debt_token_id
33407
+ ).bind(commonAdapter)
33408
+ );
33409
+ vaultSettings.leafAdapters.push(
33410
+ commonAdapter.getAvnuAdapter(
33411
+ debtAsset.address,
33412
+ lstToken.address,
33413
+ swap_debt_token_id,
33414
+ false
33415
+ ).bind(commonAdapter)
33416
+ );
33417
+ vaultSettings.leafAdapters.push(
33418
+ commonAdapter.getAvnuAdapter(
33419
+ lstToken.address,
33420
+ debtAsset.address,
33421
+ swap_lst_token_id,
33422
+ false
33423
+ ).bind(commonAdapter)
33424
+ );
33425
+ }
33426
+ vaultSettings.leafAdapters.push(
33427
+ commonAdapter.getApproveAdapter(
33428
+ lstToken.address,
33429
+ vaultSettings.vaultAddress,
33430
+ "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */
33431
+ ).bind(commonAdapter)
33432
+ );
33433
+ vaultSettings.leafAdapters.push(
33434
+ commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter)
33435
+ );
33436
+ const STRKToken = Global.getDefaultTokens().find(
33437
+ (token) => token.symbol === "STRK"
33438
+ );
33439
+ vaultSettings.leafAdapters.push(
33440
+ commonAdapter.getApproveAdapter(
33441
+ STRKToken.address,
33442
+ AVNU_EXCHANGE,
33443
+ "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */
33444
+ ).bind(commonAdapter)
33445
+ );
33446
+ vaultSettings.leafAdapters.push(
33447
+ commonAdapter.getAvnuAdapter(
33448
+ STRKToken.address,
33449
+ lstToken.address,
33450
+ "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */,
33451
+ false
33452
+ ).bind(commonAdapter)
33453
+ );
33014
33454
  return vaultSettings;
33015
33455
  }
33016
33456
  var AUDIT_URL4 = "https://docs.troves.fi/p/security#starknet-vault-kit";
@@ -33029,7 +33469,8 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
33029
33469
  answer: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
33030
33470
  "Currently, the LST is from ",
33031
33471
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Endur" }),
33032
- " while ",
33472
+ " while",
33473
+ " ",
33033
33474
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Vesu" }),
33034
33475
  " is used to collateralize the looped position."
33035
33476
  ] })
@@ -33061,23 +33502,48 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
33061
33502
  ];
33062
33503
  }
33063
33504
  var _riskFactor4 = [
33064
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 25, reason: "Audited by Zellic" },
33065
- { type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 1 /* VERY_LOW_PROBABILITY */, weight: 25, reason: "The collateral and debt are highly correlated" },
33066
- { type: "Technical Risk" /* TECHNICAL_RISK */, value: 1 /* STABLE_INFRASTRUCTURE */, weight: 25, reason: "Liquidation can only happen if vault is left un-monitored for weeks, which is highly unlikely. We actively monitor all services on a daily basis." },
33067
- { type: "Depeg Risk" /* DEPEG_RISK */, value: 2 /* GENERALLY_STABLE */, weight: 25, reason: "Generally stable pegged assets" }
33068
- ];
33069
- var btcBorrowableAssets = [
33070
- "WBTC",
33071
- "tBTC",
33072
- "LBTC",
33073
- "solvBTC"
33505
+ {
33506
+ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */,
33507
+ value: 2 /* WELL_AUDITED */,
33508
+ weight: 25,
33509
+ reason: "Audited by Zellic"
33510
+ },
33511
+ {
33512
+ type: "Liquidation Risk" /* LIQUIDATION_RISK */,
33513
+ value: 1 /* VERY_LOW_PROBABILITY */,
33514
+ weight: 25,
33515
+ reason: "The collateral and debt are highly correlated"
33516
+ },
33517
+ {
33518
+ type: "Technical Risk" /* TECHNICAL_RISK */,
33519
+ value: 1 /* STABLE_INFRASTRUCTURE */,
33520
+ weight: 25,
33521
+ reason: "Liquidation can only happen if vault is left un-monitored for weeks, which is highly unlikely. We actively monitor all services on a daily basis."
33522
+ },
33523
+ {
33524
+ type: "Depeg Risk" /* DEPEG_RISK */,
33525
+ value: 2 /* GENERALLY_STABLE */,
33526
+ weight: 25,
33527
+ reason: "Generally stable pegged assets"
33528
+ }
33074
33529
  ];
33530
+ var btcBorrowableAssets = ["WBTC", "tBTC", "LBTC", "solvBTC"];
33075
33531
  var hyperxSTRK = {
33076
- vaultAddress: ContractAddr.from("0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"),
33077
- manager: ContractAddr.from("0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"),
33078
- vaultAllocator: ContractAddr.from("0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"),
33079
- redeemRequestNFT: ContractAddr.from("0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"),
33080
- aumOracle: ContractAddr.from("0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"),
33532
+ vaultAddress: ContractAddr.from(
33533
+ "0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"
33534
+ ),
33535
+ manager: ContractAddr.from(
33536
+ "0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"
33537
+ ),
33538
+ vaultAllocator: ContractAddr.from(
33539
+ "0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"
33540
+ ),
33541
+ redeemRequestNFT: ContractAddr.from(
33542
+ "0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"
33543
+ ),
33544
+ aumOracle: ContractAddr.from(
33545
+ "0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"
33546
+ ),
33081
33547
  leafAdapters: [],
33082
33548
  adapters: [],
33083
33549
  targetHealthFactor: 1.1,
@@ -33088,35 +33554,63 @@ var hyperxSTRK = {
33088
33554
  ...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
33089
33555
  // v2, new alt for Re7xSTRK
33090
33556
  ],
33091
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "STRK"),
33557
+ underlyingToken: Global.getDefaultTokens().find(
33558
+ (token) => token.symbol === "STRK"
33559
+ ),
33092
33560
  defaultPoolId: VesuPools.Re7xSTRK
33093
33561
  };
33094
33562
  var hyperxWBTC = {
33095
- vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
33096
- manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
33097
- vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
33098
- redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
33099
- aumOracle: ContractAddr.from("0x258f8a0ca0d21f542e48ad89d00e92dc4d9db4999084f50ef9c22dfb1e83023"),
33563
+ vaultAddress: ContractAddr.from(
33564
+ "0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"
33565
+ ),
33566
+ manager: ContractAddr.from(
33567
+ "0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"
33568
+ ),
33569
+ vaultAllocator: ContractAddr.from(
33570
+ "0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"
33571
+ ),
33572
+ redeemRequestNFT: ContractAddr.from(
33573
+ "0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"
33574
+ ),
33575
+ aumOracle: ContractAddr.from(
33576
+ "0x258f8a0ca0d21f542e48ad89d00e92dc4d9db4999084f50ef9c22dfb1e83023"
33577
+ ),
33100
33578
  leafAdapters: [],
33101
33579
  adapters: [],
33102
33580
  targetHealthFactor: 1.1,
33103
33581
  minHealthFactor: 1.05,
33104
33582
  borrowable_assets: [
33105
33583
  // allow all BTC flavours borrowing on Re7xBTC pool
33106
- ...btcBorrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
33584
+ ...btcBorrowableAssets.map(
33585
+ (asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)
33586
+ ).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
33107
33587
  // allow only WBTC borrowing on Prime pool
33108
33588
  ...Global.getDefaultTokens().filter((token) => token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Prime }))
33109
33589
  ],
33110
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "WBTC"),
33590
+ underlyingToken: Global.getDefaultTokens().find(
33591
+ (token) => token.symbol === "WBTC"
33592
+ ),
33111
33593
  defaultPoolId: VesuPools.Re7xBTC,
33112
- redemptionRouter: ContractAddr.from("0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417")
33594
+ redemptionRouter: ContractAddr.from(
33595
+ "0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417"
33596
+ )
33113
33597
  };
33114
33598
  var hyperxtBTC = {
33115
- vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
33116
- manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
33117
- vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
33118
- redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
33119
- aumOracle: ContractAddr.from("0x7e0d05cb7ba3f7db77a36c21c21583b5a524c2e685c08c24b3554911fb4a039"),
33599
+ vaultAddress: ContractAddr.from(
33600
+ "0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"
33601
+ ),
33602
+ manager: ContractAddr.from(
33603
+ "0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"
33604
+ ),
33605
+ vaultAllocator: ContractAddr.from(
33606
+ "0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"
33607
+ ),
33608
+ redeemRequestNFT: ContractAddr.from(
33609
+ "0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"
33610
+ ),
33611
+ aumOracle: ContractAddr.from(
33612
+ "0x7e0d05cb7ba3f7db77a36c21c21583b5a524c2e685c08c24b3554911fb4a039"
33613
+ ),
33120
33614
  leafAdapters: [],
33121
33615
  adapters: [],
33122
33616
  targetHealthFactor: 1.1,
@@ -33124,16 +33618,30 @@ var hyperxtBTC = {
33124
33618
  borrowable_assets: [
33125
33619
  ...Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
33126
33620
  ],
33127
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC"),
33621
+ underlyingToken: Global.getDefaultTokens().find(
33622
+ (token) => token.symbol === "tBTC"
33623
+ ),
33128
33624
  defaultPoolId: VesuPools.Re7xBTC,
33129
- redemptionRouter: ContractAddr.from("0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d")
33625
+ redemptionRouter: ContractAddr.from(
33626
+ "0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d"
33627
+ )
33130
33628
  };
33131
33629
  var hyperxsBTC = {
33132
- vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
33133
- manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
33134
- vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
33135
- redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
33136
- aumOracle: ContractAddr.from("0x149298ade3e79ec6cbdac6cfad289c57504eaf54e590939136ed1ceca60c345"),
33630
+ vaultAddress: ContractAddr.from(
33631
+ "0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"
33632
+ ),
33633
+ manager: ContractAddr.from(
33634
+ "0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"
33635
+ ),
33636
+ vaultAllocator: ContractAddr.from(
33637
+ "0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"
33638
+ ),
33639
+ redeemRequestNFT: ContractAddr.from(
33640
+ "0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"
33641
+ ),
33642
+ aumOracle: ContractAddr.from(
33643
+ "0x149298ade3e79ec6cbdac6cfad289c57504eaf54e590939136ed1ceca60c345"
33644
+ ),
33137
33645
  leafAdapters: [],
33138
33646
  adapters: [],
33139
33647
  targetHealthFactor: 1.1,
@@ -33141,15 +33649,27 @@ var hyperxsBTC = {
33141
33649
  borrowable_assets: [
33142
33650
  ...Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
33143
33651
  ],
33144
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC"),
33652
+ underlyingToken: Global.getDefaultTokens().find(
33653
+ (token) => token.symbol === "solvBTC"
33654
+ ),
33145
33655
  defaultPoolId: VesuPools.Re7xBTC
33146
33656
  };
33147
33657
  var hyperxLBTC = {
33148
- vaultAddress: ContractAddr.from("0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"),
33149
- manager: ContractAddr.from("0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"),
33150
- vaultAllocator: ContractAddr.from("0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"),
33151
- redeemRequestNFT: ContractAddr.from("0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"),
33152
- aumOracle: ContractAddr.from("0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0"),
33658
+ vaultAddress: ContractAddr.from(
33659
+ "0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"
33660
+ ),
33661
+ manager: ContractAddr.from(
33662
+ "0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"
33663
+ ),
33664
+ vaultAllocator: ContractAddr.from(
33665
+ "0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"
33666
+ ),
33667
+ redeemRequestNFT: ContractAddr.from(
33668
+ "0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"
33669
+ ),
33670
+ aumOracle: ContractAddr.from(
33671
+ "0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0"
33672
+ ),
33153
33673
  leafAdapters: [],
33154
33674
  adapters: [],
33155
33675
  targetHealthFactor: 1.1,
@@ -33157,7 +33677,9 @@ var hyperxLBTC = {
33157
33677
  borrowable_assets: [
33158
33678
  ...Global.getDefaultTokens().filter((token) => token.symbol === "LBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
33159
33679
  ],
33160
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC"),
33680
+ underlyingToken: Global.getDefaultTokens().find(
33681
+ (token) => token.symbol === "LBTC"
33682
+ ),
33161
33683
  defaultPoolId: VesuPools.Re7xBTC
33162
33684
  };
33163
33685
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
@@ -33175,7 +33697,7 @@ function getMaxTVL(lstSymbol) {
33175
33697
  xLBTC: 5,
33176
33698
  xtBTC: 5,
33177
33699
  xsBTC: 5,
33178
- xSTRK: 55e4
33700
+ xSTRK: 7e6
33179
33701
  };
33180
33702
  const maxTVLValue = lstMaxTVLs[lstSymbol] || 0;
33181
33703
  const token = Global.getDefaultTokens().find(
@@ -33244,15 +33766,19 @@ var HYPER_LST_SECURITY = {
33244
33766
  };
33245
33767
  var HYPER_LST_REDEMPTION_INFO = {
33246
33768
  instantWithdrawalVault: "No" /* NO */,
33247
- redemptionsInfo: [{
33248
- title: "Typical Duration",
33249
- description: "1-2 hours"
33250
- }],
33251
- alerts: [{
33252
- type: "info",
33253
- text: "In cases of low liquidity, high slippages, the redemptions can take longer time. Redemption times are estimates and may vary based on network conditions and liquidity requirements.",
33254
- tab: "withdraw"
33255
- }]
33769
+ redemptionsInfo: [
33770
+ {
33771
+ title: "Typical Duration",
33772
+ description: "1-2 hours"
33773
+ }
33774
+ ],
33775
+ alerts: [
33776
+ {
33777
+ type: "info",
33778
+ text: "In cases of low liquidity, high slippages, the redemptions can take longer time. Redemption times are estimates and may vary based on network conditions and liquidity requirements.",
33779
+ tab: "withdraw"
33780
+ }
33781
+ ]
33256
33782
  };
33257
33783
  function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview = false) {
33258
33784
  return {
@@ -33267,9 +33793,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33267
33793
  description: `Creates leveraged looping position on ${lstSymbol} by borrowing ${underlyingSymbol} to increase yield`
33268
33794
  },
33269
33795
  depositTokens: [
33270
- Global.getDefaultTokens().find(
33271
- (token) => token.symbol === lstSymbol
33272
- )
33796
+ Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)
33273
33797
  ],
33274
33798
  additionalInfo: getLooperSettings2(
33275
33799
  lstSymbol,
@@ -33279,10 +33803,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33279
33803
  ),
33280
33804
  risk: {
33281
33805
  riskFactor: _riskFactor4,
33282
- netRisk: _riskFactor4.reduce(
33283
- (acc, curr) => acc + curr.value * curr.weight,
33284
- 0
33285
- ) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
33806
+ netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
33286
33807
  notARisks: getNoRiskTags(_riskFactor4)
33287
33808
  },
33288
33809
  auditUrl: AUDIT_URL4,
@@ -33297,16 +33818,19 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33297
33818
  investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
33298
33819
  isPreview,
33299
33820
  apyMethodology: "Current annualized APY in terms of base asset of the LST. There is no additional fee taken by Troves on LST APY. We charge a 10% performance fee on the additional gain which is already accounted in the APY shown.",
33821
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
33300
33822
  tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
33301
33823
  security: HYPER_LST_SECURITY,
33302
33824
  redemptionInfo: HYPER_LST_REDEMPTION_INFO,
33303
33825
  usualTimeToEarnings: "2 weeks",
33304
33826
  usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 hours. This is when you realise your earnings.",
33305
- points: [{
33306
- multiplier: 4,
33307
- logo: "https://endur.fi/favicon.ico",
33308
- toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi."
33309
- }]
33827
+ points: [
33828
+ {
33829
+ multiplier: 4,
33830
+ logo: "https://endur.fi/favicon.ico",
33831
+ toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi."
33832
+ }
33833
+ ]
33310
33834
  };
33311
33835
  }
33312
33836
  var HyperLSTStrategies = [