@strkfarm/sdk 1.1.9 → 1.1.11

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.
@@ -20191,7 +20191,7 @@ ${r2}}` : "}", l2;
20191
20191
  toHexString: () => toHexString2,
20192
20192
  toStorageKey: () => toStorageKey2
20193
20193
  });
20194
- var import_utils58 = require_utils2();
20194
+ var import_utils59 = require_utils2();
20195
20195
  function isHex3(hex) {
20196
20196
  return /^0x[0-9a-f]*$/i.test(hex);
20197
20197
  }
@@ -20264,7 +20264,7 @@ ${r2}}` : "}", l2;
20264
20264
  if (adaptedValue.length % 2 !== 0) {
20265
20265
  adaptedValue = `0${adaptedValue}`;
20266
20266
  }
20267
- return (0, import_utils58.hexToBytes)(adaptedValue);
20267
+ return (0, import_utils59.hexToBytes)(adaptedValue);
20268
20268
  }
20269
20269
  function addPercent2(number2, percent) {
20270
20270
  const bigIntNum = BigInt(number2);
@@ -28662,6 +28662,7 @@ ${r2}}` : "}", l2;
28662
28662
  Pragma: () => Pragma,
28663
28663
  Pricer: () => Pricer,
28664
28664
  PricerFromApi: () => PricerFromApi,
28665
+ PricerLST: () => PricerLST,
28665
28666
  Protocols: () => Protocols,
28666
28667
  RiskType: () => RiskType,
28667
28668
  SenseiStrategies: () => SenseiStrategies,
@@ -49159,6 +49160,17 @@ ${JSON.stringify(data, null, 2)}`;
49159
49160
  symbol: "xtBTC",
49160
49161
  logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
49161
49162
  address: ContractAddr.from("0x43a35c1425a0125ef8c171f1a75c6f31ef8648edcc8324b55ce1917db3f9b91"),
49163
+ decimals: 18,
49164
+ coingeckId: void 0,
49165
+ displayDecimals: 6,
49166
+ priceProxySymbol: "WBTC",
49167
+ priceCheckAmount: 1e-4
49168
+ // 112000 * 0.0001 = $11.2
49169
+ }, {
49170
+ name: "xLBTC",
49171
+ symbol: "xLBTC",
49172
+ logo: "https://assets.strkfarm.com/integrations/tokens/xlbtc.svg",
49173
+ address: ContractAddr.from("0x036834a40984312f7f7de8d31e3f6305b325389eaeea5b1c0664b2fb936461a4"),
49162
49174
  decimals: 8,
49163
49175
  coingeckId: void 0,
49164
49176
  displayDecimals: 6,
@@ -49747,7 +49759,7 @@ ${JSON.stringify(data, null, 2)}`;
49747
49759
  }
49748
49760
  async getPriceFromMyAPI(tokenSymbol) {
49749
49761
  logger2.verbose(`getPrice from redis: ${tokenSymbol}`);
49750
- const endpoint = "https://app.troves.fi";
49762
+ const endpoint = "https://cache-server-t2me.onrender.com";
49751
49763
  const url = `${endpoint}/api/price/${tokenSymbol}`;
49752
49764
  const priceInfoRes = await fetch(url);
49753
49765
  const priceInfo = await priceInfoRes.json();
@@ -51373,7 +51385,7 @@ ${JSON.stringify(data, null, 2)}`;
51373
51385
  oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, suffix])
51374
51386
  });
51375
51387
 
51376
- // node_modules/.pnpm/@noble+curves@2.0.0/node_modules/@noble/curves/utils.js
51388
+ // node_modules/@scure/starknet/node_modules/@noble/curves/utils.js
51377
51389
  var _0n7 = /* @__PURE__ */ BigInt(0);
51378
51390
  var _1n7 = /* @__PURE__ */ BigInt(1);
51379
51391
  function abool2(value, title = "") {
@@ -51519,7 +51531,7 @@ ${JSON.stringify(data, null, 2)}`;
51519
51531
  };
51520
51532
  }
51521
51533
 
51522
- // node_modules/.pnpm/@noble+curves@2.0.0/node_modules/@noble/curves/abstract/modular.js
51534
+ // node_modules/@scure/starknet/node_modules/@noble/curves/abstract/modular.js
51523
51535
  var _0n8 = /* @__PURE__ */ BigInt(0);
51524
51536
  var _1n8 = /* @__PURE__ */ BigInt(1);
51525
51537
  var _2n6 = /* @__PURE__ */ BigInt(2);
@@ -51897,7 +51909,7 @@ ${JSON.stringify(data, null, 2)}`;
51897
51909
  return isLE2 ? numberToBytesLE2(reduced, fieldLen) : numberToBytesBE2(reduced, fieldLen);
51898
51910
  }
51899
51911
 
51900
- // node_modules/.pnpm/@noble+curves@2.0.0/node_modules/@noble/curves/abstract/poseidon.js
51912
+ // node_modules/@scure/starknet/node_modules/@noble/curves/abstract/poseidon.js
51901
51913
  function assertValidPosOpts(opts) {
51902
51914
  const { Fp, roundsFull } = opts;
51903
51915
  validateField2(Fp);
@@ -52065,7 +52077,7 @@ ${JSON.stringify(data, null, 2)}`;
52065
52077
  var hmac2 = (hash2, key, message) => new _HMAC(hash2, key).update(message).digest();
52066
52078
  hmac2.create = (hash2, key) => new _HMAC(hash2, key);
52067
52079
 
52068
- // node_modules/.pnpm/@noble+curves@2.0.0/node_modules/@noble/curves/abstract/curve.js
52080
+ // node_modules/@scure/starknet/node_modules/@noble/curves/abstract/curve.js
52069
52081
  var _0n9 = /* @__PURE__ */ BigInt(0);
52070
52082
  var _1n9 = /* @__PURE__ */ BigInt(1);
52071
52083
  function negateCt(condition, item) {
@@ -52298,7 +52310,7 @@ ${JSON.stringify(data, null, 2)}`;
52298
52310
  };
52299
52311
  }
52300
52312
 
52301
- // node_modules/.pnpm/@noble+curves@2.0.0/node_modules/@noble/curves/abstract/weierstrass.js
52313
+ // node_modules/@scure/starknet/node_modules/@noble/curves/abstract/weierstrass.js
52302
52314
  var divNearest2 = (num2, den) => (num2 + (num2 >= 0 ? den : -den) / _2n7) / den;
52303
52315
  function _splitEndoScalar(k, basis, n) {
52304
52316
  const [[a1, b1], [a2, b2]] = basis;
@@ -53434,7 +53446,7 @@ ${JSON.stringify(data, null, 2)}`;
53434
53446
  /* @__PURE__ */ oidNist(1)
53435
53447
  );
53436
53448
 
53437
- // node_modules/.pnpm/@scure+starknet@2.0.0/node_modules/@scure/starknet/index.js
53449
+ // node_modules/@scure/starknet/index.js
53438
53450
  var CURVE_ORDER2 = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583");
53439
53451
  var MAX_VALUE2 = BigInt("0x800000000000000000000000000000000000000000000000000000000000000");
53440
53452
  var nBitLength2 = 252;
@@ -53807,6 +53819,55 @@ ${JSON.stringify(data, null, 2)}`;
53807
53819
  }
53808
53820
  };
53809
53821
 
53822
+ // src/modules/pricer-lst.ts
53823
+ var PricerLST = class extends Pricer {
53824
+ // e.g. xSTRK/STRK
53825
+ constructor(config3, tokenMaps) {
53826
+ const refreshInterval = 5e3;
53827
+ const staleTime = 6e4;
53828
+ const allTokens = tokenMaps.map((map2) => [map2.lst, map2.underlying]).flat();
53829
+ super(config3, allTokens, refreshInterval, staleTime);
53830
+ this.EKUBO_API = "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_ADDRESS}}/{{UNDERLYING_ADDRESS}}";
53831
+ this.tokenMaps = tokenMaps;
53832
+ }
53833
+ isUnderlying(token) {
53834
+ return this.tokenMaps.some((map2) => map2.underlying.address.eq(token.address));
53835
+ }
53836
+ getUnderlying(token) {
53837
+ return this.tokenMaps.find((map2) => map2.lst.address.eq(token.address)).underlying;
53838
+ }
53839
+ async _getPrice(token, defaultMethod = "all") {
53840
+ if (this.isUnderlying(token)) {
53841
+ return 1;
53842
+ }
53843
+ const methodToUse = this.methodToUse[token.symbol] || defaultMethod;
53844
+ logger2.verbose(`Fetching price of ${token.symbol} using ${methodToUse}`);
53845
+ try {
53846
+ const result = await this._getPriceEkubo(token, new Web3Number(token.priceCheckAmount ? token.priceCheckAmount : 1, token.decimals));
53847
+ this.methodToUse[token.symbol] = "Ekubo";
53848
+ return result;
53849
+ } catch (error2) {
53850
+ console.warn(`Ekubo: price err [${token.symbol}]: `, error2.message);
53851
+ console.warn(`Ekubo: price err [${token.symbol}]: `, Object.keys(error2));
53852
+ }
53853
+ throw new FatalError(`Price not found for ${token.symbol}`);
53854
+ }
53855
+ async _getPriceEkubo(token, amountIn = new Web3Number(1, token.decimals), retry = 0) {
53856
+ const underlying = this.getUnderlying(token);
53857
+ const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei()).replace("{{UNDERLYING_ADDRESS}}", underlying.address.toString());
53858
+ const result = await axios_default.get(url);
53859
+ const data = result.data;
53860
+ const multiplier = 1 / amountIn.toNumber();
53861
+ const outputUnderlying = Number(Web3Number.fromWei(data.total_calculated, underlying.decimals).toFixed(6)) * multiplier;
53862
+ logger2.verbose(`Ekubo: ${token.symbol} -> ${underlying.symbol}: ${outputUnderlying}, retry: ${retry}`);
53863
+ if (outputUnderlying === 0 && retry < 3) {
53864
+ const amountIn2 = new Web3Number(100, token.decimals);
53865
+ return await this._getPriceEkubo(token, amountIn2, retry + 1);
53866
+ }
53867
+ return outputUnderlying;
53868
+ }
53869
+ };
53870
+
53810
53871
  // src/interfaces/common.tsx
53811
53872
  var import_jsx_runtime = __toESM(require_jsx_runtime());
53812
53873
  var RiskType = /* @__PURE__ */ ((RiskType2) => {
@@ -68129,6 +68190,29 @@ ${JSON.stringify(data, null, 2)}`;
68129
68190
  points: [],
68130
68191
  contractDetails: [],
68131
68192
  investmentSteps: []
68193
+ },
68194
+ {
68195
+ ...xSTRKSTRK,
68196
+ name: "Ekubo xLBTC/LBTC",
68197
+ description: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {}),
68198
+ address: ContractAddr.from(
68199
+ "0x315a614603b1f702e466aedcbcb1ad97a77eb1192b8bd077e5154d4f2ee4fab"
68200
+ ),
68201
+ launchBlock: 2344809,
68202
+ // must be same order as poolKey token0 and token1
68203
+ depositTokens: [
68204
+ Global.getDefaultTokens().find((t) => t.symbol === "LBTC"),
68205
+ Global.getDefaultTokens().find((t) => t.symbol === "xLBTC")
68206
+ ],
68207
+ additionalInfo: {
68208
+ ...xSTRKSTRK.additionalInfo,
68209
+ quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "LBTC"),
68210
+ lstContract: Global.getDefaultTokens().find((t) => t.symbol === "xLBTC").address
68211
+ },
68212
+ faqs: getLSTFAQs("xLBTC"),
68213
+ points: [],
68214
+ contractDetails: [],
68215
+ investmentSteps: []
68132
68216
  }
68133
68217
  ];
68134
68218
  var ETHUSDCRe7Strategy = {
@@ -76118,6 +76202,15 @@ ${JSON.stringify(data, null, 2)}`;
76118
76202
  * @returns {Promise<number>} The weighted average APY across all pools
76119
76203
  */
76120
76204
  async netAPY() {
76205
+ if (this.metadata.isPreview) {
76206
+ return { net: 0, splits: [{
76207
+ apy: 0,
76208
+ id: "base"
76209
+ }, {
76210
+ apy: 0,
76211
+ id: "defispring"
76212
+ }] };
76213
+ }
76121
76214
  const prevAUM = await this.getPrevAUM();
76122
76215
  const vesuAdapters = this.getVesuAdapters();
76123
76216
  const allVesuPools = await VesuAdapter.getVesuPools();
@@ -76209,17 +76302,16 @@ ${JSON.stringify(data, null, 2)}`;
76209
76302
  const legAUM = await adapter.getPositions(this.config);
76210
76303
  const underlying = this.asset();
76211
76304
  let vesuAum = Web3Number.fromWei("0", underlying.decimals);
76305
+ let tokenUnderlyingPrice = await this.pricer.getPrice(this.asset().symbol);
76212
76306
  if (legAUM[0].token.address.eq(underlying.address)) {
76213
76307
  vesuAum = vesuAum.plus(legAUM[0].amount);
76214
76308
  } else {
76215
- const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
76216
- vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenPrice.price);
76309
+ vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
76217
76310
  }
76218
76311
  if (legAUM[1].token.address.eq(underlying.address)) {
76219
76312
  vesuAum = vesuAum.minus(legAUM[1].amount);
76220
76313
  } else {
76221
- const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
76222
- vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenPrice.price);
76314
+ vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
76223
76315
  }
76224
76316
  ;
76225
76317
  logger2.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
@@ -76975,9 +77067,9 @@ ${JSON.stringify(data, null, 2)}`;
76975
77067
  }
76976
77068
  // not applicable for this strategy
76977
77069
  // No rewards on collateral or borrowing of LST assets
76978
- async getRewardsAUM(prevAum) {
76979
- return Web3Number.fromWei("0", this.asset().decimals);
76980
- }
77070
+ // protected async getRewardsAUM(prevAum: Web3Number): Promise<Web3Number> {
77071
+ // return Web3Number.fromWei("0", this.asset().decimals);
77072
+ // }
76981
77073
  async getLSTDexPrice() {
76982
77074
  const ekuboQuoter = new EkuboQuoter(this.config);
76983
77075
  const lstTokenInfo = this.asset();
@@ -77009,12 +77101,12 @@ ${JSON.stringify(data, null, 2)}`;
77009
77101
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
77010
77102
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
77011
77103
  logger2.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
77104
+ const dexPrice = await this.getLSTDexPrice();
77012
77105
  const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
77013
- const DEXPrice = await this.getLSTDexPrice();
77014
77106
  logger2.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
77015
77107
  const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
77016
77108
  const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
77017
- const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / DEXPrice;
77109
+ const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
77018
77110
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
77019
77111
  logger2.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
77020
77112
  logger2.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
@@ -77024,6 +77116,7 @@ ${JSON.stringify(data, null, 2)}`;
77024
77116
  return this.getModifyLeverCall({
77025
77117
  marginAmount,
77026
77118
  debtAmount,
77119
+ lstDexPriceInUnderlying: dexPrice,
77027
77120
  isIncrease: debtAmount.greaterThan(0)
77028
77121
  });
77029
77122
  }
@@ -77065,8 +77158,8 @@ ${JSON.stringify(data, null, 2)}`;
77065
77158
  proofsIDs.push(STEP1_ID);
77066
77159
  manageCalls.push(manageCall1);
77067
77160
  }
77161
+ const lstDexPriceInUnderlying = params.lstDexPriceInUnderlying;
77068
77162
  const ekuboQuoter = new EkuboQuoter(this.config);
77069
- const lstPrice = await this.getLSTExchangeRate();
77070
77163
  const marginSwap = [];
77071
77164
  const MAX_SLIPPAGE = 0.01;
77072
77165
  const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
@@ -77079,8 +77172,8 @@ ${JSON.stringify(data, null, 2)}`;
77079
77172
  );
77080
77173
  assert3(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
77081
77174
  const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
77082
- const minExpectedDebt = params.debtAmount.dividedBy(lstPrice).multipliedBy(1 - MAX_SLIPPAGE);
77083
- const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstPrice).multipliedBy(1 + MAX_SLIPPAGE);
77175
+ const minExpectedDebt = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
77176
+ const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
77084
77177
  const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
77085
77178
  const manage2Info = this.getProofs(STEP2_ID);
77086
77179
  const manageCall2 = manage2Info.callConstructor({
@@ -77245,6 +77338,50 @@ ${JSON.stringify(data, null, 2)}`;
77245
77338
  targetHealthFactor: 1.1,
77246
77339
  minHealthFactor: 1.05
77247
77340
  };
77341
+ var hyperxWBTC = {
77342
+ vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
77343
+ manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
77344
+ vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
77345
+ redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
77346
+ aumOracle: ContractAddr.from(""),
77347
+ leafAdapters: [],
77348
+ adapters: [],
77349
+ targetHealthFactor: 1.1,
77350
+ minHealthFactor: 1.05
77351
+ };
77352
+ var hyperxtBTC = {
77353
+ vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
77354
+ manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
77355
+ vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
77356
+ redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
77357
+ aumOracle: ContractAddr.from(""),
77358
+ leafAdapters: [],
77359
+ adapters: [],
77360
+ targetHealthFactor: 1.1,
77361
+ minHealthFactor: 1.05
77362
+ };
77363
+ var hyperxsBTC = {
77364
+ vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
77365
+ manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
77366
+ vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
77367
+ redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
77368
+ aumOracle: ContractAddr.from(""),
77369
+ leafAdapters: [],
77370
+ adapters: [],
77371
+ targetHealthFactor: 1.1,
77372
+ minHealthFactor: 1.05
77373
+ };
77374
+ var hyperxLBTC = {
77375
+ vaultAddress: ContractAddr.from("0x38e96a301428d204ab4553799aa386a0f14a5ef9b30a5830be1814e4fb8da1c"),
77376
+ manager: ContractAddr.from("0x18d376446d9df1f783e17aff1f21bac3d97aa3ba378e367742cdd744468ad35"),
77377
+ vaultAllocator: ContractAddr.from("0x3e98774ca0508505ba6d7f17d95ec391648f44f947b0d211241464a4f5b9b20"),
77378
+ redeemRequestNFT: ContractAddr.from("0x268017b4c8b2117ca0136d9a77e3666db44b143447566f0746ca0b1c9ab1e72"),
77379
+ aumOracle: ContractAddr.from("0x521a3f339c65e918e0d8a065b14baef1ea25676bb7fca1e0238ac47e20d7755"),
77380
+ leafAdapters: [],
77381
+ adapters: [],
77382
+ targetHealthFactor: 1.1,
77383
+ minHealthFactor: 1.05
77384
+ };
77248
77385
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
77249
77386
  return [
77250
77387
  `Deposit ${underlyingSymbol} into the vault`,
@@ -77255,7 +77392,7 @@ ${JSON.stringify(data, null, 2)}`;
77255
77392
  `If required, adjust leverage or re-allocate assets within LST pool on Vesu to optimize yield`
77256
77393
  ];
77257
77394
  }
77258
- function getStrategySettings(lstSymbol, underlyingSymbol, addresses) {
77395
+ function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview = false) {
77259
77396
  return {
77260
77397
  name: `Hyper ${lstSymbol}`,
77261
77398
  description: getDescription2(lstSymbol),
@@ -77273,11 +77410,16 @@ ${JSON.stringify(data, null, 2)}`;
77273
77410
  maxTVL: Web3Number.fromWei(0, 18),
77274
77411
  contractDetails: getContractDetails(addresses),
77275
77412
  faqs: getFAQs2(lstSymbol, underlyingSymbol),
77276
- investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol)
77413
+ investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
77414
+ isPreview
77277
77415
  };
77278
77416
  }
77279
77417
  var HyperLSTStrategies = [
77280
- getStrategySettings("xSTRK", "STRK", hyperxSTRK)
77418
+ getStrategySettings("xSTRK", "STRK", hyperxSTRK, false),
77419
+ getStrategySettings("xWBTC", "WBTC", hyperxWBTC, true),
77420
+ getStrategySettings("xtBTC", "tBTC", hyperxtBTC, true),
77421
+ getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, true),
77422
+ getStrategySettings("xLBTC", "LBTC", hyperxLBTC, true)
77281
77423
  ];
77282
77424
  return __toCommonJS(index_browser_exports);
77283
77425
  })();
@@ -253,6 +253,17 @@ var defaultTokens = [{
253
253
  symbol: "xtBTC",
254
254
  logo: "https://assets.strkfarm.com/integrations/tokens/xtbtc.svg",
255
255
  address: ContractAddr.from("0x43a35c1425a0125ef8c171f1a75c6f31ef8648edcc8324b55ce1917db3f9b91"),
256
+ decimals: 18,
257
+ coingeckId: void 0,
258
+ displayDecimals: 6,
259
+ priceProxySymbol: "WBTC",
260
+ priceCheckAmount: 1e-4
261
+ // 112000 * 0.0001 = $11.2
262
+ }, {
263
+ name: "xLBTC",
264
+ symbol: "xLBTC",
265
+ logo: "https://assets.strkfarm.com/integrations/tokens/xlbtc.svg",
266
+ address: ContractAddr.from("0x036834a40984312f7f7de8d31e3f6305b325389eaeea5b1c0664b2fb936461a4"),
256
267
  decimals: 8,
257
268
  coingeckId: void 0,
258
269
  displayDecimals: 6,
@@ -848,7 +859,7 @@ var PricerFromApi = class extends PricerBase {
848
859
  }
849
860
  async getPriceFromMyAPI(tokenSymbol) {
850
861
  logger.verbose(`getPrice from redis: ${tokenSymbol}`);
851
- const endpoint = "https://app.troves.fi";
862
+ const endpoint = "https://cache-server-t2me.onrender.com";
852
863
  const url = `${endpoint}/api/price/${tokenSymbol}`;
853
864
  const priceInfoRes = await fetch(url);
854
865
  const priceInfo = await priceInfoRes.json();
@@ -2213,6 +2224,56 @@ var EkuboQuoter = class {
2213
2224
  }
2214
2225
  };
2215
2226
 
2227
+ // src/modules/pricer-lst.ts
2228
+ import axios6 from "axios";
2229
+ var PricerLST = class extends Pricer {
2230
+ // e.g. xSTRK/STRK
2231
+ constructor(config, tokenMaps) {
2232
+ const refreshInterval = 5e3;
2233
+ const staleTime = 6e4;
2234
+ const allTokens = tokenMaps.map((map) => [map.lst, map.underlying]).flat();
2235
+ super(config, allTokens, refreshInterval, staleTime);
2236
+ this.EKUBO_API = "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_ADDRESS}}/{{UNDERLYING_ADDRESS}}";
2237
+ this.tokenMaps = tokenMaps;
2238
+ }
2239
+ isUnderlying(token) {
2240
+ return this.tokenMaps.some((map) => map.underlying.address.eq(token.address));
2241
+ }
2242
+ getUnderlying(token) {
2243
+ return this.tokenMaps.find((map) => map.lst.address.eq(token.address)).underlying;
2244
+ }
2245
+ async _getPrice(token, defaultMethod = "all") {
2246
+ if (this.isUnderlying(token)) {
2247
+ return 1;
2248
+ }
2249
+ const methodToUse = this.methodToUse[token.symbol] || defaultMethod;
2250
+ logger.verbose(`Fetching price of ${token.symbol} using ${methodToUse}`);
2251
+ try {
2252
+ const result = await this._getPriceEkubo(token, new Web3Number(token.priceCheckAmount ? token.priceCheckAmount : 1, token.decimals));
2253
+ this.methodToUse[token.symbol] = "Ekubo";
2254
+ return result;
2255
+ } catch (error) {
2256
+ console.warn(`Ekubo: price err [${token.symbol}]: `, error.message);
2257
+ console.warn(`Ekubo: price err [${token.symbol}]: `, Object.keys(error));
2258
+ }
2259
+ throw new FatalError(`Price not found for ${token.symbol}`);
2260
+ }
2261
+ async _getPriceEkubo(token, amountIn = new Web3Number(1, token.decimals), retry = 0) {
2262
+ const underlying = this.getUnderlying(token);
2263
+ const url = this.EKUBO_API.replace("{{TOKEN_ADDRESS}}", token.address.toString()).replace("{{AMOUNT}}", amountIn.toWei()).replace("{{UNDERLYING_ADDRESS}}", underlying.address.toString());
2264
+ const result = await axios6.get(url);
2265
+ const data = result.data;
2266
+ const multiplier = 1 / amountIn.toNumber();
2267
+ const outputUnderlying = Number(Web3Number.fromWei(data.total_calculated, underlying.decimals).toFixed(6)) * multiplier;
2268
+ logger.verbose(`Ekubo: ${token.symbol} -> ${underlying.symbol}: ${outputUnderlying}, retry: ${retry}`);
2269
+ if (outputUnderlying === 0 && retry < 3) {
2270
+ const amountIn2 = new Web3Number(100, token.decimals);
2271
+ return await this._getPriceEkubo(token, amountIn2, retry + 1);
2272
+ }
2273
+ return outputUnderlying;
2274
+ }
2275
+ };
2276
+
2216
2277
  // src/interfaces/common.tsx
2217
2278
  import { BlockTag, RpcProvider as RpcProvider2 } from "starknet";
2218
2279
  import { Fragment, jsx } from "react/jsx-runtime";
@@ -3919,9 +3980,9 @@ var BaseStrategy = class extends CacheClass {
3919
3980
  };
3920
3981
 
3921
3982
  // src/node/headless.browser.ts
3922
- import axios6 from "axios";
3983
+ import axios7 from "axios";
3923
3984
  async function getAPIUsingHeadlessBrowser(url) {
3924
- const res = await axios6.get(url);
3985
+ const res = await axios7.get(url);
3925
3986
  return res.data;
3926
3987
  }
3927
3988
 
@@ -16551,6 +16612,29 @@ var lstStrategies = [
16551
16612
  points: [],
16552
16613
  contractDetails: [],
16553
16614
  investmentSteps: []
16615
+ },
16616
+ {
16617
+ ...xSTRKSTRK,
16618
+ name: "Ekubo xLBTC/LBTC",
16619
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16620
+ address: ContractAddr.from(
16621
+ "0x315a614603b1f702e466aedcbcb1ad97a77eb1192b8bd077e5154d4f2ee4fab"
16622
+ ),
16623
+ launchBlock: 2344809,
16624
+ // must be same order as poolKey token0 and token1
16625
+ depositTokens: [
16626
+ Global.getDefaultTokens().find((t) => t.symbol === "LBTC"),
16627
+ Global.getDefaultTokens().find((t) => t.symbol === "xLBTC")
16628
+ ],
16629
+ additionalInfo: {
16630
+ ...xSTRKSTRK.additionalInfo,
16631
+ quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "LBTC"),
16632
+ lstContract: Global.getDefaultTokens().find((t) => t.symbol === "xLBTC").address
16633
+ },
16634
+ faqs: getLSTFAQs("xLBTC"),
16635
+ points: [],
16636
+ contractDetails: [],
16637
+ investmentSteps: []
16554
16638
  }
16555
16639
  ];
16556
16640
  var ETHUSDCRe7Strategy = {
@@ -24553,6 +24637,15 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24553
24637
  * @returns {Promise<number>} The weighted average APY across all pools
24554
24638
  */
24555
24639
  async netAPY() {
24640
+ if (this.metadata.isPreview) {
24641
+ return { net: 0, splits: [{
24642
+ apy: 0,
24643
+ id: "base"
24644
+ }, {
24645
+ apy: 0,
24646
+ id: "defispring"
24647
+ }] };
24648
+ }
24556
24649
  const prevAUM = await this.getPrevAUM();
24557
24650
  const vesuAdapters = this.getVesuAdapters();
24558
24651
  const allVesuPools = await VesuAdapter.getVesuPools();
@@ -24644,17 +24737,16 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24644
24737
  const legAUM = await adapter.getPositions(this.config);
24645
24738
  const underlying = this.asset();
24646
24739
  let vesuAum = Web3Number.fromWei("0", underlying.decimals);
24740
+ let tokenUnderlyingPrice = await this.pricer.getPrice(this.asset().symbol);
24647
24741
  if (legAUM[0].token.address.eq(underlying.address)) {
24648
24742
  vesuAum = vesuAum.plus(legAUM[0].amount);
24649
24743
  } else {
24650
- const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
24651
- vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenPrice.price);
24744
+ vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
24652
24745
  }
24653
24746
  if (legAUM[1].token.address.eq(underlying.address)) {
24654
24747
  vesuAum = vesuAum.minus(legAUM[1].amount);
24655
24748
  } else {
24656
- const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
24657
- vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenPrice.price);
24749
+ vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenUnderlyingPrice.price);
24658
24750
  }
24659
24751
  ;
24660
24752
  logger.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
@@ -25411,9 +25503,9 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25411
25503
  }
25412
25504
  // not applicable for this strategy
25413
25505
  // No rewards on collateral or borrowing of LST assets
25414
- async getRewardsAUM(prevAum) {
25415
- return Web3Number.fromWei("0", this.asset().decimals);
25416
- }
25506
+ // protected async getRewardsAUM(prevAum: Web3Number): Promise<Web3Number> {
25507
+ // return Web3Number.fromWei("0", this.asset().decimals);
25508
+ // }
25417
25509
  async getLSTDexPrice() {
25418
25510
  const ekuboQuoter = new EkuboQuoter(this.config);
25419
25511
  const lstTokenInfo = this.asset();
@@ -25445,12 +25537,12 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25445
25537
  const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
25446
25538
  const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
25447
25539
  logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
25540
+ const dexPrice = await this.getLSTDexPrice();
25448
25541
  const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
25449
- const DEXPrice = await this.getLSTDexPrice();
25450
25542
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
25451
25543
  const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
25452
25544
  const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
25453
- const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / DEXPrice;
25545
+ const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / dexPrice;
25454
25546
  const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
25455
25547
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
25456
25548
  logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
@@ -25460,6 +25552,7 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25460
25552
  return this.getModifyLeverCall({
25461
25553
  marginAmount,
25462
25554
  debtAmount,
25555
+ lstDexPriceInUnderlying: dexPrice,
25463
25556
  isIncrease: debtAmount.greaterThan(0)
25464
25557
  });
25465
25558
  }
@@ -25501,8 +25594,8 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25501
25594
  proofsIDs.push(STEP1_ID);
25502
25595
  manageCalls.push(manageCall1);
25503
25596
  }
25597
+ const lstDexPriceInUnderlying = params.lstDexPriceInUnderlying;
25504
25598
  const ekuboQuoter = new EkuboQuoter(this.config);
25505
- const lstPrice = await this.getLSTExchangeRate();
25506
25599
  const marginSwap = [];
25507
25600
  const MAX_SLIPPAGE = 0.01;
25508
25601
  const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
@@ -25515,8 +25608,8 @@ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25515
25608
  );
25516
25609
  assert(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
25517
25610
  const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
25518
- const minExpectedDebt = params.debtAmount.dividedBy(lstPrice).multipliedBy(1 - MAX_SLIPPAGE);
25519
- const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstPrice).multipliedBy(1 + MAX_SLIPPAGE);
25611
+ const minExpectedDebt = params.debtAmount.dividedBy(lstDexPriceInUnderlying).multipliedBy(1 - MAX_SLIPPAGE);
25612
+ const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstDexPriceInUnderlying).multipliedBy(1 + MAX_SLIPPAGE);
25520
25613
  const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
25521
25614
  const manage2Info = this.getProofs(STEP2_ID);
25522
25615
  const manageCall2 = manage2Info.callConstructor({
@@ -25681,6 +25774,50 @@ var hyperxSTRK = {
25681
25774
  targetHealthFactor: 1.1,
25682
25775
  minHealthFactor: 1.05
25683
25776
  };
25777
+ var hyperxWBTC = {
25778
+ vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
25779
+ manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
25780
+ vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
25781
+ redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
25782
+ aumOracle: ContractAddr.from(""),
25783
+ leafAdapters: [],
25784
+ adapters: [],
25785
+ targetHealthFactor: 1.1,
25786
+ minHealthFactor: 1.05
25787
+ };
25788
+ var hyperxtBTC = {
25789
+ vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
25790
+ manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
25791
+ vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
25792
+ redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
25793
+ aumOracle: ContractAddr.from(""),
25794
+ leafAdapters: [],
25795
+ adapters: [],
25796
+ targetHealthFactor: 1.1,
25797
+ minHealthFactor: 1.05
25798
+ };
25799
+ var hyperxsBTC = {
25800
+ vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
25801
+ manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
25802
+ vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
25803
+ redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
25804
+ aumOracle: ContractAddr.from(""),
25805
+ leafAdapters: [],
25806
+ adapters: [],
25807
+ targetHealthFactor: 1.1,
25808
+ minHealthFactor: 1.05
25809
+ };
25810
+ var hyperxLBTC = {
25811
+ vaultAddress: ContractAddr.from("0x38e96a301428d204ab4553799aa386a0f14a5ef9b30a5830be1814e4fb8da1c"),
25812
+ manager: ContractAddr.from("0x18d376446d9df1f783e17aff1f21bac3d97aa3ba378e367742cdd744468ad35"),
25813
+ vaultAllocator: ContractAddr.from("0x3e98774ca0508505ba6d7f17d95ec391648f44f947b0d211241464a4f5b9b20"),
25814
+ redeemRequestNFT: ContractAddr.from("0x268017b4c8b2117ca0136d9a77e3666db44b143447566f0746ca0b1c9ab1e72"),
25815
+ aumOracle: ContractAddr.from("0x521a3f339c65e918e0d8a065b14baef1ea25676bb7fca1e0238ac47e20d7755"),
25816
+ leafAdapters: [],
25817
+ adapters: [],
25818
+ targetHealthFactor: 1.1,
25819
+ minHealthFactor: 1.05
25820
+ };
25684
25821
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
25685
25822
  return [
25686
25823
  `Deposit ${underlyingSymbol} into the vault`,
@@ -25691,7 +25828,7 @@ function getInvestmentSteps(lstSymbol, underlyingSymbol) {
25691
25828
  `If required, adjust leverage or re-allocate assets within LST pool on Vesu to optimize yield`
25692
25829
  ];
25693
25830
  }
25694
- function getStrategySettings(lstSymbol, underlyingSymbol, addresses) {
25831
+ function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview = false) {
25695
25832
  return {
25696
25833
  name: `Hyper ${lstSymbol}`,
25697
25834
  description: getDescription2(lstSymbol),
@@ -25709,11 +25846,16 @@ function getStrategySettings(lstSymbol, underlyingSymbol, addresses) {
25709
25846
  maxTVL: Web3Number.fromWei(0, 18),
25710
25847
  contractDetails: getContractDetails(addresses),
25711
25848
  faqs: getFAQs2(lstSymbol, underlyingSymbol),
25712
- investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol)
25849
+ investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
25850
+ isPreview
25713
25851
  };
25714
25852
  }
25715
25853
  var HyperLSTStrategies = [
25716
- getStrategySettings("xSTRK", "STRK", hyperxSTRK)
25854
+ getStrategySettings("xSTRK", "STRK", hyperxSTRK, false),
25855
+ getStrategySettings("xWBTC", "WBTC", hyperxWBTC, true),
25856
+ getStrategySettings("xtBTC", "tBTC", hyperxtBTC, true),
25857
+ getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, true),
25858
+ getStrategySettings("xLBTC", "LBTC", hyperxLBTC, true)
25717
25859
  ];
25718
25860
  export {
25719
25861
  AUMTypes,
@@ -25738,6 +25880,7 @@ export {
25738
25880
  Pragma,
25739
25881
  Pricer,
25740
25882
  PricerFromApi,
25883
+ PricerLST,
25741
25884
  Protocols,
25742
25885
  RiskType,
25743
25886
  SenseiStrategies,