@strkfarm/sdk 1.1.29 → 1.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  AUMTypes: () => AUMTypes,
34
+ AVNU_EXCHANGE: () => AVNU_EXCHANGE,
34
35
  AVNU_MIDDLEWARE: () => AVNU_MIDDLEWARE,
35
36
  AutoCompounderSTRK: () => AutoCompounderSTRK,
36
37
  AvnuWrapper: () => AvnuWrapper,
@@ -49,7 +50,7 @@ __export(index_exports, {
49
50
  HyperLSTStrategies: () => HyperLSTStrategies,
50
51
  ILending: () => ILending,
51
52
  Initializable: () => Initializable,
52
- LSTAPRService: () => LSTAPRService2,
53
+ LSTAPRService: () => LSTAPRService,
53
54
  MarginType: () => MarginType,
54
55
  Network: () => Network,
55
56
  PRICE_ROUTER: () => PRICE_ROUTER,
@@ -76,6 +77,7 @@ __export(index_exports, {
76
77
  UniversalStrategies: () => UniversalStrategies,
77
78
  UniversalStrategy: () => UniversalStrategy,
78
79
  VESU_SINGLETON: () => VESU_SINGLETON,
80
+ VESU_V2_MODIFY_POSITION_SANITIZER: () => VESU_V2_MODIFY_POSITION_SANITIZER,
79
81
  VesuAdapter: () => VesuAdapter,
80
82
  VesuAmountDenomination: () => VesuAmountDenomination,
81
83
  VesuAmountType: () => VesuAmountType,
@@ -19125,9 +19127,11 @@ var import_starknet13 = require("starknet");
19125
19127
  // src/strategies/universal-adapters/adapter-utils.ts
19126
19128
  var SIMPLE_SANITIZER = ContractAddr.from("0x5a2e3ceb3da368b983a8717898427ab7b6daf04014b70f321e777f9aad940b4");
19127
19129
  var SIMPLE_SANITIZER_V2 = ContractAddr.from("0x7b6f98311af8aa425278570e62abf523e6462eaa01a38c1feab9b2f416492e2");
19130
+ var VESU_V2_MODIFY_POSITION_SANITIZER = ContractAddr.from("0x04Bf71F2BD9D6F8819057c9dD524F0d5fbc38317C00500d7b9a0FdCf01195066");
19128
19131
  var SIMPLE_SANITIZER_VESU_V1_DELEGATIONS = ContractAddr.from("0x5643d54da70a471cd2b6fa37f52ea7a13cc3f3910689a839f8490a663d2208a");
19129
19132
  var PRICE_ROUTER = ContractAddr.from("0x05e83Fa38D791d2dba8E6f487758A9687FfEe191A6Cf8a6c5761ab0a110DB837");
19130
19133
  var AVNU_MIDDLEWARE = ContractAddr.from("0x4a7972ed3f5d1e74a6d6c4a8f467666953d081c8f2270390cc169d50d17cb0d");
19134
+ var AVNU_EXCHANGE = ContractAddr.from("0x04270219d365d6b017231b52e92b3fb5d7c8378b05e9abc97724537a80e93b0f");
19131
19135
  var VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
19132
19136
  function toBigInt(value) {
19133
19137
  if (typeof value === "string") {
@@ -19272,11 +19276,11 @@ var CommonAdapter = class extends BaseAdapter {
19272
19276
  };
19273
19277
  };
19274
19278
  }
19275
- getAvnuAdapter(fromToken, toToken, id) {
19279
+ getAvnuAdapter(fromToken, toToken, id, isMiddleware) {
19276
19280
  return () => ({
19277
19281
  leaf: this.constructSimpleLeafData({
19278
19282
  id,
19279
- target: AVNU_MIDDLEWARE,
19283
+ target: isMiddleware ? AVNU_MIDDLEWARE : AVNU_EXCHANGE,
19280
19284
  method: "multi_route_swap",
19281
19285
  packedArguments: [
19282
19286
  fromToken.toBigInt(),
@@ -19284,15 +19288,15 @@ var CommonAdapter = class extends BaseAdapter {
19284
19288
  this.config.vaultAllocator.toBigInt()
19285
19289
  ]
19286
19290
  }),
19287
- callConstructor: this.getAvnuCall(fromToken, toToken).bind(this)
19291
+ callConstructor: this.getAvnuCall(fromToken, toToken, isMiddleware).bind(this)
19288
19292
  });
19289
19293
  }
19290
- getAvnuCall(fromToken, toToken) {
19294
+ getAvnuCall(fromToken, toToken, isMiddleware) {
19291
19295
  return (params) => {
19292
19296
  return {
19293
19297
  sanitizer: SIMPLE_SANITIZER,
19294
19298
  call: {
19295
- contractAddress: AVNU_MIDDLEWARE,
19299
+ contractAddress: isMiddleware ? AVNU_MIDDLEWARE : AVNU_EXCHANGE,
19296
19300
  selector: import_starknet14.hash.getSelectorFromName("multi_route_swap"),
19297
19301
  calldata: [
19298
19302
  fromToken.toBigInt(),
@@ -24046,24 +24050,30 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
24046
24050
  this.VESU_MULTIPLY = ContractAddr.from("0x027fef272d0a9a3844767c851a64b36fe4f0115141d81134baade95d2b27b781");
24047
24051
  this.getModifyPosition = () => {
24048
24052
  const positionData = [0n];
24049
- const packedArguments = [
24050
- toBigInt(this.config.poolId.toString()),
24051
- // pool id
24053
+ const { addr, isV2 } = getVesuSingletonAddress(this.config.poolId);
24054
+ const commonPackedData = [
24052
24055
  toBigInt(this.config.collateral.address.toString()),
24053
24056
  // collateral
24054
24057
  toBigInt(this.config.debt.address.toString()),
24055
24058
  // debt
24056
- toBigInt(this.config.vaultAllocator.toString()),
24059
+ toBigInt(this.config.vaultAllocator.toString())
24057
24060
  // vault allocator
24061
+ ];
24062
+ const packedArguments = isV2 ? [
24063
+ ...commonPackedData
24064
+ ] : [
24065
+ toBigInt(this.config.poolId.toString()),
24066
+ // pool id
24067
+ ...commonPackedData,
24058
24068
  toBigInt(positionData.length),
24059
24069
  ...positionData
24060
24070
  ];
24061
24071
  const output = this.constructSimpleLeafData({
24062
24072
  id: this.config.id,
24063
- target: getVesuSingletonAddress(this.config.poolId).addr,
24073
+ target: addr,
24064
24074
  method: "modify_position",
24065
24075
  packedArguments
24066
- });
24076
+ }, isV2 ? VESU_V2_MODIFY_POSITION_SANITIZER : SIMPLE_SANITIZER);
24067
24077
  return { leaf: output, callConstructor: this.getModifyPositionCall.bind(this) };
24068
24078
  };
24069
24079
  this.getModifyPositionCall = (params) => {
@@ -24104,7 +24114,7 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
24104
24114
  }
24105
24115
  });
24106
24116
  return {
24107
- sanitizer: SIMPLE_SANITIZER,
24117
+ sanitizer: isV2 ? VESU_V2_MODIFY_POSITION_SANITIZER : SIMPLE_SANITIZER,
24108
24118
  call: {
24109
24119
  contractAddress: ContractAddr.from(contract.address),
24110
24120
  selector: import_starknet15.hash.getSelectorFromName("modify_position"),
@@ -24114,25 +24124,27 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
24114
24124
  }
24115
24125
  };
24116
24126
  };
24117
- this.getMultiplyAdapter = () => {
24118
- const packedArguments = [
24119
- toBigInt(this.config.poolId.toString()),
24120
- // pool id
24121
- toBigInt(this.config.collateral.address.toString()),
24122
- // collateral
24123
- toBigInt(this.config.debt.address.toString()),
24124
- // debt
24125
- toBigInt(this.config.vaultAllocator.toString())
24126
- // vault allocator
24127
- ];
24128
- const { isV2 } = getVesuSingletonAddress(this.config.poolId);
24129
- const output = this.constructSimpleLeafData({
24130
- id: this.config.id,
24131
- target: isV2 ? this.VESU_MULTIPLY : this.VESU_MULTIPLY_V1,
24132
- method: "modify_lever",
24133
- packedArguments
24134
- }, SIMPLE_SANITIZER_V2);
24135
- return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
24127
+ this.getMultiplyAdapter = (id) => {
24128
+ return () => {
24129
+ const packedArguments = [
24130
+ toBigInt(this.config.poolId.toString()),
24131
+ // pool id
24132
+ toBigInt(this.config.collateral.address.toString()),
24133
+ // collateral
24134
+ toBigInt(this.config.debt.address.toString()),
24135
+ // debt
24136
+ toBigInt(this.config.vaultAllocator.toString())
24137
+ // vault allocator
24138
+ ];
24139
+ const { isV2 } = getVesuSingletonAddress(this.config.poolId);
24140
+ const output = this.constructSimpleLeafData({
24141
+ id,
24142
+ target: isV2 ? this.VESU_MULTIPLY : this.VESU_MULTIPLY_V1,
24143
+ method: "modify_lever",
24144
+ packedArguments
24145
+ }, SIMPLE_SANITIZER_V2);
24146
+ return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
24147
+ };
24136
24148
  };
24137
24149
  this.getMultiplyCall = (params) => {
24138
24150
  const isIncrease = params.isIncrease;
@@ -27343,7 +27355,7 @@ function getLooperSettings(token1Symbol, token2Symbol, vaultSettings, pool1, poo
27343
27355
  vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterUSDCETH));
27344
27356
  const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
27345
27357
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
27346
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
27358
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */, true).bind(commonAdapter));
27347
27359
  return vaultSettings;
27348
27360
  }
27349
27361
  var _riskFactor3 = [
@@ -27698,8 +27710,159 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
27698
27710
  return price;
27699
27711
  }
27700
27712
  async getAvnuSwapMultiplyCall(params) {
27701
- return [];
27713
+ return this._getAvnuDepositSwapLegCall({
27714
+ ...params,
27715
+ minHF: 1.02
27716
+ });
27717
+ }
27718
+ async _getAvnuDepositSwapLegCall(params) {
27719
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`);
27720
+ assert(params.isDeposit, "Only deposit is supported in _getAvnuDepositSwapLegCall");
27721
+ const [vesuAdapter1] = this.getVesuAdapters();
27722
+ const legLTV = await vesuAdapter1.getLTVConfig(this.config);
27723
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`);
27724
+ const existingPositions = await vesuAdapter1.getPositions(this.config);
27725
+ const collateralisation = await vesuAdapter1.getCollateralization(this.config);
27726
+ const existingCollateralInfo = existingPositions[0];
27727
+ const existingDebtInfo = existingPositions[1];
27728
+ logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
27729
+ existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
27730
+ const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
27731
+ const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
27732
+ logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
27733
+ const totalCollateral = existingCollateralInfo.amount.plus(params.leg1DepositAmount);
27734
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`);
27735
+ const totalDebtAmount = totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF);
27736
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}`);
27737
+ const debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
27738
+ if (debtAmount.lt(0)) {
27739
+ const lstDEXPrice = await this.getLSTDexPrice();
27740
+ const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
27741
+ const calls = await this.getVesuMultiplyCall({
27742
+ isDeposit: false,
27743
+ leg1DepositAmount: debtAmountInLST
27744
+ });
27745
+ assert(calls.length == 1, "Expected 1 call for unwind");
27746
+ return calls[0];
27747
+ }
27748
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`);
27749
+ const STEP0 = "approve_token1" /* APPROVE_TOKEN1 */;
27750
+ const manage0Info = this.getProofs(STEP0);
27751
+ const manageCall0 = manage0Info.callConstructor({
27752
+ amount: params.leg1DepositAmount
27753
+ });
27754
+ const STEP1 = "vesu_leg1" /* VESU_LEG1 */;
27755
+ const manage1Info = this.getProofs(STEP1);
27756
+ const manageCall1 = manage1Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
27757
+ collateralAmount: params.leg1DepositAmount,
27758
+ isAddCollateral: params.isDeposit,
27759
+ debtAmount,
27760
+ isBorrow: params.isDeposit
27761
+ }));
27762
+ const proofIds = [STEP0, STEP1];
27763
+ const manageCalls = [manageCall0, manageCall1];
27764
+ if (debtAmount.gt(0)) {
27765
+ const STEP2 = "avnu_multiply_approve_deposit" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */;
27766
+ const manage2Info = this.getProofs(STEP2);
27767
+ const manageCall2 = manage2Info.callConstructor({
27768
+ amount: debtAmount
27769
+ });
27770
+ const debtTokenInfo = vesuAdapter1.config.debt;
27771
+ const lstTokenInfo = this.asset();
27772
+ const avnuModule = new AvnuWrapper();
27773
+ const quote = await avnuModule.getQuotes(
27774
+ debtTokenInfo.address.address,
27775
+ lstTokenInfo.address.address,
27776
+ debtAmount.toWei(),
27777
+ this.metadata.additionalInfo.vaultAllocator.address
27778
+ );
27779
+ const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
27780
+ const minAmountWei = minAmount.toWei();
27781
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`);
27782
+ const swapInfo = await avnuModule.getSwapInfo(
27783
+ quote,
27784
+ this.metadata.additionalInfo.vaultAllocator.address,
27785
+ 0,
27786
+ this.address.address,
27787
+ minAmountWei
27788
+ );
27789
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`);
27790
+ const STEP3 = "avnu_multiply_swap_deposit" /* AVNU_MULTIPLY_SWAP_DEPOSIT */;
27791
+ const manage3Info = this.getProofs(STEP3);
27792
+ const manageCall3 = manage3Info.callConstructor({
27793
+ props: swapInfo
27794
+ });
27795
+ proofIds.push(STEP2);
27796
+ proofIds.push(STEP3);
27797
+ manageCalls.push(manageCall2, manageCall3);
27798
+ const newCollateral = minAmount.plus(totalCollateral);
27799
+ const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
27800
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`);
27801
+ if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
27802
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`);
27803
+ const STEP4 = "approve_token1" /* APPROVE_TOKEN1 */;
27804
+ const manage4Info = this.getProofs(STEP4);
27805
+ const manageCall4 = manage4Info.callConstructor({
27806
+ amount: minAmount
27807
+ });
27808
+ const STEP5 = "vesu_leg1" /* VESU_LEG1 */;
27809
+ const manage5Info = this.getProofs(STEP5);
27810
+ const manageCall5 = manage5Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
27811
+ collateralAmount: minAmount,
27812
+ isAddCollateral: true,
27813
+ debtAmount: Web3Number.fromWei("0", this.asset().decimals),
27814
+ isBorrow: params.isDeposit
27815
+ }));
27816
+ proofIds.push(STEP4, STEP5);
27817
+ manageCalls.push(manageCall4, manageCall5);
27818
+ }
27819
+ }
27820
+ const manageCall = this.getManageCall(proofIds, manageCalls);
27821
+ return manageCall;
27702
27822
  }
27823
+ // todo unwind or not deposit when the yield is bad.
27824
+ async getLSTMultiplierRebalanceCall() {
27825
+ const positions = await this.getVaultPositions();
27826
+ assert(positions.length == 3, "Rebalance call is only supported for 3 positions");
27827
+ const existingCollateralInfo = positions[0];
27828
+ const existingDebtInfo = positions[1];
27829
+ const unusedBalance = positions[2];
27830
+ const [healthFactor] = await this.getVesuHealthFactors();
27831
+ const [vesuAdapter1] = this.getVesuAdapters();
27832
+ const legLTV = await vesuAdapter1.getLTVConfig(this.config);
27833
+ const collateralisation = await vesuAdapter1.getCollateralization(this.config);
27834
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
27835
+ existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
27836
+ const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
27837
+ const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
27838
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
27839
+ const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
27840
+ const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
27841
+ if (isHFTooLow || isHFTooHigh) {
27842
+ const manageCall = await this._getAvnuDepositSwapLegCall({
27843
+ isDeposit: true,
27844
+ leg1DepositAmount: unusedBalance.amount,
27845
+ minHF: 1.02
27846
+ // todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
27847
+ });
27848
+ return { shouldRebalance: true, manageCall };
27849
+ } else {
27850
+ return { shouldRebalance: false, manageCall: void 0 };
27851
+ }
27852
+ }
27853
+ //
27854
+ async _getMinOutputAmountLSTBuy(amountInUnderlying) {
27855
+ const lstTruePrice = await this.getLSTExchangeRate();
27856
+ const minOutputAmount = amountInUnderlying.dividedBy(lstTruePrice);
27857
+ return minOutputAmount;
27858
+ }
27859
+ async _getMinOutputAmountLSTSell(amountInLST) {
27860
+ const lstTruePrice = await this.getLSTExchangeRate();
27861
+ const minOutputAmount = amountInLST.multipliedBy(lstTruePrice).multipliedBy(0.995);
27862
+ return minOutputAmount;
27863
+ }
27864
+ // todo add a function to findout max borrowable amount without fucking yield
27865
+ // if the current net yield < LST yield, add a function to calculate how much to unwind.
27703
27866
  /**
27704
27867
  * Uses vesu's multiple call to create leverage on LST
27705
27868
  * Deposit amount is in LST
@@ -27751,7 +27914,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
27751
27914
  async getLSTAPR(_address) {
27752
27915
  try {
27753
27916
  const vesuAdapter1 = this.getVesuAdapters()[0];
27754
- return await LSTAPRService2.getLSTAPR(vesuAdapter1.config.debt.address);
27917
+ const apr = await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
27918
+ if (!apr) {
27919
+ throw new Error("Failed to get LST APR");
27920
+ }
27921
+ return apr;
27755
27922
  } catch (error) {
27756
27923
  logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
27757
27924
  return 0;
@@ -27762,7 +27929,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
27762
27929
  const { net, splits } = await super.netAPY();
27763
27930
  let _net = net;
27764
27931
  if (this.asset().symbol == "xWBTC") {
27765
- _net *= 5;
27932
+ const debtToken = this.getVesuAdapters()[0].config.debt;
27933
+ const lstAPY = await this.getLSTAPR(debtToken.address);
27934
+ _net = lstAPY * 5;
27766
27935
  }
27767
27936
  return {
27768
27937
  net: _net,
@@ -27809,7 +27978,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
27809
27978
  const proofsIDs = [];
27810
27979
  const manageCalls = [];
27811
27980
  if (params.marginAmount.greaterThan(0)) {
27812
- const STEP1_ID = "approve_token1" /* APPROVE_TOKEN1 */;
27981
+ const STEP1_ID = "multiple_approve" /* MULTIPLE_APPROVE */;
27813
27982
  const manage1Info = this.getProofs(STEP1_ID);
27814
27983
  const depositAmount = params.marginAmount;
27815
27984
  const manageCall1 = manage1Info.callConstructor({
@@ -27919,12 +28088,22 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
27919
28088
  highlightTextWithLinks("conversion rate oracle", [{ highlight: "conversion rate oracle", link: "https://docs.pragma.build/starknet/development#conversion-rate" }]),
27920
28089
  "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."
27921
28090
  ] }),
27922
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
27923
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
27924
- " Requests can take up to ",
27925
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
27926
- " to process as the vault unwinds and settles routing."
27927
- ] }) })
28091
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: [
28092
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
28093
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
28094
+ " Requests can take up to ",
28095
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
28096
+ " to process as the vault unwinds and settles routing."
28097
+ ] }),
28098
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
28099
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Debt limits:" }),
28100
+ " 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."
28101
+ ] }),
28102
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
28103
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "APY assumptions:" }),
28104
+ " APY shown is the max possible value given current LST and borrowing rates. True APY will be subject to the actual leverage, based on above point. More insights on exact APY will be added soon."
28105
+ ] })
28106
+ ] })
27928
28107
  ] });
27929
28108
  }
27930
28109
  function getDescription2(tokenSymbol, underlyingSymbol) {
@@ -27939,7 +28118,7 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
27939
28118
  collateral: lstToken,
27940
28119
  debt: underlyingToken,
27941
28120
  vaultAllocator: vaultSettings.vaultAllocator,
27942
- id: "multiply_vesu" /* MULTIPLY_VESU */
28121
+ id: "vesu_leg1" /* VESU_LEG1 */
27943
28122
  });
27944
28123
  const commonAdapter = new CommonAdapter({
27945
28124
  manager: vaultSettings.manager,
@@ -27948,10 +28127,10 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
27948
28127
  vaultAddress: vaultSettings.vaultAddress,
27949
28128
  vaultAllocator: vaultSettings.vaultAllocator
27950
28129
  });
27951
- const { isV2 } = getVesuSingletonAddress(pool1);
28130
+ const { isV2, addr: poolAddr } = getVesuSingletonAddress(pool1);
27952
28131
  const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
27953
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
27954
- vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter.bind(vesuAdapterLST));
28132
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, "multiple_approve" /* MULTIPLE_APPROVE */).bind(commonAdapter));
28133
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter("multiply_vesu" /* MULTIPLY_VESU */).bind(vesuAdapterLST));
27955
28134
  vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_on" /* SWITCH_DELEGATION_ON */).bind(vesuAdapterLST));
27956
28135
  vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_off" /* SWITCH_DELEGATION_OFF */).bind(vesuAdapterLST));
27957
28136
  vaultSettings.adapters.push(...[{
@@ -27961,12 +28140,18 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
27961
28140
  id: "common_adapter" /* COMMON */,
27962
28141
  adapter: commonAdapter
27963
28142
  }]);
28143
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(underlyingToken.address, AVNU_EXCHANGE, "avnu_multiply_approve_deposit" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */).bind(commonAdapter));
28144
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(underlyingToken.address, lstToken.address, "avnu_multiply_swap_deposit" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, false).bind(commonAdapter));
28145
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, AVNU_EXCHANGE, "avnu_multiply_approve_withdraw" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */).bind(commonAdapter));
28146
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(lstToken.address, underlyingToken.address, "avnu_multiply_swap_withdraw" /* AVNU_MULTIPLY_SWAP_WITHDRAW */, false).bind(commonAdapter));
28147
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
28148
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST));
27964
28149
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
27965
28150
  vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
27966
28151
  vaultSettings.leafAdapters.push(vesuAdapterLST.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterLST));
27967
28152
  const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
27968
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
27969
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
28153
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_EXCHANGE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
28154
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */, false).bind(commonAdapter));
27970
28155
  return vaultSettings;
27971
28156
  }
27972
28157
  var AUDIT_URL4 = "https://docs.troves.fi/p/security#starknet-vault-kit";
@@ -28067,11 +28252,11 @@ var hyperxsBTC = {
28067
28252
  minHealthFactor: 1.05
28068
28253
  };
28069
28254
  var hyperxLBTC = {
28070
- vaultAddress: ContractAddr.from("0x38e96a301428d204ab4553799aa386a0f14a5ef9b30a5830be1814e4fb8da1c"),
28071
- manager: ContractAddr.from("0x18d376446d9df1f783e17aff1f21bac3d97aa3ba378e367742cdd744468ad35"),
28072
- vaultAllocator: ContractAddr.from("0x3e98774ca0508505ba6d7f17d95ec391648f44f947b0d211241464a4f5b9b20"),
28073
- redeemRequestNFT: ContractAddr.from("0x268017b4c8b2117ca0136d9a77e3666db44b143447566f0746ca0b1c9ab1e72"),
28074
- aumOracle: ContractAddr.from("0x521a3f339c65e918e0d8a065b14baef1ea25676bb7fca1e0238ac47e20d7755"),
28255
+ vaultAddress: ContractAddr.from("0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"),
28256
+ manager: ContractAddr.from("0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"),
28257
+ vaultAllocator: ContractAddr.from("0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"),
28258
+ redeemRequestNFT: ContractAddr.from("0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"),
28259
+ aumOracle: ContractAddr.from("0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0"),
28075
28260
  leafAdapters: [],
28076
28261
  adapters: [],
28077
28262
  targetHealthFactor: 1.1,
@@ -28079,7 +28264,7 @@ var hyperxLBTC = {
28079
28264
  };
28080
28265
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
28081
28266
  return [
28082
- `Deposit ${underlyingSymbol} into the vault`,
28267
+ `Deposit ${lstSymbol} into the vault`,
28083
28268
  `The vault manager loops the ${underlyingSymbol} to buy ${lstSymbol}`,
28084
28269
  `The vault manager collateralizes the ${lstSymbol} on Vesu`,
28085
28270
  `The vault manager borrows more ${underlyingSymbol} to loop further`,
@@ -28168,7 +28353,7 @@ var PricerLST2 = class extends Pricer {
28168
28353
  };
28169
28354
 
28170
28355
  // src/modules/lst-apr.ts
28171
- var LSTAPRService2 = class {
28356
+ var LSTAPRService = class {
28172
28357
  // 5 minutes
28173
28358
  /**
28174
28359
  * Fetches LST stats from Endur API with caching
@@ -28263,10 +28448,10 @@ var LSTAPRService2 = class {
28263
28448
  logger.verbose(`LSTAPRService: Cache cleared`);
28264
28449
  }
28265
28450
  };
28266
- LSTAPRService2.ENDUR_API_URL = "https://app.endur.fi/api/lst/stats";
28267
- LSTAPRService2.cache = null;
28268
- LSTAPRService2.cacheTimestamp = 0;
28269
- LSTAPRService2.CACHE_DURATION = 5 * 60 * 1e3;
28451
+ LSTAPRService.ENDUR_API_URL = "https://app.endur.fi/api/lst/stats";
28452
+ LSTAPRService.cache = null;
28453
+ LSTAPRService.cacheTimestamp = 0;
28454
+ LSTAPRService.CACHE_DURATION = 5 * 60 * 1e3;
28270
28455
 
28271
28456
  // src/notifs/telegram.ts
28272
28457
  var import_node_telegram_bot_api = __toESM(require("node-telegram-bot-api"));
@@ -28778,6 +28963,7 @@ var deployer_default = Deployer;
28778
28963
  // Annotate the CommonJS export names for ESM import in node:
28779
28964
  0 && (module.exports = {
28780
28965
  AUMTypes,
28966
+ AVNU_EXCHANGE,
28781
28967
  AVNU_MIDDLEWARE,
28782
28968
  AutoCompounderSTRK,
28783
28969
  AvnuWrapper,
@@ -28823,6 +29009,7 @@ var deployer_default = Deployer;
28823
29009
  UniversalStrategies,
28824
29010
  UniversalStrategy,
28825
29011
  VESU_SINGLETON,
29012
+ VESU_V2_MODIFY_POSITION_SANITIZER,
28826
29013
  VesuAdapter,
28827
29014
  VesuAmountDenomination,
28828
29015
  VesuAmountType,