@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.
@@ -19129,9 +19129,11 @@ import { hash, num as num6, shortString } from "starknet";
19129
19129
  // src/strategies/universal-adapters/adapter-utils.ts
19130
19130
  var SIMPLE_SANITIZER = ContractAddr.from("0x5a2e3ceb3da368b983a8717898427ab7b6daf04014b70f321e777f9aad940b4");
19131
19131
  var SIMPLE_SANITIZER_V2 = ContractAddr.from("0x7b6f98311af8aa425278570e62abf523e6462eaa01a38c1feab9b2f416492e2");
19132
+ var VESU_V2_MODIFY_POSITION_SANITIZER = ContractAddr.from("0x04Bf71F2BD9D6F8819057c9dD524F0d5fbc38317C00500d7b9a0FdCf01195066");
19132
19133
  var SIMPLE_SANITIZER_VESU_V1_DELEGATIONS = ContractAddr.from("0x5643d54da70a471cd2b6fa37f52ea7a13cc3f3910689a839f8490a663d2208a");
19133
19134
  var PRICE_ROUTER = ContractAddr.from("0x05e83Fa38D791d2dba8E6f487758A9687FfEe191A6Cf8a6c5761ab0a110DB837");
19134
19135
  var AVNU_MIDDLEWARE = ContractAddr.from("0x4a7972ed3f5d1e74a6d6c4a8f467666953d081c8f2270390cc169d50d17cb0d");
19136
+ var AVNU_EXCHANGE = ContractAddr.from("0x04270219d365d6b017231b52e92b3fb5d7c8378b05e9abc97724537a80e93b0f");
19135
19137
  var VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
19136
19138
  function toBigInt(value) {
19137
19139
  if (typeof value === "string") {
@@ -19276,11 +19278,11 @@ var CommonAdapter = class extends BaseAdapter {
19276
19278
  };
19277
19279
  };
19278
19280
  }
19279
- getAvnuAdapter(fromToken, toToken, id) {
19281
+ getAvnuAdapter(fromToken, toToken, id, isMiddleware) {
19280
19282
  return () => ({
19281
19283
  leaf: this.constructSimpleLeafData({
19282
19284
  id,
19283
- target: AVNU_MIDDLEWARE,
19285
+ target: isMiddleware ? AVNU_MIDDLEWARE : AVNU_EXCHANGE,
19284
19286
  method: "multi_route_swap",
19285
19287
  packedArguments: [
19286
19288
  fromToken.toBigInt(),
@@ -19288,15 +19290,15 @@ var CommonAdapter = class extends BaseAdapter {
19288
19290
  this.config.vaultAllocator.toBigInt()
19289
19291
  ]
19290
19292
  }),
19291
- callConstructor: this.getAvnuCall(fromToken, toToken).bind(this)
19293
+ callConstructor: this.getAvnuCall(fromToken, toToken, isMiddleware).bind(this)
19292
19294
  });
19293
19295
  }
19294
- getAvnuCall(fromToken, toToken) {
19296
+ getAvnuCall(fromToken, toToken, isMiddleware) {
19295
19297
  return (params) => {
19296
19298
  return {
19297
19299
  sanitizer: SIMPLE_SANITIZER,
19298
19300
  call: {
19299
- contractAddress: AVNU_MIDDLEWARE,
19301
+ contractAddress: isMiddleware ? AVNU_MIDDLEWARE : AVNU_EXCHANGE,
19300
19302
  selector: hash2.getSelectorFromName("multi_route_swap"),
19301
19303
  calldata: [
19302
19304
  fromToken.toBigInt(),
@@ -24050,24 +24052,30 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
24050
24052
  this.VESU_MULTIPLY = ContractAddr.from("0x027fef272d0a9a3844767c851a64b36fe4f0115141d81134baade95d2b27b781");
24051
24053
  this.getModifyPosition = () => {
24052
24054
  const positionData = [0n];
24053
- const packedArguments = [
24054
- toBigInt(this.config.poolId.toString()),
24055
- // pool id
24055
+ const { addr, isV2 } = getVesuSingletonAddress(this.config.poolId);
24056
+ const commonPackedData = [
24056
24057
  toBigInt(this.config.collateral.address.toString()),
24057
24058
  // collateral
24058
24059
  toBigInt(this.config.debt.address.toString()),
24059
24060
  // debt
24060
- toBigInt(this.config.vaultAllocator.toString()),
24061
+ toBigInt(this.config.vaultAllocator.toString())
24061
24062
  // vault allocator
24063
+ ];
24064
+ const packedArguments = isV2 ? [
24065
+ ...commonPackedData
24066
+ ] : [
24067
+ toBigInt(this.config.poolId.toString()),
24068
+ // pool id
24069
+ ...commonPackedData,
24062
24070
  toBigInt(positionData.length),
24063
24071
  ...positionData
24064
24072
  ];
24065
24073
  const output = this.constructSimpleLeafData({
24066
24074
  id: this.config.id,
24067
- target: getVesuSingletonAddress(this.config.poolId).addr,
24075
+ target: addr,
24068
24076
  method: "modify_position",
24069
24077
  packedArguments
24070
- });
24078
+ }, isV2 ? VESU_V2_MODIFY_POSITION_SANITIZER : SIMPLE_SANITIZER);
24071
24079
  return { leaf: output, callConstructor: this.getModifyPositionCall.bind(this) };
24072
24080
  };
24073
24081
  this.getModifyPositionCall = (params) => {
@@ -24108,7 +24116,7 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
24108
24116
  }
24109
24117
  });
24110
24118
  return {
24111
- sanitizer: SIMPLE_SANITIZER,
24119
+ sanitizer: isV2 ? VESU_V2_MODIFY_POSITION_SANITIZER : SIMPLE_SANITIZER,
24112
24120
  call: {
24113
24121
  contractAddress: ContractAddr.from(contract.address),
24114
24122
  selector: hash3.getSelectorFromName("modify_position"),
@@ -24118,25 +24126,27 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
24118
24126
  }
24119
24127
  };
24120
24128
  };
24121
- this.getMultiplyAdapter = () => {
24122
- const packedArguments = [
24123
- toBigInt(this.config.poolId.toString()),
24124
- // pool id
24125
- toBigInt(this.config.collateral.address.toString()),
24126
- // collateral
24127
- toBigInt(this.config.debt.address.toString()),
24128
- // debt
24129
- toBigInt(this.config.vaultAllocator.toString())
24130
- // vault allocator
24131
- ];
24132
- const { isV2 } = getVesuSingletonAddress(this.config.poolId);
24133
- const output = this.constructSimpleLeafData({
24134
- id: this.config.id,
24135
- target: isV2 ? this.VESU_MULTIPLY : this.VESU_MULTIPLY_V1,
24136
- method: "modify_lever",
24137
- packedArguments
24138
- }, SIMPLE_SANITIZER_V2);
24139
- return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
24129
+ this.getMultiplyAdapter = (id) => {
24130
+ return () => {
24131
+ const packedArguments = [
24132
+ toBigInt(this.config.poolId.toString()),
24133
+ // pool id
24134
+ toBigInt(this.config.collateral.address.toString()),
24135
+ // collateral
24136
+ toBigInt(this.config.debt.address.toString()),
24137
+ // debt
24138
+ toBigInt(this.config.vaultAllocator.toString())
24139
+ // vault allocator
24140
+ ];
24141
+ const { isV2 } = getVesuSingletonAddress(this.config.poolId);
24142
+ const output = this.constructSimpleLeafData({
24143
+ id,
24144
+ target: isV2 ? this.VESU_MULTIPLY : this.VESU_MULTIPLY_V1,
24145
+ method: "modify_lever",
24146
+ packedArguments
24147
+ }, SIMPLE_SANITIZER_V2);
24148
+ return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
24149
+ };
24140
24150
  };
24141
24151
  this.getMultiplyCall = (params) => {
24142
24152
  const isIncrease = params.isIncrease;
@@ -27347,7 +27357,7 @@ function getLooperSettings(token1Symbol, token2Symbol, vaultSettings, pool1, poo
27347
27357
  vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterUSDCETH));
27348
27358
  const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
27349
27359
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
27350
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
27360
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */, true).bind(commonAdapter));
27351
27361
  return vaultSettings;
27352
27362
  }
27353
27363
  var _riskFactor3 = [
@@ -27702,8 +27712,159 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
27702
27712
  return price;
27703
27713
  }
27704
27714
  async getAvnuSwapMultiplyCall(params) {
27705
- return [];
27715
+ return this._getAvnuDepositSwapLegCall({
27716
+ ...params,
27717
+ minHF: 1.02
27718
+ });
27719
+ }
27720
+ async _getAvnuDepositSwapLegCall(params) {
27721
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall params: ${JSON.stringify(params)}`);
27722
+ assert(params.isDeposit, "Only deposit is supported in _getAvnuDepositSwapLegCall");
27723
+ const [vesuAdapter1] = this.getVesuAdapters();
27724
+ const legLTV = await vesuAdapter1.getLTVConfig(this.config);
27725
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall legLTV: ${legLTV}`);
27726
+ const existingPositions = await vesuAdapter1.getPositions(this.config);
27727
+ const collateralisation = await vesuAdapter1.getCollateralization(this.config);
27728
+ const existingCollateralInfo = existingPositions[0];
27729
+ const existingDebtInfo = existingPositions[1];
27730
+ logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
27731
+ existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
27732
+ const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
27733
+ const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
27734
+ logger.debug(`${this.getTag()}::_getAvnuDepositSwapLegCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
27735
+ const totalCollateral = existingCollateralInfo.amount.plus(params.leg1DepositAmount);
27736
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalCollateral: ${totalCollateral}`);
27737
+ const totalDebtAmount = totalCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(debtPrice).dividedBy(params.minHF);
27738
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall totalDebtAmount: ${totalDebtAmount}`);
27739
+ const debtAmount = totalDebtAmount.minus(existingDebtInfo.amount);
27740
+ if (debtAmount.lt(0)) {
27741
+ const lstDEXPrice = await this.getLSTDexPrice();
27742
+ const debtAmountInLST = debtAmount.abs().dividedBy(lstDEXPrice);
27743
+ const calls = await this.getVesuMultiplyCall({
27744
+ isDeposit: false,
27745
+ leg1DepositAmount: debtAmountInLST
27746
+ });
27747
+ assert(calls.length == 1, "Expected 1 call for unwind");
27748
+ return calls[0];
27749
+ }
27750
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall debtAmount: ${debtAmount}`);
27751
+ const STEP0 = "approve_token1" /* APPROVE_TOKEN1 */;
27752
+ const manage0Info = this.getProofs(STEP0);
27753
+ const manageCall0 = manage0Info.callConstructor({
27754
+ amount: params.leg1DepositAmount
27755
+ });
27756
+ const STEP1 = "vesu_leg1" /* VESU_LEG1 */;
27757
+ const manage1Info = this.getProofs(STEP1);
27758
+ const manageCall1 = manage1Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
27759
+ collateralAmount: params.leg1DepositAmount,
27760
+ isAddCollateral: params.isDeposit,
27761
+ debtAmount,
27762
+ isBorrow: params.isDeposit
27763
+ }));
27764
+ const proofIds = [STEP0, STEP1];
27765
+ const manageCalls = [manageCall0, manageCall1];
27766
+ if (debtAmount.gt(0)) {
27767
+ const STEP2 = "avnu_multiply_approve_deposit" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */;
27768
+ const manage2Info = this.getProofs(STEP2);
27769
+ const manageCall2 = manage2Info.callConstructor({
27770
+ amount: debtAmount
27771
+ });
27772
+ const debtTokenInfo = vesuAdapter1.config.debt;
27773
+ const lstTokenInfo = this.asset();
27774
+ const avnuModule = new AvnuWrapper();
27775
+ const quote = await avnuModule.getQuotes(
27776
+ debtTokenInfo.address.address,
27777
+ lstTokenInfo.address.address,
27778
+ debtAmount.toWei(),
27779
+ this.metadata.additionalInfo.vaultAllocator.address
27780
+ );
27781
+ const minAmount = await this._getMinOutputAmountLSTBuy(debtAmount);
27782
+ const minAmountWei = minAmount.toWei();
27783
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall minAmount: ${minAmount}`);
27784
+ const swapInfo = await avnuModule.getSwapInfo(
27785
+ quote,
27786
+ this.metadata.additionalInfo.vaultAllocator.address,
27787
+ 0,
27788
+ this.address.address,
27789
+ minAmountWei
27790
+ );
27791
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall swapInfo: ${JSON.stringify(swapInfo)}`);
27792
+ const STEP3 = "avnu_multiply_swap_deposit" /* AVNU_MULTIPLY_SWAP_DEPOSIT */;
27793
+ const manage3Info = this.getProofs(STEP3);
27794
+ const manageCall3 = manage3Info.callConstructor({
27795
+ props: swapInfo
27796
+ });
27797
+ proofIds.push(STEP2);
27798
+ proofIds.push(STEP3);
27799
+ manageCalls.push(manageCall2, manageCall3);
27800
+ const newCollateral = minAmount.plus(totalCollateral);
27801
+ const newHF = newCollateral.multipliedBy(collateralPrice).multipliedBy(legLTV).dividedBy(totalDebtAmount).dividedBy(debtPrice).toNumber();
27802
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF: ${newHF}`);
27803
+ if (newHF > this.metadata.additionalInfo.minHealthFactor && newHF < this.metadata.additionalInfo.targetHealthFactor + 0.05) {
27804
+ logger.verbose(`${this.getTag()}::_getAvnuDepositSwapLegCall newHF is above min and below target + 0.05, adding collateral on vesu`);
27805
+ const STEP4 = "approve_token1" /* APPROVE_TOKEN1 */;
27806
+ const manage4Info = this.getProofs(STEP4);
27807
+ const manageCall4 = manage4Info.callConstructor({
27808
+ amount: minAmount
27809
+ });
27810
+ const STEP5 = "vesu_leg1" /* VESU_LEG1 */;
27811
+ const manage5Info = this.getProofs(STEP5);
27812
+ const manageCall5 = manage5Info.callConstructor(VesuAdapter.getDefaultModifyPositionCallParams({
27813
+ collateralAmount: minAmount,
27814
+ isAddCollateral: true,
27815
+ debtAmount: Web3Number.fromWei("0", this.asset().decimals),
27816
+ isBorrow: params.isDeposit
27817
+ }));
27818
+ proofIds.push(STEP4, STEP5);
27819
+ manageCalls.push(manageCall4, manageCall5);
27820
+ }
27821
+ }
27822
+ const manageCall = this.getManageCall(proofIds, manageCalls);
27823
+ return manageCall;
27706
27824
  }
27825
+ // todo unwind or not deposit when the yield is bad.
27826
+ async getLSTMultiplierRebalanceCall() {
27827
+ const positions = await this.getVaultPositions();
27828
+ assert(positions.length == 3, "Rebalance call is only supported for 3 positions");
27829
+ const existingCollateralInfo = positions[0];
27830
+ const existingDebtInfo = positions[1];
27831
+ const unusedBalance = positions[2];
27832
+ const [healthFactor] = await this.getVesuHealthFactors();
27833
+ const [vesuAdapter1] = this.getVesuAdapters();
27834
+ const legLTV = await vesuAdapter1.getLTVConfig(this.config);
27835
+ const collateralisation = await vesuAdapter1.getCollateralization(this.config);
27836
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
27837
+ existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
27838
+ const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
27839
+ const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
27840
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
27841
+ const isHFTooLow = healthFactor < this.metadata.additionalInfo.minHealthFactor;
27842
+ const isHFTooHigh = healthFactor > this.metadata.additionalInfo.targetHealthFactor + 0.05;
27843
+ if (isHFTooLow || isHFTooHigh) {
27844
+ const manageCall = await this._getAvnuDepositSwapLegCall({
27845
+ isDeposit: true,
27846
+ leg1DepositAmount: unusedBalance.amount,
27847
+ minHF: 1.02
27848
+ // todo, shouldnt use this 1.02 HF, if there isn;t more looping left.
27849
+ });
27850
+ return { shouldRebalance: true, manageCall };
27851
+ } else {
27852
+ return { shouldRebalance: false, manageCall: void 0 };
27853
+ }
27854
+ }
27855
+ //
27856
+ async _getMinOutputAmountLSTBuy(amountInUnderlying) {
27857
+ const lstTruePrice = await this.getLSTExchangeRate();
27858
+ const minOutputAmount = amountInUnderlying.dividedBy(lstTruePrice);
27859
+ return minOutputAmount;
27860
+ }
27861
+ async _getMinOutputAmountLSTSell(amountInLST) {
27862
+ const lstTruePrice = await this.getLSTExchangeRate();
27863
+ const minOutputAmount = amountInLST.multipliedBy(lstTruePrice).multipliedBy(0.995);
27864
+ return minOutputAmount;
27865
+ }
27866
+ // todo add a function to findout max borrowable amount without fucking yield
27867
+ // if the current net yield < LST yield, add a function to calculate how much to unwind.
27707
27868
  /**
27708
27869
  * Uses vesu's multiple call to create leverage on LST
27709
27870
  * Deposit amount is in LST
@@ -27755,7 +27916,11 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
27755
27916
  async getLSTAPR(_address) {
27756
27917
  try {
27757
27918
  const vesuAdapter1 = this.getVesuAdapters()[0];
27758
- return await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
27919
+ const apr = await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
27920
+ if (!apr) {
27921
+ throw new Error("Failed to get LST APR");
27922
+ }
27923
+ return apr;
27759
27924
  } catch (error) {
27760
27925
  logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
27761
27926
  return 0;
@@ -27766,7 +27931,9 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
27766
27931
  const { net, splits } = await super.netAPY();
27767
27932
  let _net = net;
27768
27933
  if (this.asset().symbol == "xWBTC") {
27769
- _net *= 5;
27934
+ const debtToken = this.getVesuAdapters()[0].config.debt;
27935
+ const lstAPY = await this.getLSTAPR(debtToken.address);
27936
+ _net = lstAPY * 5;
27770
27937
  }
27771
27938
  return {
27772
27939
  net: _net,
@@ -27813,7 +27980,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
27813
27980
  const proofsIDs = [];
27814
27981
  const manageCalls = [];
27815
27982
  if (params.marginAmount.greaterThan(0)) {
27816
- const STEP1_ID = "approve_token1" /* APPROVE_TOKEN1 */;
27983
+ const STEP1_ID = "multiple_approve" /* MULTIPLE_APPROVE */;
27817
27984
  const manage1Info = this.getProofs(STEP1_ID);
27818
27985
  const depositAmount = params.marginAmount;
27819
27986
  const manageCall1 = manage1Info.callConstructor({
@@ -27923,12 +28090,22 @@ function VaultDescription(lstSymbol, underlyingSymbol) {
27923
28090
  highlightTextWithLinks("conversion rate oracle", [{ highlight: "conversion rate oracle", link: "https://docs.pragma.build/starknet/development#conversion-rate" }]),
27924
28091
  "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."
27925
28092
  ] }),
27926
- /* @__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: [
27927
- /* @__PURE__ */ jsx5("strong", { children: "Withdrawals:" }),
27928
- " Requests can take up to ",
27929
- /* @__PURE__ */ jsx5("strong", { children: "1-2 hours" }),
27930
- " to process as the vault unwinds and settles routing."
27931
- ] }) })
28093
+ /* @__PURE__ */ jsxs4("div", { style: { backgroundColor: "#222", padding: "10px", borderRadius: "8px", marginBottom: "20px", border: "1px solid #444" }, children: [
28094
+ /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
28095
+ /* @__PURE__ */ jsx5("strong", { children: "Withdrawals:" }),
28096
+ " Requests can take up to ",
28097
+ /* @__PURE__ */ jsx5("strong", { children: "1-2 hours" }),
28098
+ " to process as the vault unwinds and settles routing."
28099
+ ] }),
28100
+ /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
28101
+ /* @__PURE__ */ jsx5("strong", { children: "Debt limits:" }),
28102
+ " 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."
28103
+ ] }),
28104
+ /* @__PURE__ */ jsxs4("p", { style: { fontSize: "13px", color: "#ccc" }, children: [
28105
+ /* @__PURE__ */ jsx5("strong", { children: "APY assumptions:" }),
28106
+ " 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."
28107
+ ] })
28108
+ ] })
27932
28109
  ] });
27933
28110
  }
27934
28111
  function getDescription2(tokenSymbol, underlyingSymbol) {
@@ -27943,7 +28120,7 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
27943
28120
  collateral: lstToken,
27944
28121
  debt: underlyingToken,
27945
28122
  vaultAllocator: vaultSettings.vaultAllocator,
27946
- id: "multiply_vesu" /* MULTIPLY_VESU */
28123
+ id: "vesu_leg1" /* VESU_LEG1 */
27947
28124
  });
27948
28125
  const commonAdapter = new CommonAdapter({
27949
28126
  manager: vaultSettings.manager,
@@ -27952,10 +28129,10 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
27952
28129
  vaultAddress: vaultSettings.vaultAddress,
27953
28130
  vaultAllocator: vaultSettings.vaultAllocator
27954
28131
  });
27955
- const { isV2 } = getVesuSingletonAddress(pool1);
28132
+ const { isV2, addr: poolAddr } = getVesuSingletonAddress(pool1);
27956
28133
  const VESU_MULTIPLY = isV2 ? vesuAdapterLST.VESU_MULTIPLY : vesuAdapterLST.VESU_MULTIPLY_V1;
27957
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
27958
- vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter.bind(vesuAdapterLST));
28134
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, "multiple_approve" /* MULTIPLE_APPROVE */).bind(commonAdapter));
28135
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter("multiply_vesu" /* MULTIPLY_VESU */).bind(vesuAdapterLST));
27959
28136
  vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_on" /* SWITCH_DELEGATION_ON */).bind(vesuAdapterLST));
27960
28137
  vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_off" /* SWITCH_DELEGATION_OFF */).bind(vesuAdapterLST));
27961
28138
  vaultSettings.adapters.push(...[{
@@ -27965,12 +28142,18 @@ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
27965
28142
  id: "common_adapter" /* COMMON */,
27966
28143
  adapter: commonAdapter
27967
28144
  }]);
28145
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(underlyingToken.address, AVNU_EXCHANGE, "avnu_multiply_approve_deposit" /* AVNU_MULTIPLY_APPROVE_DEPOSIT */).bind(commonAdapter));
28146
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(underlyingToken.address, lstToken.address, "avnu_multiply_swap_deposit" /* AVNU_MULTIPLY_SWAP_DEPOSIT */, false).bind(commonAdapter));
28147
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, AVNU_EXCHANGE, "avnu_multiply_approve_withdraw" /* AVNU_MULTIPLY_APPROVE_WITHDRAW */).bind(commonAdapter));
28148
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(lstToken.address, underlyingToken.address, "avnu_multiply_swap_withdraw" /* AVNU_MULTIPLY_SWAP_WITHDRAW */, false).bind(commonAdapter));
28149
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
28150
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getModifyPosition.bind(vesuAdapterLST));
27968
28151
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
27969
28152
  vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
27970
28153
  vaultSettings.leafAdapters.push(vesuAdapterLST.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterLST));
27971
28154
  const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
27972
- vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
27973
- vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
28155
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_EXCHANGE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
28156
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */, false).bind(commonAdapter));
27974
28157
  return vaultSettings;
27975
28158
  }
27976
28159
  var AUDIT_URL4 = "https://docs.troves.fi/p/security#starknet-vault-kit";
@@ -28071,11 +28254,11 @@ var hyperxsBTC = {
28071
28254
  minHealthFactor: 1.05
28072
28255
  };
28073
28256
  var hyperxLBTC = {
28074
- vaultAddress: ContractAddr.from("0x38e96a301428d204ab4553799aa386a0f14a5ef9b30a5830be1814e4fb8da1c"),
28075
- manager: ContractAddr.from("0x18d376446d9df1f783e17aff1f21bac3d97aa3ba378e367742cdd744468ad35"),
28076
- vaultAllocator: ContractAddr.from("0x3e98774ca0508505ba6d7f17d95ec391648f44f947b0d211241464a4f5b9b20"),
28077
- redeemRequestNFT: ContractAddr.from("0x268017b4c8b2117ca0136d9a77e3666db44b143447566f0746ca0b1c9ab1e72"),
28078
- aumOracle: ContractAddr.from("0x521a3f339c65e918e0d8a065b14baef1ea25676bb7fca1e0238ac47e20d7755"),
28257
+ vaultAddress: ContractAddr.from("0x64cf24d4883fe569926419a0569ab34497c6956a1a308fa883257f7486d7030"),
28258
+ manager: ContractAddr.from("0x203530a4022a99b8f4b406aaf33b0849d43ad7422c1d5cc14ff8c667abec6c0"),
28259
+ vaultAllocator: ContractAddr.from("0x7dbc8ccd4eabce6ea6c19e0e5c9ccca3a93bd510303b9e071cbe25fc508546e"),
28260
+ redeemRequestNFT: ContractAddr.from("0x5ee66a39af9aef3d0d48982b4a63e8bd2a5bad021916bd87fb0eae3a26800b8"),
28261
+ aumOracle: ContractAddr.from("0x23d69e4391fa72d10e625e7575d8bddbb4aff96f04503f83fdde23123bf41d0"),
28079
28262
  leafAdapters: [],
28080
28263
  adapters: [],
28081
28264
  targetHealthFactor: 1.1,
@@ -28083,7 +28266,7 @@ var hyperxLBTC = {
28083
28266
  };
28084
28267
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
28085
28268
  return [
28086
- `Deposit ${underlyingSymbol} into the vault`,
28269
+ `Deposit ${lstSymbol} into the vault`,
28087
28270
  `The vault manager loops the ${underlyingSymbol} to buy ${lstSymbol}`,
28088
28271
  `The vault manager collateralizes the ${lstSymbol} on Vesu`,
28089
28272
  `The vault manager borrows more ${underlyingSymbol} to loop further`,
@@ -28122,6 +28305,7 @@ var HyperLSTStrategies = [
28122
28305
  ];
28123
28306
  export {
28124
28307
  AUMTypes,
28308
+ AVNU_EXCHANGE,
28125
28309
  AVNU_MIDDLEWARE,
28126
28310
  AutoCompounderSTRK,
28127
28311
  AvnuWrapper,
@@ -28160,6 +28344,7 @@ export {
28160
28344
  UniversalStrategies,
28161
28345
  UniversalStrategy,
28162
28346
  VESU_SINGLETON,
28347
+ VESU_V2_MODIFY_POSITION_SANITIZER,
28163
28348
  VesuAdapter,
28164
28349
  VesuAmountDenomination,
28165
28350
  VesuAmountType,
package/dist/index.d.ts CHANGED
@@ -961,8 +961,8 @@ declare class CommonAdapter extends BaseAdapter {
961
961
  calldata: bigint[];
962
962
  };
963
963
  };
964
- getAvnuAdapter(fromToken: ContractAddr, toToken: ContractAddr, id: string): () => AdapterLeafType<AvnuSwapCallParams>;
965
- getAvnuCall(fromToken: ContractAddr, toToken: ContractAddr): GenerateCallFn<AvnuSwapCallParams>;
964
+ getAvnuAdapter(fromToken: ContractAddr, toToken: ContractAddr, id: string, isMiddleware: boolean): () => AdapterLeafType<AvnuSwapCallParams>;
965
+ getAvnuCall(fromToken: ContractAddr, toToken: ContractAddr, isMiddleware: boolean): GenerateCallFn<AvnuSwapCallParams>;
966
966
  }
967
967
 
968
968
  interface VesuPoolsInfo {
@@ -1089,7 +1089,7 @@ declare class VesuAdapter extends BaseAdapter {
1089
1089
  };
1090
1090
  };
1091
1091
  getModifyPositionCall: (params: VesuModifyPositionCallParams) => ManageCall;
1092
- getMultiplyAdapter: () => AdapterLeafType<VesuMultiplyCallParams>;
1092
+ getMultiplyAdapter: (id: string) => LeafAdapterFn<VesuMultiplyCallParams>;
1093
1093
  getMultiplyCall: (params: VesuMultiplyCallParams) => ManageCall;
1094
1094
  getVesuModifyDelegationAdapter: (id: string) => LeafAdapterFn<VesuModifyDelegationCallParams>;
1095
1095
  getVesuModifyDelegationCall: (params: VesuModifyDelegationCallParams) => ManageCall;
@@ -1119,9 +1119,11 @@ declare class VesuAdapter extends BaseAdapter {
1119
1119
 
1120
1120
  declare const SIMPLE_SANITIZER: ContractAddr;
1121
1121
  declare const SIMPLE_SANITIZER_V2: ContractAddr;
1122
+ declare const VESU_V2_MODIFY_POSITION_SANITIZER: ContractAddr;
1122
1123
  declare const SIMPLE_SANITIZER_VESU_V1_DELEGATIONS: ContractAddr;
1123
1124
  declare const PRICE_ROUTER: ContractAddr;
1124
1125
  declare const AVNU_MIDDLEWARE: ContractAddr;
1126
+ declare const AVNU_EXCHANGE: ContractAddr;
1125
1127
  declare const VESU_SINGLETON: ContractAddr;
1126
1128
  declare function toBigInt(value: string | number): bigint;
1127
1129
 
@@ -1296,7 +1298,14 @@ declare class UniversalLstMultiplierStrategy extends UniversalStrategy<Universal
1296
1298
  getAvnuSwapMultiplyCall(params: {
1297
1299
  isDeposit: boolean;
1298
1300
  leg1DepositAmount: Web3Number;
1299
- }): Promise<never[]>;
1301
+ }): Promise<Call>;
1302
+ private _getAvnuDepositSwapLegCall;
1303
+ getLSTMultiplierRebalanceCall(): Promise<{
1304
+ shouldRebalance: boolean;
1305
+ manageCall: Call | undefined;
1306
+ }>;
1307
+ private _getMinOutputAmountLSTBuy;
1308
+ private _getMinOutputAmountLSTSell;
1300
1309
  /**
1301
1310
  * Uses vesu's multiple call to create leverage on LST
1302
1311
  * Deposit amount is in LST
@@ -1608,4 +1617,4 @@ declare class PasswordJsonCryptoUtil {
1608
1617
  decrypt(encryptedData: string, password: string): any;
1609
1618
  }
1610
1619
 
1611
- export { AUMTypes, AVNU_MIDDLEWARE, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type ApproveCallParams, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, type DecreaseLeverParams, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FatalError, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HyperLSTStrategies, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, LSTAPRService, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PRICE_ROUTER, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerLST, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type Swap, type SwapInfo, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, VESU_SINGLETON, type VaultPosition, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, type VesuMultiplyCallParams, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, logger, toBigInt };
1620
+ export { AUMTypes, AVNU_EXCHANGE, AVNU_MIDDLEWARE, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type ApproveCallParams, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, type DecreaseLeverParams, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FatalError, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HyperLSTStrategies, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, LSTAPRService, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PRICE_ROUTER, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerLST, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type Swap, type SwapInfo, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, type VesuMultiplyCallParams, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, logger, toBigInt };