@strkfarm/sdk 2.0.0-staging.22 → 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(
@@ -30947,6 +30949,13 @@ var vault_manager_abi_default = [
30947
30949
  }
30948
30950
  ];
30949
30951
 
30952
+ // src/strategies/types.ts
30953
+ var LSTPriceType = /* @__PURE__ */ ((LSTPriceType2) => {
30954
+ LSTPriceType2["ENDUR_PRICE"] = "ENDUR_PRICE";
30955
+ LSTPriceType2["AVNU_PRICE"] = "AVNU_PRICE";
30956
+ return LSTPriceType2;
30957
+ })(LSTPriceType || {});
30958
+
30950
30959
  // src/strategies/universal-strategy.tsx
30951
30960
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
30952
30961
  var AUMTypes = /* @__PURE__ */ ((AUMTypes3) => {
@@ -31255,7 +31264,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
31255
31264
  usdValue
31256
31265
  };
31257
31266
  }
31258
- async getVesuAUM(adapter) {
31267
+ async getVesuAUM(adapter, _priceType) {
31259
31268
  const legAUM = await adapter.getPositions(this.config);
31260
31269
  const underlying = this.asset();
31261
31270
  let vesuAum = Web3Number.fromWei("0", underlying.decimals);
@@ -31281,13 +31290,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
31281
31290
  logger.verbose(`${this.getTag()} Prev AUM: ${prevAum}`);
31282
31291
  return prevAum;
31283
31292
  }
31284
- async getAUM() {
31293
+ async getAUM(unrealizedAUM) {
31285
31294
  const prevAum = await this.getPrevAUM();
31286
31295
  const token1Price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
31287
31296
  const vesuAdapters = this.getVesuAdapters();
31288
31297
  let vesuAum = Web3Number.fromWei("0", this.asset().decimals);
31289
31298
  for (const adapter of vesuAdapters) {
31290
- vesuAum = vesuAum.plus(await this.getVesuAUM(adapter));
31299
+ const priceType = unrealizedAUM ? "ENDUR_PRICE" /* ENDUR_PRICE */ : "AVNU_PRICE" /* AVNU_PRICE */;
31300
+ const aumValue = await this.getVesuAUM(adapter, priceType);
31301
+ vesuAum = vesuAum.plus(aumValue);
31291
31302
  }
31292
31303
  const balance = await this.getUnusedBalance();
31293
31304
  logger.verbose(`${this.getTag()} unused balance: ${balance.amount.toNumber()}`);
@@ -31798,7 +31809,6 @@ function MetaVaultDescription(allowedSources) {
31798
31809
  const containerStyle = {
31799
31810
  maxWidth: "800px",
31800
31811
  margin: "0 auto",
31801
- backgroundColor: "#111",
31802
31812
  color: "#eee",
31803
31813
  fontFamily: "Arial, sans-serif",
31804
31814
  borderRadius: "12px"
@@ -31991,6 +32001,7 @@ var createUniversalStrategy = (params) => ({
31991
32001
  risk: getUniversalRisk(),
31992
32002
  auditUrl: AUDIT_URL3,
31993
32003
  protocols: [Protocols.VESU],
32004
+ realizedAPYMethodology: "The realizedAPY is based on past 14 days performance by the vault",
31994
32005
  curator: {
31995
32006
  name: "Unwrap Labs",
31996
32007
  logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
@@ -32101,23 +32112,36 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32101
32112
  constructor(config, pricer, metadata) {
32102
32113
  super(config, pricer, metadata);
32103
32114
  this.quoteAmountToFetchPrice = new Web3Number(1, 18);
32104
- const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
32115
+ const STRKToken = Global.getDefaultTokens().find(
32116
+ (token) => token.symbol === "STRK"
32117
+ );
32105
32118
  const underlyingToken = this.getLSTUnderlyingTokenInfo();
32106
32119
  if (underlyingToken.address.eq(STRKToken.address)) {
32107
32120
  this.quoteAmountToFetchPrice = new Web3Number(100, 18);
32108
32121
  } else {
32109
- this.quoteAmountToFetchPrice = new Web3Number(0.01, this.asset().decimals);
32122
+ this.quoteAmountToFetchPrice = new Web3Number(
32123
+ 0.01,
32124
+ this.asset().decimals
32125
+ );
32110
32126
  }
32111
32127
  }
32112
32128
  asset() {
32113
- return this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId).config.collateral;
32129
+ return this.getVesuSameTokenAdapter(
32130
+ this.metadata.additionalInfo.defaultPoolId
32131
+ ).config.collateral;
32114
32132
  }
32115
32133
  getTag() {
32116
32134
  return `${_UniversalLstMultiplierStrategy.name}:${this.metadata.name}`;
32117
32135
  }
32118
32136
  // Vesu adapter with LST and base token match
32119
32137
  getVesuSameTokenAdapter(poolId) {
32120
- 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
+ );
32121
32145
  baseAdapter.networkConfig = this.config;
32122
32146
  baseAdapter.pricer = this.pricer;
32123
32147
  return baseAdapter;
@@ -32160,27 +32184,43 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32160
32184
  lstUnderlyingTokenInfo.address.address,
32161
32185
  this.quoteAmountToFetchPrice
32162
32186
  );
32163
- const outputAmount = Web3Number.fromWei(quote.total_calculated, lstUnderlyingTokenInfo.decimals);
32187
+ const outputAmount = Web3Number.fromWei(
32188
+ quote.total_calculated,
32189
+ lstUnderlyingTokenInfo.decimals
32190
+ );
32164
32191
  const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
32165
32192
  logger.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
32166
32193
  return price;
32167
32194
  }
32168
32195
  async getAvnuSwapMultiplyCall(params) {
32169
- assert(params.isDeposit, "Only deposit is supported in getAvnuSwapMultiplyCall");
32170
- 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
+ });
32171
32203
  const allVesuAdapters = this.getVesuAdapters();
32172
32204
  let remainingAmount = params.leg1DepositAmount;
32173
32205
  const lstExRate = await this.getLSTExchangeRate();
32174
- const baseAssetPrice = await this.pricer.getPrice(this.getLSTUnderlyingTokenInfo().symbol);
32206
+ const baseAssetPrice = await this.pricer.getPrice(
32207
+ this.getLSTUnderlyingTokenInfo().symbol
32208
+ );
32175
32209
  const lstPrice = baseAssetPrice.price * lstExRate;
32176
32210
  for (let i = 0; i < maxBorrowableAmounts.maxBorrowables.length; i++) {
32177
32211
  const maxBorrowable = maxBorrowableAmounts.maxBorrowables[i];
32178
- 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
+ );
32179
32215
  if (!vesuAdapter) {
32180
- 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
+ );
32181
32219
  }
32182
32220
  const maxLTV = await vesuAdapter.getLTVConfig(this.config);
32183
- const debtPrice = await this.pricer.getPrice(maxBorrowable.borrowableAsset.symbol);
32221
+ const debtPrice = await this.pricer.getPrice(
32222
+ maxBorrowable.borrowableAsset.symbol
32223
+ );
32184
32224
  const maxAmountToDeposit = HealthFactorMath.getMinCollateralRequiredOnLooping(
32185
32225
  maxBorrowable.amount,
32186
32226
  debtPrice.price,
@@ -32190,7 +32230,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32190
32230
  this.asset()
32191
32231
  );
32192
32232
  const amountToDeposit = remainingAmount.minimum(maxAmountToDeposit);
32193
- 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
+ );
32194
32236
  const call = await this._getAvnuDepositSwapLegCall({
32195
32237
  isDeposit: params.isDeposit,
32196
32238
  // adjust decimals of debt asset
@@ -32202,36 +32244,60 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32202
32244
  remainingAmount = remainingAmount.minus(amountToDeposit);
32203
32245
  return { call, vesuAdapter };
32204
32246
  }
32205
- throw new Error(`${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`);
32247
+ throw new Error(
32248
+ `${this.getTag()}::getAvnuSwapMultiplyCall: no calls found`
32249
+ );
32206
32250
  }
32207
32251
  async _getAvnuDepositSwapLegCall(params) {
32208
32252
  const { vesuAdapter } = params;
32209
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`);
32210
- 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
+ );
32211
32260
  const legLTV = await vesuAdapter.getLTVConfig(this.config);
32212
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`);
32261
+ logger.verbose(
32262
+ `${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`
32263
+ );
32213
32264
  const existingPositions = await vesuAdapter.getPositions(this.config);
32214
- const collateralisation = await vesuAdapter.getCollateralization(this.config);
32265
+ const collateralisation = await vesuAdapter.getCollateralization(
32266
+ this.config
32267
+ );
32215
32268
  const existingCollateralInfo = existingPositions[0];
32216
32269
  const existingDebtInfo = existingPositions[1];
32217
32270
  logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32218
32271
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32219
32272
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32220
32273
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32221
- logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32274
+ logger.debug(
32275
+ `${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
32276
+ );
32222
32277
  const debtTokenInfo = vesuAdapter.config.debt;
32223
32278
  let newDepositAmount = params.leg1DepositAmount;
32224
- const totalCollateral = existingCollateralInfo.amount.plus(params.leg1DepositAmount);
32225
- 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
+ );
32226
32285
  const totalDebtAmount = new Web3Number(
32227
32286
  totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF).toString(),
32228
32287
  debtTokenInfo.decimals
32229
32288
  );
32230
32289
  let debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
32231
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}, initial computed debt: ${debtAmount}`);
32232
- 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
+ );
32233
32297
  if (debtAmount.gt(0) && maxBorrowable.amount.eq(0)) {
32234
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`);
32298
+ logger.verbose(
32299
+ `${this.getTag()}::_getAvnuDepositSwapLegCall maxBorrowable is 0, skipping`
32300
+ );
32235
32301
  return void 0;
32236
32302
  } else if (debtAmount.gt(0) && maxBorrowable.amount.gt(0)) {
32237
32303
  debtAmount = maxBorrowable.amount.minimum(debtAmount);
@@ -32244,16 +32310,24 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32244
32310
  collateralPrice,
32245
32311
  this.asset()
32246
32312
  );
32247
- newDepositAmount = totalCollateralRequired.minus(existingCollateralInfo.amount);
32313
+ newDepositAmount = totalCollateralRequired.minus(
32314
+ existingCollateralInfo.amount
32315
+ );
32248
32316
  if (newDepositAmount.lt(0)) {
32249
- 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
+ );
32250
32320
  }
32251
32321
  if (newDebtUSDValue.toNumber() < 100) {
32252
- 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
+ );
32253
32325
  return void 0;
32254
32326
  }
32255
32327
  }
32256
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`);
32328
+ logger.verbose(
32329
+ `${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`
32330
+ );
32257
32331
  if (debtAmount.lt(0)) {
32258
32332
  const lstDEXPrice = await this.getLSTDexPrice();
32259
32333
  const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
@@ -32262,28 +32336,38 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32262
32336
  leg1DepositAmount: debtAmountInLST,
32263
32337
  poolId: vesuAdapter.config.poolId
32264
32338
  });
32265
- 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
+ );
32266
32343
  return calls[0];
32267
32344
  }
32268
- console.log(`debtAmount`, debtAmount.toWei(), params.leg1DepositAmount.toWei());
32269
32345
  const STEP0 = "approve_token1" /* APPROVE_TOKEN1 */;
32270
32346
  const manage0Info = this.getProofs(STEP0);
32271
32347
  const manageCall0 = manage0Info.callConstructor({
32272
32348
  amount: newDepositAmount
32273
32349
  });
32274
- 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
+ );
32275
32355
  const manage1Info = this.getProofs(STEP1);
32276
- const manageCall1 = manage1Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
32277
- collateralAmount: newDepositAmount,
32278
- isAddCollateral: params.isDeposit,
32279
- debtAmount,
32280
- isBorrow: params.isDeposit
32281
- }));
32282
- console.log(`manageCall1`, manageCall1.call, debtAmount.toWei(), newDepositAmount.toWei());
32356
+ const manageCall1 = manage1Info.callConstructor(
32357
+ VesuAdapter.getDefaultModifyPositionCallParams({
32358
+ collateralAmount: newDepositAmount,
32359
+ isAddCollateral: params.isDeposit,
32360
+ debtAmount,
32361
+ isBorrow: params.isDeposit
32362
+ })
32363
+ );
32283
32364
  const proofIds = [STEP0, STEP1];
32284
32365
  const manageCalls = [manageCall0, manageCall1];
32285
32366
  if (debtAmount.gt(0)) {
32286
- 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
+ );
32287
32371
  const manage2Info = this.getProofs(STEP2);
32288
32372
  const manageCall2 = manage2Info.callConstructor({
32289
32373
  amount: debtAmount
@@ -32299,7 +32383,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32299
32383
  );
32300
32384
  const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
32301
32385
  const minAmountWei = minAmount.toWei();
32302
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`);
32386
+ logger.verbose(
32387
+ `${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`
32388
+ );
32303
32389
  const swapInfo = await avnuModule.getSwapInfo(
32304
32390
  quote,
32305
32391
  this.metadata.additionalInfo.vaultAllocator.address,
@@ -32307,8 +32393,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32307
32393
  this.address.address,
32308
32394
  minAmountWei
32309
32395
  );
32310
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`);
32311
- 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
+ );
32312
32403
  const manage3Info = this.getProofs(STEP3);
32313
32404
  const manageCall3 = manage3Info.callConstructor({
32314
32405
  props: swapInfo
@@ -32318,22 +32409,32 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32318
32409
  manageCalls.push(manageCall2, manageCall3);
32319
32410
  const newCollateral = minAmount.plus(totalCollateral);
32320
32411
  const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
32321
- logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`);
32412
+ logger.verbose(
32413
+ `${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`
32414
+ );
32322
32415
  if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
32323
- 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
+ );
32324
32419
  const STEP4 = "approve_token1" /* APPROVE_TOKEN1 */;
32325
32420
  const manage4Info = this.getProofs(STEP4);
32326
32421
  const manageCall4 = manage4Info.callConstructor({
32327
32422
  amount: minAmount
32328
32423
  });
32329
- 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
+ );
32330
32429
  const manage5Info = this.getProofs(STEP5);
32331
- const manageCall5 = manage5Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
32332
- collateralAmount: minAmount,
32333
- isAddCollateral: true,
32334
- debtAmount: Web3Number.fromWei("0", this.asset().decimals),
32335
- isBorrow: params.isDeposit
32336
- }));
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
+ );
32337
32438
  proofIds.push(STEP4, STEP5);
32338
32439
  manageCalls.push(manageCall4, manageCall5);
32339
32440
  }
@@ -32341,11 +32442,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32341
32442
  const manageCall = this.getManageCall(proofIds, manageCalls);
32342
32443
  return manageCall;
32343
32444
  }
32344
- // todo unwind or not deposit when the yield is bad.
32445
+ // todo unwind or not deposit when the yield is bad.
32345
32446
  async getLSTMultiplierRebalanceCall() {
32346
32447
  let shouldRebalance = false;
32347
32448
  const calls = [];
32348
- 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
+ );
32349
32452
  for (const vesuAdapter of allVesuAdapters) {
32350
32453
  const call = await this._getLSTMultiplierRebalanceCall(vesuAdapter);
32351
32454
  if (call.shouldRebalance && call.manageCall) {
@@ -32357,18 +32460,27 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32357
32460
  }
32358
32461
  async _getLSTMultiplierRebalanceCall(vesuAdapter) {
32359
32462
  const positions = await vesuAdapter.getPositions(this.config);
32360
- 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
+ );
32361
32467
  const existingCollateralInfo = positions[0];
32362
32468
  const existingDebtInfo = positions[1];
32363
32469
  const unusedBalance = await this.getUnusedBalance();
32364
32470
  const healthFactor = await vesuAdapter.getHealthFactor();
32365
- const collateralisation = await vesuAdapter.getCollateralization(this.config);
32471
+ const collateralisation = await vesuAdapter.getCollateralization(
32472
+ this.config
32473
+ );
32366
32474
  logger.debug(`${this.getTag()}::getVesuMultiplyCall::${vesuAdapter.config.debt.symbol} existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32367
32475
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32368
32476
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32369
32477
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32370
- logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32371
- 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
+ );
32372
32484
  const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
32373
32485
  const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
32374
32486
  if (isHFTooLow || isHFTooHigh || 1) {
@@ -32376,7 +32488,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32376
32488
  isDeposit: true,
32377
32489
  leg1DepositAmount: unusedBalance.amount,
32378
32490
  minHF: 1.02,
32379
- // 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.
32380
32492
  vesuAdapter
32381
32493
  });
32382
32494
  return { shouldRebalance: true, manageCall };
@@ -32384,14 +32496,48 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32384
32496
  return { shouldRebalance: false, manageCall: void 0 };
32385
32497
  }
32386
32498
  }
32387
- async getVesuAUM(adapter) {
32499
+ async getVesuAUM(adapter, priceType = "AVNU_PRICE" /* AVNU_PRICE */) {
32388
32500
  const legAUM = await adapter.getPositions(this.config);
32389
32501
  const underlying = this.asset();
32390
- 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
+ );
32391
32506
  let vesuAum = Web3Number.fromWei("0", underlying.decimals);
32392
- let tokenUnderlyingPrice = await this.getLSTExchangeRate();
32393
- tokenUnderlyingPrice = tokenUnderlyingPrice * 0.998;
32394
- logger.verbose(`${this.getTag()} tokenUnderlyingPrice: ${tokenUnderlyingPrice}`);
32507
+ let tokenUnderlyingPrice;
32508
+ if (priceType === "ENDUR_PRICE" /* ENDUR_PRICE */) {
32509
+ tokenUnderlyingPrice = await this.getLSTExchangeRate();
32510
+ if (tokenUnderlyingPrice === 0) {
32511
+ throw new Error(
32512
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Endur) is 0`
32513
+ );
32514
+ }
32515
+ const avnuRate = await this.getLSTAvnuRate();
32516
+ if (avnuRate === 0) {
32517
+ throw new Error(
32518
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
32519
+ );
32520
+ }
32521
+ const diff = Math.abs(tokenUnderlyingPrice - avnuRate) / tokenUnderlyingPrice;
32522
+ if (diff > 0.02) {
32523
+ throw new Error(
32524
+ `${this.getTag()}::getVesuAUM: Endur and Avnu prices differ by more than 2% (Endur: ${tokenUnderlyingPrice}, Avnu: ${avnuRate})`
32525
+ );
32526
+ }
32527
+ logger.verbose(
32528
+ `${this.getTag()} tokenUnderlyingPrice (Endur): ${tokenUnderlyingPrice}, avnuRate: ${avnuRate}, diff: ${diff}`
32529
+ );
32530
+ } else {
32531
+ tokenUnderlyingPrice = await this.getLSTAvnuRate();
32532
+ if (tokenUnderlyingPrice === 0) {
32533
+ throw new Error(
32534
+ `${this.getTag()}::getVesuAUM: tokenUnderlyingPrice (Avnu) is 0`
32535
+ );
32536
+ }
32537
+ logger.verbose(
32538
+ `${this.getTag()} tokenUnderlyingPrice (Avnu): ${tokenUnderlyingPrice}`
32539
+ );
32540
+ }
32395
32541
  if (legAUM[0].token.address.eq(underlying.address)) {
32396
32542
  vesuAum = vesuAum.plus(legAUM[0].amount);
32397
32543
  } else {
@@ -32402,10 +32548,28 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32402
32548
  } else {
32403
32549
  vesuAum = vesuAum.minus(legAUM[1].amount.dividedBy(tokenUnderlyingPrice));
32404
32550
  }
32405
- ;
32406
- logger.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
32551
+ const priceTypeLabel = priceType === "ENDUR_PRICE" /* ENDUR_PRICE */ ? "Endur Price" : "Avnu Price";
32552
+ logger.verbose(
32553
+ `${this.getTag()} Vesu AUM (${priceTypeLabel}): ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`
32554
+ );
32407
32555
  return vesuAum;
32408
32556
  }
32557
+ async getTVLUnrealized() {
32558
+ return await this.getAUM(true);
32559
+ }
32560
+ async getUserUnrealizedGains(user) {
32561
+ const tvl = await this.getTVL();
32562
+ const unrealizedTVL = await this.getTVLUnrealized();
32563
+ const unrealizedDiff = unrealizedTVL.net.amount.minus(tvl.amount);
32564
+ const userTVL = await this.getUserTVL(user);
32565
+ const userShare = userTVL.amount.dividedBy(tvl.amount);
32566
+ const unrealizedGains = unrealizedDiff.multipliedBy(userShare);
32567
+ return {
32568
+ unrealizedGains,
32569
+ userShare: userShare.toNumber(),
32570
+ tokenInfo: this.asset()
32571
+ };
32572
+ }
32409
32573
  //
32410
32574
  async _getMinOutputAmountLSTBuy(amountInUnderlying) {
32411
32575
  const lstTruePrice = await this.getLSTExchangeRate();
@@ -32418,11 +32582,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32418
32582
  return minOutputAmount;
32419
32583
  }
32420
32584
  // todo add a function to findout max borrowable amount without fucking yield
32421
- // 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.
32422
32586
  /**
32423
32587
  * Uses vesu's multiple call to create leverage on LST
32424
32588
  * Deposit amount is in LST
32425
- * @param params
32589
+ * @param params
32426
32590
  */
32427
32591
  async getVesuMultiplyCall(params) {
32428
32592
  const maxEkuboPriceImpact = params.maxEkuboPriceImpact || 0.01;
@@ -32431,32 +32595,54 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32431
32595
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
32432
32596
  if (!params.isDeposit) {
32433
32597
  const unusedBalance = await this.getUnusedBalance();
32434
- 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
+ );
32435
32601
  }
32436
32602
  const existingPositions = await vesuAdapter1.getPositions(this.config);
32437
- const collateralisation = await vesuAdapter1.getCollateralization(this.config);
32603
+ const collateralisation = await vesuAdapter1.getCollateralization(
32604
+ this.config
32605
+ );
32438
32606
  const existingCollateralInfo = existingPositions[0];
32439
32607
  const existingDebtInfo = existingPositions[1];
32440
32608
  logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
32441
32609
  existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
32442
32610
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
32443
32611
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
32444
- logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
32612
+ logger.debug(
32613
+ `${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`
32614
+ );
32445
32615
  const dexPrice = await this.getLSTDexPrice();
32446
- const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
32447
- 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
+ );
32448
32622
  const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
32449
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`);
32623
+ logger.verbose(
32624
+ `${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}`
32625
+ );
32450
32626
  const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
32451
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`);
32627
+ logger.verbose(
32628
+ `${this.getTag()}::getVesuMultiplyCall numeratorPart2: ${numeratorPart2}`
32629
+ );
32452
32630
  const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
32453
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`);
32631
+ logger.verbose(
32632
+ `${this.getTag()}::getVesuMultiplyCall denominatorPart: ${denominatorPart}`
32633
+ );
32454
32634
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
32455
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
32456
- 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
+ );
32457
32641
  let debtAmount = x_debt_usd.dividedBy(debtPrice);
32458
32642
  const marginAmount = addedCollateral;
32459
- logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
32643
+ logger.verbose(
32644
+ `${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`
32645
+ );
32460
32646
  if (marginAmount.lt(0) && debtAmount.gt(0)) {
32461
32647
  debtAmount = Web3Number.fromWei(0, this.asset().decimals);
32462
32648
  }
@@ -32470,31 +32656,49 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32470
32656
  });
32471
32657
  }
32472
32658
  getLSTUnderlyingTokenInfo() {
32473
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32659
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32660
+ this.metadata.additionalInfo.defaultPoolId
32661
+ );
32474
32662
  return vesuAdapter1.config.debt;
32475
32663
  }
32476
32664
  async getMaxBorrowableAmount(params = { isAPYComputation: false }) {
32477
32665
  const vesuAdapters = this.getVesuAdapters();
32478
- let netMaxBorrowableAmount = Web3Number.fromWei("0", this.getLSTUnderlyingTokenInfo().decimals);
32666
+ let netMaxBorrowableAmount = Web3Number.fromWei(
32667
+ "0",
32668
+ this.getLSTUnderlyingTokenInfo().decimals
32669
+ );
32479
32670
  const maxBorrowables = [];
32480
32671
  for (const vesuAdapter of vesuAdapters) {
32481
- const output = await this.getMaxBorrowableAmountByVesuAdapter(vesuAdapter, params.isAPYComputation);
32672
+ const output = await this.getMaxBorrowableAmountByVesuAdapter(
32673
+ vesuAdapter,
32674
+ params.isAPYComputation
32675
+ );
32482
32676
  const ltv = await vesuAdapter.getLTVConfig(this.config);
32483
32677
  maxBorrowables.push({ ...output, ltv });
32484
32678
  }
32485
32679
  maxBorrowables.sort((a, b) => b.amount.toNumber() - a.amount.toNumber());
32486
- 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
+ );
32487
32684
  return { netMaxBorrowableAmount, maxBorrowables };
32488
32685
  }
32489
- // recursively, using binary search computes max swappable.
32686
+ // recursively, using binary search computes max swappable.
32490
32687
  // @dev assumes 1 token of from == 1 token of to
32491
32688
  async getMaxSwappableWithMaxSlippage(fromToken, toToken, maxSlippage, maxAmount) {
32492
32689
  const output = await findMaxInputWithSlippage({
32493
32690
  apiGetOutput: async (inputAmount) => {
32494
32691
  const ekuboQuoter = new EkuboQuoter(this.config);
32495
32692
  await new Promise((resolve) => setTimeout(resolve, 1e3));
32496
- const quote = await ekuboQuoter.getQuote(fromToken.address.address, toToken.address.address, new Web3Number(inputAmount.toFixed(9), fromToken.decimals));
32497
- 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();
32498
32702
  },
32499
32703
  maxInput: maxAmount.toNumber(),
32500
32704
  maxSlippagePercent: maxSlippage,
@@ -32504,38 +32708,84 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32504
32708
  return new Web3Number(output.optimalInput, fromToken.decimals);
32505
32709
  }
32506
32710
  async getMaxBorrowableAmountByVesuAdapter(vesuAdapter, isAPYComputation) {
32507
- const lstAPY = await this.getLSTAPR(this.getLSTUnderlyingTokenInfo().address);
32711
+ const lstAPY = await this.getLSTAPR(
32712
+ this.getLSTUnderlyingTokenInfo().address
32713
+ );
32508
32714
  const maxInterestRate = lstAPY * 0.8;
32509
- 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
+ );
32510
32720
  const debtCap = await vesuAdapter.getDebtCap(this.config);
32511
32721
  if (currentDebt.gte(debtCap)) {
32512
- 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
+ };
32513
32734
  }
32514
32735
  const availableToBorrow = debtCap.minus(currentDebt);
32515
32736
  const maxBorrowable = maxBorrowableAmount.minimum(availableToBorrow).multipliedBy(0.999);
32516
- if (vesuAdapter.config.debt.address.eq(this.getLSTUnderlyingTokenInfo().address) || isAPYComputation) {
32517
- 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
+ };
32518
32746
  }
32519
32747
  try {
32520
- const maxSwappable = await this.getMaxSwappableWithMaxSlippage(vesuAdapter.config.debt, this.getLSTUnderlyingTokenInfo(), 2e-4, maxBorrowable);
32521
- 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
+ };
32522
32760
  } catch (error) {
32523
32761
  logger.warn(`${this.getTag()}: Failed to get max swappable: ${error}`);
32524
- const maxSwappable = Web3Number.fromWei("0", vesuAdapter.config.debt.decimals);
32525
- 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
+ };
32526
32772
  }
32527
32773
  }
32528
32774
  // todo how much to unwind to get back healthy APY zone again
32529
32775
  // if net APY < LST APR + 0.5%, we need to unwind to get back to LST APR + 1% atleast or 0 vesu position
32530
- // For xSTRK, simply deposit in Vesu if looping is not viable
32776
+ // For xSTRK, simply deposit in Vesu if looping is not viable
32531
32777
  /**
32532
32778
  * Gets LST APR for the strategy's underlying asset from Endur API
32533
32779
  * @returns Promise<number> The LST APR (not divided by 1e18)
32534
32780
  */
32535
32781
  async getLSTAPR(_address) {
32536
32782
  try {
32537
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32538
- 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
+ );
32539
32789
  if (!apr) {
32540
32790
  throw new Error("Failed to get LST APR");
32541
32791
  }
@@ -32548,19 +32798,37 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32548
32798
  // todo undo this
32549
32799
  async netAPY() {
32550
32800
  const unusedBalance = await this.getUnusedBalance();
32551
- const maxNewDeposits = await this.maxNewDeposits({ isAPYComputation: true });
32552
- 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
+ );
32553
32807
  if (maxNewDeposits * 1.5 < unusedBalance.amount.toNumber()) {
32554
- 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
+ );
32555
32811
  const output = await super.netAPY();
32556
32812
  output.splits.push({ apy: lstAPY, id: "lst_apy" });
32557
32813
  return output;
32558
32814
  } else {
32559
- 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
+ );
32560
32818
  const { positions, baseAPYs, rewardAPYs } = await this.getVesuAPYs();
32561
- 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
+ );
32562
32822
  const aum = weights.reduce((acc, curr) => acc + curr, 0);
32563
- 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
+ );
32564
32832
  output.splits.push({ apy: lstAPY, id: "lst_apy" });
32565
32833
  return output;
32566
32834
  }
@@ -32570,9 +32838,13 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32570
32838
  let numerator = 0;
32571
32839
  let ltv = void 0;
32572
32840
  for (let adapter of this.getVesuAdapters()) {
32573
- 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
+ );
32574
32844
  if (!maxBorrowableAmountInfo || !maxBorrowableAmountInfo?.amount) {
32575
- 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
+ );
32576
32848
  }
32577
32849
  numerator += this.metadata.additionalInfo.targetHealthFactor * maxBorrowableAmountInfo.amount.toNumber() / maxBorrowableAmountInfo.ltv;
32578
32850
  }
@@ -32581,7 +32853,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32581
32853
  // todo revisit cases where 0th adapters is used
32582
32854
  async getUnusedBalanceAPY() {
32583
32855
  const unusedBalance = await this.getUnusedBalance();
32584
- const vesuAdapter = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32856
+ const vesuAdapter = this.getVesuSameTokenAdapter(
32857
+ this.metadata.additionalInfo.defaultPoolId
32858
+ );
32585
32859
  const underlying = vesuAdapter.config.debt;
32586
32860
  const lstAPY = await this.getLSTAPR(underlying.address);
32587
32861
  return {
@@ -32589,37 +32863,80 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32589
32863
  weight: unusedBalance.usdValue
32590
32864
  };
32591
32865
  }
32866
+ async getLSTAvnuRate() {
32867
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32868
+ this.metadata.additionalInfo.defaultPoolId
32869
+ );
32870
+ const lstTokenInfo = vesuAdapter1.config.collateral;
32871
+ const underlyingTokenInfo = vesuAdapter1.config.debt;
32872
+ const avnuModule = new AvnuWrapper();
32873
+ const sellAmount = lstTokenInfo.priceCheckAmount ? new Web3Number(
32874
+ lstTokenInfo.priceCheckAmount,
32875
+ underlyingTokenInfo.decimals
32876
+ ) : new Web3Number(1, underlyingTokenInfo.decimals);
32877
+ const quote = await avnuModule.getQuotes(
32878
+ underlyingTokenInfo.address.address,
32879
+ lstTokenInfo.address.address,
32880
+ sellAmount.toWei(),
32881
+ this.metadata.additionalInfo.vaultAllocator.address
32882
+ );
32883
+ const underlyingAmountNumber = sellAmount.toNumber();
32884
+ const lstAmountNumber = Web3Number.fromWei(
32885
+ quote.buyAmount.toString(),
32886
+ lstTokenInfo.decimals
32887
+ ).toNumber();
32888
+ assert(lstAmountNumber > 0, "Avnu LST amount is zero");
32889
+ const exchangeRate = underlyingAmountNumber / lstAmountNumber;
32890
+ logger.verbose(
32891
+ `${this.getTag()}:: LST Avnu Exchange Rate: ${exchangeRate}`
32892
+ );
32893
+ return exchangeRate;
32894
+ }
32592
32895
  async getLSTExchangeRate() {
32593
- const vesuAdapter1 = this.getVesuSameTokenAdapter(this.metadata.additionalInfo.defaultPoolId);
32896
+ const vesuAdapter1 = this.getVesuSameTokenAdapter(
32897
+ this.metadata.additionalInfo.defaultPoolId
32898
+ );
32594
32899
  const lstTokenInfo = vesuAdapter1.config.collateral;
32595
32900
  const lstABI = new Contract11({
32596
32901
  abi: erc4626_abi_default,
32597
32902
  address: lstTokenInfo.address.address,
32598
32903
  providerOrAccount: this.config.provider
32599
32904
  });
32600
- 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
+ ]);
32601
32908
  const exchangeRate = Number(uint25610.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
32602
32909
  logger.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
32603
32910
  return exchangeRate;
32604
32911
  }
32605
32912
  /**
32606
- *
32913
+ *
32607
32914
  * @param params marginAmount is in LST, debtAmount is in underlying
32608
32915
  */
32609
32916
  async getModifyLeverCall(params) {
32610
- logger.verbose(`${this.getTag()}::getModifyLeverCall marginAmount: ${params.marginAmount}, debtAmount: ${params.debtAmount}, lstDexPriceInUnderlying: ${params.lstDexPriceInUnderlying}, isIncrease: ${params.isIncrease}`);
32611
- 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
+ );
32612
32924
  const vesuAdapter1 = this.getVesuSameTokenAdapter(params.poolId);
32613
32925
  const lstTokenInfo = this.asset();
32614
32926
  const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
32615
32927
  const maxAmounts = lstTokenInfo.symbol == "xSTRK" ? 5e5 : 0.5;
32616
32928
  if (params.marginAmount.greaterThan(maxAmounts)) {
32617
- 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
+ );
32618
32932
  }
32619
32933
  const proofsIDs = [];
32620
32934
  const manageCalls = [];
32621
32935
  if (params.marginAmount.greaterThan(0)) {
32622
- 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
+ );
32623
32940
  const manage1Info = this.getProofs(STEP1_ID);
32624
32941
  const depositAmount = params.marginAmount;
32625
32942
  const manageCall1 = manage1Info.callConstructor({
@@ -32640,31 +32957,56 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32640
32957
  params.debtAmount
32641
32958
  // negative for exact amount out
32642
32959
  );
32643
- logger.verbose(`${this.getTag()}::getModifyLeverCall leverSwapQuote: ${JSON.stringify(leverSwapQuote)}`);
32644
- assert(leverSwapQuote.price_impact <= params.maxEkuboPriceImpact, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
32645
- const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
32646
- 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
+ );
32647
32975
  let minLSTReceived = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
32648
32976
  const minLSTReceivedAsPerTruePrice = params.debtAmount.dividedBy(lstTrueExchangeRate);
32649
32977
  minLSTReceived = minLSTReceivedAsPerTruePrice;
32650
- logger.verbose(`${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`);
32978
+ logger.verbose(
32979
+ `${this.getTag()}::getModifyLeverCall minLSTReceivedAsPerTruePrice: ${minLSTReceivedAsPerTruePrice}, minLSTReceived: ${minLSTReceived}`
32980
+ );
32651
32981
  let maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
32652
32982
  const maxUsedCollateralInLST = params.debtAmount.abs().dividedBy(lstTrueExchangeRate).multipliedBy(1.005);
32653
- logger.verbose(`${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`);
32983
+ logger.verbose(
32984
+ `${this.getTag()}::getModifyLeverCall maxUsedCollateralInLST: ${maxUsedCollateralInLST}, maxUsedCollateral: ${maxUsedCollateral}`
32985
+ );
32654
32986
  maxUsedCollateral = maxUsedCollateralInLST;
32655
- 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
+ );
32656
32991
  const manage2Info = this.getProofs(STEP2_ID);
32657
32992
  const manageCall2 = manage2Info.callConstructor({
32658
32993
  delegation: true
32659
32994
  });
32660
- 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
+ );
32661
33000
  const manage3Info = this.getProofs(STEP3_ID);
32662
33001
  const multiplyParams = params.isIncrease ? {
32663
33002
  isIncrease: true,
32664
33003
  increaseParams: {
32665
33004
  add_margin: params.marginAmount,
32666
33005
  margin_swap: [],
32667
- margin_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
33006
+ margin_swap_limit_amount: Web3Number.fromWei(
33007
+ 0,
33008
+ this.asset().decimals
33009
+ ),
32668
33010
  lever_swap: leverSwap,
32669
33011
  lever_swap_limit_amount: minLSTReceived
32670
33012
  }
@@ -32676,15 +33018,21 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
32676
33018
  lever_swap_limit_amount: maxUsedCollateral,
32677
33019
  // only required for close position
32678
33020
  lever_swap_weights: [],
32679
- // 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.
32680
33022
  withdraw_swap: [],
32681
- withdraw_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
33023
+ withdraw_swap_limit_amount: Web3Number.fromWei(
33024
+ 0,
33025
+ this.asset().decimals
33026
+ ),
32682
33027
  withdraw_swap_weights: [],
32683
33028
  close_position: false
32684
33029
  }
32685
33030
  };
32686
33031
  const manageCall3 = manage3Info.callConstructor(multiplyParams);
32687
- 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
+ );
32688
33036
  const manage4Info = this.getProofs(STEP4_ID);
32689
33037
  const manageCall4 = manage4Info.callConstructor({
32690
33038
  delegation: false
@@ -32698,7 +33046,6 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
32698
33046
  const containerStyle = {
32699
33047
  maxWidth: "800px",
32700
33048
  margin: "0 auto",
32701
- backgroundColor: "#111",
32702
33049
  color: "#eee",
32703
33050
  fontFamily: "Arial, sans-serif",
32704
33051
  borderRadius: "12px"
@@ -32721,21 +33068,52 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
32721
33068
  " to create leverage. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield."
32722
33069
  ] }),
32723
33070
  /* @__PURE__ */ jsxs4("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: [
32724
- "This vault uses Vesu for lending and borrowing. The oracle used by this pool is a ",
32725
- 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
+ ]),
32726
33079
  " ",
32727
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."
32728
33081
  ] }),
32729
- /* @__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: [
32730
- /* @__PURE__ */ jsx5("strong", { children: "Withdrawals:" }),
32731
- " Requests can take up to ",
32732
- /* @__PURE__ */ jsx5("strong", { children: "1-2 hours" }),
32733
- " to process as the vault unwinds and settles routing."
32734
- ] }) }),
32735
- /* @__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: [
32736
- /* @__PURE__ */ jsx5("strong", { children: "Debt limits:" }),
32737
- " 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."
32738
- ] }) })
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
+ )
32739
33117
  ] });
32740
33118
  }
32741
33119
  function getDescription2(tokenSymbol, underlyingSymbol) {
@@ -32751,31 +33129,76 @@ function getVesuLegId(baseID, debtTokenSymbol, poolId) {
32751
33129
  return `${baseID}_${debtTokenSymbol.toLowerCase()}_${poolId.slice(-4).toLowerCase()}`;
32752
33130
  }
32753
33131
  function addVesuLeaves(poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter) {
32754
- const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
32755
- 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
+ );
32756
33138
  const vesuAdapterLST = new VesuAdapter({
32757
33139
  poolId,
32758
33140
  collateral: lstToken,
32759
33141
  debt: underlyingToken,
32760
33142
  vaultAllocator: vaultSettings.vaultAllocator,
32761
- 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
+ )
32762
33148
  });
32763
- vaultSettings.adapters.push(...[{
32764
- id: getVesuLegId("vesu_leg1" /* VESU_LEG1 */, underlyingToken.symbol, poolId.toString()),
32765
- adapter: vesuAdapterLST
32766
- }]);
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
+ );
32767
33161
  const { isV2, addr: poolAddr } = getVesuSingletonAddress(poolId);
32768
33162
  const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
32769
- const leafIdApprove = getVesuGenericLegId(poolId.toString(), "multiple_approve" /* MULTIPLE_APPROVE */);
32770
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter));
32771
- const leafIdDelegationOn = getVesuGenericLegId(poolId.toString(), "switch_delegation_on" /* SWITCH_DELEGATION_ON */);
32772
- vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST));
32773
- const leafIdDelegationOff = getVesuGenericLegId(poolId.toString(), "switch_delegation_off" /* SWITCH_DELEGATION_OFF */);
32774
- vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST));
32775
- const multiplID = getVesuLegId("multiply_vesu" /* MULTIPLY_VESU */, underlyingToken.symbol, poolId.toString());
32776
- vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST));
32777
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
32778
- 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
+ );
32779
33202
  return vesuAdapterLST;
32780
33203
  }
32781
33204
  function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultPoolId) {
@@ -32784,8 +33207,12 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
32784
33207
  if (!pool1.eq(defaultPoolId)) {
32785
33208
  throw new Error(`Dont include default pool id in supported pool ids`);
32786
33209
  }
32787
- const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
32788
- 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
+ );
32789
33216
  const commonAdapter = new CommonAdapter({
32790
33217
  manager: vaultSettings.manager,
32791
33218
  asset: lstToken.address,
@@ -32793,28 +33220,106 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, defaultP
32793
33220
  vaultAddress: vaultSettings.vaultAddress,
32794
33221
  vaultAllocator: vaultSettings.vaultAllocator
32795
33222
  });
32796
- vaultSettings.adapters.push(...[{
32797
- id: "common_adapter" /* COMMON */,
32798
- adapter: commonAdapter
32799
- }]);
32800
- vaultSettings.borrowable_assets.map((borrowableAsset) => addVesuLeaves(borrowableAsset.poolId, lstSymbol, underlyingSymbol, vaultSettings, commonAdapter));
32801
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, AVNU_EXCHANGE, "avnu_mul_approve_withdr" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */).bind(commonAdapter));
32802
- 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
+ ];
32803
33254
  for (let borrowableAssetSymbol of uniqueBorrowableAssets) {
32804
- const borrowableAsset = Global.getDefaultTokens().find((token) => token.symbol === borrowableAssetSymbol);
33255
+ const borrowableAsset = Global.getDefaultTokens().find(
33256
+ (token) => token.symbol === borrowableAssetSymbol
33257
+ );
32805
33258
  const debtAsset = borrowableAsset;
32806
- const approve_debt_token_id = getAvnuManageIDs("avnu_mul_approve_dep" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */, debtAsset.symbol);
32807
- const swap_debt_token_id = getAvnuManageIDs("avnu_mul_swap_dep" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, debtAsset.symbol);
32808
- const swap_lst_token_id = getAvnuManageIDs("avnu_mul_swap_withdr" /* AVNU_MULTIPLY_SWAP_WITHDRAW */, debtAsset.symbol);
32809
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(debtAsset.address, AVNU_EXCHANGE, approve_debt_token_id).bind(commonAdapter));
32810
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(debtAsset.address, lstToken.address, swap_debt_token_id, false).bind(commonAdapter));
32811
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(lstToken.address, debtAsset.address, swap_lst_token_id, false).bind(commonAdapter));
32812
- }
32813
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
32814
- vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
32815
- const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
32816
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_EXCHANGE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
32817
- 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
+ );
32818
33323
  return vaultSettings;
32819
33324
  }
32820
33325
  var AUDIT_URL4 = "https://docs.troves.fi/p/security#starknet-vault-kit";
@@ -32833,7 +33338,8 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
32833
33338
  answer: /* @__PURE__ */ jsxs4("span", { children: [
32834
33339
  "Currently, the LST is from ",
32835
33340
  /* @__PURE__ */ jsx5("strong", { children: "Endur" }),
32836
- " while ",
33341
+ " while",
33342
+ " ",
32837
33343
  /* @__PURE__ */ jsx5("strong", { children: "Vesu" }),
32838
33344
  " is used to collateralize the looped position."
32839
33345
  ] })
@@ -32865,23 +33371,48 @@ function getFAQs2(lstSymbol, underlyingSymbol) {
32865
33371
  ];
32866
33372
  }
32867
33373
  var _riskFactor4 = [
32868
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 25, reason: "Audited by Zellic" },
32869
- { type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 1 /* VERY_LOW_PROBABILITY */, weight: 25, reason: "The collateral and debt are highly correlated" },
32870
- { 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." },
32871
- { type: "Depeg Risk" /* DEPEG_RISK */, value: 2 /* GENERALLY_STABLE */, weight: 25, reason: "Generally stable pegged assets" }
32872
- ];
32873
- var btcBorrowableAssets = [
32874
- "WBTC",
32875
- "tBTC",
32876
- "LBTC",
32877
- "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
+ }
32878
33398
  ];
33399
+ var btcBorrowableAssets = ["WBTC", "tBTC", "LBTC", "solvBTC"];
32879
33400
  var hyperxSTRK = {
32880
- vaultAddress: ContractAddr.from("0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"),
32881
- manager: ContractAddr.from("0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"),
32882
- vaultAllocator: ContractAddr.from("0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"),
32883
- redeemRequestNFT: ContractAddr.from("0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"),
32884
- 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
+ ),
32885
33416
  leafAdapters: [],
32886
33417
  adapters: [],
32887
33418
  targetHealthFactor: 1.1,
@@ -32892,35 +33423,63 @@ var hyperxSTRK = {
32892
33423
  ...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
32893
33424
  // v2, new alt for Re7xSTRK
32894
33425
  ],
32895
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "STRK"),
33426
+ underlyingToken: Global.getDefaultTokens().find(
33427
+ (token) => token.symbol === "STRK"
33428
+ ),
32896
33429
  defaultPoolId: VesuPools.Re7xSTRK
32897
33430
  };
32898
33431
  var hyperxWBTC = {
32899
- vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
32900
- manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
32901
- vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
32902
- redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
32903
- 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
+ ),
32904
33447
  leafAdapters: [],
32905
33448
  adapters: [],
32906
33449
  targetHealthFactor: 1.1,
32907
33450
  minHealthFactor: 1.05,
32908
33451
  borrowable_assets: [
32909
33452
  // allow all BTC flavours borrowing on Re7xBTC pool
32910
- ...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 })),
32911
33456
  // allow only WBTC borrowing on Prime pool
32912
33457
  ...Global.getDefaultTokens().filter((token) => token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Prime }))
32913
33458
  ],
32914
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "WBTC"),
33459
+ underlyingToken: Global.getDefaultTokens().find(
33460
+ (token) => token.symbol === "WBTC"
33461
+ ),
32915
33462
  defaultPoolId: VesuPools.Re7xBTC,
32916
- redemptionRouter: ContractAddr.from("0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417")
33463
+ redemptionRouter: ContractAddr.from(
33464
+ "0x6ea649f402898f69baf775c1afdd08522c071c640b9c4460192070ec2b96417"
33465
+ )
32917
33466
  };
32918
33467
  var hyperxtBTC = {
32919
- vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
32920
- manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
32921
- vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
32922
- redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
32923
- 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
+ ),
32924
33483
  leafAdapters: [],
32925
33484
  adapters: [],
32926
33485
  targetHealthFactor: 1.1,
@@ -32928,16 +33487,30 @@ var hyperxtBTC = {
32928
33487
  borrowable_assets: [
32929
33488
  ...Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
32930
33489
  ],
32931
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC"),
33490
+ underlyingToken: Global.getDefaultTokens().find(
33491
+ (token) => token.symbol === "tBTC"
33492
+ ),
32932
33493
  defaultPoolId: VesuPools.Re7xBTC,
32933
- redemptionRouter: ContractAddr.from("0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d")
33494
+ redemptionRouter: ContractAddr.from(
33495
+ "0x3de9c409d1e357e25778fb7a3e2e2393666956846a5c2caa607296fa8e76b5d"
33496
+ )
32934
33497
  };
32935
33498
  var hyperxsBTC = {
32936
- vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
32937
- manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
32938
- vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
32939
- redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
32940
- 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
+ ),
32941
33514
  leafAdapters: [],
32942
33515
  adapters: [],
32943
33516
  targetHealthFactor: 1.1,
@@ -32945,15 +33518,27 @@ var hyperxsBTC = {
32945
33518
  borrowable_assets: [
32946
33519
  ...Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
32947
33520
  ],
32948
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC"),
33521
+ underlyingToken: Global.getDefaultTokens().find(
33522
+ (token) => token.symbol === "solvBTC"
33523
+ ),
32949
33524
  defaultPoolId: VesuPools.Re7xBTC
32950
33525
  };
32951
33526
  var hyperxLBTC = {
32952
- vaultAddress: ContractAddr.from("0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"),
32953
- manager: ContractAddr.from("0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"),
32954
- vaultAllocator: ContractAddr.from("0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"),
32955
- redeemRequestNFT: ContractAddr.from("0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"),
32956
- 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
+ ),
32957
33542
  leafAdapters: [],
32958
33543
  adapters: [],
32959
33544
  targetHealthFactor: 1.1,
@@ -32961,7 +33546,9 @@ var hyperxLBTC = {
32961
33546
  borrowable_assets: [
32962
33547
  ...Global.getDefaultTokens().filter((token) => token.symbol === "LBTC").map((token) => ({ token, poolId: VesuPools.Re7xBTC }))
32963
33548
  ],
32964
- underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC"),
33549
+ underlyingToken: Global.getDefaultTokens().find(
33550
+ (token) => token.symbol === "LBTC"
33551
+ ),
32965
33552
  defaultPoolId: VesuPools.Re7xBTC
32966
33553
  };
32967
33554
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
@@ -32979,7 +33566,7 @@ function getMaxTVL(lstSymbol) {
32979
33566
  xLBTC: 5,
32980
33567
  xtBTC: 5,
32981
33568
  xsBTC: 5,
32982
- xSTRK: 55e4
33569
+ xSTRK: 7e6
32983
33570
  };
32984
33571
  const maxTVLValue = lstMaxTVLs[lstSymbol] || 0;
32985
33572
  const token = Global.getDefaultTokens().find(
@@ -33048,15 +33635,19 @@ var HYPER_LST_SECURITY = {
33048
33635
  };
33049
33636
  var HYPER_LST_REDEMPTION_INFO = {
33050
33637
  instantWithdrawalVault: "No" /* NO */,
33051
- redemptionsInfo: [{
33052
- title: "Typical Duration",
33053
- description: "1-2 hours"
33054
- }],
33055
- alerts: [{
33056
- type: "info",
33057
- 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.",
33058
- tab: "withdraw"
33059
- }]
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
+ ]
33060
33651
  };
33061
33652
  function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview = false) {
33062
33653
  return {
@@ -33071,9 +33662,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33071
33662
  description: `Creates leveraged looping position on ${lstSymbol} by borrowing ${underlyingSymbol} to increase yield`
33072
33663
  },
33073
33664
  depositTokens: [
33074
- Global.getDefaultTokens().find(
33075
- (token) => token.symbol === lstSymbol
33076
- )
33665
+ Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)
33077
33666
  ],
33078
33667
  additionalInfo: getLooperSettings2(
33079
33668
  lstSymbol,
@@ -33083,10 +33672,7 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33083
33672
  ),
33084
33673
  risk: {
33085
33674
  riskFactor: _riskFactor4,
33086
- netRisk: _riskFactor4.reduce(
33087
- (acc, curr) => acc + curr.value * curr.weight,
33088
- 0
33089
- ) / _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),
33090
33676
  notARisks: getNoRiskTags(_riskFactor4)
33091
33677
  },
33092
33678
  auditUrl: AUDIT_URL4,
@@ -33101,16 +33687,19 @@ function getStrategySettings(lstSymbol, underlyingSymbol, settings, isPreview =
33101
33687
  investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
33102
33688
  isPreview,
33103
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",
33104
33691
  tags: lstSymbol.includes("BTC") ? ["BTC" /* BTC */, "Maxx" /* LEVERED */] : ["Maxx" /* LEVERED */],
33105
33692
  security: HYPER_LST_SECURITY,
33106
33693
  redemptionInfo: HYPER_LST_REDEMPTION_INFO,
33107
33694
  usualTimeToEarnings: "2 weeks",
33108
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.",
33109
- points: [{
33110
- multiplier: 4,
33111
- logo: "https://endur.fi/favicon.ico",
33112
- toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi."
33113
- }]
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
+ ]
33114
33703
  };
33115
33704
  }
33116
33705
  var HyperLSTStrategies = [
@@ -33948,6 +34537,7 @@ export {
33948
34537
  Initializable,
33949
34538
  InstantWithdrawalVault,
33950
34539
  LSTAPRService,
34540
+ LSTPriceType,
33951
34541
  MarginType,
33952
34542
  MyNumber,
33953
34543
  Network,