@strkfarm/sdk 1.2.0 → 2.0.0-dev-strategy2.1

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.
Files changed (60) hide show
  1. package/dist/index.browser.global.js +76556 -66640
  2. package/dist/index.browser.mjs +34235 -24392
  3. package/dist/index.d.ts +2372 -793
  4. package/dist/index.js +31967 -22084
  5. package/dist/index.mjs +25545 -15719
  6. package/package.json +86 -76
  7. package/readme.md +56 -1
  8. package/src/data/extended-deposit.abi.json +3613 -0
  9. package/src/data/universal-vault.abi.json +135 -20
  10. package/src/dataTypes/_bignumber.ts +11 -0
  11. package/src/dataTypes/address.ts +7 -0
  12. package/src/global.ts +240 -193
  13. package/src/interfaces/common.tsx +26 -2
  14. package/src/modules/ExtendedWrapperSDk/index.ts +62 -0
  15. package/src/modules/ExtendedWrapperSDk/types.ts +311 -0
  16. package/src/modules/ExtendedWrapperSDk/wrapper.ts +448 -0
  17. package/src/modules/avnu.ts +17 -4
  18. package/src/modules/ekubo-quoter.ts +89 -10
  19. package/src/modules/erc20.ts +67 -21
  20. package/src/modules/harvests.ts +29 -43
  21. package/src/modules/index.ts +5 -1
  22. package/src/modules/lst-apr.ts +36 -0
  23. package/src/modules/midas.ts +159 -0
  24. package/src/modules/pricer-from-api.ts +2 -2
  25. package/src/modules/pricer-lst.ts +1 -1
  26. package/src/modules/pricer.ts +3 -38
  27. package/src/modules/token-market-data.ts +202 -0
  28. package/src/node/deployer.ts +1 -36
  29. package/src/strategies/autoCompounderStrk.ts +1 -1
  30. package/src/strategies/base-strategy.ts +20 -3
  31. package/src/strategies/btc-vesu-extended-strategy/core-strategy.tsx +1486 -0
  32. package/src/strategies/btc-vesu-extended-strategy/services/operationService.ts +32 -0
  33. package/src/strategies/btc-vesu-extended-strategy/utils/constants.ts +3 -0
  34. package/src/strategies/btc-vesu-extended-strategy/utils/helper.ts +396 -0
  35. package/src/strategies/btc-vesu-extended-strategy/utils/types.ts +5 -0
  36. package/src/strategies/ekubo-cl-vault.tsx +123 -306
  37. package/src/strategies/index.ts +7 -1
  38. package/src/strategies/svk-strategy.ts +247 -0
  39. package/src/strategies/universal-adapters/adapter-optimizer.ts +65 -0
  40. package/src/strategies/universal-adapters/adapter-utils.ts +5 -1
  41. package/src/strategies/universal-adapters/avnu-adapter.ts +432 -0
  42. package/src/strategies/universal-adapters/baseAdapter.ts +181 -153
  43. package/src/strategies/universal-adapters/common-adapter.ts +98 -77
  44. package/src/strategies/universal-adapters/extended-adapter.ts +976 -0
  45. package/src/strategies/universal-adapters/index.ts +7 -1
  46. package/src/strategies/universal-adapters/unused-balance-adapter.ts +109 -0
  47. package/src/strategies/universal-adapters/vesu-adapter.ts +230 -230
  48. package/src/strategies/universal-adapters/vesu-borrow-adapter.ts +1247 -0
  49. package/src/strategies/universal-adapters/vesu-multiply-adapter.ts +1306 -0
  50. package/src/strategies/universal-adapters/vesu-supply-only-adapter.ts +58 -51
  51. package/src/strategies/universal-lst-muliplier-strategy.tsx +716 -844
  52. package/src/strategies/universal-strategy.tsx +1103 -1181
  53. package/src/strategies/vesu-extended-strategy/services/operationService.ts +34 -0
  54. package/src/strategies/vesu-extended-strategy/types/transaction-metadata.ts +25 -0
  55. package/src/strategies/vesu-extended-strategy/utils/config.runtime.ts +77 -0
  56. package/src/strategies/vesu-extended-strategy/utils/constants.ts +50 -0
  57. package/src/strategies/vesu-extended-strategy/utils/helper.ts +367 -0
  58. package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +1420 -0
  59. package/src/strategies/vesu-rebalance.tsx +16 -20
  60. package/src/utils/health-factor-math.ts +11 -5
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import BigNumber from 'bignumber.js';
2
2
  import * as starknet from 'starknet';
3
- import { RpcProvider, BlockIdentifier, Contract, Uint256, Call, Account, CairoCustomEnum, RawArgs } from 'starknet';
3
+ import { Uint256, RpcProvider, BlockIdentifier, Contract, Call, Account, CairoCustomEnum, RawArgs } from 'starknet';
4
4
  import React, { ReactNode } from 'react';
5
- import { Quote, AvnuOptions } from '@avnu/avnu-sdk';
6
5
  import { HexString, BytesLike } from '@ericnordelo/strk-merkle-tree/dist/bytes';
7
6
  import { MultiProof } from '@ericnordelo/strk-merkle-tree/dist/core';
8
7
  import { MerkleTreeImpl, MerkleTreeData } from '@ericnordelo/strk-merkle-tree/dist/merkletree';
9
8
  import { MerkleTreeOptions } from '@ericnordelo/strk-merkle-tree/dist/options';
10
9
  import { ValueType } from '@ericnordelo/strk-merkle-tree/dist/serde';
10
+ import { Quote, AvnuOptions } from '@avnu/avnu-sdk';
11
11
  import TelegramBot from 'node-telegram-bot-api';
12
12
 
13
13
  declare class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
@@ -31,6 +31,10 @@ declare class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
31
31
  mag: bigint;
32
32
  sign: 0 | 1;
33
33
  };
34
+ toI257(): {
35
+ mag: Uint256;
36
+ sign: 0 | 1;
37
+ };
34
38
  }
35
39
 
36
40
  declare class Web3Number extends _Web3Number<Web3Number> {
@@ -51,6 +55,7 @@ declare class ContractAddr {
51
55
  static eqString(a: string, b: string): boolean;
52
56
  toString(): string;
53
57
  toBigInt(): bigint;
58
+ shortString(left?: number, right?: number): string;
54
59
  }
55
60
 
56
61
  declare enum RiskType {
@@ -169,11 +174,16 @@ interface VaultPosition {
169
174
  usdValue: number;
170
175
  token: TokenInfo;
171
176
  remarks: string;
177
+ protocol: IProtocol;
172
178
  }
173
179
  declare const Protocols: {
180
+ NONE: IProtocol;
174
181
  VESU: IProtocol;
175
182
  ENDUR: IProtocol;
176
183
  EXTENDED: IProtocol;
184
+ EKUBO: IProtocol;
185
+ AVNU: IProtocol;
186
+ VAULT: IProtocol;
177
187
  };
178
188
 
179
189
  interface ILendingMetadata {
@@ -228,13 +238,6 @@ declare abstract class Initializable {
228
238
  waitForInitilisation(): Promise<void>;
229
239
  }
230
240
 
231
- declare abstract class PricerBase {
232
- readonly config: IConfig;
233
- readonly tokens: TokenInfo[];
234
- constructor(config: IConfig, tokens: TokenInfo[]);
235
- getPrice(tokenSymbol: string): Promise<PriceInfo>;
236
- }
237
-
238
241
  interface PriceInfo {
239
242
  price: number;
240
243
  timestamp: Date;
@@ -246,7 +249,7 @@ declare class Pricer extends PricerBase {
246
249
  refreshInterval: number;
247
250
  staleTime: number;
248
251
  protected methodToUse: {
249
- [tokenSymbol: string]: 'Ekubo' | 'Coinbase' | 'Coinmarketcap' | 'Avnu';
252
+ [tokenSymbol: string]: 'Ekubo' | 'Coinbase' | 'Coinmarketcap';
250
253
  };
251
254
  /**
252
255
  * TOKENA and TOKENB are the two token names to get price of TokenA in terms of TokenB
@@ -264,130 +267,14 @@ declare class Pricer extends PricerBase {
264
267
  _getPrice(token: TokenInfo, defaultMethod?: string): Promise<number>;
265
268
  _getPriceCoinbase(token: TokenInfo): Promise<number>;
266
269
  _getPriceCoinMarketCap(token: TokenInfo): Promise<number>;
267
- _getAvnuPrice(token: TokenInfo, amountIn?: Web3Number, retry?: number): Promise<number>;
268
270
  _getPriceEkubo(token: TokenInfo, amountIn?: Web3Number, retry?: number): Promise<number>;
269
271
  }
270
272
 
271
- declare class Pragma {
272
- contractAddr: string;
273
- readonly contract: Contract;
274
- constructor(provider: RpcProvider);
275
- getPrice(tokenAddr: string): Promise<number>;
276
- }
277
-
278
- declare class ZkLend extends ILending implements ILending {
279
- readonly pricer: Pricer;
280
- static readonly POOLS_URL = "https://app.zklend.com/api/pools";
281
- private POSITION_URL;
282
- constructor(config: IConfig, pricer: Pricer);
283
- init(): Promise<void>;
284
- /**
285
- * @description Get the health factor of the user for given lending and debt tokens
286
- * @param lending_tokens
287
- * @param debt_tokens
288
- * @param user
289
- * @returns hf (e.g. returns 1.5 for 150% health factor)
290
- */
291
- get_health_factor_tokenwise(lending_tokens: TokenInfo[], debt_tokens: TokenInfo[], user: ContractAddr): Promise<number>;
292
- /**
293
- * @description Get the health factor of the user
294
- * - Considers all tokens for collateral and debt
295
- */
296
- get_health_factor(user: ContractAddr): Promise<number>;
297
- getPositionsSummary(user: ContractAddr): Promise<{
298
- collateralUSD: number;
299
- debtUSD: number;
300
- }>;
301
- /**
302
- * @description Get the token-wise collateral and debt positions of the user
303
- * @param user Contract address of the user
304
- * @returns Promise<ILendingPosition[]>
305
- */
306
- getPositions(user: ContractAddr): Promise<ILendingPosition[]>;
307
- }
308
-
309
- declare class PricerFromApi extends PricerBase {
273
+ declare abstract class PricerBase {
274
+ readonly config: IConfig;
275
+ readonly tokens: TokenInfo[];
310
276
  constructor(config: IConfig, tokens: TokenInfo[]);
311
277
  getPrice(tokenSymbol: string): Promise<PriceInfo>;
312
- getPriceFromMyAPI(tokenSymbol: string): Promise<{
313
- price: number;
314
- timestamp: Date;
315
- }>;
316
- }
317
-
318
- declare class ERC20 {
319
- readonly config: IConfig;
320
- constructor(config: IConfig);
321
- contract(addr: string | ContractAddr): Contract;
322
- balanceOf(token: string | ContractAddr, address: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
323
- allowance(token: string | ContractAddr, owner: string | ContractAddr, spender: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
324
- }
325
-
326
- interface Route {
327
- token_from: string;
328
- token_to: string;
329
- exchange_address: string;
330
- percent: number;
331
- additional_swap_params: string[];
332
- }
333
- interface SwapInfo {
334
- token_from_address: string;
335
- token_from_amount: Uint256;
336
- token_to_address: string;
337
- token_to_amount: Uint256;
338
- token_to_min_amount: Uint256;
339
- beneficiary: string;
340
- integrator_fee_amount_bps: number;
341
- integrator_fee_recipient: string;
342
- routes: Route[];
343
- }
344
- declare class AvnuWrapper {
345
- getQuotes(fromToken: string, toToken: string, amountWei: string, taker: string, retry?: number, excludeSources?: string[]): Promise<Quote>;
346
- getSwapInfo(quote: Pick<Quote, 'quoteId' | 'buyTokenAddress' | 'buyAmount' | 'sellTokenAddress' | 'sellAmount'>, taker: string, integratorFeeBps: number, integratorFeeRecipient: string, minAmount?: string, options?: AvnuOptions): Promise<SwapInfo>;
347
- static buildZeroSwap(tokenToSell: ContractAddr, beneficiary: string, tokenToBuy?: ContractAddr): SwapInfo;
348
- }
349
-
350
- declare class AutoCompounderSTRK {
351
- readonly config: IConfig;
352
- readonly addr: ContractAddr;
353
- readonly pricer: Pricer;
354
- private initialized;
355
- contract: Contract | null;
356
- readonly metadata: {
357
- decimals: number;
358
- underlying: {
359
- address: ContractAddr;
360
- name: string;
361
- symbol: string;
362
- };
363
- name: string;
364
- };
365
- constructor(config: IConfig, pricer: Pricer);
366
- init(): Promise<void>;
367
- waitForInitilisation(): Promise<void>;
368
- /** Returns shares of user */
369
- balanceOf(user: ContractAddr): Promise<Web3Number>;
370
- /** Returns underlying assets of user */
371
- balanceOfUnderlying(user: ContractAddr): Promise<Web3Number>;
372
- /** Returns usd value of assets */
373
- usdBalanceOfUnderlying(user: ContractAddr): Promise<{
374
- usd: Web3Number;
375
- assets: Web3Number;
376
- }>;
377
- }
378
-
379
- interface HarvestInfo {
380
- rewardsContract: ContractAddr;
381
- token: ContractAddr;
382
- startDate: Date;
383
- endDate: Date;
384
- claim: {
385
- id: number;
386
- amount: Web3Number;
387
- claimee: ContractAddr;
388
- };
389
- actualReward: Web3Number;
390
- proof: string[];
391
278
  }
392
279
 
393
280
  interface CacheData$1 {
@@ -402,251 +289,237 @@ declare class CacheClass {
402
289
  isCacheValid(key: string): boolean;
403
290
  }
404
291
 
405
- interface SingleActionAmount {
406
- tokenInfo: TokenInfo;
407
- amount: Web3Number;
408
- }
409
- interface SingleTokenInfo extends SingleActionAmount {
410
- usdValue: number;
292
+ interface LeveledLogMethod {
293
+ (message: string, ...meta: any[]): void;
294
+ (message: any): void;
411
295
  }
412
- interface DualActionAmount {
413
- token0: SingleActionAmount;
414
- token1: SingleActionAmount;
296
+ interface MyLogger {
297
+ error: LeveledLogMethod;
298
+ warn: LeveledLogMethod;
299
+ info: LeveledLogMethod;
300
+ verbose: LeveledLogMethod;
301
+ debug: LeveledLogMethod;
415
302
  }
416
- interface DualTokenInfo {
417
- usdValue: number;
418
- token0: SingleTokenInfo;
419
- token1: SingleTokenInfo;
303
+ declare const logger: MyLogger;
304
+
305
+ interface LeafData {
306
+ id: bigint;
307
+ readableId: string;
308
+ data: bigint[];
420
309
  }
421
- interface CacheData {
422
- timestamp: number;
423
- ttl: number;
424
- data: any;
310
+ interface StandardMerkleTreeData<T extends any> extends MerkleTreeData<T> {
311
+ format: 'standard-v1';
312
+ leafEncoding: ValueType[];
425
313
  }
426
- declare class BaseStrategy<TVLInfo, ActionInfo> extends CacheClass {
427
- readonly config: IConfig;
428
- readonly cache: Map<string, CacheData>;
429
- constructor(config: IConfig);
430
- getUserTVL(user: ContractAddr): Promise<TVLInfo>;
431
- getTVL(): Promise<TVLInfo>;
432
- depositCall(amountInfo: ActionInfo, receiver: ContractAddr): Promise<Call[]>;
433
- withdrawCall(amountInfo: ActionInfo, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
434
- getVaultPositions(): Promise<VaultPosition[]>;
435
- getPendingRewards(): Promise<HarvestInfo[]>;
314
+ declare class StandardMerkleTree extends MerkleTreeImpl<LeafData> {
315
+ protected readonly tree: HexString[];
316
+ protected readonly values: StandardMerkleTreeData<LeafData>['values'];
317
+ protected readonly leafEncoding: ValueType[];
318
+ protected constructor(tree: HexString[], values: StandardMerkleTreeData<LeafData>['values'], leafEncoding: ValueType[]);
319
+ static of(values: LeafData[], leafEncoding?: ValueType[], options?: MerkleTreeOptions): StandardMerkleTree;
320
+ static verify<T extends any[]>(root: BytesLike, leafEncoding: ValueType[], leaf: T, proof: BytesLike[]): boolean;
321
+ static verifyMultiProof<T extends any[]>(root: BytesLike, leafEncoding: ValueType[], multiproof: MultiProof<BytesLike, T>): boolean;
322
+ dump(): StandardMerkleTreeData<LeafData>;
436
323
  }
437
324
 
438
- interface PoolProps {
439
- pool_id: ContractAddr;
440
- max_weight: number;
441
- v_token: ContractAddr;
442
- }
443
- interface Change {
444
- pool_id: ContractAddr;
445
- changeAmt: Web3Number;
446
- finalAmt: Web3Number;
447
- isDeposit: boolean;
325
+ type RequiredFields<T> = {
326
+ [K in keyof T]-?: T[K];
327
+ };
328
+ type RequiredKeys<T> = {
329
+ [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
330
+ }[keyof T];
331
+ declare function assert(condition: boolean, message: string): void;
332
+ declare function getTrovesEndpoint(): string;
333
+
334
+ interface ManageCall {
335
+ sanitizer: ContractAddr;
336
+ call: {
337
+ contractAddress: ContractAddr;
338
+ selector: string;
339
+ calldata: bigint[];
340
+ };
448
341
  }
449
- interface VesuRebalanceSettings {
450
- feeBps: number;
342
+ interface DepositParams {
343
+ amount: Web3Number;
451
344
  }
452
- interface PoolInfoFull {
453
- pool_id: ContractAddr;
454
- pool_name: string | undefined;
455
- max_weight: number;
456
- current_weight: number;
457
- v_token: ContractAddr;
345
+ interface WithdrawParams {
458
346
  amount: Web3Number;
459
- usdValue: Web3Number;
460
- APY: {
461
- baseApy: number;
462
- defiSpringApy: number;
463
- netApy: number;
464
- };
465
- currentUtilization: number;
466
- maxUtilization: number;
467
347
  }
468
- /**
469
- * Represents a VesuRebalance strategy.
470
- * This class implements an automated rebalancing strategy for Vesu pools,
471
- * managing deposits and withdrawals while optimizing yield through STRK rewards.
472
- */
473
- declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
474
- /** Contract address of the strategy */
475
- readonly address: ContractAddr;
476
- /** Pricer instance for token price calculations */
477
- readonly pricer: PricerBase;
478
- /** Metadata containing strategy information */
479
- readonly metadata: IStrategyMetadata<VesuRebalanceSettings>;
480
- /** Contract instance for interacting with the strategy */
481
- readonly contract: Contract;
482
- readonly BASE_WEIGHT = 10000;
483
- /**
484
- * Creates a new VesuRebalance strategy instance.
485
- * @param config - Configuration object containing provider and other settings
486
- * @param pricer - Pricer instance for token price calculations
487
- * @param metadata - Strategy metadata including deposit tokens and address
488
- * @throws {Error} If more than one deposit token is specified
489
- */
490
- constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<VesuRebalanceSettings>);
491
- /**
492
- * Creates a deposit call to the strategy contract.
493
- * @param assets - Amount of assets to deposit
494
- * @param receiver - Address that will receive the strategy tokens
495
- * @returns Populated contract call for deposit
348
+ type GenerateCallFn<T> = (params: T) => Promise<ManageCall[]>;
349
+ type AdapterLeafType<T> = {
350
+ leaves: LeafData[];
351
+ callConstructor: GenerateCallFn<T>;
352
+ };
353
+ type LeafAdapterFn<T> = () => AdapterLeafType<T>;
354
+ declare enum APYType {
355
+ BASE = "base",
356
+ REWARD = "reward",
357
+ LST = "lst"
358
+ }
359
+ interface SupportedPosition {
360
+ asset: TokenInfo;
361
+ isDebt: boolean;
362
+ }
363
+ interface BaseAdapterConfig {
364
+ baseToken: TokenInfo;
365
+ supportedPositions: SupportedPosition[];
366
+ networkConfig: IConfig;
367
+ pricer: PricerBase;
368
+ vaultAllocator: ContractAddr;
369
+ vaultAddress: ContractAddr;
370
+ }
371
+ type PositionAPY = {
372
+ apy: number;
373
+ type: APYType;
374
+ };
375
+ type PositionInfo = {
376
+ tokenInfo: TokenInfo;
377
+ amount: Web3Number;
378
+ usdValue: number;
379
+ remarks: string;
380
+ apy: PositionAPY;
381
+ protocol: IProtocol;
382
+ };
383
+ type PositionAmount = {
384
+ amount: Web3Number;
385
+ remarks: string;
386
+ };
387
+ declare abstract class BaseAdapter<DepositParams, WithdrawParams> extends CacheClass {
388
+ readonly name: string;
389
+ readonly config: BaseAdapterConfig;
390
+ readonly protocol: IProtocol;
391
+ constructor(config: BaseAdapterConfig, name: string, protocol: IProtocol);
392
+ /**
393
+ * Loop through all supported positions and return amount, usd value, remarks and apy for each
496
394
  */
497
- depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<starknet.Call[]>;
395
+ getPositions(): Promise<PositionInfo[]>;
498
396
  /**
499
- * Creates a withdrawal call to the strategy contract.
500
- * @param assets - Amount of assets to withdraw
501
- * @param receiver - Address that will receive the withdrawn assets
502
- * @param owner - Address that owns the strategy tokens
503
- * @returns Populated contract call for withdrawal
397
+ * Implemented by child adapters to compute APY for a given supported position
504
398
  */
505
- withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<starknet.Call[]>;
399
+ protected abstract getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
506
400
  /**
507
- * Returns the underlying asset token of the strategy.
508
- * @returns The deposit token supported by this strategy
401
+ * Implemented by child adapters to fetch amount for a given supported position
509
402
  */
510
- asset(): TokenInfo;
403
+ protected abstract getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
511
404
  /**
512
- * Returns the number of decimals used by the strategy token.
513
- * @returns Number of decimals (same as the underlying token)
405
+ * Implemented by child adapters to calculate maximum deposit positions
406
+ * @param amount Optional amount in baseToken to deposit
514
407
  */
515
- decimals(): number;
408
+ abstract maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
516
409
  /**
517
- * Calculates the Total Value Locked (TVL) for a specific user.
518
- * @param user - Address of the user
519
- * @returns Object containing the amount in token units and USD value
410
+ * Implemented by child adapters to calculate maximum withdraw positions
520
411
  */
521
- getUserTVL(user: ContractAddr): Promise<{
522
- tokenInfo: TokenInfo;
523
- amount: Web3Number;
524
- usdValue: number;
525
- }>;
412
+ abstract maxWithdraw(): Promise<PositionInfo>;
526
413
  /**
527
- * Calculates the total TVL of the strategy.
528
- * @returns Object containing the total amount in token units and USD value
414
+ * Uses pricer to convert an amount of an asset to USD value
529
415
  */
530
- getTVL(): Promise<{
531
- tokenInfo: TokenInfo;
532
- amount: Web3Number;
533
- usdValue: number;
534
- }>;
535
- static getAllPossibleVerifiedPools(asset: ContractAddr): Promise<any>;
536
- getPoolInfo(p: PoolProps, pools: any[], vesuPositions: any[], totalAssets: Web3Number, isErrorPositionsAPI: boolean, isErrorPoolsAPI: boolean): Promise<{
537
- pool_id: ContractAddr;
538
- pool_name: any;
539
- max_weight: number;
540
- current_weight: number;
541
- v_token: ContractAddr;
542
- amount: Web3Number;
543
- usdValue: Web3Number;
544
- APY: {
545
- baseApy: number;
546
- defiSpringApy: number;
547
- netApy: number;
548
- };
549
- currentUtilization: number;
550
- maxUtilization: number;
551
- }>;
416
+ protected getUSDValue(asset: TokenInfo, amount: Web3Number): Promise<number>;
417
+ protected constructSimpleLeafData(params: {
418
+ id: string;
419
+ target: ContractAddr;
420
+ method: string;
421
+ packedArguments: bigint[];
422
+ }, sanitizer?: ContractAddr): LeafData;
552
423
  /**
553
- * Retrieves the list of allowed pools and their detailed information from multiple sources:
554
- * 1. Contract's allowed pools
555
- * 2. Vesu positions API for current positions
556
- * 3. Vesu pools API for APY and utilization data
557
- *
558
- * @returns {Promise<{
559
- * data: Array<PoolInfoFull>,
560
- * isErrorPositionsAPI: boolean
561
- * }>} Object containing:
562
- * - data: Array of pool information including IDs, weights, amounts, APYs and utilization
563
- * - isErrorPositionsAPI: Boolean indicating if there was an error fetching position data
424
+ * Implementor must provide target/method/packedArguments/sanitizer for deposit leaf construction
564
425
  */
565
- getPools(): Promise<{
566
- data: {
567
- pool_id: ContractAddr;
568
- pool_name: any;
569
- max_weight: number;
570
- current_weight: number;
571
- v_token: ContractAddr;
572
- amount: Web3Number;
573
- usdValue: Web3Number;
574
- APY: {
575
- baseApy: number;
576
- defiSpringApy: number;
577
- netApy: number;
578
- };
579
- currentUtilization: number;
580
- maxUtilization: number;
581
- }[];
582
- isErrorPositionsAPI: boolean;
583
- isErrorPoolsAPI: boolean;
584
- isError: boolean;
585
- }>;
586
- getVesuPools(retry?: number): Promise<{
587
- pools: any[];
588
- isErrorPoolsAPI: boolean;
589
- }>;
426
+ protected abstract _getDepositLeaf(): {
427
+ target: ContractAddr;
428
+ method: string;
429
+ packedArguments: bigint[];
430
+ sanitizer: ContractAddr;
431
+ id: string;
432
+ }[];
590
433
  /**
591
- * Calculates the weighted average APY across all pools based on USD value.
592
- * @returns {Promise<number>} The weighted average APY across all pools
434
+ * Implementor must provide target/method/packedArguments/sanitizer for withdraw leaf construction
593
435
  */
594
- netAPY(): Promise<number>;
436
+ protected abstract _getWithdrawLeaf(): {
437
+ target: ContractAddr;
438
+ method: string;
439
+ packedArguments: bigint[];
440
+ sanitizer: ContractAddr;
441
+ id: string;
442
+ }[];
595
443
  /**
596
- * Calculates the weighted average APY across all pools based on USD value.
597
- * @returns {Promise<number>} The weighted average APY across all pools
444
+ * Returns deposit leaf adapter using configured proof id
598
445
  */
599
- netAPYGivenPools(pools: PoolInfoFull[]): Promise<number>;
446
+ getDepositLeaf(): AdapterLeafType<DepositParams>;
600
447
  /**
601
- * Calculates optimal position changes to maximize APY while respecting max weights.
602
- * The algorithm:
603
- * 1. Sorts pools by APY (highest first)
604
- * 2. Calculates target amounts based on max weights
605
- * 3. For each pool that needs more funds:
606
- * - Takes funds from lowest APY pools that are over their target
607
- * 4. Validates that total assets remain constant
608
- *
609
- * @returns {Promise<{
610
- * changes: Change[],
611
- * finalPools: PoolInfoFull[],
612
- * isAnyPoolOverMaxWeight: boolean
613
- * }>} Object containing:
614
- * - changes: Array of position changes
615
- * - finalPools: Array of pool information after rebalance
616
- * @throws Error if rebalance is not possible while maintaining constraints
448
+ * Returns withdraw leaf adapter using configured proof id
617
449
  */
618
- getRebalancedPositions(_pools?: PoolInfoFull[]): Promise<{
619
- changes: never[];
620
- finalPools: never[];
621
- isAnyPoolOverMaxWeight?: undefined;
622
- } | {
623
- changes: Change[];
624
- finalPools: PoolInfoFull[];
625
- isAnyPoolOverMaxWeight: boolean;
626
- }>;
450
+ getWithdrawLeaf(): AdapterLeafType<WithdrawParams>;
627
451
  /**
628
- * Creates a rebalance Call object for the strategy contract
629
- * @param pools - Array of pool information including IDs, weights, amounts, APYs and utilization
630
- * @returns Populated contract call for rebalance
452
+ * Implementor must provide deposit call
453
+ * @param params
631
454
  */
632
- getRebalanceCall(pools: Awaited<ReturnType<typeof this.getRebalancedPositions>>["changes"], isOverWeightAdjustment: boolean): Promise<starknet.Call | null>;
633
- getInvestmentFlows(pools: PoolInfoFull[]): Promise<IInvestmentFlow[]>;
634
- getPendingRewards(): Promise<HarvestInfo[]>;
635
- harvest(acc: Account): Promise<starknet.Call[]>;
455
+ abstract getDepositCall(params: DepositParams): Promise<ManageCall[]>;
636
456
  /**
637
- * Calculates the fees deducted in different vTokens based on the current and previous state.
638
- * @param previousTotalSupply - The total supply of the strategy token before the transaction
639
- * @returns {Promise<Array<{ vToken: ContractAddr, fee: Web3Number }>>} Array of fees deducted in different vTokens
457
+ * Implementor must provide withdraw call
458
+ * @param params
640
459
  */
641
- getFee(allowedPools: Array<PoolInfoFull>): Promise<Array<{
642
- vToken: ContractAddr;
643
- fee: Web3Number;
644
- }>>;
460
+ abstract getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
461
+ getProofs<T>(isDeposit: boolean, tree: StandardMerkleTree): {
462
+ proofs: string[][];
463
+ callConstructor: GenerateCallFn<DepositParams> | GenerateCallFn<WithdrawParams>;
464
+ };
465
+ getNetAPY(): Promise<number>;
466
+ abstract getHealthFactor(): Promise<number>;
467
+ }
468
+
469
+ interface FlashloanCallParams {
470
+ amount: Web3Number;
471
+ data: bigint[];
472
+ }
473
+ interface ApproveCallParams {
474
+ amount: Web3Number;
475
+ }
476
+ interface AvnuSwapCallParams {
477
+ props: SwapInfo;
478
+ }
479
+ interface CommonAdapterConfig {
480
+ id: string;
481
+ vaultAddress: ContractAddr;
482
+ vaultAllocator: ContractAddr;
483
+ manager: ContractAddr;
484
+ asset: ContractAddr;
485
+ }
486
+ declare class CommonAdapter {
487
+ config: CommonAdapterConfig;
488
+ constructor(config: CommonAdapterConfig);
489
+ protected constructSimpleLeafData(params: {
490
+ id: string;
491
+ target: ContractAddr;
492
+ method: string;
493
+ packedArguments: bigint[];
494
+ }, sanitizer?: ContractAddr): LeafData;
495
+ getFlashloanAdapter(): Promise<AdapterLeafType<FlashloanCallParams>>;
496
+ getFlashloanCall(params: FlashloanCallParams): Promise<ManageCall[]>;
497
+ getBringLiquidityAdapter(id: string): () => AdapterLeafType<ApproveCallParams>;
498
+ getApproveAdapter(token: ContractAddr, spender: ContractAddr, id: string): () => AdapterLeafType<ApproveCallParams>;
499
+ getApproveCall(token: ContractAddr, spender: ContractAddr): (params: ApproveCallParams) => Promise<{
500
+ sanitizer: ContractAddr;
501
+ call: {
502
+ contractAddress: ContractAddr;
503
+ selector: string;
504
+ calldata: bigint[];
505
+ };
506
+ }[]>;
507
+ getBringLiquidityCall(): GenerateCallFn<ApproveCallParams>;
508
+ }
509
+
510
+ interface HarvestInfo {
511
+ rewardsContract: ContractAddr;
512
+ token: ContractAddr;
513
+ startDate: Date;
514
+ endDate: Date;
515
+ claim: {
516
+ id: number;
517
+ amount: Web3Number;
518
+ claimee: ContractAddr;
519
+ };
520
+ actualReward: Web3Number;
521
+ proof: string[];
645
522
  }
646
- /**
647
- * Represents the Vesu Rebalance Strategies.
648
- */
649
- declare const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[];
650
523
 
651
524
  interface EkuboPoolKey {
652
525
  token0: ContractAddr;
@@ -728,7 +601,7 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
728
601
  * Calculates assets before and now in a given token of TVL per share to observe growth
729
602
  * @returns {Promise<number>} The weighted average APY across all pools
730
603
  */
731
- netAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number, timeperiod?: '24h' | '7d' | '30d' | '3m'): Promise<number>;
604
+ netAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number, timeperiod?: '24h' | '7d' | '30d' | '3m'): Promise<APYInfo>;
732
605
  getHarvestRewardShares(fromBlock: number, toBlock: number): Promise<Web3Number>;
733
606
  balanceOf(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<Web3Number>;
734
607
  getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<DualTokenInfo>;
@@ -783,7 +656,7 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
783
656
  usdValue: number;
784
657
  };
785
658
  }>;
786
- getSwapInfoToHandleUnused(considerRebalance?: boolean, newBounds?: EkuboBounds | null, maxIterations?: number, priceRatioPrecision?: number, getQuoteCallback?: (tokenToSell: string, tokenToBuy: string, amountWei: string, beneficiary: string) => Promise<Quote>): Promise<SwapInfo>;
659
+ getSwapInfoToHandleUnused(considerRebalance?: boolean, newBounds?: EkuboBounds | null, maxIterations?: number, priceRatioPrecision?: number): Promise<SwapInfo>;
787
660
  assertValidBounds(bounds: EkuboBounds): void;
788
661
  assertValidAmounts(expectedAmounts: any, token0Bal: Web3Number, token1Bal: Web3Number): void;
789
662
  getSwapParams(expectedAmounts: any, poolKey: EkuboPoolKey, token0Bal: Web3Number, token1Bal: Web3Number): {
@@ -803,7 +676,7 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
803
676
  * @returns {Promise<SwapInfo>}
804
677
  *
805
678
  */
806
- getSwapInfoGivenAmounts(poolKey: EkuboPoolKey, token0Bal: Web3Number, token1Bal: Web3Number, bounds: EkuboBounds, maxIterations?: number, priceRatioPrecision?: number, getQuoteCallback?: (tokenToSell: string, tokenToBuy: string, amountWei: string, beneficiary: string) => Promise<Quote>): Promise<SwapInfo>;
679
+ getSwapInfoGivenAmounts(poolKey: EkuboPoolKey, token0Bal: Web3Number, token1Bal: Web3Number, bounds: EkuboBounds, maxIterations?: number, priceRatioPrecision?: number): Promise<SwapInfo>;
807
680
  /**
808
681
  * Attempts to rebalance the vault by iteratively adjusting swap amounts if initial attempt fails.
809
682
  * Uses binary search approach to find optimal swap amount.
@@ -814,16 +687,10 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
814
687
  * @param retry - Current retry attempt number (default 0)
815
688
  * @param adjustmentFactor - Percentage to adjust swap amount by (default 1)
816
689
  * @param isToken0Deficit - Whether token0 balance needs increasing (default true)
817
- * @param MAX_RETRIES - Maximum number of retries (default 40)
818
- * @param sameErrorCount - For certain errors, we just retry with same amount again. This is the count of such retries (default { count: 0, error: null })
819
- * @param MAX_SAME_ERROR_COUNT - For certain errors, we just retry with same amount again. This limits such retries (default 10)
820
690
  * @returns Array of contract calls needed for rebalancing
821
- * @throws Error if max retries reached without successful rebalance or max same errors reached
691
+ * @throws Error if max retries reached without successful rebalance
822
692
  */
823
- rebalanceIter(swapInfo: SwapInfo, acc: Account, estimateCall: (swapInfo: SwapInfo) => Promise<Call[]>, isSellTokenToken0?: boolean, retry?: number, lowerLimit?: bigint, upperLimit?: bigint, MAX_RETRIES?: number, sameErrorCount?: {
824
- count: number;
825
- error: null | string;
826
- }, MAX_SAME_ERROR_COUNT?: number): Promise<Call[]>;
693
+ rebalanceIter(swapInfo: SwapInfo, acc: Account, estimateCall: (swapInfo: SwapInfo) => Promise<Call[]>, isSellTokenToken0?: boolean, retry?: number, lowerLimit?: bigint, upperLimit?: bigint, MAX_RETRIES?: number): Promise<Call[]>;
827
694
  static tickToi129(tick: number): {
828
695
  mag: number;
829
696
  sign: number;
@@ -842,8 +709,7 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
842
709
  amount0: Web3Number;
843
710
  amount1: Web3Number;
844
711
  }>;
845
- getPendingRewards(): Promise<HarvestInfo[]>;
846
- harvest(acc: Account, maxIterations?: number, priceRatioPrecision?: number, minRewardAmount?: Web3Number): Promise<Call[]>;
712
+ harvest(acc: Account, maxIterations?: number, priceRatioPrecision?: number): Promise<Call[]>;
847
713
  /**
848
714
  * @description This funciton requires atleast one of the pool tokens to be reward token
849
715
  * i.e. STRK.
@@ -892,175 +758,9 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
892
758
  */
893
759
  declare const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[];
894
760
 
895
- interface SenseiVaultSettings {
896
- mainToken: TokenInfo;
897
- secondaryToken: TokenInfo;
898
- targetHfBps: number;
899
- feeBps: number;
900
- }
901
- declare class SenseiVault extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
902
- readonly address: ContractAddr;
903
- readonly metadata: IStrategyMetadata<SenseiVaultSettings>;
904
- readonly pricer: PricerBase;
905
- readonly contract: Contract;
906
- constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<SenseiVaultSettings>);
907
- getUserTVL(user: ContractAddr): Promise<SingleTokenInfo>;
908
- getTVL(): Promise<SingleTokenInfo>;
909
- depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
910
- withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
911
- getPositionInfo(): Promise<{
912
- collateralXSTRK: Web3Number;
913
- collateralUSDValue: Web3Number;
914
- debtSTRK: Web3Number;
915
- debtUSDValue: Web3Number;
916
- xSTRKPrice: number;
917
- collateralInSTRK: number;
918
- }>;
919
- getSecondaryTokenPriceRelativeToMain(retry?: number): Promise<number>;
920
- getSettings: () => Promise<starknet.CallResult>;
921
- }
922
- declare const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[];
923
-
924
- interface LeveledLogMethod {
925
- (message: string, ...meta: any[]): void;
926
- (message: any): void;
927
- }
928
- interface MyLogger {
929
- error: LeveledLogMethod;
930
- warn: LeveledLogMethod;
931
- info: LeveledLogMethod;
932
- verbose: LeveledLogMethod;
933
- debug: LeveledLogMethod;
934
- }
935
- declare const logger: MyLogger;
936
-
937
- interface LeafData {
938
- id: bigint;
939
- readableId: string;
940
- data: bigint[];
941
- }
942
- interface StandardMerkleTreeData<T extends any> extends MerkleTreeData<T> {
943
- format: 'standard-v1';
944
- leafEncoding: ValueType[];
945
- }
946
- declare class StandardMerkleTree extends MerkleTreeImpl<LeafData> {
947
- protected readonly tree: HexString[];
948
- protected readonly values: StandardMerkleTreeData<LeafData>['values'];
949
- protected readonly leafEncoding: ValueType[];
950
- protected constructor(tree: HexString[], values: StandardMerkleTreeData<LeafData>['values'], leafEncoding: ValueType[]);
951
- static of(values: LeafData[], leafEncoding?: ValueType[], options?: MerkleTreeOptions): StandardMerkleTree;
952
- static verify<T extends any[]>(root: BytesLike, leafEncoding: ValueType[], leaf: T, proof: BytesLike[]): boolean;
953
- static verifyMultiProof<T extends any[]>(root: BytesLike, leafEncoding: ValueType[], multiproof: MultiProof<BytesLike, T>): boolean;
954
- dump(): StandardMerkleTreeData<LeafData>;
955
- }
956
-
957
- type RequiredFields<T> = {
958
- [K in keyof T]-?: T[K];
959
- };
960
- type RequiredKeys<T> = {
961
- [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
962
- }[keyof T];
963
- declare function assert(condition: boolean, message: string): void;
964
- declare function getTrovesEndpoint(): string;
965
-
966
- interface ManageCall {
967
- sanitizer: ContractAddr;
968
- call: {
969
- contractAddress: ContractAddr;
970
- selector: string;
971
- calldata: bigint[];
972
- };
973
- }
974
- type GenerateCallFn<T> = (params: T) => ManageCall;
975
- type AdapterLeafType<T> = {
976
- leaf: LeafData;
977
- callConstructor: GenerateCallFn<T>;
978
- };
979
- type LeafAdapterFn<T> = () => AdapterLeafType<T>;
980
- declare enum APYType {
981
- BASE = "base",
982
- REWARD = "reward",
983
- LST = "lst"
984
- }
985
- interface SupportedPosition {
986
- asset: TokenInfo;
987
- isDebt: boolean;
988
- }
989
- interface BaseAdapterConfig {
990
- baseToken: TokenInfo;
991
- supportedPositions: SupportedPosition[];
992
- networkConfig: IConfig;
993
- pricer: PricerBase;
994
- vaultAllocator: ContractAddr;
995
- vaultAddress: ContractAddr;
996
- }
997
- type PositionAPY = {
998
- apy: number;
999
- type: APYType;
1000
- };
1001
- type PositionInfo = {
1002
- amount: Web3Number;
1003
- usdValue: number;
1004
- remarks?: string;
1005
- apy: PositionAPY;
1006
- };
1007
- declare abstract class BaseAdapter extends CacheClass {
1008
- constructor();
1009
- protected constructSimpleLeafData(params: {
1010
- id: string;
1011
- target: ContractAddr;
1012
- method: string;
1013
- packedArguments: bigint[];
1014
- }, sanitizer?: ContractAddr): LeafData;
1015
- }
1016
-
1017
- interface FlashloanCallParams {
1018
- amount: Web3Number;
1019
- data: bigint[];
1020
- }
1021
- interface ApproveCallParams {
1022
- amount: Web3Number;
1023
- }
1024
- interface AvnuSwapCallParams {
1025
- props: SwapInfo;
1026
- }
1027
- interface CommonAdapterConfig {
1028
- id: string;
1029
- vaultAddress: ContractAddr;
1030
- vaultAllocator: ContractAddr;
1031
- manager: ContractAddr;
1032
- asset: ContractAddr;
1033
- }
1034
- declare class CommonAdapter extends BaseAdapter {
1035
- config: CommonAdapterConfig;
1036
- constructor(config: CommonAdapterConfig);
1037
- getFlashloanAdapter(): AdapterLeafType<FlashloanCallParams>;
1038
- getFlashloanCall(params: FlashloanCallParams): ManageCall;
1039
- getApproveAdapter(token: ContractAddr, spender: ContractAddr, id: string): () => AdapterLeafType<ApproveCallParams>;
1040
- getApproveCall(token: ContractAddr, spender: ContractAddr): (params: ApproveCallParams) => {
1041
- sanitizer: ContractAddr;
1042
- call: {
1043
- contractAddress: ContractAddr;
1044
- selector: string;
1045
- calldata: bigint[];
1046
- };
1047
- };
1048
- getBringLiquidityAdapter(id: string): () => AdapterLeafType<ApproveCallParams>;
1049
- getBringLiquidityCall(): (params: ApproveCallParams) => {
1050
- sanitizer: ContractAddr;
1051
- call: {
1052
- contractAddress: ContractAddr;
1053
- selector: string;
1054
- calldata: bigint[];
1055
- };
1056
- };
1057
- getAvnuAdapter(fromToken: ContractAddr, toToken: ContractAddr, id: string, isMiddleware: boolean): () => AdapterLeafType<AvnuSwapCallParams>;
1058
- getAvnuCall(fromToken: ContractAddr, toToken: ContractAddr, isMiddleware: boolean): GenerateCallFn<AvnuSwapCallParams>;
1059
- }
1060
-
1061
- interface VesuPoolsInfo {
1062
- pools: any[];
1063
- isErrorPoolsAPI: boolean;
761
+ interface VesuPoolsInfo {
762
+ pools: any[];
763
+ isErrorPoolsAPI: boolean;
1064
764
  }
1065
765
  declare enum VesuAmountType {
1066
766
  Delta = 0,
@@ -1155,7 +855,8 @@ declare const VesuPools: {
1155
855
  Genesis: ContractAddr;
1156
856
  Re7xSTRK: ContractAddr;
1157
857
  Re7xBTC: ContractAddr;
1158
- Prime: ContractAddr;
858
+ Re7USDCPrime: ContractAddr;
859
+ Re7USDCCore: ContractAddr;
1159
860
  };
1160
861
  declare const extensionMap: {
1161
862
  [key: string]: ContractAddr;
@@ -1164,44 +865,14 @@ declare function getVesuSingletonAddress(vesuPool: ContractAddr): {
1164
865
  addr: ContractAddr;
1165
866
  isV2: boolean;
1166
867
  };
1167
- declare class VesuAdapter extends BaseAdapter {
868
+ declare class VesuAdapter extends CacheClass {
1168
869
  VESU_MULTIPLY_V1: ContractAddr;
1169
870
  VESU_MULTIPLY: ContractAddr;
1170
871
  config: VesuAdapterConfig;
1171
872
  networkConfig: IConfig | undefined;
1172
873
  pricer: PricerBase | undefined;
1173
874
  constructor(config: VesuAdapterConfig);
1174
- getModifyPosition: () => AdapterLeafType<VesuModifyPositionCallParams>;
1175
- static getDefaultModifyPositionCallParams(params: {
1176
- collateralAmount: Web3Number;
1177
- isAddCollateral: boolean;
1178
- debtAmount: Web3Number;
1179
- isBorrow: boolean;
1180
- }): {
1181
- collateralAmount: {
1182
- amount_type: VesuAmountType;
1183
- denomination: VesuAmountDenomination;
1184
- value: {
1185
- abs: Web3Number;
1186
- is_negative: boolean;
1187
- };
1188
- };
1189
- debtAmount: {
1190
- amount_type: VesuAmountType;
1191
- denomination: VesuAmountDenomination;
1192
- value: {
1193
- abs: Web3Number;
1194
- is_negative: boolean;
1195
- };
1196
- };
1197
- };
1198
- getModifyPositionCall: (params: VesuModifyPositionCallParams) => ManageCall;
1199
- getMultiplyAdapter: (id: string) => LeafAdapterFn<VesuMultiplyCallParams>;
1200
- getMultiplyCall: (params: VesuMultiplyCallParams) => ManageCall;
1201
- getVesuModifyDelegationAdapter: (id: string) => LeafAdapterFn<VesuModifyDelegationCallParams>;
1202
875
  getVesuModifyDelegationCall: (params: VesuModifyDelegationCallParams) => ManageCall;
1203
- getDefispringRewardsAdapter: (id: string) => () => AdapterLeafType<VesuDefiSpringRewardsCallParams>;
1204
- getDefiSpringClaimCall: () => GenerateCallFn<VesuDefiSpringRewardsCallParams>;
1205
876
  formatAmountTypeEnum(amountType: VesuAmountType): CairoCustomEnum;
1206
877
  formatAmountDenominationEnum(denomination: VesuAmountDenomination): CairoCustomEnum;
1207
878
  getVesuSingletonContract(config: IConfig, poolId: ContractAddr): {
@@ -1210,21 +881,17 @@ declare class VesuAdapter extends BaseAdapter {
1210
881
  };
1211
882
  getDebtCap(config: IConfig): Promise<Web3Number>;
1212
883
  getCurrentDebtUtilisationAmount(config: IConfig): Promise<Web3Number>;
1213
- getMaxBorrowableByInterestRate(config: IConfig, asset: TokenInfo, maxBorrowAPY: number): Promise<{
1214
- maxDebtToHave: Web3Number;
1215
- currentDebt: Web3Number;
1216
- totalSupply: Web3Number;
1217
- }>;
884
+ getMaxBorrowableByInterestRate(config: IConfig, asset: TokenInfo, maxBorrowAPY: number): Promise<Web3Number>;
1218
885
  getLTVConfig(config: IConfig, blockNumber?: BlockIdentifier): Promise<number>;
1219
886
  getPositions(config: IConfig, blockNumber?: BlockIdentifier): Promise<VaultPosition[]>;
1220
887
  getCollateralization(config: IConfig, blockNumber?: BlockIdentifier): Promise<Omit<VaultPosition, 'amount'>[]>;
1221
888
  getAssetPrices(): Promise<{
1222
889
  collateralTokenAmount: Web3Number;
1223
890
  collateralUSDAmount: number;
1224
- collateralPrice: number;
891
+ collateralPrice: PriceInfo | undefined;
1225
892
  debtTokenAmount: Web3Number;
1226
893
  debtUSDAmount: number;
1227
- debtPrice: number;
894
+ debtPrice: PriceInfo | undefined;
1228
895
  ltv: number;
1229
896
  }>;
1230
897
  getHealthFactor(blockNumber?: BlockIdentifier): Promise<number>;
@@ -1244,166 +911,1278 @@ declare class VesuAdapter extends BaseAdapter {
1244
911
  getMaxUtilizationGivenRatePerSecond(interestRateConfig: InterestRateConfig, ratePerSecond: bigint, timeDelta: bigint, last_full_utilization_rate: bigint): bigint;
1245
912
  }
1246
913
 
1247
- declare const SIMPLE_SANITIZER: ContractAddr;
1248
- declare const SIMPLE_SANITIZER_V2: ContractAddr;
1249
- declare const VESU_V2_MODIFY_POSITION_SANITIZER: ContractAddr;
1250
- declare const SIMPLE_SANITIZER_VESU_V1_DELEGATIONS: ContractAddr;
1251
- declare const PRICE_ROUTER: ContractAddr;
1252
- declare const AVNU_MIDDLEWARE: ContractAddr;
1253
- declare const AVNU_EXCHANGE: ContractAddr;
1254
- declare const VESU_SINGLETON: ContractAddr;
1255
- declare function toBigInt(value: string | number): bigint;
1256
-
1257
- interface UniversalManageCall {
1258
- proofs: string[];
1259
- manageCall: ManageCall;
1260
- step: UNIVERSAL_MANAGE_IDS;
1261
- }
1262
- interface UniversalStrategySettings {
1263
- vaultAddress: ContractAddr;
1264
- manager: ContractAddr;
1265
- vaultAllocator: ContractAddr;
1266
- redeemRequestNFT: ContractAddr;
1267
- aumOracle: ContractAddr;
1268
- redemptionRouter?: ContractAddr;
1269
- leafAdapters: LeafAdapterFn<any>[];
1270
- adapters: {
914
+ interface VesuSupplyOnlyAdapterConfig extends BaseAdapterConfig {
915
+ vTokenContract: ContractAddr;
916
+ }
917
+ declare class VesuSupplyOnlyAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
918
+ readonly config: VesuSupplyOnlyAdapterConfig;
919
+ readonly tokenMarketData: TokenMarketData;
920
+ constructor(config: VesuSupplyOnlyAdapterConfig);
921
+ protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
922
+ protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
923
+ maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
924
+ maxWithdraw(): Promise<PositionInfo>;
925
+ protected _getDepositLeaf(): {
926
+ target: ContractAddr;
927
+ method: string;
928
+ packedArguments: bigint[];
929
+ sanitizer: ContractAddr;
930
+ id: string;
931
+ }[];
932
+ protected _getWithdrawLeaf(): {
933
+ target: ContractAddr;
934
+ method: string;
935
+ packedArguments: bigint[];
936
+ sanitizer: ContractAddr;
1271
937
  id: string;
1272
- adapter: BaseAdapter;
1273
938
  }[];
939
+ getDepositAdapter(): AdapterLeafType<DepositParams>;
940
+ getWithdrawAdapter(): AdapterLeafType<WithdrawParams>;
941
+ getDepositCall(params: DepositParams): Promise<ManageCall[]>;
942
+ getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
943
+ getHealthFactor(): Promise<number>;
944
+ }
945
+
946
+ interface VesuMultiplyAdapterConfig extends BaseAdapterConfig {
947
+ poolId: ContractAddr;
948
+ collateral: TokenInfo;
949
+ debt: TokenInfo;
1274
950
  targetHealthFactor: number;
1275
951
  minHealthFactor: number;
952
+ quoteAmountToFetchPrice: Web3Number;
953
+ minimumVesuMovementAmount: number;
954
+ }
955
+ declare class VesuMultiplyAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
956
+ readonly config: VesuMultiplyAdapterConfig;
957
+ readonly vesuAdapter: VesuAdapter;
958
+ readonly tokenMarketData: TokenMarketData;
959
+ readonly minimumVesuMovementAmount: number;
960
+ constructor(config: VesuMultiplyAdapterConfig);
961
+ protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
962
+ protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
963
+ maxBorrowableAPY(): Promise<number>;
964
+ maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
965
+ maxWithdraw(): Promise<PositionInfo>;
966
+ protected _getDepositLeaf(): {
967
+ target: ContractAddr;
968
+ method: string;
969
+ packedArguments: bigint[];
970
+ sanitizer: ContractAddr;
971
+ id: string;
972
+ }[];
973
+ protected _getWithdrawLeaf(): {
974
+ target: ContractAddr;
975
+ method: string;
976
+ packedArguments: bigint[];
977
+ sanitizer: ContractAddr;
978
+ id: string;
979
+ }[];
980
+ getDepositAdapter(): AdapterLeafType<DepositParams>;
981
+ getWithdrawAdapter(): AdapterLeafType<WithdrawParams>;
982
+ getDepositCall(params: DepositParams): Promise<ManageCall[]>;
983
+ getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
984
+ private getMultiplyCallCalldata;
985
+ private getLeverParams;
986
+ private getWithdrawalCalldata;
987
+ formatMultiplyParams(isIncrease: boolean, params: IncreaseLeverParams | DecreaseLeverParams): {
988
+ action: CairoCustomEnum;
989
+ };
990
+ getHealthFactor(): Promise<number>;
991
+ getNetAPY(): Promise<number>;
1276
992
  }
1277
- declare enum AUMTypes {
1278
- FINALISED = "finalised",
1279
- DEFISPRING = "defispring"
993
+
994
+ /**
995
+ * TypeScript type definitions for Extended Exchange API
996
+ * Based on Python SDK models from x10.perpetual
997
+ */
998
+ declare enum OrderSide {
999
+ BUY = "BUY",
1000
+ SELL = "SELL"
1001
+ }
1002
+ declare enum TimeInForce {
1003
+ GTT = "GTT",
1004
+ IOC = "IOC",
1005
+ FOK = "FOK"
1006
+ }
1007
+ declare enum OrderType {
1008
+ LIMIT = "LIMIT",
1009
+ CONDITIONAL = "CONDITIONAL",
1010
+ MARKET = "MARKET",
1011
+ TPSL = "TPSL"
1012
+ }
1013
+ declare enum OrderStatus {
1014
+ UNKNOWN = "UNKNOWN",
1015
+ NEW = "NEW",
1016
+ UNTRIGGERED = "UNTRIGGERED",
1017
+ PARTIALLY_FILLED = "PARTIALLY_FILLED",
1018
+ FILLED = "FILLED",
1019
+ CANCELLED = "CANCELLED",
1020
+ EXPIRED = "EXPIRED",
1021
+ REJECTED = "REJECTED"
1022
+ }
1023
+ declare enum OrderStatusReason {
1024
+ UNKNOWN = "UNKNOWN",
1025
+ NONE = "NONE",
1026
+ UNKNOWN_MARKET = "UNKNOWN_MARKET",
1027
+ DISABLED_MARKET = "DISABLED_MARKET",
1028
+ NOT_ENOUGH_FUNDS = "NOT_ENOUGH_FUNDS",
1029
+ NO_LIQUIDITY = "NO_LIQUIDITY",
1030
+ INVALID_FEE = "INVALID_FEE",
1031
+ INVALID_QTY = "INVALID_QTY",
1032
+ INVALID_PRICE = "INVALID_PRICE",
1033
+ INVALID_VALUE = "INVALID_VALUE",
1034
+ UNKNOWN_ACCOUNT = "UNKNOWN_ACCOUNT",
1035
+ SELF_TRADE_PROTECTION = "SELF_TRADE_PROTECTION",
1036
+ POST_ONLY_FAILED = "POST_ONLY_FAILED",
1037
+ REDUCE_ONLY_FAILED = "REDUCE_ONLY_FAILED",
1038
+ INVALID_EXPIRE_TIME = "INVALID_EXPIRE_TIME",
1039
+ POSITION_TPSL_CONFLICT = "POSITION_TPSL_CONFLICT",
1040
+ INVALID_LEVERAGE = "INVALID_LEVERAGE",
1041
+ PREV_ORDER_NOT_FOUND = "PREV_ORDER_NOT_FOUND",
1042
+ PREV_ORDER_TRIGGERED = "PREV_ORDER_TRIGGERED",
1043
+ TPSL_OTHER_SIDE_FILLED = "TPSL_OTHER_SIDE_FILLED",
1044
+ PREV_ORDER_CONFLICT = "PREV_ORDER_CONFLICT",
1045
+ ORDER_REPLACED = "ORDER_REPLACED",
1046
+ POST_ONLY_MODE = "POST_ONLY_MODE",
1047
+ REDUCE_ONLY_MODE = "REDUCE_ONLY_MODE",
1048
+ TRADING_OFF_MODE = "TRADING_OFF_MODE"
1049
+ }
1050
+ declare enum PositionSide {
1051
+ LONG = "LONG",
1052
+ SHORT = "SHORT"
1053
+ }
1054
+ declare enum ExitType {
1055
+ TRADE = "TRADE",
1056
+ LIQUIDATION = "LIQUIDATION",
1057
+ ADL = "ADL"
1058
+ }
1059
+ declare enum AssetOperationType {
1060
+ DEPOSIT = "DEPOSIT",
1061
+ WITHDRAWAL = "WITHDRAWAL",
1062
+ TRANSFER = "TRANSFER"
1063
+ }
1064
+ declare enum AssetOperationStatus {
1065
+ PENDING = "PENDING",
1066
+ COMPLETED = "COMPLETED",
1067
+ FAILED = "FAILED"
1068
+ }
1069
+ interface SettlementSignature {
1070
+ r: string;
1071
+ s: string;
1072
+ }
1073
+ interface StarkSettlement {
1074
+ signature: SettlementSignature;
1075
+ stark_key: string;
1076
+ collateral_position: string;
1077
+ }
1078
+ interface StarkDebuggingOrderAmounts {
1079
+ collateral_amount: string;
1080
+ fee_amount: string;
1081
+ synthetic_amount: string;
1082
+ }
1083
+ interface PlacedOrder {
1084
+ id: number;
1085
+ external_id: string;
1086
+ }
1087
+ interface OpenOrder {
1088
+ id: number;
1089
+ account_id: number;
1090
+ external_id: string;
1091
+ market: string;
1092
+ type: OrderType;
1093
+ side: OrderSide;
1094
+ status: OrderStatus;
1095
+ status_reason?: OrderStatusReason;
1096
+ price: string;
1097
+ average_price?: string;
1098
+ qty: string;
1099
+ filled_qty?: string;
1100
+ reduce_only: boolean;
1101
+ post_only: boolean;
1102
+ payed_fee?: string;
1103
+ created_time: number;
1104
+ updated_time: number;
1105
+ expiry_time?: number;
1106
+ }
1107
+ interface Position {
1108
+ id: number;
1109
+ accountId: number;
1110
+ market: string;
1111
+ side: PositionSide;
1112
+ leverage: string;
1113
+ size: string;
1114
+ value: string;
1115
+ openPrice: string;
1116
+ markPrice: string;
1117
+ liquidationPrice?: string;
1118
+ unrealisedPnl: string;
1119
+ realisedPnl: string;
1120
+ tpPrice?: string;
1121
+ slPrice?: string;
1122
+ adl?: number;
1123
+ createdAt: number;
1124
+ updatedAt: number;
1125
+ }
1126
+ interface PositionHistory {
1127
+ id: number;
1128
+ account_id: number;
1129
+ market: string;
1130
+ side: PositionSide;
1131
+ leverage: string;
1132
+ size: string;
1133
+ open_price: string;
1134
+ exit_type?: ExitType;
1135
+ exit_price?: string;
1136
+ realised_pnl: string;
1137
+ created_time: number;
1138
+ closed_time?: number;
1139
+ }
1140
+ interface Balance {
1141
+ collateral_name: string;
1142
+ balance: string;
1143
+ equity: string;
1144
+ availableForTrade: string;
1145
+ availableForWithdrawal: string;
1146
+ unrealisedPnl: string;
1147
+ initialMargin: string;
1148
+ marginRatio: string;
1149
+ updatedTime: number;
1150
+ }
1151
+ interface RiskFactorConfig {
1152
+ upper_bound: string;
1153
+ risk_factor: string;
1154
+ }
1155
+ interface MarketStats {
1156
+ daily_volume: string;
1157
+ daily_volume_base: string;
1158
+ daily_price_change: string;
1159
+ daily_low: string;
1160
+ daily_high: string;
1161
+ last_price: string;
1162
+ ask_price: string;
1163
+ bid_price: string;
1164
+ mark_price: string;
1165
+ index_price: string;
1166
+ funding_rate: string;
1167
+ next_funding_rate: number;
1168
+ open_interest: string;
1169
+ open_interest_base: string;
1170
+ }
1171
+ interface TradingConfig {
1172
+ min_order_size: string;
1173
+ min_order_size_change: string;
1174
+ min_price_change: string;
1175
+ max_market_order_value: string;
1176
+ max_limit_order_value: string;
1177
+ max_position_value: string;
1178
+ max_leverage: string;
1179
+ max_num_orders: number;
1180
+ limit_price_cap: string;
1181
+ limit_price_floor: string;
1182
+ risk_factor_config: RiskFactorConfig[];
1183
+ }
1184
+ interface L2Config {
1185
+ type: string;
1186
+ collateral_id: string;
1187
+ collateral_resolution: number;
1188
+ synthetic_id: string;
1189
+ synthetic_resolution: number;
1190
+ }
1191
+ interface Market {
1192
+ name: string;
1193
+ asset_name: string;
1194
+ asset_precision: number;
1195
+ collateral_asset_name: string;
1196
+ collateral_asset_precision: number;
1197
+ active: boolean;
1198
+ market_stats: MarketStats;
1199
+ trading_config: TradingConfig;
1200
+ l2_config: L2Config;
1201
+ }
1202
+ interface AssetOperation {
1203
+ id: string;
1204
+ type: AssetOperationType;
1205
+ status: AssetOperationStatus;
1206
+ amount: string;
1207
+ asset: string;
1208
+ created_time: number;
1209
+ updated_time: number;
1210
+ description?: string;
1211
+ transactionHash?: string;
1212
+ }
1213
+ interface CreateOrderRequest {
1214
+ market_name: string;
1215
+ amount: string;
1216
+ price: string;
1217
+ side: OrderSide;
1218
+ post_only?: boolean;
1219
+ previous_order_id?: number;
1220
+ external_id?: string;
1221
+ time_in_force?: TimeInForce;
1222
+ }
1223
+ interface WithdrawRequest {
1224
+ amount: string;
1225
+ asset?: string;
1226
+ }
1227
+ interface SignedWithdrawRequest {
1228
+ recipient: string;
1229
+ position_id: number;
1230
+ amount: number;
1231
+ expiration: number;
1232
+ salt: number;
1233
+ }
1234
+ interface CancelOrderRequest {
1235
+ order_id: number;
1236
+ }
1237
+ interface ApiResponse<T> {
1238
+ success: boolean;
1239
+ message: string;
1240
+ data: T;
1241
+ }
1242
+ interface ExtendedApiResponse<T> {
1243
+ status: 'OK' | 'ERROR';
1244
+ message: string;
1245
+ data: T;
1246
+ }
1247
+ interface ExtendedWrapperConfig {
1248
+ baseUrl: string;
1249
+ apiKey?: string;
1250
+ timeout?: number;
1251
+ retries?: number;
1252
+ }
1253
+ interface UpdateLeverageRequest {
1254
+ leverage: string;
1255
+ market: string;
1256
+ }
1257
+ interface FundingRate {
1258
+ m: string;
1259
+ f: string;
1260
+ t: number;
1280
1261
  }
1281
- declare class UniversalStrategy<S extends UniversalStrategySettings> extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
1282
- /** Contract address of the strategy */
1283
- readonly address: ContractAddr;
1284
- /** Pricer instance for token price calculations */
1285
- readonly pricer: PricerBase;
1286
- /** Metadata containing strategy information */
1287
- readonly metadata: IStrategyMetadata<S>;
1288
- /** Contract instance for interacting with the strategy */
1289
- readonly contract: Contract;
1290
- readonly managerContract: Contract;
1291
- merkleTree: StandardMerkleTree | undefined;
1292
- constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
1293
- getMerkleTree(): StandardMerkleTree;
1294
- getMerkleRoot(): string;
1295
- getProofs<T>(id: string): {
1296
- proofs: string[];
1297
- callConstructor: GenerateCallFn<T>;
1298
- };
1299
- getAdapter(id: string): BaseAdapter;
1300
- asset(): TokenInfo;
1301
- depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
1302
- withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
1262
+
1263
+ /**
1264
+ * ExtendedWrapper - TypeScript wrapper for Extended Exchange API
1265
+ * Provides a clean interface to interact with the Extended Exchange trading API
1266
+ */
1267
+
1268
+ declare class ExtendedWrapper {
1269
+ private baseUrl;
1270
+ private apiKey?;
1271
+ private timeout;
1272
+ private retries;
1273
+ constructor(config: ExtendedWrapperConfig);
1303
1274
  /**
1304
- * Calculates the Total Value Locked (TVL) for a specific user.
1305
- * @param user - Address of the user
1306
- * @returns Object containing the amount in token units and USD value
1275
+ * Make HTTP request with retry logic and error handling
1307
1276
  */
1308
- getUserTVL(user: ContractAddr): Promise<{
1309
- tokenInfo: TokenInfo;
1310
- amount: Web3Number;
1311
- usdValue: number;
1312
- }>;
1313
- getVesuAPYs(): Promise<{
1314
- baseAPYs: number[];
1315
- rewardAPYs: number[];
1316
- positions: VaultPosition[];
1317
- }>;
1277
+ private makeRequest;
1318
1278
  /**
1319
- * Calculates the weighted average APY across all pools based on USD value.
1320
- * @returns {Promise<number>} The weighted average APY across all pools
1279
+ * Create a new order on Extended Exchange
1321
1280
  */
1322
- netAPY(): Promise<{
1323
- net: number;
1324
- splits: {
1325
- apy: number;
1326
- id: string;
1327
- }[];
1328
- }>;
1329
- protected returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[], prevAUMUSD: Web3Number): Promise<{
1330
- net: number;
1331
- splits: {
1332
- apy: number;
1333
- id: string;
1334
- }[];
1335
- }>;
1336
- protected getUnusedBalanceAPY(): Promise<{
1337
- apy: number;
1338
- weight: number;
1339
- }>;
1340
- private computeAPY;
1281
+ createOrder(request: CreateOrderRequest): Promise<ExtendedApiResponse<PlacedOrder>>;
1341
1282
  /**
1342
- * Calculates the total TVL of the strategy.
1343
- * @returns Object containing the total amount in token units and USD value
1344
- */
1345
- getTVL(): Promise<{
1346
- tokenInfo: TokenInfo;
1283
+ * Get all markets
1284
+ */
1285
+ getMarkets(marketNames?: string): Promise<ExtendedApiResponse<Market[]>>;
1286
+ /**
1287
+ *
1288
+ * @param orderId - The ID of the order to get
1289
+ * @returns The order
1290
+ */
1291
+ getOrderByOrderId(orderId: string): Promise<ExtendedApiResponse<OpenOrder>>;
1292
+ /**
1293
+ * Get market statistics for a specific market
1294
+ */
1295
+ getMarketStatistics(marketName: string): Promise<ExtendedApiResponse<MarketStats>>;
1296
+ /**
1297
+ * Get current trading positions
1298
+ */
1299
+ getPositions(marketNames?: string): Promise<ExtendedApiResponse<Position[]>>;
1300
+ /**
1301
+ * Get account balance and holdings
1302
+ */
1303
+ getHoldings(): Promise<ExtendedApiResponse<Balance>>;
1304
+ /**
1305
+ * Initiate a withdrawal from Extended Exchange
1306
+ * Returns data as number | string to preserve precision for large integers
1307
+ */
1308
+ withdraw(request: WithdrawRequest): Promise<ExtendedApiResponse<number | string>>;
1309
+ /**
1310
+ * Create and sign a withdrawal request hash
1311
+ */
1312
+ signWithdrawalRequest(request: SignedWithdrawRequest): Promise<ExtendedApiResponse<{
1313
+ withdraw_request_hash: string;
1314
+ signature: {
1315
+ r: string;
1316
+ s: string;
1317
+ };
1318
+ }>>;
1319
+ /**
1320
+ * Cancel an existing order
1321
+ */
1322
+ cancelOrder(request: CancelOrderRequest): Promise<ExtendedApiResponse<{}>>;
1323
+ /**
1324
+ * Get all open orders
1325
+ */
1326
+ getOpenOrders(marketName?: string): Promise<ExtendedApiResponse<OpenOrder[]>>;
1327
+ /**
1328
+ * Update leverage on the market
1329
+ * @param request
1330
+ * @returns
1331
+ */
1332
+ updateLeverage(request: UpdateLeverageRequest): Promise<ExtendedApiResponse<{}>>;
1333
+ /**
1334
+ * Get asset operations with optional filtering
1335
+ */
1336
+ getAssetOperations(options?: {
1337
+ id?: number;
1338
+ operationsType?: AssetOperationType[];
1339
+ operationsStatus?: AssetOperationStatus[];
1340
+ startTime?: number;
1341
+ endTime?: number;
1342
+ page?: number;
1343
+ }): Promise<ExtendedApiResponse<AssetOperation[]>>;
1344
+ /**
1345
+ * Health check endpoint
1346
+ */
1347
+ healthCheck(): Promise<ExtendedApiResponse<MarketStats>>;
1348
+ /**
1349
+ * Convenience method to create a buy order
1350
+ */
1351
+ createBuyOrder(marketName: string, amount: string, price: string, options?: {
1352
+ postOnly?: boolean;
1353
+ previousOrderId?: number;
1354
+ externalId?: string;
1355
+ timeInForce?: TimeInForce;
1356
+ }): Promise<ExtendedApiResponse<PlacedOrder>>;
1357
+ /**
1358
+ * Get order by ID
1359
+ * @param orderId - The ID of the order to get
1360
+ * @returns The order
1361
+ */
1362
+ getOrderById(orderId: number): Promise<ExtendedApiResponse<OpenOrder>>;
1363
+ /**
1364
+ * Convenience method to create a sell order
1365
+ */
1366
+ createSellOrder(marketName: string, amount: string, price: string, options?: {
1367
+ postOnly?: boolean;
1368
+ previousOrderId?: number;
1369
+ externalId?: string;
1370
+ timeInForce?: TimeInForce;
1371
+ }): Promise<ExtendedApiResponse<PlacedOrder>>;
1372
+ /**
1373
+ * Get positions for a specific market
1374
+ */
1375
+ getPositionsForMarket(marketName: string): Promise<ExtendedApiResponse<Position[]>>;
1376
+ /**
1377
+ * Get open orders for a specific market
1378
+ */
1379
+ getOpenOrdersForMarket(marketName: string): Promise<ExtendedApiResponse<OpenOrder[]>>;
1380
+ /**
1381
+ * Cancel order by ID (convenience method)
1382
+ */
1383
+ cancelOrderById(orderId: number): Promise<ExtendedApiResponse<{}>>;
1384
+ /**
1385
+ * Get order history for a specific market
1386
+ * @param marketName - The name of the market to get order history for
1387
+ * @returns The order history for the specified market
1388
+ */
1389
+ getOrderHistory(marketName: string): Promise<ExtendedApiResponse<OpenOrder[]>>;
1390
+ /**
1391
+ * Withdraw USDC (convenience method)
1392
+ * Returns data as number | string to preserve precision for large integers
1393
+ */
1394
+ withdrawUSDC(amount: string): Promise<ExtendedApiResponse<number | string>>;
1395
+ /**
1396
+ * Get funding rates for a specific market
1397
+ * @param marketName - The name of the market to get funding rates for
1398
+ * @param side - The side (BUY/SELL)
1399
+ * @param options - Optional parameters for filtering and pagination
1400
+ * @param options.startTime - Start timestamp for filtering (ISO format datetime string)
1401
+ * @param options.endTime - End timestamp for filtering (ISO format datetime string)
1402
+ * @param options.page - Page number (default: 1, 10 entries per page)
1403
+ * @returns The funding rates for the specified market
1404
+ */
1405
+ getFundingRates(marketName: string, side: string, options?: {
1406
+ startTime?: string;
1407
+ endTime?: string;
1408
+ page?: number;
1409
+ }): Promise<ExtendedApiResponse<FundingRate[]>>;
1410
+ }
1411
+
1412
+ interface Route {
1413
+ token_from: string;
1414
+ token_to: string;
1415
+ exchange_address: string;
1416
+ percent: number;
1417
+ additional_swap_params: string[];
1418
+ }
1419
+ interface SwapInfo {
1420
+ token_from_address: string;
1421
+ token_from_amount: Uint256;
1422
+ token_to_address: string;
1423
+ token_to_amount: Uint256;
1424
+ token_to_min_amount: Uint256;
1425
+ beneficiary: string;
1426
+ integrator_fee_amount_bps: number;
1427
+ integrator_fee_recipient: string;
1428
+ routes: Route[];
1429
+ }
1430
+ declare class AvnuWrapper {
1431
+ getQuotes(fromToken: string, toToken: string, amountWei: string, taker: string, retry?: number, excludeSources?: string[]): Promise<Quote>;
1432
+ getSwapInfo(quote: Pick<Quote, 'quoteId' | 'buyTokenAddress' | 'buyAmount' | 'sellTokenAddress' | 'sellAmount'>, taker: string, integratorFeeBps: number, integratorFeeRecipient: string, minAmount?: string, options?: AvnuOptions): Promise<SwapInfo>;
1433
+ static buildZeroSwap(tokenToSell: ContractAddr, beneficiary: string, tokenToBuy?: ContractAddr): SwapInfo;
1434
+ getSwapCallData(quote: Pick<Quote, 'quoteId' | 'buyTokenAddress' | 'buyAmount' | 'sellTokenAddress' | 'sellAmount'>, taker: string): Promise<bigint[][]>;
1435
+ }
1436
+
1437
+ interface AvnuAdapterConfig extends BaseAdapterConfig {
1438
+ baseUrl: string;
1439
+ avnuContract: ContractAddr;
1440
+ slippage: number;
1441
+ minimumExtendedPriceDifferenceForSwapOpen: number;
1442
+ maximumExtendedPriceDifferenceForSwapClosing: number;
1443
+ }
1444
+ declare class AvnuAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
1445
+ readonly config: AvnuAdapterConfig;
1446
+ protected avnuWrapper: AvnuWrapper;
1447
+ constructor(config: AvnuAdapterConfig);
1448
+ protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
1449
+ protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
1450
+ maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
1451
+ maxWithdraw(): Promise<PositionInfo>;
1452
+ protected _getDepositLeaf(): {
1453
+ target: ContractAddr;
1454
+ method: string;
1455
+ packedArguments: bigint[];
1456
+ sanitizer: ContractAddr;
1457
+ id: string;
1458
+ }[];
1459
+ protected _getWithdrawLeaf(): {
1460
+ target: ContractAddr;
1461
+ method: string;
1462
+ packedArguments: bigint[];
1463
+ sanitizer: ContractAddr;
1464
+ id: string;
1465
+ }[];
1466
+ protected _getLegacySwapLeaf(): {
1467
+ target: ContractAddr;
1468
+ method: string;
1469
+ packedArguments: bigint[];
1470
+ sanitizer: ContractAddr;
1471
+ id: string;
1472
+ }[];
1473
+ getDepositCall(params: DepositParams): Promise<ManageCall[]>;
1474
+ getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
1475
+ getSwapCallData(quote: Quote): Promise<bigint[][]>;
1476
+ getHealthFactor(): Promise<number>;
1477
+ fetchQuoteWithRetry(params: Record<string, any>, retries?: number): Promise<any>;
1478
+ getQuotesAvnu(from_token_address: string, to_token_address: string, amount: number, //amount in btc units
1479
+ takerAddress: string, toTokenDecimals: number, usdcToBtc: boolean, maxIterations?: number, tolerance?: number): Promise<Quote | null>;
1480
+ getPriceOfToken(tokenAddress: string, retries?: number): Promise<number | null>;
1481
+ }
1482
+
1483
+ interface ExtendedAdapterConfig extends BaseAdapterConfig {
1484
+ vaultIdExtended: number;
1485
+ extendedContract: ContractAddr;
1486
+ extendedBackendUrl: string;
1487
+ extendedApiKey: string;
1488
+ extendedTimeout: number;
1489
+ extendedRetries: number;
1490
+ extendedBaseUrl: string;
1491
+ extendedMarketName: string;
1492
+ extendedPrecision: number;
1493
+ avnuAdapter: AvnuAdapter;
1494
+ retryDelayForOrderStatus: number;
1495
+ minimumExtendedMovementAmount: number;
1496
+ }
1497
+ declare class ExtendedAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
1498
+ readonly config: ExtendedAdapterConfig;
1499
+ readonly client: ExtendedWrapper;
1500
+ readonly retryDelayForOrderStatus: number;
1501
+ readonly minimumExtendedMovementAmount: number;
1502
+ constructor(config: ExtendedAdapterConfig);
1503
+ protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
1504
+ protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
1505
+ maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
1506
+ maxWithdraw(): Promise<PositionInfo>;
1507
+ protected _getDepositLeaf(): {
1508
+ target: ContractAddr;
1509
+ method: string;
1510
+ packedArguments: bigint[];
1511
+ sanitizer: ContractAddr;
1512
+ id: string;
1513
+ }[];
1514
+ getSwapFromLegacyLeaf(): AdapterLeafType<DepositParams>;
1515
+ protected _getSwapFromLegacyLeaf(): {
1516
+ target: ContractAddr;
1517
+ method: string;
1518
+ packedArguments: bigint[];
1519
+ sanitizer: ContractAddr;
1520
+ id: string;
1521
+ }[];
1522
+ protected _getWithdrawLeaf(): {
1523
+ target: ContractAddr;
1524
+ method: string;
1525
+ packedArguments: bigint[];
1526
+ sanitizer: ContractAddr;
1527
+ id: string;
1528
+ }[];
1529
+ getDepositCall(params: DepositParams): Promise<ManageCall[]>;
1530
+ getProofsForFromLegacySwap<T>(tree: StandardMerkleTree): {
1531
+ proofs: string[][];
1532
+ callConstructor: GenerateCallFn<DepositParams> | GenerateCallFn<WithdrawParams>;
1533
+ };
1534
+ getSwapFromLegacyCall(params: DepositParams): Promise<ManageCall[]>;
1535
+ getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
1536
+ withdrawFromExtended(amount: Web3Number): Promise<boolean>;
1537
+ getHealthFactor(): Promise<number>;
1538
+ getExtendedDepositAmount(): Promise<Balance | undefined>;
1539
+ setLeverage(leverage: string, marketName: string): Promise<boolean>;
1540
+ getAllOpenPositions(): Promise<Position[] | null>;
1541
+ getOrderHistory(marketName: string): Promise<OpenOrder[] | null>;
1542
+ getOrderStatus(orderId: string, marketName: string): Promise<OpenOrder | null>;
1543
+ fetchOrderBookBTCUSDC(): Promise<{
1544
+ status: boolean;
1545
+ bid: Web3Number;
1546
+ ask: Web3Number;
1547
+ }>;
1548
+ createOrder(leverage: string, btcAmount: number, side: OrderSide, attempt?: number, maxAttempts?: number): Promise<{
1549
+ position_id: string;
1550
+ btc_exposure: string;
1551
+ } | null>;
1552
+ createExtendedPositon(client: ExtendedWrapper, marketName: string, amount: string, price: string, side: OrderSide): Promise<{
1553
+ position_id: string;
1554
+ } | null>;
1555
+ getDepositOrWithdrawalStatus(orderId: number | string, // for deposits, send txn hash as string
1556
+ operationsType: AssetOperationType): Promise<boolean>;
1557
+ }
1558
+
1559
+ declare const SIMPLE_SANITIZER: ContractAddr;
1560
+ declare const EXTENDED_SANITIZER: ContractAddr;
1561
+ declare const AVNU_LEGACY_SANITIZER: ContractAddr;
1562
+ declare const SIMPLE_SANITIZER_V2: ContractAddr;
1563
+ declare const VESU_V2_MODIFY_POSITION_SANITIZER: ContractAddr;
1564
+ declare const SIMPLE_SANITIZER_VESU_V1_DELEGATIONS: ContractAddr;
1565
+ declare const PRICE_ROUTER: ContractAddr;
1566
+ declare const AVNU_MIDDLEWARE: ContractAddr;
1567
+ declare const AVNU_EXCHANGE: ContractAddr;
1568
+ declare const AVNU_EXCHANGE_FOR_LEGACY_USDC: ContractAddr;
1569
+ declare const AVNU_QUOTE_URL = "https://starknet.api.avnu.fi/swap/v3/quotes";
1570
+ declare const EXTENDED_CONTRACT: ContractAddr;
1571
+ declare const VESU_SINGLETON: ContractAddr;
1572
+ declare function toBigInt(value: string | number): bigint;
1573
+
1574
+ interface UnusedBalanceAdapterConfig extends BaseAdapterConfig {
1575
+ }
1576
+ declare class UnusedBalanceAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
1577
+ readonly config: UnusedBalanceAdapterConfig;
1578
+ readonly tokenMarketData: TokenMarketData;
1579
+ constructor(config: UnusedBalanceAdapterConfig);
1580
+ protected getAPY(_supportedPosition: SupportedPosition): Promise<PositionAPY>;
1581
+ protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
1582
+ maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
1583
+ maxWithdraw(): Promise<PositionInfo>;
1584
+ protected _getDepositLeaf(): {
1585
+ target: ContractAddr;
1586
+ method: string;
1587
+ packedArguments: bigint[];
1588
+ sanitizer: ContractAddr;
1589
+ id: string;
1590
+ }[];
1591
+ protected _getWithdrawLeaf(): {
1592
+ target: ContractAddr;
1593
+ method: string;
1594
+ packedArguments: bigint[];
1595
+ sanitizer: ContractAddr;
1596
+ id: string;
1597
+ }[];
1598
+ getHealthFactor(): Promise<number>;
1599
+ getDepositCall(params: DepositParams): Promise<ManageCall[]>;
1600
+ getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
1601
+ }
1602
+
1603
+ interface DepositParamsForLendingBorrowing {
1604
+ supplyAmount: Web3Number;
1605
+ debtAmount: Web3Number;
1606
+ }
1607
+
1608
+ interface VesuBorrowSupplyAdapterConfig extends BaseAdapterConfig {
1609
+ poolId: ContractAddr;
1610
+ borrowToken: TokenInfo;
1611
+ supplyToken: TokenInfo;
1612
+ targetHealthFactor: number;
1613
+ minHealthFactor: number;
1614
+ quoteAmountToFetchPrice: Web3Number;
1615
+ vaultIdExtended: number;
1616
+ extendedContract: ContractAddr;
1617
+ extendedBackendUrl: string;
1618
+ extendedApiKey: string;
1619
+ extendedTimeout: number;
1620
+ extendedRetries: number;
1621
+ extendedBaseUrl: string;
1622
+ extendedMarketName: string;
1623
+ extendedPrecision: number;
1624
+ extendedAdapter: ExtendedAdapter;
1625
+ avnuAdapter: AvnuAdapter;
1626
+ retryDelayForOrderStatus: number;
1627
+ minimumExtendedMovementAmount: number;
1628
+ }
1629
+ declare class VesuBorrowSupplyAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
1630
+ readonly config: VesuBorrowSupplyAdapterConfig;
1631
+ readonly vesuAdapter: VesuAdapter;
1632
+ readonly tokenMarketData: TokenMarketData;
1633
+ protected extendedAdapter: ExtendedAdapter;
1634
+ constructor(config: VesuBorrowSupplyAdapterConfig);
1635
+ protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
1636
+ protected getPosition(supportedPosition: SupportedPosition): Promise<VaultPosition>;
1637
+ maxBorrowableAPY(): Promise<number>;
1638
+ maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
1639
+ maxWithdraw(): Promise<PositionInfo>;
1640
+ protected _getDepositLeaf(): {
1641
+ target: ContractAddr;
1642
+ method: string;
1643
+ packedArguments: bigint[];
1644
+ sanitizer: ContractAddr;
1645
+ id: string;
1646
+ }[];
1647
+ protected _getPayDebtLeaf(): {
1648
+ target: ContractAddr;
1649
+ method: string;
1650
+ packedArguments: bigint[];
1651
+ sanitizer: ContractAddr;
1652
+ id: string;
1653
+ }[];
1654
+ protected _getBorrowLeaf(): {
1655
+ target: ContractAddr;
1656
+ method: string;
1657
+ packedArguments: bigint[];
1658
+ sanitizer: ContractAddr;
1659
+ id: string;
1660
+ }[];
1661
+ protected _getMultiplyLeaf(): {
1662
+ target: ContractAddr;
1663
+ method: string;
1664
+ packedArguments: bigint[];
1665
+ sanitizer: ContractAddr;
1666
+ id: string;
1667
+ }[];
1668
+ protected _getWithdrawLeaf(): {
1669
+ target: ContractAddr;
1670
+ method: string;
1671
+ packedArguments: bigint[];
1672
+ sanitizer: ContractAddr;
1673
+ id: string;
1674
+ }[];
1675
+ getHealthFactor(): Promise<number>;
1676
+ getPayDebtLeaf(): AdapterLeafType<DepositParams>;
1677
+ getMultiplyLeaf(): AdapterLeafType<DepositParams>;
1678
+ getBorrowLeaf(): AdapterLeafType<DepositParams>;
1679
+ getDepositCall(params: DepositParams): Promise<ManageCall[]>;
1680
+ getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
1681
+ /**
1682
+ * Pay the debt amount against the collateral amount
1683
+ * @param params { supplyAmount: Web3Number; debtAmount: Web3Number; }
1684
+ * @returns { ManageCall[] }
1685
+ */
1686
+ getPayDebtCall(params: {
1687
+ supplyAmount: Web3Number;
1688
+ debtAmount: Web3Number;
1689
+ }): Promise<ManageCall[]>;
1690
+ /**
1691
+ * Increase the debt amount against the collateral amount
1692
+ * @param params { supplyAmount: Web3Number; debtAmount: Web3Number; }
1693
+ * @returns { ManageCall[] }
1694
+ */
1695
+ getBorrowCall(params: {
1696
+ supplyAmount: Web3Number;
1697
+ debtAmount: Web3Number;
1698
+ }): Promise<ManageCall[]>;
1699
+ private getMultiplyCall;
1700
+ private getMultiplyCallCalldata;
1701
+ private getWithdrawalMultiplyCalldata;
1702
+ formatMultiplyParams(isIncrease: boolean, params: IncreaseLeverParams | DecreaseLeverParams): {
1703
+ action: CairoCustomEnum;
1704
+ };
1705
+ private getLeverParams;
1706
+ /**
1707
+ * The amount for debt payment or taken is already calculated and sent here, in
1708
+ * In case of debt payment, amount is the debtToBe Repaid
1709
+ * In case of debt taken, amount is the added collateral
1710
+ * @returns
1711
+ */
1712
+ private getDepositCalldata;
1713
+ private getClosePositionCalldata;
1714
+ getProofsForDebtPayment<T>(tree: StandardMerkleTree): {
1715
+ proofs: string[][];
1716
+ callConstructor: GenerateCallFn<DepositParamsForLendingBorrowing>;
1717
+ };
1718
+ getProofsForBorrowing<T>(tree: StandardMerkleTree): {
1719
+ proofs: string[][];
1720
+ callConstructor: GenerateCallFn<DepositParamsForLendingBorrowing>;
1721
+ };
1722
+ getProofsForMultiply(tree: StandardMerkleTree): {
1723
+ proofs: string[][];
1724
+ callConstructor: GenerateCallFn<({
1725
+ amount: Web3Number;
1726
+ debtAmount: Web3Number;
1727
+ isWithdraw: boolean;
1728
+ closePosition: boolean;
1729
+ })>;
1730
+ };
1731
+ }
1732
+
1733
+ interface SingleActionAmount {
1734
+ tokenInfo: TokenInfo;
1735
+ amount: Web3Number;
1736
+ }
1737
+ interface SingleTokenInfo extends SingleActionAmount {
1738
+ usdValue: number;
1739
+ }
1740
+ interface APYInfo {
1741
+ net: number;
1742
+ splits: {
1743
+ apy: number;
1744
+ id: string;
1745
+ }[];
1746
+ }
1747
+ interface DualActionAmount {
1748
+ token0: SingleActionAmount;
1749
+ token1: SingleActionAmount;
1750
+ }
1751
+ interface DualTokenInfo {
1752
+ usdValue: number;
1753
+ token0: SingleTokenInfo;
1754
+ token1: SingleTokenInfo;
1755
+ }
1756
+ interface CacheData {
1757
+ timestamp: number;
1758
+ ttl: number;
1759
+ data: any;
1760
+ }
1761
+ declare class BaseStrategy<TVLInfo, ActionInfo> extends CacheClass {
1762
+ readonly config: IConfig;
1763
+ readonly cache: Map<string, CacheData>;
1764
+ constructor(config: IConfig);
1765
+ getUserTVL(user: ContractAddr): Promise<TVLInfo>;
1766
+ getTVL(): Promise<TVLInfo>;
1767
+ depositCall(amountInfo: ActionInfo, receiver: ContractAddr): Promise<Call[]>;
1768
+ withdrawCall(amountInfo: ActionInfo, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
1769
+ getVaultPositions(): Promise<VaultPosition[]>;
1770
+ getUnusedBalance(): Promise<SingleTokenInfo>;
1771
+ netAPY(): Promise<APYInfo>;
1772
+ getAUM(): Promise<{
1773
+ net: SingleTokenInfo;
1774
+ prevAum: Web3Number;
1775
+ splits: PositionInfo[];
1776
+ }>;
1777
+ getHealthFactors(): Promise<number[]>;
1778
+ }
1779
+
1780
+ /**
1781
+ * TokenMarketData class that combines LST APR and Midas modules
1782
+ * to provide unified APY, price, and TVL functions for tokens
1783
+ */
1784
+ declare class TokenMarketData {
1785
+ private pricer;
1786
+ private config;
1787
+ constructor(pricer: PricerBase, config: IConfig);
1788
+ /**
1789
+ * Get APY for a token
1790
+ * - If it's an LST token, returns LST APY
1791
+ * - If it's a Midas token, returns Midas APY
1792
+ * - Otherwise returns 0
1793
+ * @param tokenInfo The token to get APY for
1794
+ * @returns APY in absolute terms (not percentage)
1795
+ */
1796
+ getAPY(tokenInfo: TokenInfo): Promise<number>;
1797
+ /**
1798
+ * Get price for a token using the pricer module
1799
+ * @param tokenInfo The token to get price for
1800
+ * @returns Price as a number
1801
+ * @throws Error if price is 0 or unavailable
1802
+ */
1803
+ getPrice(tokenInfo: TokenInfo): Promise<number>;
1804
+ /**
1805
+ * Get true price for a token
1806
+ * - For LST tokens: Uses convert_to_assets to get true exchange rate
1807
+ * - For Midas tokens: Uses Midas price API
1808
+ * - For other tokens: Falls back to regular pricer
1809
+ * @param tokenInfo The token to get true price for
1810
+ * @returns True price as a number
1811
+ * @throws Error if price is 0 or unavailable
1812
+ */
1813
+ getTruePrice(tokenInfo: TokenInfo): Promise<number>;
1814
+ /**
1815
+ * Get TVL for a token
1816
+ * - If it's a Midas token, returns Midas TVL data
1817
+ * - Otherwise returns 0
1818
+ * @param tokenInfo The token to get TVL for
1819
+ * @returns TVL as SingleTokenInfo or 0
1820
+ */
1821
+ getTVL(tokenInfo: TokenInfo): Promise<SingleTokenInfo>;
1822
+ /**
1823
+ * Check if a token is supported for APY data
1824
+ * @param tokenInfo The token to check
1825
+ * @returns True if the token has APY data available
1826
+ */
1827
+ isAPYSupported(tokenInfo: TokenInfo): boolean;
1828
+ /**
1829
+ * Check if a token is supported for TVL data
1830
+ * @param tokenInfo The token to check
1831
+ * @returns True if the token has TVL data available
1832
+ */
1833
+ isTVLSupported(tokenInfo: TokenInfo): boolean;
1834
+ }
1835
+
1836
+ declare class Pragma {
1837
+ contractAddr: string;
1838
+ readonly contract: Contract;
1839
+ constructor(provider: RpcProvider);
1840
+ getPrice(tokenAddr: string): Promise<number>;
1841
+ }
1842
+
1843
+ declare class ZkLend extends ILending implements ILending {
1844
+ readonly pricer: Pricer;
1845
+ static readonly POOLS_URL = "https://app.zklend.com/api/pools";
1846
+ private POSITION_URL;
1847
+ constructor(config: IConfig, pricer: Pricer);
1848
+ init(): Promise<void>;
1849
+ /**
1850
+ * @description Get the health factor of the user for given lending and debt tokens
1851
+ * @param lending_tokens
1852
+ * @param debt_tokens
1853
+ * @param user
1854
+ * @returns hf (e.g. returns 1.5 for 150% health factor)
1855
+ */
1856
+ get_health_factor_tokenwise(lending_tokens: TokenInfo[], debt_tokens: TokenInfo[], user: ContractAddr): Promise<number>;
1857
+ /**
1858
+ * @description Get the health factor of the user
1859
+ * - Considers all tokens for collateral and debt
1860
+ */
1861
+ get_health_factor(user: ContractAddr): Promise<number>;
1862
+ getPositionsSummary(user: ContractAddr): Promise<{
1863
+ collateralUSD: number;
1864
+ debtUSD: number;
1865
+ }>;
1866
+ /**
1867
+ * @description Get the token-wise collateral and debt positions of the user
1868
+ * @param user Contract address of the user
1869
+ * @returns Promise<ILendingPosition[]>
1870
+ */
1871
+ getPositions(user: ContractAddr): Promise<ILendingPosition[]>;
1872
+ }
1873
+
1874
+ declare class PricerFromApi extends PricerBase {
1875
+ constructor(config: IConfig, tokens: TokenInfo[]);
1876
+ getPrice(tokenSymbol: string): Promise<PriceInfo>;
1877
+ getPriceFromMyAPI(tokenSymbol: string): Promise<{
1878
+ price: number;
1879
+ timestamp: Date;
1880
+ }>;
1881
+ }
1882
+
1883
+ declare class ERC20 {
1884
+ readonly config: IConfig;
1885
+ constructor(config: IConfig);
1886
+ contract(addr: string | ContractAddr): Contract;
1887
+ balanceOf(token: string | ContractAddr, address: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
1888
+ allowance(token: string | ContractAddr, owner: string | ContractAddr, spender: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
1889
+ transfer(token: string | ContractAddr, to: string | ContractAddr, amount: Web3Number): starknet.Call;
1890
+ approve(token: string | ContractAddr, spender: string | ContractAddr, amount: Web3Number): starknet.Call;
1891
+ }
1892
+
1893
+ declare class AutoCompounderSTRK {
1894
+ readonly config: IConfig;
1895
+ readonly addr: ContractAddr;
1896
+ readonly pricer: Pricer;
1897
+ private initialized;
1898
+ contract: Contract | null;
1899
+ readonly metadata: {
1900
+ decimals: number;
1901
+ underlying: {
1902
+ address: ContractAddr;
1903
+ name: string;
1904
+ symbol: string;
1905
+ };
1906
+ name: string;
1907
+ };
1908
+ constructor(config: IConfig, pricer: Pricer);
1909
+ init(): Promise<void>;
1910
+ waitForInitilisation(): Promise<void>;
1911
+ /** Returns shares of user */
1912
+ balanceOf(user: ContractAddr): Promise<Web3Number>;
1913
+ /** Returns underlying assets of user */
1914
+ balanceOfUnderlying(user: ContractAddr): Promise<Web3Number>;
1915
+ /** Returns usd value of assets */
1916
+ usdBalanceOfUnderlying(user: ContractAddr): Promise<{
1917
+ usd: Web3Number;
1918
+ assets: Web3Number;
1919
+ }>;
1920
+ }
1921
+
1922
+ interface PoolProps {
1923
+ pool_id: ContractAddr;
1924
+ max_weight: number;
1925
+ v_token: ContractAddr;
1926
+ }
1927
+ interface Change {
1928
+ pool_id: ContractAddr;
1929
+ changeAmt: Web3Number;
1930
+ finalAmt: Web3Number;
1931
+ isDeposit: boolean;
1932
+ }
1933
+ interface VesuRebalanceSettings {
1934
+ feeBps: number;
1935
+ }
1936
+ interface PoolInfoFull {
1937
+ pool_id: ContractAddr;
1938
+ pool_name: string | undefined;
1939
+ max_weight: number;
1940
+ current_weight: number;
1941
+ v_token: ContractAddr;
1942
+ amount: Web3Number;
1943
+ usdValue: Web3Number;
1944
+ APY: {
1945
+ baseApy: number;
1946
+ defiSpringApy: number;
1947
+ netApy: number;
1948
+ };
1949
+ currentUtilization: number;
1950
+ maxUtilization: number;
1951
+ }
1952
+ /**
1953
+ * Represents a VesuRebalance strategy.
1954
+ * This class implements an automated rebalancing strategy for Vesu pools,
1955
+ * managing deposits and withdrawals while optimizing yield through STRK rewards.
1956
+ */
1957
+ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
1958
+ /** Contract address of the strategy */
1959
+ readonly address: ContractAddr;
1960
+ /** Pricer instance for token price calculations */
1961
+ readonly pricer: PricerBase;
1962
+ /** Metadata containing strategy information */
1963
+ readonly metadata: IStrategyMetadata<VesuRebalanceSettings>;
1964
+ /** Contract instance for interacting with the strategy */
1965
+ readonly contract: Contract;
1966
+ readonly BASE_WEIGHT = 10000;
1967
+ /**
1968
+ * Creates a new VesuRebalance strategy instance.
1969
+ * @param config - Configuration object containing provider and other settings
1970
+ * @param pricer - Pricer instance for token price calculations
1971
+ * @param metadata - Strategy metadata including deposit tokens and address
1972
+ * @throws {Error} If more than one deposit token is specified
1973
+ */
1974
+ constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<VesuRebalanceSettings>);
1975
+ /**
1976
+ * Creates a deposit call to the strategy contract.
1977
+ * @param assets - Amount of assets to deposit
1978
+ * @param receiver - Address that will receive the strategy tokens
1979
+ * @returns Populated contract call for deposit
1980
+ */
1981
+ depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<starknet.Call[]>;
1982
+ /**
1983
+ * Creates a withdrawal call to the strategy contract.
1984
+ * @param assets - Amount of assets to withdraw
1985
+ * @param receiver - Address that will receive the withdrawn assets
1986
+ * @param owner - Address that owns the strategy tokens
1987
+ * @returns Populated contract call for withdrawal
1988
+ */
1989
+ withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<starknet.Call[]>;
1990
+ /**
1991
+ * Returns the underlying asset token of the strategy.
1992
+ * @returns The deposit token supported by this strategy
1993
+ */
1994
+ asset(): TokenInfo;
1995
+ /**
1996
+ * Returns the number of decimals used by the strategy token.
1997
+ * @returns Number of decimals (same as the underlying token)
1998
+ */
1999
+ decimals(): number;
2000
+ /**
2001
+ * Calculates the Total Value Locked (TVL) for a specific user.
2002
+ * @param user - Address of the user
2003
+ * @returns Object containing the amount in token units and USD value
2004
+ */
2005
+ getUserTVL(user: ContractAddr): Promise<{
2006
+ tokenInfo: TokenInfo;
1347
2007
  amount: Web3Number;
1348
2008
  usdValue: number;
1349
2009
  }>;
1350
- getUnusedBalance(): Promise<SingleTokenInfo>;
1351
- protected getVesuAUM(adapter: VesuAdapter): Promise<Web3Number>;
1352
- getPrevAUM(): Promise<Web3Number>;
1353
- getAUM(): Promise<{
1354
- net: SingleTokenInfo;
1355
- prevAum: Web3Number;
1356
- splits: {
1357
- id: string;
1358
- aum: Web3Number;
2010
+ /**
2011
+ * Calculates the total TVL of the strategy.
2012
+ * @returns Object containing the total amount in token units and USD value
2013
+ */
2014
+ getTVL(): Promise<{
2015
+ tokenInfo: TokenInfo;
2016
+ amount: Web3Number;
2017
+ usdValue: number;
2018
+ }>;
2019
+ static getAllPossibleVerifiedPools(asset: ContractAddr): Promise<any>;
2020
+ getPoolInfo(p: PoolProps, pools: any[], vesuPositions: any[], totalAssets: Web3Number, isErrorPositionsAPI: boolean, isErrorPoolsAPI: boolean): Promise<{
2021
+ pool_id: ContractAddr;
2022
+ pool_name: any;
2023
+ max_weight: number;
2024
+ current_weight: number;
2025
+ v_token: ContractAddr;
2026
+ amount: Web3Number;
2027
+ usdValue: Web3Number;
2028
+ APY: {
2029
+ baseApy: number;
2030
+ defiSpringApy: number;
2031
+ netApy: number;
2032
+ };
2033
+ currentUtilization: number;
2034
+ maxUtilization: number;
2035
+ }>;
2036
+ /**
2037
+ * Retrieves the list of allowed pools and their detailed information from multiple sources:
2038
+ * 1. Contract's allowed pools
2039
+ * 2. Vesu positions API for current positions
2040
+ * 3. Vesu pools API for APY and utilization data
2041
+ *
2042
+ * @returns {Promise<{
2043
+ * data: Array<PoolInfoFull>,
2044
+ * isErrorPositionsAPI: boolean
2045
+ * }>} Object containing:
2046
+ * - data: Array of pool information including IDs, weights, amounts, APYs and utilization
2047
+ * - isErrorPositionsAPI: Boolean indicating if there was an error fetching position data
2048
+ */
2049
+ getPools(): Promise<{
2050
+ data: {
2051
+ pool_id: ContractAddr;
2052
+ pool_name: any;
2053
+ max_weight: number;
2054
+ current_weight: number;
2055
+ v_token: ContractAddr;
2056
+ amount: Web3Number;
2057
+ usdValue: Web3Number;
2058
+ APY: {
2059
+ baseApy: number;
2060
+ defiSpringApy: number;
2061
+ netApy: number;
2062
+ };
2063
+ currentUtilization: number;
2064
+ maxUtilization: number;
1359
2065
  }[];
2066
+ isErrorPositionsAPI: boolean;
2067
+ isErrorPoolsAPI: boolean;
2068
+ isError: boolean;
2069
+ }>;
2070
+ getVesuPools(retry?: number): Promise<{
2071
+ pools: any[];
2072
+ isErrorPoolsAPI: boolean;
1360
2073
  }>;
1361
- protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
1362
- getVesuAdapters(): VesuAdapter[];
1363
- getVesuPositions(blockNumber?: BlockIdentifier): Promise<VaultPosition[]>;
1364
- getVaultPositions(): Promise<VaultPosition[]>;
1365
- getSetManagerCall(strategist: ContractAddr, root?: string): Call;
1366
- getManageCall(proofIds: string[], manageCalls: ManageCall[]): Call;
1367
- getVesuModifyPositionCalls(params: {
1368
- isLeg1: boolean;
1369
- isDeposit: boolean;
1370
- depositAmount: Web3Number;
1371
- debtAmount: Web3Number;
1372
- }): UniversalManageCall[];
1373
- getTag(): string;
1374
2074
  /**
1375
- * Gets LST APR for the strategy's underlying asset from Endur API
1376
- * @returns Promise<number> The LST APR (not divided by 1e18)
2075
+ * Calculates the weighted average APY across all pools based on USD value.
2076
+ * @returns {Promise<number>} The weighted average APY across all pools
2077
+ */
2078
+ netAPY(): Promise<APYInfo>;
2079
+ /**
2080
+ * Calculates the weighted average APY across all pools based on USD value.
2081
+ * @returns {Promise<number>} The weighted average APY across all pools
1377
2082
  */
1378
- getLSTAPR(address: ContractAddr): Promise<number>;
1379
- getVesuHealthFactors(blockNumber?: BlockIdentifier): Promise<number[]>;
1380
- computeRebalanceConditionAndReturnCalls(): Promise<Call[]>;
1381
- private getNewHealthFactor;
2083
+ netAPYGivenPools(pools: PoolInfoFull[]): Promise<number>;
1382
2084
  /**
2085
+ * Calculates optimal position changes to maximize APY while respecting max weights.
2086
+ * The algorithm:
2087
+ * 1. Sorts pools by APY (highest first)
2088
+ * 2. Calculates target amounts based on max weights
2089
+ * 3. For each pool that needs more funds:
2090
+ * - Takes funds from lowest APY pools that are over their target
2091
+ * 4. Validates that total assets remain constant
1383
2092
  *
1384
- * @param vesuAdapter
1385
- * @param currentHf
1386
- * @param isDeposit if true, attempt by adding collateral, else by repaying
1387
- * @returns
2093
+ * @returns {Promise<{
2094
+ * changes: Change[],
2095
+ * finalPools: PoolInfoFull[],
2096
+ * isAnyPoolOverMaxWeight: boolean
2097
+ * }>} Object containing:
2098
+ * - changes: Array of position changes
2099
+ * - finalPools: Array of pool information after rebalance
2100
+ * @throws Error if rebalance is not possible while maintaining constraints
1388
2101
  */
1389
- private getLegRebalanceAmount;
1390
- getVesuModifyPositionCall(params: {
1391
- isDeposit: boolean;
1392
- leg1DepositAmount: Web3Number;
1393
- }): Promise<Call>;
1394
- getBringLiquidityCall(params: {
1395
- amount: Web3Number;
1396
- }): Promise<Call>;
1397
- getPendingRewards(): Promise<HarvestInfo[]>;
1398
- getHarvestCall(): Promise<{
1399
- call: Call;
1400
- reward: Web3Number;
1401
- tokenInfo: TokenInfo;
2102
+ getRebalancedPositions(_pools?: PoolInfoFull[]): Promise<{
2103
+ changes: never[];
2104
+ finalPools: never[];
2105
+ isAnyPoolOverMaxWeight?: undefined;
2106
+ } | {
2107
+ changes: Change[];
2108
+ finalPools: PoolInfoFull[];
2109
+ isAnyPoolOverMaxWeight: boolean;
1402
2110
  }>;
1403
- getRebalanceCall(params: {
1404
- isLeg1toLeg2: boolean;
1405
- amount: Web3Number;
1406
- }): Promise<Call>;
2111
+ /**
2112
+ * Creates a rebalance Call object for the strategy contract
2113
+ * @param pools - Array of pool information including IDs, weights, amounts, APYs and utilization
2114
+ * @returns Populated contract call for rebalance
2115
+ */
2116
+ getRebalanceCall(pools: Awaited<ReturnType<typeof this.getRebalancedPositions>>["changes"], isOverWeightAdjustment: boolean): Promise<starknet.Call | null>;
2117
+ getInvestmentFlows(pools: PoolInfoFull[]): Promise<IInvestmentFlow[]>;
2118
+ harvest(acc: Account, endpoint?: string): Promise<starknet.Call[]>;
2119
+ /**
2120
+ * Calculates the fees deducted in different vTokens based on the current and previous state.
2121
+ * @param previousTotalSupply - The total supply of the strategy token before the transaction
2122
+ * @returns {Promise<Array<{ vToken: ContractAddr, fee: Web3Number }>>} Array of fees deducted in different vTokens
2123
+ */
2124
+ getFee(allowedPools: Array<PoolInfoFull>): Promise<Array<{
2125
+ vToken: ContractAddr;
2126
+ fee: Web3Number;
2127
+ }>>;
2128
+ }
2129
+ /**
2130
+ * Represents the Vesu Rebalance Strategies.
2131
+ */
2132
+ declare const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[];
2133
+
2134
+ interface SenseiVaultSettings {
2135
+ mainToken: TokenInfo;
2136
+ secondaryToken: TokenInfo;
2137
+ targetHfBps: number;
2138
+ feeBps: number;
2139
+ }
2140
+ declare class SenseiVault extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
2141
+ readonly address: ContractAddr;
2142
+ readonly metadata: IStrategyMetadata<SenseiVaultSettings>;
2143
+ readonly pricer: PricerBase;
2144
+ readonly contract: Contract;
2145
+ constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<SenseiVaultSettings>);
2146
+ getUserTVL(user: ContractAddr): Promise<SingleTokenInfo>;
2147
+ getTVL(): Promise<SingleTokenInfo>;
2148
+ depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
2149
+ withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
2150
+ getPositionInfo(): Promise<{
2151
+ collateralXSTRK: Web3Number;
2152
+ collateralUSDValue: Web3Number;
2153
+ debtSTRK: Web3Number;
2154
+ debtUSDValue: Web3Number;
2155
+ xSTRKPrice: number;
2156
+ collateralInSTRK: number;
2157
+ }>;
2158
+ getSecondaryTokenPriceRelativeToMain(retry?: number): Promise<number>;
2159
+ getSettings: () => Promise<starknet.CallResult>;
2160
+ }
2161
+ declare const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[];
2162
+
2163
+ interface UniversalManageCall {
2164
+ proofs: string[];
2165
+ manageCall: ManageCall;
2166
+ step: UNIVERSAL_MANAGE_IDS;
2167
+ }
2168
+ interface UniversalStrategySettings {
2169
+ vaultAddress: ContractAddr;
2170
+ manager: ContractAddr;
2171
+ vaultAllocator: ContractAddr;
2172
+ redeemRequestNFT: ContractAddr;
2173
+ leafAdapters: LeafAdapterFn<any>[];
2174
+ adapters: {
2175
+ id: string;
2176
+ adapter: BaseAdapter<DepositParams, WithdrawParams>;
2177
+ }[];
2178
+ }
2179
+ declare enum AUMTypes {
2180
+ FINALISED = "finalised",
2181
+ DEFISPRING = "defispring"
2182
+ }
2183
+ declare enum PositionTypeAvnuExtended {
2184
+ OPEN = "open",
2185
+ CLOSE = "close"
1407
2186
  }
1408
2187
  declare enum UNIVERSAL_MANAGE_IDS {
1409
2188
  FLASH_LOAN = "flash_loan_init",
@@ -1417,124 +2196,852 @@ declare enum UNIVERSAL_MANAGE_IDS {
1417
2196
  APPROVE_SWAP_TOKEN1 = "approve_swap_token1",
1418
2197
  AVNU_SWAP_REWARDS = "avnu_swap_rewards"
1419
2198
  }
1420
- declare enum UNIVERSAL_ADAPTERS {
1421
- COMMON = "common_adapter",
1422
- VESU_LEG1 = "vesu_leg1_adapter",
1423
- VESU_LEG2 = "vesu_leg2_adapter"
1424
- }
1425
- declare function getContractDetails(settings: UniversalStrategySettings): {
2199
+ declare function getContractDetails(settings: UniversalStrategySettings & {
2200
+ aumOracle?: ContractAddr;
2201
+ }): {
1426
2202
  address: ContractAddr;
1427
2203
  name: string;
1428
2204
  }[];
1429
- declare const UniversalStrategies: IStrategyMetadata<UniversalStrategySettings>[];
2205
+
2206
+ /**
2207
+ * Base class for all SVK (Starknet Vault Kit) strategies.
2208
+ * Contains common functions that are shared across all SVK strategies.
2209
+ */
2210
+ declare abstract class SVKStrategy<S extends UniversalStrategySettings> extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
2211
+ /** Contract address of the strategy */
2212
+ readonly address: ContractAddr;
2213
+ /** Pricer instance for token price calculations */
2214
+ readonly pricer: PricerBase;
2215
+ /** Metadata containing strategy information */
2216
+ readonly metadata: IStrategyMetadata<S>;
2217
+ /** Contract instance for interacting with the strategy */
2218
+ readonly contract: Contract;
2219
+ /** Manager contract instance for merkle verification */
2220
+ readonly managerContract: Contract;
2221
+ /** Cached merkle tree instance */
2222
+ merkleTree: StandardMerkleTree | undefined;
2223
+ constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
2224
+ /**
2225
+ * Returns the asset token for this strategy
2226
+ */
2227
+ asset(): TokenInfo;
2228
+ /**
2229
+ * Returns the unused balance in the vault allocator.
2230
+ * Note: This function is common for any SVK strategy.
2231
+ */
2232
+ getUnusedBalance(): Promise<SingleTokenInfo>;
2233
+ /**
2234
+ * Bridges liquidity from the vault allocator back to the vault.
2235
+ * Note: This function is common for any SVK strategy.
2236
+ */
2237
+ getBringLiquidityCall(params: {
2238
+ amount: Web3Number;
2239
+ }): Promise<Call>;
2240
+ /**
2241
+ * Gets all leaves from all leaf adapters.
2242
+ * Note: This function is common for any SVK strategy.
2243
+ */
2244
+ getAllLeaves(): LeafData[];
2245
+ /**
2246
+ * Builds and caches the merkle tree from all leaf adapters.
2247
+ * Note: This function is common for any SVK strategy.
2248
+ */
2249
+ getMerkleTree(): StandardMerkleTree;
2250
+ /**
2251
+ * Gets the merkle root of the tree.
2252
+ * Note: This function is common for any SVK strategy.
2253
+ */
2254
+ getMerkleRoot(): string;
2255
+ /**
2256
+ * Combines proofs and manage calls into a single Starknet call.
2257
+ * Note: This function is common for any SVK strategy.
2258
+ */
2259
+ getManageCall(proofGroups: string[][], manageCalls: ManageCall[]): Call;
2260
+ /**
2261
+ * Creates a call to set the merkle root on the manager contract.
2262
+ * Note: This function is common for any SVK strategy.
2263
+ */
2264
+ getSetManagerCall(strategist: ContractAddr, root?: string): Call;
2265
+ /**
2266
+ * Returns a tag for logging purposes.
2267
+ * Should be overridden by subclasses to provide strategy-specific tags.
2268
+ */
2269
+ abstract getTag(): string;
2270
+ /**
2271
+ * Returns the positions in the vault.
2272
+ * @returns An array of VaultPosition objects representing the positions in the vault.
2273
+ */
2274
+ getVaultPositions(): Promise<VaultPosition[]>;
2275
+ getHealthFactors(): Promise<number[]>;
2276
+ netAPY(): Promise<{
2277
+ net: number;
2278
+ splits: {
2279
+ apy: number;
2280
+ id: string;
2281
+ }[];
2282
+ }>;
2283
+ getPrevAUM(): Promise<Web3Number>;
2284
+ maxDepositables(): Promise<PositionInfo[]>;
2285
+ maxWithdrawables(): Promise<PositionInfo[]>;
2286
+ }
1430
2287
 
1431
2288
  interface HyperLSTStrategySettings extends UniversalStrategySettings {
1432
2289
  borrowable_assets: TokenInfo[];
1433
2290
  underlyingToken: TokenInfo;
1434
- defaultPoolId: ContractAddr;
1435
- altSupportedPoolIds: ContractAddr[];
2291
+ quoteAmountToFetchPrice: Web3Number;
2292
+ targetHealthFactor: number;
2293
+ minHealthFactor: number;
2294
+ aumOracle: ContractAddr;
1436
2295
  }
1437
- declare class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTStrategySettings> {
2296
+ declare class UniversalLstMultiplierStrategy<S extends HyperLSTStrategySettings> extends SVKStrategy<S> {
1438
2297
  private quoteAmountToFetchPrice;
1439
- constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<HyperLSTStrategySettings>);
1440
- asset(): TokenInfo;
2298
+ constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
1441
2299
  getTag(): string;
1442
- getVesuSameTokenAdapter(poolId: ContractAddr): VesuAdapter;
1443
- getVesuAdapters(): VesuAdapter[];
1444
- protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
1445
- getLSTDexPrice(): Promise<number>;
1446
- getAvnuSwapMultiplyCall(params: {
1447
- isDeposit: boolean;
1448
- leg1DepositAmount: Web3Number;
1449
- }): Promise<{
1450
- call: Call | undefined;
1451
- vesuAdapter: VesuAdapter;
1452
- }>;
1453
- _getAvnuDepositSwapLegCall(params: {
1454
- isDeposit: boolean;
1455
- leg1DepositAmount: Web3Number;
1456
- minHF: number;
1457
- vesuAdapter: VesuAdapter;
1458
- }): Promise<Call | undefined>;
1459
- getLSTMultiplierRebalanceCall(): Promise<{
1460
- shouldRebalance: boolean;
1461
- manageCalls: {
1462
- vesuAdapter: VesuAdapter;
1463
- manageCall: Call;
1464
- }[];
1465
- }>;
1466
- _getLSTMultiplierRebalanceCall(vesuAdapter: VesuAdapter): Promise<{
1467
- shouldRebalance: boolean;
1468
- manageCall: Call | undefined;
1469
- }>;
1470
- protected getVesuAUM(adapter: VesuAdapter): Promise<Web3Number>;
1471
- private _getMinOutputAmountLSTBuy;
1472
- private _getMinOutputAmountLSTSell;
2300
+ getVesuSameTokenAdapter(): VesuMultiplyAdapter;
2301
+ getVesuAdapters(): VesuMultiplyAdapter[];
1473
2302
  /**
1474
2303
  * Uses vesu's multiple call to create leverage on LST
1475
2304
  * Deposit amount is in LST
1476
2305
  * @param params
1477
2306
  */
1478
- getVesuMultiplyCall(params: {
2307
+ getFundManagementCall(params: {
1479
2308
  isDeposit: boolean;
1480
2309
  leg1DepositAmount: Web3Number;
1481
- maxEkuboPriceImpact?: number;
1482
- poolId: ContractAddr;
1483
- }): Promise<Call[]>;
2310
+ }): Promise<Call[] | null>;
1484
2311
  getLSTUnderlyingTokenInfo(): TokenInfo;
1485
- getMaxBorrowableAmount(params?: {
1486
- isAPYComputation: boolean;
1487
- }): Promise<{
1488
- netMaxBorrowableAmount: Web3Number;
1489
- maxBorrowables: {
1490
- amount: Web3Number;
1491
- dexSwappableAmount: Web3Number;
1492
- maxBorrowableAmount: Web3Number;
1493
- borrowableAsset: TokenInfo;
1494
- ltv: number;
1495
- }[];
2312
+ getAUM(): Promise<{
2313
+ net: SingleTokenInfo;
2314
+ prevAum: Web3Number;
2315
+ splits: PositionInfo[];
2316
+ }>;
2317
+ }
2318
+ declare const AUDIT_URL = "https://docs.troves.fi/p/security#starknet-vault-kit";
2319
+ declare function getFAQs(lstSymbol: string, underlyingSymbol: string, isLST: boolean): FAQ[];
2320
+ declare const _riskFactor: RiskFactor[];
2321
+ declare function getInvestmentSteps(lstSymbol: string, underlyingSymbol: string): string[];
2322
+ declare const HyperLSTStrategies: IStrategyMetadata<HyperLSTStrategySettings>[];
2323
+
2324
+ declare abstract class Operations$1 {
2325
+ abstract shouldMoveAssets(extendedAmount: Web3Number, vesuAmount: Web3Number): Promise<Call[]>;
2326
+ abstract shouldInvest(): Promise<{
2327
+ shouldInvest: boolean;
2328
+ vesuAmount: Web3Number;
2329
+ extendedAmount: Web3Number;
2330
+ extendedLeverage: number;
2331
+ vesuLeverage: number;
2332
+ }>;
2333
+ abstract moveAssets(params: {
2334
+ from: string;
2335
+ to: string;
2336
+ amount: Web3Number;
2337
+ }, extendedAdapter: ExtendedAdapter, vesuAdapter: VesuMultiplyAdapter): Promise<{
2338
+ calls: Call[];
2339
+ status: boolean;
2340
+ }>;
2341
+ abstract handleDeposit(): Promise<{
2342
+ extendedAmountInBTC: Web3Number;
2343
+ calls: Call[];
2344
+ }>;
2345
+ abstract handleWithdraw(amount: Web3Number): Promise<{
2346
+ calls: Call[];
2347
+ status: boolean;
2348
+ }>;
2349
+ }
2350
+
2351
+ interface VesuExtendedStrategySettings extends UniversalStrategySettings {
2352
+ underlyingToken: TokenInfo;
2353
+ borrowable_assets: TokenInfo[];
2354
+ targetHealthFactor: number;
2355
+ quoteAmountToFetchPrice: Web3Number;
2356
+ minHealthFactor: number;
2357
+ aumOracle: ContractAddr;
2358
+ minimumWBTCDifferenceForAvnuSwap: number;
2359
+ }
2360
+ declare class VesuExtendedMultiplierStrategy<S extends VesuExtendedStrategySettings> extends SVKStrategy<S> implements Operations$1 {
2361
+ constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
2362
+ getTag(): string;
2363
+ getAssetPrices(): Promise<{
2364
+ collateralPrice: PriceInfo;
2365
+ debtPrice: PriceInfo;
2366
+ }>;
2367
+ getUnusedBalanceUSDCE(): Promise<SingleTokenInfo>;
2368
+ getUnusedBalanceWBTC(): Promise<SingleTokenInfo>;
2369
+ getVesuAdapter(): Promise<VesuMultiplyAdapter | null>;
2370
+ getAvnuAdapter(): Promise<AvnuAdapter | null>;
2371
+ getExtendedAdapter(): Promise<ExtendedAdapter | null>;
2372
+ moveAssetsToVaultAllocator(amount: Web3Number, extendedAdapter: ExtendedAdapter): Promise<Call[]>;
2373
+ shouldInvest(): Promise<{
2374
+ shouldInvest: boolean;
2375
+ vesuAmount: Web3Number;
2376
+ extendedAmount: Web3Number;
2377
+ extendedLeverage: number;
2378
+ collateralPrice: number;
2379
+ debtPrice: number;
2380
+ vesuLeverage: number;
2381
+ }>;
2382
+ shouldMoveAssets(extendedAmount: Web3Number, vesuAmount: Web3Number): Promise<Call[]>;
2383
+ moveAssets(params: {
2384
+ amount: Web3Number;
2385
+ from: string;
2386
+ to: string;
2387
+ }, extendedAdapter: ExtendedAdapter, vesuAdapter: VesuMultiplyAdapter): Promise<{
2388
+ calls: Call[];
2389
+ status: boolean;
2390
+ }>;
2391
+ handleDeposit(): Promise<{
2392
+ extendedAmountInBTC: Web3Number;
2393
+ calls: Call[];
2394
+ }>;
2395
+ checkPriceDifferenceBetweenAvnuAndExtended(extendedAdapter: ExtendedAdapter, vesuAdapter: VesuMultiplyAdapter, avnuAdapter: AvnuAdapter, positionType: PositionTypeAvnuExtended): Promise<boolean>;
2396
+ handleWithdraw(amount: Web3Number): Promise<{
2397
+ calls: Call[];
2398
+ status: boolean;
2399
+ }>;
2400
+ getAUM(): Promise<{
2401
+ net: SingleTokenInfo;
2402
+ prevAum: Web3Number;
2403
+ splits: PositionInfo[];
2404
+ }>;
2405
+ }
2406
+ declare const VesuExtendedTestStrategies: (extendedBackendUrl: string, extendedApiKey: string, vaultIdExtended: number, minimumExtendedMovementAmount: number, minimumVesuMovementAmount: number, minimumExtendedRetriesDelayForOrderStatus: number, minimumExtendedPriceDifferenceForSwapOpen: number, maximumExtendedPriceDifferenceForSwapClosing: number) => IStrategyMetadata<VesuExtendedStrategySettings>[];
2407
+
2408
+ declare const AddressesConfig: {
2409
+ readonly tokens: {
2410
+ readonly USDC: {
2411
+ readonly address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8";
2412
+ readonly decimals: 6;
2413
+ };
2414
+ readonly WBTC: {
2415
+ readonly address: "0x3fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac";
2416
+ readonly decimals: 8;
2417
+ };
2418
+ };
2419
+ readonly contracts: {
2420
+ readonly EXTENDED: "0x062da0780fae50d68cecaa5a051606dc21217ba290969b302db4dd99d2e9b470";
2421
+ readonly MULTIPLY: "0x07964760e90baa28841ec94714151e03fbc13321797e68a874e88f27c9d58513";
2422
+ };
2423
+ readonly wallet: {
2424
+ readonly address: string;
2425
+ };
2426
+ };
2427
+ declare const ExtendedConfig: {
2428
+ readonly baseUrl: string;
2429
+ readonly marketName: "BTC-USD";
2430
+ readonly maintenanceMargin: 0.01;
2431
+ readonly precision: 5;
2432
+ readonly fees: number;
2433
+ readonly minPositionSize: 0.0001;
2434
+ };
2435
+ declare const VesuConfig: {
2436
+ readonly poolId: "0x02eef0c13b10b487ea5916b54c0a7f98ec43fb3048f60fdeedaf5b08f6f88aaf";
2437
+ readonly maxLtv: 0.8428;
2438
+ readonly maxLiquidationRatio: 0.86;
2439
+ readonly targetHealthFactor: number;
2440
+ readonly ekubo: {
2441
+ readonly endpoint: "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_FROM_ADDRESS}}/{{TOKEN_TO_ADDRESS}}";
2442
+ readonly priceMaxSlippage: number;
2443
+ };
2444
+ readonly avnu: {
2445
+ readonly api: "https://starknet.api.avnu.fi/swap/v2/quotes";
2446
+ };
2447
+ readonly minDebtForVesuRebalacing: number;
2448
+ };
2449
+ declare const AbisConfig: {
2450
+ readonly vesu: {
2451
+ readonly multiply: ({
2452
+ type: string;
2453
+ name: string;
2454
+ interface_name: string;
2455
+ members?: undefined;
2456
+ items?: undefined;
2457
+ variants?: undefined;
2458
+ inputs?: undefined;
2459
+ kind?: undefined;
2460
+ } | {
2461
+ type: string;
2462
+ name: string;
2463
+ members: {
2464
+ name: string;
2465
+ type: string;
2466
+ }[];
2467
+ interface_name?: undefined;
2468
+ items?: undefined;
2469
+ variants?: undefined;
2470
+ inputs?: undefined;
2471
+ kind?: undefined;
2472
+ } | {
2473
+ type: string;
2474
+ name: string;
2475
+ items: {
2476
+ type: string;
2477
+ name: string;
2478
+ inputs: {
2479
+ name: string;
2480
+ type: string;
2481
+ }[];
2482
+ outputs: {
2483
+ type: string;
2484
+ }[];
2485
+ state_mutability: string;
2486
+ }[];
2487
+ interface_name?: undefined;
2488
+ members?: undefined;
2489
+ variants?: undefined;
2490
+ inputs?: undefined;
2491
+ kind?: undefined;
2492
+ } | {
2493
+ type: string;
2494
+ name: string;
2495
+ variants: {
2496
+ name: string;
2497
+ type: string;
2498
+ }[];
2499
+ interface_name?: undefined;
2500
+ members?: undefined;
2501
+ items?: undefined;
2502
+ inputs?: undefined;
2503
+ kind?: undefined;
2504
+ } | {
2505
+ type: string;
2506
+ name: string;
2507
+ inputs: {
2508
+ name: string;
2509
+ type: string;
2510
+ }[];
2511
+ interface_name?: undefined;
2512
+ members?: undefined;
2513
+ items?: undefined;
2514
+ variants?: undefined;
2515
+ kind?: undefined;
2516
+ } | {
2517
+ type: string;
2518
+ name: string;
2519
+ kind: string;
2520
+ members: {
2521
+ name: string;
2522
+ type: string;
2523
+ kind: string;
2524
+ }[];
2525
+ interface_name?: undefined;
2526
+ items?: undefined;
2527
+ variants?: undefined;
2528
+ inputs?: undefined;
2529
+ } | {
2530
+ type: string;
2531
+ name: string;
2532
+ kind: string;
2533
+ variants: {
2534
+ name: string;
2535
+ type: string;
2536
+ kind: string;
2537
+ }[];
2538
+ interface_name?: undefined;
2539
+ members?: undefined;
2540
+ items?: undefined;
2541
+ inputs?: undefined;
2542
+ })[];
2543
+ readonly pool: ({
2544
+ type: string;
2545
+ name: string;
2546
+ interface_name: string;
2547
+ members?: undefined;
2548
+ variants?: undefined;
2549
+ items?: undefined;
2550
+ inputs?: undefined;
2551
+ kind?: undefined;
2552
+ } | {
2553
+ type: string;
2554
+ name: string;
2555
+ members: {
2556
+ name: string;
2557
+ type: string;
2558
+ }[];
2559
+ interface_name?: undefined;
2560
+ variants?: undefined;
2561
+ items?: undefined;
2562
+ inputs?: undefined;
2563
+ kind?: undefined;
2564
+ } | {
2565
+ type: string;
2566
+ name: string;
2567
+ variants: {
2568
+ name: string;
2569
+ type: string;
2570
+ }[];
2571
+ interface_name?: undefined;
2572
+ members?: undefined;
2573
+ items?: undefined;
2574
+ inputs?: undefined;
2575
+ kind?: undefined;
2576
+ } | {
2577
+ type: string;
2578
+ name: string;
2579
+ items: {
2580
+ type: string;
2581
+ name: string;
2582
+ inputs: {
2583
+ name: string;
2584
+ type: string;
2585
+ }[];
2586
+ outputs: {
2587
+ type: string;
2588
+ }[];
2589
+ state_mutability: string;
2590
+ }[];
2591
+ interface_name?: undefined;
2592
+ members?: undefined;
2593
+ variants?: undefined;
2594
+ inputs?: undefined;
2595
+ kind?: undefined;
2596
+ } | {
2597
+ type: string;
2598
+ name: string;
2599
+ inputs: {
2600
+ name: string;
2601
+ type: string;
2602
+ }[];
2603
+ interface_name?: undefined;
2604
+ members?: undefined;
2605
+ variants?: undefined;
2606
+ items?: undefined;
2607
+ kind?: undefined;
2608
+ } | {
2609
+ type: string;
2610
+ name: string;
2611
+ kind: string;
2612
+ members: {
2613
+ name: string;
2614
+ type: string;
2615
+ kind: string;
2616
+ }[];
2617
+ interface_name?: undefined;
2618
+ variants?: undefined;
2619
+ items?: undefined;
2620
+ inputs?: undefined;
2621
+ } | {
2622
+ type: string;
2623
+ name: string;
2624
+ kind: string;
2625
+ variants: {
2626
+ name: string;
2627
+ type: string;
2628
+ kind: string;
2629
+ }[];
2630
+ interface_name?: undefined;
2631
+ members?: undefined;
2632
+ items?: undefined;
2633
+ inputs?: undefined;
2634
+ })[];
2635
+ };
2636
+ readonly extended: {
2637
+ readonly contract: ({
2638
+ type: string;
2639
+ name: string;
2640
+ interface_name: string;
2641
+ members?: undefined;
2642
+ variants?: undefined;
2643
+ items?: undefined;
2644
+ inputs?: undefined;
2645
+ kind?: undefined;
2646
+ } | {
2647
+ type: string;
2648
+ name: string;
2649
+ members: {
2650
+ name: string;
2651
+ type: string;
2652
+ }[];
2653
+ interface_name?: undefined;
2654
+ variants?: undefined;
2655
+ items?: undefined;
2656
+ inputs?: undefined;
2657
+ kind?: undefined;
2658
+ } | {
2659
+ type: string;
2660
+ name: string;
2661
+ variants: {
2662
+ name: string;
2663
+ type: string;
2664
+ }[];
2665
+ interface_name?: undefined;
2666
+ members?: undefined;
2667
+ items?: undefined;
2668
+ inputs?: undefined;
2669
+ kind?: undefined;
2670
+ } | {
2671
+ type: string;
2672
+ name: string;
2673
+ items: {
2674
+ type: string;
2675
+ name: string;
2676
+ inputs: {
2677
+ name: string;
2678
+ type: string;
2679
+ }[];
2680
+ outputs: {
2681
+ type: string;
2682
+ }[];
2683
+ state_mutability: string;
2684
+ }[];
2685
+ interface_name?: undefined;
2686
+ members?: undefined;
2687
+ variants?: undefined;
2688
+ inputs?: undefined;
2689
+ kind?: undefined;
2690
+ } | {
2691
+ type: string;
2692
+ name: string;
2693
+ inputs: {
2694
+ name: string;
2695
+ type: string;
2696
+ }[];
2697
+ interface_name?: undefined;
2698
+ members?: undefined;
2699
+ variants?: undefined;
2700
+ items?: undefined;
2701
+ kind?: undefined;
2702
+ } | {
2703
+ type: string;
2704
+ name: string;
2705
+ kind: string;
2706
+ members: {
2707
+ name: string;
2708
+ type: string;
2709
+ kind: string;
2710
+ }[];
2711
+ interface_name?: undefined;
2712
+ variants?: undefined;
2713
+ items?: undefined;
2714
+ inputs?: undefined;
2715
+ } | {
2716
+ type: string;
2717
+ name: string;
2718
+ kind: string;
2719
+ variants: {
2720
+ name: string;
2721
+ type: string;
2722
+ kind: string;
2723
+ }[];
2724
+ interface_name?: undefined;
2725
+ members?: undefined;
2726
+ items?: undefined;
2727
+ inputs?: undefined;
2728
+ })[];
2729
+ };
2730
+ };
2731
+
2732
+ /**
2733
+ * Function to return formatted amount to BigInt
2734
+ * Converts a decimal amount to the proper format for blockchain transactions
2735
+ * @param {number} amount - The decimal amount to convert
2736
+ * @param {number} fromTokenDecimals - The decimal precision of the token
2737
+ * @returns {string} The formatted amount as a hexadecimal string
2738
+ */
2739
+ declare const returnFormattedAmount: (amount: number, toTokenDecimals: number) => string;
2740
+ /**
2741
+ * calculates the amount to distribute to Extend and Vesu
2742
+ * Determines how much to allocate to each platform based on leverage calculations
2743
+ * @param {number} amount - The total amount to distribute
2744
+ * @returns {object} Object containing avnu_amount, extended_amount, and extended_leverage
2745
+ */
2746
+ declare const calculateAmountDistribution: (amount: number, client: ExtendedWrapper, marketName: string, collateralPrice: number, debtPrice: number, collateralUnits: Web3Number, extendedPosition: Position[] | null) => Promise<{
2747
+ vesu_amount: Web3Number;
2748
+ extended_amount: Web3Number;
2749
+ extended_leverage: number;
2750
+ vesu_leverage: number;
2751
+ }>;
2752
+ /**
2753
+ * calculate the amount distribution for withdrawal
2754
+ * @param amount - The amount to withdraw
2755
+ * @param client - The client
2756
+ * @param marketName - The market name
2757
+ * @returns {object} Object containing avnu_amount and extended_amount
2758
+ */
2759
+ declare const calculateAmountDistributionForWithdrawal: (amountInUsdc: Web3Number, collateralPrice: number, collateralUnits: Web3Number, extendedPosition: Position[] | null) => Promise<{
2760
+ vesu_amount: Web3Number;
2761
+ extended_amount: Web3Number;
2762
+ extended_leverage: number;
2763
+ vesu_leverage: number;
2764
+ } | null>;
2765
+ /**
2766
+ * calculate the leverage required for Avnu
2767
+ * calculates the optimal leverage for Avnu based on LTV ratios and price drop protection
2768
+ * @returns {number} The calculated leverage value
2769
+ */
2770
+ declare const calculateVesuLeverage: () => number;
2771
+ /**
2772
+ * calculate leverage for extended
2773
+ * calculates the maximum safe leverage for Extended based on maintenance margin and price drop protection
2774
+ * @returns {number} The calculated leverage value
2775
+ */
2776
+ declare const calculateExtendedLevergae: () => number;
2777
+ /**
2778
+ * calculates the debt amount for leverage operations
2779
+ * Determines how much debt to add or remove based on collateral changes and target health factor
2780
+ * @param {Web3Number} collateralAmount - Current collateral amount
2781
+ * @param {Web3Number} debtAmount - Current debt amount
2782
+ * @param {number} debtPrice - Current price of the debt token
2783
+ * @param {number} maxLtv - Maximum loan-to-value ratio (default: MAX_LTV_BTC_USDC)
2784
+ * @param {number} addedAmount - Amount being added to collateral
2785
+ * @param {number} collateralPrice - Current price of the collateral token
2786
+ * @param {boolean} isDeposit - Whether this is a deposit (true) or withdrawal (false)
2787
+ * @returns {object} Object containing deltadebtAmountUnits and isIncrease flag
2788
+ */
2789
+ declare const calculateDebtAmount: (collateralAmount: Web3Number, debtAmount: Web3Number, debtPrice: number, maxLtv: number | undefined, addedAmount: Web3Number, // this is in btc
2790
+ collateralPrice: number, isDeposit: boolean) => {
2791
+ deltadebtAmountUnits: Web3Number;
2792
+ isIncrease: boolean;
2793
+ } | {
2794
+ deltadebtAmountUnits: null;
2795
+ isIncrease: null;
2796
+ };
2797
+ /**
2798
+ * calculate the debt amount to be repaid for withdrawal
2799
+ * @param debtAmount in debt units
2800
+ * @param collateralAmount in collateral units
2801
+ * @param maxLtv in percentage
2802
+ * @param withdrawalAmount in collateral units
2803
+ * @param collateralPrice in usd
2804
+ * @param debtPrice in usd
2805
+ * @returns deltadebtAmountUnits in debt units
2806
+ * isIncrease: true if the debt amount is increasing, false if it is decreasing
2807
+ */
2808
+ declare const calculateDebtReductionAmountForWithdrawal: (debtAmount: Web3Number, collateralAmount: Web3Number, maxLtv: number | undefined, withdrawalAmount: Web3Number, collateralPrice: number, debtPrice: number, usdcDecimals: number) => {
2809
+ deltadebtAmountUnits: string;
2810
+ } | {
2811
+ deltadebtAmountUnits: null;
2812
+ };
2813
+ /**
2814
+ * calculate the amount to deposit on extended when incurring losses
2815
+ * @param client - The client
2816
+ * @returns The amount to deposit on extended when incurring losses
2817
+ */
2818
+ declare const calculateAmountDepositOnExtendedWhenIncurringLosses: (client: ExtendedWrapper) => Promise<Web3Number | null>;
2819
+ declare const calculateExposureDelta: (exposure_extended: number, exposure_vesu: number) => number;
2820
+ /**
2821
+ * calculate the delta percentage between the current btc price and the last btc price
2822
+ * @param {number} btcPrice - The current btc price
2823
+ * @param {number} lastBtcPrice - The last btc price
2824
+ * @returns {number} The delta percentage
2825
+ */
2826
+ declare const calculateBTCPriceDelta: (btcPrice: number, lastBtcPrice: number) => number;
2827
+ declare const calculateVesUPositionSizeGivenExtended: (extendedPositonValue: number, extendedHoldingAmount: Web3Number, collateralAmount: Web3Number, collateralPrice: number) => {
2828
+ vesuAmountInUsd: string;
2829
+ vesuAmountInBTC: Web3Number;
2830
+ extendedAmountInBTC: string;
2831
+ };
2832
+
2833
+ declare abstract class Operations {
2834
+ abstract shouldMoveAssets(extendedAmount: Web3Number, vesuAmount: Web3Number): Promise<Call[]>;
2835
+ abstract shouldInvest(): Promise<{
2836
+ shouldInvest: boolean;
2837
+ collateralPrice: number;
2838
+ wbtcAmountForStage1: Web3Number;
2839
+ } | null>;
2840
+ abstract moveAssets(params: {
2841
+ from: string;
2842
+ to: string;
2843
+ amount: Web3Number;
2844
+ }, extendedAdapter: ExtendedAdapter, vesuAdapter: VesuMultiplyAdapter): Promise<{
2845
+ calls: Call[];
2846
+ status: boolean;
2847
+ }>;
2848
+ abstract handleWithdraw(amount: Web3Number): Promise<{
2849
+ calls: Call[];
2850
+ status: boolean;
2851
+ }>;
2852
+ abstract handleStage2Positions(): Promise<{
2853
+ decisiveFactor: Web3Number;
2854
+ vesuAmountInUSDC: Web3Number;
2855
+ extendedAmountInUSDC: Web3Number;
2856
+ }>;
2857
+ }
2858
+
2859
+ interface BtcFiVesuExtendedStrategySettings extends UniversalStrategySettings {
2860
+ underlyingToken: TokenInfo;
2861
+ borrowable_assets: TokenInfo[];
2862
+ targetHealthFactor: number;
2863
+ quoteAmountToFetchPrice: Web3Number;
2864
+ minHealthFactor: number;
2865
+ aumOracle: ContractAddr;
2866
+ minimumWBTCDifferenceForAvnuSwap: number;
2867
+ }
2868
+ declare class BtcFiVesuExtendedStrategy<S extends BtcFiVesuExtendedStrategySettings> extends SVKStrategy<S> implements Operations {
2869
+ constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
2870
+ getTag(): string;
2871
+ getAssetPrices(): Promise<{
2872
+ collateralPrice: PriceInfo;
2873
+ debtPrice: PriceInfo;
2874
+ }>;
2875
+ getUnusedBalanceUSDC(): Promise<SingleTokenInfo>;
2876
+ getVesuBorrowSupplyAdapter(): Promise<VesuBorrowSupplyAdapter | null>;
2877
+ getVesuAdapter(): Promise<VesuMultiplyAdapter | null>;
2878
+ getAvnuAdapter(): Promise<AvnuAdapter | null>;
2879
+ getExtendedAdapter(): Promise<ExtendedAdapter | null>;
2880
+ moveAssetsToVaultAllocator(amount: Web3Number, extendedAdapter: ExtendedAdapter): Promise<Call[]>;
2881
+ shouldInvest(): Promise<{
2882
+ shouldInvest: boolean;
2883
+ collateralPrice: number;
2884
+ wbtcAmountForStage1: Web3Number;
2885
+ } | null>;
2886
+ shouldMoveAssets(vesuAmount: Web3Number, extendedAmount: Web3Number): Promise<Call[]>;
2887
+ moveAssetsFromVesuToVault(amountInWbtc: Web3Number, vesuBorrowSupplyAdapter: VesuBorrowSupplyAdapter, vesuMultiplyAdapter: VesuMultiplyAdapter): Promise<{
2888
+ calls: Call[];
2889
+ status: boolean;
1496
2890
  }>;
1497
- getMaxSwappableWithMaxSlippage(fromToken: TokenInfo, toToken: TokenInfo, maxSlippage: number, maxAmount: Web3Number): Promise<Web3Number>;
1498
- getMaxBorrowableAmountByVesuAdapter(vesuAdapter: VesuAdapter, isAPYComputation: boolean): Promise<{
2891
+ /**
2892
+ * This function returns the calls used to move assets from one protocol to another
2893
+ * @param params - The parameters for the move assets operation
2894
+ * @param extendedAdapter - The extended adapter
2895
+ * @param vesuAdapter - The vesu adapter
2896
+ * @returns The calls to be made to the protocols
2897
+ */
2898
+ moveAssets(params: {
2899
+ from: string;
2900
+ to: string;
1499
2901
  amount: Web3Number;
1500
- dexSwappableAmount: Web3Number;
1501
- maxBorrowableAmount: Web3Number;
1502
- borrowableAsset: TokenInfo;
2902
+ }, extendedAdapter: ExtendedAdapter, vesuAdapter: VesuMultiplyAdapter): Promise<{
2903
+ calls: Call[];
2904
+ status: boolean;
1503
2905
  }>;
1504
2906
  /**
1505
- * Gets LST APR for the strategy's underlying asset from Endur API
1506
- * @returns Promise<number> The LST APR (not divided by 1e18)
2907
+ * amountInWbtc is the amount of wbtc tokens on vault allocator deposited by the user, to be used as collateral for borrowing usdc from vesu
2908
+ * This function is used to first lend wbtc and then borrow usdc from vesu
2909
+ * @returns { extendedAmountInBTC: Web3Number; calls: Call[]; }
2910
+ * extendedAmountInBTC: The amount of BTC that is needed to be deposited to the extended contract
2911
+ * calls: The calls to be made to the extended contract
1507
2912
  */
1508
- getLSTAPR(_address: ContractAddr): Promise<number>;
1509
- netAPY(): Promise<{
1510
- net: number;
1511
- splits: {
1512
- apy: number;
1513
- id: string;
1514
- }[];
2913
+ handleLendingBorrowingForStage1(amountInWBTC: Web3Number): Promise<{
2914
+ calls: Call[];
2915
+ debtTaken: Web3Number;
1515
2916
  }>;
1516
- maxNewDeposits(params?: {
1517
- isAPYComputation: boolean;
1518
- }): Promise<number>;
1519
- protected getUnusedBalanceAPY(): Promise<{
1520
- apy: number;
1521
- weight: number;
2917
+ /**
2918
+ * This function is used to withdraw the assets from the vault positions to the vault allocator
2919
+ * @param amount is the amount of wbtc to be arranged
2920
+ * @returns { calls: Call[]; status: boolean; }
2921
+ * calls: The calls to be made to the avnu contract
2922
+ * status: The status of the withdrawal
2923
+ */
2924
+ handleWithdraw(amount: Web3Number): Promise<{
2925
+ calls: Call[];
2926
+ status: boolean;
1522
2927
  }>;
1523
- getLSTExchangeRate(): Promise<number>;
1524
2928
  /**
1525
- *
1526
- * @param params marginAmount is in LST, debtAmount is in underlying
2929
+ * This function is used to handle the stage 2 positions, that is opening leveraged positions on extended and vesu
2930
+ * @returns { decisiveFactor: Web3Number; vesuAmountInUSDC: Web3Number; extendedAmountInUSDC: Web3Number; }
2931
+ * decisiveFactor: The decisive factor for the stage 2 positions
2932
+ * vesuAmountInUSDC: The amount of usdc to be invested in vesu
2933
+ * extendedAmountInUSDC: The amount of usdc to be invested in extended
1527
2934
  */
1528
- getModifyLeverCall(params: {
1529
- marginAmount: Web3Number;
1530
- debtAmount: Web3Number;
1531
- lstDexPriceInUnderlying: number;
1532
- isIncrease: boolean;
1533
- maxEkuboPriceImpact: number;
1534
- poolId: ContractAddr;
1535
- }): Promise<Call[]>;
2935
+ handleStage2Positions(): Promise<{
2936
+ decisiveFactor: Web3Number;
2937
+ vesuAmountInUSDC: Web3Number;
2938
+ extendedAmountInUSDC: Web3Number;
2939
+ }>;
2940
+ /**
2941
+ * This function is used to check the price difference between avnu and extended
2942
+ * @param extendedAdapter - The extended adapter
2943
+ * @param vesuAdapter - The vesu adapter
2944
+ * @param avnuAdapter - The avnu adapter
2945
+ * @param positionType - The position type
2946
+ * @returns { boolean } - The result of the check
2947
+ * true if the price difference is greater than the minimum price difference for swap opening
2948
+ * false if the price difference is less than the minimum price difference for swap opening
2949
+ */
2950
+ checkPriceDifferenceBetweenAvnuAndExtended(extendedAdapter: ExtendedAdapter, vesuAdapter: VesuMultiplyAdapter, avnuAdapter: AvnuAdapter, positionType: PositionTypeAvnuExtended): Promise<boolean>;
2951
+ getAUM(): Promise<{
2952
+ net: SingleTokenInfo;
2953
+ prevAum: Web3Number;
2954
+ splits: PositionInfo[];
2955
+ }>;
2956
+ getFundingRateHistory(startDate: Date, endDate: Date, page: number): Promise<never[] | ExtendedApiResponse<FundingRate[]>>;
2957
+ getVesuExposureWithoutUserDepositedCollateral(): Promise<Web3Number>;
2958
+ getExtendedPositionExposure(): Promise<Web3Number>;
2959
+ getBringLiquidityCall(params: {
2960
+ amount: Web3Number;
2961
+ }): Promise<Call>;
1536
2962
  }
1537
- declare const HyperLSTStrategies: IStrategyMetadata<HyperLSTStrategySettings>[];
2963
+ declare const BtcFiVesuExtendedTestStrategies: (extendedBackendUrl: string, extendedApiKey: string, vaultIdExtended: number, minimumExtendedMovementAmount: number, minimumVesuMovementAmount: number, minimumExtendedRetriesDelayForOrderStatus: number, minimumExtendedPriceDifferenceForSwapOpen: number, maximumExtendedPriceDifferenceForSwapClosing: number) => IStrategyMetadata<BtcFiVesuExtendedStrategySettings>[];
2964
+
2965
+ declare const calculateDeltaDebtAmount: (maxLtv: number | undefined, extendedExposureWBTC: Web3Number, // Ee
2966
+ assetsUnderVaultAllocator: Web3Number, // this is the aum
2967
+ targetHf: number | undefined, adddedCollateral: Web3Number, // wbtc terms
2968
+ existingVesuCollateral: Web3Number, // C existing
2969
+ existingVesuDebt: Web3Number, // Yc, should be in debt units
2970
+ collateralPrice: number, debtPrice: number) => Web3Number | null;
2971
+ declare const calculateDecisiveFactorF: (extendedExposureWBTC: Web3Number, // Ee
2972
+ assetsUnderVaultAllocator: Web3Number, adddedCollateral: Web3Number, existingVesuCollateral: Web3Number, // C existing
2973
+ unusedBalanceUSDC: Web3Number, existingVesuDebt: Web3Number, collateralPrice: number, debtPrice: number, maxLtv?: number, targetHf?: number) => Web3Number | null;
2974
+ declare const calculateDebtAmountForStage2: (debtAmountVesu: Web3Number, collateralPrice: number, debtPrice: number, maxLtv: number | undefined, targetHf: number | undefined, collateralAmountVesu: Web3Number, addedeCollateral: Web3Number) => Web3Number | null;
2975
+ /**
2976
+ * Fetches the amount of exposure we have on vesu, apart from the deposited collateral
2977
+ * @param assetsUnderVault
2978
+ * @param userDepositedAdditionalCollateral
2979
+ * @param vesuCollateralExposure
2980
+ * @returns
2981
+ */
2982
+ declare const calculateVesuExposureExtraToDepositedCollateral: (assetsUnderVault: Web3Number, userDepositedAdditionalCollateral: Web3Number, vesuCollateralExposure: Web3Number) => Web3Number | null;
2983
+ /**
2984
+ * Calculates the debt amount to be taken/repaid to maintain the ltv on vesu
2985
+ * @param existingVesuDebt - existing vesu debt in usdc terms
2986
+ * @param existingVesuCollateral - existing vesu collateral in wbtc terms
2987
+ * @param addedCollateral - added collateral in wbtc terms
2988
+ * @param collateralPrice - collateral price in usdc terms
2989
+ * @param debtPrice - debt price in usdc terms
2990
+ * @param maxLtv - max ltv
2991
+ * @param targetHf - target hf
2992
+ * @returns delta debt amount in usdc terms
2993
+ */
2994
+ declare const calculateDebtAmountForMainatiningLtvOnVesu: (existingVesuDebt: Web3Number, existingVesuCollateral: Web3Number, addedCollateral: Web3Number, collateralPrice: number, debtPrice: number, maxLtv?: number, targetHf?: number) => Web3Number | null;
2995
+ /**
2996
+ * Calculates the vesu deposit amount for multiplier
2997
+ * @param existingVesuDebt - existing vesu debt in usdc terms
2998
+ * @param existingVesuCollateral - existing vesu collateral in wbtc terms
2999
+ * @param addedCollateral - added collateral in wbtc terms
3000
+ * @param collateralPrice - collateral price in usdc terms
3001
+ * @param debtPrice - debt price in usdc terms
3002
+ * @param maxLtv - max ltv
3003
+ * @param targetHf - target hf
3004
+ * @returns vesu deposit amount in Wbtc terms
3005
+ */
3006
+ declare const calculateVesuDepositAmountForMultiplier: (decisiveFactorF: Web3Number, deltaDebtAmount: Web3Number, collateralPrice: number) => Web3Number | null;
3007
+ /**
3008
+ * Calculates the extended deposit amount in usdc terms
3009
+ * @param decisiveFactorF is the decisive factor f
3010
+ * @param deltaDebtAmount is the delta debt amount
3011
+ * @param collateralPrice is the collateral price in usdc terms
3012
+ * @returns the extended deposit amount in usdc terms
3013
+ */
3014
+ declare const calculateExtendedDepositAmount: (decisiveFactorF: Web3Number, deltaDebtAmount: Web3Number, collateralPrice: number) => Web3Number | null;
3015
+ /**
3016
+ * Calculates the borrow amount for stage 1 in usdc terms
3017
+ * @param targetHealthFactor is the target health factor
3018
+ * @param maxLtv is the max ltv
3019
+ * @param existingVesuCollateral is the existing vesu collateral in wbtc terms
3020
+ * @param addedCollateral is the added collateral in wbtc terms
3021
+ * @param collateralPrice is the collateral price in usdc terms
3022
+ * @param debtPrice
3023
+ * @returns the borrow amount for stage 1 in usdc terms
3024
+ */
3025
+ declare const calculateBorrowAmountForStage1: (targetHealthFactor: number, maxLtv: number | undefined, existingVesuCollateral: Web3Number, // this is equal to the assets under management in wbtc terms
3026
+ addedCollateral: Web3Number, collateralPrice: number, debtPrice: number) => Web3Number | null;
3027
+ /**
3028
+ * Calculates the amount distribution for withdrawal in wbtc strategy
3029
+ * @param amountInWbtc is the amount in wbtc terms
3030
+ * @param collateralPrice is the collateral price in usdc terms
3031
+ * @param vesuCollateralExposure is the vesu collateral exposure in wbtc terms
3032
+ * @param extendedPosition is the extended position exposure in wbtc terms
3033
+ * @returns the amount distribution for withdrawal in wbtc strategy
3034
+ */
3035
+ declare const calculateAmountDistributionForWithdrawalInWbtcStrategy: (amountInWbtc: Web3Number, vesuCollateralExposure: Web3Number, extendedPosition: Position[] | null) => {
3036
+ vesuAmount: Web3Number;
3037
+ extendedAmount: Web3Number;
3038
+ extended_leverage: number;
3039
+ vesu_leverage: number;
3040
+ } | null;
3041
+
3042
+ declare const DECISIVE_FACTOR = 0.75;
3043
+ declare const BUFFER_FOR_EXTENDED_DEPOSIT_AMOUNT = 0.05;
3044
+ declare const AMOUNT_BUFFER_TO_KEEP_IN_INVESTING_CYCLE = 0.95;
1538
3045
 
1539
3046
  interface EkuboRouteNode {
1540
3047
  pool_key: {
@@ -1560,7 +3067,8 @@ interface EkuboQuote {
1560
3067
  declare class EkuboQuoter {
1561
3068
  private readonly config;
1562
3069
  ENDPOINT: string;
1563
- constructor(config: IConfig);
3070
+ tokenMarketData: TokenMarketData;
3071
+ constructor(config: IConfig, pricer: PricerBase);
1564
3072
  /**
1565
3073
  *
1566
3074
  * @param fromToken
@@ -1569,6 +3077,9 @@ declare class EkuboQuoter {
1569
3077
  * @returns
1570
3078
  */
1571
3079
  getQuote(fromToken: string, toToken: string, amount: Web3Number, retry?: number): Promise<EkuboQuote>;
3080
+ getDexPrice(baseToken: TokenInfo, quoteToken: TokenInfo, amount: Web3Number): Promise<number>;
3081
+ getLSTTrueExchangeRate(baseToken: TokenInfo, quoteToken: TokenInfo, amount: Web3Number): Promise<number>;
3082
+ getSwapLimitAmount(fromToken: TokenInfo, toToken: TokenInfo, amount: Web3Number, max_slippage?: number): Promise<Web3Number>;
1572
3083
  /**
1573
3084
  * Formats Ekubo response for Vesu multiple use
1574
3085
  * @param quote
@@ -1629,6 +3140,9 @@ declare class LSTAPRService {
1629
3140
  private static cache;
1630
3141
  private static cacheTimestamp;
1631
3142
  private static readonly CACHE_DURATION;
3143
+ static lstMapping: Record<string, TokenInfo>;
3144
+ static isLST(address: ContractAddr): boolean;
3145
+ static getUnderlyingFromLST(lstAddress: ContractAddr): TokenInfo;
1632
3146
  /**
1633
3147
  * Fetches LST stats from Endur API with caching
1634
3148
  * @returns Promise<LSTStats[]> Array of LST statistics
@@ -1657,6 +3171,73 @@ declare class LSTAPRService {
1657
3171
  static clearCache(): void;
1658
3172
  }
1659
3173
 
3174
+ /**
3175
+ * Midas module for interacting with Midas API
3176
+ * Provides functions to get APY, price, and TVL data for Midas tokens
3177
+ */
3178
+ declare class Midas {
3179
+ private static readonly CONTRACT_TO_SYMBOL;
3180
+ private static readonly BASE_URL;
3181
+ /**
3182
+ * Check if a contract address is supported by Midas
3183
+ * @param contractAddr The contract address to check
3184
+ * @returns True if the contract address is supported
3185
+ */
3186
+ static isSupported(contractAddr: ContractAddr): boolean;
3187
+ /**
3188
+ * Get the Midas symbol for a given contract address
3189
+ * @param contractAddr The contract address to look up
3190
+ * @returns The Midas symbol for the contract
3191
+ * @throws Error if contract address is not found
3192
+ */
3193
+ static getSymbolFromContract(contractAddr: ContractAddr): string;
3194
+ /**
3195
+ * Get APY data for all Midas tokens
3196
+ * @returns Object with token symbols as keys and APY values as numbers
3197
+ * @throws Error if API request fails
3198
+ */
3199
+ static getAPYs(): Promise<Record<string, number>>;
3200
+ /**
3201
+ * Get APY for a specific token by contract address
3202
+ * @param contractAddr The contract address of the token
3203
+ * @returns The APY value for the token
3204
+ * @throws Error if contract address not found or API request fails
3205
+ */
3206
+ static getAPY(contractAddr: ContractAddr): Promise<number>;
3207
+ /**
3208
+ * Get price data for a specific token
3209
+ * @param contractAddr The contract address of the token
3210
+ * @param timestampFrom Optional start timestamp (defaults to 30 days ago)
3211
+ * @param timestampTo Optional end timestamp (defaults to now)
3212
+ * @param environment Environment (defaults to 'mainnet')
3213
+ * @returns The latest price for the token
3214
+ * @throws Error if contract address not found or API request fails
3215
+ */
3216
+ static getPrice(contractAddr: ContractAddr, timestampFrom?: number, timestampTo?: number, environment?: string): Promise<number>;
3217
+ /**
3218
+ * Get TVL data for all tokens
3219
+ * @param environment Environment (defaults to 'mainnet')
3220
+ * @returns Object with TVL data including totalTvl and tokenTvl
3221
+ * @throws Error if API request fails
3222
+ */
3223
+ static getTVLData(environment?: string): Promise<{
3224
+ lastUpdatedAt: string;
3225
+ totalTvl: number;
3226
+ tokenTvl: Record<string, any>;
3227
+ }>;
3228
+ /**
3229
+ * Get TVL for a specific token by contract address
3230
+ * @param contractAddr The contract address of the token
3231
+ * @param environment Environment (defaults to 'mainnet')
3232
+ * @returns The TVL data for the token (USD and native amounts)
3233
+ * @throws Error if contract address not found or API request fails
3234
+ */
3235
+ static getTVL(contractAddr: ContractAddr, environment?: string): Promise<{
3236
+ usd: number;
3237
+ native: number;
3238
+ } | number>;
3239
+ }
3240
+
1660
3241
  declare class TelegramNotif {
1661
3242
  private subscribers;
1662
3243
  readonly bot: TelegramBot;
@@ -1720,7 +3301,6 @@ declare function executeDeployCalls(contractsInfo: DeployContractResult[], acc:
1720
3301
  declare function executeTransactions(calls: Call[], acc: Account, provider: RpcProvider, remarks?: string): Promise<{
1721
3302
  transaction_hash: string;
1722
3303
  }>;
1723
- declare function myWaitForTransaction(transaction_hash: string, provider: RpcProvider, retry?: number): Promise<boolean>;
1724
3304
  declare const Deployer: {
1725
3305
  getAccount: typeof getAccount;
1726
3306
  myDeclare: typeof myDeclare;
@@ -1728,7 +3308,6 @@ declare const Deployer: {
1728
3308
  prepareMultiDeployContracts: typeof prepareMultiDeployContracts;
1729
3309
  executeDeployCalls: typeof executeDeployCalls;
1730
3310
  executeTransactions: typeof executeTransactions;
1731
- myWaitForTransaction: typeof myWaitForTransaction;
1732
3311
  };
1733
3312
 
1734
3313
  /**
@@ -1809,4 +3388,4 @@ declare class PasswordJsonCryptoUtil {
1809
3388
  decrypt(encryptedData: string, password: string): any;
1810
3389
  }
1811
3390
 
1812
- export { APYType, AUMTypes, AVNU_EXCHANGE, AVNU_MIDDLEWARE, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type ApproveCallParams, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, type BaseAdapterConfig, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, type DecreaseLeverParams, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FatalError, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, LSTAPRService, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PRICE_ROUTER, PasswordJsonCryptoUtil, type PositionAPY, type PositionInfo, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerLST, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type SupportedPosition, type Swap, type SwapInfo, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, type VesuMultiplyCallParams, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, extensionMap, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, logger, toBigInt };
3391
+ export { AMOUNT_BUFFER_TO_KEEP_IN_INVESTING_CYCLE, type APYInfo, APYType, AUDIT_URL, AUMTypes, AVNU_EXCHANGE, AVNU_EXCHANGE_FOR_LEGACY_USDC, AVNU_LEGACY_SANITIZER, AVNU_MIDDLEWARE, AVNU_QUOTE_URL, AbisConfig, type AccountInfo, type AdapterLeafType, AddressesConfig, type AllAccountsStore, type ApiResponse, type ApproveCallParams, type AssetOperation, AssetOperationStatus, AssetOperationType, AutoCompounderSTRK, AvnuAdapter, type AvnuAdapterConfig, type AvnuSwapCallParams, AvnuWrapper, BUFFER_FOR_EXTENDED_DEPOSIT_AMOUNT, type Balance, BaseAdapter, type BaseAdapterConfig, BaseStrategy, BtcFiVesuExtendedStrategy, type BtcFiVesuExtendedStrategySettings, BtcFiVesuExtendedTestStrategies, type CLVaultStrategySettings, type CancelOrderRequest, CommonAdapter, type CommonAdapterConfig, ContractAddr, type CreateOrderRequest, DECISIVE_FACTOR, type DecreaseLeverParams, Deployer, type DepositParams, type DualActionAmount, type DualTokenInfo, ERC20, EXTENDED_CONTRACT, EXTENDED_SANITIZER, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, ExitType, ExtendedAdapter, type ExtendedAdapterConfig, type ExtendedApiResponse, ExtendedConfig, ExtendedWrapper, type ExtendedWrapperConfig, type FAQ, FatalError, type FlashloanCallParams, FlowChartColors, type FundingRate, type GenerateCallFn, Global, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type L2Config, LSTAPRService, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, type Market, type MarketStats, Midas, Network, type OpenOrder, OrderSide, OrderStatus, OrderStatusReason, OrderType, PRICE_ROUTER, PasswordJsonCryptoUtil, type PlacedOrder, type Position, type PositionAPY, type PositionAmount, type PositionHistory, type PositionInfo, PositionSide, PositionTypeAvnuExtended, Pragma, type PriceInfo, Pricer, PricerBase, PricerFromApi, PricerLST, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, type RiskFactorConfig, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SettlementSignature, type SignedWithdrawRequest, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, type StarkDebuggingOrderAmounts, type StarkSettlement, Store, type StoreConfig, type SupportedPosition, type Swap, type SwapInfo, TelegramGroupNotif, TelegramNotif, TimeInForce, type TokenAmount, type TokenInfo, TokenMarketData, type TradingConfig, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, type UniversalStrategySettings, UnusedBalanceAdapter, type UnusedBalanceAdapterConfig, type UpdateLeverageRequest, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, VesuBorrowSupplyAdapter, type VesuBorrowSupplyAdapterConfig, VesuConfig, type VesuDefiSpringRewardsCallParams, VesuExtendedMultiplierStrategy, type VesuExtendedStrategySettings, VesuExtendedTestStrategies, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, VesuMultiplyAdapter, type VesuMultiplyAdapterConfig, type VesuMultiplyCallParams, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, VesuSupplyOnlyAdapter, type VesuSupplyOnlyAdapterConfig, Web3Number, type WithdrawParams, type WithdrawRequest, ZkLend, _riskFactor, assert, calculateAmountDepositOnExtendedWhenIncurringLosses, calculateAmountDistribution, calculateAmountDistributionForWithdrawal, calculateAmountDistributionForWithdrawalInWbtcStrategy, calculateBTCPriceDelta, calculateBorrowAmountForStage1, calculateDebtAmount, calculateDebtAmountForMainatiningLtvOnVesu, calculateDebtAmountForStage2, calculateDebtReductionAmountForWithdrawal, calculateDecisiveFactorF, calculateDeltaDebtAmount, calculateExposureDelta, calculateExtendedDepositAmount, calculateExtendedLevergae, calculateVesUPositionSizeGivenExtended, calculateVesuDepositAmountForMultiplier, calculateVesuExposureExtraToDepositedCollateral, calculateVesuLeverage, extensionMap, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getFAQs, getInvestmentSteps, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, logger, returnFormattedAmount, toBigInt };