@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.mjs CHANGED
@@ -17868,6 +17868,7 @@ var xSTRKSTRK = {
17868
17868
  notARisks: getNoRiskTags(_lstPoolRiskFactors)
17869
17869
  },
17870
17870
  apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
17871
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
17871
17872
  additionalInfo: {
17872
17873
  newBounds: {
17873
17874
  lower: -1,
@@ -18020,6 +18021,7 @@ var createLSTStrategy = (params) => ({
18020
18021
  ),
18021
18022
  Global.getDefaultTokens().find((t) => t.symbol === params.depositToken1Symbol)
18022
18023
  ],
18024
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
18023
18025
  additionalInfo: {
18024
18026
  ...xSTRKSTRK.additionalInfo,
18025
18027
  quoteAsset: Global.getDefaultTokens().find(
@@ -31807,7 +31809,6 @@ function MetaVaultDescription(allowedSources) {
31807
31809
  const containerStyle = {
31808
31810
  maxWidth: "800px",
31809
31811
  margin: "0 auto",
31810
- backgroundColor: "#111",
31811
31812
  color: "#eee",
31812
31813
  fontFamily: "Arial, sans-serif",
31813
31814
  borderRadius: "12px"
@@ -32000,6 +32001,7 @@ var createUniversalStrategy = (params) => ({
32000
32001
  risk: getUniversalRisk(),
32001
32002
  auditUrl: AUDIT_URL3,
32002
32003
  protocols: [Protocols.VESU],
32004
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
32003
32005
  curator: {
32004
32006
  name: "Unwrap Labs",
32005
32007
  logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
@@ -32110,23 +32112,36 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32110
32112
  constructor(config, pricer, metadata) {
32111
32113
  super(config, pricer, metadata);
32112
32114
  this.quoteAmountToFetchPrice = new Web3Number(1, 18);
32113
- const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
32115
+ const STRKToken = Global.getDefaultTokens().find(
32116
+ (token) => token.symbol === "STRK"
32117
+ );
32114
32118
  const underlyingToken = this.getLSTUnderlyingTokenInfo();
32115
32119
  if (underlyingToken.address.eq(STRKToken.address)) {
32116
32120
  this.quoteAmountToFetchPrice = new Web3Number(100, 18);
32117
32121
  } else {
32118
- this.quoteAmountToFetchPrice = new Web3Number(0.01, this.asset().decimals);
32122
+ this.quoteAmountToFetchPrice = new Web3Number(
32123
+ 0.01,
32124
+ this.asset().decimals
32125
+ );
32119
32126
  }
32120
32127
  }
32121
32128
  asset() {
32122
- return this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId).config.collateral;
32129
+ return this.getVesuSameTokenAdapter(
32130
+ this.metadata.additionalInfo.defaultPoolId
32131
+ ).config.collateral;
32123
32132
  }
32124
32133
  getTag() {
32125
32134
  return `${_UniversalLstMultiplierStrategy.name}:${this.metadata.name}`;
32126
32135
  }
32127
32136
  // Vesu adapter with LST and base token match
32128
32137
  getVesuSameTokenAdapter(poolId) {
32129
- const baseAdapter = this.getAdapter(getVesuLegId("vesu_leg1" /* VESU_LEG1 */, this.metadata.additionalInfo.underlyingToken.symbol, poolId.toString()));
32138
+ const baseAdapter = this.getAdapter(
32139
+ getVesuLegId(
32140
+ "vesu_leg1" /* VESU_LEG1 */,
32141
+ this.metadata.additionalInfo.underlyingToken.symbol,
32142
+ poolId.toString()
32143
+ )
32144
+ );
32130
32145
  baseAdapter.networkConfig = this.config;
32131
32146
  baseAdapter.pricer = this.pricer;
32132
32147
  return baseAdapter;
@@ -32169,27 +32184,43 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32169
32184
  lstUnderlyingTokenInfo.address.address,
32170
32185
  this.quoteAmountToFetchPrice
32171
32186
  );
32172
- const outputAmount = Web3Number.fromWei(quote.total_calculated, lstUnderlyingTokenInfo.decimals);
32187
+ const outputAmount = Web3Number.fromWei(
32188
+ quote.total_calculated,
32189
+ lstUnderlyingTokenInfo.decimals
32190
+ );
32173
32191
  const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
32174
32192
  logger.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
32175
32193
  return price;
32176
32194
  }
32177
32195
  async getAvnuSwapMultiplyCall(params) {
32178
- assert(params.isDeposit, "Only deposit is supported in getAvnuSwapMultiplyCall");
32179
- const maxBorrowableAmounts = await this.getMaxBorrowableAmount({ isAPYComputation: false });
32196
+ assert(
32197
+ params.isDeposit,
32198
+ "Only deposit is supported in getAvnuSwapMultiplyCall"
32199
+ );
32200
+ const maxBorrowableAmounts = await this.getMaxBorrowableAmount({
32201
+ isAPYComputation: false
32202
+ });
32180
32203
  const allVesuAdapters = this.getVesuAdapters();
32181
32204
  let remainingAmount = params.leg1DepositAmount;
32182
32205
  const lstExRate = await this.getLSTExchangeRate();
32183
- const baseAssetPrice = await this.pricer.getPrice(this.getLSTUnderlyingTokenInfo().symbol);
32206
+ const baseAssetPrice = await this.pricer.getPrice(
32207
+ this.getLSTUnderlyingTokenInfo().symbol
32208
+ );
32184
32209
  const lstPrice = baseAssetPrice.price * lstExRate;
32185
32210
  for (let i = 0; i < maxBorrowableAmounts.maxBorrowables.length; i++) {
32186
32211
  const maxBorrowable = maxBorrowableAmounts.maxBorrowables[i];
32187
- const vesuAdapter = allVesuAdapters.find((adapter) => adapter.config.debt.address.eq(maxBorrowable.borrowableAsset.address));
32212
+ const vesuAdapter = allVesuAdapters.find(
32213
+ (adapter) => adapter.config.debt.address.eq(maxBorrowable.borrowableAsset.address)
32214
+ );
32188
32215
  if (!vesuAdapter) {
32189
- throw new Error(`${this.getTag()}::getAvnuSwapMultiplyCall: vesuAdapter not found for borrowable asset: ${maxBorrowable.borrowableAsset.symbol}`);
32216
+ throw new Error(
32217
+ `${this.getTag()}::getAvnuSwapMultiplyCall: vesuAdapter not found for borrowable asset: ${maxBorrowable.borrowableAsset.symbol}`
32218
+ );
32190
32219
  }
32191
32220
  const maxLTV = await vesuAdapter.getLTVConfig(this.config);
32192
- const debtPrice = await this.pricer.getPrice(maxBorrowable.borrowableAsset.symbol);
32221
+ const debtPrice = await this.pricer.getPrice(
32222
+ maxBorrowable.borrowableAsset.symbol
32223
+ );
32193
32224
  const maxAmountToDeposit = HealthFactorMath.getMinCollateralRequiredOnLooping(
32194
32225
  maxBorrowable.amount,
32195
32226
  debtPrice.price,
@@ -32199,7 +32230,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32199
32230
  this.asset()
32200
32231
  );
32201
32232
  const amountToDeposit = remainingAmount.minimum(maxAmountToDeposit);
32202
- logger.verbose(`${this.getTag()}::getAvnuSwapMultiplyCall::${vesuAdapter.config.debt.symbol}:: remainingAmount: ${remainingAmount}, amountToDeposit: ${amountToDeposit}, depositAmount: ${amountToDeposit}, maxBorrowable: ${maxBorrowable.amount}`);
32233
+ logger.verbose(
32234
+ `${this.getTag()}::getAvnuSwapMultiplyCall::${vesuAdapter.config.debt.symbol}:: remainingAmount: ${remainingAmount}, amountToDeposit: ${amountToDeposit}, depositAmount: ${amountToDeposit}, maxBorrowable: ${maxBorrowable.amount}`
32235
+ );
32203
32236
  const call = await this._getAvnuDepositSwapLegCall({
32204
32237
  isDeposit: params.isDeposit,
32205
32238
  // adjust decimals of debt asset
@@ -32211,36 +32244,60 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32211
32244
  remainingAmount = remainingAmount.minus(amountToDeposit);
32212
32245
  return { call, vesuAdapter };
32213
32246
  }
32214
- throw new Error(`${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`);
32247
+ throw new Error(
32248
+ `${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`
32249
+ );
32215
32250
  }
32216
32251
  async _getAvnuDepositSwapLegCall(params) {
32217
32252
  const { vesuAdapter } = params;
32218
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`);
32219
- assert(params.isDeposit, "Only deposit is supported in _getAvnuDepositSwapLegCall");
32253
+ logger.verbose(
32254
+ `${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`
32255
+ );
32256
+ assert(
32257
+ params.isDeposit,
32258
+ "Only deposit is supported in _getAvnuDepositSwapLegCall"
32259
+ );
32220
32260
  const legLTV = await vesuAdapter.getLTVConfig(this.config);
32221
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`);
32261
+ logger.verbose(
32262
+ `${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`
32263
+ );
32222
32264
  const existingPositions = await vesuAdapter.getPositions(this.config);
32223
- const collateralisation = await vesuAdapter.getCollateralization(this.config);
32265
+ const collateralisation = await vesuAdapter.getCollateralization(
32266
+ this.config
32267
+ );
32224
32268
  const existingCollateralInfo = existingPositions[0];
32225
32269
  const existingDebtInfo = existingPositions[1];
32226
32270
  logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32227
32271
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32228
32272
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32229
32273
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32230
- logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32274
+ logger.debug(
32275
+ `${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
32276
+ );
32231
32277
  const debtTokenInfo = vesuAdapter.config.debt;
32232
32278
  let newDepositAmount = params.leg1DepositAmount;
32233
- const totalCollateral = existingCollateralInfo.amount.plus(params.leg1DepositAmount);
32234
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`);
32279
+ const totalCollateral = existingCollateralInfo.amount.plus(
32280
+ params.leg1DepositAmount
32281
+ );
32282
+ logger.verbose(
32283
+ `${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`
32284
+ );
32235
32285
  const totalDebtAmount = new Web3Number(
32236
32286
  totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF).toString(),
32237
32287
  debtTokenInfo.decimals
32238
32288
  );
32239
32289
  let debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
32240
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}, initial computed debt: ${debtAmount}`);
32241
- const maxBorrowable = await this.getMaxBorrowableAmountByVesuAdapter(vesuAdapter, false);
32290
+ logger.verbose(
32291
+ `${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}, initial computed debt: ${debtAmount}`
32292
+ );
32293
+ const maxBorrowable = await this.getMaxBorrowableAmountByVesuAdapter(
32294
+ vesuAdapter,
32295
+ false
32296
+ );
32242
32297
  if (debtAmount.gt(0) && maxBorrowable.amount.eq(0)) {
32243
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`);
32298
+ logger.verbose(
32299
+ `${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`
32300
+ );
32244
32301
  return void 0;
32245
32302
  } else if (debtAmount.gt(0) && maxBorrowable.amount.gt(0)) {
32246
32303
  debtAmount = maxBorrowable.amount.minimum(debtAmount);
@@ -32253,16 +32310,24 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32253
32310
  collateralPrice,
32254
32311
  this.asset()
32255
32312
  );
32256
- newDepositAmount = totalCollateralRequired.minus(existingCollateralInfo.amount);
32313
+ newDepositAmount = totalCollateralRequired.minus(
32314
+ existingCollateralInfo.amount
32315
+ );
32257
32316
  if (newDepositAmount.lt(0)) {
32258
- throw new Error(`${this.getTag()}::_getAvnuDepositSwapLegCall newDepositAmount is less than 0, newDepositAmount: ${newDepositAmount}, totalCollateralRequired: ${totalCollateralRequired}, existingCollateralInfo.amount: ${existingCollateralInfo.amount}`);
32317
+ throw new Error(
32318
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newDepositAmount is less than 0, newDepositAmount: ${newDepositAmount}, totalCollateralRequired: ${totalCollateralRequired}, existingCollateralInfo.amount: ${existingCollateralInfo.amount}`
32319
+ );
32259
32320
  }
32260
32321
  if (newDebtUSDValue.toNumber() < 100) {
32261
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newDebtUSDValue is less than 100, skipping`);
32322
+ logger.verbose(
32323
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newDebtUSDValue is less than 100, skipping`
32324
+ );
32262
32325
  return void 0;
32263
32326
  }
32264
32327
  }
32265
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`);
32328
+ logger.verbose(
32329
+ `${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`
32330
+ );
32266
32331
  if (debtAmount.lt(0)) {
32267
32332
  const lstDEXPrice = await this.getLSTDexPrice();
32268
32333
  const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
@@ -32271,7 +32336,10 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32271
32336
  leg1DepositAmount: debtAmountInLST,
32272
32337
  poolId: vesuAdapter.config.poolId
32273
32338
  });
32274
- assert(calls.length == 1, `Expected 1 call for unwind, got ${calls.length}`);
32339
+ assert(
32340
+ calls.length == 1,
32341
+ `Expected 1 call for unwind, got ${calls.length}`
32342
+ );
32275
32343
  return calls[0];
32276
32344
  }
32277
32345
  const STEP0 = "approve_token1" /* APPROVE_TOKEN1 */;
@@ -32279,18 +32347,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32279
32347
  const manageCall0 = manage0Info.callConstructor({
32280
32348
  amount: newDepositAmount
32281
32349
  });
32282
- const STEP1 = getVesuLegId("vesu_leg1" /* VESU_LEG1 */, vesuAdapter.config.debt.symbol, vesuAdapter.config.poolId.toString());
32350
+ const STEP1 = getVesuLegId(
32351
+ "vesu_leg1" /* VESU_LEG1 */,
32352
+ vesuAdapter.config.debt.symbol,
32353
+ vesuAdapter.config.poolId.toString()
32354
+ );
32283
32355
  const manage1Info = this.getProofs(STEP1);
32284
- const manageCall1 = manage1Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
32285
- collateralAmount: newDepositAmount,
32286
- isAddCollateral: params.isDeposit,
32287
- debtAmount,
32288
- isBorrow: params.isDeposit
32289
- }));
32356
+ const manageCall1 = manage1Info.callConstructor(
32357
+ VesuAdapter.getDefaultModifyPositionCallParams({
32358
+ collateralAmount: newDepositAmount,
32359
+ isAddCollateral: params.isDeposit,
32360
+ debtAmount,
32361
+ isBorrow: params.isDeposit
32362
+ })
32363
+ );
32290
32364
  const proofIds = [STEP0, STEP1];
32291
32365
  const manageCalls = [manageCall0, manageCall1];
32292
32366
  if (debtAmount.gt(0)) {
32293
- const STEP2 = getAvnuManageIDs("avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */, vesuAdapter.config.debt.symbol);
32367
+ const STEP2 = getAvnuManageIDs(
32368
+ "avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
32369
+ vesuAdapter.config.debt.symbol
32370
+ );
32294
32371
  const manage2Info = this.getProofs(STEP2);
32295
32372
  const manageCall2 = manage2Info.callConstructor({
32296
32373
  amount: debtAmount
@@ -32306,7 +32383,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32306
32383
  );
32307
32384
  const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
32308
32385
  const minAmountWei = minAmount.toWei();
32309
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`);
32386
+ logger.verbose(
32387
+ `${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`
32388
+ );
32310
32389
  const swapInfo = await avnuModule.getSwapInfo(
32311
32390
  quote,
32312
32391
  this.metadata.additionalInfo.vaultAllocator.address,
@@ -32314,8 +32393,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32314
32393
  this.address.address,
32315
32394
  minAmountWei
32316
32395
  );
32317
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`);
32318
- const STEP3 = getAvnuManageIDs("avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, vesuAdapter.config.debt.symbol);
32396
+ logger.verbose(
32397
+ `${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`
32398
+ );
32399
+ const STEP3 = getAvnuManageIDs(
32400
+ "avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */,
32401
+ vesuAdapter.config.debt.symbol
32402
+ );
32319
32403
  const manage3Info = this.getProofs(STEP3);
32320
32404
  const manageCall3 = manage3Info.callConstructor({
32321
32405
  props: swapInfo
@@ -32325,22 +32409,32 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32325
32409
  manageCalls.push(manageCall2, manageCall3);
32326
32410
  const newCollateral = minAmount.plus(totalCollateral);
32327
32411
  const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
32328
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`);
32412
+ logger.verbose(
32413
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`
32414
+ );
32329
32415
  if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
32330
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`);
32416
+ logger.verbose(
32417
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`
32418
+ );
32331
32419
  const STEP4 = "approve_token1" /* APPROVE_TOKEN1 */;
32332
32420
  const manage4Info = this.getProofs(STEP4);
32333
32421
  const manageCall4 = manage4Info.callConstructor({
32334
32422
  amount: minAmount
32335
32423
  });
32336
- const STEP5 = getVesuLegId("vesu_leg1" /* VESU_LEG1 */, vesuAdapter.config.debt.symbol, vesuAdapter.config.poolId.toString());
32424
+ const STEP5 = getVesuLegId(
32425
+ "vesu_leg1" /* VESU_LEG1 */,
32426
+ vesuAdapter.config.debt.symbol,
32427
+ vesuAdapter.config.poolId.toString()
32428
+ );
32337
32429
  const manage5Info = this.getProofs(STEP5);
32338
- const manageCall5 = manage5Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
32339
- collateralAmount: minAmount,
32340
- isAddCollateral: true,
32341
- debtAmount: Web3Number.fromWei("0", this.asset().decimals),
32342
- isBorrow: params.isDeposit
32343
- }));
32430
+ const manageCall5 = manage5Info.callConstructor(
32431
+ VesuAdapter.getDefaultModifyPositionCallParams({
32432
+ collateralAmount: minAmount,
32433
+ isAddCollateral: true,
32434
+ debtAmount: Web3Number.fromWei("0", this.asset().decimals),
32435
+ isBorrow: params.isDeposit
32436
+ })
32437
+ );
32344
32438
  proofIds.push(STEP4, STEP5);
32345
32439
  manageCalls.push(manageCall4, manageCall5);
32346
32440
  }
@@ -32348,11 +32442,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32348
32442
  const manageCall = this.getManageCall(proofIds, manageCalls);
32349
32443
  return manageCall;
32350
32444
  }
32351
- // todo unwind or not deposit when the yield is bad.
32445
+ // todo unwind or not deposit when the yield is bad.
32352
32446
  async getLSTMultiplierRebalanceCall() {
32353
32447
  let shouldRebalance = false;
32354
32448
  const calls = [];
32355
- const allVesuAdapters = this.getVesuAdapters().filter((vesuAdapter) => vesuAdapter.config.debt.symbol === "LBTC");
32449
+ const allVesuAdapters = this.getVesuAdapters().filter(
32450
+ (vesuAdapter) => vesuAdapter.config.debt.symbol === "LBTC"
32451
+ );
32356
32452
  for (const vesuAdapter of allVesuAdapters) {
32357
32453
  const call = await this._getLSTMultiplierRebalanceCall(vesuAdapter);
32358
32454
  if (call.shouldRebalance && call.manageCall) {
@@ -32364,18 +32460,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32364
32460
  }
32365
32461
  async _getLSTMultiplierRebalanceCall(vesuAdapter) {
32366
32462
  const positions = await vesuAdapter.getPositions(this.config);
32367
- assert(positions.length == 2, "Rebalance call is only supported for 2 positions");
32463
+ assert(
32464
+ positions.length == 2,
32465
+ "Rebalance call is only supported for 2 positions"
32466
+ );
32368
32467
  const existingCollateralInfo = positions[0];
32369
32468
  const existingDebtInfo = positions[1];
32370
32469
  const unusedBalance = await this.getUnusedBalance();
32371
32470
  const healthFactor = await vesuAdapter.getHealthFactor();
32372
- const collateralisation = await vesuAdapter.getCollateralization(this.config);
32471
+ const collateralisation = await vesuAdapter.getCollateralization(
32472
+ this.config
32473
+ );
32373
32474
  logger.debug(`${this.getTag()}::getVesuMultiplyCall::${vesuAdapter.config.debt.symbol} existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32374
32475
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32375
32476
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32376
32477
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32377
- logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32378
- logger.debug(`${this.getTag()}::getVesuMultiplyCall healthFactor: ${healthFactor}`);
32478
+ logger.debug(
32479
+ `${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
32480
+ );
32481
+ logger.debug(
32482
+ `${this.getTag()}::getVesuMultiplyCall healthFactor: ${healthFactor}`
32483
+ );
32379
32484
  const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
32380
32485
  const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
32381
32486
  if (isHFTooLow || isHFTooHigh || 1) {
@@ -32383,7 +32488,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32383
32488
  isDeposit: true,
32384
32489
  leg1DepositAmount: unusedBalance.amount,
32385
32490
  minHF: 1.02,
32386
- // todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
32491
+ // todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
32387
32492
  vesuAdapter
32388
32493
  });
32389
32494
  return { shouldRebalance: true, manageCall };
@@ -32394,29 +32499,44 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32394
32499
  async getVesuAUM(adapter, priceType = "AVNU_PRICE" /* AVNU_PRICE */) {
32395
32500
  const legAUM = await adapter.getPositions(this.config);
32396
32501
  const underlying = this.asset();
32397
- assert(underlying.symbol.startsWith("x"), "Underlying is not an LST of Endur");
32502
+ assert(
32503
+ underlying.symbol.startsWith("x"),
32504
+ "Underlying is not an LST of Endur"
32505
+ );
32398
32506
  let vesuAum = Web3Number.fromWei("0", underlying.decimals);
32399
32507
  let tokenUnderlyingPrice;
32400
32508
  if (priceType === "ENDUR_PRICE" /* ENDUR_PRICE */) {
32401
32509
  tokenUnderlyingPrice = await this.getLSTExchangeRate();
32402
32510
  if (tokenUnderlyingPrice === 0) {
32403
- throw new Error(`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Endur) is 0`);
32511
+ throw new Error(
32512
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Endur) is 0`
32513
+ );
32404
32514
  }
32405
32515
  const avnuRate = await this.getLSTAvnuRate();
32406
32516
  if (avnuRate === 0) {
32407
- throw new Error(`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`);
32517
+ throw new Error(
32518
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
32519
+ );
32408
32520
  }
32409
32521
  const diff = Math.abs(tokenUnderlyingPrice - avnuRate) / tokenUnderlyingPrice;
32410
32522
  if (diff > 0.02) {
32411
- throw new Error(`${this.getTag()}::getVesuAUM: Endur and Avnu prices differ by more than 2% (Endur: ${tokenUnderlyingPrice}, Avnu: ${avnuRate})`);
32523
+ throw new Error(
32524
+ `${this.getTag()}::getVesuAUM: Endur and Avnu prices differ by more than 2% (Endur: ${tokenUnderlyingPrice}, Avnu: ${avnuRate})`
32525
+ );
32412
32526
  }
32413
- logger.verbose(`${this.getTag()} tokenUnderlyingPrice (Endur): ${tokenUnderlyingPrice}, avnuRate: ${avnuRate}, diff: ${diff}`);
32527
+ logger.verbose(
32528
+ `${this.getTag()} tokenUnderlyingPrice (Endur): ${tokenUnderlyingPrice}, avnuRate: ${avnuRate}, diff: ${diff}`
32529
+ );
32414
32530
  } else {
32415
32531
  tokenUnderlyingPrice = await this.getLSTAvnuRate();
32416
32532
  if (tokenUnderlyingPrice === 0) {
32417
- throw new Error(`${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`);
32533
+ throw new Error(
32534
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
32535
+ );
32418
32536
  }
32419
- logger.verbose(`${this.getTag()} tokenUnderlyingPrice (Avnu): ${tokenUnderlyingPrice}`);
32537
+ logger.verbose(
32538
+ `${this.getTag()} tokenUnderlyingPrice (Avnu): ${tokenUnderlyingPrice}`
32539
+ );
32420
32540
  }
32421
32541
  if (legAUM[0].token.address.eq(underlying.address)) {
32422
32542
  vesuAum = vesuAum.plus(legAUM[0].amount);
@@ -32428,9 +32548,10 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32428
32548
  } else {
32429
32549
  vesuAum = vesuAum.minus(legAUM[1].amount.dividedBy(tokenUnderlyingPrice));
32430
32550
  }
32431
- ;
32432
32551
  const priceTypeLabel = priceType === "ENDUR_PRICE" /* ENDUR_PRICE */ ? "Endur Price" : "Avnu Price";
32433
- logger.verbose(`${this.getTag()} Vesu AUM (${priceTypeLabel}): ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
32552
+ logger.verbose(
32553
+ `${this.getTag()} Vesu AUM (${priceTypeLabel}): ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`
32554
+ );
32434
32555
  return vesuAum;
32435
32556
  }
32436
32557
  async getTVLUnrealized() {
@@ -32461,11 +32582,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32461
32582
  return minOutputAmount;
32462
32583
  }
32463
32584
  // todo add a function to findout max borrowable amount without fucking yield
32464
- // if the current net yield < LST yield, add a function to calculate how much to unwind.
32585
+ // if the current net yield < LST yield, add a function to calculate how much to unwind.
32465
32586
  /**
32466
32587
  * Uses vesu's multiple call to create leverage on LST
32467
32588
  * Deposit amount is in LST
32468
- * @param params
32589
+ * @param params
32469
32590
  */
32470
32591
  async getVesuMultiplyCall(params) {
32471
32592
  const maxEkuboPriceImpact = params.maxEkuboPriceImpact || 0.01;
@@ -32474,32 +32595,54 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32474
32595
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
32475
32596
  if (!params.isDeposit) {
32476
32597
  const unusedBalance = await this.getUnusedBalance();
32477
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall unusedBalance: ${unusedBalance.amount.toString()}, required: ${params.leg1DepositAmount.toString()}`);
32598
+ logger.verbose(
32599
+ `${this.getTag()}::getVesuMultiplyCall unusedBalance: ${unusedBalance.amount.toString()}, required: ${params.leg1DepositAmount.toString()}`
32600
+ );
32478
32601
  }
32479
32602
  const existingPositions = await vesuAdapter1.getPositions(this.config);
32480
- const collateralisation = await vesuAdapter1.getCollateralization(this.config);
32603
+ const collateralisation = await vesuAdapter1.getCollateralization(
32604
+ this.config
32605
+ );
32481
32606
  const existingCollateralInfo = existingPositions[0];
32482
32607
  const existingDebtInfo = existingPositions[1];
32483
32608
  logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32484
32609
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32485
32610
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32486
32611
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32487
- logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32612
+ logger.debug(
32613
+ `${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
32614
+ );
32488
32615
  const dexPrice = await this.getLSTDexPrice();
32489
- const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
32490
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
32616
+ const addedCollateral = params.leg1DepositAmount.multipliedBy(
32617
+ params.isDeposit ? 1 : -1
32618
+ );
32619
+ logger.verbose(
32620
+ `${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`
32621
+ );
32491
32622
  const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
32492
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`);
32623
+ logger.verbose(
32624
+ `${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`
32625
+ );
32493
32626
  const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
32494
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`);
32627
+ logger.verbose(
32628
+ `${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`
32629
+ );
32495
32630
  const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
32496
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`);
32631
+ logger.verbose(
32632
+ `${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`
32633
+ );
32497
32634
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
32498
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
32499
- logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
32635
+ logger.verbose(
32636
+ `${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`
32637
+ );
32638
+ logger.debug(
32639
+ `${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`
32640
+ );
32500
32641
  let debtAmount = x_debt_usd.dividedBy(debtPrice);
32501
32642
  const marginAmount = addedCollateral;
32502
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
32643
+ logger.verbose(
32644
+ `${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`
32645
+ );
32503
32646
  if (marginAmount.lt(0) && debtAmount.gt(0)) {
32504
32647
  debtAmount = Web3Number.fromWei(0, this.asset().decimals);
32505
32648
  }
@@ -32513,31 +32656,49 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32513
32656
  });
32514
32657
  }
32515
32658
  getLSTUnderlyingTokenInfo() {
32516
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32659
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32660
+ this.metadata.additionalInfo.defaultPoolId
32661
+ );
32517
32662
  return vesuAdapter1.config.debt;
32518
32663
  }
32519
32664
  async getMaxBorrowableAmount(params = { isAPYComputation: false }) {
32520
32665
  const vesuAdapters = this.getVesuAdapters();
32521
- let netMaxBorrowableAmount = Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals);
32666
+ let netMaxBorrowableAmount = Web3Number.fromWei(
32667
+ "0",
32668
+ this.getLSTUnderlyingTokenInfo().decimals
32669
+ );
32522
32670
  const maxBorrowables = [];
32523
32671
  for (const vesuAdapter of vesuAdapters) {
32524
- const output = await this.getMaxBorrowableAmountByVesuAdapter(vesuAdapter, params.isAPYComputation);
32672
+ const output = await this.getMaxBorrowableAmountByVesuAdapter(
32673
+ vesuAdapter,
32674
+ params.isAPYComputation
32675
+ );
32525
32676
  const ltv = await vesuAdapter.getLTVConfig(this.config);
32526
32677
  maxBorrowables.push({ ...output, ltv });
32527
32678
  }
32528
32679
  maxBorrowables.sort((a, b) => b.amount.toNumber() - a.amount.toNumber());
32529
- netMaxBorrowableAmount = maxBorrowables.reduce((acc, curr) => acc.plus(curr.amount), Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals));
32680
+ netMaxBorrowableAmount = maxBorrowables.reduce(
32681
+ (acc, curr) => acc.plus(curr.amount),
32682
+ Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals)
32683
+ );
32530
32684
  return { netMaxBorrowableAmount, maxBorrowables };
32531
32685
  }
32532
- // recursively, using binary search computes max swappable.
32686
+ // recursively, using binary search computes max swappable.
32533
32687
  // @dev assumes 1 token of from == 1 token of to
32534
32688
  async getMaxSwappableWithMaxSlippage(fromToken, toToken, maxSlippage, maxAmount) {
32535
32689
  const output = await findMaxInputWithSlippage({
32536
32690
  apiGetOutput: async (inputAmount) => {
32537
32691
  const ekuboQuoter = new EkuboQuoter(this.config);
32538
32692
  await new Promise((resolve) => setTimeout(resolve, 1e3));
32539
- const quote = await ekuboQuoter.getQuote(fromToken.address.address, toToken.address.address, new Web3Number(inputAmount.toFixed(9), fromToken.decimals));
32540
- return Web3Number.fromWei(quote.total_calculated.toString(), toToken.decimals).toNumber();
32693
+ const quote = await ekuboQuoter.getQuote(
32694
+ fromToken.address.address,
32695
+ toToken.address.address,
32696
+ new Web3Number(inputAmount.toFixed(9), fromToken.decimals)
32697
+ );
32698
+ return Web3Number.fromWei(
32699
+ quote.total_calculated.toString(),
32700
+ toToken.decimals
32701
+ ).toNumber();
32541
32702
  },
32542
32703
  maxInput: maxAmount.toNumber(),
32543
32704
  maxSlippagePercent: maxSlippage,
@@ -32547,38 +32708,84 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32547
32708
  return new Web3Number(output.optimalInput, fromToken.decimals);
32548
32709
  }
32549
32710
  async getMaxBorrowableAmountByVesuAdapter(vesuAdapter, isAPYComputation) {
32550
- const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
32711
+ const lstAPY = await this.getLSTAPR(
32712
+ this.getLSTUnderlyingTokenInfo().address
32713
+ );
32551
32714
  const maxInterestRate = lstAPY * 0.8;
32552
- const { maxDebtToHave: maxBorrowableAmount, currentDebt } = await vesuAdapter.getMaxBorrowableByInterestRate(this.config, vesuAdapter.config.debt, maxInterestRate);
32715
+ const { maxDebtToHave: maxBorrowableAmount, currentDebt } = await vesuAdapter.getMaxBorrowableByInterestRate(
32716
+ this.config,
32717
+ vesuAdapter.config.debt,
32718
+ maxInterestRate
32719
+ );
32553
32720
  const debtCap = await vesuAdapter.getDebtCap(this.config);
32554
32721
  if (currentDebt.gte(debtCap)) {
32555
- 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 };
32722
+ return {
32723
+ amount: Web3Number.fromWei("0", vesuAdapter.config.debt.decimals),
32724
+ dexSwappableAmount: Web3Number.fromWei(
32725
+ "0",
32726
+ vesuAdapter.config.debt.decimals
32727
+ ),
32728
+ maxBorrowableAmount: Web3Number.fromWei(
32729
+ "0",
32730
+ vesuAdapter.config.debt.decimals
32731
+ ),
32732
+ borrowableAsset: vesuAdapter.config.debt
32733
+ };
32556
32734
  }
32557
32735
  const availableToBorrow = debtCap.minus(currentDebt);
32558
32736
  const maxBorrowable = maxBorrowableAmount.minimum(availableToBorrow).multipliedBy(0.999);
32559
- if (vesuAdapter.config.debt.address.eq(this.getLSTUnderlyingTokenInfo().address) || isAPYComputation) {
32560
- return { amount: maxBorrowable, dexSwappableAmount: maxBorrowable, maxBorrowableAmount: maxBorrowable, borrowableAsset: vesuAdapter.config.debt };
32737
+ if (vesuAdapter.config.debt.address.eq(
32738
+ this.getLSTUnderlyingTokenInfo().address
32739
+ ) || isAPYComputation) {
32740
+ return {
32741
+ amount: maxBorrowable,
32742
+ dexSwappableAmount: maxBorrowable,
32743
+ maxBorrowableAmount: maxBorrowable,
32744
+ borrowableAsset: vesuAdapter.config.debt
32745
+ };
32561
32746
  }
32562
32747
  try {
32563
- const maxSwappable = await this.getMaxSwappableWithMaxSlippage(vesuAdapter.config.debt, this.getLSTUnderlyingTokenInfo(), 2e-4, maxBorrowable);
32564
- return { amount: maxBorrowable.minimum(maxSwappable), dexSwappableAmount: maxSwappable, maxBorrowableAmount: maxBorrowable, borrowableAsset: vesuAdapter.config.debt };
32748
+ const maxSwappable = await this.getMaxSwappableWithMaxSlippage(
32749
+ vesuAdapter.config.debt,
32750
+ this.getLSTUnderlyingTokenInfo(),
32751
+ 2e-4,
32752
+ maxBorrowable
32753
+ );
32754
+ return {
32755
+ amount: maxBorrowable.minimum(maxSwappable),
32756
+ dexSwappableAmount: maxSwappable,
32757
+ maxBorrowableAmount: maxBorrowable,
32758
+ borrowableAsset: vesuAdapter.config.debt
32759
+ };
32565
32760
  } catch (error) {
32566
32761
  logger.warn(`${this.getTag()}: Failed to get max swappable: ${error}`);
32567
- const maxSwappable = Web3Number.fromWei("0", vesuAdapter.config.debt.decimals);
32568
- return { amount: maxBorrowable.minimum(maxSwappable), dexSwappableAmount: maxSwappable, maxBorrowableAmount: maxBorrowable, borrowableAsset: vesuAdapter.config.debt };
32762
+ const maxSwappable = Web3Number.fromWei(
32763
+ "0",
32764
+ vesuAdapter.config.debt.decimals
32765
+ );
32766
+ return {
32767
+ amount: maxBorrowable.minimum(maxSwappable),
32768
+ dexSwappableAmount: maxSwappable,
32769
+ maxBorrowableAmount: maxBorrowable,
32770
+ borrowableAsset: vesuAdapter.config.debt
32771
+ };
32569
32772
  }
32570
32773
  }
32571
32774
  // todo how much to unwind to get back healthy APY zone again
32572
32775
  // if net APY < LST APR + 0.5%, we need to unwind to get back to LST APR + 1% atleast or 0 vesu position
32573
- // For xSTRK, simply deposit in Vesu if looping is not viable
32776
+ // For xSTRK, simply deposit in Vesu if looping is not viable
32574
32777
  /**
32575
32778
  * Gets LST APR for the strategy's underlying asset from Endur API
32576
32779
  * @returns Promise<number> The LST APR (not divided by 1e18)
32577
32780
  */
32578
32781
  async getLSTAPR(_address) {
32579
32782
  try {
32580
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32581
- const apr = await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
32783
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32784
+ this.metadata.additionalInfo.defaultPoolId
32785
+ );
32786
+ const apr = await LSTAPRService.getLSTAPR(
32787
+ vesuAdapter1.config.debt.address
32788
+ );
32582
32789
  if (!apr) {
32583
32790
  throw new Error("Failed to get LST APR");
32584
32791
  }
@@ -32591,19 +32798,37 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32591
32798
  // todo undo this
32592
32799
  async netAPY() {
32593
32800
  const unusedBalance = await this.getUnusedBalance();
32594
- const maxNewDeposits = await this.maxNewDeposits({ isAPYComputation: true });
32595
- const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
32801
+ const maxNewDeposits = await this.maxNewDeposits({
32802
+ isAPYComputation: true
32803
+ });
32804
+ const lstAPY = await this.getLSTAPR(
32805
+ this.getLSTUnderlyingTokenInfo().address
32806
+ );
32596
32807
  if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
32597
- logger.verbose(`${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`);
32808
+ logger.verbose(
32809
+ `${this.getTag()}::netAPY: unused balance is > max servicable from loan, lstAPY: ${lstAPY}`
32810
+ );
32598
32811
  const output = await super.netAPY();
32599
32812
  output.splits.push({ apy: lstAPY, id: "lst_apy" });
32600
32813
  return output;
32601
32814
  } else {
32602
- logger.verbose(`${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`);
32815
+ logger.verbose(
32816
+ `${this.getTag()}::netAPY: we can take more deposits, use theoretical max APY`
32817
+ );
32603
32818
  const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
32604
- const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
32819
+ const weights = positions.map(
32820
+ (p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1)
32821
+ );
32605
32822
  const aum = weights.reduce((acc, curr) => acc + curr, 0);
32606
- const output = await this.returnNetAPY(baseAPYs, rewardAPYs, weights, new Web3Number(aum.toFixed(9), this.getLSTUnderlyingTokenInfo().decimals));
32823
+ const output = await this.returnNetAPY(
32824
+ baseAPYs,
32825
+ rewardAPYs,
32826
+ weights,
32827
+ new Web3Number(
32828
+ aum.toFixed(9),
32829
+ this.getLSTUnderlyingTokenInfo().decimals
32830
+ )
32831
+ );
32607
32832
  output.splits.push({ apy: lstAPY, id: "lst_apy" });
32608
32833
  return output;
32609
32834
  }
@@ -32613,9 +32838,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32613
32838
  let numerator = 0;
32614
32839
  let ltv = void 0;
32615
32840
  for (let adapter of this.getVesuAdapters()) {
32616
- const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find((b) => b.borrowableAsset.address.eq(adapter.config.debt.address));
32841
+ const maxBorrowableAmountInfo = maxBorrowableAmounts.maxBorrowables.find(
32842
+ (b) => b.borrowableAsset.address.eq(adapter.config.debt.address)
32843
+ );
32617
32844
  if (!maxBorrowableAmountInfo || !maxBorrowableAmountInfo?.amount) {
32618
- throw new Error(`Max borrowable amount not found for adapter: ${adapter.config.debt.symbol}`);
32845
+ throw new Error(
32846
+ `Max borrowable amount not found for adapter: ${adapter.config.debt.symbol}`
32847
+ );
32619
32848
  }
32620
32849
  numerator += this.metadata.additionalInfo.targetHealthFactor * maxBorrowableAmountInfo.amount.toNumber() / maxBorrowableAmountInfo.ltv;
32621
32850
  }
@@ -32624,7 +32853,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32624
32853
  // todo revisit cases where 0th adapters is used
32625
32854
  async getUnusedBalanceAPY() {
32626
32855
  const unusedBalance = await this.getUnusedBalance();
32627
- const vesuAdapter = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32856
+ const vesuAdapter = this.getVesuSameTokenAdapter(
32857
+ this.metadata.additionalInfo.defaultPoolId
32858
+ );
32628
32859
  const underlying = vesuAdapter.config.debt;
32629
32860
  const lstAPY = await this.getLSTAPR(underlying.address);
32630
32861
  return {
@@ -32633,11 +32864,16 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32633
32864
  };
32634
32865
  }
32635
32866
  async getLSTAvnuRate() {
32636
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32867
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32868
+ this.metadata.additionalInfo.defaultPoolId
32869
+ );
32637
32870
  const lstTokenInfo = vesuAdapter1.config.collateral;
32638
32871
  const underlyingTokenInfo = vesuAdapter1.config.debt;
32639
32872
  const avnuModule = new AvnuWrapper();
32640
- const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(lstTokenInfo.priceCheckAmount, underlyingTokenInfo.decimals) : new Web3Number(1, underlyingTokenInfo.decimals);
32873
+ const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(
32874
+ lstTokenInfo.priceCheckAmount,
32875
+ underlyingTokenInfo.decimals
32876
+ ) : new Web3Number(1, underlyingTokenInfo.decimals);
32641
32877
  const quote = await avnuModule.getQuotes(
32642
32878
  underlyingTokenInfo.address.address,
32643
32879
  lstTokenInfo.address.address,
@@ -32651,40 +32887,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32651
32887
  ).toNumber();
32652
32888
  assert(lstAmountNumber > 0, "Avnu LST amount is zero");
32653
32889
  const exchangeRate = underlyingAmountNumber / lstAmountNumber;
32654
- logger.verbose(`${this.getTag()}:: LST Avnu Exchange Rate: ${exchangeRate}`);
32890
+ logger.verbose(
32891
+ `${this.getTag()}:: LST Avnu Exchange Rate: ${exchangeRate}`
32892
+ );
32655
32893
  return exchangeRate;
32656
32894
  }
32657
32895
  async getLSTExchangeRate() {
32658
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32896
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32897
+ this.metadata.additionalInfo.defaultPoolId
32898
+ );
32659
32899
  const lstTokenInfo = vesuAdapter1.config.collateral;
32660
32900
  const lstABI = new Contract11({
32661
32901
  abi: erc4626_abi_default,
32662
32902
  address: lstTokenInfo.address.address,
32663
32903
  providerOrAccount: this.config.provider
32664
32904
  });
32665
- const price = await lstABI.call("convert_to_assets", [uint25610.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())]);
32905
+ const price = await lstABI.call("convert_to_assets", [
32906
+ uint25610.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())
32907
+ ]);
32666
32908
  const exchangeRate = Number(uint25610.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
32667
32909
  logger.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
32668
32910
  return exchangeRate;
32669
32911
  }
32670
32912
  /**
32671
- *
32913
+ *
32672
32914
  * @param params marginAmount is in LST, debtAmount is in underlying
32673
32915
  */
32674
32916
  async getModifyLeverCall(params) {
32675
- logger.verbose(`${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`);
32676
- assert(!params.marginAmount.isZero() || !params.debtAmount.isZero(), "Deposit/debt must be non-0");
32917
+ logger.verbose(
32918
+ `${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`
32919
+ );
32920
+ assert(
32921
+ !params.marginAmount.isZero() || !params.debtAmount.isZero(),
32922
+ "Deposit/debt must be non-0"
32923
+ );
32677
32924
  const vesuAdapter1 = this.getVesuSameTokenAdapter(params.poolId);
32678
32925
  const lstTokenInfo = this.asset();
32679
32926
  const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
32680
32927
  const maxAmounts = lstTokenInfo.symbol == "xSTRK" ? 5e5 : 0.5;
32681
32928
  if (params.marginAmount.greaterThan(maxAmounts)) {
32682
- throw new Error(`Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`);
32929
+ throw new Error(
32930
+ `Margin amount is greater than max amount: ${params.marginAmount.toNumber()} > ${maxAmounts}`
32931
+ );
32683
32932
  }
32684
32933
  const proofsIDs = [];
32685
32934
  const manageCalls = [];
32686
32935
  if (params.marginAmount.greaterThan(0)) {
32687
- const STEP1_ID = getVesuGenericLegId(params.poolId.toString(), "multiple_approve" /* MULTIPLE_APPROVE */);
32936
+ const STEP1_ID = getVesuGenericLegId(
32937
+ params.poolId.toString(),
32938
+ "multiple_approve" /* MULTIPLE_APPROVE */
32939
+ );
32688
32940
  const manage1Info = this.getProofs(STEP1_ID);
32689
32941
  const depositAmount = params.marginAmount;
32690
32942
  const manageCall1 = manage1Info.callConstructor({
@@ -32705,31 +32957,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32705
32957
  params.debtAmount
32706
32958
  // negative for exact amount out
32707
32959
  );
32708
- logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`);
32709
- assert(leverSwapQuote.price_impact <= params.maxEkuboPriceImpact, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
32710
- const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
32711
- logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`);
32960
+ logger.verbose(
32961
+ `${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`
32962
+ );
32963
+ assert(
32964
+ leverSwapQuote.price_impact <= params.maxEkuboPriceImpact,
32965
+ "getIncreaseLeverCall: Price impact is too high [Debt swap]"
32966
+ );
32967
+ const leverSwap = ekuboQuoter.getVesuMultiplyQuote(
32968
+ leverSwapQuote,
32969
+ fromToken,
32970
+ toToken
32971
+ );
32972
+ logger.verbose(
32973
+ `${this.getTag()}::getModifyLeverCall leverSwap: ${JSON.stringify(leverSwap)}`
32974
+ );
32712
32975
  let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
32713
32976
  const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
32714
32977
  minLSTReceived = minLSTReceivedAsPerTruePrice;
32715
- logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
32978
+ logger.verbose(
32979
+ `${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`
32980
+ );
32716
32981
  let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
32717
32982
  const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
32718
- logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
32983
+ logger.verbose(
32984
+ `${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`
32985
+ );
32719
32986
  maxUsedCollateral = maxUsedCollateralInLST;
32720
- const STEP2_ID = getVesuGenericLegId(params.poolId.toString(), "switch_delegation_on" /* SWITCH_DELEGATION_ON */);
32987
+ const STEP2_ID = getVesuGenericLegId(
32988
+ params.poolId.toString(),
32989
+ "switch_delegation_on" /* SWITCH_DELEGATION_ON */
32990
+ );
32721
32991
  const manage2Info = this.getProofs(STEP2_ID);
32722
32992
  const manageCall2 = manage2Info.callConstructor({
32723
32993
  delegation: true
32724
32994
  });
32725
- const STEP3_ID = getVesuLegId("multiply_vesu" /* MULTIPLY_VESU */, vesuAdapter1.config.debt.symbol, vesuAdapter1.config.poolId.toString());
32995
+ const STEP3_ID = getVesuLegId(
32996
+ "multiply_vesu" /* MULTIPLY_VESU */,
32997
+ vesuAdapter1.config.debt.symbol,
32998
+ vesuAdapter1.config.poolId.toString()
32999
+ );
32726
33000
  const manage3Info = this.getProofs(STEP3_ID);
32727
33001
  const multiplyParams = params.isIncrease ? {
32728
33002
  isIncrease: true,
32729
33003
  increaseParams: {
32730
33004
  add_margin: params.marginAmount,
32731
33005
  margin_swap: [],
32732
- margin_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
33006
+ margin_swap_limit_amount: Web3Number.fromWei(
33007
+ 0,
33008
+ this.asset().decimals
33009
+ ),
32733
33010
  lever_swap: leverSwap,
32734
33011
  lever_swap_limit_amount: minLSTReceived
32735
33012
  }
@@ -32741,15 +33018,21 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32741
33018
  lever_swap_limit_amount: maxUsedCollateral,
32742
33019
  // only required for close position
32743
33020
  lever_swap_weights: [],
32744
- // no need to swap collateral to anything, and any residuals return our contract anyways.
33021
+ // no need to swap collateral to anything, and any residuals return our contract anyways.
32745
33022
  withdraw_swap: [],
32746
- withdraw_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
33023
+ withdraw_swap_limit_amount: Web3Number.fromWei(
33024
+ 0,
33025
+ this.asset().decimals
33026
+ ),
32747
33027
  withdraw_swap_weights: [],
32748
33028
  close_position: false
32749
33029
  }
32750
33030
  };
32751
33031
  const manageCall3 = manage3Info.callConstructor(multiplyParams);
32752
- const STEP4_ID = getVesuGenericLegId(params.poolId.toString(), "switch_delegation_off" /* SWITCH_DELEGATION_OFF */);
33032
+ const STEP4_ID = getVesuGenericLegId(
33033
+ params.poolId.toString(),
33034
+ "switch_delegation_off" /* SWITCH_DELEGATION_OFF */
33035
+ );
32753
33036
  const manage4Info = this.getProofs(STEP4_ID);
32754
33037
  const manageCall4 = manage4Info.callConstructor({
32755
33038
  delegation: false
@@ -32763,7 +33046,6 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
32763
33046
  const containerStyle = {
32764
33047
  maxWidth: "800px",
32765
33048
  margin: "0 auto",
32766
- backgroundColor: "#111",
32767
33049
  color: "#eee",
32768
33050
  fontFamily: "Arial, sans-serif",
32769
33051
  borderRadius: "12px"
@@ -32786,21 +33068,52 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
32786
33068
  " to create leverage. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield."
32787
33069
  ] }),
32788
33070
  /* @__PURE__ */ jsxs4("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: [
32789
- "This vault uses Vesu for lending and borrowing. The oracle used by this pool is a ",
32790
- highlightTextWithLinks("conversion rate oracle", [{ highlight: "conversion rate oracle", link: "https://docs.pragma.build/starknet/development#conversion-rate" }]),
33071
+ "This vault uses Vesu for lending and borrowing. The oracle used by this pool is a",
33072
+ " ",
33073
+ highlightTextWithLinks("conversion rate oracle", [
33074
+ {
33075
+ highlight: "conversion rate oracle",
33076
+ link: "https://docs.pragma.build/starknet/development#conversion-rate"
33077
+ }
33078
+ ]),
32791
33079
  " ",
32792
33080
  "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."
32793
33081
  ] }),
32794
- /* @__PURE__ */ jsx5("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
32795
- /* @__PURE__ */ jsx5("strong", { children: "Withdrawals:" }),
32796
- " Requests can take up to ",
32797
- /* @__PURE__ */ jsx5("strong", { children: "1-2 hours" }),
32798
- " to process as the vault unwinds and settles routing."
32799
- ] }) }),
32800
- /* @__PURE__ */ jsx5("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
32801
- /* @__PURE__ */ jsx5("strong", { children: "Debt limits:" }),
32802
- " 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."
32803
- ] }) })
33082
+ /* @__PURE__ */ jsx5(
33083
+ "div",
33084
+ {
33085
+ style: {
33086
+ backgroundColor: "#222",
33087
+ padding: "10px",
33088
+ borderRadius: "8px",
33089
+ marginBottom: "20px",
33090
+ border: "1px solid #444"
33091
+ },
33092
+ children: /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
33093
+ /* @__PURE__ */ jsx5("strong", { children: "Withdrawals:" }),
33094
+ " Requests can take up to",
33095
+ " ",
33096
+ /* @__PURE__ */ jsx5("strong", { children: "1-2 hours" }),
33097
+ " to process as the vault unwinds and settles routing."
33098
+ ] })
33099
+ }
33100
+ ),
33101
+ /* @__PURE__ */ jsx5(
33102
+ "div",
33103
+ {
33104
+ style: {
33105
+ backgroundColor: "#222",
33106
+ padding: "10px",
33107
+ borderRadius: "8px",
33108
+ marginBottom: "20px",
33109
+ border: "1px solid #444"
33110
+ },
33111
+ children: /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
33112
+ /* @__PURE__ */ jsx5("strong", { children: "Debt limits:" }),
33113
+ " 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."
33114
+ ] })
33115
+ }
33116
+ )
32804
33117
  ] });
32805
33118
  }
32806
33119
  function getDescription2(tokenSymbol, underlyingSymbol) {
@@ -32816,31 +33129,76 @@ function getVesuLegId(baseID, debtTokenSymbol, poolId) {
32816
33129
  return `${baseID}_${debtTokenSymbol.toLowerCase()}_${poolId.slice(-4).toLowerCase()}`;
32817
33130
  }
32818
33131
  function addVesuLeaves(poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter) {
32819
- const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
32820
- const underlyingToken = Global.getDefaultTokens().find((token) => token.symbol === underlyingSymbol);
33132
+ const lstToken = Global.getDefaultTokens().find(
33133
+ (token) => token.symbol === lstSymbol
33134
+ );
33135
+ const underlyingToken = Global.getDefaultTokens().find(
33136
+ (token) => token.symbol === underlyingSymbol
33137
+ );
32821
33138
  const vesuAdapterLST = new VesuAdapter({
32822
33139
  poolId,
32823
33140
  collateral: lstToken,
32824
33141
  debt: underlyingToken,
32825
33142
  vaultAllocator: vaultSettings.vaultAllocator,
32826
- id: getVesuLegId("vesu_leg1" /* VESU_LEG1 */, underlyingToken.symbol, poolId.toString())
33143
+ id: getVesuLegId(
33144
+ "vesu_leg1" /* VESU_LEG1 */,
33145
+ underlyingToken.symbol,
33146
+ poolId.toString()
33147
+ )
32827
33148
  });
32828
- vaultSettings.adapters.push(...[{
32829
- id: getVesuLegId("vesu_leg1" /* VESU_LEG1 */, underlyingToken.symbol, poolId.toString()),
32830
- adapter: vesuAdapterLST
32831
- }]);
33149
+ vaultSettings.adapters.push(
33150
+ ...[
33151
+ {
33152
+ id: getVesuLegId(
33153
+ "vesu_leg1" /* VESU_LEG1 */,
33154
+ underlyingToken.symbol,
33155
+ poolId.toString()
33156
+ ),
33157
+ adapter: vesuAdapterLST
33158
+ }
33159
+ ]
33160
+ );
32832
33161
  const { isV2, addr: poolAddr } = getVesuSingletonAddress(poolId);
32833
33162
  const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
32834
- const leafIdApprove = getVesuGenericLegId(poolId.toString(), "multiple_approve" /* MULTIPLE_APPROVE */);
32835
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter));
32836
- const leafIdDelegationOn = getVesuGenericLegId(poolId.toString(), "switch_delegation_on" /* SWITCH_DELEGATION_ON */);
32837
- vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST));
32838
- const leafIdDelegationOff = getVesuGenericLegId(poolId.toString(), "switch_delegation_off" /* SWITCH_DELEGATION_OFF */);
32839
- vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST));
32840
- const multiplID = getVesuLegId("multiply_vesu" /* MULTIPLY_VESU */, underlyingToken.symbol, poolId.toString());
32841
- vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST));
32842
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
32843
- vaultSettings.leafAdapters.push(vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST));
33163
+ const leafIdApprove = getVesuGenericLegId(
33164
+ poolId.toString(),
33165
+ "multiple_approve" /* MULTIPLE_APPROVE */
33166
+ );
33167
+ vaultSettings.leafAdapters.push(
33168
+ commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter)
33169
+ );
33170
+ const leafIdDelegationOn = getVesuGenericLegId(
33171
+ poolId.toString(),
33172
+ "switch_delegation_on" /* SWITCH_DELEGATION_ON */
33173
+ );
33174
+ vaultSettings.leafAdapters.push(
33175
+ vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST)
33176
+ );
33177
+ const leafIdDelegationOff = getVesuGenericLegId(
33178
+ poolId.toString(),
33179
+ "switch_delegation_off" /* SWITCH_DELEGATION_OFF */
33180
+ );
33181
+ vaultSettings.leafAdapters.push(
33182
+ vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST)
33183
+ );
33184
+ const multiplID = getVesuLegId(
33185
+ "multiply_vesu" /* MULTIPLY_VESU */,
33186
+ underlyingToken.symbol,
33187
+ poolId.toString()
33188
+ );
33189
+ vaultSettings.leafAdapters.push(
33190
+ vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST)
33191
+ );
33192
+ vaultSettings.leafAdapters.push(
33193
+ commonAdapter.getApproveAdapter(
33194
+ lstToken.address,
33195
+ poolAddr,
33196
+ "approve_token1" /* APPROVE_TOKEN1 */
33197
+ ).bind(commonAdapter)
33198
+ );
33199
+ vaultSettings.leafAdapters.push(
33200
+ vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST)
33201
+ );
32844
33202
  return vesuAdapterLST;
32845
33203
  }
32846
33204
  function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId) {
@@ -32849,8 +33207,12 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
32849
33207
  if (!pool1.eq(defaultPoolId)) {
32850
33208
  throw new Error(`Dont include default pool id in supported pool ids`);
32851
33209
  }
32852
- const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
32853
- const underlyingToken = Global.getDefaultTokens().find((token) => token.symbol === underlyingSymbol);
33210
+ const lstToken = Global.getDefaultTokens().find(
33211
+ (token) => token.symbol === lstSymbol
33212
+ );
33213
+ const underlyingToken = Global.getDefaultTokens().find(
33214
+ (token) => token.symbol === underlyingSymbol
33215
+ );
32854
33216
  const commonAdapter = new CommonAdapter({
32855
33217
  manager: vaultSettings.manager,
32856
33218
  asset: lstToken.address,
@@ -32858,28 +33220,106 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
32858
33220
  vaultAddress: vaultSettings.vaultAddress,
32859
33221
  vaultAllocator: vaultSettings.vaultAllocator
32860
33222
  });
32861
- vaultSettings.adapters.push(...[{
32862
- id: "common_adapter" /* COMMON */,
32863
- adapter: commonAdapter
32864
- }]);
32865
- vaultSettings.borrowable_assets.map((borrowableAsset) => addVesuLeaves(borrowableAsset.poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter));
32866
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, AVNU_EXCHANGE, "avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */).bind(commonAdapter));
32867
- const uniqueBorrowableAssets = [...new Set(vaultSettings.borrowable_assets.map((borrowableAsset) => borrowableAsset.token.symbol))];
33223
+ vaultSettings.adapters.push(
33224
+ ...[
33225
+ {
33226
+ id: "common_adapter" /* COMMON */,
33227
+ adapter: commonAdapter
33228
+ }
33229
+ ]
33230
+ );
33231
+ vaultSettings.borrowable_assets.map(
33232
+ (borrowableAsset) => addVesuLeaves(
33233
+ borrowableAsset.poolId,
33234
+ lstSymbol,
33235
+ underlyingSymbol,
33236
+ vaultSettings,
33237
+ commonAdapter
33238
+ )
33239
+ );
33240
+ vaultSettings.leafAdapters.push(
33241
+ commonAdapter.getApproveAdapter(
33242
+ lstToken.address,
33243
+ AVNU_EXCHANGE,
33244
+ "avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */
33245
+ ).bind(commonAdapter)
33246
+ );
33247
+ const uniqueBorrowableAssets = [
33248
+ ...new Set(
33249
+ vaultSettings.borrowable_assets.map(
33250
+ (borrowableAsset) => borrowableAsset.token.symbol
33251
+ )
33252
+ )
33253
+ ];
32868
33254
  for (let borrowableAssetSymbol of uniqueBorrowableAssets) {
32869
- const borrowableAsset = Global.getDefaultTokens().find((token) => token.symbol === borrowableAssetSymbol);
33255
+ const borrowableAsset = Global.getDefaultTokens().find(
33256
+ (token) => token.symbol === borrowableAssetSymbol
33257
+ );
32870
33258
  const debtAsset = borrowableAsset;
32871
- const approve_debt_token_id = getAvnuManageIDs("avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */, debtAsset.symbol);
32872
- const swap_debt_token_id = getAvnuManageIDs("avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, debtAsset.symbol);
32873
- const swap_lst_token_id = getAvnuManageIDs("avnu_mul_swap_withdr" /* AVNU_MULTIPLY_SWAP_WITHDRAW */, debtAsset.symbol);
32874
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(debtAsset.address, AVNU_EXCHANGE, approve_debt_token_id).bind(commonAdapter));
32875
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(debtAsset.address, lstToken.address, swap_debt_token_id, false).bind(commonAdapter));
32876
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(lstToken.address, debtAsset.address, swap_lst_token_id, false).bind(commonAdapter));
32877
- }
32878
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
32879
- vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
32880
- const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
32881
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_EXCHANGE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
32882
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */, false).bind(commonAdapter));
33259
+ const approve_debt_token_id = getAvnuManageIDs(
33260
+ "avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */,
33261
+ debtAsset.symbol
33262
+ );
33263
+ const swap_debt_token_id = getAvnuManageIDs(
33264
+ "avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */,
33265
+ debtAsset.symbol
33266
+ );
33267
+ const swap_lst_token_id = getAvnuManageIDs(
33268
+ "avnu_mul_swap_withdr" /* AVNU_MULTIPLY_SWAP_WITHDRAW */,
33269
+ debtAsset.symbol
33270
+ );
33271
+ vaultSettings.leafAdapters.push(
33272
+ commonAdapter.getApproveAdapter(
33273
+ debtAsset.address,
33274
+ AVNU_EXCHANGE,
33275
+ approve_debt_token_id
33276
+ ).bind(commonAdapter)
33277
+ );
33278
+ vaultSettings.leafAdapters.push(
33279
+ commonAdapter.getAvnuAdapter(
33280
+ debtAsset.address,
33281
+ lstToken.address,
33282
+ swap_debt_token_id,
33283
+ false
33284
+ ).bind(commonAdapter)
33285
+ );
33286
+ vaultSettings.leafAdapters.push(
33287
+ commonAdapter.getAvnuAdapter(
33288
+ lstToken.address,
33289
+ debtAsset.address,
33290
+ swap_lst_token_id,
33291
+ false
33292
+ ).bind(commonAdapter)
33293
+ );
33294
+ }
33295
+ vaultSettings.leafAdapters.push(
33296
+ commonAdapter.getApproveAdapter(
33297
+ lstToken.address,
33298
+ vaultSettings.vaultAddress,
33299
+ "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */
33300
+ ).bind(commonAdapter)
33301
+ );
33302
+ vaultSettings.leafAdapters.push(
33303
+ commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter)
33304
+ );
33305
+ const STRKToken = Global.getDefaultTokens().find(
33306
+ (token) => token.symbol === "STRK"
33307
+ );
33308
+ vaultSettings.leafAdapters.push(
33309
+ commonAdapter.getApproveAdapter(
33310
+ STRKToken.address,
33311
+ AVNU_EXCHANGE,
33312
+ "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */
33313
+ ).bind(commonAdapter)
33314
+ );
33315
+ vaultSettings.leafAdapters.push(
33316
+ commonAdapter.getAvnuAdapter(
33317
+ STRKToken.address,
33318
+ lstToken.address,
33319
+ "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */,
33320
+ false
33321
+ ).bind(commonAdapter)
33322
+ );
32883
33323
  return vaultSettings;
32884
33324
  }
32885
33325
  var AUDIT_URL4 = "https://docs.troves.fi/p/security#starknet-vault-kit";
@@ -32898,7 +33338,8 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
32898
33338
  answer: /* @__PURE__ */ jsxs4("span", { children: [
32899
33339
  "Currently, the LST is from ",
32900
33340
  /* @__PURE__ */ jsx5("strong", { children: "Endur" }),
32901
- " while ",
33341
+ " while",
33342
+ " ",
32902
33343
  /* @__PURE__ */ jsx5("strong", { children: "Vesu" }),
32903
33344
  " is used to collateralize the looped position."
32904
33345
  ] })
@@ -32930,23 +33371,48 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
32930
33371
  ];
32931
33372
  }
32932
33373
  var _riskFactor4 = [
32933
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 25, reason: "Audited by Zellic" },
32934
- { type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 1 /* VERY_LOW_PROBABILITY */, weight: 25, reason: "The collateral and debt are highly correlated" },
32935
- { 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." },
32936
- { type: "Depeg Risk" /* DEPEG_RISK */, value: 2 /* GENERALLY_STABLE */, weight: 25, reason: "Generally stable pegged assets" }
32937
- ];
32938
- var btcBorrowableAssets = [
32939
- "WBTC",
32940
- "tBTC",
32941
- "LBTC",
32942
- "solvBTC"
33374
+ {
33375
+ type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */,
33376
+ value: 2 /* WELL_AUDITED */,
33377
+ weight: 25,
33378
+ reason: "Audited by Zellic"
33379
+ },
33380
+ {
33381
+ type: "Liquidation Risk" /* LIQUIDATION_RISK */,
33382
+ value: 1 /* VERY_LOW_PROBABILITY */,
33383
+ weight: 25,
33384
+ reason: "The collateral and debt are highly correlated"
33385
+ },
33386
+ {
33387
+ type: "Technical Risk" /* TECHNICAL_RISK */,
33388
+ value: 1 /* STABLE_INFRASTRUCTURE */,
33389
+ weight: 25,
33390
+ 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."
33391
+ },
33392
+ {
33393
+ type: "Depeg Risk" /* DEPEG_RISK */,
33394
+ value: 2 /* GENERALLY_STABLE */,
33395
+ weight: 25,
33396
+ reason: "Generally stable pegged assets"
33397
+ }
32943
33398
  ];
33399
+ var btcBorrowableAssets = ["WBTC", "tBTC", "LBTC", "solvBTC"];
32944
33400
  var hyperxSTRK = {
32945
- vaultAddress: ContractAddr.from("0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"),
32946
- manager: ContractAddr.from("0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"),
32947
- vaultAllocator: ContractAddr.from("0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"),
32948
- redeemRequestNFT: ContractAddr.from("0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"),
32949
- aumOracle: ContractAddr.from("0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"),
33401
+ vaultAddress: ContractAddr.from(
33402
+ "0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"
33403
+ ),
33404
+ manager: ContractAddr.from(
33405
+ "0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"
33406
+ ),
33407
+ vaultAllocator: ContractAddr.from(
33408
+ "0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"
33409
+ ),
33410
+ redeemRequestNFT: ContractAddr.from(
33411
+ "0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"
33412
+ ),
33413
+ aumOracle: ContractAddr.from(
33414
+ "0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"
33415
+ ),
32950
33416
  leafAdapters: [],
32951
33417
  adapters: [],
32952
33418
  targetHealthFactor: 1.1,
@@ -32957,35 +33423,63 @@ var hyperxSTRK = {
32957
33423
  ...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
32958
33424
  // v2, new alt for Re7xSTRK
32959
33425
  ],
32960
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "STRK"),
33426
+ underlyingToken: Global.getDefaultTokens().find(
33427
+ (token) => token.symbol === "STRK"
33428
+ ),
32961
33429
  defaultPoolId: VesuPools.Re7xSTRK
32962
33430
  };
32963
33431
  var hyperxWBTC = {
32964
- vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
32965
- manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
32966
- vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
32967
- redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
32968
- aumOracle: ContractAddr.from("0x258f8a0ca0d21f542e48ad89d00e92dc4d9db4999084f50ef9c22dfb1e83023"),
33432
+ vaultAddress: ContractAddr.from(
33433
+ "0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"
33434
+ ),
33435
+ manager: ContractAddr.from(
33436
+ "0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"
33437
+ ),
33438
+ vaultAllocator: ContractAddr.from(
33439
+ "0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"
33440
+ ),
33441
+ redeemRequestNFT: ContractAddr.from(
33442
+ "0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"
33443
+ ),
33444
+ aumOracle: ContractAddr.from(
33445
+ "0x258f8a0ca0d21f542e48ad89d00e92dc4d9db4999084f50ef9c22dfb1e83023"
33446
+ ),
32969
33447
  leafAdapters: [],
32970
33448
  adapters: [],
32971
33449
  targetHealthFactor: 1.1,
32972
33450
  minHealthFactor: 1.05,
32973
33451
  borrowable_assets: [
32974
33452
  // allow all BTC flavours borrowing on Re7xBTC pool
32975
- ...btcBorrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
33453
+ ...btcBorrowableAssets.map(
33454
+ (asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)
33455
+ ).map((token) => ({ token, poolId: VesuPools.Re7xBTC })),
32976
33456
  // allow only WBTC borrowing on Prime pool
32977
33457
  ...Global.getDefaultTokens().filter((token) => token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Prime }))
32978
33458
  ],
32979
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "WBTC"),
33459
+ underlyingToken: Global.getDefaultTokens().find(
33460
+ (token) => token.symbol === "WBTC"
33461
+ ),
32980
33462
  defaultPoolId: VesuPools.Re7xBTC,
32981
- redemptionRouter: ContractAddr.from("0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417")
33463
+ redemptionRouter: ContractAddr.from(
33464
+ "0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417"
33465
+ )
32982
33466
  };
32983
33467
  var hyperxtBTC = {
32984
- vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
32985
- manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
32986
- vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
32987
- redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
32988
- aumOracle: ContractAddr.from("0x7e0d05cb7ba3f7db77a36c21c21583b5a524c2e685c08c24b3554911fb4a039"),
33468
+ vaultAddress: ContractAddr.from(
33469
+ "0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"
33470
+ ),
33471
+ manager: ContractAddr.from(
33472
+ "0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"
33473
+ ),
33474
+ vaultAllocator: ContractAddr.from(
33475
+ "0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"
33476
+ ),
33477
+ redeemRequestNFT: ContractAddr.from(
33478
+ "0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"
33479
+ ),
33480
+ aumOracle: ContractAddr.from(
33481
+ "0x7e0d05cb7ba3f7db77a36c21c21583b5a524c2e685c08c24b3554911fb4a039"
33482
+ ),
32989
33483
  leafAdapters: [],
32990
33484
  adapters: [],
32991
33485
  targetHealthFactor: 1.1,
@@ -32993,16 +33487,30 @@ var hyperxtBTC = {
32993
33487
  borrowable_assets: [
32994
33488
  ...Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
32995
33489
  ],
32996
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC"),
33490
+ underlyingToken: Global.getDefaultTokens().find(
33491
+ (token) => token.symbol === "tBTC"
33492
+ ),
32997
33493
  defaultPoolId: VesuPools.Re7xBTC,
32998
- redemptionRouter: ContractAddr.from("0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d")
33494
+ redemptionRouter: ContractAddr.from(
33495
+ "0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d"
33496
+ )
32999
33497
  };
33000
33498
  var hyperxsBTC = {
33001
- vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
33002
- manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
33003
- vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
33004
- redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
33005
- aumOracle: ContractAddr.from("0x149298ade3e79ec6cbdac6cfad289c57504eaf54e590939136ed1ceca60c345"),
33499
+ vaultAddress: ContractAddr.from(
33500
+ "0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"
33501
+ ),
33502
+ manager: ContractAddr.from(
33503
+ "0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"
33504
+ ),
33505
+ vaultAllocator: ContractAddr.from(
33506
+ "0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"
33507
+ ),
33508
+ redeemRequestNFT: ContractAddr.from(
33509
+ "0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"
33510
+ ),
33511
+ aumOracle: ContractAddr.from(
33512
+ "0x149298ade3e79ec6cbdac6cfad289c57504eaf54e590939136ed1ceca60c345"
33513
+ ),
33006
33514
  leafAdapters: [],
33007
33515
  adapters: [],
33008
33516
  targetHealthFactor: 1.1,
@@ -33010,15 +33518,27 @@ var hyperxsBTC = {
33010
33518
  borrowable_assets: [
33011
33519
  ...Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
33012
33520
  ],
33013
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC"),
33521
+ underlyingToken: Global.getDefaultTokens().find(
33522
+ (token) => token.symbol === "solvBTC"
33523
+ ),
33014
33524
  defaultPoolId: VesuPools.Re7xBTC
33015
33525
  };
33016
33526
  var hyperxLBTC = {
33017
- vaultAddress: ContractAddr.from("0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"),
33018
- manager: ContractAddr.from("0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"),
33019
- vaultAllocator: ContractAddr.from("0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"),
33020
- redeemRequestNFT: ContractAddr.from("0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"),
33021
- aumOracle: ContractAddr.from("0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0"),
33527
+ vaultAddress: ContractAddr.from(
33528
+ "0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"
33529
+ ),
33530
+ manager: ContractAddr.from(
33531
+ "0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"
33532
+ ),
33533
+ vaultAllocator: ContractAddr.from(
33534
+ "0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"
33535
+ ),
33536
+ redeemRequestNFT: ContractAddr.from(
33537
+ "0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"
33538
+ ),
33539
+ aumOracle: ContractAddr.from(
33540
+ "0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0"
33541
+ ),
33022
33542
  leafAdapters: [],
33023
33543
  adapters: [],
33024
33544
  targetHealthFactor: 1.1,
@@ -33026,7 +33546,9 @@ var hyperxLBTC = {
33026
33546
  borrowable_assets: [
33027
33547
  ...Global.getDefaultTokens().filter((token) => token.symbol === "LBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
33028
33548
  ],
33029
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC"),
33549
+ underlyingToken: Global.getDefaultTokens().find(
33550
+ (token) => token.symbol === "LBTC"
33551
+ ),
33030
33552
  defaultPoolId: VesuPools.Re7xBTC
33031
33553
  };
33032
33554
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
@@ -33044,7 +33566,7 @@ function getMaxTVL(lstSymbol) {
33044
33566
  xLBTC: 5,
33045
33567
  xtBTC: 5,
33046
33568
  xsBTC: 5,
33047
- xSTRK: 55e4
33569
+ xSTRK: 7e6
33048
33570
  };
33049
33571
  const maxTVLValue = lstMaxTVLs[lstSymbol] || 0;
33050
33572
  const token = Global.getDefaultTokens().find(
@@ -33113,15 +33635,19 @@ var HYPER_LST_SECURITY = {
33113
33635
  };
33114
33636
  var HYPER_LST_REDEMPTION_INFO = {
33115
33637
  instantWithdrawalVault: "No" /* NO */,
33116
- redemptionsInfo: [{
33117
- title: "Typical Duration",
33118
- description: "1-2 hours"
33119
- }],
33120
- alerts: [{
33121
- type: "info",
33122
- 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.",
33123
- tab: "withdraw"
33124
- }]
33638
+ redemptionsInfo: [
33639
+ {
33640
+ title: "Typical Duration",
33641
+ description: "1-2 hours"
33642
+ }
33643
+ ],
33644
+ alerts: [
33645
+ {
33646
+ type: "info",
33647
+ 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.",
33648
+ tab: "withdraw"
33649
+ }
33650
+ ]
33125
33651
  };
33126
33652
  function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview = false) {
33127
33653
  return {
@@ -33136,9 +33662,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33136
33662
  description: `Creates leveraged looping position on ${lstSymbol} by borrowing ${underlyingSymbol} to increase yield`
33137
33663
  },
33138
33664
  depositTokens: [
33139
- Global.getDefaultTokens().find(
33140
- (token) => token.symbol === lstSymbol
33141
- )
33665
+ Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)
33142
33666
  ],
33143
33667
  additionalInfo: getLooperSettings2(
33144
33668
  lstSymbol,
@@ -33148,10 +33672,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33148
33672
  ),
33149
33673
  risk: {
33150
33674
  riskFactor: _riskFactor4,
33151
- netRisk: _riskFactor4.reduce(
33152
- (acc, curr) => acc + curr.value * curr.weight,
33153
- 0
33154
- ) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
33675
+ netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
33155
33676
  notARisks: getNoRiskTags(_riskFactor4)
33156
33677
  },
33157
33678
  auditUrl: AUDIT_URL4,
@@ -33166,16 +33687,19 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33166
33687
  investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
33167
33688
  isPreview,
33168
33689
  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.",
33690
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
33169
33691
  tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
33170
33692
  security: HYPER_LST_SECURITY,
33171
33693
  redemptionInfo: HYPER_LST_REDEMPTION_INFO,
33172
33694
  usualTimeToEarnings: "2 weeks",
33173
33695
  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.",
33174
- points: [{
33175
- multiplier: 4,
33176
- logo: "https://endur.fi/favicon.ico",
33177
- toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi."
33178
- }]
33696
+ points: [
33697
+ {
33698
+ multiplier: 4,
33699
+ logo: "https://endur.fi/favicon.ico",
33700
+ toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi."
33701
+ }
33702
+ ]
33179
33703
  };
33180
33704
  }
33181
33705
  var HyperLSTStrategies = [