@strkfarm/sdk 1.1.7 → 1.1.9

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 }),
@@ -2231,8 +2246,8 @@ var AvnuWrapper = class _AvnuWrapper {
2231
2246
  }
2232
2247
  return filteredQuotes[0];
2233
2248
  }
2234
- async getSwapInfo(quote, taker, integratorFeeBps, integratorFeeRecipient, minAmount) {
2235
- const calldata = await (0, import_avnu_sdk.fetchBuildExecuteTransaction)(quote.quoteId);
2249
+ async getSwapInfo(quote, taker, integratorFeeBps, integratorFeeRecipient, minAmount, options) {
2250
+ const calldata = await (0, import_avnu_sdk.fetchBuildExecuteTransaction)(quote.quoteId, taker, void 0, void 0, options);
2236
2251
  const call = calldata.calls[1];
2237
2252
  const callData = call.calldata;
2238
2253
  const routesLen = Number(callData[11]);
@@ -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,33 @@ 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
+ const prevAUM = await this.getPrevAUM();
24693
+ const vesuAdapters = this.getVesuAdapters();
24694
+ const allVesuPools = await VesuAdapter.getVesuPools();
24695
+ const pools = vesuAdapters.map((vesuAdapter) => {
24696
+ return allVesuPools.pools.find((p) => vesuAdapter.config.poolId.eqString(import_starknet16.num.getHexString(p.id)));
24697
+ });
24698
+ logger.verbose(`${this.metadata.name}::netAPY: vesu-pools: ${JSON.stringify(pools)}`);
24699
+ if (pools.some((p) => !p)) {
23954
24700
  throw new Error("Pool not found");
23955
24701
  }
23956
24702
  ;
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();
24703
+ const positions = await this.getVesuPositions();
23966
24704
  logger.verbose(`${this.metadata.name}::netAPY: positions: ${JSON.stringify(positions)}`);
24705
+ const baseAPYs = [];
24706
+ const rewardAPYs = [];
24707
+ for (const [index, pool] of pools.entries()) {
24708
+ const vesuAdapter = vesuAdapters[index];
24709
+ const collateralAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.collateral.symbol)?.stats;
24710
+ const debtAsset = pool.assets.find((a) => a.symbol === vesuAdapter.config.debt.symbol)?.stats;
24711
+ const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
24712
+ const lstAPY = Number(collateralAsset.lstApr?.value || 0) / 1e18;
24713
+ baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
24714
+ rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr.value || "0") / 1e18, 0]);
24715
+ }
24716
+ logger.verbose(`${this.metadata.name}::netAPY: baseAPYs: ${JSON.stringify(baseAPYs)}`);
24717
+ logger.verbose(`${this.metadata.name}::netAPY: rewardAPYs: ${JSON.stringify(rewardAPYs)}`);
24718
+ assert(baseAPYs.length == positions.length, "APYs and positions length mismatch");
23967
24719
  if (positions.every((p) => p.amount.isZero())) {
23968
24720
  return { net: 0, splits: [{
23969
24721
  apy: 0,
@@ -23974,11 +24726,10 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
23974
24726
  }] };
23975
24727
  }
23976
24728
  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);
24729
+ const price = await this.pricer.getPrice(this.metadata.depositTokens[0].symbol);
24730
+ const prevAUMUSD = prevAUM.multipliedBy(price.price);
24731
+ const baseAPY = this.computeAPY(baseAPYs, weights, prevAUMUSD);
24732
+ const rewardAPY = this.computeAPY(rewardAPYs, weights, prevAUMUSD);
23982
24733
  const netAPY = baseAPY + rewardAPY;
23983
24734
  logger.verbose(`${this.metadata.name}::netAPY: net: ${netAPY}, baseAPY: ${baseAPY}, rewardAPY: ${rewardAPY}`);
23984
24735
  return { net: netAPY, splits: [{
@@ -23989,11 +24740,11 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
23989
24740
  id: "defispring"
23990
24741
  }] };
23991
24742
  }
23992
- computeAPY(apys, weights) {
24743
+ computeAPY(apys, weights, currentAUM) {
23993
24744
  assert(apys.length === weights.length, "APYs and weights length mismatch");
23994
24745
  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;
24746
+ logger.verbose(`${this.getTag()} computeAPY: apys: ${JSON.stringify(apys)}, weights: ${JSON.stringify(weights)}, weightedSum: ${weightedSum}, currentAUM: ${currentAUM}`);
24747
+ return weightedSum / currentAUM.toNumber();
23997
24748
  }
23998
24749
  /**
23999
24750
  * Calculates the total TVL of the strategy.
@@ -24025,24 +24776,48 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24025
24776
  usdValue
24026
24777
  };
24027
24778
  }
24028
- async getAUM() {
24779
+ async getVesuAUM(adapter) {
24780
+ const legAUM = await adapter.getPositions(this.config);
24781
+ const underlying = this.asset();
24782
+ let vesuAum = Web3Number.fromWei("0", underlying.decimals);
24783
+ if (legAUM[0].token.address.eq(underlying.address)) {
24784
+ vesuAum = vesuAum.plus(legAUM[0].amount);
24785
+ } else {
24786
+ const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
24787
+ vesuAum = vesuAum.plus(legAUM[1].usdValue / tokenPrice.price);
24788
+ }
24789
+ if (legAUM[1].token.address.eq(underlying.address)) {
24790
+ vesuAum = vesuAum.minus(legAUM[1].amount);
24791
+ } else {
24792
+ const tokenPrice = await this.pricer.getPrice(legAUM[1].token.symbol);
24793
+ vesuAum = vesuAum.minus(legAUM[1].usdValue / tokenPrice.price);
24794
+ }
24795
+ ;
24796
+ logger.verbose(`${this.getTag()} Vesu AUM: ${vesuAum}, legCollateral: ${legAUM[0].amount.toNumber()}, legDebt: ${legAUM[1].amount.toNumber()}`);
24797
+ return vesuAum;
24798
+ }
24799
+ async getPrevAUM() {
24029
24800
  const currentAUM = await this.contract.call("aum", []);
24030
- const lastReportTime = await this.contract.call("last_report_timestamp", []);
24801
+ const prevAum = Web3Number.fromWei(currentAUM.toString(), this.asset().decimals);
24802
+ logger.verbose(`${this.getTag()} Prev AUM: ${prevAum}`);
24803
+ return prevAum;
24804
+ }
24805
+ async getAUM() {
24806
+ const prevAum = await this.getPrevAUM();
24031
24807
  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);
24808
+ const vesuAdapters = this.getVesuAdapters();
24809
+ let vesuAum = Web3Number.fromWei("0", this.asset().decimals);
24810
+ for (const adapter of vesuAdapters) {
24811
+ vesuAum = vesuAum.plus(await this.getVesuAUM(adapter));
24812
+ }
24035
24813
  const balance = await this.getUnusedBalance();
24036
24814
  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
24815
  const zeroAmt = Web3Number.fromWei("0", this.asset().decimals);
24040
24816
  const net = {
24041
24817
  tokenInfo: this.asset(),
24042
24818
  amount: zeroAmt,
24043
24819
  usdValue: 0
24044
24820
  };
24045
- const prevAum = Web3Number.fromWei(currentAUM.toString(), this.asset().decimals);
24046
24821
  if (vesuAum.isZero()) {
24047
24822
  return { net, splits: [{
24048
24823
  aum: zeroAmt,
@@ -24054,16 +24829,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24054
24829
  }
24055
24830
  const aumToken = vesuAum.plus(balance.amount);
24056
24831
  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}`);
24832
+ const rewardAssets = await this.getRewardsAUM(prevAum);
24067
24833
  const newAUM = aumToken.plus(rewardAssets);
24068
24834
  logger.verbose(`${this.getTag()} New AUM: ${newAUM}`);
24069
24835
  net.amount = newAUM;
@@ -24077,6 +24843,21 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24077
24843
  }];
24078
24844
  return { net, splits, prevAum };
24079
24845
  }
24846
+ // account for future rewards (e.g. defispring rewards)
24847
+ async getRewardsAUM(prevAum) {
24848
+ const lastReportTime = await this.contract.call("last_report_timestamp", []);
24849
+ const netAPY = await this.netAPY();
24850
+ const defispringAPY = (netAPY.splits.find((s) => s.id === "defispring")?.apy || 0) * 0.8;
24851
+ if (!defispringAPY) throw new Error("DefiSpring APY not found");
24852
+ const timeDiff = Math.round(Date.now() / 1e3) - Number(lastReportTime);
24853
+ const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
24854
+ const rewardAssets = prevAum.multipliedBy(growthRate);
24855
+ logger.verbose(`${this.getTag()} DefiSpring AUM time difference: ${timeDiff}`);
24856
+ logger.verbose(`${this.getTag()} Current AUM: ${prevAum.toString()}`);
24857
+ logger.verbose(`${this.getTag()} Net APY: ${JSON.stringify(netAPY)}`);
24858
+ logger.verbose(`${this.getTag()} rewards AUM: ${rewardAssets}`);
24859
+ return rewardAssets;
24860
+ }
24080
24861
  getVesuAdapters() {
24081
24862
  const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
24082
24863
  const vesuAdapter2 = this.getAdapter("vesu_leg2_adapter" /* VESU_LEG2 */);
@@ -24086,11 +24867,23 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24086
24867
  vesuAdapter2.networkConfig = this.config;
24087
24868
  return [vesuAdapter1, vesuAdapter2];
24088
24869
  }
24870
+ async getVesuPositions() {
24871
+ const adapters = this.getVesuAdapters();
24872
+ const positions = [];
24873
+ for (const adapter of adapters) {
24874
+ positions.push(...await adapter.getPositions(this.config));
24875
+ }
24876
+ return positions;
24877
+ }
24089
24878
  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];
24879
+ const vesuPositions = await this.getVesuPositions();
24880
+ const unusedBalance = await this.getUnusedBalance();
24881
+ return [...vesuPositions, {
24882
+ amount: unusedBalance.amount,
24883
+ usdValue: unusedBalance.usdValue,
24884
+ token: this.asset(),
24885
+ remarks: "Unused Balance"
24886
+ }];
24094
24887
  }
24095
24888
  getSetManagerCall(strategist, root = this.getMerkleRoot()) {
24096
24889
  return this.managerContract.populate("set_manage_root", [strategist.address, import_starknet16.num.getHexString(root)]);
@@ -24228,7 +25021,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
24228
25021
  return new Web3Number(newAmount.toFixed(8), debtTokenAmount.decimals);
24229
25022
  }
24230
25023
  }
24231
- async getVesuMultiplyCall(params) {
25024
+ async getVesuModifyPositionCall(params) {
24232
25025
  const [vesuAdapter1, vesuAdapter2] = this.getVesuAdapters();
24233
25026
  const leg1LTV = await vesuAdapter1.getLTVConfig(this.config);
24234
25027
  const leg2LTV = await vesuAdapter2.getLTVConfig(this.config);
@@ -24729,6 +25522,336 @@ var UniversalStrategies = [
24729
25522
  }
24730
25523
  ];
24731
25524
 
25525
+ // src/strategies/universal-lst-muliplier-strategy.tsx
25526
+ var import_starknet17 = require("starknet");
25527
+ var import_jsx_runtime5 = require("react/jsx-runtime");
25528
+ var UniversalLstMultiplierStrategy = class extends UniversalStrategy {
25529
+ constructor(config, pricer, metadata) {
25530
+ super(config, pricer, metadata);
25531
+ this.quoteAmountToFetchPrice = new Web3Number(1, 18);
25532
+ const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
25533
+ const underlyingToken = this.getLSTUnderlyingTokenInfo();
25534
+ if (underlyingToken.address.eq(STRKToken.address)) {
25535
+ this.quoteAmountToFetchPrice = new Web3Number(100, 18);
25536
+ } else {
25537
+ this.quoteAmountToFetchPrice = new Web3Number(0.01, this.asset().decimals);
25538
+ }
25539
+ }
25540
+ // only one leg is used
25541
+ // todo support lending assets of underlying as well
25542
+ getVesuAdapters() {
25543
+ const vesuAdapter1 = this.getAdapter("vesu_leg1_adapter" /* VESU_LEG1 */);
25544
+ vesuAdapter1.pricer = this.pricer;
25545
+ vesuAdapter1.networkConfig = this.config;
25546
+ return [vesuAdapter1];
25547
+ }
25548
+ // not applicable for this strategy
25549
+ // No rewards on collateral or borrowing of LST assets
25550
+ async getRewardsAUM(prevAum) {
25551
+ return Web3Number.fromWei("0", this.asset().decimals);
25552
+ }
25553
+ async getLSTDexPrice() {
25554
+ const ekuboQuoter = new EkuboQuoter(this.config);
25555
+ const lstTokenInfo = this.asset();
25556
+ const lstUnderlyingTokenInfo = this.getLSTUnderlyingTokenInfo();
25557
+ const quote = await ekuboQuoter.getQuote(
25558
+ lstTokenInfo.address.address,
25559
+ lstUnderlyingTokenInfo.address.address,
25560
+ this.quoteAmountToFetchPrice
25561
+ );
25562
+ const outputAmount = Web3Number.fromWei(quote.total_calculated, lstUnderlyingTokenInfo.decimals);
25563
+ const price = outputAmount.toNumber() / this.quoteAmountToFetchPrice.toNumber();
25564
+ logger.verbose(`${this.getTag()}:: LST Dex Price: ${price}`);
25565
+ return price;
25566
+ }
25567
+ /**
25568
+ * Uses vesu's multiple call to create leverage on LST
25569
+ * Deposit amount is in LST
25570
+ * @param params
25571
+ */
25572
+ async getVesuMultiplyCall(params) {
25573
+ const [vesuAdapter1] = this.getVesuAdapters();
25574
+ const legLTV = await vesuAdapter1.getLTVConfig(this.config);
25575
+ const existingPositions = await vesuAdapter1.getPositions(this.config);
25576
+ const collateralisation = await vesuAdapter1.getCollateralization(this.config);
25577
+ const existingCollateralInfo = existingPositions[0];
25578
+ const existingDebtInfo = existingPositions[1];
25579
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall existingCollateralInfo: ${JSON.stringify(existingCollateralInfo)},
25580
+ existingDebtInfo: ${JSON.stringify(existingDebtInfo)}, collateralisation: ${JSON.stringify(collateralisation)}`);
25581
+ const collateralPrice = collateralisation[0].usdValue > 0 ? collateralisation[0].usdValue / existingCollateralInfo.amount.toNumber() : 1;
25582
+ const debtPrice = collateralisation[1].usdValue > 0 ? collateralisation[1].usdValue / existingDebtInfo.amount.toNumber() : 1;
25583
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall collateralPrice: ${collateralPrice}, debtPrice: ${debtPrice}`);
25584
+ const addedCollateral = params.leg1DepositAmount.multipliedBy(params.isDeposit ? 1 : -1);
25585
+ const DEXPrice = await this.getLSTDexPrice();
25586
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall addedCollateral: ${addedCollateral}`);
25587
+ const numeratorPart1 = existingCollateralInfo.amount.plus(addedCollateral).multipliedBy(collateralPrice).multipliedBy(legLTV);
25588
+ const numeratorPart2 = existingDebtInfo.amount.multipliedBy(debtPrice).multipliedBy(this.metadata.additionalInfo.targetHealthFactor);
25589
+ const denominatorPart = this.metadata.additionalInfo.targetHealthFactor - legLTV / DEXPrice;
25590
+ const x_debt_usd = numeratorPart1.minus(numeratorPart2).dividedBy(denominatorPart);
25591
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall x_debt_usd: ${x_debt_usd}`);
25592
+ logger.debug(`${this.getTag()}::getVesuMultiplyCall numeratorPart1: ${numeratorPart1}, numeratorPart2: ${numeratorPart2}, denominatorPart: ${denominatorPart}`);
25593
+ const debtAmount = x_debt_usd.dividedBy(debtPrice);
25594
+ const marginAmount = addedCollateral;
25595
+ logger.verbose(`${this.getTag()}::getVesuMultiplyCall debtAmount: ${debtAmount}, marginAmount: ${marginAmount}`);
25596
+ return this.getModifyLeverCall({
25597
+ marginAmount,
25598
+ debtAmount,
25599
+ isIncrease: debtAmount.greaterThan(0)
25600
+ });
25601
+ }
25602
+ getLSTUnderlyingTokenInfo() {
25603
+ const [vesuAdapter1] = this.getVesuAdapters();
25604
+ return vesuAdapter1.config.debt;
25605
+ }
25606
+ async getLSTExchangeRate() {
25607
+ const [vesuAdapter1] = this.getVesuAdapters();
25608
+ const lstTokenInfo = vesuAdapter1.config.collateral;
25609
+ const lstABI = new import_starknet17.Contract({
25610
+ abi: erc4626_abi_default,
25611
+ address: lstTokenInfo.address.address,
25612
+ providerOrAccount: this.config.provider
25613
+ });
25614
+ const price = await lstABI.call("convert_to_assets", [import_starknet17.uint256.bnToUint256(new Web3Number(1, lstTokenInfo.decimals).toWei())]);
25615
+ const exchangeRate = Number(import_starknet17.uint256.uint256ToBN(price).toString()) / Math.pow(10, lstTokenInfo.decimals);
25616
+ logger.verbose(`${this.getTag()}:: LST Exchange Rate: ${exchangeRate}`);
25617
+ return exchangeRate;
25618
+ }
25619
+ /**
25620
+ *
25621
+ * @param params marginAmount is in LST, debtAmount is in underlying
25622
+ */
25623
+ async getModifyLeverCall(params) {
25624
+ assert(!params.marginAmount.isZero() || !params.debtAmount.isZero(), "Deposit/debt must be non-0");
25625
+ const [vesuAdapter1] = this.getVesuAdapters();
25626
+ const lstTokenInfo = this.asset();
25627
+ const lstUnderlyingTokenInfo = vesuAdapter1.config.debt;
25628
+ const proofsIDs = [];
25629
+ const manageCalls = [];
25630
+ if (params.marginAmount.greaterThan(0)) {
25631
+ const STEP1_ID = "approve_token1" /* APPROVE_TOKEN1 */;
25632
+ const manage1Info = this.getProofs(STEP1_ID);
25633
+ const depositAmount = params.marginAmount;
25634
+ const manageCall1 = manage1Info.callConstructor({
25635
+ amount: depositAmount
25636
+ });
25637
+ proofsIDs.push(STEP1_ID);
25638
+ manageCalls.push(manageCall1);
25639
+ }
25640
+ const ekuboQuoter = new EkuboQuoter(this.config);
25641
+ const lstPrice = await this.getLSTExchangeRate();
25642
+ const marginSwap = [];
25643
+ const MAX_SLIPPAGE = 0.01;
25644
+ const fromToken = params.isIncrease ? lstUnderlyingTokenInfo : lstTokenInfo;
25645
+ const toToken = params.isIncrease ? lstTokenInfo : lstUnderlyingTokenInfo;
25646
+ const leverSwapQuote = await ekuboQuoter.getQuote(
25647
+ fromToken.address.address,
25648
+ toToken.address.address,
25649
+ params.debtAmount
25650
+ // negative for exact amount out
25651
+ );
25652
+ assert(leverSwapQuote.price_impact < MAX_SLIPPAGE, "getIncreaseLeverCall: Price impact is too high [Debt swap]");
25653
+ const leverSwap = ekuboQuoter.getVesuMultiplyQuote(leverSwapQuote, fromToken, toToken);
25654
+ const minExpectedDebt = params.debtAmount.dividedBy(lstPrice).multipliedBy(1 - MAX_SLIPPAGE);
25655
+ const maxUsedCollateral = params.debtAmount.abs().dividedBy(lstPrice).multipliedBy(1 + MAX_SLIPPAGE);
25656
+ const STEP2_ID = "switch_delegation_on" /* SWITCH_DELEGATION_ON */;
25657
+ const manage2Info = this.getProofs(STEP2_ID);
25658
+ const manageCall2 = manage2Info.callConstructor({
25659
+ delegation: true
25660
+ });
25661
+ const STEP3_ID = "multiply_vesu" /* MULTIPLY_VESU */;
25662
+ const manage3Info = this.getProofs(STEP3_ID);
25663
+ const multiplyParams = params.isIncrease ? {
25664
+ isIncrease: true,
25665
+ increaseParams: {
25666
+ add_margin: params.marginAmount,
25667
+ margin_swap: marginSwap,
25668
+ margin_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
25669
+ lever_swap: leverSwap,
25670
+ lever_swap_limit_amount: minExpectedDebt
25671
+ }
25672
+ } : {
25673
+ isIncrease: false,
25674
+ decreaseParams: {
25675
+ sub_margin: params.marginAmount.multipliedBy(-1),
25676
+ lever_swap: leverSwap,
25677
+ lever_swap_limit_amount: maxUsedCollateral,
25678
+ // only required for close position
25679
+ lever_swap_weights: [],
25680
+ // no need to swap collateral to anything, and any residuals return our contract anyways.
25681
+ withdraw_swap: [],
25682
+ withdraw_swap_limit_amount: Web3Number.fromWei(0, this.asset().decimals),
25683
+ withdraw_swap_weights: [],
25684
+ close_position: false
25685
+ }
25686
+ };
25687
+ const manageCall3 = manage3Info.callConstructor(multiplyParams);
25688
+ const STEP4_ID = "switch_delegation_off" /* SWITCH_DELEGATION_OFF */;
25689
+ const manage4Info = this.getProofs(STEP4_ID);
25690
+ const manageCall4 = manage4Info.callConstructor({
25691
+ delegation: false
25692
+ });
25693
+ proofsIDs.push(STEP2_ID, STEP3_ID, STEP4_ID);
25694
+ manageCalls.push(manageCall2, manageCall3, manageCall4);
25695
+ return [this.getManageCall(proofsIDs, manageCalls)];
25696
+ }
25697
+ };
25698
+ function VaultDescription() {
25699
+ const containerStyle = {
25700
+ maxWidth: "800px",
25701
+ margin: "0 auto",
25702
+ backgroundColor: "#111",
25703
+ color: "#eee",
25704
+ fontFamily: "Arial, sans-serif",
25705
+ borderRadius: "12px"
25706
+ };
25707
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: containerStyle, children: [
25708
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { style: { fontSize: "18px", marginBottom: "10px" }, children: "Meta Vault \u2014 Automated Yield Router" }),
25709
+ /* @__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." }),
25710
+ /* @__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: [
25711
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Withdrawals:" }),
25712
+ " Requests can take up to ",
25713
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "1-2 hours" }),
25714
+ " to process as the vault unwinds and settles routing."
25715
+ ] }) })
25716
+ ] });
25717
+ }
25718
+ function getDescription2(tokenSymbol) {
25719
+ return VaultDescription();
25720
+ }
25721
+ function getLooperSettings2(lstSymbol, underlyingSymbol, vaultSettings, pool1) {
25722
+ vaultSettings.leafAdapters = [];
25723
+ const lstToken = Global.getDefaultTokens().find((token) => token.symbol === lstSymbol);
25724
+ const underlyingToken = Global.getDefaultTokens().find((token) => token.symbol === underlyingSymbol);
25725
+ const vesuAdapterLST = new VesuAdapter({
25726
+ poolId: pool1,
25727
+ collateral: lstToken,
25728
+ debt: underlyingToken,
25729
+ vaultAllocator: vaultSettings.vaultAllocator,
25730
+ id: "multiply_vesu" /* MULTIPLY_VESU */
25731
+ });
25732
+ const commonAdapter = new CommonAdapter({
25733
+ manager: vaultSettings.manager,
25734
+ asset: lstToken.address,
25735
+ id: "",
25736
+ vaultAddress: vaultSettings.vaultAddress,
25737
+ vaultAllocator: vaultSettings.vaultAllocator
25738
+ });
25739
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vesuAdapterLST.VESU_MULTIPLY, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
25740
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter.bind(vesuAdapterLST));
25741
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_on" /* SWITCH_DELEGATION_ON */).bind(vesuAdapterLST));
25742
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter("switch_delegation_off" /* SWITCH_DELEGATION_OFF */).bind(vesuAdapterLST));
25743
+ vaultSettings.adapters.push(...[{
25744
+ id: "vesu_leg1_adapter" /* VESU_LEG1 */,
25745
+ adapter: vesuAdapterLST
25746
+ }, {
25747
+ id: "common_adapter" /* COMMON */,
25748
+ adapter: commonAdapter
25749
+ }]);
25750
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
25751
+ vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
25752
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterLST));
25753
+ const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
25754
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
25755
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, lstToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
25756
+ return vaultSettings;
25757
+ }
25758
+ function getFAQs2(lstSymbol, underlyingSymbol) {
25759
+ return [
25760
+ {
25761
+ question: `What is the Hyper ${lstSymbol} Vault?`,
25762
+ 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.`
25763
+ },
25764
+ {
25765
+ question: "How does yield allocation work?",
25766
+ 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.`
25767
+ },
25768
+ {
25769
+ question: "Which protocols/dApp are used??",
25770
+ answer: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { children: [
25771
+ "Currently, the LST is from ",
25772
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Endur" }),
25773
+ " while ",
25774
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Vesu" }),
25775
+ " is used to collateralize the looped position."
25776
+ ] })
25777
+ },
25778
+ {
25779
+ question: "Can I get liquidated?",
25780
+ 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."
25781
+ },
25782
+ {
25783
+ question: "What do I receive when I deposit?",
25784
+ answer: "Depositors receive vault tokens representing their proportional share of the vault. These tokens entitle holders to both the principal and accrued yield."
25785
+ },
25786
+ {
25787
+ question: "How long do withdrawals take?",
25788
+ 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."
25789
+ },
25790
+ {
25791
+ question: "Is the Hyper xSTRK Vault non-custodial?",
25792
+ answer: "Yes. The Hyper xSTRK Vault operates entirely on-chain. Users always maintain control of their vault tokens, and the strategy is fully transparent."
25793
+ },
25794
+ {
25795
+ question: "Is the Vault audited?",
25796
+ answer: "Yes. The Hyper xSTRK Vault is audited by Zellic. Look for safety icon beside the strategy name for more details."
25797
+ },
25798
+ {
25799
+ question: "Are there any fees?",
25800
+ 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."
25801
+ }
25802
+ ];
25803
+ }
25804
+ var _riskFactor4 = [
25805
+ { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 25, reason: "Audited by Zellic" },
25806
+ { type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 1 /* VERY_LOW_PROBABILITY */, weight: 50, reason: "The collateral and debt are highly correlated" },
25807
+ { 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." }
25808
+ ];
25809
+ var hyperxSTRK = {
25810
+ vaultAddress: ContractAddr.from("0x46c7a54c82b1fe374353859f554a40b8bd31d3e30f742901579e7b57b1b5960"),
25811
+ manager: ContractAddr.from("0x5d499cd333757f461a0bedaca3dfc4d77320c773037e0aa299f22a6dbfdc03a"),
25812
+ vaultAllocator: ContractAddr.from("0x511d07953a09bc7c505970891507c5a2486d2ea22752601a14db092186d7caa"),
25813
+ redeemRequestNFT: ContractAddr.from("0x51e40b839dc0c2feca923f863072673b94abfa2483345be3b30b457a90d095"),
25814
+ aumOracle: ContractAddr.from("0x48cf709870a1a0d453d37de108e0c41b8b89819ef54f95abc0e2e1f98bbe937"),
25815
+ leafAdapters: [],
25816
+ adapters: [],
25817
+ targetHealthFactor: 1.1,
25818
+ minHealthFactor: 1.05
25819
+ };
25820
+ function getInvestmentSteps(lstSymbol, underlyingSymbol) {
25821
+ return [
25822
+ `Deposit ${underlyingSymbol} into the vault`,
25823
+ `The vault manager loops the ${underlyingSymbol} to buy ${lstSymbol}`,
25824
+ `The vault manager collateralizes the ${lstSymbol} on Vesu`,
25825
+ `The vault manager borrows more ${underlyingSymbol} to loop further`,
25826
+ `Claim BTCFi STRK rewards weekly to swap to ${lstSymbol} and reinvest`,
25827
+ `If required, adjust leverage or re-allocate assets within LST pool on Vesu to optimize yield`
25828
+ ];
25829
+ }
25830
+ function getStrategySettings(lstSymbol, underlyingSymbol, addresses) {
25831
+ return {
25832
+ name: `Hyper ${lstSymbol}`,
25833
+ description: getDescription2(lstSymbol),
25834
+ address: addresses.vaultAddress,
25835
+ launchBlock: 0,
25836
+ type: "Other",
25837
+ depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === lstSymbol)],
25838
+ additionalInfo: getLooperSettings2(lstSymbol, underlyingSymbol, addresses, VesuPools.Re7xSTRK),
25839
+ risk: {
25840
+ riskFactor: _riskFactor4,
25841
+ netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
25842
+ notARisks: getNoRiskTags(_riskFactor4)
25843
+ },
25844
+ protocols: [Protocols.ENDUR, Protocols.VESU],
25845
+ maxTVL: Web3Number.fromWei(0, 18),
25846
+ contractDetails: getContractDetails(addresses),
25847
+ faqs: getFAQs2(lstSymbol, underlyingSymbol),
25848
+ investmentSteps: getInvestmentSteps(lstSymbol, underlyingSymbol)
25849
+ };
25850
+ }
25851
+ var HyperLSTStrategies = [
25852
+ getStrategySettings("xSTRK", "STRK", hyperxSTRK)
25853
+ ];
25854
+
24732
25855
  // src/notifs/telegram.ts
24733
25856
  var import_node_telegram_bot_api = __toESM(require("node-telegram-bot-api"));
24734
25857
  var TelegramNotif = class {
@@ -24830,12 +25953,12 @@ var PricerRedis = class extends Pricer {
24830
25953
 
24831
25954
  // src/node/deployer.ts
24832
25955
  var import_assert = __toESM(require("assert"));
24833
- var import_starknet18 = require("starknet");
25956
+ var import_starknet19 = require("starknet");
24834
25957
  var import_fs2 = require("fs");
24835
25958
 
24836
25959
  // src/utils/store.ts
24837
25960
  var import_fs = __toESM(require("fs"));
24838
- var import_starknet17 = require("starknet");
25961
+ var import_starknet18 = require("starknet");
24839
25962
  var crypto2 = __toESM(require("crypto"));
24840
25963
 
24841
25964
  // src/utils/encrypt.ts
@@ -24929,7 +26052,7 @@ var Store = class _Store {
24929
26052
  }
24930
26053
  logger.verbose(`Account loaded: ${accountKey} from network: ${this.config.network}`);
24931
26054
  logger.verbose(`Address: ${data.address}`);
24932
- const acc = new import_starknet17.Account({
26055
+ const acc = new import_starknet18.Account({
24933
26056
  provider: this.config.provider,
24934
26057
  address: data.address,
24935
26058
  signer: data.pk,
@@ -25024,10 +26147,10 @@ function getAccount(accountKey, config, password = process.env.ACCOUNT_SECURE_PA
25024
26147
  }
25025
26148
  async function myDeclare(contract_name, package_name = "strkfarm", config, acc) {
25026
26149
  const provider2 = config.provider;
25027
- const compiledSierra = import_starknet18.json.parse(
26150
+ const compiledSierra = import_starknet19.json.parse(
25028
26151
  (0, import_fs2.readFileSync)(`./target/release/${package_name}_${contract_name}.contract_class.json`).toString("ascii")
25029
26152
  );
25030
- const compiledCasm = import_starknet18.json.parse(
26153
+ const compiledCasm = import_starknet19.json.parse(
25031
26154
  (0, import_fs2.readFileSync)(`./target/release/${package_name}_${contract_name}.compiled_contract_class.json`).toString("ascii")
25032
26155
  );
25033
26156
  const contracts = getContracts();
@@ -25035,7 +26158,7 @@ async function myDeclare(contract_name, package_name = "strkfarm", config, acc)
25035
26158
  contract: compiledSierra,
25036
26159
  casm: compiledCasm
25037
26160
  };
25038
- const result = (0, import_starknet18.extractContractHashes)(payload);
26161
+ const result = (0, import_starknet19.extractContractHashes)(payload);
25039
26162
  console.log("classhash:", result.classHash);
25040
26163
  try {
25041
26164
  const cls = await provider2.getClassByHash(result.classHash);
@@ -25053,7 +26176,7 @@ async function myDeclare(contract_name, package_name = "strkfarm", config, acc)
25053
26176
  const tx = await acc.declareIfNot(payload);
25054
26177
  console.log(`Declaring: ${contract_name}, tx:`, tx.transaction_hash);
25055
26178
  await provider2.waitForTransaction(tx.transaction_hash, {
25056
- successStates: [import_starknet18.TransactionExecutionStatus.SUCCEEDED]
26179
+ successStates: [import_starknet19.TransactionExecutionStatus.SUCCEEDED]
25057
26180
  });
25058
26181
  if (!contracts.class_hashes) {
25059
26182
  contracts["class_hashes"] = {};
@@ -25077,7 +26200,7 @@ async function deployContract(contract_name, classHash, constructorData, config,
25077
26200
  });
25078
26201
  console.log("Deploy tx: ", tx.transaction_hash);
25079
26202
  await provider2.waitForTransaction(tx.transaction_hash, {
25080
- successStates: [import_starknet18.TransactionExecutionStatus.SUCCEEDED]
26203
+ successStates: [import_starknet19.TransactionExecutionStatus.SUCCEEDED]
25081
26204
  });
25082
26205
  const contracts = getContracts();
25083
26206
  if (!contracts.contracts) {
@@ -25094,7 +26217,7 @@ async function prepareMultiDeployContracts(contracts, config, acc) {
25094
26217
  for (const { contract_name, package_name, constructorData } of contracts) {
25095
26218
  const declaredInfo = await myDeclare(contract_name, package_name, config, acc);
25096
26219
  const classHash = declaredInfo.class_hash;
25097
- const { calls, addresses } = new import_starknet18.Deployer().buildDeployerCall({
26220
+ const { calls, addresses } = new import_starknet19.Deployer().buildDeployerCall({
25098
26221
  classHash,
25099
26222
  constructorCalldata: constructorData
25100
26223
  }, acc.address);
@@ -25112,7 +26235,7 @@ async function prepareMultiDeployContracts(contracts, config, acc) {
25112
26235
  }
25113
26236
  async function executeDeployCalls(contractsInfo, acc, provider2) {
25114
26237
  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");
26238
+ (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
26239
  }
25117
26240
  const allCalls = contractsInfo.map((info) => info.call);
25118
26241
  await executeTransactions(allCalls, acc, provider2, `Deploying contracts: ${contractsInfo.map((info) => info.contract_name).join(", ")}`);
@@ -25136,7 +26259,7 @@ async function executeTransactions(calls, acc, provider2, remarks) {
25136
26259
  if (remarks)
25137
26260
  console.log(`Remarks: ${remarks}`);
25138
26261
  await provider2.waitForTransaction(tx.transaction_hash, {
25139
- successStates: [import_starknet18.TransactionExecutionStatus.SUCCEEDED]
26262
+ successStates: [import_starknet19.TransactionExecutionStatus.SUCCEEDED]
25140
26263
  });
25141
26264
  console.log(`Transaction confirmed: ${tx.transaction_hash}`);
25142
26265
  return tx;
@@ -25163,9 +26286,11 @@ var deployer_default = Deployer;
25163
26286
  ERC20,
25164
26287
  EkuboCLVault,
25165
26288
  EkuboCLVaultStrategies,
26289
+ EkuboQuoter,
25166
26290
  FatalError,
25167
26291
  FlowChartColors,
25168
26292
  Global,
26293
+ HyperLSTStrategies,
25169
26294
  ILending,
25170
26295
  Initializable,
25171
26296
  MarginType,
@@ -25184,6 +26309,7 @@ var deployer_default = Deployer;
25184
26309
  TelegramNotif,
25185
26310
  UNIVERSAL_ADAPTERS,
25186
26311
  UNIVERSAL_MANAGE_IDS,
26312
+ UniversalLstMultiplierStrategy,
25187
26313
  UniversalStrategies,
25188
26314
  UniversalStrategy,
25189
26315
  VesuAdapter,
@@ -25196,6 +26322,7 @@ var deployer_default = Deployer;
25196
26322
  ZkLend,
25197
26323
  assert,
25198
26324
  getAPIUsingHeadlessBrowser,
26325
+ getContractDetails,
25199
26326
  getDefaultStoreConfig,
25200
26327
  getMainnetConfig,
25201
26328
  getNoRiskTags,