@strkfarm/sdk 1.0.62 → 1.0.64

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.mjs CHANGED
@@ -213,7 +213,7 @@ var defaultTokens = [{
213
213
  name: "WBTC",
214
214
  symbol: "WBTC",
215
215
  logo: "https://assets.troves.fi/integrations/tokens/wbtc.svg",
216
- address: ContractAddr.from("0x3fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac"),
216
+ address: ContractAddr.from("0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac"),
217
217
  decimals: 8,
218
218
  coingeckId: void 0,
219
219
  displayDecimals: 6,
@@ -229,6 +229,26 @@ var defaultTokens = [{
229
229
  displayDecimals: 6,
230
230
  priceCheckAmount: 1e-4
231
231
  // 112000 * 0.0001 = $11.2
232
+ }, {
233
+ name: "solvBTC",
234
+ symbol: "solvBTC",
235
+ logo: "https://assets.strkfarm.com/integrations/tokens/solvbtc.svg",
236
+ address: ContractAddr.from("0x0593e034dda23eea82d2ba9a30960ed42cf4a01502cc2351dc9b9881f9931a68"),
237
+ decimals: 18,
238
+ coingeckId: void 0,
239
+ displayDecimals: 6,
240
+ priceCheckAmount: 1e-4
241
+ // 112000 * 0.0001 = $11.2
242
+ }, {
243
+ name: "LBTC",
244
+ symbol: "LBTC",
245
+ logo: "https://assets.strkfarm.com/integrations/tokens/lbtc.svg",
246
+ address: ContractAddr.from("0x036834a40984312f7f7de8d31e3f6305b325389eaeea5b1c0664b2fb936461a4"),
247
+ decimals: 8,
248
+ coingeckId: void 0,
249
+ displayDecimals: 6,
250
+ priceCheckAmount: 1e-4
251
+ // 112000 * 0.0001 = $11.2
232
252
  }];
233
253
  var tokens = defaultTokens;
234
254
  var _Global = class _Global {
@@ -3890,11 +3910,12 @@ var EkuboHarvests = class extends Harvests {
3890
3910
  return rewards.sort((a, b) => b.endDate.getTime() - a.endDate.getTime());
3891
3911
  }
3892
3912
  };
3913
+ var VESU_REWARDS_CONTRACT = ContractAddr.from("0x0387f3eb1d98632fbe3440a9f1385Aec9d87b6172491d3Dd81f1c35A7c61048F");
3893
3914
  var VesuHarvests = class _VesuHarvests extends Harvests {
3894
3915
  async getHarvests(addr) {
3895
3916
  const result = await fetch(`https://api.vesu.xyz/users/${addr.address}/strk-rewards/calldata`);
3896
3917
  const data = await result.json();
3897
- const rewardsContract = ContractAddr.from("0x0387f3eb1d98632fbe3440a9f1385Aec9d87b6172491d3Dd81f1c35A7c61048F");
3918
+ const rewardsContract = VESU_REWARDS_CONTRACT;
3898
3919
  const cls = await this.config.provider.getClassAt(rewardsContract.address);
3899
3920
  const contract = new Contract4(cls.abi, rewardsContract.address, this.config.provider);
3900
3921
  const _claimed_amount = await contract.call("amount_already_claimed", [addr.address]);
@@ -16259,14 +16280,31 @@ var _protocol2 = {
16259
16280
  name: "Ekubo",
16260
16281
  logo: "https://app.ekubo.org/favicon.ico"
16261
16282
  };
16262
- var _riskFactor2 = [
16263
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 34, reason: "Audited smart contracts" },
16264
- { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 0.75, weight: 33, reason: "Low risk due to co-related assets" },
16265
- { type: "Market Risk" /* MARKET_RISK */, value: 0.75, weight: 33, reason: "Low risk due to co-related assets" }
16283
+ var _corelatedPoolRiskFactors = [
16284
+ { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
16285
+ { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 1 /* HIGHLY_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
16286
+ { type: "Market Risk" /* MARKET_RISK */, value: 1 /* VERY_LOW_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
16287
+ ];
16288
+ var mediumVolatilityPoolRiskFactors = [
16289
+ { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
16290
+ { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
16291
+ { type: "Market Risk" /* MARKET_RISK */, value: 3 /* MODERATE_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
16266
16292
  ];
16267
- var _riskFactorStable = [
16268
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25 }
16293
+ var highVolatilityPoolRiskFactors = [
16294
+ { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 2 /* WELL_AUDITED */, weight: 34, reason: "Audited smart contracts" },
16295
+ { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 3 /* NON_CORRELATED */, weight: 33, reason: "Low risk due to co-related assets" },
16296
+ { type: "Market Risk" /* MARKET_RISK */, value: 4 /* HIGH_VOLATILITY */, weight: 33, reason: "Low risk due to co-related assets" }
16269
16297
  ];
16298
+ var mediumRisk = {
16299
+ riskFactor: mediumVolatilityPoolRiskFactors,
16300
+ netRisk: mediumVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / mediumVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
16301
+ notARisks: getNoRiskTags(mediumVolatilityPoolRiskFactors)
16302
+ };
16303
+ var highRisk = {
16304
+ riskFactor: highVolatilityPoolRiskFactors,
16305
+ netRisk: highVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / highVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
16306
+ notARisks: getNoRiskTags(highVolatilityPoolRiskFactors)
16307
+ };
16270
16308
  var AUDIT_URL2 = "https://assets.troves.fi/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
16271
16309
  var faqs2 = [
16272
16310
  {
@@ -16281,6 +16319,10 @@ var faqs2 = [
16281
16319
  question: "What happens during withdrawal?",
16282
16320
  answer: "During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices."
16283
16321
  },
16322
+ {
16323
+ question: "Are there any deposit/withdrawal fees?",
16324
+ answer: "No, there are no deposit/withdrawal fees. However, there is a performance fee varying between 10-20% of the fees and rewards generated. The exact fee is determined by the strategy and the APY shown is net of this fee."
16325
+ },
16284
16326
  {
16285
16327
  question: "Is the strategy audited?",
16286
16328
  answer: /* @__PURE__ */ jsxs2("div", { children: [
@@ -16315,9 +16357,9 @@ var xSTRKSTRK = {
16315
16357
  auditUrl: AUDIT_URL2,
16316
16358
  maxTVL: Web3Number.fromWei("0", 18),
16317
16359
  risk: {
16318
- riskFactor: _riskFactor2,
16319
- netRisk: _riskFactor2.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor2.reduce((acc, curr) => acc + curr.weight, 0),
16320
- notARisks: getNoRiskTags(_riskFactor2)
16360
+ riskFactor: _corelatedPoolRiskFactors,
16361
+ netRisk: _corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
16362
+ notARisks: getNoRiskTags(_corelatedPoolRiskFactors)
16321
16363
  },
16322
16364
  apyMethodology: "APY based on 7-day historical performance, including fees and rewards.",
16323
16365
  additionalInfo: {
@@ -16333,7 +16375,8 @@ var xSTRKSTRK = {
16333
16375
  customShouldRebalance: async (currentPrice) => true,
16334
16376
  minWaitHours: 24,
16335
16377
  direction: "uponly"
16336
- }
16378
+ },
16379
+ quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "STRK")
16337
16380
  },
16338
16381
  faqs: [
16339
16382
  ...faqs2,
@@ -16350,68 +16393,165 @@ var xSTRKSTRK = {
16350
16393
  contractDetails: [],
16351
16394
  investmentSteps: []
16352
16395
  };
16353
- var EkuboCLVaultStrategies = [
16354
- xSTRKSTRK,
16396
+ var ETHUSDCRe7Strategy = {
16397
+ ...xSTRKSTRK,
16398
+ name: "Ekubo ETH/USDC",
16399
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16400
+ address: ContractAddr.from(
16401
+ "0x160d8fa4569ef6a12e6bf47cb943d7b5ebba8a41a69a14c1d943050ba5ff947"
16402
+ ),
16403
+ launchBlock: 1501761,
16404
+ // must be same order as poolKey token0 and token1
16405
+ depositTokens: [
16406
+ Global.getDefaultTokens().find((t) => t.symbol === "ETH"),
16407
+ Global.getDefaultTokens().find((t) => t.symbol === "USDC")
16408
+ ],
16409
+ additionalInfo: {
16410
+ newBounds: "Managed by Re7",
16411
+ truePrice: 1,
16412
+ feeBps: 1e3,
16413
+ rebalanceConditions: {
16414
+ customShouldRebalance: async (currentPrice) => currentPrice > 0.99 && currentPrice < 1.01,
16415
+ minWaitHours: 6,
16416
+ direction: "any"
16417
+ },
16418
+ quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "USDC")
16419
+ },
16420
+ faqs: [
16421
+ ...faqs2,
16422
+ {
16423
+ question: "Who is the curator of this strategy?",
16424
+ answer: /* @__PURE__ */ jsxs2("div", { children: [
16425
+ "Re7 Labs is the curator of this strategy. Re7 Labs is a well-known Web3 asset management firm. This strategy is completely managed by them, including ownership of the vault. Troves is developer of the smart contracts and maintains infrastructure to help users access these strategies. You can find more information about them on their website ",
16426
+ /* @__PURE__ */ jsx3("a", { href: "https://www.re7labs.xyz", style: { textDecoration: "underline", marginLeft: "2px" }, target: "_blank", children: "here" }),
16427
+ "."
16428
+ ] })
16429
+ }
16430
+ ],
16431
+ risk: highRisk,
16432
+ points: [],
16433
+ curator: { name: "Re7 Labs", logo: "https://www.re7labs.xyz/favicon.ico" }
16434
+ };
16435
+ var RE7Strategies = [
16436
+ ETHUSDCRe7Strategy,
16355
16437
  {
16356
- ...xSTRKSTRK,
16438
+ ...ETHUSDCRe7Strategy,
16357
16439
  name: "Ekubo USDC/USDT",
16358
16440
  description: /* @__PURE__ */ jsx3(Fragment2, {}),
16359
16441
  address: ContractAddr.from(
16360
- "0xd647ed735f0db52f2a5502b6e06ed21dc4284a43a36af4b60d3c80fbc56c91"
16442
+ "0x3a4f8debaf12af97bb911099bc011d63d6c208d4c5ba8e15d7f437785b0aaa2"
16361
16443
  ),
16362
- launchBlock: 1385576,
16444
+ launchBlock: 1501761,
16363
16445
  // must be same order as poolKey token0 and token1
16364
16446
  depositTokens: [
16365
16447
  Global.getDefaultTokens().find((t) => t.symbol === "USDC"),
16366
16448
  Global.getDefaultTokens().find((t) => t.symbol === "USDT")
16367
16449
  ],
16368
- additionalInfo: {
16369
- newBounds: {
16370
- lower: -1,
16371
- upper: 1
16372
- },
16373
- truePrice: 1,
16374
- feeBps: 1e3,
16375
- rebalanceConditions: {
16376
- customShouldRebalance: async (currentPrice) => currentPrice > 0.99 && currentPrice < 1.01,
16377
- minWaitHours: 6,
16378
- direction: "any"
16379
- }
16380
- }
16450
+ risk: xSTRKSTRK.risk
16381
16451
  },
16382
16452
  {
16383
- ...xSTRKSTRK,
16453
+ ...ETHUSDCRe7Strategy,
16384
16454
  name: "Ekubo STRK/USDC",
16385
16455
  description: /* @__PURE__ */ jsx3(Fragment2, {}),
16386
16456
  address: ContractAddr.from(
16387
- "0xb7bd37121041261446d8eedec618955a4490641034942da688e8cbddea7b23"
16457
+ "0x351b36d0d9d8b40010658825adeeddb1397436cd41acd0ff6c6e23aaa8b5b30"
16388
16458
  ),
16389
- launchBlock: 1492136,
16459
+ launchBlock: 1501762,
16390
16460
  // must be same order as poolKey token0 and token1
16391
16461
  depositTokens: [
16392
16462
  Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
16393
16463
  Global.getDefaultTokens().find((t) => t.symbol === "USDC")
16394
16464
  ],
16395
- maxTVL: Web3Number.fromWei("0", 6),
16396
- additionalInfo: {
16397
- newBounds: "Managed by Re7",
16398
- feeBps: 1e3,
16399
- rebalanceConditions: {
16400
- customShouldRebalance: async (currentPrice) => true,
16401
- minWaitHours: 6,
16402
- direction: "any"
16403
- }
16404
- }
16465
+ risk: highRisk
16466
+ },
16467
+ {
16468
+ ...ETHUSDCRe7Strategy,
16469
+ name: "Ekubo STRK/ETH",
16470
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16471
+ address: ContractAddr.from(
16472
+ "0x4ce3024b0ee879009112d7b0e073f8a87153dd35b029347d4247ffe48d28f51"
16473
+ ),
16474
+ launchBlock: 1501763,
16475
+ // must be same order as poolKey token0 and token1
16476
+ depositTokens: [
16477
+ Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
16478
+ Global.getDefaultTokens().find((t) => t.symbol === "ETH")
16479
+ ],
16480
+ risk: highRisk
16481
+ },
16482
+ {
16483
+ ...ETHUSDCRe7Strategy,
16484
+ name: "Ekubo WBTC/USDC",
16485
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16486
+ address: ContractAddr.from(
16487
+ "0x2bcaef2eb7706875a5fdc6853dd961a0590f850bc3a031c59887189b5e84ba1"
16488
+ ),
16489
+ launchBlock: 1501764,
16490
+ // must be same order as poolKey token0 and token1
16491
+ depositTokens: [
16492
+ Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
16493
+ Global.getDefaultTokens().find((t) => t.symbol === "USDC")
16494
+ ],
16495
+ risk: mediumRisk
16496
+ },
16497
+ {
16498
+ ...ETHUSDCRe7Strategy,
16499
+ name: "Ekubo tBTC/USDC",
16500
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16501
+ address: ContractAddr.from(
16502
+ "0x4aad891a2d4432fba06b6558631bb13f6bbd7f6f33ab8c3111e344889ea4456"
16503
+ ),
16504
+ launchBlock: 1501764,
16505
+ // must be same order as poolKey token0 and token1
16506
+ depositTokens: [
16507
+ Global.getDefaultTokens().find((t) => t.symbol === "tBTC"),
16508
+ Global.getDefaultTokens().find((t) => t.symbol === "USDC")
16509
+ ],
16510
+ risk: mediumRisk
16511
+ },
16512
+ {
16513
+ ...ETHUSDCRe7Strategy,
16514
+ name: "Ekubo WBTC/ETH",
16515
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16516
+ address: ContractAddr.from(
16517
+ "0x1c9232b8186d9317652f05055615f18a120c2ad9e5ee96c39e031c257fb945b"
16518
+ ),
16519
+ launchBlock: 1501765,
16520
+ // must be same order as poolKey token0 and token1
16521
+ depositTokens: [
16522
+ Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
16523
+ Global.getDefaultTokens().find((t) => t.symbol === "ETH")
16524
+ ],
16525
+ risk: mediumRisk
16526
+ },
16527
+ {
16528
+ ...ETHUSDCRe7Strategy,
16529
+ name: "Ekubo WBTC/STRK",
16530
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16531
+ address: ContractAddr.from(
16532
+ "0x1248e385c23a929a015ec298a26560fa7745bbd6e41a886550e337b02714b1b"
16533
+ ),
16534
+ launchBlock: 1501766,
16535
+ // must be same order as poolKey token0 and token1
16536
+ depositTokens: [
16537
+ Global.getDefaultTokens().find((t) => t.symbol === "WBTC"),
16538
+ Global.getDefaultTokens().find((t) => t.symbol === "STRK")
16539
+ ],
16540
+ risk: highRisk
16405
16541
  }
16406
16542
  ];
16543
+ var EkuboCLVaultStrategies = [
16544
+ xSTRKSTRK,
16545
+ ...RE7Strategies
16546
+ ];
16407
16547
  EkuboCLVaultStrategies.forEach((s) => {
16408
16548
  s.contractDetails = [
16409
16549
  {
16410
16550
  address: s.address,
16411
16551
  name: "Vault",
16412
16552
  sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/tree/main/src/strategies/cl_vault"
16413
- },
16414
- ...COMMON_CONTRACTS
16553
+ }
16554
+ // ...COMMON_CONTRACTS
16415
16555
  ];
16416
16556
  s.docs = "https://docs.troves.fi/p/ekubo-cl-vaults";
16417
16557
  s.description = /* @__PURE__ */ jsxs2("div", { children: [
@@ -18382,7 +18522,7 @@ var endurProtocol = {
18382
18522
  name: "Endur",
18383
18523
  logo: "https://app.endur.fi/logo.png"
18384
18524
  };
18385
- var _riskFactor3 = [
18525
+ var _riskFactor2 = [
18386
18526
  { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25, reason: "Audited by CSC" },
18387
18527
  { type: "Depeg Risk" /* DEPEG_RISK */, value: 0.25, weight: 25, reason: "Depending on prevailing market conditions and trading activity, xSTRK may lose its peg to the underlying asset." },
18388
18528
  { type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 0.1, weight: 10, reason: "Liquidation risk is low due to the nature of the Re7 Pool on Vesu" },
@@ -18457,9 +18597,9 @@ var SenseiStrategies = [
18457
18597
  protocols: [endurProtocol, vesuProtocol],
18458
18598
  maxTVL: new Web3Number("1500000", 18),
18459
18599
  risk: {
18460
- riskFactor: _riskFactor3,
18461
- netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
18462
- notARisks: getNoRiskTags(_riskFactor3)
18600
+ riskFactor: _riskFactor2,
18601
+ netRisk: _riskFactor2.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor2.reduce((acc, curr) => acc + curr.weight, 0),
18602
+ notARisks: getNoRiskTags(_riskFactor2)
18463
18603
  },
18464
18604
  additionalInfo: {
18465
18605
  mainToken: Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
@@ -18486,7 +18626,9 @@ var SenseiStrategies = [
18486
18626
  import { hash, num as num6, shortString } from "starknet";
18487
18627
 
18488
18628
  // src/strategies/universal-adapters/adapter-utils.ts
18489
- var SIMPLE_SANITIZER = ContractAddr.from("0x3798dc4f83fdfad199e5236e3656cf2fb79bc50c00504d0dd41522e0f042072");
18629
+ var SIMPLE_SANITIZER = ContractAddr.from("0x5a2e3ceb3da368b983a8717898427ab7b6daf04014b70f321e777f9aad940b4");
18630
+ var PRICE_ROUTER = ContractAddr.from("0x05e83Fa38D791d2dba8E6f487758A9687FfEe191A6Cf8a6c5761ab0a110DB837");
18631
+ var AVNU_MIDDLEWARE = ContractAddr.from("0x4a7972ed3f5d1e74a6d6c4a8f467666953d081c8f2270390cc169d50d17cb0d");
18490
18632
  function toBigInt(value) {
18491
18633
  if (typeof value === "string") {
18492
18634
  return BigInt(value);
@@ -18519,7 +18661,7 @@ var BaseAdapter = class extends CacheClass {
18519
18661
  };
18520
18662
 
18521
18663
  // src/strategies/universal-adapters/common-adapter.ts
18522
- import { hash as hash2, uint256 as uint2566 } from "starknet";
18664
+ import { hash as hash2, num as num7, uint256 as uint2566 } from "starknet";
18523
18665
  var CommonAdapter = class extends BaseAdapter {
18524
18666
  constructor(config) {
18525
18667
  super();
@@ -18630,10 +18772,70 @@ var CommonAdapter = class extends BaseAdapter {
18630
18772
  };
18631
18773
  };
18632
18774
  }
18775
+ getAvnuAdapter(fromToken, toToken, id) {
18776
+ return () => ({
18777
+ leaf: this.constructSimpleLeafData({
18778
+ id,
18779
+ target: AVNU_MIDDLEWARE,
18780
+ method: "multi_route_swap",
18781
+ packedArguments: [
18782
+ fromToken.toBigInt(),
18783
+ toToken.toBigInt(),
18784
+ this.config.vaultAllocator.toBigInt()
18785
+ ]
18786
+ }),
18787
+ callConstructor: this.getAvnuCall(fromToken, toToken).bind(this)
18788
+ });
18789
+ }
18790
+ getAvnuCall(fromToken, toToken) {
18791
+ return (params) => {
18792
+ return {
18793
+ sanitizer: SIMPLE_SANITIZER,
18794
+ call: {
18795
+ contractAddress: AVNU_MIDDLEWARE,
18796
+ selector: hash2.getSelectorFromName("multi_route_swap"),
18797
+ calldata: [
18798
+ fromToken.toBigInt(),
18799
+ // sell_token_address
18800
+ toBigInt(params.props.token_from_amount.low.toString()),
18801
+ // sell_token_amount low
18802
+ toBigInt(params.props.token_from_amount.high.toString()),
18803
+ // sell_token_amount high
18804
+ toToken.toBigInt(),
18805
+ // buy_token_address
18806
+ toBigInt(params.props.token_to_amount.low.toString()),
18807
+ // buy_token_amount low
18808
+ toBigInt(params.props.token_to_amount.high.toString()),
18809
+ // buy_token_amount high
18810
+ toBigInt(params.props.token_to_min_amount.low.toString()),
18811
+ // buy_token_min_amount low
18812
+ toBigInt(params.props.token_to_min_amount.high.toString()),
18813
+ // buy_token_min_amount high
18814
+ this.config.vaultAllocator.toBigInt(),
18815
+ // beneficiary
18816
+ toBigInt(0),
18817
+ // integrator_fee_amount_bps
18818
+ this.config.vaultAllocator.toBigInt(),
18819
+ // integrator_fee_recipient
18820
+ // unpack routes
18821
+ BigInt(params.props.routes.length),
18822
+ ...params.props.routes.map((r) => [
18823
+ BigInt(num7.hexToDecimalString(r.token_from)),
18824
+ BigInt(num7.hexToDecimalString(r.token_to)),
18825
+ BigInt(num7.hexToDecimalString(r.exchange_address)),
18826
+ BigInt(r.percent),
18827
+ BigInt(r.additional_swap_params.length),
18828
+ ...r.additional_swap_params.map((p) => BigInt(num7.hexToDecimalString(p)))
18829
+ ]).flat()
18830
+ ]
18831
+ }
18832
+ };
18833
+ };
18834
+ }
18633
18835
  };
18634
18836
 
18635
18837
  // src/strategies/universal-adapters/vesu-adapter.ts
18636
- import { CairoCustomEnum as CairoCustomEnum2, Contract as Contract8, hash as hash3, RpcProvider as RpcProvider4, uint256 as uint2567 } from "starknet";
18838
+ import { CairoCustomEnum as CairoCustomEnum2, Contract as Contract8, hash as hash3, num as num8, RpcProvider as RpcProvider4, shortString as shortString3, uint256 as uint2567 } from "starknet";
18637
18839
 
18638
18840
  // src/data/vesu-singleton.abi.json
18639
18841
  var vesu_singleton_abi_default = [
@@ -20966,6 +21168,40 @@ var VesuAdapter = class _VesuAdapter extends BaseAdapter {
20966
21168
  }
20967
21169
  };
20968
21170
  };
21171
+ this.getDefispringRewardsAdapter = (id) => {
21172
+ return () => {
21173
+ const packedArguments = [];
21174
+ const output = {
21175
+ id: BigInt(num8.getDecimalString(shortString3.encodeShortString(id))),
21176
+ readableId: id,
21177
+ data: [
21178
+ SIMPLE_SANITIZER.toBigInt(),
21179
+ // sanitizer address
21180
+ VESU_REWARDS_CONTRACT.toBigInt(),
21181
+ // contract
21182
+ toBigInt(hash3.getSelectorFromName("claim")),
21183
+ // method name
21184
+ BigInt(packedArguments.length),
21185
+ ...packedArguments
21186
+ ]
21187
+ };
21188
+ return { leaf: output, callConstructor: this.getDefiSpringClaimCall().bind(this) };
21189
+ };
21190
+ };
21191
+ this.getDefiSpringClaimCall = () => {
21192
+ return (params) => ({
21193
+ sanitizer: SIMPLE_SANITIZER,
21194
+ call: {
21195
+ contractAddress: VESU_REWARDS_CONTRACT,
21196
+ selector: hash3.getSelectorFromName("claim"),
21197
+ calldata: [
21198
+ BigInt(params.amount.toWei()),
21199
+ BigInt(params.proofs.length),
21200
+ ...params.proofs.map((proof) => BigInt(num8.hexToDecimalString(proof)))
21201
+ ]
21202
+ }
21203
+ });
21204
+ };
20969
21205
  this.config = config;
20970
21206
  }
20971
21207
  static getDefaultModifyPositionCallParams(params) {
@@ -23595,7 +23831,7 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
23595
23831
  const aumToken = vesuAum.plus(balance.amount);
23596
23832
  logger.verbose(`${this.getTag()} Actual AUM: ${aumToken}`);
23597
23833
  const netAPY = await this.netAPY();
23598
- const defispringAPY = netAPY.splits.find((s) => s.id === "defispring")?.apy || 0;
23834
+ const defispringAPY = (netAPY.splits.find((s) => s.id === "defispring")?.apy || 0) * 0.8;
23599
23835
  if (!defispringAPY) throw new Error("DefiSpring APY not found");
23600
23836
  const timeDiff = Math.round(Date.now() / 1e3) - Number(lastReportTime);
23601
23837
  const growthRate = timeDiff * defispringAPY / (365 * 24 * 60 * 60);
@@ -23838,6 +24074,51 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
23838
24074
  const manageCall = this.getManageCall(["approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */, "bring_liquidity" /* BRING_LIQUIDITY */], [manageCall1, manageCall2]);
23839
24075
  return manageCall;
23840
24076
  }
24077
+ async getHarvestCall() {
24078
+ const vesuHarvest = new VesuHarvests(this.config);
24079
+ const harvestInfo = await vesuHarvest.getUnHarvestedRewards(this.metadata.additionalInfo.vaultAllocator);
24080
+ if (harvestInfo.length != 1) {
24081
+ throw new Error(`Expected 1 harvest info, got ${harvestInfo.length}`);
24082
+ }
24083
+ const amount = harvestInfo[0].claim.amount;
24084
+ const actualReward = harvestInfo[0].actualReward;
24085
+ const proofs = harvestInfo[0].proof;
24086
+ if (actualReward.isZero()) {
24087
+ throw new Error(`Expected non-zero actual reward, got ${harvestInfo[0].actualReward}`);
24088
+ }
24089
+ const manage1Info = this.getProofs("defispring_rewards" /* DEFISPRING_REWARDS */);
24090
+ const manageCall1 = manage1Info.callConstructor({
24091
+ amount,
24092
+ proofs
24093
+ });
24094
+ const proofIds = ["defispring_rewards" /* DEFISPRING_REWARDS */];
24095
+ const manageCalls = [manageCall1];
24096
+ const STRK2 = Global.getDefaultTokens().find((t) => t.symbol === "STRK");
24097
+ if (this.asset().symbol != "STRK") {
24098
+ const manage2Info = this.getProofs("approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */);
24099
+ const manageCall2 = manage2Info.callConstructor({
24100
+ amount: actualReward
24101
+ });
24102
+ const avnuModule = new AvnuWrapper();
24103
+ const quote = await avnuModule.getQuotes(
24104
+ STRK2.address.address,
24105
+ this.asset().address.address,
24106
+ actualReward.toWei(),
24107
+ this.address.address
24108
+ );
24109
+ const swapInfo = await avnuModule.getSwapInfo(quote, this.address.address, 0, this.address.address);
24110
+ const manage3Info = this.getProofs("avnu_swap_rewards" /* AVNU_SWAP_REWARDS */);
24111
+ const manageCall3 = manage3Info.callConstructor({
24112
+ props: swapInfo
24113
+ });
24114
+ proofIds.push("approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */);
24115
+ proofIds.push("avnu_swap_rewards" /* AVNU_SWAP_REWARDS */);
24116
+ manageCalls.push(manageCall2);
24117
+ manageCalls.push(manageCall3);
24118
+ }
24119
+ const manageCall = this.getManageCall(proofIds, manageCalls);
24120
+ return { call: manageCall, reward: actualReward, tokenInfo: STRK2 };
24121
+ }
23841
24122
  async getRebalanceCall(params) {
23842
24123
  let callSet1 = this.getVesuModifyPositionCalls({
23843
24124
  isLeg1: true,
@@ -23874,6 +24155,9 @@ var UNIVERSAL_MANAGE_IDS = /* @__PURE__ */ ((UNIVERSAL_MANAGE_IDS2) => {
23874
24155
  UNIVERSAL_MANAGE_IDS2["APPROVE_TOKEN2"] = "approve_token2";
23875
24156
  UNIVERSAL_MANAGE_IDS2["APPROVE_BRING_LIQUIDITY"] = "approve_bring_liquidity";
23876
24157
  UNIVERSAL_MANAGE_IDS2["BRING_LIQUIDITY"] = "bring_liquidity";
24158
+ UNIVERSAL_MANAGE_IDS2["DEFISPRING_REWARDS"] = "defispring_rewards";
24159
+ UNIVERSAL_MANAGE_IDS2["APPROVE_SWAP_TOKEN1"] = "approve_swap_token1";
24160
+ UNIVERSAL_MANAGE_IDS2["AVNU_SWAP_REWARDS"] = "avnu_swap_rewards";
23877
24161
  return UNIVERSAL_MANAGE_IDS2;
23878
24162
  })(UNIVERSAL_MANAGE_IDS || {});
23879
24163
  var UNIVERSAL_ADAPTERS = /* @__PURE__ */ ((UNIVERSAL_ADAPTERS2) => {
@@ -23923,9 +24207,13 @@ function getLooperSettings(token1Symbol, token2Symbol, vaultSettings, pool1, poo
23923
24207
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(ETHToken.address, vesuAdapterETHUSDC.VESU_SINGLETON, "approve_token2" /* APPROVE_TOKEN2 */).bind(commonAdapter));
23924
24208
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(USDCToken.address, vaultSettings.vaultAddress, "approve_bring_liquidity" /* APPROVE_BRING_LIQUIDITY */).bind(commonAdapter));
23925
24209
  vaultSettings.leafAdapters.push(commonAdapter.getBringLiquidityAdapter("bring_liquidity" /* BRING_LIQUIDITY */).bind(commonAdapter));
24210
+ vaultSettings.leafAdapters.push(vesuAdapterUSDCETH.getDefispringRewardsAdapter("defispring_rewards" /* DEFISPRING_REWARDS */).bind(vesuAdapterUSDCETH));
24211
+ const STRKToken = Global.getDefaultTokens().find((token) => token.symbol === "STRK");
24212
+ vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(STRKToken.address, AVNU_MIDDLEWARE, "approve_swap_token1" /* APPROVE_SWAP_TOKEN1 */).bind(commonAdapter));
24213
+ vaultSettings.leafAdapters.push(commonAdapter.getAvnuAdapter(STRKToken.address, USDCToken.address, "avnu_swap_rewards" /* AVNU_SWAP_REWARDS */).bind(commonAdapter));
23926
24214
  return vaultSettings;
23927
24215
  }
23928
- var _riskFactor4 = [
24216
+ var _riskFactor3 = [
23929
24217
  { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25, reason: "Audited by Zellic" },
23930
24218
  { type: "Liquidation Risk" /* LIQUIDATION_RISK */, value: 1.5, weight: 50, reason: "Liquidation risk is mitigated by stable price feed on Starknet" },
23931
24219
  { type: "Technical Risk" /* TECHNICAL_RISK */, value: 1, weight: 50, reason: "Technical failures like risk monitoring failures" }
@@ -24129,9 +24417,9 @@ var UniversalStrategies = [
24129
24417
  depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "USDC")],
24130
24418
  additionalInfo: getLooperSettings("USDC", "ETH", usdcVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
24131
24419
  risk: {
24132
- riskFactor: _riskFactor4,
24133
- netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
24134
- notARisks: getNoRiskTags(_riskFactor4)
24420
+ riskFactor: _riskFactor3,
24421
+ netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
24422
+ notARisks: getNoRiskTags(_riskFactor3)
24135
24423
  },
24136
24424
  protocols: [Protocols.VESU],
24137
24425
  maxTVL: Web3Number.fromWei(0, 6),
@@ -24148,9 +24436,9 @@ var UniversalStrategies = [
24148
24436
  depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "WBTC")],
24149
24437
  additionalInfo: getLooperSettings("WBTC", "ETH", wbtcVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
24150
24438
  risk: {
24151
- riskFactor: _riskFactor4,
24152
- netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
24153
- notARisks: getNoRiskTags(_riskFactor4)
24439
+ riskFactor: _riskFactor3,
24440
+ netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
24441
+ notARisks: getNoRiskTags(_riskFactor3)
24154
24442
  },
24155
24443
  protocols: [Protocols.VESU],
24156
24444
  maxTVL: Web3Number.fromWei(0, 8),
@@ -24167,9 +24455,9 @@ var UniversalStrategies = [
24167
24455
  depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "ETH")],
24168
24456
  additionalInfo: getLooperSettings("ETH", "WBTC", ethVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
24169
24457
  risk: {
24170
- riskFactor: _riskFactor4,
24171
- netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
24172
- notARisks: getNoRiskTags(_riskFactor4)
24458
+ riskFactor: _riskFactor3,
24459
+ netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
24460
+ notARisks: getNoRiskTags(_riskFactor3)
24173
24461
  },
24174
24462
  protocols: [Protocols.VESU],
24175
24463
  maxTVL: Web3Number.fromWei(0, 18),
@@ -24186,9 +24474,9 @@ var UniversalStrategies = [
24186
24474
  depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "STRK")],
24187
24475
  additionalInfo: getLooperSettings("STRK", "ETH", strkVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
24188
24476
  risk: {
24189
- riskFactor: _riskFactor4,
24190
- netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
24191
- notARisks: getNoRiskTags(_riskFactor4)
24477
+ riskFactor: _riskFactor3,
24478
+ netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
24479
+ notARisks: getNoRiskTags(_riskFactor3)
24192
24480
  },
24193
24481
  protocols: [Protocols.VESU],
24194
24482
  maxTVL: Web3Number.fromWei(0, 18),
@@ -24205,9 +24493,9 @@ var UniversalStrategies = [
24205
24493
  depositTokens: [Global.getDefaultTokens().find((token) => token.symbol === "USDT")],
24206
24494
  additionalInfo: getLooperSettings("USDT", "ETH", usdtVaultSettings, VesuPools.Genesis, VesuPools.Genesis),
24207
24495
  risk: {
24208
- riskFactor: _riskFactor4,
24209
- netRisk: _riskFactor4.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor4.reduce((acc, curr) => acc + curr.weight, 0),
24210
- notARisks: getNoRiskTags(_riskFactor4)
24496
+ riskFactor: _riskFactor3,
24497
+ netRisk: _riskFactor3.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor3.reduce((acc, curr) => acc + curr.weight, 0),
24498
+ notARisks: getNoRiskTags(_riskFactor3)
24211
24499
  },
24212
24500
  protocols: [Protocols.VESU],
24213
24501
  maxTVL: Web3Number.fromWei(0, 6),
@@ -24223,11 +24511,9 @@ var TelegramNotif = class {
24223
24511
  constructor(token, shouldPoll) {
24224
24512
  this.subscribers = [
24225
24513
  // '6820228303',
24226
- "1505578076",
24227
- "1356705582",
24228
- // langs
24229
- "1388729514",
24230
- // hwashere
24514
+ // '1505578076',
24515
+ // '1356705582', // langs
24516
+ // '1388729514', // hwashere
24231
24517
  "985902592"
24232
24518
  ];
24233
24519
  this.bot = new TelegramBot(token, { polling: shouldPoll });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strkfarm/sdk",
3
- "version": "1.0.62",
3
+ "version": "1.0.64",
4
4
  "description": "STRKFarm TS SDK (Meant for our internal use, but feel free to use it)",
5
5
  "typings": "dist/index.d.ts",
6
6
  "types": "dist/index.d.ts",