@strkfarm/sdk 1.1.8 → 1.1.10

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
@@ -41,9 +41,11 @@ __export(index_exports, {
41
41
  ERC20: () => ERC20,
42
42
  EkuboCLVault: () => EkuboCLVault,
43
43
  EkuboCLVaultStrategies: () => EkuboCLVaultStrategies,
44
+ EkuboQuoter: () => EkuboQuoter,
44
45
  FatalError: () => FatalError,
45
46
  FlowChartColors: () => FlowChartColors,
46
47
  Global: () => Global,
48
+ HyperLSTStrategies: () => HyperLSTStrategies,
47
49
  ILending: () => ILending,
48
50
  Initializable: () => Initializable,
49
51
  MarginType: () => MarginType,
@@ -62,6 +64,7 @@ __export(index_exports, {
62
64
  TelegramNotif: () => TelegramNotif,
63
65
  UNIVERSAL_ADAPTERS: () => UNIVERSAL_ADAPTERS,
64
66
  UNIVERSAL_MANAGE_IDS: () => UNIVERSAL_MANAGE_IDS,
67
+ UniversalLstMultiplierStrategy: () => UniversalLstMultiplierStrategy,
65
68
  UniversalStrategies: () => UniversalStrategies,
66
69
  UniversalStrategy: () => UniversalStrategy,
67
70
  VesuAdapter: () => VesuAdapter,
@@ -74,6 +77,7 @@ __export(index_exports, {
74
77
  ZkLend: () => ZkLend,
75
78
  assert: () => assert,
76
79
  getAPIUsingHeadlessBrowser: () => getAPIUsingHeadlessBrowser,
80
+ getContractDetails: () => getContractDetails,
77
81
  getDefaultStoreConfig: () => getDefaultStoreConfig,
78
82
  getMainnetConfig: () => getMainnetConfig,
79
83
  getNoRiskTags: () => getNoRiskTags,
@@ -154,6 +158,17 @@ var _Web3Number = class extends import_bignumber.default {
154
158
  const answer = _value.greaterThanOrEqualTo(_valueMe) ? _value : _valueMe;
155
159
  return this.construct(answer.toString(), this.decimals);
156
160
  }
161
+ abs() {
162
+ console.warn(`abs: this: ${this}`);
163
+ return this.construct(Math.abs(this.toNumber()).toFixed(12), this.decimals);
164
+ }
165
+ toI129() {
166
+ const sign = this.isNegative() ? 1 : 0;
167
+ return {
168
+ mag: BigInt(this.toWei()) * (this.isNegative() ? -1n : 1n),
169
+ sign
170
+ };
171
+ }
157
172
  };
158
173
  import_bignumber.default.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
159
174
  _Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
@@ -220,7 +235,7 @@ var colors = {
220
235
  };
221
236
  import_winston.default.addColors(colors);
222
237
  var logger = import_winston.default.createLogger({
223
- level: "verbose",
238
+ level: "debug",
224
239
  // Set the minimum logging level
225
240
  format: import_winston.format.combine(
226
241
  import_winston.format.colorize({ all: true }),
@@ -2283,6 +2298,61 @@ var AvnuWrapper = class _AvnuWrapper {
2283
2298
  }
2284
2299
  };
2285
2300
 
2301
+ // src/modules/ekubo-quoter.ts
2302
+ var import_axios5 = __toESM(require("axios"));
2303
+ var EkuboQuoter = class {
2304
+ // e.g. ETH/USDC'
2305
+ constructor(config) {
2306
+ this.config = config;
2307
+ this.ENDPOINT = "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_FROM_ADDRESS}}/{{TOKEN_TO_ADDRESS}}";
2308
+ }
2309
+ /**
2310
+ *
2311
+ * @param fromToken
2312
+ * @param toToken
2313
+ * @param amount Can be negative too, which would mean to get exact amount out
2314
+ * @returns
2315
+ */
2316
+ async getQuote(fromToken, toToken, amount) {
2317
+ let _fromToken = amount.gt(0) ? fromToken : toToken;
2318
+ let _toToken = amount.gt(0) ? toToken : fromToken;
2319
+ const quote = await import_axios5.default.get(this.ENDPOINT.replace("{{AMOUNT}}", amount.toWei()).replace("{{TOKEN_FROM_ADDRESS}}", _fromToken).replace("{{TOKEN_TO_ADDRESS}}", _toToken));
2320
+ console.log(`Ekubo quote from ${_fromToken} to ${_toToken} for ${amount.toString()}: ${JSON.stringify(quote.data)}`);
2321
+ return quote.data;
2322
+ }
2323
+ /**
2324
+ * Formats Ekubo response for Vesu multiple use
2325
+ * @param quote
2326
+ * @param fromTokenInfo
2327
+ * @returns
2328
+ */
2329
+ getVesuMultiplyQuote(quote, fromTokenInfo, toTokenInfo) {
2330
+ return quote.splits.map((split) => {
2331
+ const isNegativeAmount = BigInt(split.amount_specified) < 0n;
2332
+ const token = isNegativeAmount ? toTokenInfo : fromTokenInfo;
2333
+ return {
2334
+ route: split.route.map((_route) => ({
2335
+ pool_key: {
2336
+ token0: ContractAddr.from(_route.pool_key.token0),
2337
+ token1: ContractAddr.from(_route.pool_key.token1),
2338
+ fee: _route.pool_key.fee,
2339
+ tick_spacing: _route.pool_key.tick_spacing.toString(),
2340
+ extension: _route.pool_key.extension
2341
+ },
2342
+ sqrt_ratio_limit: Web3Number.fromWei(_route.sqrt_ratio_limit, 18),
2343
+ // just for use, any decimal works
2344
+ skip_ahead: Web3Number.fromWei(_route.skip_ahead, 0)
2345
+ // no decimal for this
2346
+ })),
2347
+ token_amount: {
2348
+ token: token.address,
2349
+ amount: Web3Number.fromWei(split.amount_specified, token.decimals)
2350
+ }
2351
+ };
2352
+ });
2353
+ }
2354
+ };
2355
+
2286
2356
  // src/interfaces/common.tsx
2287
2357
  var import_starknet7 = require("starknet");
2288
2358
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -3989,9 +4059,9 @@ var BaseStrategy = class extends CacheClass {
3989
4059
  };
3990
4060
 
3991
4061
  // src/node/headless.browser.ts
3992
- var import_axios5 = __toESM(require("axios"));
4062
+ var import_axios6 = __toESM(require("axios"));
3993
4063
  async function getAPIUsingHeadlessBrowser(url) {
3994
- const res = await import_axios5.default.get(url);
4064
+ const res = await import_axios6.default.get(url);
3995
4065
  return res.data;
3996
4066
  }
3997
4067
 
@@ -16424,20 +16494,27 @@ var _protocol2 = {
16424
16494
  name: "Ekubo",
16425
16495
  logo: "https://app.ekubo.org/favicon.ico"
16426
16496
  };
16427
- var _corelatedPoolRiskFactors = [
16497
+ var _lstPoolRiskFactors = [
16428
16498
  { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
16429
16499
  { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 1 /* HIGHLY_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
16430
- { type: "Market Risk" /* MARKET_RISK */, value: 1 /* VERY_LOW_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
16500
+ { type: "Market Risk" /* MARKET_RISK */, value: 1 /* VERY_LOW_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" },
16501
+ { type: "Depeg Risk" /* DEPEG_RISK */, value: 2 /* GENERALLY_STABLE */, weight: 33, reason: "Generally stable pegged assets" }
16502
+ ];
16503
+ var _stableCoinPoolRiskFactors = [
16504
+ { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 1 /* BATTLE_TESTED */, weight: 34, reason: "Audited smart contracts" },
16505
+ { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 1 /* HIGHLY_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
16506
+ { type: "Market Risk" /* MARKET_RISK */, value: 1 /* VERY_LOW_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" },
16507
+ { type: "Depeg Risk" /* DEPEG_RISK */, value: 1 /* HIGHLY_STABLE */, weight: 33, reason: "Highly stable assets" }
16431
16508
  ];
16432
16509
  var mediumVolatilityPoolRiskFactors = [
16433
16510
  { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
16434
- { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
16435
- { type: "Market Risk" /* MARKET_RISK */, value: 3 /* MODERATE_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
16511
+ { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Assets are not correlated, often volatile" },
16512
+ { type: "Market Risk" /* MARKET_RISK */, value: 3 /* MODERATE_VOLATILITY */, weight: 33, reason: "Assets are not correlated, relative volatile can be moderate sometimes" }
16436
16513
  ];
16437
16514
  var highVolatilityPoolRiskFactors = [
16438
16515
  { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
16439
- { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
16440
- { type: "Market Risk" /* MARKET_RISK */, value: 4 /* HIGH_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
16516
+ { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Assets are not correlated, often volatile" },
16517
+ { type: "Market Risk" /* MARKET_RISK */, value: 4 /* HIGH_VOLATILITY */, weight: 33, reason: "Assets are not correlated, relative volatile is often high" }
16441
16518
  ];
16442
16519
  var mediumRisk = {
16443
16520
  riskFactor: mediumVolatilityPoolRiskFactors,
@@ -16510,9 +16587,9 @@ var xSTRKSTRK = {
16510
16587
  auditUrl: AUDIT_URL2,
16511
16588
  maxTVL: Web3Number.fromWei("0", 18),
16512
16589
  risk: {
16513
- riskFactor: _corelatedPoolRiskFactors,
16514
- netRisk: _corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
16515
- notARisks: getNoRiskTags(_corelatedPoolRiskFactors)
16590
+ riskFactor: _lstPoolRiskFactors,
16591
+ netRisk: _lstPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _lstPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
16592
+ notARisks: getNoRiskTags(_lstPoolRiskFactors)
16516
16593
  },
16517
16594
  apyMethodology: "APY based on 30-day historical performance, including fees and rewards.",
16518
16595
  additionalInfo: {
@@ -16667,7 +16744,11 @@ var RE7Strategies = [
16667
16744
  Global.getDefaultTokens().find((t) => t.symbol === "USDC"),
16668
16745
  Global.getDefaultTokens().find((t) => t.symbol === "USDT")
16669
16746
  ],
16670
- risk: xSTRKSTRK.risk
16747
+ risk: {
16748
+ riskFactor: _stableCoinPoolRiskFactors,
16749
+ netRisk: _stableCoinPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _stableCoinPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
16750
+ notARisks: getNoRiskTags(_stableCoinPoolRiskFactors)
16751
+ }
16671
16752
  },
16672
16753
  {
16673
16754
  ...ETHUSDCRe7Strategy,
@@ -18851,6 +18932,7 @@ var import_starknet13 = require("starknet");
18851
18932
 
18852
18933
  // src/strategies/universal-adapters/adapter-utils.ts
18853
18934
  var SIMPLE_SANITIZER = ContractAddr.from("0x5a2e3ceb3da368b983a8717898427ab7b6daf04014b70f321e777f9aad940b4");
18935
+ var SIMPLE_SANITIZER_V2 = ContractAddr.from("0x5643d54da70a471cd2b6fa37f52ea7a13cc3f3910689a839f8490a663d2208a");
18854
18936
  var PRICE_ROUTER = ContractAddr.from("0x05e83Fa38D791d2dba8E6f487758A9687FfEe191A6Cf8a6c5761ab0a110DB837");
18855
18937
  var AVNU_MIDDLEWARE = ContractAddr.from("0x4a7972ed3f5d1e74a6d6c4a8f467666953d081c8f2270390cc169d50d17cb0d");
18856
18938
  function toBigInt(value) {
@@ -18865,13 +18947,13 @@ function toBigInt(value) {
18865
18947
 
18866
18948
  // src/strategies/universal-adapters/baseAdapter.ts
18867
18949
  var BaseAdapter = class extends CacheClass {
18868
- constructSimpleLeafData(params) {
18950
+ constructSimpleLeafData(params, sanitizer = SIMPLE_SANITIZER) {
18869
18951
  const { id, target, method, packedArguments } = params;
18870
18952
  return {
18871
18953
  id: BigInt(import_starknet13.num.getDecimalString(import_starknet13.shortString.encodeShortString(id))),
18872
18954
  readableId: id,
18873
18955
  data: [
18874
- SIMPLE_SANITIZER.toBigInt(),
18956
+ sanitizer.toBigInt(),
18875
18957
  // sanitizer address
18876
18958
  target.toBigInt(),
18877
18959
  // contract
@@ -21310,172 +21392,833 @@ var vesu_singleton_abi_default = [
21310
21392
  }
21311
21393
  ];
21312
21394
 
21313
- // src/strategies/universal-adapters/vesu-adapter.ts
21314
- var VesuAmountType = /* @__PURE__ */ ((VesuAmountType2) => {
21315
- VesuAmountType2[VesuAmountType2["Delta"] = 0] = "Delta";
21316
- VesuAmountType2[VesuAmountType2["Target"] = 1] = "Target";
21317
- return VesuAmountType2;
21318
- })(VesuAmountType || {});
21319
- var VesuAmountDenomination = /* @__PURE__ */ ((VesuAmountDenomination2) => {
21320
- VesuAmountDenomination2[VesuAmountDenomination2["Native"] = 0] = "Native";
21321
- VesuAmountDenomination2[VesuAmountDenomination2["Assets"] = 1] = "Assets";
21322
- return VesuAmountDenomination2;
21323
- })(VesuAmountDenomination || {});
21324
- var VesuPools = {
21325
- Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28")
21326
- };
21327
- var VesuAdapter = class _VesuAdapter extends BaseAdapter {
21328
- constructor(config) {
21329
- super();
21330
- this.VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
21331
- this.getModifyPosition = () => {
21332
- const positionData = [0n];
21333
- const packedArguments = [
21334
- toBigInt(this.config.poolId.toString()),
21335
- // pool id
21336
- toBigInt(this.config.collateral.address.toString()),
21337
- // collateral
21338
- toBigInt(this.config.debt.address.toString()),
21339
- // debt
21340
- toBigInt(this.config.vaultAllocator.toString()),
21341
- // vault allocator
21342
- toBigInt(positionData.length),
21343
- ...positionData
21344
- ];
21345
- const output = this.constructSimpleLeafData({
21346
- id: this.config.id,
21347
- target: this.VESU_SINGLETON,
21348
- method: "modify_position",
21349
- packedArguments
21350
- });
21351
- return { leaf: output, callConstructor: this.getModifyPositionCall.bind(this) };
21352
- };
21353
- this.getModifyPositionCall = (params) => {
21354
- const _collateral = {
21355
- amount_type: this.formatAmountTypeEnum(params.collateralAmount.amount_type),
21356
- denomination: this.formatAmountDenominationEnum(params.collateralAmount.denomination),
21357
- value: {
21358
- abs: import_starknet15.uint256.bnToUint256(params.collateralAmount.value.abs.toWei()),
21359
- is_negative: params.collateralAmount.value.abs.isZero() ? false : params.collateralAmount.value.is_negative
21360
- }
21361
- };
21362
- logger.verbose(`VesuAdapter::ConstructingModify::Collateral::${JSON.stringify(_collateral)}`);
21363
- const _debt = {
21364
- amount_type: this.formatAmountTypeEnum(params.debtAmount.amount_type),
21365
- denomination: this.formatAmountDenominationEnum(params.debtAmount.denomination),
21366
- value: {
21367
- abs: import_starknet15.uint256.bnToUint256(params.debtAmount.value.abs.toWei()),
21368
- is_negative: params.debtAmount.value.abs.isZero() ? false : params.debtAmount.value.is_negative
21369
- }
21370
- };
21371
- logger.verbose(`VesuAdapter::ConstructingModify::Debt::${JSON.stringify(_debt)}`);
21372
- const singletonContract = new import_starknet15.Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.toString(), providerOrAccount: new import_starknet15.RpcProvider({ nodeUrl: "" }) });
21373
- const call = singletonContract.populate("modify_position", {
21374
- params: {
21375
- pool_id: this.config.poolId.toBigInt(),
21376
- collateral_asset: this.config.collateral.address.toBigInt(),
21377
- debt_asset: this.config.debt.address.toBigInt(),
21378
- user: this.config.vaultAllocator.toBigInt(),
21379
- collateral: _collateral,
21380
- debt: _debt,
21381
- data: [0]
21382
- }
21383
- });
21384
- return {
21385
- sanitizer: SIMPLE_SANITIZER,
21386
- call: {
21387
- contractAddress: this.VESU_SINGLETON,
21388
- selector: import_starknet15.hash.getSelectorFromName("modify_position"),
21389
- calldata: [
21390
- ...call.calldata
21391
- ]
21392
- }
21393
- };
21394
- };
21395
- this.getDefispringRewardsAdapter = (id) => {
21396
- return () => {
21397
- const packedArguments = [];
21398
- const output = {
21399
- id: BigInt(import_starknet15.num.getDecimalString(import_starknet15.shortString.encodeShortString(id))),
21400
- readableId: id,
21401
- data: [
21402
- SIMPLE_SANITIZER.toBigInt(),
21403
- // sanitizer address
21404
- VESU_REWARDS_CONTRACT.toBigInt(),
21405
- // contract
21406
- toBigInt(import_starknet15.hash.getSelectorFromName("claim")),
21407
- // method name
21408
- BigInt(packedArguments.length),
21409
- ...packedArguments
21410
- ]
21411
- };
21412
- return { leaf: output, callConstructor: this.getDefiSpringClaimCall().bind(this) };
21413
- };
21414
- };
21415
- this.getDefiSpringClaimCall = () => {
21416
- return (params) => ({
21417
- sanitizer: SIMPLE_SANITIZER,
21418
- call: {
21419
- contractAddress: VESU_REWARDS_CONTRACT,
21420
- selector: import_starknet15.hash.getSelectorFromName("claim"),
21421
- calldata: [
21422
- BigInt(params.amount.toWei()),
21423
- BigInt(params.proofs.length),
21424
- ...params.proofs.map((proof) => BigInt(import_starknet15.num.hexToDecimalString(proof)))
21425
- ]
21426
- }
21427
- });
21428
- };
21429
- this.config = config;
21430
- }
21431
- static getDefaultModifyPositionCallParams(params) {
21432
- return {
21433
- collateralAmount: {
21434
- amount_type: 0 /* Delta */,
21435
- denomination: 1 /* Assets */,
21436
- value: {
21437
- abs: params.collateralAmount,
21438
- is_negative: !params.isAddCollateral
21439
- }
21395
+ // src/data/vesu-multiple.abi.json
21396
+ var vesu_multiple_abi_default = [
21397
+ {
21398
+ type: "impl",
21399
+ name: "LockerImpl",
21400
+ interface_name: "ekubo::interfaces::core::ILocker"
21401
+ },
21402
+ {
21403
+ type: "struct",
21404
+ name: "core::array::Span::<core::felt252>",
21405
+ members: [
21406
+ {
21407
+ name: "snapshot",
21408
+ type: "@core::array::Array::<core::felt252>"
21409
+ }
21410
+ ]
21411
+ },
21412
+ {
21413
+ type: "interface",
21414
+ name: "ekubo::interfaces::core::ILocker",
21415
+ items: [
21416
+ {
21417
+ type: "function",
21418
+ name: "locked",
21419
+ inputs: [
21420
+ {
21421
+ name: "id",
21422
+ type: "core::integer::u32"
21423
+ },
21424
+ {
21425
+ name: "data",
21426
+ type: "core::array::Span::<core::felt252>"
21427
+ }
21428
+ ],
21429
+ outputs: [
21430
+ {
21431
+ type: "core::array::Span::<core::felt252>"
21432
+ }
21433
+ ],
21434
+ state_mutability: "external"
21435
+ }
21436
+ ]
21437
+ },
21438
+ {
21439
+ type: "impl",
21440
+ name: "MultiplyImpl",
21441
+ interface_name: "vesu_periphery::multiply::IMultiply"
21442
+ },
21443
+ {
21444
+ type: "struct",
21445
+ name: "ekubo::types::keys::PoolKey",
21446
+ members: [
21447
+ {
21448
+ name: "token0",
21449
+ type: "core::starknet::contract_address::ContractAddress"
21440
21450
  },
21441
- debtAmount: {
21442
- amount_type: 0 /* Delta */,
21443
- denomination: 1 /* Assets */,
21444
- value: {
21445
- abs: params.debtAmount,
21446
- is_negative: !params.isBorrow
21447
- }
21451
+ {
21452
+ name: "token1",
21453
+ type: "core::starknet::contract_address::ContractAddress"
21454
+ },
21455
+ {
21456
+ name: "fee",
21457
+ type: "core::integer::u128"
21458
+ },
21459
+ {
21460
+ name: "tick_spacing",
21461
+ type: "core::integer::u128"
21462
+ },
21463
+ {
21464
+ name: "extension",
21465
+ type: "core::starknet::contract_address::ContractAddress"
21448
21466
  }
21449
- };
21450
- }
21451
- formatAmountTypeEnum(amountType) {
21452
- switch (amountType) {
21453
- case 0 /* Delta */:
21454
- return new import_starknet15.CairoCustomEnum({ Delta: {} });
21455
- case 1 /* Target */:
21456
- return new import_starknet15.CairoCustomEnum({ Target: {} });
21457
- }
21458
- throw new Error(`Unknown VesuAmountType: ${amountType}`);
21459
- }
21460
- formatAmountDenominationEnum(denomination) {
21461
- switch (denomination) {
21462
- case 0 /* Native */:
21463
- return new import_starknet15.CairoCustomEnum({ Native: {} });
21464
- case 1 /* Assets */:
21465
- return new import_starknet15.CairoCustomEnum({ Assets: {} });
21466
- }
21467
- throw new Error(`Unknown VesuAmountDenomination: ${denomination}`);
21468
- }
21469
- getVesuSingletonContract(config) {
21470
- return new import_starknet15.Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.address, providerOrAccount: config.provider });
21471
- }
21472
- async getLTVConfig(config) {
21473
- const CACHE_KEY = "ltv_config";
21474
- const cacheData = this.getCache(CACHE_KEY);
21475
- if (cacheData) {
21476
- return cacheData;
21477
- }
21478
- const output = await this.getVesuSingletonContract(config).call("ltv_config", [this.config.poolId.address, this.config.collateral.address.address, this.config.debt.address.address]);
21467
+ ]
21468
+ },
21469
+ {
21470
+ type: "struct",
21471
+ name: "core::integer::u256",
21472
+ members: [
21473
+ {
21474
+ name: "low",
21475
+ type: "core::integer::u128"
21476
+ },
21477
+ {
21478
+ name: "high",
21479
+ type: "core::integer::u128"
21480
+ }
21481
+ ]
21482
+ },
21483
+ {
21484
+ type: "struct",
21485
+ name: "vesu_periphery::swap::RouteNode",
21486
+ members: [
21487
+ {
21488
+ name: "pool_key",
21489
+ type: "ekubo::types::keys::PoolKey"
21490
+ },
21491
+ {
21492
+ name: "sqrt_ratio_limit",
21493
+ type: "core::integer::u256"
21494
+ },
21495
+ {
21496
+ name: "skip_ahead",
21497
+ type: "core::integer::u128"
21498
+ }
21499
+ ]
21500
+ },
21501
+ {
21502
+ type: "enum",
21503
+ name: "core::bool",
21504
+ variants: [
21505
+ {
21506
+ name: "False",
21507
+ type: "()"
21508
+ },
21509
+ {
21510
+ name: "True",
21511
+ type: "()"
21512
+ }
21513
+ ]
21514
+ },
21515
+ {
21516
+ type: "struct",
21517
+ name: "ekubo::types::i129::i129",
21518
+ members: [
21519
+ {
21520
+ name: "mag",
21521
+ type: "core::integer::u128"
21522
+ },
21523
+ {
21524
+ name: "sign",
21525
+ type: "core::bool"
21526
+ }
21527
+ ]
21528
+ },
21529
+ {
21530
+ type: "struct",
21531
+ name: "vesu_periphery::swap::TokenAmount",
21532
+ members: [
21533
+ {
21534
+ name: "token",
21535
+ type: "core::starknet::contract_address::ContractAddress"
21536
+ },
21537
+ {
21538
+ name: "amount",
21539
+ type: "ekubo::types::i129::i129"
21540
+ }
21541
+ ]
21542
+ },
21543
+ {
21544
+ type: "struct",
21545
+ name: "vesu_periphery::swap::Swap",
21546
+ members: [
21547
+ {
21548
+ name: "route",
21549
+ type: "core::array::Array::<vesu_periphery::swap::RouteNode>"
21550
+ },
21551
+ {
21552
+ name: "token_amount",
21553
+ type: "vesu_periphery::swap::TokenAmount"
21554
+ }
21555
+ ]
21556
+ },
21557
+ {
21558
+ type: "struct",
21559
+ name: "vesu_periphery::multiply::IncreaseLeverParams",
21560
+ members: [
21561
+ {
21562
+ name: "pool_id",
21563
+ type: "core::felt252"
21564
+ },
21565
+ {
21566
+ name: "collateral_asset",
21567
+ type: "core::starknet::contract_address::ContractAddress"
21568
+ },
21569
+ {
21570
+ name: "debt_asset",
21571
+ type: "core::starknet::contract_address::ContractAddress"
21572
+ },
21573
+ {
21574
+ name: "user",
21575
+ type: "core::starknet::contract_address::ContractAddress"
21576
+ },
21577
+ {
21578
+ name: "add_margin",
21579
+ type: "core::integer::u128"
21580
+ },
21581
+ {
21582
+ name: "margin_swap",
21583
+ type: "core::array::Array::<vesu_periphery::swap::Swap>"
21584
+ },
21585
+ {
21586
+ name: "margin_swap_limit_amount",
21587
+ type: "core::integer::u128"
21588
+ },
21589
+ {
21590
+ name: "lever_swap",
21591
+ type: "core::array::Array::<vesu_periphery::swap::Swap>"
21592
+ },
21593
+ {
21594
+ name: "lever_swap_limit_amount",
21595
+ type: "core::integer::u128"
21596
+ }
21597
+ ]
21598
+ },
21599
+ {
21600
+ type: "struct",
21601
+ name: "vesu_periphery::multiply::DecreaseLeverParams",
21602
+ members: [
21603
+ {
21604
+ name: "pool_id",
21605
+ type: "core::felt252"
21606
+ },
21607
+ {
21608
+ name: "collateral_asset",
21609
+ type: "core::starknet::contract_address::ContractAddress"
21610
+ },
21611
+ {
21612
+ name: "debt_asset",
21613
+ type: "core::starknet::contract_address::ContractAddress"
21614
+ },
21615
+ {
21616
+ name: "user",
21617
+ type: "core::starknet::contract_address::ContractAddress"
21618
+ },
21619
+ {
21620
+ name: "sub_margin",
21621
+ type: "core::integer::u128"
21622
+ },
21623
+ {
21624
+ name: "recipient",
21625
+ type: "core::starknet::contract_address::ContractAddress"
21626
+ },
21627
+ {
21628
+ name: "lever_swap",
21629
+ type: "core::array::Array::<vesu_periphery::swap::Swap>"
21630
+ },
21631
+ {
21632
+ name: "lever_swap_limit_amount",
21633
+ type: "core::integer::u128"
21634
+ },
21635
+ {
21636
+ name: "lever_swap_weights",
21637
+ type: "core::array::Array::<core::integer::u128>"
21638
+ },
21639
+ {
21640
+ name: "withdraw_swap",
21641
+ type: "core::array::Array::<vesu_periphery::swap::Swap>"
21642
+ },
21643
+ {
21644
+ name: "withdraw_swap_limit_amount",
21645
+ type: "core::integer::u128"
21646
+ },
21647
+ {
21648
+ name: "withdraw_swap_weights",
21649
+ type: "core::array::Array::<core::integer::u128>"
21650
+ },
21651
+ {
21652
+ name: "close_position",
21653
+ type: "core::bool"
21654
+ }
21655
+ ]
21656
+ },
21657
+ {
21658
+ type: "enum",
21659
+ name: "vesu_periphery::multiply::ModifyLeverAction",
21660
+ variants: [
21661
+ {
21662
+ name: "IncreaseLever",
21663
+ type: "vesu_periphery::multiply::IncreaseLeverParams"
21664
+ },
21665
+ {
21666
+ name: "DecreaseLever",
21667
+ type: "vesu_periphery::multiply::DecreaseLeverParams"
21668
+ }
21669
+ ]
21670
+ },
21671
+ {
21672
+ type: "struct",
21673
+ name: "vesu_periphery::multiply::ModifyLeverParams",
21674
+ members: [
21675
+ {
21676
+ name: "action",
21677
+ type: "vesu_periphery::multiply::ModifyLeverAction"
21678
+ }
21679
+ ]
21680
+ },
21681
+ {
21682
+ type: "struct",
21683
+ name: "alexandria_math::i257::i257",
21684
+ members: [
21685
+ {
21686
+ name: "abs",
21687
+ type: "core::integer::u256"
21688
+ },
21689
+ {
21690
+ name: "is_negative",
21691
+ type: "core::bool"
21692
+ }
21693
+ ]
21694
+ },
21695
+ {
21696
+ type: "struct",
21697
+ name: "vesu_periphery::multiply::ModifyLeverResponse",
21698
+ members: [
21699
+ {
21700
+ name: "collateral_delta",
21701
+ type: "alexandria_math::i257::i257"
21702
+ },
21703
+ {
21704
+ name: "debt_delta",
21705
+ type: "alexandria_math::i257::i257"
21706
+ },
21707
+ {
21708
+ name: "margin_delta",
21709
+ type: "alexandria_math::i257::i257"
21710
+ }
21711
+ ]
21712
+ },
21713
+ {
21714
+ type: "interface",
21715
+ name: "vesu_periphery::multiply::IMultiply",
21716
+ items: [
21717
+ {
21718
+ type: "function",
21719
+ name: "modify_lever",
21720
+ inputs: [
21721
+ {
21722
+ name: "modify_lever_params",
21723
+ type: "vesu_periphery::multiply::ModifyLeverParams"
21724
+ }
21725
+ ],
21726
+ outputs: [
21727
+ {
21728
+ type: "vesu_periphery::multiply::ModifyLeverResponse"
21729
+ }
21730
+ ],
21731
+ state_mutability: "external"
21732
+ }
21733
+ ]
21734
+ },
21735
+ {
21736
+ type: "struct",
21737
+ name: "ekubo::interfaces::core::ICoreDispatcher",
21738
+ members: [
21739
+ {
21740
+ name: "contract_address",
21741
+ type: "core::starknet::contract_address::ContractAddress"
21742
+ }
21743
+ ]
21744
+ },
21745
+ {
21746
+ type: "struct",
21747
+ name: "vesu::singleton::ISingletonDispatcher",
21748
+ members: [
21749
+ {
21750
+ name: "contract_address",
21751
+ type: "core::starknet::contract_address::ContractAddress"
21752
+ }
21753
+ ]
21754
+ },
21755
+ {
21756
+ type: "constructor",
21757
+ name: "constructor",
21758
+ inputs: [
21759
+ {
21760
+ name: "core",
21761
+ type: "ekubo::interfaces::core::ICoreDispatcher"
21762
+ },
21763
+ {
21764
+ name: "singleton",
21765
+ type: "vesu::singleton::ISingletonDispatcher"
21766
+ }
21767
+ ]
21768
+ },
21769
+ {
21770
+ type: "event",
21771
+ name: "vesu_periphery::multiply::Multiply::IncreaseLever",
21772
+ kind: "struct",
21773
+ members: [
21774
+ {
21775
+ name: "pool_id",
21776
+ type: "core::felt252",
21777
+ kind: "key"
21778
+ },
21779
+ {
21780
+ name: "collateral_asset",
21781
+ type: "core::starknet::contract_address::ContractAddress",
21782
+ kind: "key"
21783
+ },
21784
+ {
21785
+ name: "debt_asset",
21786
+ type: "core::starknet::contract_address::ContractAddress",
21787
+ kind: "key"
21788
+ },
21789
+ {
21790
+ name: "user",
21791
+ type: "core::starknet::contract_address::ContractAddress",
21792
+ kind: "key"
21793
+ },
21794
+ {
21795
+ name: "margin",
21796
+ type: "core::integer::u256",
21797
+ kind: "data"
21798
+ },
21799
+ {
21800
+ name: "collateral_delta",
21801
+ type: "core::integer::u256",
21802
+ kind: "data"
21803
+ },
21804
+ {
21805
+ name: "debt_delta",
21806
+ type: "core::integer::u256",
21807
+ kind: "data"
21808
+ }
21809
+ ]
21810
+ },
21811
+ {
21812
+ type: "event",
21813
+ name: "vesu_periphery::multiply::Multiply::DecreaseLever",
21814
+ kind: "struct",
21815
+ members: [
21816
+ {
21817
+ name: "pool_id",
21818
+ type: "core::felt252",
21819
+ kind: "key"
21820
+ },
21821
+ {
21822
+ name: "collateral_asset",
21823
+ type: "core::starknet::contract_address::ContractAddress",
21824
+ kind: "key"
21825
+ },
21826
+ {
21827
+ name: "debt_asset",
21828
+ type: "core::starknet::contract_address::ContractAddress",
21829
+ kind: "key"
21830
+ },
21831
+ {
21832
+ name: "user",
21833
+ type: "core::starknet::contract_address::ContractAddress",
21834
+ kind: "key"
21835
+ },
21836
+ {
21837
+ name: "margin",
21838
+ type: "core::integer::u256",
21839
+ kind: "data"
21840
+ },
21841
+ {
21842
+ name: "collateral_delta",
21843
+ type: "core::integer::u256",
21844
+ kind: "data"
21845
+ },
21846
+ {
21847
+ name: "debt_delta",
21848
+ type: "core::integer::u256",
21849
+ kind: "data"
21850
+ }
21851
+ ]
21852
+ },
21853
+ {
21854
+ type: "event",
21855
+ name: "vesu_periphery::multiply::Multiply::Event",
21856
+ kind: "enum",
21857
+ variants: [
21858
+ {
21859
+ name: "IncreaseLever",
21860
+ type: "vesu_periphery::multiply::Multiply::IncreaseLever",
21861
+ kind: "nested"
21862
+ },
21863
+ {
21864
+ name: "DecreaseLever",
21865
+ type: "vesu_periphery::multiply::Multiply::DecreaseLever",
21866
+ kind: "nested"
21867
+ }
21868
+ ]
21869
+ }
21870
+ ];
21871
+
21872
+ // src/strategies/universal-adapters/vesu-adapter.ts
21873
+ var VesuAmountType = /* @__PURE__ */ ((VesuAmountType2) => {
21874
+ VesuAmountType2[VesuAmountType2["Delta"] = 0] = "Delta";
21875
+ VesuAmountType2[VesuAmountType2["Target"] = 1] = "Target";
21876
+ return VesuAmountType2;
21877
+ })(VesuAmountType || {});
21878
+ var VesuAmountDenomination = /* @__PURE__ */ ((VesuAmountDenomination2) => {
21879
+ VesuAmountDenomination2[VesuAmountDenomination2["Native"] = 0] = "Native";
21880
+ VesuAmountDenomination2[VesuAmountDenomination2["Assets"] = 1] = "Assets";
21881
+ return VesuAmountDenomination2;
21882
+ })(VesuAmountDenomination || {});
21883
+ function getVesuMultiplyParams(isIncrease, params) {
21884
+ if (isIncrease) {
21885
+ const _params2 = params;
21886
+ return {
21887
+ action: new import_starknet15.CairoCustomEnum({ IncreaseLever: {
21888
+ pool_id: _params2.pool_id.toBigInt(),
21889
+ collateral_asset: _params2.collateral_asset.toBigInt(),
21890
+ debt_asset: _params2.debt_asset.toBigInt(),
21891
+ user: _params2.user.toBigInt(),
21892
+ add_margin: BigInt(_params2.add_margin.toWei()),
21893
+ margin_swap: _params2.margin_swap.map((swap) => ({
21894
+ route: swap.route.map((route) => ({
21895
+ pool_key: {
21896
+ token0: route.pool_key.token0.toBigInt(),
21897
+ token1: route.pool_key.token1.toBigInt(),
21898
+ fee: route.pool_key.fee,
21899
+ tick_spacing: route.pool_key.tick_spacing,
21900
+ extension: BigInt(import_starknet15.num.hexToDecimalString(route.pool_key.extension))
21901
+ },
21902
+ sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
21903
+ skip_ahead: BigInt(100)
21904
+ })),
21905
+ token_amount: {
21906
+ token: swap.token_amount.token.toBigInt(),
21907
+ amount: swap.token_amount.amount.toI129()
21908
+ }
21909
+ })),
21910
+ margin_swap_limit_amount: BigInt(_params2.margin_swap_limit_amount.toWei()),
21911
+ lever_swap: _params2.lever_swap.map((swap) => ({
21912
+ route: swap.route.map((route) => ({
21913
+ pool_key: {
21914
+ token0: route.pool_key.token0.toBigInt(),
21915
+ token1: route.pool_key.token1.toBigInt(),
21916
+ fee: route.pool_key.fee,
21917
+ tick_spacing: route.pool_key.tick_spacing,
21918
+ extension: BigInt(import_starknet15.num.hexToDecimalString(route.pool_key.extension))
21919
+ },
21920
+ sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
21921
+ skip_ahead: BigInt(100)
21922
+ })),
21923
+ token_amount: {
21924
+ token: swap.token_amount.token.toBigInt(),
21925
+ amount: swap.token_amount.amount.toI129()
21926
+ }
21927
+ })),
21928
+ lever_swap_limit_amount: BigInt(_params2.lever_swap_limit_amount.toWei())
21929
+ } })
21930
+ };
21931
+ }
21932
+ const _params = params;
21933
+ return {
21934
+ action: new import_starknet15.CairoCustomEnum({ DecreaseLever: {
21935
+ pool_id: _params.pool_id.toBigInt(),
21936
+ collateral_asset: _params.collateral_asset.toBigInt(),
21937
+ debt_asset: _params.debt_asset.toBigInt(),
21938
+ user: _params.user.toBigInt(),
21939
+ sub_margin: BigInt(_params.sub_margin.toWei()),
21940
+ recipient: _params.recipient.toBigInt(),
21941
+ lever_swap: _params.lever_swap.map((swap) => ({
21942
+ route: swap.route.map((route) => ({
21943
+ pool_key: {
21944
+ token0: route.pool_key.token0.toBigInt(),
21945
+ token1: route.pool_key.token1.toBigInt(),
21946
+ fee: route.pool_key.fee,
21947
+ tick_spacing: route.pool_key.tick_spacing,
21948
+ extension: ContractAddr.from(route.pool_key.extension).toBigInt()
21949
+ },
21950
+ sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
21951
+ skip_ahead: BigInt(route.skip_ahead.toWei())
21952
+ })),
21953
+ token_amount: {
21954
+ token: swap.token_amount.token.toBigInt(),
21955
+ amount: swap.token_amount.amount.toI129()
21956
+ }
21957
+ })),
21958
+ lever_swap_limit_amount: BigInt(_params.lever_swap_limit_amount.toWei()),
21959
+ lever_swap_weights: _params.lever_swap_weights.map((weight) => BigInt(weight.toWei())),
21960
+ withdraw_swap: _params.withdraw_swap.map((swap) => ({
21961
+ route: swap.route.map((route) => ({
21962
+ pool_key: {
21963
+ token0: route.pool_key.token0.toBigInt(),
21964
+ token1: route.pool_key.token1.toBigInt(),
21965
+ fee: route.pool_key.fee,
21966
+ tick_spacing: route.pool_key.tick_spacing,
21967
+ extension: ContractAddr.from(route.pool_key.extension).toBigInt()
21968
+ },
21969
+ sqrt_ratio_limit: import_starknet15.uint256.bnToUint256(route.sqrt_ratio_limit.toWei()),
21970
+ skip_ahead: BigInt(route.skip_ahead.toWei())
21971
+ })),
21972
+ token_amount: {
21973
+ token: swap.token_amount.token.toBigInt(),
21974
+ amount: swap.token_amount.amount.toI129()
21975
+ }
21976
+ })),
21977
+ withdraw_swap_limit_amount: BigInt(_params.withdraw_swap_limit_amount.toWei()),
21978
+ withdraw_swap_weights: _params.withdraw_swap_weights.map((weight) => BigInt(weight.toWei())),
21979
+ close_position: _params.close_position
21980
+ } })
21981
+ };
21982
+ }
21983
+ var VesuPools = {
21984
+ Genesis: ContractAddr.from("0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"),
21985
+ Re7xSTRK: ContractAddr.from("0x052fb52363939c3aa848f8f4ac28f0a51379f8d1b971d8444de25fbd77d8f161")
21986
+ };
21987
+ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
21988
+ constructor(config) {
21989
+ super();
21990
+ this.VESU_SINGLETON = ContractAddr.from("0x000d8d6dfec4d33bfb6895de9f3852143a17c6f92fd2a21da3d6924d34870160");
21991
+ this.VESU_MULTIPLY = ContractAddr.from("0x3630f1f8e5b8f5c4c4ae9b6620f8a570ae55cddebc0276c37550e7c118edf67");
21992
+ this.getModifyPosition = () => {
21993
+ const positionData = [0n];
21994
+ const packedArguments = [
21995
+ toBigInt(this.config.poolId.toString()),
21996
+ // pool id
21997
+ toBigInt(this.config.collateral.address.toString()),
21998
+ // collateral
21999
+ toBigInt(this.config.debt.address.toString()),
22000
+ // debt
22001
+ toBigInt(this.config.vaultAllocator.toString()),
22002
+ // vault allocator
22003
+ toBigInt(positionData.length),
22004
+ ...positionData
22005
+ ];
22006
+ const output = this.constructSimpleLeafData({
22007
+ id: this.config.id,
22008
+ target: this.VESU_SINGLETON,
22009
+ method: "modify_position",
22010
+ packedArguments
22011
+ });
22012
+ return { leaf: output, callConstructor: this.getModifyPositionCall.bind(this) };
22013
+ };
22014
+ this.getModifyPositionCall = (params) => {
22015
+ const _collateral = {
22016
+ amount_type: this.formatAmountTypeEnum(params.collateralAmount.amount_type),
22017
+ denomination: this.formatAmountDenominationEnum(params.collateralAmount.denomination),
22018
+ value: {
22019
+ abs: import_starknet15.uint256.bnToUint256(params.collateralAmount.value.abs.toWei()),
22020
+ is_negative: params.collateralAmount.value.abs.isZero() ? false : params.collateralAmount.value.is_negative
22021
+ }
22022
+ };
22023
+ logger.verbose(`VesuAdapter::ConstructingModify::Collateral::${JSON.stringify(_collateral)}`);
22024
+ const _debt = {
22025
+ amount_type: this.formatAmountTypeEnum(params.debtAmount.amount_type),
22026
+ denomination: this.formatAmountDenominationEnum(params.debtAmount.denomination),
22027
+ value: {
22028
+ abs: import_starknet15.uint256.bnToUint256(params.debtAmount.value.abs.toWei()),
22029
+ is_negative: params.debtAmount.value.abs.isZero() ? false : params.debtAmount.value.is_negative
22030
+ }
22031
+ };
22032
+ logger.verbose(`VesuAdapter::ConstructingModify::Debt::${JSON.stringify(_debt)}`);
22033
+ const singletonContract = new import_starknet15.Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.toString(), providerOrAccount: new import_starknet15.RpcProvider({ nodeUrl: "" }) });
22034
+ const call = singletonContract.populate("modify_position", {
22035
+ params: {
22036
+ pool_id: this.config.poolId.toBigInt(),
22037
+ collateral_asset: this.config.collateral.address.toBigInt(),
22038
+ debt_asset: this.config.debt.address.toBigInt(),
22039
+ user: this.config.vaultAllocator.toBigInt(),
22040
+ collateral: _collateral,
22041
+ debt: _debt,
22042
+ data: [0]
22043
+ }
22044
+ });
22045
+ return {
22046
+ sanitizer: SIMPLE_SANITIZER,
22047
+ call: {
22048
+ contractAddress: this.VESU_SINGLETON,
22049
+ selector: import_starknet15.hash.getSelectorFromName("modify_position"),
22050
+ calldata: [
22051
+ ...call.calldata
22052
+ ]
22053
+ }
22054
+ };
22055
+ };
22056
+ this.getMultiplyAdapter = () => {
22057
+ const packedArguments = [
22058
+ toBigInt(this.config.poolId.toString()),
22059
+ // pool id
22060
+ toBigInt(this.config.collateral.address.toString()),
22061
+ // collateral
22062
+ toBigInt(this.config.debt.address.toString()),
22063
+ // debt
22064
+ toBigInt(this.config.vaultAllocator.toString())
22065
+ // vault allocator
22066
+ ];
22067
+ const output = this.constructSimpleLeafData({
22068
+ id: this.config.id,
22069
+ target: this.VESU_MULTIPLY,
22070
+ method: "modify_lever",
22071
+ packedArguments
22072
+ }, SIMPLE_SANITIZER_V2);
22073
+ return { leaf: output, callConstructor: this.getMultiplyCall.bind(this) };
22074
+ };
22075
+ this.getMultiplyCall = (params) => {
22076
+ const isIncrease = params.isIncrease;
22077
+ const multiplyParams = isIncrease ? params.increaseParams : params.decreaseParams;
22078
+ if (!multiplyParams) {
22079
+ throw new Error("Multiply params are not provided");
22080
+ }
22081
+ const multiplyContract = new import_starknet15.Contract({ abi: vesu_multiple_abi_default, address: this.VESU_MULTIPLY.toString(), providerOrAccount: new import_starknet15.RpcProvider({ nodeUrl: "" }) });
22082
+ const call = multiplyContract.populate("modify_lever", {
22083
+ modify_lever_params: getVesuMultiplyParams(isIncrease, {
22084
+ ...multiplyParams,
22085
+ user: this.config.vaultAllocator,
22086
+ pool_id: this.config.poolId,
22087
+ collateral_asset: this.config.collateral.address,
22088
+ debt_asset: this.config.debt.address,
22089
+ recipient: this.config.vaultAllocator
22090
+ })
22091
+ });
22092
+ return {
22093
+ sanitizer: SIMPLE_SANITIZER_V2,
22094
+ call: {
22095
+ contractAddress: this.VESU_MULTIPLY,
22096
+ selector: import_starknet15.hash.getSelectorFromName("modify_lever"),
22097
+ calldata: [
22098
+ ...call.calldata
22099
+ ]
22100
+ }
22101
+ };
22102
+ };
22103
+ this.getVesuModifyDelegationAdapter = (id) => {
22104
+ return () => {
22105
+ const packedArguments = [
22106
+ toBigInt(this.config.poolId.toString()),
22107
+ // pool id
22108
+ toBigInt(this.VESU_MULTIPLY.toString())
22109
+ // vault allocator
22110
+ ];
22111
+ const output = this.constructSimpleLeafData({
22112
+ id,
22113
+ target: this.VESU_SINGLETON,
22114
+ method: "modify_delegation",
22115
+ packedArguments
22116
+ }, SIMPLE_SANITIZER_V2);
22117
+ return { leaf: output, callConstructor: this.getVesuModifyDelegationCall.bind(this) };
22118
+ };
22119
+ };
22120
+ this.getVesuModifyDelegationCall = (params) => {
22121
+ const singletonContract = new import_starknet15.Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.toString(), providerOrAccount: new import_starknet15.RpcProvider({ nodeUrl: "" }) });
22122
+ const call = singletonContract.populate("modify_delegation", {
22123
+ pool_id: this.config.poolId.toBigInt(),
22124
+ delegatee: this.VESU_MULTIPLY.toBigInt(),
22125
+ delegation: params.delegation
22126
+ });
22127
+ return {
22128
+ sanitizer: SIMPLE_SANITIZER_V2,
22129
+ call: {
22130
+ contractAddress: this.VESU_SINGLETON,
22131
+ selector: import_starknet15.hash.getSelectorFromName("modify_delegation"),
22132
+ calldata: [
22133
+ ...call.calldata
22134
+ ]
22135
+ }
22136
+ };
22137
+ };
22138
+ this.getDefispringRewardsAdapter = (id) => {
22139
+ return () => {
22140
+ const packedArguments = [];
22141
+ const output = {
22142
+ id: BigInt(import_starknet15.num.getDecimalString(import_starknet15.shortString.encodeShortString(id))),
22143
+ readableId: id,
22144
+ data: [
22145
+ SIMPLE_SANITIZER.toBigInt(),
22146
+ // sanitizer address
22147
+ VESU_REWARDS_CONTRACT.toBigInt(),
22148
+ // contract
22149
+ toBigInt(import_starknet15.hash.getSelectorFromName("claim")),
22150
+ // method name
22151
+ BigInt(packedArguments.length),
22152
+ ...packedArguments
22153
+ ]
22154
+ };
22155
+ return { leaf: output, callConstructor: this.getDefiSpringClaimCall().bind(this) };
22156
+ };
22157
+ };
22158
+ this.getDefiSpringClaimCall = () => {
22159
+ return (params) => ({
22160
+ sanitizer: SIMPLE_SANITIZER,
22161
+ call: {
22162
+ contractAddress: VESU_REWARDS_CONTRACT,
22163
+ selector: import_starknet15.hash.getSelectorFromName("claim"),
22164
+ calldata: [
22165
+ BigInt(params.amount.toWei()),
22166
+ BigInt(params.proofs.length),
22167
+ ...params.proofs.map((proof) => BigInt(import_starknet15.num.hexToDecimalString(proof)))
22168
+ ]
22169
+ }
22170
+ });
22171
+ };
22172
+ this.config = config;
22173
+ }
22174
+ static getDefaultModifyPositionCallParams(params) {
22175
+ return {
22176
+ collateralAmount: {
22177
+ amount_type: 0 /* Delta */,
22178
+ denomination: 1 /* Assets */,
22179
+ value: {
22180
+ abs: params.collateralAmount,
22181
+ is_negative: !params.isAddCollateral
22182
+ }
22183
+ },
22184
+ debtAmount: {
22185
+ amount_type: 0 /* Delta */,
22186
+ denomination: 1 /* Assets */,
22187
+ value: {
22188
+ abs: params.debtAmount,
22189
+ is_negative: !params.isBorrow
22190
+ }
22191
+ }
22192
+ };
22193
+ }
22194
+ formatAmountTypeEnum(amountType) {
22195
+ switch (amountType) {
22196
+ case 0 /* Delta */:
22197
+ return new import_starknet15.CairoCustomEnum({ Delta: {} });
22198
+ case 1 /* Target */:
22199
+ return new import_starknet15.CairoCustomEnum({ Target: {} });
22200
+ }
22201
+ throw new Error(`Unknown VesuAmountType: ${amountType}`);
22202
+ }
22203
+ formatAmountDenominationEnum(denomination) {
22204
+ switch (denomination) {
22205
+ case 0 /* Native */:
22206
+ return new import_starknet15.CairoCustomEnum({ Native: {} });
22207
+ case 1 /* Assets */:
22208
+ return new import_starknet15.CairoCustomEnum({ Assets: {} });
22209
+ }
22210
+ throw new Error(`Unknown VesuAmountDenomination: ${denomination}`);
22211
+ }
22212
+ getVesuSingletonContract(config) {
22213
+ return new import_starknet15.Contract({ abi: vesu_singleton_abi_default, address: this.VESU_SINGLETON.address, providerOrAccount: config.provider });
22214
+ }
22215
+ async getLTVConfig(config) {
22216
+ const CACHE_KEY = "ltv_config";
22217
+ const cacheData = this.getCache(CACHE_KEY);
22218
+ if (cacheData) {
22219
+ return cacheData;
22220
+ }
22221
+ const output = await this.getVesuSingletonContract(config).call("ltv_config", [this.config.poolId.address, this.config.collateral.address.address, this.config.debt.address.address]);
21479
22222
  this.setCache(CACHE_KEY, Number(output.max_ltv) / 1e18, 3e5);
21480
22223
  return this.getCache(CACHE_KEY);
21481
22224
  }
@@ -23815,10 +24558,10 @@ var vault_manager_abi_default = [
23815
24558
 
23816
24559
  // src/strategies/universal-strategy.tsx
23817
24560
  var import_jsx_runtime4 = require("react/jsx-runtime");
23818
- var AUMTypes = /* @__PURE__ */ ((AUMTypes2) => {
23819
- AUMTypes2["FINALISED"] = "finalised";
23820
- AUMTypes2["DEFISPRING"] = "defispring";
23821
- return AUMTypes2;
24561
+ var AUMTypes = /* @__PURE__ */ ((AUMTypes3) => {
24562
+ AUMTypes3["FINALISED"] = "finalised";
24563
+ AUMTypes3["DEFISPRING"] = "defispring";
24564
+ return AUMTypes3;
23822
24565
  })(AUMTypes || {});
23823
24566
  var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
23824
24567
  constructor(config, pricer, metadata) {
@@ -23946,24 +24689,42 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
23946
24689
  * @returns {Promise<number>} The weighted average APY across all pools
23947
24690
  */
23948
24691
  async netAPY() {
23949
- const [vesuAdapter1, vesuAdapter2] = this.getVesuAdapters();
23950
- const pools = await VesuAdapter.getVesuPools();
23951
- const pool1 = pools.pools.find((p) => vesuAdapter1.config.poolId.eqString(import_starknet16.num.getHexString(p.id)));
23952
- const pool2 = pools.pools.find((p) => vesuAdapter2.config.poolId.eqString(import_starknet16.num.getHexString(p.id)));
23953
- if (!pool1 || !pool2) {
24692
+ if (this.metadata.isPreview) {
24693
+ return { net: 0, splits: [{
24694
+ apy: 0,
24695
+ id: "base"
24696
+ }, {
24697
+ apy: 0,
24698
+ id: "defispring"
24699
+ }] };
24700
+ }
24701
+ const prevAUM = await this.getPrevAUM();
24702
+ const vesuAdapters = this.getVesuAdapters();
24703
+ const allVesuPools = await VesuAdapter.getVesuPools();
24704
+ const pools = vesuAdapters.map((vesuAdapter) => {
24705
+ return allVesuPools.pools.find((p) => vesuAdapter.config.poolId.eqString(import_starknet16.num.getHexString(p.id)));
24706
+ });
24707
+ logger.verbose(`${this.metadata.name}::netAPY: vesu-pools: ${JSON.stringify(pools)}`);
24708
+ if (pools.some((p) => !p)) {
23954
24709
  throw new Error("Pool not found");
23955
24710
  }
23956
24711
  ;
23957
- const collateralAsset1 = pool1.assets.find((a) => a.symbol === vesuAdapter1.config.collateral.symbol)?.stats;
23958
- const debtAsset1 = pool1.assets.find((a) => a.symbol === vesuAdapter1.config.debt.symbol)?.stats;
23959
- const collateralAsset2 = pool2.assets.find((a) => a.symbol === vesuAdapter2.config.collateral.symbol)?.stats;
23960
- const debtAsset2 = pool2.assets.find((a) => a.symbol === vesuAdapter2.config.debt.symbol)?.stats;
23961
- const collateral1APY = Number(collateralAsset1.supplyApy.value) / 1e18;
23962
- const debt1APY = Number(debtAsset1.borrowApr.value) / 1e18;
23963
- const collateral2APY = Number(collateralAsset2.supplyApy.value) / 1e18;
23964
- const debt2APY = Number(debtAsset2.borrowApr.value) / 1e18;
23965
- const positions = await this.getVaultPositions();
24712
+ const positions = await this.getVesuPositions();
23966
24713
  logger.verbose(`${this.metadata.name}::netAPY: positions: ${JSON.stringify(positions)}`);
24714
+ const baseAPYs = [];
24715
+ const rewardAPYs = [];
24716
+ for (const [index, pool] of pools.entries()) {
24717
+ const vesuAdapter = vesuAdapters[index];
24718
+ const collateralAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.collateral.symbol)?.stats;
24719
+ const debtAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.debt.symbol)?.stats;
24720
+ const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
24721
+ const lstAPY = Number(collateralAsset.lstApr?.value || 0) / 1e18;
24722
+ baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
24723
+ rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr.value || "0") / 1e18, 0]);
24724
+ }
24725
+ logger.verbose(`${this.metadata.name}::netAPY: baseAPYs: ${JSON.stringify(baseAPYs)}`);
24726
+ logger.verbose(`${this.metadata.name}::netAPY: rewardAPYs: ${JSON.stringify(rewardAPYs)}`);
24727
+ assert(baseAPYs.length == positions.length, "APYs and positions length mismatch");
23967
24728
  if (positions.every((p) => p.amount.isZero())) {
23968
24729
  return { net: 0, splits: [{
23969
24730
  apy: 0,
@@ -23974,11 +24735,10 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
23974
24735
  }] };
23975
24736
  }
23976
24737
  const weights = positions.map((p, index) => p.usdValue * (index % 2 == 0 ? 1 : -1));
23977
- const baseAPYs = [collateral1APY, debt1APY, collateral2APY, debt2APY];
23978
- assert(positions.length == baseAPYs.length, "Positions and APYs length mismatch");
23979
- const rewardAPYs = [Number(collateralAsset1.defiSpringSupplyApr.value) / 1e18, 0, Number(collateralAsset2.defiSpringSupplyApr.value) / 1e18, 0];
23980
- const baseAPY = this.computeAPY(baseAPYs, weights);
23981
- const rewardAPY = this.computeAPY(rewardAPYs, weights);
24738
+ const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
24739
+ const prevAUMUSD = prevAUM.multipliedBy(price.price);
24740
+ const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
24741
+ const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
23982
24742
  const netAPY = baseAPY + rewardAPY;
23983
24743
  logger.verbose(`${this.metadata.name}::netAPY: net: ${netAPY}, baseAPY: ${baseAPY}, rewardAPY: ${rewardAPY}`);
23984
24744
  return { net: netAPY, splits: [{
@@ -23989,11 +24749,11 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
23989
24749
  id: "defispring"
23990
24750
  }] };
23991
24751
  }
23992
- computeAPY(apys, weights) {
24752
+ computeAPY(apys, weights, currentAUM) {
23993
24753
  assert(apys.length === weights.length, "APYs and weights length mismatch");
23994
24754
  const weightedSum = apys.reduce((acc, apy, i) => acc + apy * weights[i], 0);
23995
- const totalWeight = weights.reduce((acc, weight) => acc + weight, 0);
23996
- return weightedSum / totalWeight;
24755
+ logger.verbose(`${this.getTag()} computeAPY: apys: ${JSON.stringify(apys)}, weights: ${JSON.stringify(weights)}, weightedSum: ${weightedSum}, currentAUM: ${currentAUM}`);
24756
+ return weightedSum / currentAUM.toNumber();
23997
24757
  }
23998
24758
  /**
23999
24759
  * Calculates the total TVL of the strategy.
@@ -24025,24 +24785,48 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24025
24785
  usdValue
24026
24786
  };
24027
24787
  }
24028
- async getAUM() {
24788
+ async getVesuAUM(adapter) {
24789
+ const legAUM = await adapter.getPositions(this.config);
24790
+ const underlying = this.asset();
24791
+ let vesuAum = Web3Number.fromWei("0", underlying.decimals);
24792
+ if (legAUM[0].token.address.eq(underlying.address)) {
24793
+ vesuAum = vesuAum.plus(legAUM[0].amount);
24794
+ } else {
24795
+ const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
24796
+ vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenPrice.price);
24797
+ }
24798
+ if (legAUM[1].token.address.eq(underlying.address)) {
24799
+ vesuAum = vesuAum.minus(legAUM[1].amount);
24800
+ } else {
24801
+ const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
24802
+ vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenPrice.price);
24803
+ }
24804
+ ;
24805
+ logger.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
24806
+ return vesuAum;
24807
+ }
24808
+ async getPrevAUM() {
24029
24809
  const currentAUM = await this.contract.call("aum", []);
24030
- const lastReportTime = await this.contract.call("last_report_timestamp", []);
24810
+ const prevAum = Web3Number.fromWei(currentAUM.toString(), this.asset().decimals);
24811
+ logger.verbose(`${this.getTag()} Prev AUM: ${prevAum}`);
24812
+ return prevAum;
24813
+ }
24814
+ async getAUM() {
24815
+ const prevAum = await this.getPrevAUM();
24031
24816
  const token1Price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
24032
- const [vesuAdapter1, vesuAdapter2] = this.getVesuAdapters();
24033
- const leg1AUM = await vesuAdapter1.getPositions(this.config);
24034
- const leg2AUM = await vesuAdapter2.getPositions(this.config);
24817
+ const vesuAdapters = this.getVesuAdapters();
24818
+ let vesuAum = Web3Number.fromWei("0", this.asset().decimals);
24819
+ for (const adapter of vesuAdapters) {
24820
+ vesuAum = vesuAum.plus(await this.getVesuAUM(adapter));
24821
+ }
24035
24822
  const balance = await this.getUnusedBalance();
24036
24823
  logger.verbose(`${this.getTag()} unused balance: ${balance.amount.toNumber()}`);
24037
- const vesuAum = leg1AUM[0].amount.plus(leg2AUM[0].usdValue / token1Price.price).minus(leg1AUM[1].usdValue / token1Price.price).minus(leg2AUM[1].amount);
24038
- logger.verbose(`${this.getTag()} Vesu AUM: leg1: ${leg1AUM[0].amount.toNumber()}, ${leg1AUM[1].amount.toNumber()}, leg2: ${leg2AUM[0].amount.toNumber()}, ${leg2AUM[1].amount.toNumber()}`);
24039
24824
  const zeroAmt = Web3Number.fromWei("0", this.asset().decimals);
24040
24825
  const net = {
24041
24826
  tokenInfo: this.asset(),
24042
24827
  amount: zeroAmt,
24043
24828
  usdValue: 0
24044
24829
  };
24045
- const prevAum = Web3Number.fromWei(currentAUM.toString(), this.asset().decimals);
24046
24830
  if (vesuAum.isZero()) {
24047
24831
  return { net, splits: [{
24048
24832
  aum: zeroAmt,
@@ -24054,16 +24838,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24054
24838
  }
24055
24839
  const aumToken = vesuAum.plus(balance.amount);
24056
24840
  logger.verbose(`${this.getTag()} Actual AUM: ${aumToken}`);
24057
- const netAPY = await this.netAPY();
24058
- const defispringAPY = (netAPY.splits.find((s) => s.id === "defispring")?.apy || 0) * 0.8;
24059
- if (!defispringAPY) throw new Error("DefiSpring APY not found");
24060
- const timeDiff = Math.round(Date.now() / 1e3) - Number(lastReportTime);
24061
- const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
24062
- const rewardAssets = prevAum.multipliedBy(growthRate);
24063
- logger.verbose(`${this.getTag()} DefiSpring AUM time difference: ${timeDiff}`);
24064
- logger.verbose(`${this.getTag()} Current AUM: ${currentAUM}`);
24065
- logger.verbose(`${this.getTag()} Net APY: ${JSON.stringify(netAPY)}`);
24066
- logger.verbose(`${this.getTag()} rewards AUM: ${rewardAssets}`);
24841
+ const rewardAssets = await this.getRewardsAUM(prevAum);
24067
24842
  const newAUM = aumToken.plus(rewardAssets);
24068
24843
  logger.verbose(`${this.getTag()} New AUM: ${newAUM}`);
24069
24844
  net.amount = newAUM;
@@ -24077,6 +24852,21 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24077
24852
  }];
24078
24853
  return { net, splits, prevAum };
24079
24854
  }
24855
+ // account for future rewards (e.g. defispring rewards)
24856
+ async getRewardsAUM(prevAum) {
24857
+ const lastReportTime = await this.contract.call("last_report_timestamp", []);
24858
+ const netAPY = await this.netAPY();
24859
+ const defispringAPY = (netAPY.splits.find((s) => s.id === "defispring")?.apy || 0) * 0.8;
24860
+ if (!defispringAPY) throw new Error("DefiSpring APY not found");
24861
+ const timeDiff = Math.round(Date.now() / 1e3) - Number(lastReportTime);
24862
+ const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
24863
+ const rewardAssets = prevAum.multipliedBy(growthRate);
24864
+ logger.verbose(`${this.getTag()} DefiSpring AUM time difference: ${timeDiff}`);
24865
+ logger.verbose(`${this.getTag()} Current AUM: ${prevAum.toString()}`);
24866
+ logger.verbose(`${this.getTag()} Net APY: ${JSON.stringify(netAPY)}`);
24867
+ logger.verbose(`${this.getTag()} rewards AUM: ${rewardAssets}`);
24868
+ return rewardAssets;
24869
+ }
24080
24870
  getVesuAdapters() {
24081
24871
  const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
24082
24872
  const vesuAdapter2 = this.getAdapter("vesu_leg2_adapter" /* VESU_LEG2 */);
@@ -24086,11 +24876,23 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24086
24876
  vesuAdapter2.networkConfig = this.config;
24087
24877
  return [vesuAdapter1, vesuAdapter2];
24088
24878
  }
24879
+ async getVesuPositions() {
24880
+ const adapters = this.getVesuAdapters();
24881
+ const positions = [];
24882
+ for (const adapter of adapters) {
24883
+ positions.push(...await adapter.getPositions(this.config));
24884
+ }
24885
+ return positions;
24886
+ }
24089
24887
  async getVaultPositions() {
24090
- const [vesuAdapter1, vesuAdapter2] = this.getVesuAdapters();
24091
- const leg1Positions = await vesuAdapter1.getPositions(this.config);
24092
- const leg2Positions = await vesuAdapter2.getPositions(this.config);
24093
- return [...leg1Positions, ...leg2Positions];
24888
+ const vesuPositions = await this.getVesuPositions();
24889
+ const unusedBalance = await this.getUnusedBalance();
24890
+ return [...vesuPositions, {
24891
+ amount: unusedBalance.amount,
24892
+ usdValue: unusedBalance.usdValue,
24893
+ token: this.asset(),
24894
+ remarks: "Unused Balance"
24895
+ }];
24094
24896
  }
24095
24897
  getSetManagerCall(strategist, root = this.getMerkleRoot()) {
24096
24898
  return this.managerContract.populate("set_manage_root", [strategist.address, import_starknet16.num.getHexString(root)]);
@@ -24228,7 +25030,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24228
25030
  return new Web3Number(newAmount.toFixed(8), debtTokenAmount.decimals);
24229
25031
  }
24230
25032
  }
24231
- async getVesuMultiplyCall(params) {
25033
+ async getVesuModifyPositionCall(params) {
24232
25034
  const [vesuAdapter1, vesuAdapter2] = this.getVesuAdapters();
24233
25035
  const leg1LTV = await vesuAdapter1.getLTVConfig(this.config);
24234
25036
  const leg2LTV = await vesuAdapter2.getLTVConfig(this.config);
@@ -24729,6 +25531,373 @@ var UniversalStrategies = [
24729
25531
  }
24730
25532
  ];
24731
25533
 
25534
+ // src/strategies/universal-lst-muliplier-strategy.tsx
25535
+ var import_starknet17 = require("starknet");
25536
+ var import_jsx_runtime5 = require("react/jsx-runtime");
25537
+ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25538
+ constructor(config, pricer, metadata) {
25539
+ super(config, pricer, metadata);
25540
+ this.quoteAmountToFetchPrice = new Web3Number(1, 18);
25541
+ const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
25542
+ const underlyingToken = this.getLSTUnderlyingTokenInfo();
25543
+ if (underlyingToken.address.eq(STRKToken.address)) {
25544
+ this.quoteAmountToFetchPrice = new Web3Number(100, 18);
25545
+ } else {
25546
+ this.quoteAmountToFetchPrice = new Web3Number(0.01, this.asset().decimals);
25547
+ }
25548
+ }
25549
+ // only one leg is used
25550
+ // todo support lending assets of underlying as well
25551
+ getVesuAdapters() {
25552
+ const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
25553
+ vesuAdapter1.pricer = this.pricer;
25554
+ vesuAdapter1.networkConfig = this.config;
25555
+ return [vesuAdapter1];
25556
+ }
25557
+ // not applicable for this strategy
25558
+ // No rewards on collateral or borrowing of LST assets
25559
+ async getRewardsAUM(prevAum) {
25560
+ return Web3Number.fromWei("0", this.asset().decimals);
25561
+ }
25562
+ async getLSTDexPrice() {
25563
+ const ekuboQuoter = new EkuboQuoter(this.config);
25564
+ const lstTokenInfo = this.asset();
25565
+ const lstUnderlyingTokenInfo = this.getLSTUnderlyingTokenInfo();
25566
+ const quote = await ekuboQuoter.getQuote(
25567
+ lstTokenInfo.address.address,
25568
+ lstUnderlyingTokenInfo.address.address,
25569
+ this.quoteAmountToFetchPrice
25570
+ );
25571
+ const outputAmount = Web3Number.fromWei(quote.total_calculated, lstUnderlyingTokenInfo.decimals);
25572
+ const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
25573
+ logger.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
25574
+ return price;
25575
+ }
25576
+ /**
25577
+ * Uses vesu's multiple call to create leverage on LST
25578
+ * Deposit amount is in LST
25579
+ * @param params
25580
+ */
25581
+ async getVesuMultiplyCall(params) {
25582
+ const [vesuAdapter1] = this.getVesuAdapters();
25583
+ const legLTV = await vesuAdapter1.getLTVConfig(this.config);
25584
+ const existingPositions = await vesuAdapter1.getPositions(this.config);
25585
+ const collateralisation = await vesuAdapter1.getCollateralization(this.config);
25586
+ const existingCollateralInfo = existingPositions[0];
25587
+ const existingDebtInfo = existingPositions[1];
25588
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
25589
+ existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
25590
+ const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
25591
+ const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
25592
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
25593
+ const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
25594
+ const DEXPrice = await this.getLSTDexPrice();
25595
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
25596
+ const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
25597
+ const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
25598
+ const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / DEXPrice;
25599
+ const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
25600
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
25601
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
25602
+ const debtAmount = x_debt_usd.dividedBy(debtPrice);
25603
+ const marginAmount = addedCollateral;
25604
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
25605
+ return this.getModifyLeverCall({
25606
+ marginAmount,
25607
+ debtAmount,
25608
+ isIncrease: debtAmount.greaterThan(0)
25609
+ });
25610
+ }
25611
+ getLSTUnderlyingTokenInfo() {
25612
+ const [vesuAdapter1] = this.getVesuAdapters();
25613
+ return vesuAdapter1.config.debt;
25614
+ }
25615
+ async getLSTExchangeRate() {
25616
+ const [vesuAdapter1] = this.getVesuAdapters();
25617
+ const lstTokenInfo = vesuAdapter1.config.collateral;
25618
+ const lstABI = new import_starknet17.Contract({
25619
+ abi: erc4626_abi_default,
25620
+ address: lstTokenInfo.address.address,
25621
+ providerOrAccount: this.config.provider
25622
+ });
25623
+ const price = await lstABI.call("convert_to_assets", [import_starknet17.uint256.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())]);
25624
+ const exchangeRate = Number(import_starknet17.uint256.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
25625
+ logger.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
25626
+ return exchangeRate;
25627
+ }
25628
+ /**
25629
+ *
25630
+ * @param params marginAmount is in LST, debtAmount is in underlying
25631
+ */
25632
+ async getModifyLeverCall(params) {
25633
+ assert(!params.marginAmount.isZero() || !params.debtAmount.isZero(), "Deposit/debt must be non-0");
25634
+ const [vesuAdapter1] = this.getVesuAdapters();
25635
+ const lstTokenInfo = this.asset();
25636
+ const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
25637
+ const proofsIDs = [];
25638
+ const manageCalls = [];
25639
+ if (params.marginAmount.greaterThan(0)) {
25640
+ const STEP1_ID = "approve_token1" /* APPROVE_TOKEN1 */;
25641
+ const manage1Info = this.getProofs(STEP1_ID);
25642
+ const depositAmount = params.marginAmount;
25643
+ const manageCall1 = manage1Info.callConstructor({
25644
+ amount: depositAmount
25645
+ });
25646
+ proofsIDs.push(STEP1_ID);
25647
+ manageCalls.push(manageCall1);
25648
+ }
25649
+ const ekuboQuoter = new EkuboQuoter(this.config);
25650
+ const lstPrice = await this.getLSTExchangeRate();
25651
+ const marginSwap = [];
25652
+ const MAX_SLIPPAGE = 0.01;
25653
+ const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
25654
+ const toToken = params.isIncrease ? lstTokenInfo : lstUnderlyingTokenInfo;
25655
+ const leverSwapQuote = await ekuboQuoter.getQuote(
25656
+ fromToken.address.address,
25657
+ toToken.address.address,
25658
+ params.debtAmount
25659
+ // negative for exact amount out
25660
+ );
25661
+ assert(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
25662
+ const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
25663
+ const minExpectedDebt = params.debtAmount.dividedBy(lstPrice).multipliedBy(1 - MAX_SLIPPAGE);
25664
+ const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstPrice).multipliedBy(1 + MAX_SLIPPAGE);
25665
+ const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
25666
+ const manage2Info = this.getProofs(STEP2_ID);
25667
+ const manageCall2 = manage2Info.callConstructor({
25668
+ delegation: true
25669
+ });
25670
+ const STEP3_ID = "multiply_vesu" /* MULTIPLY_VESU */;
25671
+ const manage3Info = this.getProofs(STEP3_ID);
25672
+ const multiplyParams = params.isIncrease ? {
25673
+ isIncrease: true,
25674
+ increaseParams: {
25675
+ add_margin: params.marginAmount,
25676
+ margin_swap: marginSwap,
25677
+ margin_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
25678
+ lever_swap: leverSwap,
25679
+ lever_swap_limit_amount: minExpectedDebt
25680
+ }
25681
+ } : {
25682
+ isIncrease: false,
25683
+ decreaseParams: {
25684
+ sub_margin: params.marginAmount.multipliedBy(-1),
25685
+ lever_swap: leverSwap,
25686
+ lever_swap_limit_amount: maxUsedCollateral,
25687
+ // only required for close position
25688
+ lever_swap_weights: [],
25689
+ // no need to swap collateral to anything, and any residuals return our contract anyways.
25690
+ withdraw_swap: [],
25691
+ withdraw_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
25692
+ withdraw_swap_weights: [],
25693
+ close_position: false
25694
+ }
25695
+ };
25696
+ const manageCall3 = manage3Info.callConstructor(multiplyParams);
25697
+ const STEP4_ID = "switch_delegation_off" /* SWITCH_DELEGATION_OFF */;
25698
+ const manage4Info = this.getProofs(STEP4_ID);
25699
+ const manageCall4 = manage4Info.callConstructor({
25700
+ delegation: false
25701
+ });
25702
+ proofsIDs.push(STEP2_ID, STEP3_ID, STEP4_ID);
25703
+ manageCalls.push(manageCall2, manageCall3, manageCall4);
25704
+ return [this.getManageCall(proofsIDs, manageCalls)];
25705
+ }
25706
+ };
25707
+ function VaultDescription() {
25708
+ const containerStyle = {
25709
+ maxWidth: "800px",
25710
+ margin: "0 auto",
25711
+ backgroundColor: "#111",
25712
+ color: "#eee",
25713
+ fontFamily: "Arial, sans-serif",
25714
+ borderRadius: "12px"
25715
+ };
25716
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: containerStyle, children: [
25717
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { style: { fontSize: "18px", marginBottom: "10px" }, children: "Meta Vault \u2014 Automated Yield Router" }),
25718
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { style: { fontSize: "14px", lineHeight: "1.5", marginBottom: "16px" }, children: "This Levered Endur LST vault is a tokenized leveraged Vault, auto-compounding strategy that continuously allocates your deposited asset to the best available yield source in the ecosystem. Depositors receive vault shares that represent a proportional claim on the underlying assets and accrued yield. Allocation shifts are handled programmatically based on on-chain signals and risk filters, minimizing idle capital and maximizing net APY." }),
25719
+ /* @__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: [
25720
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
25721
+ " Requests can take up to ",
25722
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
25723
+ " to process as the vault unwinds and settles routing."
25724
+ ] }) })
25725
+ ] });
25726
+ }
25727
+ function getDescription2(tokenSymbol) {
25728
+ return VaultDescription();
25729
+ }
25730
+ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
25731
+ vaultSettings.leafAdapters = [];
25732
+ const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
25733
+ const underlyingToken = Global.getDefaultTokens().find((token) => token.symbol === underlyingSymbol);
25734
+ const vesuAdapterLST = new VesuAdapter({
25735
+ poolId: pool1,
25736
+ collateral: lstToken,
25737
+ debt: underlyingToken,
25738
+ vaultAllocator: vaultSettings.vaultAllocator,
25739
+ id: "multiply_vesu" /* MULTIPLY_VESU */
25740
+ });
25741
+ const commonAdapter = new CommonAdapter({
25742
+ manager: vaultSettings.manager,
25743
+ asset: lstToken.address,
25744
+ id: "",
25745
+ vaultAddress: vaultSettings.vaultAddress,
25746
+ vaultAllocator: vaultSettings.vaultAllocator
25747
+ });
25748
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vesuAdapterLST.VESU_MULTIPLY, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
25749
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter.bind(vesuAdapterLST));
25750
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_on" /* SWITCH_DELEGATION_ON */).bind(vesuAdapterLST));
25751
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_off" /* SWITCH_DELEGATION_OFF */).bind(vesuAdapterLST));
25752
+ vaultSettings.adapters.push(...[{
25753
+ id: "vesu_leg1_adapter" /* VESU_LEG1 */,
25754
+ adapter: vesuAdapterLST
25755
+ }, {
25756
+ id: "common_adapter" /* COMMON */,
25757
+ adapter: commonAdapter
25758
+ }]);
25759
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
25760
+ vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
25761
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterLST));
25762
+ const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
25763
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
25764
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
25765
+ return vaultSettings;
25766
+ }
25767
+ function getFAQs2(lstSymbol, underlyingSymbol) {
25768
+ return [
25769
+ {
25770
+ question: `What is the Hyper ${lstSymbol} Vault?`,
25771
+ answer: `The Hyper ${lstSymbol} Vault is a tokenized strategy that automatically loops your ${underlyingSymbol} or ${lstSymbol} to create up to 4x leverage to hence yield in a very low risk manner.`
25772
+ },
25773
+ {
25774
+ question: "How does yield allocation work?",
25775
+ answer: `The strategy uses deposited ${lstSymbol} to collateralize it on Vesu, borrow more ${underlyingSymbol} to loop further. Instead of manually doing this, using flash loan, this leverage is created in a single gas efficient step. Our continuous monitoring systems gauge current yield and available liquidity in real time to make sure yield is optimal. For instance, if the looping becomes in-efficient in future, the strategy will rebalance to reduce leverage or simply hold ${lstSymbol} to continue earning yield.`
25776
+ },
25777
+ {
25778
+ question: "Which protocols/dApp are used??",
25779
+ answer: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
25780
+ "Currently, the LST is from ",
25781
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Endur" }),
25782
+ " while ",
25783
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Vesu" }),
25784
+ " is used to collateralize the looped position."
25785
+ ] })
25786
+ },
25787
+ {
25788
+ question: "Can I get liquidated?",
25789
+ answer: "The strategy uses highly correlated assets which drastically reduces 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."
25790
+ },
25791
+ {
25792
+ question: "What do I receive when I deposit?",
25793
+ answer: "Depositors receive vault tokens representing their proportional share of the vault. These tokens entitle holders to both the principal and accrued yield."
25794
+ },
25795
+ {
25796
+ question: "How long do withdrawals take?",
25797
+ answer: "Withdrawals may take up to 1-2 hours to process, as the vault unwinds and settles liquidity routing across integrated protocols. In case of large withdrawals, to avoid slippage, we may slowly unwind the position, which could make the withdrawals longer."
25798
+ },
25799
+ {
25800
+ question: "Is the Hyper xSTRK Vault non-custodial?",
25801
+ answer: "Yes. The Hyper xSTRK Vault operates entirely on-chain. Users always maintain control of their vault tokens, and the strategy is fully transparent."
25802
+ },
25803
+ {
25804
+ question: "Is the Vault audited?",
25805
+ answer: "Yes. The Hyper xSTRK Vault is audited by Zellic. Look for safety icon beside the strategy name for more details."
25806
+ },
25807
+ {
25808
+ question: "Are there any fees?",
25809
+ answer: "Troves charges a performance of 10% on the yield generated. The APY shown is net of this fee. This fee is only applied to the profits earned, ensuring that users retain their initial capital."
25810
+ }
25811
+ ];
25812
+ }
25813
+ var _riskFactor4 = [
25814
+ { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 25, reason: "Audited by Zellic" },
25815
+ { type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 1 /* VERY_LOW_PROBABILITY */, weight: 50, reason: "The collateral and debt are highly correlated" },
25816
+ { type: "Technical Risk" /* TECHNICAL_RISK */, value: 1 /* STABLE_INFRASTRUCTURE */, weight: 50, reason: "Liquidation can only happen if vault is left un-monitored for weeks, which is highly unlikely. We actively monitor all services on a daily basis." }
25817
+ ];
25818
+ var hyperxSTRK = {
25819
+ vaultAddress: ContractAddr.from("0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"),
25820
+ manager: ContractAddr.from("0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"),
25821
+ vaultAllocator: ContractAddr.from("0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"),
25822
+ redeemRequestNFT: ContractAddr.from("0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"),
25823
+ aumOracle: ContractAddr.from("0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"),
25824
+ leafAdapters: [],
25825
+ adapters: [],
25826
+ targetHealthFactor: 1.1,
25827
+ minHealthFactor: 1.05
25828
+ };
25829
+ var hyperxWBTC = {
25830
+ vaultAddress: ContractAddr.from("0x2da9d0f96a46b453f55604313785dc866424240b1c6811d13bef594343db818"),
25831
+ manager: ContractAddr.from("0x75866db44c81e6986f06035206ee9c7d15833ddb22d6a22c016cfb5c866a491"),
25832
+ vaultAllocator: ContractAddr.from("0x57b5c1bb457b5e840a2714ae53ada87d77be2f3fd33a59b4fe709ef20c020c1"),
25833
+ redeemRequestNFT: ContractAddr.from("0x7a5dc288325456f05e70e9616e16bc02ffbe448f4b89f80b47c0970b989c7c"),
25834
+ aumOracle: ContractAddr.from(""),
25835
+ leafAdapters: [],
25836
+ adapters: [],
25837
+ targetHealthFactor: 1.1,
25838
+ minHealthFactor: 1.05
25839
+ };
25840
+ var hyperxtBTC = {
25841
+ vaultAddress: ContractAddr.from("0x47d5f68477e5637ce0e56436c6b5eee5a354e6828995dae106b11a48679328"),
25842
+ manager: ContractAddr.from("0xc4cc3e08029a0ae076f5fdfca70575abb78d23c5cd1c49a957f7e697885401"),
25843
+ vaultAllocator: ContractAddr.from("0x50bbd4fe69f841ecb13b2619fe50ebfa4e8944671b5d0ebf7868fd80c61b31e"),
25844
+ redeemRequestNFT: ContractAddr.from("0xeac9032f02057779816e38a6cb9185d12d86b3aacc9949b96b36de359c1e3"),
25845
+ aumOracle: ContractAddr.from(""),
25846
+ leafAdapters: [],
25847
+ adapters: [],
25848
+ targetHealthFactor: 1.1,
25849
+ minHealthFactor: 1.05
25850
+ };
25851
+ var hyperxsBTC = {
25852
+ vaultAddress: ContractAddr.from("0x437ef1e7d0f100b2e070b7a65cafec0b2be31b0290776da8b4112f5473d8d9"),
25853
+ manager: ContractAddr.from("0xc9ac023090625b0be3f6532ca353f086746f9c09f939dbc1b2613f09e5f821"),
25854
+ vaultAllocator: ContractAddr.from("0x60c2d856936b975459a5b4eb28b8672d91f757bd76cebb6241f8d670185dc01"),
25855
+ redeemRequestNFT: ContractAddr.from("0x429e8ee8bc7ecd1ade72630d350a2e0f10f9a2507c45f188ba17fe8f2ab4cf3"),
25856
+ aumOracle: ContractAddr.from(""),
25857
+ leafAdapters: [],
25858
+ adapters: [],
25859
+ targetHealthFactor: 1.1,
25860
+ minHealthFactor: 1.05
25861
+ };
25862
+ function getInvestmentSteps(lstSymbol, underlyingSymbol) {
25863
+ return [
25864
+ `Deposit ${underlyingSymbol} into the vault`,
25865
+ `The vault manager loops the ${underlyingSymbol} to buy ${lstSymbol}`,
25866
+ `The vault manager collateralizes the ${lstSymbol} on Vesu`,
25867
+ `The vault manager borrows more ${underlyingSymbol} to loop further`,
25868
+ `Claim BTCFi STRK rewards weekly to swap to ${lstSymbol} and reinvest`,
25869
+ `If required, adjust leverage or re-allocate assets within LST pool on Vesu to optimize yield`
25870
+ ];
25871
+ }
25872
+ function getStrategySettings(lstSymbol, underlyingSymbol, addresses, isPreview = false) {
25873
+ return {
25874
+ name: `Hyper ${lstSymbol}`,
25875
+ description: getDescription2(lstSymbol),
25876
+ address: addresses.vaultAddress,
25877
+ launchBlock: 0,
25878
+ type: "Other",
25879
+ depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)],
25880
+ additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, VesuPools.Re7xSTRK),
25881
+ risk: {
25882
+ riskFactor: _riskFactor4,
25883
+ netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
25884
+ notARisks: getNoRiskTags(_riskFactor4)
25885
+ },
25886
+ protocols: [Protocols.ENDUR, Protocols.VESU],
25887
+ maxTVL: Web3Number.fromWei(0, 18),
25888
+ contractDetails: getContractDetails(addresses),
25889
+ faqs: getFAQs2(lstSymbol, underlyingSymbol),
25890
+ investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol),
25891
+ isPreview
25892
+ };
25893
+ }
25894
+ var HyperLSTStrategies = [
25895
+ getStrategySettings("xSTRK", "STRK", hyperxSTRK, false),
25896
+ getStrategySettings("xWBTC", "WBTC", hyperxWBTC, true),
25897
+ getStrategySettings("xtBTC", "tBTC", hyperxtBTC, true),
25898
+ getStrategySettings("xsBTC", "solvBTC", hyperxsBTC, true)
25899
+ ];
25900
+
24732
25901
  // src/notifs/telegram.ts
24733
25902
  var import_node_telegram_bot_api = __toESM(require("node-telegram-bot-api"));
24734
25903
  var TelegramNotif = class {
@@ -24830,12 +25999,12 @@ var PricerRedis = class extends Pricer {
24830
25999
 
24831
26000
  // src/node/deployer.ts
24832
26001
  var import_assert = __toESM(require("assert"));
24833
- var import_starknet18 = require("starknet");
26002
+ var import_starknet19 = require("starknet");
24834
26003
  var import_fs2 = require("fs");
24835
26004
 
24836
26005
  // src/utils/store.ts
24837
26006
  var import_fs = __toESM(require("fs"));
24838
- var import_starknet17 = require("starknet");
26007
+ var import_starknet18 = require("starknet");
24839
26008
  var crypto2 = __toESM(require("crypto"));
24840
26009
 
24841
26010
  // src/utils/encrypt.ts
@@ -24929,7 +26098,7 @@ var Store = class _Store {
24929
26098
  }
24930
26099
  logger.verbose(`Account loaded: ${accountKey} from network: ${this.config.network}`);
24931
26100
  logger.verbose(`Address: ${data.address}`);
24932
- const acc = new import_starknet17.Account({
26101
+ const acc = new import_starknet18.Account({
24933
26102
  provider: this.config.provider,
24934
26103
  address: data.address,
24935
26104
  signer: data.pk,
@@ -25024,10 +26193,10 @@ function getAccount(accountKey, config, password = process.env.ACCOUNT_SECURE_PA
25024
26193
  }
25025
26194
  async function myDeclare(contract_name, package_name = "strkfarm", config, acc) {
25026
26195
  const provider2 = config.provider;
25027
- const compiledSierra = import_starknet18.json.parse(
26196
+ const compiledSierra = import_starknet19.json.parse(
25028
26197
  (0, import_fs2.readFileSync)(`./target/release/${package_name}_${contract_name}.contract_class.json`).toString("ascii")
25029
26198
  );
25030
- const compiledCasm = import_starknet18.json.parse(
26199
+ const compiledCasm = import_starknet19.json.parse(
25031
26200
  (0, import_fs2.readFileSync)(`./target/release/${package_name}_${contract_name}.compiled_contract_class.json`).toString("ascii")
25032
26201
  );
25033
26202
  const contracts = getContracts();
@@ -25035,7 +26204,7 @@ async function myDeclare(contract_name, package_name = "strkfarm", config, acc)
25035
26204
  contract: compiledSierra,
25036
26205
  casm: compiledCasm
25037
26206
  };
25038
- const result = (0, import_starknet18.extractContractHashes)(payload);
26207
+ const result = (0, import_starknet19.extractContractHashes)(payload);
25039
26208
  console.log("classhash:", result.classHash);
25040
26209
  try {
25041
26210
  const cls = await provider2.getClassByHash(result.classHash);
@@ -25053,7 +26222,7 @@ async function myDeclare(contract_name, package_name = "strkfarm", config, acc)
25053
26222
  const tx = await acc.declareIfNot(payload);
25054
26223
  console.log(`Declaring: ${contract_name}, tx:`, tx.transaction_hash);
25055
26224
  await provider2.waitForTransaction(tx.transaction_hash, {
25056
- successStates: [import_starknet18.TransactionExecutionStatus.SUCCEEDED]
26225
+ successStates: [import_starknet19.TransactionExecutionStatus.SUCCEEDED]
25057
26226
  });
25058
26227
  if (!contracts.class_hashes) {
25059
26228
  contracts["class_hashes"] = {};
@@ -25077,7 +26246,7 @@ async function deployContract(contract_name, classHash, constructorData, config,
25077
26246
  });
25078
26247
  console.log("Deploy tx: ", tx.transaction_hash);
25079
26248
  await provider2.waitForTransaction(tx.transaction_hash, {
25080
- successStates: [import_starknet18.TransactionExecutionStatus.SUCCEEDED]
26249
+ successStates: [import_starknet19.TransactionExecutionStatus.SUCCEEDED]
25081
26250
  });
25082
26251
  const contracts = getContracts();
25083
26252
  if (!contracts.contracts) {
@@ -25094,7 +26263,7 @@ async function prepareMultiDeployContracts(contracts, config, acc) {
25094
26263
  for (const { contract_name, package_name, constructorData } of contracts) {
25095
26264
  const declaredInfo = await myDeclare(contract_name, package_name, config, acc);
25096
26265
  const classHash = declaredInfo.class_hash;
25097
- const { calls, addresses } = new import_starknet18.Deployer().buildDeployerCall({
26266
+ const { calls, addresses } = new import_starknet19.Deployer().buildDeployerCall({
25098
26267
  classHash,
25099
26268
  constructorCalldata: constructorData
25100
26269
  }, acc.address);
@@ -25112,7 +26281,7 @@ async function prepareMultiDeployContracts(contracts, config, acc) {
25112
26281
  }
25113
26282
  async function executeDeployCalls(contractsInfo, acc, provider2) {
25114
26283
  for (let contractInfo of contractsInfo) {
25115
- (0, import_assert.default)(import_starknet18.num.toHexString(contractInfo.call.contractAddress) == import_starknet18.num.toHexString(import_starknet18.constants.UDC.ADDRESS), "Must be pointed at UDC address");
26284
+ (0, import_assert.default)(import_starknet19.num.toHexString(contractInfo.call.contractAddress) == import_starknet19.num.toHexString(import_starknet19.constants.UDC.ADDRESS), "Must be pointed at UDC address");
25116
26285
  }
25117
26286
  const allCalls = contractsInfo.map((info) => info.call);
25118
26287
  await executeTransactions(allCalls, acc, provider2, `Deploying contracts: ${contractsInfo.map((info) => info.contract_name).join(", ")}`);
@@ -25136,7 +26305,7 @@ async function executeTransactions(calls, acc, provider2, remarks) {
25136
26305
  if (remarks)
25137
26306
  console.log(`Remarks: ${remarks}`);
25138
26307
  await provider2.waitForTransaction(tx.transaction_hash, {
25139
- successStates: [import_starknet18.TransactionExecutionStatus.SUCCEEDED]
26308
+ successStates: [import_starknet19.TransactionExecutionStatus.SUCCEEDED]
25140
26309
  });
25141
26310
  console.log(`Transaction confirmed: ${tx.transaction_hash}`);
25142
26311
  return tx;
@@ -25163,9 +26332,11 @@ var deployer_default = Deployer;
25163
26332
  ERC20,
25164
26333
  EkuboCLVault,
25165
26334
  EkuboCLVaultStrategies,
26335
+ EkuboQuoter,
25166
26336
  FatalError,
25167
26337
  FlowChartColors,
25168
26338
  Global,
26339
+ HyperLSTStrategies,
25169
26340
  ILending,
25170
26341
  Initializable,
25171
26342
  MarginType,
@@ -25184,6 +26355,7 @@ var deployer_default = Deployer;
25184
26355
  TelegramNotif,
25185
26356
  UNIVERSAL_ADAPTERS,
25186
26357
  UNIVERSAL_MANAGE_IDS,
26358
+ UniversalLstMultiplierStrategy,
25187
26359
  UniversalStrategies,
25188
26360
  UniversalStrategy,
25189
26361
  VesuAdapter,
@@ -25196,6 +26368,7 @@ var deployer_default = Deployer;
25196
26368
  ZkLend,
25197
26369
  assert,
25198
26370
  getAPIUsingHeadlessBrowser,
26371
+ getContractDetails,
25199
26372
  getDefaultStoreConfig,
25200
26373
  getMainnetConfig,
25201
26374
  getNoRiskTags,