@strkfarm/sdk 2.0.0-dev.28 → 2.0.0-dev.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.global.js +1938 -771
- package/dist/index.browser.mjs +1960 -791
- package/dist/index.d.ts +343 -124
- package/dist/index.js +1971 -794
- package/dist/index.mjs +1963 -791
- package/package.json +1 -1
- package/src/dataTypes/bignumber.browser.ts +6 -1
- package/src/dataTypes/bignumber.node.ts +5 -1
- package/src/interfaces/common.tsx +8 -1
- package/src/strategies/universal-adapters/baseAdapter.ts +1 -1
- package/src/strategies/universal-adapters/extended-adapter.ts +7 -7
- package/src/strategies/universal-adapters/index.ts +2 -1
- package/src/strategies/universal-adapters/svk-troves-adapter.ts +364 -0
- package/src/strategies/universal-adapters/vesu-multiply-adapter.ts +88 -34
- package/src/strategies/vesu-extended-strategy/services/executionService.ts +36 -55
- package/src/strategies/vesu-extended-strategy/services/extended-vesu-state-manager.ts +1553 -538
- package/src/strategies/vesu-extended-strategy/services/ltv-imbalance-rebalance-math.ts +730 -0
- package/src/strategies/vesu-extended-strategy/services/operationService.ts +4 -3
- package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +27 -83
- package/src/utils/index.ts +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ declare class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
|
|
|
37
37
|
|
|
38
38
|
declare class Web3Number extends _Web3Number<Web3Number> {
|
|
39
39
|
static fromWei(weiNumber: string | number, decimals: number): Web3Number;
|
|
40
|
+
static fromNumber(number: number, decimals: number): Web3Number;
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/**
|
|
@@ -348,6 +349,7 @@ declare const Protocols: {
|
|
|
348
349
|
EKUBO: IProtocol;
|
|
349
350
|
AVNU: IProtocol;
|
|
350
351
|
VAULT: IProtocol;
|
|
352
|
+
TROVES: IProtocol;
|
|
351
353
|
};
|
|
352
354
|
|
|
353
355
|
interface ILendingMetadata {
|
|
@@ -1372,6 +1374,14 @@ declare class StarknetCallParser {
|
|
|
1372
1374
|
private static addressToString;
|
|
1373
1375
|
}
|
|
1374
1376
|
|
|
1377
|
+
declare class HealthFactorMath {
|
|
1378
|
+
static getCollateralRequired(debtAmount: Web3Number, debtPrice: number, targetHF: number, maxLTV: number, collateralPrice: number, collateralTokenInfo: TokenInfo): Web3Number;
|
|
1379
|
+
static getMinCollateralRequiredOnLooping(debtAmount: Web3Number, debtPrice: number, targetHF: number, maxLTV: number, collateralPrice: number, collateralTokenInfo: TokenInfo): Web3Number;
|
|
1380
|
+
static getHealthFactor(collateralAmount: Web3Number, collateralPrice: number, maxLTV: number, debtAmount: Web3Number, debtPrice: number): number;
|
|
1381
|
+
static getMaxDebtAmountOnLooping(collateralAmount: Web3Number, collateralPrice: number, maxLTV: number, targetHF: number, debtPrice: number, debtTokenInfo: TokenInfo): Web3Number;
|
|
1382
|
+
static getMaxDebtAmount(collateralAmount: Web3Number, collateralPrice: number, maxLTV: number, targetHF: number, debtPrice: number, debtTokenInfo: TokenInfo): Web3Number;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1375
1385
|
type RequiredFields<T> = {
|
|
1376
1386
|
[K in keyof T]-?: T[K];
|
|
1377
1387
|
};
|
|
@@ -2452,7 +2462,7 @@ interface ExtendedAdapterConfig extends BaseAdapterConfig {
|
|
|
2452
2462
|
declare class ExtendedAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
|
|
2453
2463
|
readonly config: ExtendedAdapterConfig;
|
|
2454
2464
|
readonly client: ExtendedWrapper;
|
|
2455
|
-
readonly
|
|
2465
|
+
readonly usdcToken: TokenInfo;
|
|
2456
2466
|
readonly retryDelayForOrderStatus: number;
|
|
2457
2467
|
readonly minimumExtendedMovementAmount: number;
|
|
2458
2468
|
constructor(config: ExtendedAdapterConfig);
|
|
@@ -2567,6 +2577,74 @@ declare class TokenTransferAdapter extends BaseAdapter<DepositParams, WithdrawPa
|
|
|
2567
2577
|
getHealthFactor(): Promise<number>;
|
|
2568
2578
|
}
|
|
2569
2579
|
|
|
2580
|
+
/** Public Troves strategies feed (APY + metadata). Override in config for tests. */
|
|
2581
|
+
declare const DEFAULT_TROVES_STRATEGIES_API = "https://app.troves.fi/api/strategies";
|
|
2582
|
+
interface SvkTrovesAdapterConfig extends BaseAdapterConfig {
|
|
2583
|
+
/**
|
|
2584
|
+
* On-chain Troves / SVK strategy vault: ERC-4626-style `deposit` / `withdraw` on the underlying asset,
|
|
2585
|
+
* plus `due_assets_from_owner` for redemption NFT value still owed to an owner.
|
|
2586
|
+
*/
|
|
2587
|
+
strategyVault: ContractAddr;
|
|
2588
|
+
/**
|
|
2589
|
+
* Troves API `strategies[].id` string (e.g. `hyper_xstrk`). Used to resolve APY from the public JSON feed.
|
|
2590
|
+
*/
|
|
2591
|
+
trovesStrategyId: string;
|
|
2592
|
+
/**
|
|
2593
|
+
* Address whose vault **share** balance and **pending** redemption assets are measured.
|
|
2594
|
+
* Defaults to `vaultAllocator` when omitted (typical STRKFarm vault wiring).
|
|
2595
|
+
*/
|
|
2596
|
+
positionOwner?: ContractAddr;
|
|
2597
|
+
/** Optional APY endpoint (defaults to {@link DEFAULT_TROVES_STRATEGIES_API}). */
|
|
2598
|
+
trovesStrategiesApiUrl?: string;
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* Universal adapter for **Starknet Vault Kit (SVK)** style Troves strategies:
|
|
2602
|
+
* approve underlying → `deposit(assets, receiver)`, and `withdraw(assets, receiver, owner)` on the strategy vault.
|
|
2603
|
+
*
|
|
2604
|
+
* **Position sizing** (underlying asset, same decimals as `baseToken`):
|
|
2605
|
+
* - Liquid: `convert_to_assets(balance_of(positionOwner))` on the strategy vault (vault shares).
|
|
2606
|
+
* - Pending redemptions: `due_assets_from_owner(positionOwner)` on the same vault (NFT / queue claims not yet settled).
|
|
2607
|
+
*
|
|
2608
|
+
* **APY**: Fetched from Troves public API by `trovesStrategyId` (numeric `apy` field; non-numeric marketing values fall back to `0`).
|
|
2609
|
+
*/
|
|
2610
|
+
declare class SvkTrovesAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
|
|
2611
|
+
readonly config: SvkTrovesAdapterConfig;
|
|
2612
|
+
constructor(config: SvkTrovesAdapterConfig);
|
|
2613
|
+
/** Owner used for share balance + `due_assets_from_owner`. */
|
|
2614
|
+
private _positionOwner;
|
|
2615
|
+
/**
|
|
2616
|
+
* Proof readable IDs must stay ≤ 31 chars (Cairo short string). We derive a short ASCII suffix from
|
|
2617
|
+
* `strategyVault` address so multiple SVK adapters in one tree stay distinct.
|
|
2618
|
+
*/
|
|
2619
|
+
private _proofSuffix;
|
|
2620
|
+
private _depositApproveProofReadableId;
|
|
2621
|
+
private _depositCallProofReadableId;
|
|
2622
|
+
private _withdrawCallProofReadableId;
|
|
2623
|
+
protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
2624
|
+
protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount | null>;
|
|
2625
|
+
maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
2626
|
+
maxWithdraw(): Promise<PositionInfo>;
|
|
2627
|
+
protected _getDepositLeaf(): {
|
|
2628
|
+
target: ContractAddr;
|
|
2629
|
+
method: string;
|
|
2630
|
+
packedArguments: bigint[];
|
|
2631
|
+
sanitizer: ContractAddr;
|
|
2632
|
+
id: string;
|
|
2633
|
+
}[];
|
|
2634
|
+
protected _getWithdrawLeaf(): {
|
|
2635
|
+
target: ContractAddr;
|
|
2636
|
+
method: string;
|
|
2637
|
+
packedArguments: bigint[];
|
|
2638
|
+
sanitizer: ContractAddr;
|
|
2639
|
+
id: string;
|
|
2640
|
+
}[];
|
|
2641
|
+
getDepositAdapter(): AdapterLeafType<DepositParams>;
|
|
2642
|
+
getWithdrawAdapter(): AdapterLeafType<WithdrawParams>;
|
|
2643
|
+
getDepositCall(params: DepositParams): Promise<ManageCall[]>;
|
|
2644
|
+
getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
|
|
2645
|
+
getHealthFactor(): Promise<number>;
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2570
2648
|
declare enum LSTPriceType {
|
|
2571
2649
|
ENDUR_PRICE = "ENDUR_PRICE",
|
|
2572
2650
|
AVNU_PRICE = "AVNU_PRICE"
|
|
@@ -2989,9 +3067,9 @@ interface VesuPoolDelta {
|
|
|
2989
3067
|
* Enumerates all possible fund-routing paths used during execution.
|
|
2990
3068
|
*/
|
|
2991
3069
|
declare enum RouteType {
|
|
2992
|
-
/**
|
|
3070
|
+
/** Deposit USDC from operator wallet directly to Extended exchange */
|
|
2993
3071
|
WALLET_TO_EXTENDED = "WALLET_TO_EXTENDED",
|
|
2994
|
-
/**
|
|
3072
|
+
/** USDC from vault allocator → deposit to Extended (via manager) */
|
|
2995
3073
|
VA_TO_EXTENDED = "VA_TO_EXTENDED",
|
|
2996
3074
|
/** Withdraw from Extended exchange → operator wallet */
|
|
2997
3075
|
EXTENDED_TO_WALLET = "EXTENDED_TO_WALLET",
|
|
@@ -3007,7 +3085,7 @@ declare enum RouteType {
|
|
|
3007
3085
|
VESU_BORROW = "VESU_BORROW",
|
|
3008
3086
|
/** Repay USDC debt to Vesu (debtDelta < 0) */
|
|
3009
3087
|
VESU_REPAY = "VESU_REPAY",
|
|
3010
|
-
/** Transfer USDC
|
|
3088
|
+
/** Transfer USDC from operator wallet to vault allocator */
|
|
3011
3089
|
WALLET_TO_VA = "WALLET_TO_VA",
|
|
3012
3090
|
/** Realize PnL on Extended exchange */
|
|
3013
3091
|
REALISE_PNL = "REALISE_PNL",
|
|
@@ -3135,11 +3213,12 @@ declare enum CaseCategory {
|
|
|
3135
3213
|
* Specific case IDs corresponding to the situations defined in cases.json.
|
|
3136
3214
|
*/
|
|
3137
3215
|
declare enum CaseId {
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3216
|
+
MANAGE_LTV = "MANAGE_LTV",
|
|
3217
|
+
/** @deprecated use MANAGE_LTV */ LTV_VESU_LOW_TO_EXTENDED = "LTV_VESU_LOW_TO_EXTENDED",
|
|
3218
|
+
/** @deprecated use MANAGE_LTV */ LTV_EXTENDED_PROFITABLE_AVAILABLE = "LTV_EXTENDED_PROFITABLE_AVAILABLE",
|
|
3219
|
+
/** @deprecated use MANAGE_LTV */ LTV_EXTENDED_PROFITABLE_REALIZE = "LTV_EXTENDED_PROFITABLE_REALIZE",
|
|
3220
|
+
/** @deprecated use MANAGE_LTV */ LTV_VESU_HIGH_USE_VA_OR_WALLET = "LTV_VESU_HIGH_USE_VA_OR_WALLET",
|
|
3221
|
+
/** @deprecated use MANAGE_LTV */ LTV_EXTENDED_HIGH_USE_VA_OR_WALLET = "LTV_EXTENDED_HIGH_USE_VA_OR_WALLET",
|
|
3143
3222
|
DEPOSIT_FRESH_VAULT = "DEPOSIT_FRESH_VAULT",
|
|
3144
3223
|
DEPOSIT_EXTENDED_AVAILABLE = "DEPOSIT_EXTENDED_AVAILABLE",
|
|
3145
3224
|
DEPOSIT_VESU_BORROW_CAPACITY = "DEPOSIT_VESU_BORROW_CAPACITY",
|
|
@@ -3164,6 +3243,8 @@ interface SolveCase {
|
|
|
3164
3243
|
/** High-level steps describing what needs to happen for this case */
|
|
3165
3244
|
steps: string[];
|
|
3166
3245
|
}
|
|
3246
|
+
/** Decimal places for rounding collateral / exposure deltas in token terms (e.g. BTC) */
|
|
3247
|
+
declare const COLLATERAL_PRECISION = 4;
|
|
3167
3248
|
/**
|
|
3168
3249
|
* A single detected case with its metadata, amounts, and the execution
|
|
3169
3250
|
* routes that belong to this case.
|
|
@@ -3216,9 +3297,13 @@ interface StateManagerConfig {
|
|
|
3216
3297
|
extendedAdapter: ExtendedAdapter;
|
|
3217
3298
|
vaultAllocator: ContractAddr;
|
|
3218
3299
|
walletAddress: string;
|
|
3300
|
+
/** Strategy / vault token — idle balance in the vault allocator is denominated in this asset */
|
|
3219
3301
|
assetToken: TokenInfo;
|
|
3220
|
-
/**
|
|
3221
|
-
|
|
3302
|
+
/**
|
|
3303
|
+
* Native USDC (Starknet) — operator wallet stablecoin balance is always read for this token,
|
|
3304
|
+
* independent of {@link assetToken} (e.g. when the strategy vault uses another asset).
|
|
3305
|
+
*/
|
|
3306
|
+
usdcToken: TokenInfo;
|
|
3222
3307
|
/** Collateral token (e.g. WBTC) for wallet balance checks */
|
|
3223
3308
|
collateralToken: TokenInfo;
|
|
3224
3309
|
limitBalanceBufferFactor: number;
|
|
@@ -3230,67 +3315,193 @@ declare function routeSummary(r: ExecutionRoute): string;
|
|
|
3230
3315
|
/**
|
|
3231
3316
|
* Single source of truth for all mutable state during a solve() call.
|
|
3232
3317
|
*
|
|
3233
|
-
*
|
|
3234
|
-
*
|
|
3235
|
-
*
|
|
3236
|
-
* (
|
|
3237
|
-
*
|
|
3238
|
-
*
|
|
3318
|
+
* Stores **raw** snapshots from refresh (no safety buffer applied in fields).
|
|
3319
|
+
* Buffer {@link limitBalanceBufferFactor} is applied only in **getters** used
|
|
3320
|
+
* during solve (caps, diagnostics). **Spend / add** methods mutate balances
|
|
3321
|
+
* in **raw** USD only (no buffer on debits or credits).
|
|
3322
|
+
*
|
|
3323
|
+
* **Extended deposits** ({@link SolveBudget.addToExtAvailTrade}): while account equity is
|
|
3324
|
+
* below required margin (Σ position value ÷ Extended leverage), incoming USDC is credited
|
|
3325
|
+
* only to **balance** and **equity**. Only the excess is credited to **availableForWithdrawal**
|
|
3326
|
+
* and **availableForTrade**, matching “margin first, then free collateral”.
|
|
3239
3327
|
*/
|
|
3240
3328
|
declare class SolveBudget {
|
|
3241
|
-
unusedBalance
|
|
3242
|
-
walletBalance
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
private
|
|
3250
|
-
private
|
|
3251
|
-
private
|
|
3252
|
-
private
|
|
3253
|
-
private
|
|
3254
|
-
private
|
|
3255
|
-
|
|
3256
|
-
|
|
3329
|
+
private unusedBalance;
|
|
3330
|
+
private walletBalance;
|
|
3331
|
+
/** Idle {@link StateManagerConfig.assetToken} in the vault allocator */
|
|
3332
|
+
private vaultAssetBalance;
|
|
3333
|
+
/**
|
|
3334
|
+
* Idle {@link StateManagerConfig.usdcToken} in the vault allocator.
|
|
3335
|
+
* When asset and USDC are the same token, this is null (all VA stablecoin is in {@link vaultAssetBalance} only).
|
|
3336
|
+
*/
|
|
3337
|
+
private vaultUsdcBalance;
|
|
3338
|
+
private extendedPositions;
|
|
3339
|
+
private extendedBalance;
|
|
3340
|
+
private vesuPoolStates;
|
|
3341
|
+
private vesuPerPoolDebtDeltasToBorrow;
|
|
3342
|
+
private shouldVesuRebalance;
|
|
3343
|
+
readonly assetToken: TokenInfo;
|
|
3344
|
+
readonly usdcToken: TokenInfo;
|
|
3257
3345
|
constructor(state: {
|
|
3258
|
-
|
|
3346
|
+
assetToken: TokenInfo;
|
|
3347
|
+
usdcToken: TokenInfo;
|
|
3259
3348
|
unusedBalance: TokenBalance[];
|
|
3260
3349
|
walletBalance: TokenBalance | null;
|
|
3261
|
-
|
|
3350
|
+
vaultAssetBalance: TokenBalance | null;
|
|
3351
|
+
vaultUsdcBalance: TokenBalance | null;
|
|
3262
3352
|
extendedPositions: ExtendedPositionState[];
|
|
3263
3353
|
extendedBalance: ExtendedBalanceState | null;
|
|
3264
3354
|
vesuPoolStates: VesuPoolState[];
|
|
3265
3355
|
});
|
|
3356
|
+
/** `1 - limitBalanceBufferFactor` — multiplier applied to raw notionals for “usable” USD. */
|
|
3357
|
+
private _usableFraction;
|
|
3358
|
+
/**
|
|
3359
|
+
* Raw USD notional for a token row. USDC (and configured {@link usdcToken}) uses 1:1 from amount;
|
|
3360
|
+
* non-stable assets (e.g. WBTC in VA) use {@link TokenBalance.usdValue} from the pricer at refresh.
|
|
3361
|
+
*/
|
|
3362
|
+
private _rawTokenUsd;
|
|
3363
|
+
/** Apply safety buffer to a raw USD scalar. */
|
|
3364
|
+
bufferedUsd(rawUsd: number): number;
|
|
3365
|
+
/** Convert a buffered “usable” USD amount to raw nominal USD (inverse of {@link bufferedUsd}). */
|
|
3366
|
+
rawUsdFromBuffered(bufferedUsd: number): number;
|
|
3367
|
+
/** Buffered USD notional for one token balance row. */
|
|
3368
|
+
bufferedTokenUsd(tb: TokenBalance | null | undefined): number;
|
|
3369
|
+
logStateSummary(): {
|
|
3370
|
+
unusedBalances: {
|
|
3371
|
+
token: string;
|
|
3372
|
+
amount: number;
|
|
3373
|
+
}[];
|
|
3374
|
+
walletBalance: {
|
|
3375
|
+
token: string;
|
|
3376
|
+
amount: number;
|
|
3377
|
+
} | undefined;
|
|
3378
|
+
vaultAssetBalance: {
|
|
3379
|
+
token: string;
|
|
3380
|
+
amount: number;
|
|
3381
|
+
} | undefined;
|
|
3382
|
+
vaultUsdcBalance: {
|
|
3383
|
+
token: string;
|
|
3384
|
+
amount: number;
|
|
3385
|
+
} | undefined;
|
|
3386
|
+
vesuPoolStates: {
|
|
3387
|
+
poolId: ContractAddr;
|
|
3388
|
+
collateralAmount: number;
|
|
3389
|
+
debtAmount: number;
|
|
3390
|
+
}[];
|
|
3391
|
+
vesuBorrowCapacity: number;
|
|
3392
|
+
vesuRebalance: boolean[];
|
|
3393
|
+
vesuPerPoolDebtDeltasToBorrow: number[];
|
|
3394
|
+
extendedBalance: number | undefined;
|
|
3395
|
+
extendedEquity: number | undefined;
|
|
3396
|
+
extendedAvailableForTrade: number | undefined;
|
|
3397
|
+
extendedAvailableForWithdrawal: number | undefined;
|
|
3398
|
+
extendedUnrealisedPnl: number | undefined;
|
|
3399
|
+
extendedPendingDeposit: number | undefined;
|
|
3400
|
+
extendedPositions: {
|
|
3401
|
+
instrument: string;
|
|
3402
|
+
size: number;
|
|
3403
|
+
valueUsd: number;
|
|
3404
|
+
}[];
|
|
3405
|
+
};
|
|
3266
3406
|
/**
|
|
3267
|
-
* Initialise
|
|
3268
|
-
*
|
|
3269
|
-
*
|
|
3270
|
-
* Accounts for pendingDeposit:
|
|
3271
|
-
* - pendingDeposit > 0: funds in transit TO Extended → increase effective Extended available-for-trade
|
|
3272
|
-
* - pendingDeposit < 0: funds in transit FROM Extended → increase effective wallet balance
|
|
3407
|
+
* Initialise derived views for a solve cycle. Mutates only when pending
|
|
3408
|
+
* withdrawal from Extended is in transit (credits wallet raw balance).
|
|
3273
3409
|
*/
|
|
3274
3410
|
initBudget(): void;
|
|
3411
|
+
/**
|
|
3412
|
+
* Apply a safety buffer to all liquid balances (VA, wallet, extended trade/withdraw/upnl,
|
|
3413
|
+
* unused balances). Call after withdrawal classification but before LTV/deposit classifiers
|
|
3414
|
+
* so that withdrawal uses full raw amounts while subsequent classifiers see buffered values.
|
|
3415
|
+
*/
|
|
3416
|
+
applyBuffer(factor: number): void;
|
|
3417
|
+
get vesuPoolState(): VesuPoolState;
|
|
3418
|
+
/** Buffered VA USD: strategy-asset slot + optional USDC slot. */
|
|
3275
3419
|
get vaUsd(): number;
|
|
3420
|
+
/** Buffered USD in VA strategy-asset bucket only. */
|
|
3421
|
+
get vaAssetUsd(): number;
|
|
3422
|
+
/** Buffered USD in VA USDC bucket (0 when asset === USDC). */
|
|
3423
|
+
get vaUsdcUsd(): number;
|
|
3276
3424
|
get walletUsd(): number;
|
|
3277
3425
|
get vaWalletUsd(): number;
|
|
3278
3426
|
get extAvailWithdraw(): number;
|
|
3279
3427
|
get extAvailUpnl(): number;
|
|
3428
|
+
/**
|
|
3429
|
+
* Buffered Extended available-for-trade plus positive {@link ExtendedBalanceState.pendingDeposit}
|
|
3430
|
+
* (deposit in transit is usable the same way as the pre-buffer implementation).
|
|
3431
|
+
*/
|
|
3280
3432
|
get extAvailTrade(): number;
|
|
3433
|
+
get extPendingDeposit(): number;
|
|
3434
|
+
/**
|
|
3435
|
+
* Aggregate positive per-pool borrow headroom (USD). Repay/borrow routes update
|
|
3436
|
+
* {@link vesuPerPoolDebtDeltasToBorrow}; no separate counter.
|
|
3437
|
+
*/
|
|
3281
3438
|
get vesuBorrowCapacity(): number;
|
|
3439
|
+
/** Diagnostic: buffered idle + positive debt delta + buffered Extended afT + in-flight deposit. */
|
|
3282
3440
|
get totalUnused(): number;
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3441
|
+
/** Sum of buffered USD across merged unused-balance rows (VA + wallet). */
|
|
3442
|
+
get unusedBalancesBufferedUsdSum(): number;
|
|
3443
|
+
/** Read-only snapshot view for validation / logging. */
|
|
3444
|
+
get unusedBalanceRows(): readonly TokenBalance[];
|
|
3445
|
+
/** Read-only Vesu pool view for solve computations. */
|
|
3446
|
+
get vesuPools(): readonly VesuPoolState[];
|
|
3447
|
+
/** Read-only Extended positions view for solve computations. */
|
|
3448
|
+
get extendedPositionsView(): readonly ExtendedPositionState[];
|
|
3449
|
+
/** Read-only Extended balance view for diagnostics / margin checks. */
|
|
3450
|
+
get extendedBalanceView(): ExtendedBalanceState | null;
|
|
3451
|
+
/** Current debt deltas per pool (positive=borrow, negative=repay). */
|
|
3452
|
+
get vesuDebtDeltas(): readonly Web3Number[];
|
|
3453
|
+
/** Per-pool rebalance flags derived from target HF checks. */
|
|
3454
|
+
get vesuRebalanceFlags(): readonly boolean[];
|
|
3455
|
+
/** Raw USD in VA (USDC slot + asset slot); spend caps when executing transfers. */
|
|
3456
|
+
private _vaRawUsd;
|
|
3457
|
+
private _walletRawUsd;
|
|
3458
|
+
/** Remove up to `usd` notional from a token balance, scaling token amount proportionally. */
|
|
3459
|
+
private _deductUsdFromTokenBalance;
|
|
3460
|
+
/** Add USD notional; infers price from current amount/usd when possible, else 1:1. */
|
|
3461
|
+
private _addUsdToTokenBalance;
|
|
3462
|
+
/**
|
|
3463
|
+
* Rebuilds {@link unusedBalance} from vault + wallet snapshots (same merge as refresh).
|
|
3464
|
+
*/
|
|
3465
|
+
private _recomputeUnusedBalance;
|
|
3466
|
+
/**
|
|
3467
|
+
* Spend VA **raw** USD (up to {@link vaRawUsd}). Prefer {@link vaultUsdcBalance} when present, then {@link vaultAssetBalance}.
|
|
3468
|
+
*/
|
|
3469
|
+
spendVA(rawDesired: number): number;
|
|
3470
|
+
/**
|
|
3471
|
+
* Spend nominal/raw USD from VA (e.g. Vesu repay, on-chain USDC). Does not apply the safety buffer to the cap.
|
|
3472
|
+
*/
|
|
3473
|
+
spendVaRawUsd(rawUsdDesired: number): number;
|
|
3474
|
+
/**
|
|
3475
|
+
* Add **raw nominal USD** to VA (borrow proceeds, wallet→VA in raw USDC, etc.).
|
|
3476
|
+
*/
|
|
3477
|
+
addToVA(rawUsd: number): void;
|
|
3478
|
+
spendWallet(rawDesired: number): number;
|
|
3479
|
+
/** Add **raw nominal USD** to the operator wallet balance (e.g. Extended→wallet withdrawal). */
|
|
3480
|
+
addToWallet(rawUsd: number): void;
|
|
3481
|
+
spendVAWallet(rawDesired: number): number;
|
|
3289
3482
|
private _updateExtAvailWithdraw;
|
|
3290
3483
|
private _updateExtAvailUpnl;
|
|
3291
|
-
spendExtAvailTrade(
|
|
3292
|
-
|
|
3293
|
-
|
|
3484
|
+
spendExtAvailTrade(rawDesired: number): number;
|
|
3485
|
+
spendExtAvailTradeToEquityOnly(rawDesired: number): number;
|
|
3486
|
+
spendExtAvailWithdraw(rawDesired: number): number;
|
|
3487
|
+
spendExtAvailUpnl(rawDesired: number): number;
|
|
3488
|
+
/**
|
|
3489
|
+
* Withdraw from Extended **withdrawal bucket only** to operator wallet (planning).
|
|
3490
|
+
* Used when VA must be funded from Extended and withdraw should be exhausted before unrealised PnL.
|
|
3491
|
+
*/
|
|
3492
|
+
spendAvailWithdrawToWallet(rawDesired: number): number;
|
|
3493
|
+
/**
|
|
3494
|
+
* Required Extended equity (USD) for current open positions: total notional ÷ strategy leverage.
|
|
3495
|
+
* Same basis as {@link ExtendedSVKVesuStateManager._classifyLtvExtended} margin check.
|
|
3496
|
+
*/
|
|
3497
|
+
private _extendedMarginRequirementUsd;
|
|
3498
|
+
/** How much more equity is needed before deposits should increase withdraw / trade availability. */
|
|
3499
|
+
private _extendedEquityShortfallUsd;
|
|
3500
|
+
/**
|
|
3501
|
+
* Credits a USDC inflow on Extended. Fills margin shortfall (balance+equity only) first;
|
|
3502
|
+
* any remainder is credited across balance, equity, availableForWithdrawal, and availableForTrade.
|
|
3503
|
+
*/
|
|
3504
|
+
addToExtAvailTrade(rawUsd: number): void;
|
|
3294
3505
|
spendVesuBorrowCapacity(desired: number): {
|
|
3295
3506
|
used: number;
|
|
3296
3507
|
spendsByPool: Omit<VesuDebtRoute, 'priority' | 'type'>[];
|
|
@@ -3301,8 +3512,16 @@ declare class SolveBudget {
|
|
|
3301
3512
|
};
|
|
3302
3513
|
/** Update a Vesu pool's collateral and debt after a lever / borrow / repay route. */
|
|
3303
3514
|
applyVesuDelta(poolId: ContractAddr, collToken: TokenInfo, debtToken: TokenInfo, collDelta: Web3Number, debtDelta: Web3Number): void;
|
|
3304
|
-
/**
|
|
3305
|
-
|
|
3515
|
+
/**
|
|
3516
|
+
* Update Extended position size after a lever route; sync {@link ExtendedPositionState.valueUsd}
|
|
3517
|
+
* and margin buckets (released USD on decrease, locked USD on increase).
|
|
3518
|
+
*
|
|
3519
|
+
* @param collateralPriceUsd BTC collateral price for notional / margin math; if omitted, uses
|
|
3520
|
+
* existing valueUsd / |size| or the first Vesu pool collateral price.
|
|
3521
|
+
*/
|
|
3522
|
+
applyExtendedExposureDelta(instrument: string, sizeDelta: Web3Number, collateralPriceUsd?: number): void;
|
|
3523
|
+
/** Pull margin for larger Extended exposure from liquid buckets, then balance/equity. */
|
|
3524
|
+
private _lockExtendedMarginUsd;
|
|
3306
3525
|
/**
|
|
3307
3526
|
* For each Vesu pool, computes the debt delta needed to bring the position
|
|
3308
3527
|
* back to the target health factor.
|
|
@@ -3311,6 +3530,18 @@ declare class SolveBudget {
|
|
|
3311
3530
|
*/
|
|
3312
3531
|
private _computeperPoolDebtDeltasToBorrow;
|
|
3313
3532
|
}
|
|
3533
|
+
declare function createSolveBudgetFromRawState(params: {
|
|
3534
|
+
assetToken: TokenInfo;
|
|
3535
|
+
usdcToken: TokenInfo;
|
|
3536
|
+
unusedBalance: TokenBalance[];
|
|
3537
|
+
walletBalance: TokenBalance | null;
|
|
3538
|
+
vaultAssetBalance: TokenBalance | null;
|
|
3539
|
+
vaultUsdcBalance: TokenBalance | null;
|
|
3540
|
+
extendedPositions: ExtendedPositionState[];
|
|
3541
|
+
extendedBalance: ExtendedBalanceState | null;
|
|
3542
|
+
vesuPoolStates: VesuPoolState[];
|
|
3543
|
+
limitBalanceBufferFactor?: number;
|
|
3544
|
+
}): SolveBudget;
|
|
3314
3545
|
/**
|
|
3315
3546
|
* Reads all on-chain / off-chain state for the Extended + SVK + Vesu strategy,
|
|
3316
3547
|
* then solves for the optimal rebalancing deltas.
|
|
@@ -3340,22 +3571,25 @@ declare class ExtendedSVKVesuStateManager {
|
|
|
3340
3571
|
* results in private instance variables.
|
|
3341
3572
|
*/
|
|
3342
3573
|
private _refresh;
|
|
3574
|
+
/** True when strategy asset and USDC share one token — VA USDC slot is unused (all in asset balance). */
|
|
3575
|
+
private _vaultAssetAndUsdcAreSameToken;
|
|
3343
3576
|
/**
|
|
3344
|
-
* Reads the
|
|
3577
|
+
* Reads the {@link StateManagerConfig.assetToken} balance idle in the vault allocator.
|
|
3345
3578
|
*/
|
|
3346
|
-
private
|
|
3579
|
+
private _fetchVaultAllocatorAssetBalance;
|
|
3347
3580
|
/**
|
|
3348
|
-
*
|
|
3349
|
-
*
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
*
|
|
3581
|
+
* Reads {@link StateManagerConfig.usdcToken} in the vault allocator when it differs from
|
|
3582
|
+
* {@link StateManagerConfig.assetToken}. Otherwise returns null (treat VA USDC as 0; stablecoin is only under asset).
|
|
3583
|
+
*/
|
|
3584
|
+
private _fetchVaultAllocatorUsdcBalanceIfDistinct;
|
|
3585
|
+
/**
|
|
3586
|
+
* Merges vault-allocator asset, optional vault-allocator USDC, and operator wallet
|
|
3587
|
+
* balances into entries keyed by token address.
|
|
3354
3588
|
*/
|
|
3355
3589
|
private _computeUnusedBalances;
|
|
3356
3590
|
/**
|
|
3357
|
-
* Reads the operator wallet
|
|
3358
|
-
*
|
|
3591
|
+
* Reads the operator wallet balance for {@link StateManagerConfig.usdcToken} only
|
|
3592
|
+
* (wallet stablecoin is always USDC, regardless of strategy {@link StateManagerConfig.assetToken}).
|
|
3359
3593
|
*/
|
|
3360
3594
|
private _fetchWalletBalances;
|
|
3361
3595
|
/**
|
|
@@ -3406,8 +3640,10 @@ declare class ExtendedSVKVesuStateManager {
|
|
|
3406
3640
|
*/
|
|
3407
3641
|
private _computeDistributableAmount;
|
|
3408
3642
|
/**
|
|
3409
|
-
* Total investable = vault allocator balance + Extended available-for-trade
|
|
3410
|
-
*
|
|
3643
|
+
* Total investable = vault allocator balance + Extended available-for-trade +
|
|
3644
|
+
* buffered unrealised PnL, matching `deposit_cases_extended_vesu.xlsx`:
|
|
3645
|
+
* `(VA + wallet + EXT_WITH_AVL + EXT_UPNL) * (1 − buffer)`.
|
|
3646
|
+
* Positive {@link ExtendedBalanceState.pendingDeposit} stays on the afT leg only (see {@link SolveBudget.extAvailTrade}).
|
|
3411
3647
|
*/
|
|
3412
3648
|
private _computeTotalInvestableAmount;
|
|
3413
3649
|
private _sumDebtDeltas;
|
|
@@ -3507,7 +3743,23 @@ declare class ExtendedSVKVesuStateManager {
|
|
|
3507
3743
|
*
|
|
3508
3744
|
* Design: accumulate all ext-to-wallet moves, add transfer routes at the end (principle #3).
|
|
3509
3745
|
*/
|
|
3510
|
-
|
|
3746
|
+
/**
|
|
3747
|
+
* Unified LTV classifier. Computes both Vesu repay and Extended margin needs,
|
|
3748
|
+
* then builds all routes in a single pass with no duplicate transfers.
|
|
3749
|
+
*
|
|
3750
|
+
* Vesu repay priority: VA > Wallet > ExtAvl > ExtUpnl
|
|
3751
|
+
* Extended margin priority: Wallet > VA > VesuBorrow
|
|
3752
|
+
* Shared sources consumed by Vesu first (higher priority).
|
|
3753
|
+
*/
|
|
3754
|
+
private _classifyLTV;
|
|
3755
|
+
private _ltvRebalanceInputsFromBudget;
|
|
3756
|
+
private _isLtvRebalanceNoop;
|
|
3757
|
+
/**
|
|
3758
|
+
* Turn pure rebalance() deltas into execution routes.
|
|
3759
|
+
* Order: Vesu multiply (decrease/increase) → Extended lever → aggregated transfers
|
|
3760
|
+
* (REALISE_PNL, EXTENDED_TO_WALLET + WAIT, WALLET_TO_VA, VESU_BORROW, VESU_REPAY, VA_TO_EXTENDED).
|
|
3761
|
+
*/
|
|
3762
|
+
private _buildLtvRoutesFromRebalanceDeltas;
|
|
3511
3763
|
/**
|
|
3512
3764
|
* LTV_EXTENDED_PROFITABLE_AVAILABLE:
|
|
3513
3765
|
* Extended has enough available-to-withdraw → withdraw, move to VA, repay Vesu.
|
|
@@ -3526,16 +3778,6 @@ declare class ExtendedSVKVesuStateManager {
|
|
|
3526
3778
|
* Routes: [CRISIS_INCREASE_EXTENDED_MAX_LEVERAGE, EXTENDED_TO_WALLET, WALLET_TO_VA,
|
|
3527
3779
|
* VESU_MULTIPLY_DECREASE_LEVER, EXTENDED_DECREASE_LEVER, CRISIS_UNDO_EXTENDED_MAX_LEVERAGE]
|
|
3528
3780
|
*/
|
|
3529
|
-
/** 2b. LTV Rebalance — Extended side */
|
|
3530
|
-
/**
|
|
3531
|
-
* 2b. LTV Rebalance — Extended side
|
|
3532
|
-
*
|
|
3533
|
-
* Triggered when Extended equity is below the required margin for current positions.
|
|
3534
|
-
* Sources funds to Extended via VA/Wallet or Vesu borrow.
|
|
3535
|
-
*
|
|
3536
|
-
* Priority: 1) VA/Wallet → Extended 2) Vesu borrow → VA → Extended
|
|
3537
|
-
*/
|
|
3538
|
-
private _classifyLtvExtended;
|
|
3539
3781
|
/**
|
|
3540
3782
|
* LTV_EXTENDED_HIGH_USE_VA_OR_WALLET:
|
|
3541
3783
|
* VA/Wallet has funds → route them to Extended.
|
|
@@ -3554,6 +3796,7 @@ declare class ExtendedSVKVesuStateManager {
|
|
|
3554
3796
|
* VESU_MULTIPLY_DECREASE_LEVER, EXTENDED_DECREASE_LEVER,
|
|
3555
3797
|
* CRISIS_UNDO_EXTENDED_MAX_LEVERAGE]
|
|
3556
3798
|
*/
|
|
3799
|
+
private _rebalanceFunds;
|
|
3557
3800
|
/**
|
|
3558
3801
|
* 3. New Deposits / Excess Funds
|
|
3559
3802
|
*
|
|
@@ -3568,11 +3811,20 @@ declare class ExtendedSVKVesuStateManager {
|
|
|
3568
3811
|
* Computes allocation split between Vesu and Extended, then sources
|
|
3569
3812
|
* funds and creates lever-increase routes.
|
|
3570
3813
|
*
|
|
3571
|
-
* Fund flow (
|
|
3572
|
-
*
|
|
3573
|
-
*
|
|
3574
|
-
*
|
|
3575
|
-
*
|
|
3814
|
+
* Fund flow (single pass — avoid VA→Extended then Extended→wallet round-trips):
|
|
3815
|
+
* 1) Treat Vesu borrow headroom that the multiply route will consume as covering
|
|
3816
|
+
* part of the Vesu USDC need (no standalone VESU_BORROW for that slice). Cap
|
|
3817
|
+
* standalone VESU_BORROW→VA→Extended by remaining headroom.
|
|
3818
|
+
* 2) Cover Extended deposit delta: REALISE_PNL first, then withdrawal→avail-trade,
|
|
3819
|
+
* then wallet→Extended, then VA→Extended only up to VA surplus above the USDC
|
|
3820
|
+
* that must remain for Vesu (after step 1), then borrow→VA→Extended.
|
|
3821
|
+
* 3) Cover Vesu VA shortfall: wallet→VA, Extended withdrawal→wallet→VA, REALISE_PNL,
|
|
3822
|
+
* then combined Extended→wallet→VA for the remainder.
|
|
3823
|
+
* 4) RETURN_TO_WAIT when needed; then AVNU + VESU_MULTIPLY + EXTENDED_INCREASE.
|
|
3824
|
+
*/
|
|
3825
|
+
/**
|
|
3826
|
+
* @param skipAvnuDepositSwap Omit AVNU before Vesu multiply when LTV cases already ran this cycle
|
|
3827
|
+
* (matrix tests expect deposit routes without that step).
|
|
3576
3828
|
*/
|
|
3577
3829
|
private _classifyDeposits;
|
|
3578
3830
|
/** 4. Exposure Imbalance */
|
|
@@ -3618,36 +3870,6 @@ declare class ExtendedSVKVesuStateManager {
|
|
|
3618
3870
|
private _logSolveResult;
|
|
3619
3871
|
}
|
|
3620
3872
|
|
|
3621
|
-
declare class UsdcToUsdceAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
|
|
3622
|
-
readonly config: BaseAdapterConfig;
|
|
3623
|
-
private _approveProofReadableId;
|
|
3624
|
-
private _swapProofReadableId;
|
|
3625
|
-
private buildSwapLeafConfigs;
|
|
3626
|
-
private buildSwapCalls;
|
|
3627
|
-
constructor(config: BaseAdapterConfig);
|
|
3628
|
-
protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
3629
|
-
protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount | null>;
|
|
3630
|
-
maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
3631
|
-
maxWithdraw(): Promise<PositionInfo>;
|
|
3632
|
-
protected _getDepositLeaf(): {
|
|
3633
|
-
target: ContractAddr;
|
|
3634
|
-
method: string;
|
|
3635
|
-
packedArguments: bigint[];
|
|
3636
|
-
sanitizer: ContractAddr;
|
|
3637
|
-
id: string;
|
|
3638
|
-
}[];
|
|
3639
|
-
protected _getWithdrawLeaf(): {
|
|
3640
|
-
target: ContractAddr;
|
|
3641
|
-
method: string;
|
|
3642
|
-
packedArguments: bigint[];
|
|
3643
|
-
sanitizer: ContractAddr;
|
|
3644
|
-
id: string;
|
|
3645
|
-
}[];
|
|
3646
|
-
getDepositCall(params: DepositParams): Promise<ManageCall[]>;
|
|
3647
|
-
getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
|
|
3648
|
-
getHealthFactor(): Promise<number>;
|
|
3649
|
-
}
|
|
3650
|
-
|
|
3651
3873
|
/**
|
|
3652
3874
|
* Transaction metadata that SDK generates and risk engine stores in DB.
|
|
3653
3875
|
* This metadata is used to track transaction lifecycle without coupling SDK to DB.
|
|
@@ -3726,17 +3948,15 @@ type ExecutionCallback = (eventType: ExecutionEventType, metadata: ExecutionEven
|
|
|
3726
3948
|
interface ExecutionConfig {
|
|
3727
3949
|
networkConfig: IConfig;
|
|
3728
3950
|
pricer: PricerBase;
|
|
3729
|
-
|
|
3951
|
+
vesuMultiplyAdapter: VesuMultiplyAdapter;
|
|
3730
3952
|
vesuModifyPositionAdapter: VesuModifyPositionAdapter;
|
|
3731
3953
|
extendedAdapter: ExtendedAdapter;
|
|
3732
3954
|
avnuAdapter: AvnuAdapter;
|
|
3733
|
-
|
|
3734
|
-
usdceTransferAdapter: TokenTransferAdapter;
|
|
3955
|
+
usdcTransferAdapter: TokenTransferAdapter;
|
|
3735
3956
|
vaultAllocator: ContractAddr;
|
|
3736
3957
|
walletAddress: string;
|
|
3737
3958
|
wbtcToken: TokenInfo;
|
|
3738
3959
|
usdcToken: TokenInfo;
|
|
3739
|
-
usdceToken: TokenInfo;
|
|
3740
3960
|
/**
|
|
3741
3961
|
* Returns the strategy's merkle tree (built from all leaf adapters).
|
|
3742
3962
|
* Used to generate proofs for adapter manage calls.
|
|
@@ -3891,7 +4111,8 @@ declare class ExecutionService {
|
|
|
3891
4111
|
*
|
|
3892
4112
|
* For deposit (USDC→BTC): price = sum(USDC sold) / sum(BTC bought)
|
|
3893
4113
|
* For withdraw (BTC→USDC): price = sum(USDC bought) / sum(BTC sold)
|
|
3894
|
-
|
|
4114
|
+
* @returns no-swap means, logic is fine and explicit no swap is needed
|
|
4115
|
+
*/
|
|
3895
4116
|
private _getNetExecutionPrice;
|
|
3896
4117
|
/** Clears cached swap price info on all adapters to prevent stale data across cycles. */
|
|
3897
4118
|
private _clearAdapterPriceInfo;
|
|
@@ -3959,7 +4180,7 @@ declare class ExecutionService {
|
|
|
3959
4180
|
/** Dispatches an on-chain route to the appropriate call builder. */
|
|
3960
4181
|
private _buildOnChainCalls;
|
|
3961
4182
|
/**
|
|
3962
|
-
* WALLET_TO_EXTENDED: Deposit USDC
|
|
4183
|
+
* WALLET_TO_EXTENDED: Deposit USDC from operator wallet directly to Extended.
|
|
3963
4184
|
*
|
|
3964
4185
|
* Builds raw approve + deposit calls (NOT through the manager/merkle system)
|
|
3965
4186
|
* because the wallet interacts with Extended directly, not via vault allocator.
|
|
@@ -3968,7 +4189,7 @@ declare class ExecutionService {
|
|
|
3968
4189
|
*/
|
|
3969
4190
|
private _buildWalletToExtendedCalls;
|
|
3970
4191
|
/**
|
|
3971
|
-
* VA_TO_EXTENDED: Deposit USDC
|
|
4192
|
+
* VA_TO_EXTENDED: Deposit USDC from vault allocator to Extended.
|
|
3972
4193
|
*
|
|
3973
4194
|
* Uses the extended adapter's getDepositCall to build ManageCalls,
|
|
3974
4195
|
* then wraps them in a merkle-verified manage call through the manager contract.
|
|
@@ -3977,7 +4198,7 @@ declare class ExecutionService {
|
|
|
3977
4198
|
*/
|
|
3978
4199
|
private _buildVAToExtendedCalls;
|
|
3979
4200
|
/**
|
|
3980
|
-
* WALLET_TO_VA: Transfer USDC
|
|
4201
|
+
* WALLET_TO_VA: Transfer USDC from operator wallet to vault allocator.
|
|
3981
4202
|
* Caps amount by actual wallet balance.
|
|
3982
4203
|
*/
|
|
3983
4204
|
private _buildWalletToVACalls;
|
|
@@ -4123,7 +4344,6 @@ interface VesuExtendedStrategySettings extends UniversalStrategySettings {
|
|
|
4123
4344
|
declare class VesuExtendedMultiplierStrategy<S extends VesuExtendedStrategySettings> extends SVKStrategy<S> {
|
|
4124
4345
|
wbtcToken: TokenInfo;
|
|
4125
4346
|
usdcToken: TokenInfo;
|
|
4126
|
-
usdceToken: TokenInfo;
|
|
4127
4347
|
readonly stateManager: ExtendedSVKVesuStateManager;
|
|
4128
4348
|
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
|
|
4129
4349
|
/**
|
|
@@ -4140,12 +4360,11 @@ declare class VesuExtendedMultiplierStrategy<S extends VesuExtendedStrategySetti
|
|
|
4140
4360
|
collateralPrice: PriceInfo;
|
|
4141
4361
|
debtPrice: PriceInfo;
|
|
4142
4362
|
}>;
|
|
4143
|
-
|
|
4363
|
+
getVesuMultiplyAdapter(): Promise<VesuMultiplyAdapter>;
|
|
4144
4364
|
getVesuModifyPositionAdapter(): Promise<VesuModifyPositionAdapter>;
|
|
4145
|
-
|
|
4365
|
+
getUsdcTransferAdapter(): Promise<TokenTransferAdapter>;
|
|
4146
4366
|
getAvnuAdapter(): Promise<AvnuAdapter>;
|
|
4147
4367
|
getExtendedAdapter(): Promise<ExtendedAdapter>;
|
|
4148
|
-
getUsdcToUsdceAdapter(): Promise<UsdcToUsdceAdapter>;
|
|
4149
4368
|
/**
|
|
4150
4369
|
* Creates an ExecutionService wired to this strategy's adapters and config.
|
|
4151
4370
|
* Use with `stateManager.solve()` to get a SolveResult, then pass it to
|
|
@@ -4198,7 +4417,7 @@ declare class VesuExtendedMultiplierStrategy<S extends VesuExtendedStrategySetti
|
|
|
4198
4417
|
}[];
|
|
4199
4418
|
}>;
|
|
4200
4419
|
/**
|
|
4201
|
-
* Fetches the operator wallet's current holdings for USDC
|
|
4420
|
+
* Fetches the operator wallet's current holdings for USDC and WBTC,
|
|
4202
4421
|
* returning each token's balance and USD value.
|
|
4203
4422
|
*/
|
|
4204
4423
|
getWalletHoldings(): Promise<{
|
|
@@ -5118,4 +5337,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
5118
5337
|
decrypt(encryptedData: string, password: string): any;
|
|
5119
5338
|
}
|
|
5120
5339
|
|
|
5121
|
-
export { type APYInfo, APYType, AUDIT_URL, AUMTypes, AVNU_EXCHANGE, AVNU_EXCHANGE_FOR_LEGACY_USDC, AVNU_LEGACY_SANITIZER, AVNU_MIDDLEWARE, AVNU_QUOTE_URL, AbisConfig, type AccessControlInfo, AccessControlType, type AccountInfo, type AdapterLeafType, AddressesConfig, type AllAccountsStore, type AmountInfo, type AmountsInfo, type ApiResponse, type ApproveCallParams, type AssetOperation, AssetOperationStatus, AssetOperationType, AuditStatus, AutoCompounderSTRK, AvnuAdapter, type AvnuAdapterConfig, type AvnuSwapCallParams, AvnuWrapper, type Balance, BaseAdapter, type BaseAdapterConfig, BaseStrategy, type BringLiquidityRoute, CASE_ROUTE_TYPES, type CLVaultStrategySettings, type CancelOrderRequest, CaseCategory, CaseId, CommonAdapter, type CommonAdapterConfig, ContractAddr, type CreateOrderRequest, type CrisisBorrowRoute, type CrisisExtendedLeverRoute, CycleType, 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, type ExecutionCallback, type ExecutionConfig, type ExecutionEventMetadata, ExecutionEventType, type ExecutionRoute, ExecutionService, ExitType, ExtendedAdapter, type ExtendedAdapterConfig, type ExtendedApiResponse, type ExtendedBalanceState, ExtendedConfig, type ExtendedLeverRoute, type ExtendedPositionDelta, type ExtendedPositionState, ExtendedSVKVesuStateManager, ExtendedWrapper, type ExtendedWrapperConfig, type FAQ, FactoryStrategyType, FatalError, type FilterOption, type FlashloanCallParams, FlowChartColors, type FundingPayment, type FundingRate, type GenerateCallFn, Global, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, InstantWithdrawalVault, type L2Config, LSTAPRService, LSTPriceType, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type LoggerConfig, type LoggerLevel, type ManageCall, MarginType, type Market, type MarketStats, Midas, MyNumber, type NetAPYDetails, type NetAPYSplit, Network, type OpenOrder, OrderSide, OrderStatus, OrderStatusReason, OrderType, PRICE_ROUTER, type ParsedStarknetCall, PasswordJsonCryptoUtil, type PlacedOrder, type Position, type PositionAPY, type PositionAmount, type PositionHistory, type PositionInfo, PositionSide, PositionTypeAvnuExtended, Pragma, type PriceInfo, Pricer, PricerBase, PricerFromApi, PricerLST, PricerRedis, Protocols, type RealisePnlRoute, type RedemptionInfo, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, type RiskFactorConfig, RiskType, type Route, type RouteNode, RouteType, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, type SecurityMetadata, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SettlementSignature, type SignedWithdrawRequest, type SingleActionAmount, type SingleTokenInfo, SolveBudget, type SolveCase, type SolveCaseEntry, type SolveResult, type SourceCodeInfo, SourceCodeType, StandardMerkleTree, type StandardMerkleTreeData, type StarkDebuggingOrderAmounts, type StarkSettlement, StarknetCallParser, type StarknetCallParserOptions, type StateManagerConfig, Store, type StoreConfig, type StrategyAlert, type StrategyCapabilities, type StrategyFilterMetadata, StrategyLiveStatus, type StrategyMetadata, type StrategyRegistryEntry, type StrategySettings, StrategyTag, StrategyType, type SupportedPosition, type Swap, type SwapInfo, type SwapPriceInfo, type SwapRoute, TRANSFER_SANITIZER, TelegramGroupNotif, TelegramNotif, TimeInForce, type TokenAmount, type TokenBalance, type TokenInfo, TokenMarketData, TokenTransferAdapter, type TokenTransferAdapterConfig, type TradingConfig, type TransactionMetadata, type TransactionResult, type TransferRoute, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, type UpdateLeverageRequest, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VaultType, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, VesuConfig, type VesuDebtRoute, type VesuDefiSpringRewardsCallParams, type VesuDepositParams, VesuExtendedMultiplierStrategy, type VesuExtendedStrategySettings, VesuExtendedTestStrategies, type VesuModifyDelegationCallParams, VesuModifyPositionAdapter, type VesuModifyPositionAdapterConfig, type VesuModifyPositionCallParams, type VesuModifyPositionDepositParams, type VesuModifyPositionWithdrawParams, VesuMultiplyAdapter, type VesuMultiplyAdapterConfig, type VesuMultiplyCallParams, type VesuMultiplyRoute, type VesuPoolDelta, VesuPoolMetadata, type VesuPoolState, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, VesuSupplyOnlyAdapter, type VesuSupplyOnlyAdapterConfig, type VesuWithdrawParams, type WaitRoute, Web3Number, type WithdrawParams, type WithdrawRequest, ZkLend, _riskFactor, assert, buildStrategyRegistry, calculateAmountDepositOnExtendedWhenIncurringLosses, calculateAmountDistribution, calculateAmountDistributionForWithdrawal, calculateBTCPriceDelta, calculateDebtAmount, calculateDebtReductionAmountForWithdrawal, calculateDeltaDebtAmount, calculateExposureDelta, calculateExtendedLevergae, calculatePositionToCloseToWithdrawAmount, calculateVesUPositionSizeGivenExtended, calculateVesuLeverage, calculateWBTCAmountToMaintainLTV, configureLogger, createEkuboCLStrategy, createHyperLSTStrategy, createSenseiStrategy, createStrategy, createUniversalStrategy, createVesuRebalanceStrategy, detectCapabilities, extensionMap, getAPIUsingHeadlessBrowser, getAllStrategyMetadata, getAllStrategyTags, getContractDetails, getDefaultStoreConfig, getFAQs, getFilterMetadata, getInvestmentSteps, getLiveStrategies, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getStrategiesByType, getStrategyTagDesciption, getStrategyTypeFromMetadata, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, isDualTokenStrategy, logger, returnFormattedAmount, routeSummary, toAmountsInfo, toBigInt };
|
|
5340
|
+
export { type APYInfo, APYType, AUDIT_URL, AUMTypes, AVNU_EXCHANGE, AVNU_EXCHANGE_FOR_LEGACY_USDC, AVNU_LEGACY_SANITIZER, AVNU_MIDDLEWARE, AVNU_QUOTE_URL, AbisConfig, type AccessControlInfo, AccessControlType, type AccountInfo, type AdapterLeafType, AddressesConfig, type AllAccountsStore, type AmountInfo, type AmountsInfo, type ApiResponse, type ApproveCallParams, type AssetOperation, AssetOperationStatus, AssetOperationType, AuditStatus, AutoCompounderSTRK, AvnuAdapter, type AvnuAdapterConfig, type AvnuSwapCallParams, AvnuWrapper, type Balance, BaseAdapter, type BaseAdapterConfig, BaseStrategy, type BringLiquidityRoute, CASE_ROUTE_TYPES, type CLVaultStrategySettings, COLLATERAL_PRECISION, type CancelOrderRequest, CaseCategory, CaseId, CommonAdapter, type CommonAdapterConfig, ContractAddr, type CreateOrderRequest, type CrisisBorrowRoute, type CrisisExtendedLeverRoute, CycleType, DEFAULT_TROVES_STRATEGIES_API, 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, type ExecutionCallback, type ExecutionConfig, type ExecutionEventMetadata, ExecutionEventType, type ExecutionRoute, ExecutionService, ExitType, ExtendedAdapter, type ExtendedAdapterConfig, type ExtendedApiResponse, type ExtendedBalanceState, ExtendedConfig, type ExtendedLeverRoute, type ExtendedPositionDelta, type ExtendedPositionState, ExtendedSVKVesuStateManager, ExtendedWrapper, type ExtendedWrapperConfig, type FAQ, FactoryStrategyType, FatalError, type FilterOption, type FlashloanCallParams, FlowChartColors, type FundingPayment, type FundingRate, type GenerateCallFn, Global, HealthFactorMath, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, InstantWithdrawalVault, type L2Config, LSTAPRService, LSTPriceType, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type LoggerConfig, type LoggerLevel, type ManageCall, MarginType, type Market, type MarketStats, Midas, MyNumber, type NetAPYDetails, type NetAPYSplit, Network, type OpenOrder, OrderSide, OrderStatus, OrderStatusReason, OrderType, PRICE_ROUTER, type ParsedStarknetCall, PasswordJsonCryptoUtil, type PlacedOrder, type Position, type PositionAPY, type PositionAmount, type PositionHistory, type PositionInfo, PositionSide, PositionTypeAvnuExtended, Pragma, type PriceInfo, Pricer, PricerBase, PricerFromApi, PricerLST, PricerRedis, Protocols, type RealisePnlRoute, type RedemptionInfo, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, type RiskFactorConfig, RiskType, type Route, type RouteNode, RouteType, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, type SecurityMetadata, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SettlementSignature, type SignedWithdrawRequest, type SingleActionAmount, type SingleTokenInfo, SolveBudget, type SolveCase, type SolveCaseEntry, type SolveResult, type SourceCodeInfo, SourceCodeType, StandardMerkleTree, type StandardMerkleTreeData, type StarkDebuggingOrderAmounts, type StarkSettlement, StarknetCallParser, type StarknetCallParserOptions, type StateManagerConfig, Store, type StoreConfig, type StrategyAlert, type StrategyCapabilities, type StrategyFilterMetadata, StrategyLiveStatus, type StrategyMetadata, type StrategyRegistryEntry, type StrategySettings, StrategyTag, StrategyType, type SupportedPosition, SvkTrovesAdapter, type SvkTrovesAdapterConfig, type Swap, type SwapInfo, type SwapPriceInfo, type SwapRoute, TRANSFER_SANITIZER, TelegramGroupNotif, TelegramNotif, TimeInForce, type TokenAmount, type TokenBalance, type TokenInfo, TokenMarketData, TokenTransferAdapter, type TokenTransferAdapterConfig, type TradingConfig, type TransactionMetadata, type TransactionResult, type TransferRoute, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, type UpdateLeverageRequest, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VaultType, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, VesuConfig, type VesuDebtRoute, type VesuDefiSpringRewardsCallParams, type VesuDepositParams, VesuExtendedMultiplierStrategy, type VesuExtendedStrategySettings, VesuExtendedTestStrategies, type VesuModifyDelegationCallParams, VesuModifyPositionAdapter, type VesuModifyPositionAdapterConfig, type VesuModifyPositionCallParams, type VesuModifyPositionDepositParams, type VesuModifyPositionWithdrawParams, VesuMultiplyAdapter, type VesuMultiplyAdapterConfig, type VesuMultiplyCallParams, type VesuMultiplyRoute, type VesuPoolDelta, VesuPoolMetadata, type VesuPoolState, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, VesuSupplyOnlyAdapter, type VesuSupplyOnlyAdapterConfig, type VesuWithdrawParams, type WaitRoute, Web3Number, type WithdrawParams, type WithdrawRequest, ZkLend, _riskFactor, assert, buildStrategyRegistry, calculateAmountDepositOnExtendedWhenIncurringLosses, calculateAmountDistribution, calculateAmountDistributionForWithdrawal, calculateBTCPriceDelta, calculateDebtAmount, calculateDebtReductionAmountForWithdrawal, calculateDeltaDebtAmount, calculateExposureDelta, calculateExtendedLevergae, calculatePositionToCloseToWithdrawAmount, calculateVesUPositionSizeGivenExtended, calculateVesuLeverage, calculateWBTCAmountToMaintainLTV, configureLogger, createEkuboCLStrategy, createHyperLSTStrategy, createSenseiStrategy, createSolveBudgetFromRawState, createStrategy, createUniversalStrategy, createVesuRebalanceStrategy, detectCapabilities, extensionMap, getAPIUsingHeadlessBrowser, getAllStrategyMetadata, getAllStrategyTags, getContractDetails, getDefaultStoreConfig, getFAQs, getFilterMetadata, getInvestmentSteps, getLiveStrategies, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getStrategiesByType, getStrategyTagDesciption, getStrategyTypeFromMetadata, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, isDualTokenStrategy, logger, returnFormattedAmount, routeSummary, toAmountsInfo, toBigInt };
|