@strkfarm/sdk 1.0.38 → 1.0.39

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/cli.js CHANGED
@@ -29,7 +29,7 @@ var import_inquirer = __toESM(require("inquirer"));
29
29
 
30
30
  // src/utils/store.ts
31
31
  var import_fs = __toESM(require("fs"));
32
- var import_starknet10 = require("starknet");
32
+ var import_starknet = require("starknet");
33
33
  var crypto2 = __toESM(require("crypto"));
34
34
 
35
35
  // src/utils/encrypt.ts
@@ -81,716 +81,42 @@ var PasswordJsonCryptoUtil = class {
81
81
  }
82
82
  };
83
83
 
84
- // src/modules/pricer.ts
85
- var import_axios2 = __toESM(require("axios"));
86
-
87
- // src/global.ts
88
- var import_axios = __toESM(require("axios"));
89
-
90
- // src/dataTypes/bignumber.node.ts
91
- var import_util = __toESM(require("util"));
92
-
93
- // src/dataTypes/_bignumber.ts
94
- var import_bignumber = __toESM(require("bignumber.js"));
95
- var _Web3Number = class extends import_bignumber.default {
96
- constructor(value, decimals) {
97
- super(value);
98
- this.decimals = decimals;
99
- }
100
- toWei() {
101
- return this.mul(10 ** this.decimals).toFixed(0);
102
- }
103
- multipliedBy(value) {
104
- const _value = this.getStandardString(value);
105
- return this.construct(this.mul(_value).toString(), this.decimals);
106
- }
107
- dividedBy(value) {
108
- const _value = this.getStandardString(value);
109
- return this.construct(this.div(_value).toString(), this.decimals);
110
- }
111
- plus(value) {
112
- const _value = this.getStandardString(value);
113
- return this.construct(this.add(_value).toString(), this.decimals);
114
- }
115
- minus(n, base) {
116
- const _value = this.getStandardString(n);
117
- return this.construct(super.minus(_value, base).toString(), this.decimals);
118
- }
119
- construct(value, decimals) {
120
- return new this.constructor(value, decimals);
121
- }
122
- toString(decimals = this.maxToFixedDecimals()) {
123
- return super.toFixed(decimals);
124
- }
125
- toJSON() {
126
- return this.toString();
127
- }
128
- valueOf() {
129
- return this.toString();
130
- }
131
- maxToFixedDecimals() {
132
- return Math.min(this.decimals, 18);
133
- }
134
- getStandardString(value) {
135
- if (typeof value == "string") {
136
- return value;
137
- }
138
- return value.toFixed(this.maxToFixedDecimals());
139
- }
140
- };
141
- import_bignumber.default.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
142
- _Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
143
-
144
- // src/dataTypes/bignumber.node.ts
145
- var Web3Number = class _Web3Number2 extends _Web3Number {
146
- static fromWei(weiNumber, decimals) {
147
- const bn = new _Web3Number2(weiNumber, decimals).dividedBy(10 ** decimals);
148
- return new _Web3Number2(bn.toString(), decimals);
149
- }
150
- [import_util.default.inspect.custom](depth, opts) {
151
- return this.toString();
152
- }
153
- [Symbol.for("nodejs.util.inspect.custom")](depth, inspectOptions, inspect) {
154
- return this.toString();
155
- }
156
- inspect(depth, opts) {
157
- return this.toString();
158
- }
159
- };
160
-
161
- // src/dataTypes/address.ts
162
- var import_starknet = require("starknet");
163
- var ContractAddr = class _ContractAddr {
164
- constructor(address) {
165
- this.address = _ContractAddr.standardise(address);
166
- }
167
- static from(address) {
168
- return new _ContractAddr(address);
169
- }
170
- eq(other) {
171
- return this.address === other.address;
172
- }
173
- eqString(other) {
174
- return this.address === _ContractAddr.standardise(other);
175
- }
176
- static standardise(address) {
177
- let _a = address;
178
- if (!address) {
179
- _a = "0";
180
- }
181
- const a = import_starknet.num.getHexString(import_starknet.num.getDecimalString(_a.toString()));
182
- return a;
183
- }
184
- static eqString(a, b) {
185
- return _ContractAddr.standardise(a) === _ContractAddr.standardise(b);
186
- }
187
- toString() {
188
- return this.address;
189
- }
190
- };
191
-
192
- // src/global.ts
193
- var logger = {
194
- ...console,
195
- verbose(message) {
196
- console.log(`[VERBOSE] ${message}`);
197
- }
198
- };
199
- var FatalError = class extends Error {
200
- constructor(message, err) {
201
- super(message);
202
- logger.error(message);
203
- if (err)
204
- logger.error(err.message);
205
- this.name = "FatalError";
206
- }
207
- };
208
- var defaultTokens = [{
209
- name: "Starknet",
210
- symbol: "STRK",
211
- logo: "https://assets.strkfarm.com/integrations/tokens/strk.svg",
212
- address: ContractAddr.from("0x4718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"),
213
- decimals: 18,
214
- coingeckId: "starknet",
215
- displayDecimals: 2
216
- }, {
217
- name: "xSTRK",
218
- symbol: "xSTRK",
219
- logo: "https://assets.strkfarm.com/integrations/tokens/xstrk.svg",
220
- address: ContractAddr.from("0x028d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a"),
221
- decimals: 18,
222
- coingeckId: void 0,
223
- displayDecimals: 2
224
- }, {
225
- name: "ETH",
226
- symbol: "ETH",
227
- logo: "https://assets.strkfarm.com/integrations/tokens/eth.svg",
228
- address: ContractAddr.from("0x49d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"),
229
- decimals: 18,
230
- coingeckId: void 0,
231
- displayDecimals: 4
232
- }, {
233
- name: "USDC",
234
- symbol: "USDC",
235
- logo: "https://assets.strkfarm.com/integrations/tokens/usdc.svg",
236
- address: ContractAddr.from("0x53c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8"),
237
- decimals: 6,
238
- coingeckId: void 0,
239
- displayDecimals: 2
240
- }, {
241
- name: "USDT",
242
- symbol: "USDT",
243
- logo: "https://assets.strkfarm.com/integrations/tokens/usdt.svg",
244
- address: ContractAddr.from("0x68f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8"),
245
- decimals: 6,
246
- coingeckId: void 0,
247
- displayDecimals: 2
248
- }, {
249
- name: "WBTC",
250
- symbol: "WBTC",
251
- logo: "https://assets.strkfarm.com/integrations/tokens/wbtc.svg",
252
- address: ContractAddr.from("0x3fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac"),
253
- decimals: 8,
254
- coingeckId: void 0,
255
- displayDecimals: 6
256
- }];
257
- var tokens = defaultTokens;
258
- var Global = class _Global {
259
- static fatalError(message, err) {
260
- logger.error(message);
261
- console.error(message, err);
262
- if (err)
263
- console.error(err);
264
- process.exit(1);
265
- }
266
- static httpError(url, err, message) {
267
- logger.error(`${url}: ${message}`);
268
- console.error(err);
269
- }
270
- static getDefaultTokens() {
271
- return tokens;
272
- }
273
- static async getTokens() {
274
- if (tokens.length) return tokens;
275
- const data = await import_axios.default.get("https://assets.strkfarm.com/integrations/tokens.json");
276
- const tokensData = data.data.content;
277
- tokensData.forEach((token) => {
278
- if (!token.tags.includes("AVNU") || !token.tags.includes("Verified")) {
279
- return;
280
- }
281
- tokens.push({
282
- name: token.name,
283
- symbol: token.symbol,
284
- address: ContractAddr.from(token.address),
285
- decimals: token.decimals,
286
- logo: token.logoUri,
287
- coingeckId: token.extensions.coingeckoId,
288
- displayDecimals: 2
289
- });
290
- });
291
- console.log(tokens);
292
- return tokens;
293
- }
294
- static assert(condition, message) {
295
- if (!condition) {
296
- throw new FatalError(message);
297
- }
298
- }
299
- static async getTokenInfoFromAddr(addr) {
300
- if (tokens.length == defaultTokens.length) {
301
- await _Global.getTokens();
302
- }
303
- const token = tokens.find((token2) => addr.eq(token2.address));
304
- if (!token) {
305
- throw new FatalError(`Token not found: ${addr.address}`);
306
- }
307
- return token;
308
- }
309
- };
310
-
311
- // src/modules/pragma.ts
312
- var import_starknet2 = require("starknet");
313
-
314
- // src/modules/zkLend.ts
315
- var import_axios3 = __toESM(require("axios"));
316
-
317
- // src/dataTypes/bignumber.browser.ts
318
- var Web3Number2 = class _Web3Number2 extends _Web3Number {
319
- static fromWei(weiNumber, decimals) {
320
- const bn = new _Web3Number2(weiNumber, decimals).dividedBy(10 ** decimals);
321
- return new _Web3Number2(bn.toString(), decimals);
322
- }
323
- };
324
-
325
- // src/interfaces/lending.ts
326
- var ILending = class {
327
- constructor(config, metadata) {
328
- this.tokens = [];
329
- this.initialised = false;
330
- this.metadata = metadata;
331
- this.config = config;
332
- this.init();
333
- }
334
- /** Wait for initialisation */
335
- waitForInitilisation() {
336
- return new Promise((resolve, reject) => {
337
- const interval = setInterval(() => {
338
- logger.verbose(`Waiting for ${this.metadata.name} to initialise`);
339
- if (this.initialised) {
340
- logger.verbose(`${this.metadata.name} initialised`);
341
- clearInterval(interval);
342
- resolve();
343
- }
344
- }, 1e3);
345
- });
346
- }
347
- };
348
-
349
- // src/modules/zkLend.ts
350
- var _ZkLend = class _ZkLend extends ILending {
351
- constructor(config, pricer) {
352
- super(config, {
353
- name: "zkLend",
354
- logo: "https://app.zklend.com/favicon.ico"
355
- });
356
- this.POSITION_URL = "https://app.zklend.com/api/users/{{USER_ADDR}}/all";
357
- this.pricer = pricer;
358
- }
359
- async init() {
360
- try {
361
- logger.verbose(`Initialising ${this.metadata.name}`);
362
- const result = await import_axios3.default.get(_ZkLend.POOLS_URL);
363
- const data = result.data;
364
- const savedTokens = await Global.getTokens();
365
- data.forEach((pool) => {
366
- let collareralFactor = new Web3Number2(0, 0);
367
- if (pool.collateral_factor) {
368
- collareralFactor = Web3Number2.fromWei(pool.collateral_factor.value, pool.collateral_factor.decimals);
369
- }
370
- const savedTokenInfo = savedTokens.find((t) => t.symbol == pool.token.symbol);
371
- const token = {
372
- name: pool.token.name,
373
- symbol: pool.token.symbol,
374
- address: savedTokenInfo?.address || ContractAddr.from(""),
375
- logo: "",
376
- decimals: pool.token.decimals,
377
- borrowFactor: Web3Number2.fromWei(pool.borrow_factor.value, pool.borrow_factor.decimals),
378
- collareralFactor,
379
- displayDecimals: 2
380
- };
381
- this.tokens.push(token);
382
- });
383
- logger.info(`Initialised ${this.metadata.name} with ${this.tokens.length} tokens`);
384
- this.initialised = true;
385
- } catch (error) {
386
- return Global.httpError(_ZkLend.POOLS_URL, error);
387
- }
388
- }
389
- /**
390
- * @description Get the health factor of the user for given lending and debt tokens
391
- * @param lending_tokens
392
- * @param debt_tokens
393
- * @param user
394
- * @returns hf (e.g. returns 1.5 for 150% health factor)
395
- */
396
- async get_health_factor_tokenwise(lending_tokens, debt_tokens, user) {
397
- const positions = await this.getPositions(user);
398
- logger.verbose(`${this.metadata.name}:: Positions: ${JSON.stringify(positions)}`);
399
- let effectiveDebt = new Web3Number2(0, 6);
400
- positions.filter((pos) => {
401
- return debt_tokens.find((t) => t.symbol === pos.tokenSymbol);
402
- }).forEach((pos) => {
403
- const token = this.tokens.find((t) => t.symbol === pos.tokenSymbol);
404
- if (!token) {
405
- throw new FatalError(`Token ${pos.tokenName} not found in ${this.metadata.name}`);
406
- }
407
- effectiveDebt = effectiveDebt.plus(pos.debtUSD.dividedBy(token.borrowFactor.toFixed(6)).toString());
408
- });
409
- logger.verbose(`${this.metadata.name}:: Effective debt: ${effectiveDebt}`);
410
- if (effectiveDebt.isZero()) {
411
- return Infinity;
412
- }
413
- let effectiveCollateral = new Web3Number2(0, 6);
414
- positions.filter((pos) => {
415
- const exp1 = lending_tokens.find((t) => t.symbol === pos.tokenSymbol);
416
- const exp2 = pos.marginType === "shared" /* SHARED */;
417
- return exp1 && exp2;
418
- }).forEach((pos) => {
419
- const token = this.tokens.find((t) => t.symbol === pos.tokenSymbol);
420
- if (!token) {
421
- throw new FatalError(`Token ${pos.tokenName} not found in ${this.metadata.name}`);
422
- }
423
- logger.verbose(`${this.metadata.name}:: Token: ${pos.tokenName}, Collateral factor: ${token.collareralFactor.toFixed(6)}`);
424
- effectiveCollateral = effectiveCollateral.plus(pos.supplyUSD.multipliedBy(token.collareralFactor.toFixed(6)).toString());
425
- });
426
- logger.verbose(`${this.metadata.name}:: Effective collateral: ${effectiveCollateral}`);
427
- const healthFactor = effectiveCollateral.dividedBy(effectiveDebt.toFixed(6)).toNumber();
428
- logger.verbose(`${this.metadata.name}:: Health factor: ${healthFactor}`);
429
- return healthFactor;
430
- }
431
- /**
432
- * @description Get the health factor of the user
433
- * - Considers all tokens for collateral and debt
434
- */
435
- async get_health_factor(user) {
436
- return this.get_health_factor_tokenwise(this.tokens, this.tokens, user);
437
- }
438
- async getPositionsSummary(user) {
439
- const pos = await this.getPositions(user);
440
- const collateralUSD = pos.reduce((acc, p) => acc + p.supplyUSD.toNumber(), 0);
441
- const debtUSD = pos.reduce((acc, p) => acc + p.debtUSD.toNumber(), 0);
442
- return {
443
- collateralUSD,
444
- debtUSD
445
- };
446
- }
447
- /**
448
- * @description Get the token-wise collateral and debt positions of the user
449
- * @param user Contract address of the user
450
- * @returns Promise<ILendingPosition[]>
451
- */
452
- async getPositions(user) {
453
- const url = this.POSITION_URL.replace("{{USER_ADDR}}", user.address);
454
- const result = await import_axios3.default.get(url);
455
- const data = result.data;
456
- const lendingPosition = [];
457
- logger.verbose(`${this.metadata.name}:: Positions: ${JSON.stringify(data)}`);
458
- for (let i = 0; i < data.pools.length; i++) {
459
- const pool = data.pools[i];
460
- const token = this.tokens.find((t) => {
461
- return t.symbol === pool.token_symbol;
462
- });
463
- if (!token) {
464
- throw new FatalError(`Token ${pool.token_symbol} not found in ${this.metadata.name}`);
465
- }
466
- const debtAmount = Web3Number2.fromWei(pool.data.debt_amount, token.decimals);
467
- const supplyAmount = Web3Number2.fromWei(pool.data.supply_amount, token.decimals);
468
- const price = (await this.pricer.getPrice(token.symbol)).price;
469
- lendingPosition.push({
470
- tokenName: token.name,
471
- tokenSymbol: token.symbol,
472
- marginType: pool.data.is_collateral ? "shared" /* SHARED */ : "none" /* NONE */,
473
- debtAmount,
474
- debtUSD: debtAmount.multipliedBy(price.toFixed(6)),
475
- supplyAmount,
476
- supplyUSD: supplyAmount.multipliedBy(price.toFixed(6))
477
- });
478
- }
479
- ;
480
- return lendingPosition;
481
- }
482
- };
483
- _ZkLend.POOLS_URL = "https://app.zklend.com/api/pools";
484
- var ZkLend = _ZkLend;
485
-
486
- // src/modules/pricer-from-api.ts
487
- var import_axios4 = __toESM(require("axios"));
488
-
489
- // src/modules/erc20.ts
490
- var import_starknet3 = require("starknet");
491
-
492
- // src/modules/avnu.ts
493
- var import_starknet4 = require("starknet");
494
- var import_avnu_sdk = require("@avnu/avnu-sdk");
495
-
496
- // src/interfaces/common.ts
497
- var import_starknet5 = require("starknet");
498
- var RiskType = /* @__PURE__ */ ((RiskType2) => {
499
- RiskType2["MARKET_RISK"] = "Market Risk";
500
- RiskType2["IMPERMANENT_LOSS"] = "Impermanent Loss Risk";
501
- RiskType2["LIQUIDATION_RISK"] = "Liquidation Risk";
502
- RiskType2["LOW_LIQUIDITY_RISK"] = "Low Liquidity Risk";
503
- RiskType2["SMART_CONTRACT_RISK"] = "Smart Contract Risk";
504
- RiskType2["ORACLE_RISK"] = "Oracle Risk";
505
- RiskType2["TECHNICAL_RISK"] = "Technical Risk";
506
- RiskType2["COUNTERPARTY_RISK"] = "Counterparty Risk";
507
- return RiskType2;
508
- })(RiskType || {});
509
- var getNoRiskTags = (risks) => {
510
- const noRisks1 = risks.filter((risk) => risk.value === 0).map((risk) => risk.type);
511
- const noRisks2 = Object.values(RiskType).filter(
512
- (risk) => !risks.map((risk2) => risk2.type).includes(risk)
513
- );
514
- const mergedUnique = [.../* @__PURE__ */ new Set([...noRisks1, ...noRisks2])];
515
- return mergedUnique.map((risk) => `No ${risk}`);
516
- };
517
-
518
- // src/strategies/autoCompounderStrk.ts
519
- var import_starknet6 = require("starknet");
520
-
521
- // src/strategies/vesu-rebalance.tsx
522
- var import_starknet8 = require("starknet");
523
-
524
- // src/node/headless.browser.ts
525
- var import_axios5 = __toESM(require("axios"));
526
-
527
- // src/modules/harvests.ts
528
- var import_starknet7 = require("starknet");
529
-
530
- // src/strategies/vesu-rebalance.tsx
531
- var import_jsx_runtime = require("react/jsx-runtime");
532
- var _description = "Automatically diversify {{TOKEN}} holdings into different Vesu pools while reducing risk and maximizing yield. Defi spring STRK Rewards are auto-compounded as well.";
533
- var _protocol = {
534
- name: "Vesu",
535
- logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
536
- };
537
- var _riskFactor = [
538
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25 },
539
- { type: "Counterparty Risk" /* COUNTERPARTY_RISK */, value: 1, weight: 50 },
540
- { type: "Oracle Risk" /* ORACLE_RISK */, value: 0.5, weight: 25 }
541
- ];
542
- var AUDIT_URL = "https://assets.strkfarm.com/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
543
- var faqs = [
544
- {
545
- question: "What is the Vesu Rebalancing Strategy?",
546
- answer: "The Vesu Rebalancing Strategy is an automated investment strategy that diversifies your holdings across multiple Vesu pools. It optimizes yield by rebalancing assets based on pool performance while adhering to risk constraints."
547
- },
548
- {
549
- question: "Will I earn Vesu points?",
550
- answer: "Yes, of course! You will earn Vesu points for your deposits."
551
- },
552
- {
553
- question: "How does the strategy optimize yield?",
554
- answer: "The strategy calculates the weighted average APY across all pools and reallocates assets to maximize returns. It prioritizes high-performing pools while ensuring compliance with maximum weight constraints."
555
- },
556
- {
557
- question: "What are the risks associated with this strategy?",
558
- answer: "The strategy involves usual DeFi risks such as smart contract vulnerabilities, counterparty risks, and oracle inaccuracies. However, we try our best to reduce these risks through audits and careful pool selection."
559
- },
560
- {
561
- question: "How are fees calculated and deducted?",
562
- answer: "Fees are calculated based on the performance of the strategy and deducted proportionally from the total assets. We charge a 10% performance fee and is already accounted in the APY shown."
563
- },
564
- {
565
- question: "What happens if a pool exceeds its maximum weight?",
566
- answer: "If a pool exceeds its maximum weight, the strategy rebalances by withdrawing excess funds and reallocating them to other pools with available capacity."
567
- },
568
- {
569
- question: "Can I withdraw my assets at any time?",
570
- answer: "Yes, you can withdraw your assets at any time. In rare circumstances, if debt utilisation is high for certain pools on Vesu, it may not be possible to withdraw until markets restore balance."
571
- },
572
- {
573
- question: "What happens to my Defi Spring STRK rewards?",
574
- answer: "STRK rewards are automatically harvested and reinvested into the strategy every week to maximize compounding returns."
575
- },
576
- {
577
- question: "Is the strategy audited?",
578
- answer: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
579
- "Yes, the strategy has been audited. You can review the audit report in our docs ",
580
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: "https://docs.strkfarm.com/p/strategies/vesu-fusion-rebalancing-vaults#technical-details", style: { textDecoration: "underline", marginLeft: "5px" }, children: "Here" }),
581
- "."
582
- ] })
583
- }
584
- ];
585
- var VesuRebalanceStrategies = [
586
- {
587
- name: "Vesu Fusion STRK",
588
- description: _description.replace("{{TOKEN}}", "STRK"),
589
- address: ContractAddr.from(
590
- "0x7fb5bcb8525954a60fde4e8fb8220477696ce7117ef264775a1770e23571929"
591
- ),
592
- type: "ERC4626",
593
- depositTokens: [
594
- Global.getDefaultTokens().find((t) => t.symbol === "STRK")
595
- ],
596
- protocols: [_protocol],
597
- auditUrl: AUDIT_URL,
598
- maxTVL: Web3Number.fromWei("0", 18),
599
- risk: {
600
- riskFactor: _riskFactor,
601
- netRisk: _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
602
- notARisks: getNoRiskTags(_riskFactor)
603
- },
604
- additionalInfo: {
605
- feeBps: 1e3
606
- },
607
- faqs
608
- },
609
- {
610
- name: "Vesu Fusion ETH",
611
- description: _description.replace("{{TOKEN}}", "ETH"),
612
- address: ContractAddr.from(
613
- "0x5eaf5ee75231cecf79921ff8ded4b5ffe96be718bcb3daf206690ad1a9ad0ca"
614
- ),
615
- type: "ERC4626",
616
- auditUrl: AUDIT_URL,
617
- depositTokens: [
618
- Global.getDefaultTokens().find((t) => t.symbol === "ETH")
619
- ],
620
- protocols: [_protocol],
621
- maxTVL: Web3Number.fromWei("0", 18),
622
- risk: {
623
- riskFactor: _riskFactor,
624
- netRisk: _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
625
- notARisks: getNoRiskTags(_riskFactor)
626
- },
627
- additionalInfo: {
628
- feeBps: 1e3
629
- },
630
- faqs
631
- },
632
- {
633
- name: "Vesu Fusion USDC",
634
- description: _description.replace("{{TOKEN}}", "USDC"),
635
- address: ContractAddr.from(
636
- "0xa858c97e9454f407d1bd7c57472fc8d8d8449a777c822b41d18e387816f29c"
637
- ),
638
- type: "ERC4626",
639
- auditUrl: AUDIT_URL,
640
- depositTokens: [
641
- Global.getDefaultTokens().find((t) => t.symbol === "USDC")
642
- ],
643
- protocols: [_protocol],
644
- maxTVL: Web3Number.fromWei("0", 6),
645
- risk: {
646
- riskFactor: _riskFactor,
647
- netRisk: _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
648
- notARisks: getNoRiskTags(_riskFactor)
649
- },
650
- additionalInfo: {
651
- feeBps: 1e3
652
- },
653
- faqs
654
- },
655
- {
656
- name: "Vesu Fusion USDT",
657
- description: _description.replace("{{TOKEN}}", "USDT"),
658
- address: ContractAddr.from(
659
- "0x115e94e722cfc4c77a2f15c4aefb0928c1c0029e5a57570df24c650cb7cec2c"
660
- ),
661
- type: "ERC4626",
662
- depositTokens: [
663
- Global.getDefaultTokens().find((t) => t.symbol === "USDT")
664
- ],
665
- auditUrl: AUDIT_URL,
666
- protocols: [_protocol],
667
- maxTVL: Web3Number.fromWei("0", 6),
668
- risk: {
669
- riskFactor: _riskFactor,
670
- netRisk: _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
671
- notARisks: getNoRiskTags(_riskFactor)
672
- },
673
- additionalInfo: {
674
- feeBps: 1e3
675
- },
676
- faqs
677
- // }, {
678
- // name: 'Vesu Fusion WBTC',
679
- // description: _description.replace('{{TOKEN}}', 'WBTC'),
680
- // address: ContractAddr.from('0x778007f8136a5b827325d21613803e796bda4d676fbe1e34aeab0b2a2ec027f'),
681
- // type: 'ERC4626',
682
- // depositTokens: [Global.getDefaultTokens().find(t => t.symbol === 'WBTC')!],
683
- // auditUrl: AUDIT_URL,
684
- // protocols: [_protocol],
685
- // maxTVL: Web3Number.fromWei('0', 8),
686
- // risk: {
687
- // riskFactor: _riskFactor,
688
- // netRisk: _riskFactor.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor.reduce((acc, curr) => acc + curr.weight, 0),
689
- // },
690
- // additionalInfo: {
691
- // feeBps: 1000,
692
- // },
693
- }
694
- ];
695
-
696
- // src/strategies/ekubo-cl-vault.tsx
697
- var import_starknet9 = require("starknet");
698
- var import_jsx_runtime2 = require("react/jsx-runtime");
699
- var _description2 = "Deploys your {{POOL_NAME}} into an Ekubo liquidity pool, automatically rebalancing positions around the current price to optimize yield and reduce the need for manual adjustments. Trading fees and DeFi Spring rewards are automatically compounded back into the strategy. In return, you receive an ERC-20 token representing your share of the strategy. The APY is calculated based on 7-day historical performance.";
700
- var _protocol2 = {
701
- name: "Ekubo",
702
- logo: "https://app.ekubo.org/favicon.ico"
84
+ // src/utils/logger.node.ts
85
+ var import_winston = __toESM(require("winston"));
86
+ var colors = {
87
+ error: "red",
88
+ warn: "yellow",
89
+ info: "blue",
90
+ verbose: "white",
91
+ debug: "white"
703
92
  };
704
- var _riskFactor2 = [
705
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25 },
706
- { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 1, weight: 75 }
707
- ];
708
- var AUDIT_URL2 = "https://assets.strkfarm.com/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
709
- var faqs2 = [
710
- {
711
- question: "What is the Ekubo CL Vault strategy?",
712
- answer: "The Ekubo CL Vault strategy deploys your assets into an Ekubo liquidity pool, automatically rebalancing positions around the current price to optimize yield and reduce manual adjustments."
713
- },
714
- {
715
- question: "How are trading fees and rewards handled?",
716
- answer: "Trading fees and DeFi Spring rewards are automatically compounded back into the strategy, increasing your overall returns."
717
- },
718
- {
719
- question: "What happens during withdrawal?",
720
- answer: "During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices."
721
- },
722
- {
723
- question: "Is the strategy audited?",
724
- answer: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
725
- "Yes, the strategy has been audited. You can review the audit report in our docs ",
726
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("a", { href: "https://docs.strkfarm.com/p/ekubo-cl-vaults#technical-details", style: { textDecoration: "underline", marginLeft: "5px" }, children: "Here" }),
727
- "."
728
- ] })
729
- }
730
- ];
731
- var EkuboCLVaultStrategies = [
732
- {
733
- name: "Ekubo xSTRK/STRK",
734
- description: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { children: [
735
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: _description2.replace("{{POOL_NAME}}", "xSTRK/STRK") }),
736
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
737
- "ul",
738
- {
739
- style: {
740
- marginLeft: "20px",
741
- listStyle: "circle",
742
- fontSize: "12px"
743
- },
744
- children: [
745
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { style: { marginTop: "10px" }, children: "During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices." }),
746
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { style: { marginTop: "10px" }, children: "Sometimes you might see a negative APY \u2014 this is usually not a big deal. It happens when xSTRK's price drops on DEXes, but things typically bounce back within a few days or a week." })
747
- ]
93
+ import_winston.default.addColors(colors);
94
+ var logger = import_winston.default.createLogger({
95
+ level: "verbose",
96
+ // Set the minimum logging level
97
+ format: import_winston.format.combine(
98
+ import_winston.format.colorize({ all: true }),
99
+ // Apply custom colors
100
+ import_winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
101
+ // Add timestamp to log messages
102
+ import_winston.format.printf(({ timestamp, level, message, ...meta }) => {
103
+ let msg = `${timestamp} ${level}: ${message}`;
104
+ if (meta && meta[Symbol.for("splat")]) {
105
+ for (const arg of meta[Symbol.for("splat")]) {
106
+ if (arg instanceof Error) {
107
+ msg += `
108
+ ${arg.stack}`;
109
+ }
748
110
  }
749
- )
750
- ] }),
751
- address: ContractAddr.from(
752
- "0x01f083b98674bc21effee29ef443a00c7b9a500fd92cf30341a3da12c73f2324"
753
- ),
754
- type: "Other",
755
- // must be same order as poolKey token0 and token1
756
- depositTokens: [
757
- Global.getDefaultTokens().find((t) => t.symbol === "xSTRK"),
758
- Global.getDefaultTokens().find((t) => t.symbol === "STRK")
759
- ],
760
- protocols: [_protocol2],
761
- auditUrl: AUDIT_URL2,
762
- maxTVL: Web3Number.fromWei("0", 18),
763
- risk: {
764
- riskFactor: _riskFactor2,
765
- netRisk: _riskFactor2.reduce((acc, curr) => acc + curr.value * curr.weight, 0) / _riskFactor2.reduce((acc, curr) => acc + curr.weight, 0),
766
- notARisks: getNoRiskTags(_riskFactor2)
767
- },
768
- apyMethodology: "APY based on 7-day historical performance, including fees and rewards.",
769
- additionalInfo: {
770
- newBounds: {
771
- lower: -1,
772
- upper: 1
773
- },
774
- lstContract: ContractAddr.from(
775
- "0x028d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a"
776
- ),
777
- feeBps: 1e3
778
- },
779
- faqs: [
780
- ...faqs2,
781
- {
782
- question: "Why might I see a negative APY?",
783
- answer: "A negative APY can occur when xSTRK's price drops on DEXes. This is usually temporary and tends to recover within a few days or a week."
784
111
  }
785
- ]
786
- }
787
- ];
788
-
789
- // src/notifs/telegram.ts
790
- var import_node_telegram_bot_api = __toESM(require("node-telegram-bot-api"));
791
-
792
- // src/node/pricer-redis.ts
793
- var import_redis = require("redis");
112
+ return msg;
113
+ })
114
+ ),
115
+ transports: [
116
+ new import_winston.default.transports.Console()
117
+ // Output logs to the console
118
+ ]
119
+ });
794
120
 
795
121
  // src/utils/store.ts
796
122
  function getDefaultStoreConfig(network) {
@@ -825,7 +151,7 @@ var Store = class _Store {
825
151
  logger.warn(`This not stored anywhere, please you backup this password for future use`);
826
152
  logger.warn(`\u26A0\uFE0F=========================================\u26A0\uFE0F`);
827
153
  }
828
- getAccount(accountKey, txVersion = import_starknet10.constants.TRANSACTION_VERSION.V2) {
154
+ getAccount(accountKey, txVersion = import_starknet.constants.TRANSACTION_VERSION.V2) {
829
155
  const accounts = this.loadAccounts();
830
156
  logger.verbose(`nAccounts loaded for network: ${Object.keys(accounts).length}`);
831
157
  const data = accounts[accountKey];
@@ -834,7 +160,7 @@ var Store = class _Store {
834
160
  }
835
161
  logger.verbose(`Account loaded: ${accountKey} from network: ${this.config.network}`);
836
162
  logger.verbose(`Address: ${data.address}`);
837
- const acc = new import_starknet10.Account(this.config.provider, data.address, data.pk, void 0, txVersion);
163
+ const acc = new import_starknet.Account(this.config.provider, data.address, data.pk, void 0, txVersion);
838
164
  return acc;
839
165
  }
840
166
  addAccount(accountKey, address, pk) {
@@ -898,11 +224,11 @@ var Store = class _Store {
898
224
 
899
225
  // src/cli.ts
900
226
  var import_chalk = __toESM(require("chalk"));
901
- var import_starknet11 = require("starknet");
227
+ var import_starknet2 = require("starknet");
902
228
  var program = new import_commander.Command();
903
229
  var getConfig = (network) => {
904
230
  return {
905
- provider: new import_starknet11.RpcProvider({
231
+ provider: new import_starknet2.RpcProvider({
906
232
  nodeUrl: "https://starknet-mainnet.public.blastapi.io"
907
233
  }),
908
234
  network,