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