@strkfarm/sdk 2.0.0-dev.5 → 2.0.0-dev.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +190 -36
- package/dist/cli.mjs +188 -34
- package/dist/index.browser.global.js +118889 -92229
- package/dist/index.browser.mjs +13381 -11153
- package/dist/index.d.ts +2284 -1938
- package/dist/index.js +13794 -11360
- package/dist/index.mjs +14253 -11843
- package/package.json +59 -60
- package/src/data/avnu.abi.json +840 -0
- package/src/data/ekubo-price-fethcer.abi.json +265 -0
- package/src/data/redeem-request-nft.abi.json +752 -0
- package/src/data/universal-vault.abi.json +8 -7
- package/src/dataTypes/_bignumber.ts +13 -4
- package/src/dataTypes/bignumber.browser.ts +10 -1
- package/src/dataTypes/bignumber.node.ts +10 -1
- package/src/dataTypes/index.ts +3 -2
- package/src/dataTypes/mynumber.ts +141 -0
- package/src/global.ts +280 -233
- package/src/index.browser.ts +2 -1
- package/src/interfaces/common.tsx +229 -6
- package/src/modules/apollo-client-config.ts +28 -0
- package/src/modules/avnu.ts +21 -12
- package/src/modules/ekubo-pricer.ts +99 -0
- package/src/modules/ekubo-quoter.ts +48 -30
- package/src/modules/erc20.ts +17 -0
- package/src/modules/harvests.ts +43 -29
- package/src/modules/index.ts +2 -1
- package/src/modules/pragma.ts +23 -8
- package/src/modules/pricer-avnu-api.ts +114 -0
- package/src/modules/pricer-from-api.ts +159 -15
- package/src/modules/pricer-lst.ts +1 -1
- package/src/modules/pricer-quote-utils.ts +54 -0
- package/src/modules/pricer.ts +157 -54
- package/src/modules/pricerBase.ts +2 -1
- package/src/modules/zkLend.ts +3 -2
- package/src/node/deployer.ts +36 -1
- package/src/node/pricer-redis.ts +3 -1
- package/src/strategies/base-strategy.ts +168 -16
- package/src/strategies/constants.ts +8 -3
- package/src/strategies/ekubo-cl-vault.tsx +1048 -355
- package/src/strategies/factory.ts +199 -0
- package/src/strategies/index.ts +5 -3
- package/src/strategies/registry.ts +262 -0
- package/src/strategies/sensei.ts +354 -10
- package/src/strategies/svk-strategy.ts +292 -31
- package/src/strategies/token-boosted-xstrk-carry-strategy.tsx +1261 -0
- package/src/strategies/types.ts +4 -0
- package/src/strategies/universal-adapters/adapter-utils.ts +4 -1
- package/src/strategies/universal-adapters/avnu-adapter.ts +196 -272
- package/src/strategies/universal-adapters/baseAdapter.ts +263 -251
- package/src/strategies/universal-adapters/common-adapter.ts +206 -203
- package/src/strategies/universal-adapters/index.ts +10 -8
- package/src/strategies/universal-adapters/svk-troves-adapter.ts +511 -0
- package/src/strategies/universal-adapters/token-transfer-adapter.ts +200 -0
- package/src/strategies/universal-adapters/vesu-adapter.ts +120 -82
- package/src/strategies/universal-adapters/vesu-modify-position-adapter.ts +525 -0
- package/src/strategies/universal-adapters/vesu-multiply-adapter.ts +866 -860
- package/src/strategies/universal-adapters/vesu-position-common.ts +258 -0
- package/src/strategies/universal-adapters/vesu-supply-only-adapter.ts +18 -3
- package/src/strategies/universal-lst-muliplier-strategy.tsx +895 -416
- package/src/strategies/universal-strategy.tsx +1332 -1173
- package/src/strategies/vesu-rebalance.tsx +254 -153
- package/src/strategies/yoloVault.ts +1096 -0
- package/src/utils/cacheClass.ts +11 -2
- package/src/utils/health-factor-math.ts +33 -1
- package/src/utils/index.ts +3 -1
- package/src/utils/logger.browser.ts +22 -4
- package/src/utils/logger.node.ts +259 -24
- package/src/utils/starknet-call-parser.ts +1036 -0
- package/src/utils/strategy-utils.ts +61 -0
- package/src/modules/ExtendedWrapperSDk/index.ts +0 -62
- package/src/modules/ExtendedWrapperSDk/types.ts +0 -311
- package/src/modules/ExtendedWrapperSDk/wrapper.ts +0 -395
- package/src/strategies/universal-adapters/extended-adapter.ts +0 -662
- package/src/strategies/universal-adapters/unused-balance-adapter.ts +0 -109
- package/src/strategies/vesu-extended-strategy/services/operationService.ts +0 -34
- package/src/strategies/vesu-extended-strategy/utils/config.runtime.ts +0 -77
- package/src/strategies/vesu-extended-strategy/utils/constants.ts +0 -49
- package/src/strategies/vesu-extended-strategy/utils/helper.ts +0 -372
- package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +0 -1140
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import BigNumber from 'bignumber.js';
|
|
2
1
|
import * as starknet from 'starknet';
|
|
3
|
-
import { RpcProvider, BlockIdentifier,
|
|
2
|
+
import { Uint256, RpcProvider, BlockIdentifier, Call, Contract, Account, CairoCustomEnum, RawArgs } from 'starknet';
|
|
3
|
+
import BigNumber from 'bignumber.js';
|
|
4
4
|
import React, { ReactNode } from 'react';
|
|
5
|
+
import { Quote, AvnuOptions } from '@avnu/avnu-sdk';
|
|
5
6
|
import { HexString, BytesLike } from '@ericnordelo/strk-merkle-tree/dist/bytes';
|
|
6
7
|
import { MultiProof } from '@ericnordelo/strk-merkle-tree/dist/core';
|
|
7
8
|
import { MerkleTreeImpl, MerkleTreeData } from '@ericnordelo/strk-merkle-tree/dist/merkletree';
|
|
8
9
|
import { MerkleTreeOptions } from '@ericnordelo/strk-merkle-tree/dist/options';
|
|
9
10
|
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 {
|
|
@@ -27,14 +27,18 @@ declare class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
|
|
|
27
27
|
minimum(value: string | number | T): T;
|
|
28
28
|
maximum(value: string | number | T): T;
|
|
29
29
|
abs(): T;
|
|
30
|
+
toFixedRoundDown(dp?: number): string;
|
|
30
31
|
toI129(): {
|
|
31
32
|
mag: bigint;
|
|
32
33
|
sign: 0 | 1;
|
|
33
34
|
};
|
|
35
|
+
toUint256(): starknet.Uint256;
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
declare class Web3Number extends _Web3Number<Web3Number> {
|
|
37
39
|
static fromWei(weiNumber: string | number, decimals: number): Web3Number;
|
|
40
|
+
static fromNumber(number: number, decimals: number): Web3Number;
|
|
41
|
+
static fromUint256(uint256Value: Uint256): Web3Number;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
/**
|
|
@@ -54,6 +58,33 @@ declare class ContractAddr {
|
|
|
54
58
|
shortString(left?: number, right?: number): string;
|
|
55
59
|
}
|
|
56
60
|
|
|
61
|
+
declare const customInspectSymbol: unique symbol;
|
|
62
|
+
declare class MyNumber {
|
|
63
|
+
bigNumber: BigNumber;
|
|
64
|
+
decimals: number;
|
|
65
|
+
constructor(bigNumber: string, decimals: number);
|
|
66
|
+
static fromEther(num: string, decimals: number): MyNumber;
|
|
67
|
+
static fromZero(): MyNumber;
|
|
68
|
+
toString(): string;
|
|
69
|
+
toEtherStr(): string;
|
|
70
|
+
toFixedStr(decimals: number): string;
|
|
71
|
+
toEtherToFixedDecimals(decimals: number): string;
|
|
72
|
+
isZero(): boolean;
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
* @param amountEther in token terms without decimal e.g. 1 for 1 STRK
|
|
76
|
+
* @param command BigNumber compare funds. e.g. gte, gt, lt
|
|
77
|
+
* @returns
|
|
78
|
+
* @dev Add more commands as needed
|
|
79
|
+
*/
|
|
80
|
+
compare(amountEther: string, command: "gte" | "gt" | "lt"): boolean;
|
|
81
|
+
operate(command: "div" | "plus" | "mul", value: string | number): MyNumber;
|
|
82
|
+
subtract(value: MyNumber): MyNumber;
|
|
83
|
+
static min(a: MyNumber, b: MyNumber): MyNumber;
|
|
84
|
+
static max(a: MyNumber, b: MyNumber): MyNumber;
|
|
85
|
+
[customInspectSymbol](depth: any, inspectOptions: any, inspect: any): string;
|
|
86
|
+
}
|
|
87
|
+
|
|
57
88
|
declare enum RiskType {
|
|
58
89
|
MARKET_RISK = "Market Risk",
|
|
59
90
|
IMPERMANENT_LOSS = "Impermanent Loss Risk",
|
|
@@ -71,6 +102,13 @@ interface RiskFactor {
|
|
|
71
102
|
weight: number;
|
|
72
103
|
reason?: string;
|
|
73
104
|
}
|
|
105
|
+
type PriceMethod = 'AvnuApi' | 'Coinbase' | 'Coinmarketcap' | 'Ekubo' | 'Avnu';
|
|
106
|
+
declare enum TokenIndexingType {
|
|
107
|
+
PEGGED = "pegged",
|
|
108
|
+
INDEXER = "indexer",
|
|
109
|
+
LST_SCRIPT = "lstScript",
|
|
110
|
+
IGNORE = "ignore"
|
|
111
|
+
}
|
|
74
112
|
interface TokenInfo {
|
|
75
113
|
name: string;
|
|
76
114
|
symbol: string;
|
|
@@ -81,6 +119,10 @@ interface TokenInfo {
|
|
|
81
119
|
displayDecimals: number;
|
|
82
120
|
priceProxySymbol?: string;
|
|
83
121
|
priceCheckAmount?: number;
|
|
122
|
+
priceMethod?: PriceMethod;
|
|
123
|
+
dontPrice?: boolean;
|
|
124
|
+
indexingType: TokenIndexingType;
|
|
125
|
+
intermediateQuoteTokenSymbol?: string;
|
|
84
126
|
}
|
|
85
127
|
declare enum Network {
|
|
86
128
|
mainnet = "mainnet",
|
|
@@ -97,6 +139,62 @@ interface IProtocol {
|
|
|
97
139
|
name: string;
|
|
98
140
|
logo: string;
|
|
99
141
|
}
|
|
142
|
+
interface ICurator {
|
|
143
|
+
name: string;
|
|
144
|
+
logo: string;
|
|
145
|
+
}
|
|
146
|
+
declare enum StrategyTag {
|
|
147
|
+
META_VAULT = "Meta Vaults",
|
|
148
|
+
LEVERED = "Maxx",
|
|
149
|
+
AUTOMATED_LP = "Ekubo",
|
|
150
|
+
BTC = "BTC"
|
|
151
|
+
}
|
|
152
|
+
declare enum VaultType {
|
|
153
|
+
LOOPING = "Looping",
|
|
154
|
+
META_VAULT = "Meta Vault",
|
|
155
|
+
DELTA_NEUTRAL = "Delta Neutral",
|
|
156
|
+
AUTOMATED_LP = "Automated LP",
|
|
157
|
+
TVA = "Troves Value Averaging"
|
|
158
|
+
}
|
|
159
|
+
declare enum AuditStatus {
|
|
160
|
+
AUDITED = "Audited",
|
|
161
|
+
NOT_AUDITED = "Not Audited"
|
|
162
|
+
}
|
|
163
|
+
declare enum SourceCodeType {
|
|
164
|
+
OPEN_SOURCE = "Open Source",
|
|
165
|
+
CLOSED_SOURCE = "Closed Source"
|
|
166
|
+
}
|
|
167
|
+
declare enum AccessControlType {
|
|
168
|
+
MULTISIG_ACCOUNT = "Multisig Account",
|
|
169
|
+
STANDARD_ACCOUNT = "Standard Account",
|
|
170
|
+
ROLE_BASED_ACCESS = "Role Based Access"
|
|
171
|
+
}
|
|
172
|
+
declare enum InstantWithdrawalVault {
|
|
173
|
+
YES = "Yes",
|
|
174
|
+
NO = "No"
|
|
175
|
+
}
|
|
176
|
+
interface SourceCodeInfo {
|
|
177
|
+
type: SourceCodeType;
|
|
178
|
+
contractLink: string;
|
|
179
|
+
}
|
|
180
|
+
interface AccessControlInfo {
|
|
181
|
+
type: AccessControlType;
|
|
182
|
+
addresses: ContractAddr[];
|
|
183
|
+
timeLock?: string;
|
|
184
|
+
}
|
|
185
|
+
interface SecurityMetadata {
|
|
186
|
+
auditStatus: AuditStatus;
|
|
187
|
+
sourceCode: SourceCodeInfo;
|
|
188
|
+
accessControl: AccessControlInfo;
|
|
189
|
+
}
|
|
190
|
+
interface RedemptionInfo {
|
|
191
|
+
instantWithdrawalVault: InstantWithdrawalVault;
|
|
192
|
+
redemptionsInfo: {
|
|
193
|
+
title: string;
|
|
194
|
+
description: string;
|
|
195
|
+
}[];
|
|
196
|
+
alerts: StrategyAlert[];
|
|
197
|
+
}
|
|
100
198
|
declare enum FlowChartColors {
|
|
101
199
|
Green = "purple",
|
|
102
200
|
Blue = "#35484f",
|
|
@@ -106,26 +204,82 @@ interface FAQ {
|
|
|
106
204
|
question: string | React.ReactNode;
|
|
107
205
|
answer: string | React.ReactNode;
|
|
108
206
|
}
|
|
207
|
+
declare enum StrategyLiveStatus {
|
|
208
|
+
ACTIVE = "Active",
|
|
209
|
+
NEW = "New",
|
|
210
|
+
COMING_SOON = "Coming Soon",
|
|
211
|
+
DEPRECATED = "Deprecated",// active but not recommended
|
|
212
|
+
RETIRED = "Retired",// not active anymore
|
|
213
|
+
HOT = "Hot & New \uD83D\uDD25"
|
|
214
|
+
}
|
|
215
|
+
interface StrategyAlert {
|
|
216
|
+
type: "warning" | "info";
|
|
217
|
+
text: string | React.ReactNode;
|
|
218
|
+
tab: "all" | "deposit" | "withdraw";
|
|
219
|
+
}
|
|
220
|
+
interface StrategySettings {
|
|
221
|
+
liveStatus?: StrategyLiveStatus;
|
|
222
|
+
isPaused?: boolean;
|
|
223
|
+
isInMaintenance?: boolean;
|
|
224
|
+
isAudited: boolean;
|
|
225
|
+
isInstantWithdrawal?: boolean;
|
|
226
|
+
hideHarvestInfo?: boolean;
|
|
227
|
+
is_promoted?: boolean;
|
|
228
|
+
isTransactionHistDisabled?: boolean;
|
|
229
|
+
quoteToken: TokenInfo;
|
|
230
|
+
hideNetEarnings?: boolean;
|
|
231
|
+
showWithdrawalWarningModal?: boolean;
|
|
232
|
+
alerts?: StrategyAlert[];
|
|
233
|
+
tags?: StrategyTag[];
|
|
234
|
+
}
|
|
235
|
+
interface StrategyApyHistoryUIConfig {
|
|
236
|
+
showApyHistory?: boolean;
|
|
237
|
+
noApyHistoryMessage?: string;
|
|
238
|
+
}
|
|
239
|
+
interface FeeBps {
|
|
240
|
+
performanceFeeBps: number;
|
|
241
|
+
}
|
|
109
242
|
/**
|
|
110
243
|
* @property risk.riskFactor.factor - The risk factors that are considered for the strategy.
|
|
111
244
|
* @property risk.riskFactor.factor - The value of the risk factor from 0 to 10, 0 being the lowest and 10 being the highest.
|
|
245
|
+
* @property security - Security-related metadata including audit status, source code information, and access control details.
|
|
246
|
+
* @property redemptionInfo - Redemption information including instant withdrawal availability and expected redemption times.
|
|
112
247
|
*/
|
|
113
248
|
interface IStrategyMetadata<T> {
|
|
249
|
+
id: string;
|
|
114
250
|
name: string;
|
|
115
251
|
description: string | React.ReactNode;
|
|
252
|
+
/**
|
|
253
|
+
* Optional UI sort priority. Higher shows earlier.
|
|
254
|
+
* Intended for pinning flagship parent vaults (e.g. BTC above STRK).
|
|
255
|
+
*/
|
|
256
|
+
priority?: number;
|
|
257
|
+
/**
|
|
258
|
+
* Optional UI config for the variant intro popup (strategy page).
|
|
259
|
+
* Should be identical across strategies that share the same `parentId`.
|
|
260
|
+
*/
|
|
261
|
+
variantIntro?: {
|
|
262
|
+
title: string;
|
|
263
|
+
description: string;
|
|
264
|
+
};
|
|
116
265
|
address: ContractAddr;
|
|
117
266
|
launchBlock: number;
|
|
118
267
|
type: "ERC4626" | "ERC721" | "Other";
|
|
268
|
+
vaultType: {
|
|
269
|
+
type: VaultType;
|
|
270
|
+
description: string;
|
|
271
|
+
};
|
|
119
272
|
depositTokens: TokenInfo[];
|
|
120
273
|
protocols: IProtocol[];
|
|
121
274
|
auditUrl?: string;
|
|
122
|
-
maxTVL: Web3Number;
|
|
123
275
|
risk: {
|
|
124
276
|
riskFactor: RiskFactor[];
|
|
125
277
|
netRisk: number;
|
|
126
278
|
notARisks: RiskType[];
|
|
127
279
|
};
|
|
128
280
|
apyMethodology?: string;
|
|
281
|
+
realizedApyMethodology?: string;
|
|
282
|
+
feeBps?: FeeBps;
|
|
129
283
|
additionalInfo: T;
|
|
130
284
|
contractDetails: {
|
|
131
285
|
address: ContractAddr;
|
|
@@ -140,11 +294,41 @@ interface IStrategyMetadata<T> {
|
|
|
140
294
|
}[];
|
|
141
295
|
docs?: string;
|
|
142
296
|
investmentSteps: string[];
|
|
143
|
-
curator?:
|
|
144
|
-
name: string;
|
|
145
|
-
logo: string;
|
|
146
|
-
};
|
|
297
|
+
curator?: ICurator;
|
|
147
298
|
isPreview?: boolean;
|
|
299
|
+
tags?: StrategyTag[];
|
|
300
|
+
security: SecurityMetadata;
|
|
301
|
+
redemptionInfo: RedemptionInfo;
|
|
302
|
+
usualTimeToEarnings: null | string;
|
|
303
|
+
usualTimeToEarningsDescription: null | string;
|
|
304
|
+
discontinuationInfo?: {
|
|
305
|
+
date?: Date;
|
|
306
|
+
reason?: React.ReactNode | string;
|
|
307
|
+
info?: React.ReactNode | string;
|
|
308
|
+
};
|
|
309
|
+
settings?: StrategySettings;
|
|
310
|
+
apyHistoryUIConfig?: StrategyApyHistoryUIConfig;
|
|
311
|
+
actions?: Array<{
|
|
312
|
+
name?: string;
|
|
313
|
+
pool?: {
|
|
314
|
+
protocol?: {
|
|
315
|
+
name: string;
|
|
316
|
+
logo: string;
|
|
317
|
+
};
|
|
318
|
+
pool?: {
|
|
319
|
+
name: string;
|
|
320
|
+
logos?: string[];
|
|
321
|
+
};
|
|
322
|
+
apr?: number;
|
|
323
|
+
borrow?: {
|
|
324
|
+
apr?: number;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
amount?: string | number;
|
|
328
|
+
isDeposit?: boolean;
|
|
329
|
+
}>;
|
|
330
|
+
parentId?: string;
|
|
331
|
+
parentName?: string;
|
|
148
332
|
}
|
|
149
333
|
interface IInvestmentFlow {
|
|
150
334
|
id?: string;
|
|
@@ -157,6 +341,8 @@ interface IInvestmentFlow {
|
|
|
157
341
|
style?: any;
|
|
158
342
|
}
|
|
159
343
|
declare function getMainnetConfig(rpcUrl?: string, blockIdentifier?: BlockIdentifier): IConfig;
|
|
344
|
+
declare const getStrategyTagDesciption: (tag: StrategyTag) => string;
|
|
345
|
+
declare const getAllStrategyTags: () => StrategyTag[];
|
|
160
346
|
declare const getRiskExplaination: (riskType: RiskType) => "The risk of the market moving against the position." | "The temporary loss of value experienced by liquidity providers in AMMs when asset prices diverge compared to simply holding them." | "The risk of losing funds due to the position being liquidated." | "The risk of low liquidity in the pool, which can lead to high slippages or reduced in-abilities to quickly exit the position." | "The risk of the oracle being manipulated or incorrect." | "The risk of the smart contract being vulnerable to attacks." | "The risk of technical issues e.g. backend failure." | "The risk of the counterparty defaulting e.g. bad debt on lending platforms." | "The risk of a token losing its peg to the underlying asset, leading to potential losses for holders.";
|
|
161
347
|
declare const getRiskColor: (risk: RiskFactor) => "light_green_2" | "yellow" | "red";
|
|
162
348
|
declare const getNoRiskTags: (risks: RiskFactor[]) => RiskType[];
|
|
@@ -172,6 +358,27 @@ interface VaultPosition {
|
|
|
172
358
|
remarks: string;
|
|
173
359
|
protocol: IProtocol;
|
|
174
360
|
}
|
|
361
|
+
interface AmountInfo {
|
|
362
|
+
amount: Web3Number;
|
|
363
|
+
usdValue: number;
|
|
364
|
+
tokenInfo: TokenInfo;
|
|
365
|
+
}
|
|
366
|
+
interface AmountsInfo {
|
|
367
|
+
usdValue: number;
|
|
368
|
+
amounts: AmountInfo[];
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Strategy capabilities interface
|
|
372
|
+
* Describes what optional methods a strategy instance supports
|
|
373
|
+
*/
|
|
374
|
+
interface StrategyCapabilities {
|
|
375
|
+
hasMatchInputAmounts: boolean;
|
|
376
|
+
hasNetAPY: boolean;
|
|
377
|
+
hasGetInvestmentFlows: boolean;
|
|
378
|
+
hasGetPendingRewards: boolean;
|
|
379
|
+
hasHarvest: boolean;
|
|
380
|
+
hasRebalance: boolean;
|
|
381
|
+
}
|
|
175
382
|
declare const Protocols: {
|
|
176
383
|
NONE: IProtocol;
|
|
177
384
|
VESU: IProtocol;
|
|
@@ -180,7 +387,9 @@ declare const Protocols: {
|
|
|
180
387
|
EKUBO: IProtocol;
|
|
181
388
|
AVNU: IProtocol;
|
|
182
389
|
VAULT: IProtocol;
|
|
390
|
+
TROVES: IProtocol;
|
|
183
391
|
};
|
|
392
|
+
declare const UnwrapLabsCurator: ICurator;
|
|
184
393
|
|
|
185
394
|
interface ILendingMetadata {
|
|
186
395
|
name: string;
|
|
@@ -234,6 +443,27 @@ declare abstract class Initializable {
|
|
|
234
443
|
waitForInitilisation(): Promise<void>;
|
|
235
444
|
}
|
|
236
445
|
|
|
446
|
+
/**
|
|
447
|
+
* Polls Avnu impulse tokens API and keeps USD prices in memory for configured tokens.
|
|
448
|
+
* Price timestamp is set when each poll request completes.
|
|
449
|
+
*/
|
|
450
|
+
declare class PricerAvnuApi extends PricerBase {
|
|
451
|
+
protected prices: {
|
|
452
|
+
[key: string]: PriceInfo;
|
|
453
|
+
};
|
|
454
|
+
readonly refreshInterval = 15000;
|
|
455
|
+
readonly staleTime: number;
|
|
456
|
+
private pollTimer;
|
|
457
|
+
private loading;
|
|
458
|
+
constructor(config: IConfig, tokens: TokenInfo[]);
|
|
459
|
+
start(): void;
|
|
460
|
+
stop(): void;
|
|
461
|
+
isStale(timestamp: Date): boolean;
|
|
462
|
+
hasPrice(tokenSymbol: string): boolean;
|
|
463
|
+
getPrice(tokenSymbol: string): Promise<PriceInfo>;
|
|
464
|
+
protected _loadPrices(): Promise<void>;
|
|
465
|
+
}
|
|
466
|
+
|
|
237
467
|
interface PriceInfo {
|
|
238
468
|
price: number;
|
|
239
469
|
timestamp: Date;
|
|
@@ -244,8 +474,9 @@ declare class Pricer extends PricerBase {
|
|
|
244
474
|
};
|
|
245
475
|
refreshInterval: number;
|
|
246
476
|
staleTime: number;
|
|
477
|
+
protected readonly avnuApiPricer: PricerAvnuApi;
|
|
247
478
|
protected methodToUse: {
|
|
248
|
-
[tokenSymbol: string]:
|
|
479
|
+
[tokenSymbol: string]: PriceMethod;
|
|
249
480
|
};
|
|
250
481
|
/**
|
|
251
482
|
* TOKENA and TOKENB are the two token names to get price of TokenA in terms of TokenB
|
|
@@ -258,11 +489,17 @@ declare class Pricer extends PricerBase {
|
|
|
258
489
|
start(): void;
|
|
259
490
|
isStale(timestamp: Date, tokenName: string): boolean;
|
|
260
491
|
assertNotStale(timestamp: Date, tokenName: string): void;
|
|
261
|
-
getPrice(tokenSymbol: string): Promise<PriceInfo>;
|
|
492
|
+
getPrice(tokenSymbol: string, blockNumber?: BlockIdentifier): Promise<PriceInfo>;
|
|
262
493
|
protected _loadPrices(onUpdate?: (tokenSymbol: string) => void): void;
|
|
263
|
-
_getPrice(token: TokenInfo
|
|
494
|
+
_getPrice(token: TokenInfo): Promise<number>;
|
|
495
|
+
protected _getMethodsToTry(token: TokenInfo): PriceMethod[];
|
|
496
|
+
protected _tryPriceMethod(token: TokenInfo, method: PriceMethod): Promise<number>;
|
|
497
|
+
_getPriceAvnuApi(token: TokenInfo): Promise<number>;
|
|
264
498
|
_getPriceCoinbase(token: TokenInfo): Promise<number>;
|
|
265
499
|
_getPriceCoinMarketCap(token: TokenInfo): Promise<number>;
|
|
500
|
+
protected _resolveQuoteTokenUsdPrice(symbol: string): Promise<number>;
|
|
501
|
+
protected _convertDexQuoteToUsd(token: TokenInfo, quoteAmount: number): Promise<number>;
|
|
502
|
+
_getAvnuPrice(token: TokenInfo, amountIn?: Web3Number, retry?: number): Promise<number>;
|
|
266
503
|
_getPriceEkubo(token: TokenInfo, amountIn?: Web3Number, retry?: number): Promise<number>;
|
|
267
504
|
}
|
|
268
505
|
|
|
@@ -270,7 +507,7 @@ declare abstract class PricerBase {
|
|
|
270
507
|
readonly config: IConfig;
|
|
271
508
|
readonly tokens: TokenInfo[];
|
|
272
509
|
constructor(config: IConfig, tokens: TokenInfo[]);
|
|
273
|
-
getPrice(tokenSymbol: string): Promise<PriceInfo>;
|
|
510
|
+
getPrice(tokenSymbol: string, blockNumber?: BlockIdentifier): Promise<PriceInfo>;
|
|
274
511
|
}
|
|
275
512
|
|
|
276
513
|
interface CacheData$1 {
|
|
@@ -280,296 +517,356 @@ interface CacheData$1 {
|
|
|
280
517
|
}
|
|
281
518
|
declare class CacheClass {
|
|
282
519
|
readonly cache: Map<string, CacheData$1>;
|
|
520
|
+
isCacheEnabled: boolean;
|
|
283
521
|
setCache(key: string, data: any, ttl?: number): void;
|
|
284
522
|
getCache<T>(key: string): T | null;
|
|
285
523
|
isCacheValid(key: string): boolean;
|
|
524
|
+
disableCache(): void;
|
|
525
|
+
enableCache(): void;
|
|
286
526
|
}
|
|
287
527
|
|
|
288
|
-
interface
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
528
|
+
interface HarvestInfo {
|
|
529
|
+
rewardsContract: ContractAddr;
|
|
530
|
+
token: ContractAddr;
|
|
531
|
+
startDate: Date;
|
|
532
|
+
endDate: Date;
|
|
533
|
+
claim: {
|
|
534
|
+
id: number;
|
|
535
|
+
amount: Web3Number;
|
|
536
|
+
claimee: ContractAddr;
|
|
537
|
+
};
|
|
538
|
+
actualReward: Web3Number;
|
|
539
|
+
proof: string[];
|
|
298
540
|
}
|
|
299
|
-
declare const logger: MyLogger;
|
|
300
541
|
|
|
301
|
-
interface
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
data: bigint[];
|
|
542
|
+
interface SingleActionAmount {
|
|
543
|
+
tokenInfo: TokenInfo;
|
|
544
|
+
amount: Web3Number;
|
|
305
545
|
}
|
|
306
|
-
interface
|
|
307
|
-
|
|
308
|
-
leafEncoding: ValueType[];
|
|
546
|
+
interface SingleTokenInfo extends SingleActionAmount {
|
|
547
|
+
usdValue: number;
|
|
309
548
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
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>;
|
|
549
|
+
interface APYInfo {
|
|
550
|
+
net: number;
|
|
551
|
+
splits: {
|
|
552
|
+
apy: number;
|
|
553
|
+
id: string;
|
|
554
|
+
}[];
|
|
319
555
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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
|
-
};
|
|
556
|
+
interface DualActionAmount {
|
|
557
|
+
token0: SingleActionAmount;
|
|
558
|
+
token1: SingleActionAmount;
|
|
337
559
|
}
|
|
338
|
-
interface
|
|
339
|
-
|
|
560
|
+
interface DualTokenInfo {
|
|
561
|
+
usdValue: number;
|
|
562
|
+
token0: SingleTokenInfo;
|
|
563
|
+
token1: SingleTokenInfo;
|
|
340
564
|
}
|
|
341
|
-
|
|
342
|
-
|
|
565
|
+
type StrategyInputMode = "single" | "dual";
|
|
566
|
+
type InputModeFromAction<T> = T extends DualActionAmount ? "dual" : "single";
|
|
567
|
+
interface NetAPYSplit {
|
|
568
|
+
apy: number;
|
|
569
|
+
id: string;
|
|
343
570
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
callConstructor: GenerateCallFn<T>;
|
|
348
|
-
};
|
|
349
|
-
type LeafAdapterFn<T> = () => AdapterLeafType<T>;
|
|
350
|
-
declare enum APYType {
|
|
351
|
-
BASE = "base",
|
|
352
|
-
REWARD = "reward",
|
|
353
|
-
LST = "lst"
|
|
571
|
+
interface NetAPYDetails {
|
|
572
|
+
net: number;
|
|
573
|
+
splits: NetAPYSplit[];
|
|
354
574
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
575
|
+
type UserPositionCardSubValueColor = "default" | "positive" | "negative" | "info";
|
|
576
|
+
interface UserPositionCard {
|
|
577
|
+
title: string;
|
|
578
|
+
value: string;
|
|
579
|
+
tooltip?: string;
|
|
580
|
+
subValue?: string;
|
|
581
|
+
subValueColor?: UserPositionCardSubValueColor;
|
|
358
582
|
}
|
|
359
|
-
interface
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
583
|
+
interface UserPositionCardsInput {
|
|
584
|
+
user: ContractAddr;
|
|
585
|
+
investmentFlows?: Array<{
|
|
586
|
+
amount: string;
|
|
587
|
+
type: string;
|
|
588
|
+
timestamp: number;
|
|
589
|
+
tx_hash: string;
|
|
590
|
+
}>;
|
|
591
|
+
usualTimeToEarnings?: string | null;
|
|
592
|
+
usualTimeToEarningsDescription?: string | null;
|
|
366
593
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
594
|
+
interface CacheData {
|
|
595
|
+
timestamp: number;
|
|
596
|
+
ttl: number;
|
|
597
|
+
data: any;
|
|
598
|
+
}
|
|
599
|
+
declare class BaseStrategy<TVLInfo, DepositActionInfo, WithdrawActionInfo = DepositActionInfo> extends CacheClass {
|
|
600
|
+
readonly config: IConfig;
|
|
601
|
+
readonly cache: Map<string, CacheData>;
|
|
602
|
+
private readonly _depositInputMode;
|
|
603
|
+
private readonly _withdrawInputMode;
|
|
604
|
+
constructor(config: IConfig, inputModes?: {
|
|
605
|
+
depositInputMode?: InputModeFromAction<DepositActionInfo>;
|
|
606
|
+
withdrawInputMode?: InputModeFromAction<WithdrawActionInfo>;
|
|
607
|
+
});
|
|
608
|
+
depositInputMode(): InputModeFromAction<DepositActionInfo>;
|
|
609
|
+
withdrawInputMode(): InputModeFromAction<WithdrawActionInfo>;
|
|
610
|
+
getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<TVLInfo>;
|
|
611
|
+
getTVL(): Promise<TVLInfo>;
|
|
612
|
+
depositCall(amountInfo: DepositActionInfo, receiver: ContractAddr): Promise<Call[]>;
|
|
613
|
+
withdrawCall(amountInfo: WithdrawActionInfo, receiver: ContractAddr, owner: ContractAddr, isMaxWithdraw?: boolean): Promise<Call[]>;
|
|
614
|
+
getVaultPositions(): Promise<VaultPosition[]>;
|
|
615
|
+
netAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number, timeperiod?: "24h" | "7d" | "30d" | "3m"): Promise<number | string | NetAPYDetails>;
|
|
616
|
+
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
617
|
+
getUserRealizedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
618
|
+
getUserPositionCards(_input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
619
|
+
getMaxTVL(): Promise<Web3Number>;
|
|
620
|
+
protected formatTokenAmountForCard(amount: Web3Number, tokenInfo: TokenInfo): string;
|
|
621
|
+
protected formatPercentForCard(value: number): string;
|
|
622
|
+
protected formatUSDForCard(value: number): string;
|
|
623
|
+
protected getSubValueColorFromSignedNumber(value: number): UserPositionCardSubValueColor;
|
|
624
|
+
/**
|
|
625
|
+
* Calculate lifetime earnings for a user based on provided data from client
|
|
626
|
+
* Formula: lifetimeEarnings = currentValue + totalWithdrawals - totalDeposits
|
|
627
|
+
*
|
|
628
|
+
* @param userTVL - The user's current TVL (SingleTokenInfo with amount, usdValue, tokenInfo)
|
|
629
|
+
* @param investmentFlows - Array of investment flow transactions from client
|
|
630
|
+
* @returns Object containing lifetime earnings, current value, and total deposits/withdrawals
|
|
631
|
+
*/
|
|
632
|
+
getLifetimeEarnings(userTVL: SingleTokenInfo, investmentFlows: Array<{
|
|
633
|
+
amount: string;
|
|
634
|
+
type: string;
|
|
635
|
+
timestamp: number;
|
|
636
|
+
tx_hash: string;
|
|
637
|
+
}>): {
|
|
638
|
+
tokenInfo: SingleTokenInfo;
|
|
639
|
+
lifetimeEarnings: Web3Number;
|
|
640
|
+
currentValue: Web3Number;
|
|
641
|
+
totalDeposits: Web3Number;
|
|
642
|
+
totalWithdrawals: Web3Number;
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/**
|
|
647
|
+
* TokenMarketData class that combines LST APR and Midas modules
|
|
648
|
+
* to provide unified APY, price, and TVL functions for tokens
|
|
649
|
+
*/
|
|
650
|
+
declare class TokenMarketData {
|
|
651
|
+
private pricer;
|
|
652
|
+
private config;
|
|
653
|
+
constructor(pricer: PricerBase, config: IConfig);
|
|
388
654
|
/**
|
|
389
|
-
*
|
|
655
|
+
* Get APY for a token
|
|
656
|
+
* - If it's an LST token, returns LST APY
|
|
657
|
+
* - If it's a Midas token, returns Midas APY
|
|
658
|
+
* - Otherwise returns 0
|
|
659
|
+
* @param tokenInfo The token to get APY for
|
|
660
|
+
* @returns APY in absolute terms (not percentage)
|
|
390
661
|
*/
|
|
391
|
-
|
|
662
|
+
getAPY(tokenInfo: TokenInfo): Promise<number>;
|
|
392
663
|
/**
|
|
393
|
-
*
|
|
664
|
+
* Get price for a token using the pricer module
|
|
665
|
+
* @param tokenInfo The token to get price for
|
|
666
|
+
* @returns Price as a number
|
|
667
|
+
* @throws Error if price is 0 or unavailable
|
|
394
668
|
*/
|
|
395
|
-
|
|
669
|
+
getPrice(tokenInfo: TokenInfo): Promise<number>;
|
|
396
670
|
/**
|
|
397
|
-
*
|
|
671
|
+
* Get true price for a token
|
|
672
|
+
* - For LST tokens: Uses convert_to_assets to get true exchange rate
|
|
673
|
+
* - For Midas tokens: Uses Midas price API
|
|
674
|
+
* - For other tokens: Falls back to regular pricer
|
|
675
|
+
* @param tokenInfo The token to get true price for
|
|
676
|
+
* @returns True price as a number
|
|
677
|
+
* @throws Error if price is 0 or unavailable
|
|
398
678
|
*/
|
|
399
|
-
|
|
679
|
+
getTruePrice(tokenInfo: TokenInfo): Promise<number>;
|
|
400
680
|
/**
|
|
401
|
-
*
|
|
402
|
-
*
|
|
681
|
+
* Get TVL for a token
|
|
682
|
+
* - If it's a Midas token, returns Midas TVL data
|
|
683
|
+
* - Otherwise returns 0
|
|
684
|
+
* @param tokenInfo The token to get TVL for
|
|
685
|
+
* @returns TVL as SingleTokenInfo or 0
|
|
403
686
|
*/
|
|
404
|
-
|
|
687
|
+
getTVL(tokenInfo: TokenInfo): Promise<SingleTokenInfo>;
|
|
405
688
|
/**
|
|
406
|
-
*
|
|
689
|
+
* Check if a token is supported for APY data
|
|
690
|
+
* @param tokenInfo The token to check
|
|
691
|
+
* @returns True if the token has APY data available
|
|
407
692
|
*/
|
|
408
|
-
|
|
693
|
+
isAPYSupported(tokenInfo: TokenInfo): boolean;
|
|
409
694
|
/**
|
|
410
|
-
*
|
|
695
|
+
* Check if a token is supported for TVL data
|
|
696
|
+
* @param tokenInfo The token to check
|
|
697
|
+
* @returns True if the token has TVL data available
|
|
411
698
|
*/
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}[];
|
|
429
|
-
/**
|
|
430
|
-
* Implementor must provide target/method/packedArguments/sanitizer for withdraw leaf construction
|
|
431
|
-
*/
|
|
432
|
-
protected abstract _getWithdrawLeaf(): {
|
|
433
|
-
target: ContractAddr;
|
|
434
|
-
method: string;
|
|
435
|
-
packedArguments: bigint[];
|
|
436
|
-
sanitizer: ContractAddr;
|
|
437
|
-
id: string;
|
|
438
|
-
}[];
|
|
699
|
+
isTVLSupported(tokenInfo: TokenInfo): boolean;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
declare class Pragma extends PricerBase {
|
|
703
|
+
contractAddr: string;
|
|
704
|
+
readonly contract: Contract;
|
|
705
|
+
constructor(config: IConfig, tokens: TokenInfo[]);
|
|
706
|
+
getPrice(tokenAddr: string, blockIdentifier?: BlockIdentifier): Promise<PriceInfo>;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
declare class ZkLend extends ILending implements ILending {
|
|
710
|
+
readonly pricer: Pricer;
|
|
711
|
+
static readonly POOLS_URL = "https://app.zklend.com/api/pools";
|
|
712
|
+
private POSITION_URL;
|
|
713
|
+
constructor(config: IConfig, pricer: Pricer);
|
|
714
|
+
init(): Promise<void>;
|
|
439
715
|
/**
|
|
440
|
-
*
|
|
716
|
+
* @description Get the health factor of the user for given lending and debt tokens
|
|
717
|
+
* @param lending_tokens
|
|
718
|
+
* @param debt_tokens
|
|
719
|
+
* @param user
|
|
720
|
+
* @returns hf (e.g. returns 1.5 for 150% health factor)
|
|
441
721
|
*/
|
|
442
|
-
|
|
722
|
+
get_health_factor_tokenwise(lending_tokens: TokenInfo[], debt_tokens: TokenInfo[], user: ContractAddr): Promise<number>;
|
|
443
723
|
/**
|
|
444
|
-
*
|
|
724
|
+
* @description Get the health factor of the user
|
|
725
|
+
* - Considers all tokens for collateral and debt
|
|
445
726
|
*/
|
|
446
|
-
|
|
727
|
+
get_health_factor(user: ContractAddr): Promise<number>;
|
|
728
|
+
getPositionsSummary(user: ContractAddr): Promise<{
|
|
729
|
+
collateralUSD: number;
|
|
730
|
+
debtUSD: number;
|
|
731
|
+
}>;
|
|
447
732
|
/**
|
|
448
|
-
*
|
|
449
|
-
* @param
|
|
733
|
+
* @description Get the token-wise collateral and debt positions of the user
|
|
734
|
+
* @param user Contract address of the user
|
|
735
|
+
* @returns Promise<ILendingPosition[]>
|
|
450
736
|
*/
|
|
451
|
-
|
|
737
|
+
getPositions(user: ContractAddr): Promise<ILendingPosition[]>;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
declare class PricerFromApi extends PricerBase {
|
|
741
|
+
private apolloClient;
|
|
742
|
+
private pragma;
|
|
743
|
+
private ekuboPricer;
|
|
744
|
+
private readonly PRAGMA_SUPPORTED_TOKENS;
|
|
745
|
+
constructor(config: IConfig, tokens: TokenInfo[]);
|
|
746
|
+
getPrice(tokenSymbol: string, blockNumber?: BlockIdentifier): Promise<PriceInfo>;
|
|
747
|
+
getPriceFromMyAPI(tokenSymbol: string): Promise<{
|
|
748
|
+
price: number;
|
|
749
|
+
timestamp: Date;
|
|
750
|
+
}>;
|
|
452
751
|
/**
|
|
453
|
-
*
|
|
454
|
-
* @param
|
|
752
|
+
* Fetches historical price for a token at a specific block number
|
|
753
|
+
* @param tokenSymbol - The token symbol to get price for
|
|
754
|
+
* @param blockNumber - The block number to query
|
|
755
|
+
* @returns PriceInfo with price at the closest block <= blockNumber
|
|
455
756
|
*/
|
|
456
|
-
|
|
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>;
|
|
757
|
+
getHistoricalPrice(tokenSymbol: string, blockNumber: BlockIdentifier): Promise<PriceInfo>;
|
|
463
758
|
}
|
|
464
759
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
760
|
+
declare class ERC20 {
|
|
761
|
+
readonly config: IConfig;
|
|
762
|
+
constructor(config: IConfig);
|
|
763
|
+
contract(addr: string | ContractAddr): Contract;
|
|
764
|
+
balanceOf(token: string | ContractAddr, address: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
|
|
765
|
+
allowance(token: string | ContractAddr, owner: string | ContractAddr, spender: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
|
|
766
|
+
transfer(token: string | ContractAddr, to: string | ContractAddr, amount: Web3Number): starknet.Call;
|
|
767
|
+
transferFrom(token: string | ContractAddr, from: string | ContractAddr, to: string | ContractAddr, amount: Web3Number): starknet.Call;
|
|
768
|
+
approve(token: string | ContractAddr, spender: string | ContractAddr, amount: Web3Number): starknet.Call;
|
|
471
769
|
}
|
|
472
|
-
|
|
473
|
-
|
|
770
|
+
|
|
771
|
+
interface Route {
|
|
772
|
+
token_from: string;
|
|
773
|
+
token_to: string;
|
|
774
|
+
exchange_address: string;
|
|
775
|
+
percent: number;
|
|
776
|
+
additional_swap_params: string[];
|
|
474
777
|
}
|
|
475
|
-
interface
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
778
|
+
interface SwapInfo {
|
|
779
|
+
token_from_address: string;
|
|
780
|
+
token_from_amount: Uint256;
|
|
781
|
+
token_to_address: string;
|
|
782
|
+
token_to_amount: Uint256;
|
|
783
|
+
token_to_min_amount: Uint256;
|
|
784
|
+
beneficiary: string;
|
|
785
|
+
integrator_fee_amount_bps: number;
|
|
786
|
+
integrator_fee_recipient: string;
|
|
787
|
+
routes: Route[];
|
|
481
788
|
}
|
|
482
|
-
declare class
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
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>;
|
|
789
|
+
declare class AvnuWrapper {
|
|
790
|
+
getQuotes(fromToken: string, toToken: string, amountWei: string, taker: string, retry?: number, excludeSources?: string[]): Promise<Quote>;
|
|
791
|
+
getSwapInfo(quote: Pick<Quote, 'quoteId' | 'buyTokenAddress' | 'buyAmount' | 'sellTokenAddress' | 'sellAmount'>, taker: string, integratorFeeBps: number, integratorFeeRecipient: string, minAmount?: string, options?: AvnuOptions): Promise<SwapInfo>;
|
|
792
|
+
static buildZeroSwap(tokenToSell: ContractAddr, beneficiary: string, tokenToBuy?: ContractAddr): SwapInfo;
|
|
793
|
+
getSwapCallData(quote: Pick<Quote, 'quoteId' | 'buyTokenAddress' | 'buyAmount' | 'sellTokenAddress' | 'sellAmount'>, taker: string, minAmount?: Web3Number): Promise<bigint[][]>;
|
|
504
794
|
}
|
|
505
795
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
796
|
+
declare class AutoCompounderSTRK {
|
|
797
|
+
readonly config: IConfig;
|
|
798
|
+
readonly addr: ContractAddr;
|
|
799
|
+
readonly pricer: Pricer;
|
|
800
|
+
private initialized;
|
|
801
|
+
contract: Contract | null;
|
|
802
|
+
readonly metadata: {
|
|
803
|
+
decimals: number;
|
|
804
|
+
underlying: {
|
|
805
|
+
address: ContractAddr;
|
|
806
|
+
name: string;
|
|
807
|
+
symbol: string;
|
|
808
|
+
};
|
|
809
|
+
name: string;
|
|
515
810
|
};
|
|
516
|
-
|
|
517
|
-
|
|
811
|
+
constructor(config: IConfig, pricer: Pricer);
|
|
812
|
+
init(): Promise<void>;
|
|
813
|
+
waitForInitilisation(): Promise<void>;
|
|
814
|
+
/** Returns shares of user */
|
|
815
|
+
balanceOf(user: ContractAddr): Promise<Web3Number>;
|
|
816
|
+
/** Returns underlying assets of user */
|
|
817
|
+
balanceOfUnderlying(user: ContractAddr): Promise<Web3Number>;
|
|
818
|
+
/** Returns usd value of assets */
|
|
819
|
+
usdBalanceOfUnderlying(user: ContractAddr): Promise<{
|
|
820
|
+
usd: Web3Number;
|
|
821
|
+
assets: Web3Number;
|
|
822
|
+
}>;
|
|
518
823
|
}
|
|
519
824
|
|
|
520
|
-
interface
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
tick_spacing: string;
|
|
525
|
-
extension: string;
|
|
825
|
+
interface PoolProps {
|
|
826
|
+
pool_id: ContractAddr;
|
|
827
|
+
max_weight: number;
|
|
828
|
+
v_token: ContractAddr;
|
|
526
829
|
}
|
|
527
|
-
interface
|
|
528
|
-
|
|
529
|
-
|
|
830
|
+
interface Change {
|
|
831
|
+
pool_id: ContractAddr;
|
|
832
|
+
changeAmt: Web3Number;
|
|
833
|
+
finalAmt: Web3Number;
|
|
834
|
+
isDeposit: boolean;
|
|
530
835
|
}
|
|
531
|
-
interface
|
|
532
|
-
|
|
533
|
-
|
|
836
|
+
interface VesuRebalanceSettings {
|
|
837
|
+
feeBps: number;
|
|
838
|
+
}
|
|
839
|
+
interface PoolInfoFull {
|
|
840
|
+
pool_id: ContractAddr;
|
|
841
|
+
pool_name: string | undefined;
|
|
842
|
+
max_weight: number;
|
|
843
|
+
current_weight: number;
|
|
844
|
+
v_token: ContractAddr;
|
|
534
845
|
amount: Web3Number;
|
|
846
|
+
usdValue: Web3Number;
|
|
847
|
+
APY: {
|
|
848
|
+
baseApy: number;
|
|
849
|
+
defiSpringApy: number;
|
|
850
|
+
netApy: number;
|
|
851
|
+
};
|
|
852
|
+
currentUtilization: number;
|
|
853
|
+
maxUtilization: number;
|
|
535
854
|
}
|
|
536
855
|
/**
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
* @property newBounds.lower - relative to the current tick
|
|
541
|
-
* @property newBounds.upper - relative to the current tick
|
|
856
|
+
* Represents a VesuRebalance strategy.
|
|
857
|
+
* This class implements an automated rebalancing strategy for Vesu pools,
|
|
858
|
+
* managing deposits and withdrawals while optimizing yield through STRK rewards.
|
|
542
859
|
*/
|
|
543
|
-
|
|
544
|
-
newBounds: {
|
|
545
|
-
lower: number;
|
|
546
|
-
upper: number;
|
|
547
|
-
} | string;
|
|
548
|
-
lstContract?: ContractAddr;
|
|
549
|
-
truePrice?: number;
|
|
550
|
-
feeBps: number;
|
|
551
|
-
rebalanceConditions: {
|
|
552
|
-
minWaitHours: number;
|
|
553
|
-
direction: "any" | "uponly";
|
|
554
|
-
customShouldRebalance: (currentPoolPrice: number) => Promise<boolean>;
|
|
555
|
-
};
|
|
556
|
-
quoteAsset: TokenInfo;
|
|
557
|
-
}
|
|
558
|
-
declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount> {
|
|
860
|
+
declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
|
|
559
861
|
/** Contract address of the strategy */
|
|
560
862
|
readonly address: ContractAddr;
|
|
561
863
|
/** Pricer instance for token price calculations */
|
|
562
864
|
readonly pricer: PricerBase;
|
|
563
865
|
/** Metadata containing strategy information */
|
|
564
|
-
readonly metadata: IStrategyMetadata<
|
|
866
|
+
readonly metadata: IStrategyMetadata<VesuRebalanceSettings>;
|
|
565
867
|
/** Contract instance for interacting with the strategy */
|
|
566
868
|
readonly contract: Contract;
|
|
567
869
|
readonly BASE_WEIGHT = 10000;
|
|
568
|
-
readonly ekuboPositionsContract: Contract;
|
|
569
|
-
readonly ekuboMathContract: Contract;
|
|
570
|
-
readonly lstContract: Contract | null;
|
|
571
|
-
poolKey: EkuboPoolKey | undefined;
|
|
572
|
-
readonly avnu: AvnuWrapper;
|
|
573
870
|
/**
|
|
574
871
|
* Creates a new VesuRebalance strategy instance.
|
|
575
872
|
* @param config - Configuration object containing provider and other settings
|
|
@@ -577,27 +874,268 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
577
874
|
* @param metadata - Strategy metadata including deposit tokens and address
|
|
578
875
|
* @throws {Error} If more than one deposit token is specified
|
|
579
876
|
*/
|
|
580
|
-
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
877
|
+
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<VesuRebalanceSettings>);
|
|
878
|
+
/**
|
|
879
|
+
* Creates a deposit call to the strategy contract.
|
|
880
|
+
* @param assets - Amount of assets to deposit
|
|
881
|
+
* @param receiver - Address that will receive the strategy tokens
|
|
882
|
+
* @returns Populated contract call for deposit
|
|
883
|
+
*/
|
|
884
|
+
depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<starknet.Call[]>;
|
|
885
|
+
/**
|
|
886
|
+
* Creates a withdrawal call to the strategy contract.
|
|
887
|
+
* @param assets - Amount of assets to withdraw
|
|
888
|
+
* @param receiver - Address that will receive the withdrawn assets
|
|
889
|
+
* @param owner - Address that owns the strategy tokens
|
|
890
|
+
* @returns Populated contract call for withdrawal
|
|
891
|
+
*/
|
|
892
|
+
withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr, _isMaxWithdraw?: boolean): Promise<starknet.Call[]>;
|
|
893
|
+
/**
|
|
894
|
+
* Returns the underlying asset token of the strategy.
|
|
895
|
+
* @returns The deposit token supported by this strategy
|
|
896
|
+
*/
|
|
897
|
+
asset(): TokenInfo;
|
|
898
|
+
/**
|
|
899
|
+
* Returns the number of decimals used by the strategy token.
|
|
900
|
+
* @returns Number of decimals (same as the underlying token)
|
|
901
|
+
*/
|
|
902
|
+
decimals(): number;
|
|
903
|
+
getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<{
|
|
904
|
+
tokenInfo: TokenInfo;
|
|
905
|
+
amount: Web3Number;
|
|
906
|
+
usdValue: number;
|
|
907
|
+
}>;
|
|
908
|
+
/**
|
|
909
|
+
* Calculates user realized APY based on trueSharesBasedAPY method.
|
|
910
|
+
* Returns the APY as a number.
|
|
911
|
+
*/
|
|
912
|
+
getUserRealizedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
913
|
+
/**
|
|
914
|
+
* Calculates the total TVL of the strategy.
|
|
915
|
+
* @returns Object containing the total amount in token units and USD value
|
|
916
|
+
*/
|
|
917
|
+
getTVL(): Promise<{
|
|
918
|
+
tokenInfo: TokenInfo;
|
|
919
|
+
amount: Web3Number;
|
|
920
|
+
usdValue: number;
|
|
921
|
+
}>;
|
|
922
|
+
static getAllPossibleVerifiedPools(asset: ContractAddr): Promise<any>;
|
|
923
|
+
getPoolInfo(p: PoolProps, pools: any[], vesuPositions: any[], totalAssets: Web3Number, isErrorPositionsAPI: boolean, isErrorPoolsAPI: boolean): Promise<{
|
|
924
|
+
pool_id: ContractAddr;
|
|
925
|
+
pool_name: any;
|
|
926
|
+
max_weight: number;
|
|
927
|
+
current_weight: number;
|
|
928
|
+
v_token: ContractAddr;
|
|
929
|
+
amount: Web3Number;
|
|
930
|
+
usdValue: Web3Number;
|
|
931
|
+
APY: {
|
|
932
|
+
baseApy: number;
|
|
933
|
+
defiSpringApy: number;
|
|
934
|
+
netApy: number;
|
|
935
|
+
};
|
|
936
|
+
currentUtilization: number;
|
|
937
|
+
maxUtilization: number;
|
|
938
|
+
}>;
|
|
939
|
+
/**
|
|
940
|
+
* Retrieves the list of allowed pools and their detailed information from multiple sources:
|
|
941
|
+
* 1. Contract's allowed pools
|
|
942
|
+
* 2. Vesu positions API for current positions
|
|
943
|
+
* 3. Vesu pools API for APY and utilization data
|
|
944
|
+
*
|
|
945
|
+
* @returns {Promise<{
|
|
946
|
+
* data: Array<PoolInfoFull>,
|
|
947
|
+
* isErrorPositionsAPI: boolean
|
|
948
|
+
* }>} Object containing:
|
|
949
|
+
* - data: Array of pool information including IDs, weights, amounts, APYs and utilization
|
|
950
|
+
* - isErrorPositionsAPI: Boolean indicating if there was an error fetching position data
|
|
951
|
+
*/
|
|
952
|
+
getPools(): Promise<{
|
|
953
|
+
data: {
|
|
954
|
+
pool_id: ContractAddr;
|
|
955
|
+
pool_name: any;
|
|
956
|
+
max_weight: number;
|
|
957
|
+
current_weight: number;
|
|
958
|
+
v_token: ContractAddr;
|
|
959
|
+
amount: Web3Number;
|
|
960
|
+
usdValue: Web3Number;
|
|
961
|
+
APY: {
|
|
962
|
+
baseApy: number;
|
|
963
|
+
defiSpringApy: number;
|
|
964
|
+
netApy: number;
|
|
965
|
+
};
|
|
966
|
+
currentUtilization: number;
|
|
967
|
+
maxUtilization: number;
|
|
968
|
+
}[];
|
|
969
|
+
isErrorPositionsAPI: boolean;
|
|
970
|
+
isErrorPoolsAPI: boolean;
|
|
971
|
+
isError: boolean;
|
|
972
|
+
}>;
|
|
973
|
+
getVesuPools(retry?: number): Promise<{
|
|
974
|
+
pools: any[];
|
|
975
|
+
isErrorPoolsAPI: boolean;
|
|
976
|
+
}>;
|
|
977
|
+
/**
|
|
978
|
+
* Calculates the weighted average APY across all pools based on USD value.
|
|
979
|
+
* @returns {Promise<number>} The weighted average APY across all pools
|
|
980
|
+
*/
|
|
981
|
+
netAPY(): Promise<APYInfo>;
|
|
982
|
+
/**
|
|
983
|
+
* Calculates the weighted average APY across all pools based on USD value.
|
|
984
|
+
* @returns {Promise<number>} The weighted average APY across all pools
|
|
985
|
+
*/
|
|
986
|
+
netAPYGivenPools(pools: PoolInfoFull[]): Promise<number>;
|
|
987
|
+
/**
|
|
988
|
+
* Calculates optimal position changes to maximize APY while respecting max weights.
|
|
989
|
+
* The algorithm:
|
|
990
|
+
* 1. Sorts pools by APY (highest first)
|
|
991
|
+
* 2. Calculates target amounts based on max weights
|
|
992
|
+
* 3. For each pool that needs more funds:
|
|
993
|
+
* - Takes funds from lowest APY pools that are over their target
|
|
994
|
+
* 4. Validates that total assets remain constant
|
|
995
|
+
*
|
|
996
|
+
* @returns {Promise<{
|
|
997
|
+
* changes: Change[],
|
|
998
|
+
* finalPools: PoolInfoFull[],
|
|
999
|
+
* isAnyPoolOverMaxWeight: boolean
|
|
1000
|
+
* }>} Object containing:
|
|
1001
|
+
* - changes: Array of position changes
|
|
1002
|
+
* - finalPools: Array of pool information after rebalance
|
|
1003
|
+
* @throws Error if rebalance is not possible while maintaining constraints
|
|
1004
|
+
*/
|
|
1005
|
+
getRebalancedPositions(_pools?: PoolInfoFull[]): Promise<{
|
|
1006
|
+
changes: never[];
|
|
1007
|
+
finalPools: never[];
|
|
1008
|
+
isAnyPoolOverMaxWeight?: undefined;
|
|
1009
|
+
} | {
|
|
1010
|
+
changes: Change[];
|
|
1011
|
+
finalPools: PoolInfoFull[];
|
|
1012
|
+
isAnyPoolOverMaxWeight: boolean;
|
|
1013
|
+
}>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Creates a rebalance Call object for the strategy contract
|
|
1016
|
+
* @param pools - Array of pool information including IDs, weights, amounts, APYs and utilization
|
|
1017
|
+
* @returns Populated contract call for rebalance
|
|
1018
|
+
*/
|
|
1019
|
+
getRebalanceCall(pools: Awaited<ReturnType<typeof this.getRebalancedPositions>>["changes"], isOverWeightAdjustment: boolean): Promise<starknet.Call | null>;
|
|
1020
|
+
getInvestmentFlows(pools: PoolInfoFull[]): Promise<IInvestmentFlow[]>;
|
|
1021
|
+
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
1022
|
+
harvest(acc: Account): Promise<starknet.Call[]>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Calculates the fees deducted in different vTokens based on the current and previous state.
|
|
1025
|
+
* @param previousTotalSupply - The total supply of the strategy token before the transaction
|
|
1026
|
+
* @returns {Promise<Array<{ vToken: ContractAddr, fee: Web3Number }>>} Array of fees deducted in different vTokens
|
|
1027
|
+
*/
|
|
1028
|
+
getFee(allowedPools: Array<PoolInfoFull>): Promise<Array<{
|
|
1029
|
+
vToken: ContractAddr;
|
|
1030
|
+
fee: Web3Number;
|
|
1031
|
+
}>>;
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Represents the Vesu Rebalance Strategies.
|
|
1035
|
+
*/
|
|
1036
|
+
declare const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[];
|
|
1037
|
+
|
|
1038
|
+
interface EkuboPoolKey {
|
|
1039
|
+
token0: ContractAddr;
|
|
1040
|
+
token1: ContractAddr;
|
|
1041
|
+
fee: string;
|
|
1042
|
+
tick_spacing: string;
|
|
1043
|
+
extension: string;
|
|
1044
|
+
}
|
|
1045
|
+
interface EkuboBounds {
|
|
1046
|
+
lowerTick: bigint;
|
|
1047
|
+
upperTick: bigint;
|
|
1048
|
+
}
|
|
1049
|
+
interface FeeHistory {
|
|
1050
|
+
date: string;
|
|
1051
|
+
tokenInfo: TokenInfo;
|
|
1052
|
+
amount: Web3Number;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Settings for the CLVaultStrategy
|
|
1056
|
+
*
|
|
1057
|
+
* @property newBounds - The new bounds for the strategy
|
|
1058
|
+
* @property newBounds.lower - relative to the current tick
|
|
1059
|
+
* @property newBounds.upper - relative to the current tick
|
|
1060
|
+
*/
|
|
1061
|
+
interface CLVaultStrategySettings {
|
|
1062
|
+
newBounds: {
|
|
1063
|
+
lower: number;
|
|
1064
|
+
upper: number;
|
|
1065
|
+
} | string;
|
|
1066
|
+
lstContract?: ContractAddr;
|
|
1067
|
+
truePrice?: number;
|
|
1068
|
+
feeBps: number;
|
|
1069
|
+
rebalanceConditions: {
|
|
1070
|
+
minWaitHours: number;
|
|
1071
|
+
direction: "any" | "uponly";
|
|
1072
|
+
customShouldRebalance: (currentPoolPrice: number) => Promise<boolean>;
|
|
1073
|
+
};
|
|
1074
|
+
quoteAsset: TokenInfo;
|
|
1075
|
+
}
|
|
1076
|
+
declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount> {
|
|
1077
|
+
/** Contract address of the strategy */
|
|
1078
|
+
readonly address: ContractAddr;
|
|
1079
|
+
/** Pricer instance for token price calculations */
|
|
1080
|
+
readonly pricer: PricerBase;
|
|
1081
|
+
/** Metadata containing strategy information */
|
|
1082
|
+
readonly metadata: IStrategyMetadata<CLVaultStrategySettings>;
|
|
1083
|
+
/** Contract instance for interacting with the strategy */
|
|
1084
|
+
readonly contract: Contract;
|
|
1085
|
+
readonly BASE_WEIGHT = 10000;
|
|
1086
|
+
readonly ekuboPositionsContract: Contract;
|
|
1087
|
+
readonly ekuboMathContract: Contract;
|
|
1088
|
+
readonly lstContract: Contract | null;
|
|
1089
|
+
poolKey: EkuboPoolKey | undefined;
|
|
1090
|
+
readonly avnu: AvnuWrapper;
|
|
1091
|
+
/**
|
|
1092
|
+
* Creates a new VesuRebalance strategy instance.
|
|
1093
|
+
* @param config - Configuration object containing provider and other settings
|
|
1094
|
+
* @param pricer - Pricer instance for token price calculations
|
|
1095
|
+
* @param metadata - Strategy metadata including deposit tokens and address
|
|
1096
|
+
* @throws {Error} If more than one deposit token is specified
|
|
1097
|
+
*/
|
|
1098
|
+
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<CLVaultStrategySettings>);
|
|
1099
|
+
matchInputAmounts(amountInfo: DualActionAmount): Promise<DualActionAmount>;
|
|
1100
|
+
/** Returns minimum amounts give given two amounts based on what can be added for liq */
|
|
1101
|
+
getMinDepositAmounts(amountInfo: DualActionAmount): Promise<DualActionAmount>;
|
|
1102
|
+
depositCall(amountInfo: DualActionAmount, receiver: ContractAddr): Promise<Call[]>;
|
|
1103
|
+
tokensToShares(amountInfo: DualActionAmount): Promise<Web3Number>;
|
|
1104
|
+
withdrawCall(amountInfo: DualActionAmount, receiver: ContractAddr, owner: ContractAddr, isMaxWithdraw?: boolean): Promise<Call[]>;
|
|
587
1105
|
rebalanceCall(newBounds: EkuboBounds, swapParams: SwapInfo): Call[];
|
|
588
1106
|
handleUnusedCall(swapParams: SwapInfo): Call[];
|
|
589
1107
|
handleFeesCall(): Call[];
|
|
590
|
-
getFeeHistory(timePeriod?: '24h' | '7d' | '30d' | '3m'
|
|
1108
|
+
getFeeHistory(timePeriod?: '24h' | '7d' | '30d' | '3m' | '6m', range?: {
|
|
1109
|
+
startTimestamp?: number;
|
|
1110
|
+
endTimestamp?: number;
|
|
1111
|
+
}): Promise<{
|
|
591
1112
|
summary: DualTokenInfo;
|
|
592
1113
|
history: FeeHistory[];
|
|
593
1114
|
}>;
|
|
594
1115
|
netSharesBasedTrueAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
1116
|
+
/**
|
|
1117
|
+
* Calculate lifetime earnings for a user
|
|
1118
|
+
* Not yet implemented for Ekubo CL Vault strategy
|
|
1119
|
+
*/
|
|
1120
|
+
getLifetimeEarnings(userTVL: SingleTokenInfo, investmentFlows: Array<{
|
|
1121
|
+
amount: string;
|
|
1122
|
+
type: string;
|
|
1123
|
+
timestamp: number;
|
|
1124
|
+
tx_hash: string;
|
|
1125
|
+
}>): any;
|
|
1126
|
+
/**
|
|
1127
|
+
* Calculates realized APY based on TVL per share growth, always valued in USDC.
|
|
1128
|
+
* This is a vault-level metric (same for all users) and works for all strategies,
|
|
1129
|
+
* regardless of quote asset configuration.
|
|
1130
|
+
*/
|
|
1131
|
+
getUserRealizedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
1132
|
+
getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
595
1133
|
feeBasedAPY(timeperiod?: '24h' | '7d' | '30d' | '3m'): Promise<number>;
|
|
596
1134
|
/**
|
|
597
1135
|
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
598
1136
|
* @returns {Promise<number>} The weighted average APY across all pools
|
|
599
1137
|
*/
|
|
600
|
-
netAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number, timeperiod?: '24h' | '7d' | '30d' | '3m'): Promise<
|
|
1138
|
+
netAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number, timeperiod?: '24h' | '7d' | '30d' | '3m'): Promise<number>;
|
|
601
1139
|
getHarvestRewardShares(fromBlock: number, toBlock: number): Promise<Web3Number>;
|
|
602
1140
|
balanceOf(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<Web3Number>;
|
|
603
1141
|
getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<DualTokenInfo>;
|
|
@@ -652,7 +1190,7 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
652
1190
|
usdValue: number;
|
|
653
1191
|
};
|
|
654
1192
|
}>;
|
|
655
|
-
getSwapInfoToHandleUnused(considerRebalance?: boolean, newBounds?: EkuboBounds | null, maxIterations?: number, priceRatioPrecision?: number): Promise<SwapInfo>;
|
|
1193
|
+
getSwapInfoToHandleUnused(considerRebalance?: boolean, newBounds?: EkuboBounds | null, maxIterations?: number, priceRatioPrecision?: number, getQuoteCallback?: (tokenToSell: string, tokenToBuy: string, amountWei: string, beneficiary: string) => Promise<Quote>): Promise<SwapInfo>;
|
|
656
1194
|
assertValidBounds(bounds: EkuboBounds): void;
|
|
657
1195
|
assertValidAmounts(expectedAmounts: any, token0Bal: Web3Number, token1Bal: Web3Number): void;
|
|
658
1196
|
getSwapParams(expectedAmounts: any, poolKey: EkuboPoolKey, token0Bal: Web3Number, token1Bal: Web3Number): {
|
|
@@ -672,7 +1210,7 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
672
1210
|
* @returns {Promise<SwapInfo>}
|
|
673
1211
|
*
|
|
674
1212
|
*/
|
|
675
|
-
getSwapInfoGivenAmounts(poolKey: EkuboPoolKey, token0Bal: Web3Number, token1Bal: Web3Number, bounds: EkuboBounds, maxIterations?: number, priceRatioPrecision?: number): Promise<SwapInfo>;
|
|
1213
|
+
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>;
|
|
676
1214
|
/**
|
|
677
1215
|
* Attempts to rebalance the vault by iteratively adjusting swap amounts if initial attempt fails.
|
|
678
1216
|
* Uses binary search approach to find optimal swap amount.
|
|
@@ -683,10 +1221,16 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
683
1221
|
* @param retry - Current retry attempt number (default 0)
|
|
684
1222
|
* @param adjustmentFactor - Percentage to adjust swap amount by (default 1)
|
|
685
1223
|
* @param isToken0Deficit - Whether token0 balance needs increasing (default true)
|
|
1224
|
+
* @param MAX_RETRIES - Maximum number of retries (default 40)
|
|
1225
|
+
* @param sameErrorCount - For certain errors, we just retry with same amount again. This is the count of such retries (default { count: 0, error: null })
|
|
1226
|
+
* @param MAX_SAME_ERROR_COUNT - For certain errors, we just retry with same amount again. This limits such retries (default 10)
|
|
686
1227
|
* @returns Array of contract calls needed for rebalancing
|
|
687
|
-
* @throws Error if max retries reached without successful rebalance
|
|
1228
|
+
* @throws Error if max retries reached without successful rebalance or max same errors reached
|
|
688
1229
|
*/
|
|
689
|
-
rebalanceIter(swapInfo: SwapInfo, acc: Account, estimateCall: (swapInfo: SwapInfo) => Promise<Call[]>, isSellTokenToken0?: boolean, retry?: number, lowerLimit?: bigint, upperLimit?: bigint, MAX_RETRIES?: number
|
|
1230
|
+
rebalanceIter(swapInfo: SwapInfo, acc: Account, estimateCall: (swapInfo: SwapInfo) => Promise<Call[]>, isSellTokenToken0?: boolean, retry?: number, lowerLimit?: bigint, upperLimit?: bigint, MAX_RETRIES?: number, sameErrorCount?: {
|
|
1231
|
+
count: number;
|
|
1232
|
+
error: null | string;
|
|
1233
|
+
}, MAX_SAME_ERROR_COUNT?: number): Promise<Call[]>;
|
|
690
1234
|
static tickToi129(tick: number): {
|
|
691
1235
|
mag: number;
|
|
692
1236
|
sign: number;
|
|
@@ -705,7 +1249,8 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
705
1249
|
amount0: Web3Number;
|
|
706
1250
|
amount1: Web3Number;
|
|
707
1251
|
}>;
|
|
708
|
-
|
|
1252
|
+
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
1253
|
+
harvest(acc: Account, maxIterations?: number, priceRatioPrecision?: number, minRewardAmount?: Web3Number): Promise<Call[]>;
|
|
709
1254
|
/**
|
|
710
1255
|
* @description This funciton requires atleast one of the pool tokens to be reward token
|
|
711
1256
|
* i.e. STRK.
|
|
@@ -754,806 +1299,709 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
754
1299
|
*/
|
|
755
1300
|
declare const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[];
|
|
756
1301
|
|
|
757
|
-
interface
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
Delta = 0,
|
|
763
|
-
Target = 1
|
|
764
|
-
}
|
|
765
|
-
declare enum VesuAmountDenomination {
|
|
766
|
-
Native = 0,
|
|
767
|
-
Assets = 1
|
|
768
|
-
}
|
|
769
|
-
interface i257 {
|
|
770
|
-
abs: Web3Number;
|
|
771
|
-
is_negative: boolean;
|
|
772
|
-
}
|
|
773
|
-
interface VesuAmount {
|
|
774
|
-
amount_type: VesuAmountType;
|
|
775
|
-
denomination: VesuAmountDenomination;
|
|
776
|
-
value: i257;
|
|
777
|
-
}
|
|
778
|
-
interface VesuModifyPositionCallParams {
|
|
779
|
-
collateralAmount: VesuAmount;
|
|
780
|
-
debtAmount: VesuAmount;
|
|
1302
|
+
interface SenseiVaultSettings {
|
|
1303
|
+
mainToken: TokenInfo;
|
|
1304
|
+
secondaryToken: TokenInfo;
|
|
1305
|
+
targetHfBps: number;
|
|
1306
|
+
feeBps: number;
|
|
781
1307
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
rate_half_life: bigint;
|
|
800
|
-
min_full_utilization_rate: bigint;
|
|
801
|
-
max_full_utilization_rate: bigint;
|
|
802
|
-
};
|
|
803
|
-
interface TokenAmount {
|
|
804
|
-
token: ContractAddr;
|
|
805
|
-
amount: Web3Number;
|
|
806
|
-
}
|
|
807
|
-
interface Swap {
|
|
808
|
-
route: RouteNode[];
|
|
809
|
-
token_amount: TokenAmount;
|
|
810
|
-
}
|
|
811
|
-
interface RouteNode {
|
|
812
|
-
pool_key: EkuboPoolKey;
|
|
813
|
-
sqrt_ratio_limit: Web3Number;
|
|
814
|
-
skip_ahead: Web3Number;
|
|
815
|
-
}
|
|
816
|
-
interface IncreaseLeverParams {
|
|
817
|
-
pool_id: ContractAddr;
|
|
818
|
-
collateral_asset: ContractAddr;
|
|
819
|
-
debt_asset: ContractAddr;
|
|
820
|
-
user: ContractAddr;
|
|
821
|
-
add_margin: Web3Number;
|
|
822
|
-
margin_swap: Swap[];
|
|
823
|
-
margin_swap_limit_amount: Web3Number;
|
|
824
|
-
lever_swap: Swap[];
|
|
825
|
-
lever_swap_limit_amount: Web3Number;
|
|
826
|
-
}
|
|
827
|
-
interface DecreaseLeverParams {
|
|
828
|
-
pool_id: ContractAddr;
|
|
829
|
-
collateral_asset: ContractAddr;
|
|
830
|
-
debt_asset: ContractAddr;
|
|
831
|
-
user: ContractAddr;
|
|
832
|
-
sub_margin: Web3Number;
|
|
833
|
-
recipient: ContractAddr;
|
|
834
|
-
lever_swap: Swap[];
|
|
835
|
-
lever_swap_limit_amount: Web3Number;
|
|
836
|
-
lever_swap_weights: Web3Number[];
|
|
837
|
-
withdraw_swap: Swap[];
|
|
838
|
-
withdraw_swap_limit_amount: Web3Number;
|
|
839
|
-
withdraw_swap_weights: Web3Number[];
|
|
840
|
-
close_position: boolean;
|
|
841
|
-
}
|
|
842
|
-
interface VesuMultiplyCallParams {
|
|
843
|
-
increaseParams?: Omit<IncreaseLeverParams, 'user' | 'pool_id' | 'collateral_asset' | 'debt_asset'>;
|
|
844
|
-
decreaseParams?: Omit<DecreaseLeverParams, 'user' | 'pool_id' | 'collateral_asset' | 'debt_asset' | 'recipient'>;
|
|
845
|
-
isIncrease: boolean;
|
|
846
|
-
}
|
|
847
|
-
interface VesuModifyDelegationCallParams {
|
|
848
|
-
delegation: boolean;
|
|
849
|
-
}
|
|
850
|
-
declare const VesuPools: {
|
|
851
|
-
Genesis: ContractAddr;
|
|
852
|
-
Re7xSTRK: ContractAddr;
|
|
853
|
-
Re7xBTC: ContractAddr;
|
|
854
|
-
Re7USDCPrime: ContractAddr;
|
|
855
|
-
};
|
|
856
|
-
declare const extensionMap: {
|
|
857
|
-
[key: string]: ContractAddr;
|
|
858
|
-
};
|
|
859
|
-
declare function getVesuSingletonAddress(vesuPool: ContractAddr): {
|
|
860
|
-
addr: ContractAddr;
|
|
861
|
-
isV2: boolean;
|
|
862
|
-
};
|
|
863
|
-
declare class VesuAdapter extends CacheClass {
|
|
864
|
-
VESU_MULTIPLY_V1: ContractAddr;
|
|
865
|
-
VESU_MULTIPLY: ContractAddr;
|
|
866
|
-
config: VesuAdapterConfig;
|
|
867
|
-
networkConfig: IConfig | undefined;
|
|
868
|
-
pricer: PricerBase | undefined;
|
|
869
|
-
constructor(config: VesuAdapterConfig);
|
|
870
|
-
getVesuModifyDelegationCall: (params: VesuModifyDelegationCallParams) => ManageCall;
|
|
871
|
-
formatAmountTypeEnum(amountType: VesuAmountType): CairoCustomEnum;
|
|
872
|
-
formatAmountDenominationEnum(denomination: VesuAmountDenomination): CairoCustomEnum;
|
|
873
|
-
getVesuSingletonContract(config: IConfig, poolId: ContractAddr): {
|
|
874
|
-
contract: Contract;
|
|
875
|
-
isV2: boolean;
|
|
876
|
-
};
|
|
877
|
-
getDebtCap(config: IConfig): Promise<Web3Number>;
|
|
878
|
-
getCurrentDebtUtilisationAmount(config: IConfig): Promise<Web3Number>;
|
|
879
|
-
getMaxBorrowableByInterestRate(config: IConfig, asset: TokenInfo, maxBorrowAPY: number): Promise<Web3Number>;
|
|
880
|
-
getLTVConfig(config: IConfig, blockNumber?: BlockIdentifier): Promise<number>;
|
|
881
|
-
getPositions(config: IConfig, blockNumber?: BlockIdentifier): Promise<VaultPosition[]>;
|
|
882
|
-
getCollateralization(config: IConfig, blockNumber?: BlockIdentifier): Promise<Omit<VaultPosition, 'amount'>[]>;
|
|
883
|
-
getAssetPrices(): Promise<{
|
|
884
|
-
collateralTokenAmount: Web3Number;
|
|
885
|
-
collateralUSDAmount: number;
|
|
886
|
-
collateralPrice: number;
|
|
887
|
-
debtTokenAmount: Web3Number;
|
|
888
|
-
debtUSDAmount: number;
|
|
889
|
-
debtPrice: number;
|
|
890
|
-
ltv: number;
|
|
1308
|
+
declare class SenseiVault extends BaseStrategy<SingleTokenInfo, SingleActionAmount> {
|
|
1309
|
+
readonly address: ContractAddr;
|
|
1310
|
+
readonly metadata: IStrategyMetadata<SenseiVaultSettings>;
|
|
1311
|
+
readonly pricer: PricerBase;
|
|
1312
|
+
readonly contract: Contract;
|
|
1313
|
+
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<SenseiVaultSettings>);
|
|
1314
|
+
getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<SingleTokenInfo>;
|
|
1315
|
+
getTVL(): Promise<SingleTokenInfo>;
|
|
1316
|
+
depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
|
|
1317
|
+
withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr, _isMaxWithdraw?: boolean): Promise<Call[]>;
|
|
1318
|
+
getPositionInfo(): Promise<{
|
|
1319
|
+
collateralXSTRK: Web3Number;
|
|
1320
|
+
collateralUSDValue: Web3Number;
|
|
1321
|
+
debtSTRK: Web3Number;
|
|
1322
|
+
debtUSDValue: Web3Number;
|
|
1323
|
+
xSTRKPrice: number;
|
|
1324
|
+
collateralInSTRK: number;
|
|
891
1325
|
}>;
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
fullUtilizationRate(interestRateConfig: InterestRateConfig, timeDelta: bigint, utilization: bigint, fullUtilizationRate: bigint): bigint;
|
|
1326
|
+
getSecondaryTokenPriceRelativeToMain(retry?: number): Promise<number>;
|
|
1327
|
+
getSettings: () => Promise<starknet.CallResult>;
|
|
895
1328
|
/**
|
|
896
|
-
*
|
|
1329
|
+
* Calculate lifetime earnings for a user
|
|
1330
|
+
* Not yet implemented for Sensei Vault strategy
|
|
897
1331
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
1332
|
+
getLifetimeEarnings(userTVL: SingleTokenInfo, investmentFlows: Array<{
|
|
1333
|
+
amount: string;
|
|
1334
|
+
type: string;
|
|
1335
|
+
timestamp: number;
|
|
1336
|
+
tx_hash: string;
|
|
1337
|
+
}>): any;
|
|
1338
|
+
netAPY(): Promise<number>;
|
|
902
1339
|
/**
|
|
903
|
-
* Calculates
|
|
904
|
-
*
|
|
1340
|
+
* Calculates user realized APY based on position growth accounting for deposits and withdrawals.
|
|
1341
|
+
* Returns the APY as a number.
|
|
1342
|
+
* Not implemented for Sensei Strategy yet.
|
|
905
1343
|
*/
|
|
906
|
-
|
|
1344
|
+
getUserRealizedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
1345
|
+
getUserPositionCards(_input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
907
1346
|
}
|
|
1347
|
+
declare const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[];
|
|
908
1348
|
|
|
909
|
-
interface
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1349
|
+
interface YoloVaultSettings {
|
|
1350
|
+
startDate: string;
|
|
1351
|
+
expiryDate: string;
|
|
1352
|
+
mainToken: TokenInfo;
|
|
1353
|
+
secondaryToken: TokenInfo;
|
|
1354
|
+
totalEpochs: number;
|
|
1355
|
+
minEpochDurationSeconds: number;
|
|
1356
|
+
spendingLevels: YoloSpendingLevel[];
|
|
1357
|
+
feeBps: number;
|
|
1358
|
+
/** When true, base token is ERC-4626 (e.g. vUSDC); amounts for TVL / user info use `convert_to_assets` into `baseUnderlying`. */
|
|
1359
|
+
isBaseERC4626?: boolean;
|
|
1360
|
+
/** When true, second token is ERC-4626 (e.g. xSTRK); amounts use `convert_to_assets` into `secondUnderlying`. */
|
|
1361
|
+
isSecondERC4626?: boolean;
|
|
1362
|
+
/** Required when `isBaseERC4626` is true (e.g. USDC). */
|
|
1363
|
+
baseUnderlying?: TokenInfo;
|
|
1364
|
+
/** Required when `isSecondERC4626` is true (e.g. STRK / WBTC for xSTRK / xWBTC). */
|
|
1365
|
+
secondUnderlying?: TokenInfo;
|
|
1366
|
+
}
|
|
1367
|
+
interface YoloSpendingLevel {
|
|
1368
|
+
minPrice?: number;
|
|
1369
|
+
maxPrice?: number;
|
|
1370
|
+
spendPercent: number;
|
|
1371
|
+
}
|
|
1372
|
+
interface UserYoloInfo {
|
|
1373
|
+
shares: bigint;
|
|
1374
|
+
claimable_second_tokens: bigint;
|
|
1375
|
+
base_token_balance: bigint;
|
|
1376
|
+
base_token_consumed: bigint;
|
|
1377
|
+
base_consumed_last_index: bigint;
|
|
1378
|
+
second_token_last_index: bigint;
|
|
1379
|
+
second_token_balance: bigint;
|
|
1380
|
+
}
|
|
1381
|
+
interface YoloVaultStatus {
|
|
1382
|
+
current_epoch: bigint;
|
|
1383
|
+
total_epochs: bigint;
|
|
1384
|
+
remaining_base: bigint;
|
|
1385
|
+
total_second_tokens: bigint;
|
|
1386
|
+
global_second_token_index: bigint;
|
|
1387
|
+
cumulative_spend_index: bigint;
|
|
1388
|
+
total_shares: bigint;
|
|
1389
|
+
base_token_assets_per_share: bigint;
|
|
1390
|
+
}
|
|
1391
|
+
interface YoloSettings {
|
|
1392
|
+
base_token: bigint;
|
|
1393
|
+
second_token: bigint;
|
|
1394
|
+
total_epochs: bigint;
|
|
1395
|
+
min_time_per_epoch: bigint;
|
|
1396
|
+
max_spend_units_per_epoch: bigint;
|
|
1397
|
+
base_token_assets_per_share: bigint;
|
|
1398
|
+
oracle: bigint;
|
|
1399
|
+
}
|
|
1400
|
+
type YoloErc4626RuntimeConfig = {
|
|
1401
|
+
isBaseERC4626: boolean;
|
|
1402
|
+
isSecondERC4626: boolean;
|
|
1403
|
+
baseUnderlying?: TokenInfo;
|
|
1404
|
+
secondUnderlying?: TokenInfo;
|
|
1405
|
+
};
|
|
1406
|
+
declare class YoLoVault extends BaseStrategy<DualTokenInfo, SingleActionAmount, DualActionAmount> {
|
|
1407
|
+
readonly address: ContractAddr;
|
|
1408
|
+
readonly metadata: IStrategyMetadata<YoloVaultSettings>;
|
|
1409
|
+
readonly pricer: PricerBase;
|
|
1410
|
+
/** Resolves to a `Contract` built from `provider.getClassAt` at the vault address (no checked-in vault ABI). */
|
|
1411
|
+
readonly contract: Promise<Contract>;
|
|
1412
|
+
readonly primaryToken: TokenInfo;
|
|
1413
|
+
readonly secondaryToken: TokenInfo;
|
|
1414
|
+
readonly erc4626: YoloErc4626RuntimeConfig;
|
|
1415
|
+
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<YoloVaultSettings>);
|
|
1416
|
+
/** Underlying (or base token) used for pricing / swap sell leg when base is ERC-4626. */
|
|
1417
|
+
tokenForPrimaryPricing(): TokenInfo;
|
|
1418
|
+
/** Underlying (or second token) for price ratios when second leg is ERC-4626 (e.g. STRK for xSTRK). */
|
|
1419
|
+
tokenForSecondaryPricing(): TokenInfo;
|
|
1420
|
+
private primaryAmountDecimals;
|
|
1421
|
+
private secondaryAmountDecimals;
|
|
1422
|
+
private convertWrapperSharesToUnderlying;
|
|
1423
|
+
private getNormalizedUserInfo;
|
|
1424
|
+
private resolveWithdrawRequest;
|
|
1425
|
+
getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<DualTokenInfo>;
|
|
1426
|
+
getVaultPositions(): Promise<VaultPosition[]>;
|
|
1427
|
+
getTVL(): Promise<DualTokenInfo>;
|
|
1428
|
+
depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
|
|
1429
|
+
getVaultStatus(): Promise<YoloVaultStatus>;
|
|
1430
|
+
matchInputAmounts(amountInfo: DualActionAmount, user: ContractAddr): Promise<DualActionAmount>;
|
|
1431
|
+
withdrawCall(amountInfo: DualActionAmount, receiver: ContractAddr, owner: ContractAddr, isMaxWithdraw?: boolean): Promise<Call[]>;
|
|
1432
|
+
netAPY(): Promise<number | string | NetAPYDetails>;
|
|
1433
|
+
getSwapAmounts(spendUnits: Web3Number): Promise<{
|
|
1434
|
+
grossSpend: Web3Number;
|
|
1435
|
+
netSpend: Web3Number;
|
|
1436
|
+
isReadyForNextSwap: boolean;
|
|
1437
|
+
}>;
|
|
1438
|
+
getSettings: () => Promise<YoloSettings>;
|
|
1439
|
+
getMaxTVL(): Promise<Web3Number>;
|
|
1440
|
+
getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
939
1441
|
}
|
|
1442
|
+
declare const YoloVaultStrategies: IStrategyMetadata<YoloVaultSettings>[];
|
|
940
1443
|
|
|
941
|
-
interface
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
debt: TokenInfo;
|
|
945
|
-
targetHealthFactor: number;
|
|
946
|
-
minHealthFactor: number;
|
|
947
|
-
quoteAmountToFetchPrice: Web3Number;
|
|
1444
|
+
interface LeveledLogMethod {
|
|
1445
|
+
(message: string, ...meta: any[]): void;
|
|
1446
|
+
(message: any): void;
|
|
948
1447
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
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>;
|
|
1448
|
+
type LoggerLevel = "error" | "warn" | "info" | "verbose" | "debug";
|
|
1449
|
+
interface LoggerConfig {
|
|
1450
|
+
level?: LoggerLevel;
|
|
1451
|
+
consoleLevel?: LoggerLevel;
|
|
1452
|
+
fileLevel?: LoggerLevel;
|
|
1453
|
+
filePath?: string;
|
|
1454
|
+
enableConsole?: boolean;
|
|
1455
|
+
enableFile?: boolean;
|
|
1456
|
+
colorizeConsole?: boolean;
|
|
1457
|
+
shortErrorsInConsole?: boolean;
|
|
1458
|
+
emitConfigLog?: boolean;
|
|
985
1459
|
}
|
|
1460
|
+
interface MyLogger {
|
|
1461
|
+
error: LeveledLogMethod;
|
|
1462
|
+
warn: LeveledLogMethod;
|
|
1463
|
+
info: LeveledLogMethod;
|
|
1464
|
+
verbose: LeveledLogMethod;
|
|
1465
|
+
debug: LeveledLogMethod;
|
|
1466
|
+
}
|
|
1467
|
+
declare const logger: MyLogger;
|
|
1468
|
+
declare function configureLogger(_config?: LoggerConfig): MyLogger;
|
|
986
1469
|
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
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;
|
|
1470
|
+
interface LeafData {
|
|
1471
|
+
id: bigint;
|
|
1472
|
+
readableId: string;
|
|
1473
|
+
data: bigint[];
|
|
1245
1474
|
}
|
|
1246
|
-
interface
|
|
1247
|
-
|
|
1248
|
-
|
|
1475
|
+
interface StandardMerkleTreeData<T extends any> extends MerkleTreeData<T> {
|
|
1476
|
+
format: 'standard-v1';
|
|
1477
|
+
leafEncoding: ValueType[];
|
|
1249
1478
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1479
|
+
declare class StandardMerkleTree extends MerkleTreeImpl<LeafData> {
|
|
1480
|
+
protected readonly tree: HexString[];
|
|
1481
|
+
protected readonly values: StandardMerkleTreeData<LeafData>['values'];
|
|
1482
|
+
protected readonly leafEncoding: ValueType[];
|
|
1483
|
+
protected constructor(tree: HexString[], values: StandardMerkleTreeData<LeafData>['values'], leafEncoding: ValueType[]);
|
|
1484
|
+
static of(values: LeafData[], leafEncoding?: ValueType[], options?: MerkleTreeOptions): StandardMerkleTree;
|
|
1485
|
+
static verify<T extends any[]>(root: BytesLike, leafEncoding: ValueType[], leaf: T, proof: BytesLike[]): boolean;
|
|
1486
|
+
static verifyMultiProof<T extends any[]>(root: BytesLike, leafEncoding: ValueType[], multiproof: MultiProof<BytesLike, T>): boolean;
|
|
1487
|
+
dump(): StandardMerkleTreeData<LeafData>;
|
|
1254
1488
|
}
|
|
1255
1489
|
|
|
1256
1490
|
/**
|
|
1257
|
-
*
|
|
1258
|
-
|
|
1491
|
+
* Convert SDK TVL info (SingleTokenInfo or DualTokenInfo) to client AmountsInfo format
|
|
1492
|
+
*/
|
|
1493
|
+
declare function toAmountsInfo(tvlInfo: SingleTokenInfo | DualTokenInfo): Omit<AmountsInfo, "amounts"> & {
|
|
1494
|
+
amounts: Array<{
|
|
1495
|
+
amount: Web3Number;
|
|
1496
|
+
tokenInfo: TokenInfo;
|
|
1497
|
+
}>;
|
|
1498
|
+
};
|
|
1499
|
+
/**
|
|
1500
|
+
* Detect what capabilities a strategy instance has
|
|
1259
1501
|
*/
|
|
1502
|
+
declare function detectCapabilities(strategy: BaseStrategy<any, any>): StrategyCapabilities;
|
|
1503
|
+
/**
|
|
1504
|
+
* Check if a strategy is a dual-token strategy
|
|
1505
|
+
*/
|
|
1506
|
+
declare function isDualTokenStrategy(strategy: BaseStrategy<any, any>): boolean;
|
|
1260
1507
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1508
|
+
type ParsedStarknetCall = {
|
|
1509
|
+
target: string;
|
|
1510
|
+
method: string;
|
|
1511
|
+
selector?: string;
|
|
1512
|
+
sanitizer?: string;
|
|
1513
|
+
decodedArgs: unknown;
|
|
1514
|
+
rawCalldata: string[];
|
|
1515
|
+
parserUsed: string;
|
|
1516
|
+
parseError?: string;
|
|
1517
|
+
};
|
|
1518
|
+
type StarknetCallParserOptions = {
|
|
1519
|
+
tokenSymbols?: Record<string, string>;
|
|
1520
|
+
tokenDecimals?: Record<string, number>;
|
|
1521
|
+
poolNames?: Record<string, string>;
|
|
1522
|
+
};
|
|
1523
|
+
/**
|
|
1524
|
+
* Integration guide for new methods/protocols:
|
|
1525
|
+
* 1) Add method name to METHOD_BY_SELECTOR if it comes from ManageCall selector.
|
|
1526
|
+
* 2) Add a decoder in METHOD_DECODERS with a focused decode* method.
|
|
1527
|
+
* 3) Keep decoder output concise and operator-friendly.
|
|
1528
|
+
* 4) Prefer existing primitives (ContractAddr, uint256, Web3Number where needed).
|
|
1529
|
+
* 5) Add/extend tests in test/starknet-call-parser.test.ts for parse + log behavior.
|
|
1530
|
+
*/
|
|
1531
|
+
declare class StarknetCallParser {
|
|
1532
|
+
private static readonly METHOD_DECODERS;
|
|
1533
|
+
private static readonly METHOD_BY_SELECTOR;
|
|
1534
|
+
static parseManageCall(manageCall: ManageCall, options?: StarknetCallParserOptions): ParsedStarknetCall;
|
|
1535
|
+
static parseManageCalls(manageCalls: ManageCall[], options?: StarknetCallParserOptions): ParsedStarknetCall[];
|
|
1536
|
+
static parseCall(call: Call, options?: StarknetCallParserOptions): ParsedStarknetCall;
|
|
1537
|
+
static parseCalls(calls: Call[], options?: StarknetCallParserOptions): ParsedStarknetCall[];
|
|
1538
|
+
static logManageCalls(context: string, manageCalls: ManageCall[], options?: StarknetCallParserOptions): void;
|
|
1539
|
+
static logCalls(context: string, calls: Call[], options?: StarknetCallParserOptions): void;
|
|
1540
|
+
static logCallsSummary(context: string, calls: Call[], options?: StarknetCallParserOptions, sink?: (message: string) => void): void;
|
|
1541
|
+
static logManageCallsSummary(context: string, manageCalls: ManageCall[], options?: StarknetCallParserOptions, sink?: (message: string) => void): void;
|
|
1542
|
+
static formatCallsSummary(context: string, calls: Call[], options?: StarknetCallParserOptions): string;
|
|
1543
|
+
static formatManageCallsSummary(context: string, manageCalls: ManageCall[], options?: StarknetCallParserOptions): string;
|
|
1544
|
+
static buildTokenSymbolLookup(tokens: TokenInfo[]): Record<string, string>;
|
|
1545
|
+
static buildPoolNameLookup(pools: {
|
|
1546
|
+
poolId: string | bigint;
|
|
1547
|
+
name: string;
|
|
1548
|
+
}[]): Record<string, string>;
|
|
1549
|
+
static buildTokenDecimalsLookup(tokens: TokenInfo[]): Record<string, number>;
|
|
1550
|
+
private static parseRaw;
|
|
1551
|
+
private static enrichDecodedArgs;
|
|
1552
|
+
private static toStringCalldata;
|
|
1553
|
+
private static toBigInt;
|
|
1554
|
+
private static decodeApprove;
|
|
1555
|
+
private static decodeBringLiquidity;
|
|
1556
|
+
private static decodeFlashLoan;
|
|
1557
|
+
private static decodeModifyDelegation;
|
|
1558
|
+
private static parseVesuAmount;
|
|
1559
|
+
private static decodeModifyPosition;
|
|
1560
|
+
private static decodeModifyLever;
|
|
1561
|
+
private static decodeMultiRouteSwap;
|
|
1562
|
+
private static decodeManageVaultWithMerkleVerification;
|
|
1563
|
+
private static toCallSummary;
|
|
1564
|
+
private static pickKeyFields;
|
|
1565
|
+
private static u256FromParts;
|
|
1566
|
+
private static toSelectorHex;
|
|
1567
|
+
private static parseSwapArray;
|
|
1568
|
+
private static toPoolIdKey;
|
|
1569
|
+
private static toAssetLabel;
|
|
1570
|
+
private static toHumanAmount;
|
|
1571
|
+
private static toHumanAmountIfDecimals;
|
|
1572
|
+
private static normalizeHex;
|
|
1573
|
+
private static toAddressHex;
|
|
1574
|
+
private static addressToString;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
declare class HealthFactorMath {
|
|
1578
|
+
static getCollateralRequired(debtAmount: Web3Number, debtPrice: number, targetHF: number, maxLTV: number, collateralPrice: number, collateralTokenInfo: TokenInfo): Web3Number;
|
|
1579
|
+
static getMinCollateralRequiredOnLooping(debtAmount: Web3Number, debtPrice: number, targetHF: number, maxLTV: number, collateralPrice: number, collateralTokenInfo: TokenInfo): Web3Number;
|
|
1580
|
+
static getHealthFactor(collateralAmount: Web3Number, collateralPrice: number, maxLTV: number, debtAmount: Web3Number, debtPrice: number): number;
|
|
1581
|
+
static getMaxDebtAmountOnLooping(collateralAmount: Web3Number, collateralPrice: number, maxLTV: number, targetHF: number, debtPrice: number, debtTokenInfo: TokenInfo): Web3Number;
|
|
1582
|
+
static getMaxDebtAmount(collateralAmount: Web3Number, collateralPrice: number, maxLTV: number, targetHF: number, debtPrice: number, debtTokenInfo: TokenInfo): Web3Number;
|
|
1583
|
+
static calculateDebtReductionAmountForWithdrawal: (debtAmount: Web3Number, collateralAmount: Web3Number, maxLtv: number, targetHF: number, withdrawalAmount: Web3Number, collateralPrice: number, debtPrice: number, collateralTokenInfo: TokenInfo, debtTokenInfo: TokenInfo) => {
|
|
1584
|
+
deltadebtAmountUnits: null;
|
|
1585
|
+
} | {
|
|
1586
|
+
deltadebtAmountUnits: Web3Number;
|
|
1587
|
+
};
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
type RequiredFields<T> = {
|
|
1591
|
+
[K in keyof T]-?: T[K];
|
|
1592
|
+
};
|
|
1593
|
+
type RequiredKeys<T> = {
|
|
1594
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? never : K;
|
|
1595
|
+
}[keyof T];
|
|
1596
|
+
declare function assert(condition: boolean, message: string): void;
|
|
1597
|
+
declare function getTrovesEndpoint(): string;
|
|
1598
|
+
|
|
1599
|
+
interface ManageCall {
|
|
1600
|
+
proofReadableId: string;
|
|
1601
|
+
sanitizer: ContractAddr;
|
|
1602
|
+
call: {
|
|
1603
|
+
contractAddress: ContractAddr;
|
|
1604
|
+
selector: string;
|
|
1605
|
+
calldata: bigint[];
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
interface SwapPriceInfo {
|
|
1609
|
+
source: 'avnu' | 'ekubo';
|
|
1610
|
+
fromTokenSymbol: string;
|
|
1611
|
+
toTokenSymbol: string;
|
|
1612
|
+
fromAmount: number;
|
|
1613
|
+
toAmount: number;
|
|
1614
|
+
effectivePrice: number;
|
|
1615
|
+
}
|
|
1616
|
+
interface DepositParams {
|
|
1617
|
+
amount: Web3Number;
|
|
1618
|
+
}
|
|
1619
|
+
interface WithdrawParams {
|
|
1620
|
+
amount: Web3Number;
|
|
1621
|
+
}
|
|
1622
|
+
type GenerateCallFn<T> = (params: T) => Promise<ManageCall[]>;
|
|
1623
|
+
type AdapterLeafType<T> = {
|
|
1624
|
+
leaves: LeafData[];
|
|
1625
|
+
callConstructor: GenerateCallFn<T>;
|
|
1626
|
+
};
|
|
1627
|
+
type LeafAdapterFn<T> = () => AdapterLeafType<T>;
|
|
1628
|
+
declare enum APYType {
|
|
1629
|
+
BASE = "base",
|
|
1630
|
+
REWARD = "reward",
|
|
1631
|
+
LST = "lst"
|
|
1632
|
+
}
|
|
1633
|
+
interface SupportedPosition {
|
|
1634
|
+
asset: TokenInfo;
|
|
1635
|
+
isDebt: boolean;
|
|
1636
|
+
}
|
|
1637
|
+
interface BaseAdapterConfig {
|
|
1638
|
+
baseToken: TokenInfo;
|
|
1639
|
+
supportedPositions: SupportedPosition[];
|
|
1640
|
+
networkConfig: IConfig;
|
|
1641
|
+
pricer: PricerBase;
|
|
1642
|
+
vaultAllocator: ContractAddr;
|
|
1643
|
+
vaultAddress: ContractAddr;
|
|
1644
|
+
}
|
|
1645
|
+
type PositionAPY = {
|
|
1646
|
+
apy: number;
|
|
1647
|
+
type: APYType;
|
|
1648
|
+
};
|
|
1649
|
+
type PositionInfo = {
|
|
1650
|
+
tokenInfo: TokenInfo;
|
|
1651
|
+
amount: Web3Number;
|
|
1652
|
+
usdValue: number;
|
|
1653
|
+
remarks: string;
|
|
1654
|
+
apy: PositionAPY;
|
|
1655
|
+
protocol: IProtocol;
|
|
1656
|
+
};
|
|
1657
|
+
type PositionAmount = {
|
|
1658
|
+
amount: Web3Number;
|
|
1659
|
+
remarks: string;
|
|
1660
|
+
};
|
|
1661
|
+
declare abstract class BaseAdapter<DepositParams, WithdrawParams> extends CacheClass {
|
|
1662
|
+
readonly name: string;
|
|
1663
|
+
readonly config: BaseAdapterConfig;
|
|
1664
|
+
readonly protocol: IProtocol;
|
|
1665
|
+
constructor(config: BaseAdapterConfig, name: string, protocol: IProtocol);
|
|
1315
1666
|
/**
|
|
1316
|
-
*
|
|
1667
|
+
* Loop through all supported positions and return amount, usd value, remarks and apy for each
|
|
1317
1668
|
*/
|
|
1318
|
-
|
|
1669
|
+
getPositions(): Promise<PositionInfo[]>;
|
|
1319
1670
|
/**
|
|
1320
|
-
*
|
|
1321
|
-
* @param request
|
|
1322
|
-
* @returns
|
|
1671
|
+
* Implemented by child adapters to compute APY for a given supported position
|
|
1323
1672
|
*/
|
|
1324
|
-
|
|
1673
|
+
protected abstract getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
1325
1674
|
/**
|
|
1326
|
-
*
|
|
1675
|
+
* Implemented by child adapters to fetch amount for a given supported position
|
|
1327
1676
|
*/
|
|
1328
|
-
|
|
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[]>>;
|
|
1677
|
+
protected abstract getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount | null>;
|
|
1337
1678
|
/**
|
|
1338
|
-
*
|
|
1679
|
+
* Implemented by child adapters to calculate maximum deposit positions
|
|
1680
|
+
* @param amount Optional amount in baseToken to deposit
|
|
1339
1681
|
*/
|
|
1340
|
-
|
|
1682
|
+
abstract maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
1341
1683
|
/**
|
|
1342
|
-
*
|
|
1684
|
+
* Implemented by child adapters to calculate maximum withdraw positions
|
|
1343
1685
|
*/
|
|
1344
|
-
|
|
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>>;
|
|
1686
|
+
abstract maxWithdraw(): Promise<PositionInfo>;
|
|
1356
1687
|
/**
|
|
1357
|
-
*
|
|
1688
|
+
* Uses pricer to convert an amount of an asset to USD value
|
|
1358
1689
|
*/
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1690
|
+
protected getUSDValue(asset: TokenInfo, amount: Web3Number): Promise<number>;
|
|
1691
|
+
protected constructSimpleLeafData(params: {
|
|
1692
|
+
id: string;
|
|
1693
|
+
target: ContractAddr;
|
|
1694
|
+
method: string;
|
|
1695
|
+
packedArguments: bigint[];
|
|
1696
|
+
}, sanitizer?: ContractAddr): LeafData;
|
|
1365
1697
|
/**
|
|
1366
|
-
*
|
|
1698
|
+
* Implementor must provide target/method/packedArguments/sanitizer for deposit leaf construction
|
|
1367
1699
|
*/
|
|
1368
|
-
|
|
1700
|
+
protected abstract _getDepositLeaf(): {
|
|
1701
|
+
target: ContractAddr;
|
|
1702
|
+
method: string;
|
|
1703
|
+
packedArguments: bigint[];
|
|
1704
|
+
sanitizer: ContractAddr;
|
|
1705
|
+
id: string;
|
|
1706
|
+
}[];
|
|
1369
1707
|
/**
|
|
1370
|
-
*
|
|
1708
|
+
* Implementor must provide target/method/packedArguments/sanitizer for withdraw leaf construction
|
|
1371
1709
|
*/
|
|
1372
|
-
|
|
1710
|
+
protected abstract _getWithdrawLeaf(): {
|
|
1711
|
+
target: ContractAddr;
|
|
1712
|
+
method: string;
|
|
1713
|
+
packedArguments: bigint[];
|
|
1714
|
+
sanitizer: ContractAddr;
|
|
1715
|
+
id: string;
|
|
1716
|
+
}[];
|
|
1373
1717
|
/**
|
|
1374
|
-
*
|
|
1718
|
+
* Returns deposit leaf adapter using configured proof id
|
|
1375
1719
|
*/
|
|
1376
|
-
|
|
1720
|
+
getDepositLeaf(): AdapterLeafType<DepositParams>;
|
|
1377
1721
|
/**
|
|
1378
|
-
*
|
|
1379
|
-
* @param marketName - The name of the market to get order history for
|
|
1380
|
-
* @returns The order history for the specified market
|
|
1722
|
+
* Returns withdraw leaf adapter using configured proof id
|
|
1381
1723
|
*/
|
|
1382
|
-
|
|
1724
|
+
getWithdrawLeaf(): AdapterLeafType<WithdrawParams>;
|
|
1383
1725
|
/**
|
|
1384
|
-
*
|
|
1726
|
+
* Implementor must provide deposit call
|
|
1727
|
+
* @param params
|
|
1385
1728
|
*/
|
|
1386
|
-
|
|
1729
|
+
abstract getDepositCall(params: DepositParams): Promise<ManageCall[]>;
|
|
1387
1730
|
/**
|
|
1388
|
-
*
|
|
1389
|
-
* @param
|
|
1390
|
-
* @returns The funding rates for the specified market
|
|
1731
|
+
* Implementor must provide withdraw call
|
|
1732
|
+
* @param params
|
|
1391
1733
|
*/
|
|
1392
|
-
|
|
1734
|
+
abstract getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
|
|
1735
|
+
getProofs<T>(isDeposit: boolean, tree: StandardMerkleTree): {
|
|
1736
|
+
proofs: string[][];
|
|
1737
|
+
callConstructor: GenerateCallFn<DepositParams> | GenerateCallFn<WithdrawParams>;
|
|
1738
|
+
};
|
|
1739
|
+
getNetAPY(): Promise<number>;
|
|
1740
|
+
abstract getHealthFactor(): Promise<number>;
|
|
1393
1741
|
}
|
|
1394
1742
|
|
|
1395
|
-
interface
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
exchange_address: string;
|
|
1399
|
-
percent: number;
|
|
1400
|
-
additional_swap_params: string[];
|
|
1743
|
+
interface FlashloanCallParams {
|
|
1744
|
+
amount: Web3Number;
|
|
1745
|
+
data: bigint[];
|
|
1401
1746
|
}
|
|
1402
|
-
interface
|
|
1403
|
-
|
|
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[];
|
|
1747
|
+
interface ApproveCallParams {
|
|
1748
|
+
amount: Web3Number;
|
|
1412
1749
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
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[][]>;
|
|
1750
|
+
interface AvnuSwapCallParams {
|
|
1751
|
+
props: SwapInfo;
|
|
1418
1752
|
}
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1753
|
+
interface CommonAdapterConfig {
|
|
1754
|
+
id: string;
|
|
1755
|
+
vaultAddress: ContractAddr;
|
|
1756
|
+
vaultAllocator: ContractAddr;
|
|
1757
|
+
manager: ContractAddr;
|
|
1758
|
+
asset: ContractAddr;
|
|
1424
1759
|
}
|
|
1425
|
-
declare class
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
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;
|
|
1760
|
+
declare class CommonAdapter {
|
|
1761
|
+
config: CommonAdapterConfig;
|
|
1762
|
+
constructor(config: CommonAdapterConfig);
|
|
1763
|
+
protected constructSimpleLeafData(params: {
|
|
1445
1764
|
id: string;
|
|
1446
|
-
}[];
|
|
1447
|
-
protected _getLegacySwapLeaf(): {
|
|
1448
1765
|
target: ContractAddr;
|
|
1449
1766
|
method: string;
|
|
1450
1767
|
packedArguments: bigint[];
|
|
1768
|
+
}, sanitizer?: ContractAddr): LeafData;
|
|
1769
|
+
getFlashloanAdapter(): Promise<AdapterLeafType<FlashloanCallParams>>;
|
|
1770
|
+
getFlashloanCall(params: FlashloanCallParams): Promise<ManageCall[]>;
|
|
1771
|
+
getBringLiquidityAdapter(id: string): () => AdapterLeafType<ApproveCallParams>;
|
|
1772
|
+
getApproveAdapter(token: ContractAddr, spender: ContractAddr, id: string): () => AdapterLeafType<ApproveCallParams>;
|
|
1773
|
+
getApproveCall(token: ContractAddr, spender: ContractAddr, proofReadableId: string): (params: ApproveCallParams) => Promise<{
|
|
1774
|
+
proofReadableId: string;
|
|
1451
1775
|
sanitizer: ContractAddr;
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
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>;
|
|
1776
|
+
call: {
|
|
1777
|
+
contractAddress: ContractAddr;
|
|
1778
|
+
selector: string;
|
|
1779
|
+
calldata: bigint[];
|
|
1780
|
+
};
|
|
1781
|
+
}[]>;
|
|
1782
|
+
getBringLiquidityCall(proofReadableId: string): GenerateCallFn<ApproveCallParams>;
|
|
1462
1783
|
}
|
|
1463
1784
|
|
|
1464
|
-
interface
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1785
|
+
interface VesuPoolsInfo {
|
|
1786
|
+
pools: any[];
|
|
1787
|
+
isErrorPoolsAPI: boolean;
|
|
1788
|
+
}
|
|
1789
|
+
declare enum VesuAmountType {
|
|
1790
|
+
Delta = 0,
|
|
1791
|
+
Target = 1
|
|
1792
|
+
}
|
|
1793
|
+
declare enum VesuAmountDenomination {
|
|
1794
|
+
Native = 0,
|
|
1795
|
+
Assets = 1
|
|
1796
|
+
}
|
|
1797
|
+
interface i257 {
|
|
1798
|
+
abs: Web3Number;
|
|
1799
|
+
is_negative: boolean;
|
|
1800
|
+
}
|
|
1801
|
+
interface VesuAmount {
|
|
1802
|
+
amount_type: VesuAmountType;
|
|
1803
|
+
denomination: VesuAmountDenomination;
|
|
1804
|
+
value: i257;
|
|
1805
|
+
}
|
|
1806
|
+
interface VesuModifyPositionCallParams {
|
|
1807
|
+
collateralAmount: VesuAmount;
|
|
1808
|
+
debtAmount: VesuAmount;
|
|
1809
|
+
}
|
|
1810
|
+
interface VesuDefiSpringRewardsCallParams {
|
|
1811
|
+
amount: Web3Number;
|
|
1812
|
+
proofs: string[];
|
|
1813
|
+
}
|
|
1814
|
+
interface VesuAdapterConfig {
|
|
1815
|
+
poolId: ContractAddr;
|
|
1816
|
+
collateral: TokenInfo;
|
|
1817
|
+
debt: TokenInfo;
|
|
1818
|
+
vaultAllocator: ContractAddr;
|
|
1819
|
+
id: string;
|
|
1820
|
+
}
|
|
1821
|
+
type InterestRateConfig = {
|
|
1822
|
+
target_utilization: bigint;
|
|
1823
|
+
zero_utilization_rate: bigint;
|
|
1824
|
+
target_rate_percent: bigint;
|
|
1825
|
+
min_target_utilization: bigint;
|
|
1826
|
+
max_target_utilization: bigint;
|
|
1827
|
+
rate_half_life: bigint;
|
|
1828
|
+
min_full_utilization_rate: bigint;
|
|
1829
|
+
max_full_utilization_rate: bigint;
|
|
1830
|
+
};
|
|
1831
|
+
interface TokenAmount {
|
|
1832
|
+
token: ContractAddr;
|
|
1833
|
+
amount: Web3Number;
|
|
1834
|
+
}
|
|
1835
|
+
interface Swap {
|
|
1836
|
+
route: RouteNode[];
|
|
1837
|
+
token_amount: TokenAmount;
|
|
1838
|
+
}
|
|
1839
|
+
interface RouteNode {
|
|
1840
|
+
pool_key: EkuboPoolKey;
|
|
1841
|
+
sqrt_ratio_limit: Web3Number;
|
|
1842
|
+
skip_ahead: Web3Number;
|
|
1843
|
+
}
|
|
1844
|
+
interface IncreaseLeverParams {
|
|
1845
|
+
pool_id: ContractAddr;
|
|
1846
|
+
collateral_asset: ContractAddr;
|
|
1847
|
+
debt_asset: ContractAddr;
|
|
1848
|
+
user: ContractAddr;
|
|
1849
|
+
add_margin: Web3Number;
|
|
1850
|
+
margin_swap: Swap[];
|
|
1851
|
+
margin_swap_limit_amount: Web3Number;
|
|
1852
|
+
lever_swap: Swap[];
|
|
1853
|
+
lever_swap_limit_amount: Web3Number;
|
|
1854
|
+
}
|
|
1855
|
+
interface DecreaseLeverParams {
|
|
1856
|
+
pool_id: ContractAddr;
|
|
1857
|
+
collateral_asset: ContractAddr;
|
|
1858
|
+
debt_asset: ContractAddr;
|
|
1859
|
+
user: ContractAddr;
|
|
1860
|
+
sub_margin: Web3Number;
|
|
1861
|
+
recipient: ContractAddr;
|
|
1862
|
+
lever_swap: Swap[];
|
|
1863
|
+
lever_swap_limit_amount: Web3Number;
|
|
1864
|
+
lever_swap_weights: Web3Number[];
|
|
1865
|
+
withdraw_swap: Swap[];
|
|
1866
|
+
withdraw_swap_limit_amount: Web3Number;
|
|
1867
|
+
withdraw_swap_weights: Web3Number[];
|
|
1868
|
+
close_position: boolean;
|
|
1869
|
+
}
|
|
1870
|
+
interface VesuMultiplyCallParams {
|
|
1871
|
+
increaseParams?: Omit<IncreaseLeverParams, 'user' | 'pool_id' | 'collateral_asset' | 'debt_asset'>;
|
|
1872
|
+
decreaseParams?: Omit<DecreaseLeverParams, 'user' | 'pool_id' | 'collateral_asset' | 'debt_asset' | 'recipient'>;
|
|
1873
|
+
isIncrease: boolean;
|
|
1874
|
+
}
|
|
1875
|
+
interface VesuModifyDelegationCallParams {
|
|
1876
|
+
delegation: boolean;
|
|
1877
|
+
}
|
|
1878
|
+
declare const VesuPools: {
|
|
1879
|
+
Genesis: ContractAddr;
|
|
1880
|
+
Re7xSTRK: ContractAddr;
|
|
1881
|
+
Re7xBTC: ContractAddr;
|
|
1882
|
+
Re7USDCPrime: ContractAddr;
|
|
1883
|
+
Prime: ContractAddr;
|
|
1884
|
+
Re7STRK: ContractAddr;
|
|
1885
|
+
};
|
|
1886
|
+
declare const VesuPoolMetadata: {
|
|
1887
|
+
[VesuPools.Genesis.address]: {
|
|
1888
|
+
name: string;
|
|
1510
1889
|
};
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1890
|
+
[VesuPools.Re7xSTRK.address]: {
|
|
1891
|
+
name: string;
|
|
1892
|
+
};
|
|
1893
|
+
[VesuPools.Re7xBTC.address]: {
|
|
1894
|
+
name: string;
|
|
1895
|
+
};
|
|
1896
|
+
[VesuPools.Prime.address]: {
|
|
1897
|
+
name: string;
|
|
1898
|
+
};
|
|
1899
|
+
[VesuPools.Re7STRK.address]: {
|
|
1900
|
+
name: string;
|
|
1901
|
+
};
|
|
1902
|
+
[VesuPools.Re7USDCPrime.address]: {
|
|
1903
|
+
name: string;
|
|
1904
|
+
};
|
|
1905
|
+
};
|
|
1906
|
+
declare const extensionMap: {
|
|
1907
|
+
[key: string]: ContractAddr;
|
|
1908
|
+
};
|
|
1909
|
+
declare function getVesuSingletonAddress(vesuPool: ContractAddr): {
|
|
1910
|
+
addr: ContractAddr;
|
|
1911
|
+
isV2: boolean;
|
|
1912
|
+
};
|
|
1913
|
+
declare class VesuAdapter extends CacheClass {
|
|
1914
|
+
VESU_MULTIPLY_V1: ContractAddr;
|
|
1915
|
+
VESU_MULTIPLY: ContractAddr;
|
|
1916
|
+
VESU_WITHDRAW_SWAP_FIXED_MULTIPLIER: ContractAddr;
|
|
1917
|
+
config: VesuAdapterConfig;
|
|
1918
|
+
networkConfig: IConfig | undefined;
|
|
1919
|
+
pricer: PricerBase | undefined;
|
|
1920
|
+
constructor(config: VesuAdapterConfig);
|
|
1921
|
+
static getDefaultModifyPositionCallParams(params: {
|
|
1922
|
+
collateralAmount: Web3Number;
|
|
1923
|
+
isAddCollateral: boolean;
|
|
1924
|
+
debtAmount: Web3Number;
|
|
1925
|
+
isBorrow: boolean;
|
|
1926
|
+
}): {
|
|
1927
|
+
collateralAmount: {
|
|
1928
|
+
amount_type: VesuAmountType;
|
|
1929
|
+
denomination: VesuAmountDenomination;
|
|
1930
|
+
value: {
|
|
1931
|
+
abs: Web3Number;
|
|
1932
|
+
is_negative: boolean;
|
|
1933
|
+
};
|
|
1934
|
+
};
|
|
1935
|
+
debtAmount: {
|
|
1936
|
+
amount_type: VesuAmountType;
|
|
1937
|
+
denomination: VesuAmountDenomination;
|
|
1938
|
+
value: {
|
|
1939
|
+
abs: Web3Number;
|
|
1940
|
+
is_negative: boolean;
|
|
1941
|
+
};
|
|
1942
|
+
};
|
|
1943
|
+
};
|
|
1944
|
+
getVesuModifyDelegationCall: (delegatee: ContractAddr) => (params: VesuModifyDelegationCallParams) => {
|
|
1945
|
+
sanitizer: ContractAddr;
|
|
1946
|
+
call: {
|
|
1947
|
+
contractAddress: ContractAddr;
|
|
1948
|
+
selector: string;
|
|
1949
|
+
calldata: bigint[];
|
|
1950
|
+
};
|
|
1951
|
+
};
|
|
1952
|
+
formatAmountTypeEnum(amountType: VesuAmountType): CairoCustomEnum;
|
|
1953
|
+
formatAmountDenominationEnum(denomination: VesuAmountDenomination): CairoCustomEnum;
|
|
1954
|
+
getVesuSingletonContract(config: IConfig, poolId: ContractAddr): {
|
|
1955
|
+
contract: Contract;
|
|
1956
|
+
isV2: boolean;
|
|
1957
|
+
};
|
|
1958
|
+
getDebtCap(config: IConfig): Promise<Web3Number>;
|
|
1959
|
+
getCurrentDebtUtilisationAmount(config: IConfig): Promise<Web3Number>;
|
|
1960
|
+
getMaxBorrowableByInterestRate(config: IConfig, asset: TokenInfo, maxBorrowAPY: number): Promise<{
|
|
1961
|
+
maxDebtToHave: Web3Number;
|
|
1962
|
+
currentDebt: Web3Number;
|
|
1963
|
+
totalSupply: Web3Number;
|
|
1964
|
+
}>;
|
|
1965
|
+
getLTVConfig(config: IConfig, blockNumber?: BlockIdentifier): Promise<number>;
|
|
1966
|
+
getPositions(config: IConfig, blockNumber?: BlockIdentifier): Promise<VaultPosition[]>;
|
|
1967
|
+
getCollateralization(config: IConfig, blockNumber?: BlockIdentifier): Promise<Omit<VaultPosition, 'amount'>[]>;
|
|
1968
|
+
getAssetPrices(): Promise<{
|
|
1969
|
+
collateralTokenAmount: Web3Number;
|
|
1970
|
+
collateralUSDAmount: number;
|
|
1971
|
+
collateralPrice: number;
|
|
1972
|
+
debtTokenAmount: Web3Number;
|
|
1973
|
+
debtUSDAmount: number;
|
|
1974
|
+
debtPrice: number;
|
|
1975
|
+
ltv: number;
|
|
1524
1976
|
}>;
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1977
|
+
getHealthFactor(blockNumber?: BlockIdentifier): Promise<number>;
|
|
1978
|
+
static getVesuPools(retry?: number): Promise<VesuPoolsInfo>;
|
|
1979
|
+
fullUtilizationRate(interestRateConfig: InterestRateConfig, timeDelta: bigint, utilization: bigint, fullUtilizationRate: bigint): bigint;
|
|
1980
|
+
/**
|
|
1981
|
+
* Calculates new interest rate per second and next full utilization rate.
|
|
1982
|
+
*/
|
|
1983
|
+
calculateInterestRate(interestRateConfig: InterestRateConfig, utilization: bigint, timeDelta: bigint, lastFullUtilizationRate: bigint): {
|
|
1984
|
+
newRatePerSecond: bigint;
|
|
1985
|
+
nextFullUtilizationRate: bigint;
|
|
1986
|
+
};
|
|
1987
|
+
/**
|
|
1988
|
+
* Calculates utilization given a specific rate per second.
|
|
1989
|
+
* This is an inverse function of the piecewise interest rate formula above.
|
|
1990
|
+
*/
|
|
1991
|
+
getMaxUtilizationGivenRatePerSecond(interestRateConfig: InterestRateConfig, ratePerSecond: bigint, timeDelta: bigint, last_full_utilization_rate: bigint): bigint;
|
|
1533
1992
|
}
|
|
1534
1993
|
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
declare const AVNU_LEGACY_SANITIZER: ContractAddr;
|
|
1538
|
-
declare const SIMPLE_SANITIZER_V2: ContractAddr;
|
|
1539
|
-
declare const VESU_V2_MODIFY_POSITION_SANITIZER: ContractAddr;
|
|
1540
|
-
declare const SIMPLE_SANITIZER_VESU_V1_DELEGATIONS: ContractAddr;
|
|
1541
|
-
declare const PRICE_ROUTER: ContractAddr;
|
|
1542
|
-
declare const AVNU_MIDDLEWARE: ContractAddr;
|
|
1543
|
-
declare const AVNU_EXCHANGE: ContractAddr;
|
|
1544
|
-
declare const AVNU_EXCHANGE_FOR_LEGACY_USDC: ContractAddr;
|
|
1545
|
-
declare const AVNU_QUOTE_URL = "https://starknet.api.avnu.fi/swap/v3/quotes";
|
|
1546
|
-
declare const EXTENDED_CONTRACT: ContractAddr;
|
|
1547
|
-
declare const VESU_SINGLETON: ContractAddr;
|
|
1548
|
-
declare function toBigInt(value: string | number): bigint;
|
|
1549
|
-
|
|
1550
|
-
interface UnusedBalanceAdapterConfig extends BaseAdapterConfig {
|
|
1994
|
+
interface VesuSupplyOnlyAdapterConfig extends BaseAdapterConfig {
|
|
1995
|
+
vTokenContract: ContractAddr;
|
|
1551
1996
|
}
|
|
1552
|
-
declare class
|
|
1553
|
-
readonly config:
|
|
1997
|
+
declare class VesuSupplyOnlyAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
|
|
1998
|
+
readonly config: VesuSupplyOnlyAdapterConfig;
|
|
1554
1999
|
readonly tokenMarketData: TokenMarketData;
|
|
1555
|
-
constructor(config:
|
|
1556
|
-
|
|
2000
|
+
constructor(config: VesuSupplyOnlyAdapterConfig);
|
|
2001
|
+
private _depositApproveProofReadableId;
|
|
2002
|
+
private _depositCallProofReadableId;
|
|
2003
|
+
private _withdrawCallProofReadableId;
|
|
2004
|
+
protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
1557
2005
|
protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
|
|
1558
2006
|
maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
1559
2007
|
maxWithdraw(): Promise<PositionInfo>;
|
|
@@ -1571,479 +2019,367 @@ declare class UnusedBalanceAdapter extends BaseAdapter<DepositParams, WithdrawPa
|
|
|
1571
2019
|
sanitizer: ContractAddr;
|
|
1572
2020
|
id: string;
|
|
1573
2021
|
}[];
|
|
1574
|
-
|
|
2022
|
+
getDepositAdapter(): AdapterLeafType<DepositParams>;
|
|
2023
|
+
getWithdrawAdapter(): AdapterLeafType<WithdrawParams>;
|
|
1575
2024
|
getDepositCall(params: DepositParams): Promise<ManageCall[]>;
|
|
1576
2025
|
getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
|
|
2026
|
+
getHealthFactor(): Promise<number>;
|
|
1577
2027
|
}
|
|
1578
2028
|
|
|
1579
|
-
interface
|
|
1580
|
-
|
|
2029
|
+
interface VesuDepositParams {
|
|
2030
|
+
amount: Web3Number;
|
|
2031
|
+
marginSwap?: {
|
|
2032
|
+
marginToken: TokenInfo;
|
|
2033
|
+
};
|
|
2034
|
+
leverSwap?: {
|
|
2035
|
+
exactOutput?: Web3Number;
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
interface VesuWithdrawParams {
|
|
1581
2039
|
amount: Web3Number;
|
|
2040
|
+
withdrawSwap?: {
|
|
2041
|
+
outputToken: TokenInfo;
|
|
2042
|
+
};
|
|
1582
2043
|
}
|
|
1583
|
-
interface
|
|
1584
|
-
|
|
2044
|
+
interface VesuMultiplyAdapterConfig extends BaseAdapterConfig {
|
|
2045
|
+
poolId: ContractAddr;
|
|
2046
|
+
collateral: TokenInfo;
|
|
2047
|
+
debt: TokenInfo;
|
|
2048
|
+
marginToken: TokenInfo;
|
|
2049
|
+
targetHealthFactor: number;
|
|
2050
|
+
minHealthFactor: number;
|
|
2051
|
+
quoteAmountToFetchPrice: Web3Number;
|
|
2052
|
+
minimumVesuMovementAmount: number;
|
|
2053
|
+
maxSlippage?: number;
|
|
1585
2054
|
}
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
2055
|
+
declare class VesuMultiplyAdapter extends BaseAdapter<VesuDepositParams, VesuWithdrawParams> {
|
|
2056
|
+
readonly config: VesuMultiplyAdapterConfig;
|
|
2057
|
+
readonly _vesuAdapter: VesuAdapter;
|
|
2058
|
+
readonly tokenMarketData: TokenMarketData;
|
|
2059
|
+
readonly minimumVesuMovementAmount: number;
|
|
2060
|
+
lastSwapPriceInfo: SwapPriceInfo | null;
|
|
2061
|
+
maxSlippage: number;
|
|
2062
|
+
constructor(config: VesuMultiplyAdapterConfig);
|
|
2063
|
+
private _getMultiplyContract;
|
|
2064
|
+
private _buildDelegationWrappedCalls;
|
|
2065
|
+
private _getDepositProofReadableIds;
|
|
2066
|
+
private _getWithdrawProofReadableIds;
|
|
2067
|
+
private _buildZeroAmountSwapsWithWeights;
|
|
2068
|
+
private _fetchPositionAndPrices;
|
|
2069
|
+
private _computeTargetDebtDelta;
|
|
2070
|
+
private _getPositionCommonContext;
|
|
2071
|
+
protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
2072
|
+
protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount | null>;
|
|
2073
|
+
maxBorrowableAPY(): Promise<number>;
|
|
2074
|
+
private _computeMax;
|
|
2075
|
+
maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
2076
|
+
maxWithdraw(): Promise<PositionInfo>;
|
|
2077
|
+
protected _getDepositLeaf(): {
|
|
2078
|
+
target: ContractAddr;
|
|
2079
|
+
method: string;
|
|
2080
|
+
packedArguments: bigint[];
|
|
2081
|
+
sanitizer: ContractAddr;
|
|
2082
|
+
id: string;
|
|
2083
|
+
}[];
|
|
2084
|
+
protected _getWithdrawLeaf(): {
|
|
2085
|
+
target: ContractAddr;
|
|
2086
|
+
method: string;
|
|
2087
|
+
packedArguments: bigint[];
|
|
2088
|
+
sanitizer: ContractAddr;
|
|
1590
2089
|
id: string;
|
|
1591
2090
|
}[];
|
|
2091
|
+
getDepositAdapter(approveToken?: TokenInfo): AdapterLeafType<VesuDepositParams>;
|
|
2092
|
+
getWithdrawAdapter(): AdapterLeafType<VesuWithdrawParams>;
|
|
2093
|
+
getDepositCall(params: VesuDepositParams): Promise<ManageCall[]>;
|
|
2094
|
+
getWithdrawCall(params: VesuWithdrawParams): Promise<ManageCall[]>;
|
|
2095
|
+
private _getIncreaseCalldata;
|
|
2096
|
+
private _buildDecreaseLikeCalldata;
|
|
2097
|
+
private _getDecreaseCalldata;
|
|
2098
|
+
formatMultiplyParams(isIncrease: boolean, params: IncreaseLeverParams | DecreaseLeverParams): {
|
|
2099
|
+
action: CairoCustomEnum;
|
|
2100
|
+
};
|
|
2101
|
+
getHealthFactor(): Promise<number>;
|
|
2102
|
+
getNetAPY(): Promise<number>;
|
|
1592
2103
|
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
2104
|
+
|
|
2105
|
+
interface VesuModifyPositionDepositParams {
|
|
2106
|
+
amount: Web3Number;
|
|
2107
|
+
debtAmount?: Web3Number;
|
|
1596
2108
|
}
|
|
1597
|
-
interface
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
token1: SingleTokenInfo;
|
|
1601
|
-
}
|
|
1602
|
-
interface CacheData {
|
|
1603
|
-
timestamp: number;
|
|
1604
|
-
ttl: number;
|
|
1605
|
-
data: any;
|
|
1606
|
-
}
|
|
1607
|
-
declare class BaseStrategy<TVLInfo, ActionInfo> extends CacheClass {
|
|
1608
|
-
readonly config: IConfig;
|
|
1609
|
-
readonly cache: Map<string, CacheData>;
|
|
1610
|
-
constructor(config: IConfig);
|
|
1611
|
-
getUserTVL(user: ContractAddr): Promise<TVLInfo>;
|
|
1612
|
-
getTVL(): Promise<TVLInfo>;
|
|
1613
|
-
depositCall(amountInfo: ActionInfo, receiver: ContractAddr): Promise<Call[]>;
|
|
1614
|
-
withdrawCall(amountInfo: ActionInfo, receiver: ContractAddr, owner: ContractAddr): Promise<Call[]>;
|
|
1615
|
-
getVaultPositions(): Promise<VaultPosition[]>;
|
|
1616
|
-
getUnusedBalance(): Promise<SingleTokenInfo>;
|
|
1617
|
-
netAPY(): Promise<APYInfo>;
|
|
1618
|
-
getAUM(): Promise<{
|
|
1619
|
-
net: SingleTokenInfo;
|
|
1620
|
-
prevAum: Web3Number;
|
|
1621
|
-
splits: PositionInfo[];
|
|
1622
|
-
}>;
|
|
1623
|
-
getHealthFactors(): Promise<number[]>;
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
/**
|
|
1627
|
-
* TokenMarketData class that combines LST APR and Midas modules
|
|
1628
|
-
* to provide unified APY, price, and TVL functions for tokens
|
|
1629
|
-
*/
|
|
1630
|
-
declare class TokenMarketData {
|
|
1631
|
-
private pricer;
|
|
1632
|
-
private config;
|
|
1633
|
-
constructor(pricer: PricerBase, config: IConfig);
|
|
1634
|
-
/**
|
|
1635
|
-
* Get APY for a token
|
|
1636
|
-
* - If it's an LST token, returns LST APY
|
|
1637
|
-
* - If it's a Midas token, returns Midas APY
|
|
1638
|
-
* - Otherwise returns 0
|
|
1639
|
-
* @param tokenInfo The token to get APY for
|
|
1640
|
-
* @returns APY in absolute terms (not percentage)
|
|
1641
|
-
*/
|
|
1642
|
-
getAPY(tokenInfo: TokenInfo): Promise<number>;
|
|
1643
|
-
/**
|
|
1644
|
-
* Get price for a token using the pricer module
|
|
1645
|
-
* @param tokenInfo The token to get price for
|
|
1646
|
-
* @returns Price as a number
|
|
1647
|
-
* @throws Error if price is 0 or unavailable
|
|
1648
|
-
*/
|
|
1649
|
-
getPrice(tokenInfo: TokenInfo): Promise<number>;
|
|
1650
|
-
/**
|
|
1651
|
-
* Get true price for a token
|
|
1652
|
-
* - For LST tokens: Uses convert_to_assets to get true exchange rate
|
|
1653
|
-
* - For Midas tokens: Uses Midas price API
|
|
1654
|
-
* - For other tokens: Falls back to regular pricer
|
|
1655
|
-
* @param tokenInfo The token to get true price for
|
|
1656
|
-
* @returns True price as a number
|
|
1657
|
-
* @throws Error if price is 0 or unavailable
|
|
1658
|
-
*/
|
|
1659
|
-
getTruePrice(tokenInfo: TokenInfo): Promise<number>;
|
|
1660
|
-
/**
|
|
1661
|
-
* Get TVL for a token
|
|
1662
|
-
* - If it's a Midas token, returns Midas TVL data
|
|
1663
|
-
* - Otherwise returns 0
|
|
1664
|
-
* @param tokenInfo The token to get TVL for
|
|
1665
|
-
* @returns TVL as SingleTokenInfo or 0
|
|
1666
|
-
*/
|
|
1667
|
-
getTVL(tokenInfo: TokenInfo): Promise<SingleTokenInfo>;
|
|
1668
|
-
/**
|
|
1669
|
-
* Check if a token is supported for APY data
|
|
1670
|
-
* @param tokenInfo The token to check
|
|
1671
|
-
* @returns True if the token has APY data available
|
|
1672
|
-
*/
|
|
1673
|
-
isAPYSupported(tokenInfo: TokenInfo): boolean;
|
|
1674
|
-
/**
|
|
1675
|
-
* Check if a token is supported for TVL data
|
|
1676
|
-
* @param tokenInfo The token to check
|
|
1677
|
-
* @returns True if the token has TVL data available
|
|
1678
|
-
*/
|
|
1679
|
-
isTVLSupported(tokenInfo: TokenInfo): boolean;
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
declare class Pragma {
|
|
1683
|
-
contractAddr: string;
|
|
1684
|
-
readonly contract: Contract;
|
|
1685
|
-
constructor(provider: RpcProvider);
|
|
1686
|
-
getPrice(tokenAddr: string): Promise<number>;
|
|
2109
|
+
interface VesuModifyPositionWithdrawParams {
|
|
2110
|
+
amount: Web3Number;
|
|
2111
|
+
debtAmount?: Web3Number;
|
|
1687
2112
|
}
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
2113
|
+
interface VesuModifyPositionAdapterConfig extends BaseAdapterConfig {
|
|
2114
|
+
poolId: ContractAddr;
|
|
2115
|
+
collateral: TokenInfo;
|
|
2116
|
+
debt: TokenInfo;
|
|
2117
|
+
targetLtv: number;
|
|
2118
|
+
maxLtv: number;
|
|
2119
|
+
}
|
|
2120
|
+
declare class VesuModifyPositionAdapter extends BaseAdapter<VesuModifyPositionDepositParams, VesuModifyPositionWithdrawParams> {
|
|
2121
|
+
readonly config: VesuModifyPositionAdapterConfig;
|
|
2122
|
+
readonly _vesuAdapter: VesuAdapter;
|
|
2123
|
+
private readonly _tokenMarketData;
|
|
2124
|
+
constructor(config: VesuModifyPositionAdapterConfig);
|
|
2125
|
+
private _prepareVesuAdapter;
|
|
2126
|
+
private _getTargetHealthFactor;
|
|
2127
|
+
private _getPositionCommonContext;
|
|
2128
|
+
private _getEffectiveMaxLtv;
|
|
2129
|
+
private _toSigned;
|
|
2130
|
+
private _depositApproveProofReadableId;
|
|
2131
|
+
private _depositModifyProofReadableId;
|
|
2132
|
+
private _withdrawApproveProofReadableId;
|
|
2133
|
+
private _withdrawModifyProofReadableId;
|
|
2134
|
+
private _clampWithdrawCollateral;
|
|
2135
|
+
private _clampRepayDebt;
|
|
2136
|
+
private _normalizeDebtAmountFromHelper;
|
|
2137
|
+
private _getState;
|
|
2138
|
+
private _buildDefaultDepositDeltas;
|
|
2139
|
+
private _buildDefaultWithdrawDeltas;
|
|
2140
|
+
private _amountStruct;
|
|
2141
|
+
private _getModifyPositionCall;
|
|
2142
|
+
private _getApproveCall;
|
|
2143
|
+
protected getAPY(_supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
2144
|
+
protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
|
|
2145
|
+
maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
2146
|
+
maxWithdraw(): Promise<PositionInfo>;
|
|
2147
|
+
protected _getDepositLeaf(): {
|
|
2148
|
+
target: ContractAddr;
|
|
2149
|
+
method: string;
|
|
2150
|
+
packedArguments: bigint[];
|
|
2151
|
+
sanitizer: ContractAddr;
|
|
2152
|
+
id: string;
|
|
2153
|
+
}[];
|
|
2154
|
+
protected _getWithdrawLeaf(): {
|
|
2155
|
+
target: ContractAddr;
|
|
2156
|
+
method: string;
|
|
2157
|
+
packedArguments: bigint[];
|
|
2158
|
+
sanitizer: ContractAddr;
|
|
2159
|
+
id: string;
|
|
2160
|
+
}[];
|
|
2161
|
+
getDepositCall(params: VesuModifyPositionDepositParams): Promise<ManageCall[]>;
|
|
2162
|
+
getWithdrawCall(params: VesuModifyPositionWithdrawParams): Promise<ManageCall[]>;
|
|
2163
|
+
getHealthFactor(): Promise<number>;
|
|
1703
2164
|
/**
|
|
1704
|
-
*
|
|
1705
|
-
*
|
|
2165
|
+
* Simulates a deposit of `depositAmount` collateral and returns how much
|
|
2166
|
+
* debt (STRK) would be incrementally borrowed to reach the target LTV.
|
|
2167
|
+
* Used upstream to size the AVNU swap call in the same transaction batch.
|
|
1706
2168
|
*/
|
|
1707
|
-
|
|
1708
|
-
getPositionsSummary(user: ContractAddr): Promise<{
|
|
1709
|
-
collateralUSD: number;
|
|
1710
|
-
debtUSD: number;
|
|
1711
|
-
}>;
|
|
2169
|
+
getExpectedDepositDebtDelta(depositAmount: Web3Number): Promise<Web3Number>;
|
|
1712
2170
|
/**
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
2171
|
+
* Simulates a withdrawal of `withdrawAmount` collateral and returns the
|
|
2172
|
+
* incremental debt delta needed to keep the target health factor.
|
|
2173
|
+
* Positive means borrow, negative means repay.
|
|
1716
2174
|
*/
|
|
1717
|
-
|
|
2175
|
+
getExpectedWithdrawDebtDelta(withdrawAmount: Web3Number): Promise<Web3Number>;
|
|
1718
2176
|
}
|
|
1719
2177
|
|
|
1720
|
-
declare
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
2178
|
+
declare const SIMPLE_SANITIZER: ContractAddr;
|
|
2179
|
+
declare const SVK_SIMPLE_SANITIZER: ContractAddr;
|
|
2180
|
+
declare const EXTENDED_SANITIZER: ContractAddr;
|
|
2181
|
+
declare const AVNU_LEGACY_SANITIZER: ContractAddr;
|
|
2182
|
+
declare const SIMPLE_SANITIZER_V2: ContractAddr;
|
|
2183
|
+
declare const VESU_V2_MODIFY_POSITION_SANITIZER: ContractAddr;
|
|
2184
|
+
declare const SIMPLE_SANITIZER_VESU_V1_DELEGATIONS: ContractAddr;
|
|
2185
|
+
declare const PRICE_ROUTER: ContractAddr;
|
|
2186
|
+
declare const AVNU_MIDDLEWARE: ContractAddr;
|
|
2187
|
+
declare const AVNU_EXCHANGE: ContractAddr;
|
|
2188
|
+
declare const AVNU_EXCHANGE_FOR_LEGACY_USDC: ContractAddr;
|
|
2189
|
+
declare const AVNU_QUOTE_URL = "https://starknet.api.avnu.fi/swap/v3/quotes";
|
|
2190
|
+
declare const EXTENDED_CONTRACT: ContractAddr;
|
|
2191
|
+
declare const VESU_SINGLETON: ContractAddr;
|
|
2192
|
+
declare const TRANSFER_SANITIZER: ContractAddr;
|
|
2193
|
+
declare function toBigInt(value: string | number): bigint;
|
|
1728
2194
|
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
allowance(token: string | ContractAddr, owner: string | ContractAddr, spender: string | ContractAddr, tokenDecimals: number): Promise<Web3Number>;
|
|
1735
|
-
transfer(token: string | ContractAddr, to: string | ContractAddr, amount: Web3Number): starknet.Call;
|
|
1736
|
-
approve(token: string | ContractAddr, spender: string | ContractAddr, amount: Web3Number): starknet.Call;
|
|
2195
|
+
interface TokenTransferAdapterConfig extends BaseAdapterConfig {
|
|
2196
|
+
/** Address that funds are sent FROM during deposit (and returned TO during withdraw) */
|
|
2197
|
+
fromAddress: ContractAddr;
|
|
2198
|
+
/** Address that funds are sent TO during deposit (and pulled FROM during withdraw) */
|
|
2199
|
+
toAddress: ContractAddr;
|
|
1737
2200
|
}
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
2201
|
+
/**
|
|
2202
|
+
* Adapter for transferring a single token between two fixed addresses.
|
|
2203
|
+
*
|
|
2204
|
+
* Deposit: transfers baseToken from `fromAddress` → `toAddress`
|
|
2205
|
+
* Withdraw: transfers baseToken from `toAddress` → `fromAddress` (requires toAddress to approve fromAddress/VA)
|
|
2206
|
+
*
|
|
2207
|
+
* Proof IDs are derived from `tr_<symbol>_<toAddrShort>` to be unique per token+destination pair.
|
|
2208
|
+
*/
|
|
2209
|
+
declare class TokenTransferAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
|
|
2210
|
+
readonly config: TokenTransferAdapterConfig;
|
|
2211
|
+
readonly tokenMarketData: TokenMarketData;
|
|
2212
|
+
constructor(config: TokenTransferAdapterConfig);
|
|
2213
|
+
private _idBase;
|
|
2214
|
+
private _depositCallProofReadableId;
|
|
2215
|
+
private _withdrawCallProofReadableId;
|
|
2216
|
+
protected getAPY(_supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
2217
|
+
protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount>;
|
|
2218
|
+
maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
2219
|
+
maxWithdraw(): Promise<PositionInfo>;
|
|
2220
|
+
protected _getDepositLeaf(): {
|
|
2221
|
+
target: ContractAddr;
|
|
2222
|
+
method: string;
|
|
2223
|
+
packedArguments: bigint[];
|
|
2224
|
+
sanitizer: ContractAddr;
|
|
2225
|
+
id: string;
|
|
2226
|
+
}[];
|
|
2227
|
+
protected _getWithdrawLeaf(): {
|
|
2228
|
+
target: ContractAddr;
|
|
2229
|
+
method: string;
|
|
2230
|
+
packedArguments: bigint[];
|
|
2231
|
+
sanitizer: ContractAddr;
|
|
2232
|
+
id: string;
|
|
2233
|
+
}[];
|
|
2234
|
+
getDepositCall(params: DepositParams): Promise<ManageCall[]>;
|
|
2235
|
+
getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
|
|
2236
|
+
getHealthFactor(): Promise<number>;
|
|
1766
2237
|
}
|
|
1767
2238
|
|
|
1768
|
-
interface
|
|
1769
|
-
|
|
1770
|
-
max_weight: number;
|
|
1771
|
-
v_token: ContractAddr;
|
|
2239
|
+
interface AvnuDepositParams extends DepositParams {
|
|
2240
|
+
minAmount?: Web3Number;
|
|
1772
2241
|
}
|
|
1773
|
-
interface
|
|
1774
|
-
|
|
1775
|
-
changeAmt: Web3Number;
|
|
1776
|
-
finalAmt: Web3Number;
|
|
1777
|
-
isDeposit: boolean;
|
|
2242
|
+
interface AvnuWithdrawParams extends WithdrawParams {
|
|
2243
|
+
minAmount?: Web3Number;
|
|
1778
2244
|
}
|
|
1779
|
-
interface
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
* @param owner - Address that owns the strategy tokens
|
|
1833
|
-
* @returns Populated contract call for withdrawal
|
|
1834
|
-
*/
|
|
1835
|
-
withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr): Promise<starknet.Call[]>;
|
|
1836
|
-
/**
|
|
1837
|
-
* Returns the underlying asset token of the strategy.
|
|
1838
|
-
* @returns The deposit token supported by this strategy
|
|
1839
|
-
*/
|
|
1840
|
-
asset(): TokenInfo;
|
|
1841
|
-
/**
|
|
1842
|
-
* Returns the number of decimals used by the strategy token.
|
|
1843
|
-
* @returns Number of decimals (same as the underlying token)
|
|
1844
|
-
*/
|
|
1845
|
-
decimals(): number;
|
|
1846
|
-
/**
|
|
1847
|
-
* Calculates the Total Value Locked (TVL) for a specific user.
|
|
1848
|
-
* @param user - Address of the user
|
|
1849
|
-
* @returns Object containing the amount in token units and USD value
|
|
1850
|
-
*/
|
|
1851
|
-
getUserTVL(user: ContractAddr): Promise<{
|
|
1852
|
-
tokenInfo: TokenInfo;
|
|
1853
|
-
amount: Web3Number;
|
|
1854
|
-
usdValue: number;
|
|
1855
|
-
}>;
|
|
1856
|
-
/**
|
|
1857
|
-
* Calculates the total TVL of the strategy.
|
|
1858
|
-
* @returns Object containing the total amount in token units and USD value
|
|
1859
|
-
*/
|
|
1860
|
-
getTVL(): Promise<{
|
|
1861
|
-
tokenInfo: TokenInfo;
|
|
1862
|
-
amount: Web3Number;
|
|
1863
|
-
usdValue: number;
|
|
1864
|
-
}>;
|
|
1865
|
-
static getAllPossibleVerifiedPools(asset: ContractAddr): Promise<any>;
|
|
1866
|
-
getPoolInfo(p: PoolProps, pools: any[], vesuPositions: any[], totalAssets: Web3Number, isErrorPositionsAPI: boolean, isErrorPoolsAPI: boolean): Promise<{
|
|
1867
|
-
pool_id: ContractAddr;
|
|
1868
|
-
pool_name: any;
|
|
1869
|
-
max_weight: number;
|
|
1870
|
-
current_weight: number;
|
|
1871
|
-
v_token: ContractAddr;
|
|
1872
|
-
amount: Web3Number;
|
|
1873
|
-
usdValue: Web3Number;
|
|
1874
|
-
APY: {
|
|
1875
|
-
baseApy: number;
|
|
1876
|
-
defiSpringApy: number;
|
|
1877
|
-
netApy: number;
|
|
1878
|
-
};
|
|
1879
|
-
currentUtilization: number;
|
|
1880
|
-
maxUtilization: number;
|
|
1881
|
-
}>;
|
|
1882
|
-
/**
|
|
1883
|
-
* Retrieves the list of allowed pools and their detailed information from multiple sources:
|
|
1884
|
-
* 1. Contract's allowed pools
|
|
1885
|
-
* 2. Vesu positions API for current positions
|
|
1886
|
-
* 3. Vesu pools API for APY and utilization data
|
|
1887
|
-
*
|
|
1888
|
-
* @returns {Promise<{
|
|
1889
|
-
* data: Array<PoolInfoFull>,
|
|
1890
|
-
* isErrorPositionsAPI: boolean
|
|
1891
|
-
* }>} Object containing:
|
|
1892
|
-
* - data: Array of pool information including IDs, weights, amounts, APYs and utilization
|
|
1893
|
-
* - isErrorPositionsAPI: Boolean indicating if there was an error fetching position data
|
|
1894
|
-
*/
|
|
1895
|
-
getPools(): Promise<{
|
|
1896
|
-
data: {
|
|
1897
|
-
pool_id: ContractAddr;
|
|
1898
|
-
pool_name: any;
|
|
1899
|
-
max_weight: number;
|
|
1900
|
-
current_weight: number;
|
|
1901
|
-
v_token: ContractAddr;
|
|
1902
|
-
amount: Web3Number;
|
|
1903
|
-
usdValue: Web3Number;
|
|
1904
|
-
APY: {
|
|
1905
|
-
baseApy: number;
|
|
1906
|
-
defiSpringApy: number;
|
|
1907
|
-
netApy: number;
|
|
1908
|
-
};
|
|
1909
|
-
currentUtilization: number;
|
|
1910
|
-
maxUtilization: number;
|
|
1911
|
-
}[];
|
|
1912
|
-
isErrorPositionsAPI: boolean;
|
|
1913
|
-
isErrorPoolsAPI: boolean;
|
|
1914
|
-
isError: boolean;
|
|
1915
|
-
}>;
|
|
1916
|
-
getVesuPools(retry?: number): Promise<{
|
|
1917
|
-
pools: any[];
|
|
1918
|
-
isErrorPoolsAPI: boolean;
|
|
1919
|
-
}>;
|
|
1920
|
-
/**
|
|
1921
|
-
* Calculates the weighted average APY across all pools based on USD value.
|
|
1922
|
-
* @returns {Promise<number>} The weighted average APY across all pools
|
|
1923
|
-
*/
|
|
1924
|
-
netAPY(): Promise<APYInfo>;
|
|
2245
|
+
interface AvnuAdapterConfig extends BaseAdapterConfig {
|
|
2246
|
+
baseUrl: string;
|
|
2247
|
+
avnuContract: ContractAddr;
|
|
2248
|
+
slippage: number;
|
|
2249
|
+
minimumExtendedPriceDifferenceForSwapOpen: number;
|
|
2250
|
+
maximumExtendedPriceDifferenceForSwapClosing: number;
|
|
2251
|
+
}
|
|
2252
|
+
declare class AvnuAdapter extends BaseAdapter<AvnuDepositParams, AvnuWithdrawParams> {
|
|
2253
|
+
readonly config: AvnuAdapterConfig;
|
|
2254
|
+
protected avnuWrapper: AvnuWrapper;
|
|
2255
|
+
lastSwapPriceInfo: SwapPriceInfo | null;
|
|
2256
|
+
private _depositApproveProofReadableId;
|
|
2257
|
+
private _depositSwapProofReadableId;
|
|
2258
|
+
private _withdrawApproveProofReadableId;
|
|
2259
|
+
private _withdrawSwapProofReadableId;
|
|
2260
|
+
private buildSwapLeafConfigs;
|
|
2261
|
+
private buildSwapCalls;
|
|
2262
|
+
constructor(config: AvnuAdapterConfig);
|
|
2263
|
+
protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
2264
|
+
protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount | null>;
|
|
2265
|
+
maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
2266
|
+
maxWithdraw(): Promise<PositionInfo>;
|
|
2267
|
+
protected _getDepositLeaf(): {
|
|
2268
|
+
target: ContractAddr;
|
|
2269
|
+
method: string;
|
|
2270
|
+
packedArguments: bigint[];
|
|
2271
|
+
sanitizer: ContractAddr;
|
|
2272
|
+
id: string;
|
|
2273
|
+
}[];
|
|
2274
|
+
protected _getWithdrawLeaf(): {
|
|
2275
|
+
target: ContractAddr;
|
|
2276
|
+
method: string;
|
|
2277
|
+
packedArguments: bigint[];
|
|
2278
|
+
sanitizer: ContractAddr;
|
|
2279
|
+
id: string;
|
|
2280
|
+
}[];
|
|
2281
|
+
protected _getLegacySwapLeaf(): {
|
|
2282
|
+
target: ContractAddr;
|
|
2283
|
+
method: string;
|
|
2284
|
+
packedArguments: bigint[];
|
|
2285
|
+
sanitizer: ContractAddr;
|
|
2286
|
+
id: string;
|
|
2287
|
+
}[];
|
|
2288
|
+
getDepositCall(params: AvnuDepositParams): Promise<ManageCall[]>;
|
|
2289
|
+
getWithdrawCall(params: AvnuWithdrawParams): Promise<ManageCall[]>;
|
|
2290
|
+
getSwapCallData(quote: Quote): Promise<bigint[][]>;
|
|
2291
|
+
getHealthFactor(): Promise<number>;
|
|
2292
|
+
fetchQuoteWithRetry(params: Record<string, any>, retries?: number): Promise<any>;
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
/** Public Troves strategies feed (APY + metadata). Override in config for tests. */
|
|
2296
|
+
declare const DEFAULT_TROVES_STRATEGIES_API = "https://app.troves.fi/api/strategies";
|
|
2297
|
+
interface SvkTrovesAdapterConfig extends BaseAdapterConfig {
|
|
1925
2298
|
/**
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
2299
|
+
* On-chain Troves / SVK strategy vault: ERC-4626-style `deposit` / `withdraw` on the underlying asset,
|
|
2300
|
+
* plus `due_assets_from_owner` for redemption NFT value still owed to an owner.
|
|
1928
2301
|
*/
|
|
1929
|
-
|
|
2302
|
+
strategyVault: ContractAddr;
|
|
1930
2303
|
/**
|
|
1931
|
-
*
|
|
1932
|
-
* The algorithm:
|
|
1933
|
-
* 1. Sorts pools by APY (highest first)
|
|
1934
|
-
* 2. Calculates target amounts based on max weights
|
|
1935
|
-
* 3. For each pool that needs more funds:
|
|
1936
|
-
* - Takes funds from lowest APY pools that are over their target
|
|
1937
|
-
* 4. Validates that total assets remain constant
|
|
1938
|
-
*
|
|
1939
|
-
* @returns {Promise<{
|
|
1940
|
-
* changes: Change[],
|
|
1941
|
-
* finalPools: PoolInfoFull[],
|
|
1942
|
-
* isAnyPoolOverMaxWeight: boolean
|
|
1943
|
-
* }>} Object containing:
|
|
1944
|
-
* - changes: Array of position changes
|
|
1945
|
-
* - finalPools: Array of pool information after rebalance
|
|
1946
|
-
* @throws Error if rebalance is not possible while maintaining constraints
|
|
2304
|
+
* Troves API `strategies[].id` string (e.g. `hyper_xstrk`). Used to resolve APY from the public JSON feed.
|
|
1947
2305
|
*/
|
|
1948
|
-
|
|
1949
|
-
changes: never[];
|
|
1950
|
-
finalPools: never[];
|
|
1951
|
-
isAnyPoolOverMaxWeight?: undefined;
|
|
1952
|
-
} | {
|
|
1953
|
-
changes: Change[];
|
|
1954
|
-
finalPools: PoolInfoFull[];
|
|
1955
|
-
isAnyPoolOverMaxWeight: boolean;
|
|
1956
|
-
}>;
|
|
2306
|
+
trovesStrategyId: string;
|
|
1957
2307
|
/**
|
|
1958
|
-
*
|
|
1959
|
-
*
|
|
1960
|
-
* @returns Populated contract call for rebalance
|
|
2308
|
+
* Address whose vault **share** balance and **pending** redemption assets are measured.
|
|
2309
|
+
* Defaults to `vaultAllocator` when omitted (typical STRKFarm vault wiring).
|
|
1961
2310
|
*/
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
2311
|
+
positionOwner?: ContractAddr;
|
|
2312
|
+
/** Optional APY endpoint (defaults to {@link DEFAULT_TROVES_STRATEGIES_API}). */
|
|
2313
|
+
trovesStrategiesApiUrl?: string;
|
|
1965
2314
|
/**
|
|
1966
|
-
*
|
|
1967
|
-
*
|
|
1968
|
-
* @returns {Promise<Array<{ vToken: ContractAddr, fee: Web3Number }>>} Array of fees deducted in different vTokens
|
|
2315
|
+
* Optional redeem request NFT contract address. When provided, pending assets are calculated
|
|
2316
|
+
* using `getPendingAssetsFromOwnerNFTMethod` instead of `due_assets_from_owner`.
|
|
1969
2317
|
*/
|
|
1970
|
-
|
|
1971
|
-
vToken: ContractAddr;
|
|
1972
|
-
fee: Web3Number;
|
|
1973
|
-
}>>;
|
|
2318
|
+
redeemRequestNFT?: ContractAddr;
|
|
1974
2319
|
}
|
|
1975
2320
|
/**
|
|
1976
|
-
*
|
|
2321
|
+
* Universal adapter for **Starknet Vault Kit (SVK)** style Troves strategies:
|
|
2322
|
+
* approve underlying → `deposit(assets, receiver)`, and `withdraw(assets, receiver, owner)` on the strategy vault.
|
|
2323
|
+
*
|
|
2324
|
+
* **Position sizing** (underlying asset, same decimals as `baseToken`):
|
|
2325
|
+
* - Liquid: `convert_to_assets(balance_of(positionOwner))` on the strategy vault (vault shares).
|
|
2326
|
+
* - Pending redemptions: `due_assets_from_owner(positionOwner)` on the same vault (NFT / queue claims not yet settled).
|
|
2327
|
+
*
|
|
2328
|
+
* **APY**: Fetched from Troves public API by `trovesStrategyId` (numeric `apy` field; non-numeric marketing values fall back to `0`).
|
|
1977
2329
|
*/
|
|
1978
|
-
declare
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
manageCall: ManageCall;
|
|
2012
|
-
step: UNIVERSAL_MANAGE_IDS;
|
|
2013
|
-
}
|
|
2014
|
-
interface UniversalStrategySettings {
|
|
2015
|
-
vaultAddress: ContractAddr;
|
|
2016
|
-
manager: ContractAddr;
|
|
2017
|
-
vaultAllocator: ContractAddr;
|
|
2018
|
-
redeemRequestNFT: ContractAddr;
|
|
2019
|
-
leafAdapters: LeafAdapterFn<any>[];
|
|
2020
|
-
adapters: {
|
|
2330
|
+
declare class SvkTrovesAdapter extends BaseAdapter<DepositParams, WithdrawParams> {
|
|
2331
|
+
readonly config: SvkTrovesAdapterConfig;
|
|
2332
|
+
constructor(config: SvkTrovesAdapterConfig);
|
|
2333
|
+
/** Owner used for share balance + `due_assets_from_owner`. */
|
|
2334
|
+
private _positionOwner;
|
|
2335
|
+
/**
|
|
2336
|
+
* Proof readable IDs must stay ≤ 31 chars (Cairo short string). We derive a short ASCII suffix from
|
|
2337
|
+
* `strategyVault` address so multiple SVK adapters in one tree stay distinct.
|
|
2338
|
+
*/
|
|
2339
|
+
private _proofSuffix;
|
|
2340
|
+
private _depositApproveProofReadableId;
|
|
2341
|
+
private _depositCallProofReadableId;
|
|
2342
|
+
private _withdrawCallProofReadableId;
|
|
2343
|
+
protected getAPY(supportedPosition: SupportedPosition): Promise<PositionAPY>;
|
|
2344
|
+
protected getPosition(supportedPosition: SupportedPosition): Promise<PositionAmount | null>;
|
|
2345
|
+
getPendingAssetsFromOwner(owner?: ContractAddr, decimals?: number): Promise<Web3Number>;
|
|
2346
|
+
/**
|
|
2347
|
+
* Get pending assets from owner by scanning redeem request NFTs.
|
|
2348
|
+
* This method iterates backwards through NFT IDs to find all pending redemptions for a specific owner.
|
|
2349
|
+
*
|
|
2350
|
+
* @param redeemRequestNFT - The redeem request NFT contract address
|
|
2351
|
+
* @param owner - The owner address to check for pending redemptions (defaults to positionOwner)
|
|
2352
|
+
* @param decimals - Token decimals for conversion (defaults to baseToken decimals)
|
|
2353
|
+
* @returns Total pending assets from all NFTs owned by the specified address
|
|
2354
|
+
*/
|
|
2355
|
+
getPendingAssetsFromOwnerNFTMethod(redeemRequestNFT: ContractAddr, owner?: ContractAddr, decimals?: number): Promise<Web3Number>;
|
|
2356
|
+
maxDeposit(amount?: Web3Number): Promise<PositionInfo>;
|
|
2357
|
+
maxWithdraw(): Promise<PositionInfo>;
|
|
2358
|
+
protected _getDepositLeaf(): {
|
|
2359
|
+
target: ContractAddr;
|
|
2360
|
+
method: string;
|
|
2361
|
+
packedArguments: bigint[];
|
|
2362
|
+
sanitizer: ContractAddr;
|
|
2021
2363
|
id: string;
|
|
2022
|
-
adapter: BaseAdapter<DepositParams, WithdrawParams>;
|
|
2023
2364
|
}[];
|
|
2365
|
+
protected _getWithdrawLeaf(): {
|
|
2366
|
+
target: ContractAddr;
|
|
2367
|
+
method: string;
|
|
2368
|
+
packedArguments: bigint[];
|
|
2369
|
+
sanitizer: ContractAddr;
|
|
2370
|
+
id: string;
|
|
2371
|
+
}[];
|
|
2372
|
+
getDepositAdapter(): AdapterLeafType<DepositParams>;
|
|
2373
|
+
getWithdrawAdapter(): AdapterLeafType<WithdrawParams>;
|
|
2374
|
+
getDepositCall(params: DepositParams): Promise<ManageCall[]>;
|
|
2375
|
+
getWithdrawCall(params: WithdrawParams): Promise<ManageCall[]>;
|
|
2376
|
+
getHealthFactor(): Promise<number>;
|
|
2024
2377
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
declare enum UNIVERSAL_MANAGE_IDS {
|
|
2030
|
-
FLASH_LOAN = "flash_loan_init",
|
|
2031
|
-
VESU_LEG1 = "vesu_leg1",
|
|
2032
|
-
VESU_LEG2 = "vesu_leg2",
|
|
2033
|
-
APPROVE_TOKEN1 = "approve_token1",
|
|
2034
|
-
APPROVE_TOKEN2 = "approve_token2",
|
|
2035
|
-
APPROVE_BRING_LIQUIDITY = "approve_bring_liquidity",
|
|
2036
|
-
BRING_LIQUIDITY = "bring_liquidity",
|
|
2037
|
-
DEFISPRING_REWARDS = "defispring_rewards",
|
|
2038
|
-
APPROVE_SWAP_TOKEN1 = "approve_swap_token1",
|
|
2039
|
-
AVNU_SWAP_REWARDS = "avnu_swap_rewards"
|
|
2378
|
+
|
|
2379
|
+
declare enum LSTPriceType {
|
|
2380
|
+
ENDUR_PRICE = "ENDUR_PRICE",
|
|
2381
|
+
AVNU_PRICE = "AVNU_PRICE"
|
|
2040
2382
|
}
|
|
2041
|
-
declare function getContractDetails(settings: UniversalStrategySettings & {
|
|
2042
|
-
aumOracle?: ContractAddr;
|
|
2043
|
-
}): {
|
|
2044
|
-
address: ContractAddr;
|
|
2045
|
-
name: string;
|
|
2046
|
-
}[];
|
|
2047
2383
|
|
|
2048
2384
|
/**
|
|
2049
2385
|
* Base class for all SVK (Starknet Vault Kit) strategies.
|
|
@@ -2067,11 +2403,21 @@ declare abstract class SVKStrategy<S extends UniversalStrategySettings> extends
|
|
|
2067
2403
|
* Returns the asset token for this strategy
|
|
2068
2404
|
*/
|
|
2069
2405
|
asset(): TokenInfo;
|
|
2406
|
+
depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
|
|
2407
|
+
withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr, isMaxWithdraw?: boolean): Promise<Call[]>;
|
|
2408
|
+
getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<SingleTokenInfo>;
|
|
2070
2409
|
/**
|
|
2071
2410
|
* Returns the unused balance in the vault allocator.
|
|
2072
2411
|
* Note: This function is common for any SVK strategy.
|
|
2073
2412
|
*/
|
|
2074
2413
|
getUnusedBalance(): Promise<SingleTokenInfo>;
|
|
2414
|
+
/**
|
|
2415
|
+
* Builds a manage call from an adapter's proof tree.
|
|
2416
|
+
* DRY helper for the repeated getProofs → getManageCall pattern.
|
|
2417
|
+
*/
|
|
2418
|
+
protected buildManageCallFromAdapter(adapter: {
|
|
2419
|
+
getProofs: (isDeposit: boolean, tree: any) => any;
|
|
2420
|
+
}, isDeposit: boolean, amount: Web3Number, additionalParams?: Record<string, any>): Promise<Call>;
|
|
2075
2421
|
/**
|
|
2076
2422
|
* Bridges liquidity from the vault allocator back to the vault.
|
|
2077
2423
|
* Note: This function is common for any SVK strategy.
|
|
@@ -2079,6 +2425,11 @@ declare abstract class SVKStrategy<S extends UniversalStrategySettings> extends
|
|
|
2079
2425
|
getBringLiquidityCall(params: {
|
|
2080
2426
|
amount: Web3Number;
|
|
2081
2427
|
}): Promise<Call>;
|
|
2428
|
+
/**
|
|
2429
|
+
* Resolves ordered merkle proofs from emitted manage calls.
|
|
2430
|
+
* This ensures only runtime-required proofs are passed to manager calls.
|
|
2431
|
+
*/
|
|
2432
|
+
protected getProofGroupsForManageCalls(manageCalls: ManageCall[]): string[][];
|
|
2082
2433
|
/**
|
|
2083
2434
|
* Gets all leaves from all leaf adapters.
|
|
2084
2435
|
* Note: This function is common for any SVK strategy.
|
|
@@ -2095,52 +2446,240 @@ declare abstract class SVKStrategy<S extends UniversalStrategySettings> extends
|
|
|
2095
2446
|
*/
|
|
2096
2447
|
getMerkleRoot(): string;
|
|
2097
2448
|
/**
|
|
2098
|
-
* Combines proofs and manage calls into a single Starknet call.
|
|
2099
|
-
* Note: This function is common for any SVK strategy.
|
|
2449
|
+
* Combines proofs and manage calls into a single Starknet call.
|
|
2450
|
+
* Note: This function is common for any SVK strategy.
|
|
2451
|
+
*/
|
|
2452
|
+
getManageCall(proofGroups: string[][], manageCalls: ManageCall[]): Call;
|
|
2453
|
+
/**
|
|
2454
|
+
* Creates a call to set the merkle root on the manager contract.
|
|
2455
|
+
* Note: This function is common for any SVK strategy.
|
|
2456
|
+
*/
|
|
2457
|
+
getSetManagerCall(strategist: ContractAddr, root?: string): Call;
|
|
2458
|
+
/**
|
|
2459
|
+
* Returns a tag for logging purposes.
|
|
2460
|
+
* Should be overridden by subclasses to provide strategy-specific tags.
|
|
2461
|
+
*/
|
|
2462
|
+
abstract getTag(): string;
|
|
2463
|
+
/**
|
|
2464
|
+
* Returns the positions in the vault.
|
|
2465
|
+
* @returns An array of VaultPosition objects representing the positions in the vault.
|
|
2466
|
+
*/
|
|
2467
|
+
getVaultPositions(): Promise<VaultPosition[]>;
|
|
2468
|
+
getHealthFactors(): Promise<number[]>;
|
|
2469
|
+
netAPY(): Promise<{
|
|
2470
|
+
net: number;
|
|
2471
|
+
splits: {
|
|
2472
|
+
apy: number;
|
|
2473
|
+
id: string;
|
|
2474
|
+
}[];
|
|
2475
|
+
}>;
|
|
2476
|
+
getTVL(): Promise<SingleTokenInfo>;
|
|
2477
|
+
getUserRealizedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
2478
|
+
getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
2479
|
+
getPrevAUM(): Promise<Web3Number>;
|
|
2480
|
+
maxDepositables(): Promise<PositionInfo[]>;
|
|
2481
|
+
maxWithdrawables(): Promise<PositionInfo[]>;
|
|
2482
|
+
getMaxTVL(): Promise<Web3Number>;
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
interface UniversalManageCall {
|
|
2486
|
+
proofs: string[];
|
|
2487
|
+
manageCall: ManageCall;
|
|
2488
|
+
step: UNIVERSAL_MANAGE_IDS;
|
|
2489
|
+
}
|
|
2490
|
+
interface UniversalStrategySettings {
|
|
2491
|
+
vaultAddress: ContractAddr;
|
|
2492
|
+
manager: ContractAddr;
|
|
2493
|
+
vaultAllocator: ContractAddr;
|
|
2494
|
+
redeemRequestNFT: ContractAddr;
|
|
2495
|
+
aumOracle: ContractAddr;
|
|
2496
|
+
redemptionRouter?: ContractAddr;
|
|
2497
|
+
leafAdapters: LeafAdapterFn<any>[];
|
|
2498
|
+
adapters: {
|
|
2499
|
+
id: string;
|
|
2500
|
+
adapter: BaseAdapter<DepositParams, WithdrawParams>;
|
|
2501
|
+
}[];
|
|
2502
|
+
targetHealthFactor: number;
|
|
2503
|
+
minHealthFactor: number;
|
|
2504
|
+
}
|
|
2505
|
+
declare enum AUMTypes {
|
|
2506
|
+
FINALISED = "finalised",
|
|
2507
|
+
DEFISPRING = "defispring",
|
|
2508
|
+
BTCFI = "btcfi"
|
|
2509
|
+
}
|
|
2510
|
+
declare enum PositionTypeAvnuExtended {
|
|
2511
|
+
OPEN = "open",
|
|
2512
|
+
CLOSE = "close"
|
|
2513
|
+
}
|
|
2514
|
+
declare class UniversalStrategy<S extends UniversalStrategySettings> extends SVKStrategy<S> {
|
|
2515
|
+
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
|
|
2516
|
+
getMerkleTree(): StandardMerkleTree;
|
|
2517
|
+
getMerkleRoot(): string;
|
|
2518
|
+
getProofs<T>(id: string): {
|
|
2519
|
+
proofs: string[];
|
|
2520
|
+
callConstructor: GenerateCallFn<T>;
|
|
2521
|
+
};
|
|
2522
|
+
getAdapter(id: string): BaseAdapter<any, any>;
|
|
2523
|
+
asset(): TokenInfo;
|
|
2524
|
+
depositCall(amountInfo: SingleActionAmount, receiver: ContractAddr): Promise<Call[]>;
|
|
2525
|
+
withdrawCall(amountInfo: SingleActionAmount, receiver: ContractAddr, owner: ContractAddr, isMaxWithdraw?: boolean): Promise<Call[]>;
|
|
2526
|
+
getVesuAPYs(): Promise<{
|
|
2527
|
+
baseAPYs: number[];
|
|
2528
|
+
rewardAPYs: number[];
|
|
2529
|
+
positions: VaultPosition[];
|
|
2530
|
+
}>;
|
|
2531
|
+
/**
|
|
2532
|
+
* Calculates the weighted average APY across all pools based on USD value.
|
|
2533
|
+
* @returns {Promise<number>} The weighted average APY across all pools
|
|
2534
|
+
*/
|
|
2535
|
+
netAPY(): Promise<{
|
|
2536
|
+
net: number;
|
|
2537
|
+
splits: {
|
|
2538
|
+
apy: number;
|
|
2539
|
+
id: string;
|
|
2540
|
+
}[];
|
|
2541
|
+
}>;
|
|
2542
|
+
protected returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[], prevAUMUSD: Web3Number): Promise<{
|
|
2543
|
+
net: number;
|
|
2544
|
+
splits: {
|
|
2545
|
+
apy: number;
|
|
2546
|
+
id: string;
|
|
2547
|
+
}[];
|
|
2548
|
+
}>;
|
|
2549
|
+
protected getUnusedBalanceAPY(): Promise<{
|
|
2550
|
+
apy: number;
|
|
2551
|
+
weight: number;
|
|
2552
|
+
}>;
|
|
2553
|
+
private computeAPY;
|
|
2554
|
+
/**
|
|
2555
|
+
* Calculates the total TVL of the strategy.
|
|
2556
|
+
* @returns Object containing the total amount in token units and USD value
|
|
2557
|
+
*/
|
|
2558
|
+
getTVL(): Promise<{
|
|
2559
|
+
tokenInfo: TokenInfo;
|
|
2560
|
+
amount: Web3Number;
|
|
2561
|
+
usdValue: number;
|
|
2562
|
+
}>;
|
|
2563
|
+
getUnusedBalance(): Promise<SingleTokenInfo>;
|
|
2564
|
+
protected getVesuAUM(adapter: VesuAdapter, _priceType?: LSTPriceType): Promise<Web3Number>;
|
|
2565
|
+
getPrevAUM(): Promise<Web3Number>;
|
|
2566
|
+
getAUM(unrealizedAUM?: boolean): Promise<{
|
|
2567
|
+
net: SingleTokenInfo;
|
|
2568
|
+
prevAum: Web3Number;
|
|
2569
|
+
splits: {
|
|
2570
|
+
id: string;
|
|
2571
|
+
aum: Web3Number;
|
|
2572
|
+
}[];
|
|
2573
|
+
}>;
|
|
2574
|
+
protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
|
|
2575
|
+
getVesuMultiplyAdapter(): VesuMultiplyAdapter;
|
|
2576
|
+
getVesuModifyPositionAdapter(): VesuModifyPositionAdapter;
|
|
2577
|
+
/**
|
|
2578
|
+
* Legacy helper for retired Evergreen flows. New integrations should use
|
|
2579
|
+
* getVesuMultiplyAdapter / getVesuModifyPositionAdapter and BaseAdapter deposit/withdraw leaves.
|
|
2100
2580
|
*/
|
|
2101
|
-
|
|
2581
|
+
getVesuAdapters(): VesuAdapter[];
|
|
2582
|
+
getVesuPositions(blockNumber?: BlockIdentifier): Promise<VaultPosition[]>;
|
|
2583
|
+
getVaultPositions(): Promise<VaultPosition[]>;
|
|
2584
|
+
getSetManagerCall(strategist: ContractAddr, root?: string): Call;
|
|
2102
2585
|
/**
|
|
2103
|
-
*
|
|
2104
|
-
*
|
|
2586
|
+
* Compatibility helper: SVKStrategy's `getManageCall` expects proof-groups.
|
|
2587
|
+
* We derive proof-groups from each manageCall's `proofReadableId`.
|
|
2105
2588
|
*/
|
|
2106
|
-
|
|
2589
|
+
protected getManageCallFromManageCalls(manageCalls: ManageCall[]): Call;
|
|
2590
|
+
getVesuModifyPositionCalls(params: {
|
|
2591
|
+
isLeg1: boolean;
|
|
2592
|
+
isDeposit: boolean;
|
|
2593
|
+
depositAmount: Web3Number;
|
|
2594
|
+
debtAmount: Web3Number;
|
|
2595
|
+
}): UniversalManageCall[];
|
|
2596
|
+
getTag(): string;
|
|
2107
2597
|
/**
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2598
|
+
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
2599
|
+
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
2110
2600
|
*/
|
|
2111
|
-
|
|
2601
|
+
getLSTAPR(address: ContractAddr): Promise<number>;
|
|
2602
|
+
getVesuHealthFactors(blockNumber?: BlockIdentifier): Promise<number[]>;
|
|
2603
|
+
computeRebalanceConditionAndReturnCalls(): Promise<Call[]>;
|
|
2604
|
+
private getNewHealthFactor;
|
|
2112
2605
|
/**
|
|
2113
|
-
*
|
|
2114
|
-
* @
|
|
2606
|
+
*
|
|
2607
|
+
* @param vesuAdapter
|
|
2608
|
+
* @param currentHf
|
|
2609
|
+
* @param isDeposit if true, attempt by adding collateral, else by repaying
|
|
2610
|
+
* @returns
|
|
2115
2611
|
*/
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2612
|
+
private getLegRebalanceAmount;
|
|
2613
|
+
getVesuModifyPositionCall(params: {
|
|
2614
|
+
isDeposit: boolean;
|
|
2615
|
+
leg1DepositAmount: Web3Number;
|
|
2616
|
+
}): Promise<Call>;
|
|
2617
|
+
getPendingRewards(): Promise<HarvestInfo[]>;
|
|
2618
|
+
getHarvestCall(): Promise<{
|
|
2619
|
+
call: Call;
|
|
2620
|
+
reward: Web3Number;
|
|
2621
|
+
tokenInfo: TokenInfo;
|
|
2124
2622
|
}>;
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2623
|
+
getRebalanceCall(params: {
|
|
2624
|
+
isLeg1toLeg2: boolean;
|
|
2625
|
+
amount: Web3Number;
|
|
2626
|
+
}): Promise<Call>;
|
|
2627
|
+
}
|
|
2628
|
+
declare enum UNIVERSAL_MANAGE_IDS {
|
|
2629
|
+
FLASH_LOAN = "flash_loan_init",
|
|
2630
|
+
VESU_LEG1 = "vesu_leg1",
|
|
2631
|
+
VESU_LEG2 = "vesu_leg2",
|
|
2632
|
+
APPROVE_TOKEN1 = "approve_token1",
|
|
2633
|
+
APPROVE_TOKEN2 = "approve_token2",
|
|
2634
|
+
APPROVE_BRING_LIQUIDITY = "approve_bring_liquidity",
|
|
2635
|
+
BRING_LIQUIDITY = "bring_liquidity",
|
|
2636
|
+
DEFISPRING_REWARDS = "defispring_rewards",
|
|
2637
|
+
APPROVE_SWAP_TOKEN1 = "approve_swap_token1",
|
|
2638
|
+
AVNU_SWAP_REWARDS = "avnu_swap_rewards"
|
|
2639
|
+
}
|
|
2640
|
+
declare enum UNIVERSAL_ADAPTER_IDS {
|
|
2641
|
+
VESU_MULTIPLY = "vesu_multiply",
|
|
2642
|
+
VESU_MODIFY = "vesu_modify",
|
|
2643
|
+
AVNU = "avnu"
|
|
2128
2644
|
}
|
|
2645
|
+
declare function getContractDetails(settings: UniversalStrategySettings & {
|
|
2646
|
+
aumOracle?: ContractAddr;
|
|
2647
|
+
}): {
|
|
2648
|
+
address: ContractAddr;
|
|
2649
|
+
name: string;
|
|
2650
|
+
}[];
|
|
2651
|
+
declare const UniversalStrategies: IStrategyMetadata<UniversalStrategySettings>[];
|
|
2129
2652
|
|
|
2130
2653
|
interface HyperLSTStrategySettings extends UniversalStrategySettings {
|
|
2131
|
-
borrowable_assets:
|
|
2654
|
+
borrowable_assets: {
|
|
2655
|
+
tokenInfo: TokenInfo;
|
|
2656
|
+
poolId: ContractAddr;
|
|
2657
|
+
}[];
|
|
2132
2658
|
underlyingToken: TokenInfo;
|
|
2133
2659
|
quoteAmountToFetchPrice: Web3Number;
|
|
2134
2660
|
targetHealthFactor: number;
|
|
2135
2661
|
minHealthFactor: number;
|
|
2136
2662
|
aumOracle: ContractAddr;
|
|
2663
|
+
adapterIds?: {
|
|
2664
|
+
/** VesuMultiplyAdapter for underlying-matched debt (first matching borrowable pool) */
|
|
2665
|
+
primaryMultiply: string;
|
|
2666
|
+
multiply: Record<string, string>;
|
|
2667
|
+
modify: Record<string, string>;
|
|
2668
|
+
};
|
|
2137
2669
|
}
|
|
2138
2670
|
declare class UniversalLstMultiplierStrategy<S extends HyperLSTStrategySettings> extends SVKStrategy<S> {
|
|
2139
2671
|
private quoteAmountToFetchPrice;
|
|
2140
2672
|
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
|
|
2141
2673
|
getTag(): string;
|
|
2674
|
+
private getAdapterById;
|
|
2675
|
+
getVesuMultiplyAdapterByKey(key: string): VesuMultiplyAdapter;
|
|
2142
2676
|
getVesuSameTokenAdapter(): VesuMultiplyAdapter;
|
|
2143
|
-
|
|
2677
|
+
getVesuMultiplyAdapters(): VesuMultiplyAdapter[];
|
|
2678
|
+
getRewardsAUM(_prevAum: Web3Number): Promise<Web3Number>;
|
|
2679
|
+
getLSTAvnuRate(): Promise<number>;
|
|
2680
|
+
getLSTExchangeRate(): Promise<number>;
|
|
2681
|
+
private _getMinOutputAmountLSTBuy;
|
|
2682
|
+
private _getMinOutputAmountLSTSell;
|
|
2144
2683
|
/**
|
|
2145
2684
|
* Uses vesu's multiple call to create leverage on LST
|
|
2146
2685
|
* Deposit amount is in LST
|
|
@@ -2151,11 +2690,73 @@ declare class UniversalLstMultiplierStrategy<S extends HyperLSTStrategySettings>
|
|
|
2151
2690
|
leg1DepositAmount: Web3Number;
|
|
2152
2691
|
}): Promise<Call[] | null>;
|
|
2153
2692
|
getLSTUnderlyingTokenInfo(): TokenInfo;
|
|
2154
|
-
|
|
2693
|
+
getLSTAPR(_address: ContractAddr): Promise<number>;
|
|
2694
|
+
netAPY(): Promise<{
|
|
2695
|
+
net: number;
|
|
2696
|
+
splits: {
|
|
2697
|
+
apy: number;
|
|
2698
|
+
id: string;
|
|
2699
|
+
}[];
|
|
2700
|
+
}>;
|
|
2701
|
+
getVesuAPYs(): Promise<{
|
|
2702
|
+
baseAPYs: number[];
|
|
2703
|
+
rewardAPYs: number[];
|
|
2704
|
+
positions: VaultPosition[];
|
|
2705
|
+
}>;
|
|
2706
|
+
protected returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[], prevAUMUSD: Web3Number): Promise<{
|
|
2707
|
+
net: number;
|
|
2708
|
+
splits: {
|
|
2709
|
+
apy: number;
|
|
2710
|
+
id: string;
|
|
2711
|
+
}[];
|
|
2712
|
+
}>;
|
|
2713
|
+
protected getUnusedBalanceAPY(): Promise<{
|
|
2714
|
+
apy: number;
|
|
2715
|
+
weight: number;
|
|
2716
|
+
}>;
|
|
2717
|
+
private computeAPY;
|
|
2718
|
+
getVesuAdapters(): VesuAdapter[];
|
|
2719
|
+
getVesuPositions(blockNumber?: BlockIdentifier): Promise<VaultPosition[]>;
|
|
2720
|
+
getUnusedBalance(): Promise<SingleTokenInfo>;
|
|
2721
|
+
maxNewDeposits(params?: {
|
|
2722
|
+
isAPYComputation: boolean;
|
|
2723
|
+
}): Promise<number>;
|
|
2724
|
+
getMaxBorrowableAmount(params?: {
|
|
2725
|
+
isAPYComputation: boolean;
|
|
2726
|
+
}): Promise<{
|
|
2727
|
+
netMaxBorrowableAmount: Web3Number;
|
|
2728
|
+
maxBorrowables: {
|
|
2729
|
+
amount: Web3Number;
|
|
2730
|
+
dexSwappableAmount: Web3Number;
|
|
2731
|
+
maxBorrowableAmount: Web3Number;
|
|
2732
|
+
borrowableAsset: TokenInfo;
|
|
2733
|
+
ltv: number;
|
|
2734
|
+
poolId: ContractAddr;
|
|
2735
|
+
}[];
|
|
2736
|
+
}>;
|
|
2737
|
+
getMaxSwappableWithMaxSlippage(fromToken: TokenInfo, toToken: TokenInfo, maxSlippage: number, maxAmount: Web3Number): Promise<Web3Number>;
|
|
2738
|
+
getMaxBorrowableAmountByVesuAdapter(vesuAdapter: VesuAdapter, isAPYComputation: boolean): Promise<{
|
|
2739
|
+
amount: Web3Number;
|
|
2740
|
+
dexSwappableAmount: Web3Number;
|
|
2741
|
+
maxBorrowableAmount: Web3Number;
|
|
2742
|
+
borrowableAsset: TokenInfo;
|
|
2743
|
+
}>;
|
|
2744
|
+
getAUM(unrealizedAUM?: boolean): Promise<{
|
|
2745
|
+
net: SingleTokenInfo;
|
|
2746
|
+
prevAum: Web3Number;
|
|
2747
|
+
splits: PositionInfo[];
|
|
2748
|
+
}>;
|
|
2749
|
+
getTVLUnrealized(): Promise<{
|
|
2155
2750
|
net: SingleTokenInfo;
|
|
2156
2751
|
prevAum: Web3Number;
|
|
2157
2752
|
splits: PositionInfo[];
|
|
2158
2753
|
}>;
|
|
2754
|
+
getUserUnrealizedGains(user: ContractAddr): Promise<{
|
|
2755
|
+
unrealizedGains: Web3Number;
|
|
2756
|
+
userShare: number;
|
|
2757
|
+
tokenInfo: TokenInfo;
|
|
2758
|
+
}>;
|
|
2759
|
+
getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
2159
2760
|
}
|
|
2160
2761
|
declare const AUDIT_URL = "https://docs.troves.fi/p/security#starknet-vault-kit";
|
|
2161
2762
|
declare function getFAQs(lstSymbol: string, underlyingSymbol: string, isLST: boolean): FAQ[];
|
|
@@ -2163,514 +2764,237 @@ declare const _riskFactor: RiskFactor[];
|
|
|
2163
2764
|
declare function getInvestmentSteps(lstSymbol: string, underlyingSymbol: string): string[];
|
|
2164
2765
|
declare const HyperLSTStrategies: IStrategyMetadata<HyperLSTStrategySettings>[];
|
|
2165
2766
|
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
}
|
|
2183
|
-
abstract handleDeposit(): Promise<{
|
|
2184
|
-
extendedAmountInBTC: Web3Number;
|
|
2185
|
-
calls: Call[];
|
|
2186
|
-
}>;
|
|
2187
|
-
abstract handleWithdraw(amount: Web3Number): Promise<{
|
|
2188
|
-
calls: Call[];
|
|
2189
|
-
status: boolean;
|
|
2190
|
-
}>;
|
|
2191
|
-
}
|
|
2192
|
-
|
|
2193
|
-
interface VesuExtendedStrategySettings extends UniversalStrategySettings {
|
|
2194
|
-
underlyingToken: TokenInfo;
|
|
2195
|
-
borrowable_assets: TokenInfo[];
|
|
2196
|
-
targetHealthFactor: number;
|
|
2197
|
-
quoteAmountToFetchPrice: Web3Number;
|
|
2198
|
-
minHealthFactor: number;
|
|
2199
|
-
aumOracle: ContractAddr;
|
|
2200
|
-
minimumWBTCDifferenceForAvnuSwap: number;
|
|
2767
|
+
interface BoostedxSTRKCarryStrategySettings extends UniversalStrategySettings {
|
|
2768
|
+
depositToken: TokenInfo;
|
|
2769
|
+
debtToken: TokenInfo;
|
|
2770
|
+
lstHyperToken: TokenInfo;
|
|
2771
|
+
vesuPoolId: ContractAddr;
|
|
2772
|
+
maxLTV: number;
|
|
2773
|
+
targetLTV: number;
|
|
2774
|
+
hyperLstVaultAddress: ContractAddr;
|
|
2775
|
+
hyperLstRedeemNFT: ContractAddr;
|
|
2776
|
+
trovesStrategyId: string;
|
|
2777
|
+
hasBtcFiRewards: boolean;
|
|
2778
|
+
adapterIds?: {
|
|
2779
|
+
vesu: string;
|
|
2780
|
+
avnu: string;
|
|
2781
|
+
hyper: string;
|
|
2782
|
+
transfer: string;
|
|
2783
|
+
};
|
|
2201
2784
|
}
|
|
2202
|
-
declare class
|
|
2785
|
+
declare class BoostedxSTRKCarryStrategy<S extends BoostedxSTRKCarryStrategySettings> extends SVKStrategy<S> {
|
|
2203
2786
|
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<S>);
|
|
2204
2787
|
getTag(): string;
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
extendedAmount: Web3Number;
|
|
2219
|
-
extendedLeverage: number;
|
|
2220
|
-
collateralPrice: number;
|
|
2221
|
-
debtPrice: number;
|
|
2222
|
-
vesuLeverage: number;
|
|
2223
|
-
}>;
|
|
2224
|
-
shouldMoveAssets(extendedAmount: Web3Number, vesuAmount: Web3Number): Promise<Call[]>;
|
|
2225
|
-
moveAssets(params: {
|
|
2788
|
+
private getAdapterById;
|
|
2789
|
+
private getTruePriceForToken;
|
|
2790
|
+
getMinOutputAmountLSTBuy(amountInUnderlying: Web3Number): Promise<Web3Number>;
|
|
2791
|
+
getMinOutputAmountLSTSell(amountInLST: Web3Number): Promise<Web3Number>;
|
|
2792
|
+
getVesuModifyPositionCall(params: {
|
|
2793
|
+
isDeposit: boolean;
|
|
2794
|
+
leg1DepositAmount: Web3Number;
|
|
2795
|
+
debtAmount?: Web3Number;
|
|
2796
|
+
}): Promise<Call>;
|
|
2797
|
+
getVesuPositions(): Promise<VaultPosition[]>;
|
|
2798
|
+
getVesuHealthFactor(blockNumber?: BlockIdentifier): Promise<number>;
|
|
2799
|
+
getModifyHyperPositionCall(params: {
|
|
2800
|
+
isDeposit: boolean;
|
|
2226
2801
|
amount: Web3Number;
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
}>;
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2802
|
+
}): Promise<Call>;
|
|
2803
|
+
getAvnuSwapCall(params: {
|
|
2804
|
+
isDeposit: boolean;
|
|
2805
|
+
amount: Web3Number;
|
|
2806
|
+
minAmount?: Web3Number;
|
|
2807
|
+
}): Promise<Call>;
|
|
2808
|
+
/**
|
|
2809
|
+
* Returns the deposit token balance sitting idle inside the vault contract itself.
|
|
2810
|
+
* This balance can offset the required liquidity during withdrawal processing.
|
|
2811
|
+
*/
|
|
2812
|
+
getUnusedBalanceVault(): Promise<Web3Number>;
|
|
2813
|
+
/**
|
|
2814
|
+
* Returns the current borrow token balance sitting unused in the vault allocator.
|
|
2815
|
+
* This covers borrow token from prior borrow cycles that hasn't been swapped yet.
|
|
2816
|
+
*/
|
|
2817
|
+
getUnusedDebt(): Promise<Web3Number>;
|
|
2818
|
+
/**
|
|
2819
|
+
* Returns the LST balance sitting in the vault allocator.
|
|
2820
|
+
* This is non-zero when the previous cycle's request_redeem on the HyperPosition
|
|
2821
|
+
* has been settled — the redeemed LST lands here and is ready to be swapped.
|
|
2822
|
+
*/
|
|
2823
|
+
getLstInVaultAllocator(): Promise<Web3Number>;
|
|
2824
|
+
/**
|
|
2825
|
+
* Simulates depositing `depositAmount` on Vesu and returns the
|
|
2826
|
+
* incremental borrow token that would be borrowed. Needed to size the AVNU swap
|
|
2827
|
+
* call that is batched together with the Vesu call in the same transaction.
|
|
2828
|
+
*/
|
|
2829
|
+
computeVesuDepositBorrowAmount(depositAmount: Web3Number): Promise<Web3Number>;
|
|
2830
|
+
computeVesuWithdrawDebtDelta(withdrawAmount: Web3Number): Promise<Web3Number>;
|
|
2831
|
+
getPendingHyperAssets(): Promise<Web3Number>;
|
|
2832
|
+
getUserTVL(user: ContractAddr, blockIdentifier?: BlockIdentifier): Promise<{
|
|
2833
|
+
tokenInfo: TokenInfo;
|
|
2834
|
+
amount: Web3Number;
|
|
2835
|
+
usdValue: number;
|
|
2241
2836
|
}>;
|
|
2837
|
+
getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]>;
|
|
2242
2838
|
getAUM(): Promise<{
|
|
2243
2839
|
net: SingleTokenInfo;
|
|
2244
2840
|
prevAum: Web3Number;
|
|
2245
2841
|
splits: PositionInfo[];
|
|
2246
2842
|
}>;
|
|
2843
|
+
/**
|
|
2844
|
+
* Get Vesu APYs for collateral and debt positions
|
|
2845
|
+
*/
|
|
2846
|
+
getVesuAPYs(): Promise<{
|
|
2847
|
+
baseAPYs: number[];
|
|
2848
|
+
rewardAPYs: number[];
|
|
2849
|
+
positions: VaultPosition[];
|
|
2850
|
+
}>;
|
|
2851
|
+
/**
|
|
2852
|
+
* Get APY from the Hyper LST vault position
|
|
2853
|
+
*/
|
|
2854
|
+
getHyperVaultAPY(): Promise<{
|
|
2855
|
+
apy: number;
|
|
2856
|
+
weight: number;
|
|
2857
|
+
}>;
|
|
2858
|
+
/**
|
|
2859
|
+
* Get APY for unused balance (idle funds in vault allocator)
|
|
2860
|
+
*/
|
|
2861
|
+
protected getUnusedBalanceAPY(): Promise<{
|
|
2862
|
+
apy: number;
|
|
2863
|
+
weight: number;
|
|
2864
|
+
}>;
|
|
2865
|
+
/**
|
|
2866
|
+
* Compute weighted APY from individual APYs, weights, and total AUM
|
|
2867
|
+
*/
|
|
2868
|
+
private computeAPY;
|
|
2869
|
+
/**
|
|
2870
|
+
* Calculate net APY from base and reward APYs
|
|
2871
|
+
*/
|
|
2872
|
+
protected returnNetAPY(baseAPYs: number[], rewardAPYs: number[], weights: number[], totalWeightUSD: number): Promise<{
|
|
2873
|
+
net: number;
|
|
2874
|
+
splits: {
|
|
2875
|
+
apy: number;
|
|
2876
|
+
id: string;
|
|
2877
|
+
}[];
|
|
2878
|
+
}>;
|
|
2879
|
+
/**
|
|
2880
|
+
* Calculate net APY across all positions (Vesu, Hyper vault, unused balance)
|
|
2881
|
+
* weighted by USD value
|
|
2882
|
+
*/
|
|
2883
|
+
netAPY(): Promise<{
|
|
2884
|
+
net: number;
|
|
2885
|
+
splits: {
|
|
2886
|
+
apy: number;
|
|
2887
|
+
id: string;
|
|
2888
|
+
}[];
|
|
2889
|
+
}>;
|
|
2890
|
+
/**
|
|
2891
|
+
* Calculate future rewards (e.g. BTCFI rewards) contribution to AUM
|
|
2892
|
+
* Similar to universal-strategy.tsx approach
|
|
2893
|
+
*/
|
|
2894
|
+
protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
|
|
2895
|
+
getFundManagementCall(params: {
|
|
2896
|
+
isDeposit: boolean;
|
|
2897
|
+
leg1DepositAmount: Web3Number;
|
|
2898
|
+
}): Promise<Call[] | null>;
|
|
2247
2899
|
}
|
|
2248
|
-
declare const
|
|
2249
|
-
|
|
2250
|
-
declare const AddressesConfig: {
|
|
2251
|
-
readonly tokens: {
|
|
2252
|
-
readonly USDC: {
|
|
2253
|
-
readonly address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8";
|
|
2254
|
-
readonly decimals: 6;
|
|
2255
|
-
};
|
|
2256
|
-
readonly WBTC: {
|
|
2257
|
-
readonly address: "0x3fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac";
|
|
2258
|
-
readonly decimals: 8;
|
|
2259
|
-
};
|
|
2260
|
-
};
|
|
2261
|
-
readonly contracts: {
|
|
2262
|
-
readonly EXTENDED: "0x062da0780fae50d68cecaa5a051606dc21217ba290969b302db4dd99d2e9b470";
|
|
2263
|
-
readonly MULTIPLY: "0x07964760e90baa28841ec94714151e03fbc13321797e68a874e88f27c9d58513";
|
|
2264
|
-
};
|
|
2265
|
-
readonly wallet: {
|
|
2266
|
-
readonly address: string;
|
|
2267
|
-
};
|
|
2268
|
-
};
|
|
2269
|
-
declare const ExtendedConfig: {
|
|
2270
|
-
readonly baseUrl: string;
|
|
2271
|
-
readonly marketName: "BTC-USD";
|
|
2272
|
-
readonly maintenanceMargin: 0.01;
|
|
2273
|
-
readonly precision: 5;
|
|
2274
|
-
readonly fees: number;
|
|
2275
|
-
readonly minPositionSize: 0.0001;
|
|
2276
|
-
};
|
|
2277
|
-
declare const VesuConfig: {
|
|
2278
|
-
readonly poolId: "0x02eef0c13b10b487ea5916b54c0a7f98ec43fb3048f60fdeedaf5b08f6f88aaf";
|
|
2279
|
-
readonly maxLtv: 0.8428;
|
|
2280
|
-
readonly maxLiquidationRatio: 0.86;
|
|
2281
|
-
readonly targetHealthFactor: number;
|
|
2282
|
-
readonly ekubo: {
|
|
2283
|
-
readonly endpoint: "https://quoter-mainnet-api.ekubo.org/{{AMOUNT}}/{{TOKEN_FROM_ADDRESS}}/{{TOKEN_TO_ADDRESS}}";
|
|
2284
|
-
readonly priceMaxSlippage: number;
|
|
2285
|
-
};
|
|
2286
|
-
readonly avnu: {
|
|
2287
|
-
readonly api: "https://starknet.api.avnu.fi/swap/v2/quotes";
|
|
2288
|
-
};
|
|
2289
|
-
readonly minDebtForVesuRebalacing: number;
|
|
2290
|
-
};
|
|
2291
|
-
declare const AbisConfig: {
|
|
2292
|
-
readonly vesu: {
|
|
2293
|
-
readonly multiply: ({
|
|
2294
|
-
type: string;
|
|
2295
|
-
name: string;
|
|
2296
|
-
interface_name: string;
|
|
2297
|
-
members?: undefined;
|
|
2298
|
-
items?: undefined;
|
|
2299
|
-
variants?: undefined;
|
|
2300
|
-
inputs?: undefined;
|
|
2301
|
-
kind?: undefined;
|
|
2302
|
-
} | {
|
|
2303
|
-
type: string;
|
|
2304
|
-
name: string;
|
|
2305
|
-
members: {
|
|
2306
|
-
name: string;
|
|
2307
|
-
type: string;
|
|
2308
|
-
}[];
|
|
2309
|
-
interface_name?: undefined;
|
|
2310
|
-
items?: undefined;
|
|
2311
|
-
variants?: undefined;
|
|
2312
|
-
inputs?: undefined;
|
|
2313
|
-
kind?: undefined;
|
|
2314
|
-
} | {
|
|
2315
|
-
type: string;
|
|
2316
|
-
name: string;
|
|
2317
|
-
items: {
|
|
2318
|
-
type: string;
|
|
2319
|
-
name: string;
|
|
2320
|
-
inputs: {
|
|
2321
|
-
name: string;
|
|
2322
|
-
type: string;
|
|
2323
|
-
}[];
|
|
2324
|
-
outputs: {
|
|
2325
|
-
type: string;
|
|
2326
|
-
}[];
|
|
2327
|
-
state_mutability: string;
|
|
2328
|
-
}[];
|
|
2329
|
-
interface_name?: undefined;
|
|
2330
|
-
members?: undefined;
|
|
2331
|
-
variants?: undefined;
|
|
2332
|
-
inputs?: undefined;
|
|
2333
|
-
kind?: undefined;
|
|
2334
|
-
} | {
|
|
2335
|
-
type: string;
|
|
2336
|
-
name: string;
|
|
2337
|
-
variants: {
|
|
2338
|
-
name: string;
|
|
2339
|
-
type: string;
|
|
2340
|
-
}[];
|
|
2341
|
-
interface_name?: undefined;
|
|
2342
|
-
members?: undefined;
|
|
2343
|
-
items?: undefined;
|
|
2344
|
-
inputs?: undefined;
|
|
2345
|
-
kind?: undefined;
|
|
2346
|
-
} | {
|
|
2347
|
-
type: string;
|
|
2348
|
-
name: string;
|
|
2349
|
-
inputs: {
|
|
2350
|
-
name: string;
|
|
2351
|
-
type: string;
|
|
2352
|
-
}[];
|
|
2353
|
-
interface_name?: undefined;
|
|
2354
|
-
members?: undefined;
|
|
2355
|
-
items?: undefined;
|
|
2356
|
-
variants?: undefined;
|
|
2357
|
-
kind?: undefined;
|
|
2358
|
-
} | {
|
|
2359
|
-
type: string;
|
|
2360
|
-
name: string;
|
|
2361
|
-
kind: string;
|
|
2362
|
-
members: {
|
|
2363
|
-
name: string;
|
|
2364
|
-
type: string;
|
|
2365
|
-
kind: string;
|
|
2366
|
-
}[];
|
|
2367
|
-
interface_name?: undefined;
|
|
2368
|
-
items?: undefined;
|
|
2369
|
-
variants?: undefined;
|
|
2370
|
-
inputs?: undefined;
|
|
2371
|
-
} | {
|
|
2372
|
-
type: string;
|
|
2373
|
-
name: string;
|
|
2374
|
-
kind: string;
|
|
2375
|
-
variants: {
|
|
2376
|
-
name: string;
|
|
2377
|
-
type: string;
|
|
2378
|
-
kind: string;
|
|
2379
|
-
}[];
|
|
2380
|
-
interface_name?: undefined;
|
|
2381
|
-
members?: undefined;
|
|
2382
|
-
items?: undefined;
|
|
2383
|
-
inputs?: undefined;
|
|
2384
|
-
})[];
|
|
2385
|
-
readonly pool: ({
|
|
2386
|
-
type: string;
|
|
2387
|
-
name: string;
|
|
2388
|
-
interface_name: string;
|
|
2389
|
-
members?: undefined;
|
|
2390
|
-
variants?: undefined;
|
|
2391
|
-
items?: undefined;
|
|
2392
|
-
inputs?: undefined;
|
|
2393
|
-
kind?: undefined;
|
|
2394
|
-
} | {
|
|
2395
|
-
type: string;
|
|
2396
|
-
name: string;
|
|
2397
|
-
members: {
|
|
2398
|
-
name: string;
|
|
2399
|
-
type: string;
|
|
2400
|
-
}[];
|
|
2401
|
-
interface_name?: undefined;
|
|
2402
|
-
variants?: undefined;
|
|
2403
|
-
items?: undefined;
|
|
2404
|
-
inputs?: undefined;
|
|
2405
|
-
kind?: undefined;
|
|
2406
|
-
} | {
|
|
2407
|
-
type: string;
|
|
2408
|
-
name: string;
|
|
2409
|
-
variants: {
|
|
2410
|
-
name: string;
|
|
2411
|
-
type: string;
|
|
2412
|
-
}[];
|
|
2413
|
-
interface_name?: undefined;
|
|
2414
|
-
members?: undefined;
|
|
2415
|
-
items?: undefined;
|
|
2416
|
-
inputs?: undefined;
|
|
2417
|
-
kind?: undefined;
|
|
2418
|
-
} | {
|
|
2419
|
-
type: string;
|
|
2420
|
-
name: string;
|
|
2421
|
-
items: {
|
|
2422
|
-
type: string;
|
|
2423
|
-
name: string;
|
|
2424
|
-
inputs: {
|
|
2425
|
-
name: string;
|
|
2426
|
-
type: string;
|
|
2427
|
-
}[];
|
|
2428
|
-
outputs: {
|
|
2429
|
-
type: string;
|
|
2430
|
-
}[];
|
|
2431
|
-
state_mutability: string;
|
|
2432
|
-
}[];
|
|
2433
|
-
interface_name?: undefined;
|
|
2434
|
-
members?: undefined;
|
|
2435
|
-
variants?: undefined;
|
|
2436
|
-
inputs?: undefined;
|
|
2437
|
-
kind?: undefined;
|
|
2438
|
-
} | {
|
|
2439
|
-
type: string;
|
|
2440
|
-
name: string;
|
|
2441
|
-
inputs: {
|
|
2442
|
-
name: string;
|
|
2443
|
-
type: string;
|
|
2444
|
-
}[];
|
|
2445
|
-
interface_name?: undefined;
|
|
2446
|
-
members?: undefined;
|
|
2447
|
-
variants?: undefined;
|
|
2448
|
-
items?: undefined;
|
|
2449
|
-
kind?: undefined;
|
|
2450
|
-
} | {
|
|
2451
|
-
type: string;
|
|
2452
|
-
name: string;
|
|
2453
|
-
kind: string;
|
|
2454
|
-
members: {
|
|
2455
|
-
name: string;
|
|
2456
|
-
type: string;
|
|
2457
|
-
kind: string;
|
|
2458
|
-
}[];
|
|
2459
|
-
interface_name?: undefined;
|
|
2460
|
-
variants?: undefined;
|
|
2461
|
-
items?: undefined;
|
|
2462
|
-
inputs?: undefined;
|
|
2463
|
-
} | {
|
|
2464
|
-
type: string;
|
|
2465
|
-
name: string;
|
|
2466
|
-
kind: string;
|
|
2467
|
-
variants: {
|
|
2468
|
-
name: string;
|
|
2469
|
-
type: string;
|
|
2470
|
-
kind: string;
|
|
2471
|
-
}[];
|
|
2472
|
-
interface_name?: undefined;
|
|
2473
|
-
members?: undefined;
|
|
2474
|
-
items?: undefined;
|
|
2475
|
-
inputs?: undefined;
|
|
2476
|
-
})[];
|
|
2477
|
-
};
|
|
2478
|
-
readonly extended: {
|
|
2479
|
-
readonly contract: ({
|
|
2480
|
-
type: string;
|
|
2481
|
-
name: string;
|
|
2482
|
-
interface_name: string;
|
|
2483
|
-
members?: undefined;
|
|
2484
|
-
variants?: undefined;
|
|
2485
|
-
items?: undefined;
|
|
2486
|
-
inputs?: undefined;
|
|
2487
|
-
kind?: undefined;
|
|
2488
|
-
} | {
|
|
2489
|
-
type: string;
|
|
2490
|
-
name: string;
|
|
2491
|
-
members: {
|
|
2492
|
-
name: string;
|
|
2493
|
-
type: string;
|
|
2494
|
-
}[];
|
|
2495
|
-
interface_name?: undefined;
|
|
2496
|
-
variants?: undefined;
|
|
2497
|
-
items?: undefined;
|
|
2498
|
-
inputs?: undefined;
|
|
2499
|
-
kind?: undefined;
|
|
2500
|
-
} | {
|
|
2501
|
-
type: string;
|
|
2502
|
-
name: string;
|
|
2503
|
-
variants: {
|
|
2504
|
-
name: string;
|
|
2505
|
-
type: string;
|
|
2506
|
-
}[];
|
|
2507
|
-
interface_name?: undefined;
|
|
2508
|
-
members?: undefined;
|
|
2509
|
-
items?: undefined;
|
|
2510
|
-
inputs?: undefined;
|
|
2511
|
-
kind?: undefined;
|
|
2512
|
-
} | {
|
|
2513
|
-
type: string;
|
|
2514
|
-
name: string;
|
|
2515
|
-
items: {
|
|
2516
|
-
type: string;
|
|
2517
|
-
name: string;
|
|
2518
|
-
inputs: {
|
|
2519
|
-
name: string;
|
|
2520
|
-
type: string;
|
|
2521
|
-
}[];
|
|
2522
|
-
outputs: {
|
|
2523
|
-
type: string;
|
|
2524
|
-
}[];
|
|
2525
|
-
state_mutability: string;
|
|
2526
|
-
}[];
|
|
2527
|
-
interface_name?: undefined;
|
|
2528
|
-
members?: undefined;
|
|
2529
|
-
variants?: undefined;
|
|
2530
|
-
inputs?: undefined;
|
|
2531
|
-
kind?: undefined;
|
|
2532
|
-
} | {
|
|
2533
|
-
type: string;
|
|
2534
|
-
name: string;
|
|
2535
|
-
inputs: {
|
|
2536
|
-
name: string;
|
|
2537
|
-
type: string;
|
|
2538
|
-
}[];
|
|
2539
|
-
interface_name?: undefined;
|
|
2540
|
-
members?: undefined;
|
|
2541
|
-
variants?: undefined;
|
|
2542
|
-
items?: undefined;
|
|
2543
|
-
kind?: undefined;
|
|
2544
|
-
} | {
|
|
2545
|
-
type: string;
|
|
2546
|
-
name: string;
|
|
2547
|
-
kind: string;
|
|
2548
|
-
members: {
|
|
2549
|
-
name: string;
|
|
2550
|
-
type: string;
|
|
2551
|
-
kind: string;
|
|
2552
|
-
}[];
|
|
2553
|
-
interface_name?: undefined;
|
|
2554
|
-
variants?: undefined;
|
|
2555
|
-
items?: undefined;
|
|
2556
|
-
inputs?: undefined;
|
|
2557
|
-
} | {
|
|
2558
|
-
type: string;
|
|
2559
|
-
name: string;
|
|
2560
|
-
kind: string;
|
|
2561
|
-
variants: {
|
|
2562
|
-
name: string;
|
|
2563
|
-
type: string;
|
|
2564
|
-
kind: string;
|
|
2565
|
-
}[];
|
|
2566
|
-
interface_name?: undefined;
|
|
2567
|
-
members?: undefined;
|
|
2568
|
-
items?: undefined;
|
|
2569
|
-
inputs?: undefined;
|
|
2570
|
-
})[];
|
|
2571
|
-
};
|
|
2572
|
-
};
|
|
2900
|
+
declare const BoostedxSTRKCarryStrategies: IStrategyMetadata<BoostedxSTRKCarryStrategySettings>[];
|
|
2573
2901
|
|
|
2574
2902
|
/**
|
|
2575
|
-
*
|
|
2576
|
-
* Converts a decimal amount to the proper format for blockchain transactions
|
|
2577
|
-
* @param {number} amount - The decimal amount to convert
|
|
2578
|
-
* @param {number} fromTokenDecimals - The decimal precision of the token
|
|
2579
|
-
* @returns {string} The formatted amount as a hexadecimal string
|
|
2903
|
+
* Filter option definition
|
|
2580
2904
|
*/
|
|
2581
|
-
|
|
2905
|
+
interface FilterOption {
|
|
2906
|
+
id: string;
|
|
2907
|
+
label: string;
|
|
2908
|
+
icon?: string;
|
|
2909
|
+
}
|
|
2582
2910
|
/**
|
|
2583
|
-
*
|
|
2584
|
-
* Determines how much to allocate to each platform based on leverage calculations
|
|
2585
|
-
* @param {number} amount - The total amount to distribute
|
|
2586
|
-
* @returns {object} Object containing avnu_amount, extended_amount, and extended_leverage
|
|
2911
|
+
* Strategy filter metadata - defines what filters are available
|
|
2587
2912
|
*/
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
}>;
|
|
2913
|
+
interface StrategyFilterMetadata {
|
|
2914
|
+
assets: FilterOption[];
|
|
2915
|
+
protocols: FilterOption[];
|
|
2916
|
+
quickFilters: FilterOption[];
|
|
2917
|
+
}
|
|
2594
2918
|
/**
|
|
2595
|
-
*
|
|
2596
|
-
* @param amount - The amount to withdraw
|
|
2597
|
-
* @param client - The client
|
|
2598
|
-
* @param marketName - The market name
|
|
2599
|
-
* @returns {object} Object containing avnu_amount and extended_amount
|
|
2919
|
+
* Strategy type enum
|
|
2600
2920
|
*/
|
|
2601
|
-
declare
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2921
|
+
declare enum StrategyType {
|
|
2922
|
+
EKUBO_CL = "ekubo",
|
|
2923
|
+
UNIVERSAL = "universal",
|
|
2924
|
+
HYPER_LST = "hyper-lst",
|
|
2925
|
+
VESU_REBALANCE = "vesu-rebalance",
|
|
2926
|
+
SENSEI = "sensei",
|
|
2927
|
+
YOLO_VAULT = "yolo-vault",
|
|
2928
|
+
BOOSTEDXSTRKCARRY = "boostedxstrkcarry"
|
|
2929
|
+
}
|
|
2607
2930
|
/**
|
|
2608
|
-
*
|
|
2609
|
-
* calculates the optimal leverage for Avnu based on LTV ratios and price drop protection
|
|
2610
|
-
* @returns {number} The calculated leverage value
|
|
2931
|
+
* Strategy metadata extracted from IStrategyMetadata
|
|
2611
2932
|
*/
|
|
2612
|
-
|
|
2933
|
+
interface StrategyMetadata {
|
|
2934
|
+
id: string;
|
|
2935
|
+
name: string;
|
|
2936
|
+
type: StrategyType;
|
|
2937
|
+
assets: string[];
|
|
2938
|
+
protocols: string[];
|
|
2939
|
+
tags: string[];
|
|
2940
|
+
curator?: {
|
|
2941
|
+
name: string;
|
|
2942
|
+
logo: string;
|
|
2943
|
+
};
|
|
2944
|
+
isRetired: boolean;
|
|
2945
|
+
}
|
|
2613
2946
|
/**
|
|
2614
|
-
*
|
|
2615
|
-
* calculates the maximum safe leverage for Extended based on maintenance margin and price drop protection
|
|
2616
|
-
* @returns {number} The calculated leverage value
|
|
2947
|
+
* Strategy registry entry
|
|
2617
2948
|
*/
|
|
2618
|
-
|
|
2949
|
+
interface StrategyRegistryEntry<T = any> {
|
|
2950
|
+
metadata: IStrategyMetadata<T>;
|
|
2951
|
+
type: StrategyType;
|
|
2952
|
+
}
|
|
2619
2953
|
/**
|
|
2620
|
-
*
|
|
2621
|
-
* Determines how much debt to add or remove based on collateral changes and target health factor
|
|
2622
|
-
* @param {Web3Number} collateralAmount - Current collateral amount
|
|
2623
|
-
* @param {Web3Number} debtAmount - Current debt amount
|
|
2624
|
-
* @param {number} debtPrice - Current price of the debt token
|
|
2625
|
-
* @param {number} maxLtv - Maximum loan-to-value ratio (default: MAX_LTV_BTC_USDC)
|
|
2626
|
-
* @param {number} addedAmount - Amount being added to collateral
|
|
2627
|
-
* @param {number} collateralPrice - Current price of the collateral token
|
|
2628
|
-
* @param {boolean} isDeposit - Whether this is a deposit (true) or withdrawal (false)
|
|
2629
|
-
* @returns {object} Object containing deltadebtAmountUnits and isIncrease flag
|
|
2954
|
+
* Build strategy registry from SDK strategies
|
|
2630
2955
|
*/
|
|
2631
|
-
declare
|
|
2632
|
-
collateralPrice: number, isDeposit: boolean) => {
|
|
2633
|
-
deltadebtAmountUnits: Web3Number;
|
|
2634
|
-
isIncrease: boolean;
|
|
2635
|
-
} | {
|
|
2636
|
-
deltadebtAmountUnits: null;
|
|
2637
|
-
isIncrease: null;
|
|
2638
|
-
};
|
|
2956
|
+
declare function buildStrategyRegistry(): StrategyRegistryEntry[];
|
|
2639
2957
|
/**
|
|
2640
|
-
*
|
|
2641
|
-
* @param debtAmount in debt units
|
|
2642
|
-
* @param collateralAmount in collateral units
|
|
2643
|
-
* @param maxLtv in percentage
|
|
2644
|
-
* @param withdrawalAmount in collateral units
|
|
2645
|
-
* @param collateralPrice in usd
|
|
2646
|
-
* @param debtPrice in usd
|
|
2647
|
-
* @returns deltadebtAmountUnits in debt units
|
|
2648
|
-
* isIncrease: true if the debt amount is increasing, false if it is decreasing
|
|
2958
|
+
* Get all strategy metadata from registry
|
|
2649
2959
|
*/
|
|
2650
|
-
declare
|
|
2651
|
-
deltadebtAmountUnits: string;
|
|
2652
|
-
} | {
|
|
2653
|
-
deltadebtAmountUnits: null;
|
|
2654
|
-
};
|
|
2960
|
+
declare function getAllStrategyMetadata(): StrategyMetadata[];
|
|
2655
2961
|
/**
|
|
2656
|
-
*
|
|
2657
|
-
* @param client - The client
|
|
2658
|
-
* @returns The amount to deposit on extended when incurring losses
|
|
2962
|
+
* Get filter metadata - defines available filters and their options
|
|
2659
2963
|
*/
|
|
2660
|
-
declare
|
|
2661
|
-
declare const calculateExposureDelta: (exposure_extended: number, exposure_vesu: number) => number;
|
|
2964
|
+
declare function getFilterMetadata(): StrategyFilterMetadata;
|
|
2662
2965
|
/**
|
|
2663
|
-
*
|
|
2664
|
-
* @param {number} btcPrice - The current btc price
|
|
2665
|
-
* @param {number} lastBtcPrice - The last btc price
|
|
2666
|
-
* @returns {number} The delta percentage
|
|
2966
|
+
* Get live strategies (filter out retired)
|
|
2667
2967
|
*/
|
|
2668
|
-
declare
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2968
|
+
declare function getLiveStrategies(): StrategyRegistryEntry[];
|
|
2969
|
+
/**
|
|
2970
|
+
* Get strategies by type
|
|
2971
|
+
*/
|
|
2972
|
+
declare function getStrategiesByType(type: StrategyType): StrategyRegistryEntry[];
|
|
2973
|
+
|
|
2974
|
+
declare enum FactoryStrategyType {
|
|
2975
|
+
UNIVERSAL = "UNIVERSAL",
|
|
2976
|
+
EKUBO_CL = "EKUBO_CL",
|
|
2977
|
+
HYPER_LST = "HYPER_LST",
|
|
2978
|
+
VESU_REBALANCE = "VESU_REBALANCE",
|
|
2979
|
+
SENSEI = "SENSEI",
|
|
2980
|
+
YOLO_VAULT = "YOLO_VAULT",
|
|
2981
|
+
BOOSTEDXSTRKCARRY = "BOOSTEDXSTRKCARRY"
|
|
2982
|
+
}
|
|
2983
|
+
declare function createUniversalStrategy(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<UniversalStrategySettings>): UniversalStrategy<UniversalStrategySettings>;
|
|
2984
|
+
declare function createEkuboCLStrategy(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<CLVaultStrategySettings>): EkuboCLVault;
|
|
2985
|
+
declare function createYoloVaultStrategy(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<YoloVaultSettings>): YoLoVault;
|
|
2986
|
+
declare function createHyperLSTStrategy(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<HyperLSTStrategySettings>): UniversalLstMultiplierStrategy<HyperLSTStrategySettings>;
|
|
2987
|
+
declare function createVesuRebalanceStrategy(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<VesuRebalanceSettings>): VesuRebalance;
|
|
2988
|
+
declare function createSenseiStrategy(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<SenseiVaultSettings>): SenseiVault;
|
|
2989
|
+
declare function createBoostedXSTRKCarryStrategy(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<BoostedxSTRKCarryStrategySettings>): BoostedxSTRKCarryStrategy<BoostedxSTRKCarryStrategySettings>;
|
|
2990
|
+
/**
|
|
2991
|
+
* Determines the strategy type from metadata by inspecting the additionalInfo structure
|
|
2992
|
+
*/
|
|
2993
|
+
declare function getStrategyTypeFromMetadata(metadata: IStrategyMetadata<any>): FactoryStrategyType;
|
|
2994
|
+
/**
|
|
2995
|
+
* Generic factory function that creates SDK strategy instances based on type
|
|
2996
|
+
*/
|
|
2997
|
+
declare function createStrategy(type: FactoryStrategyType, config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<any>): EkuboCLVault | VesuRebalance | SenseiVault | YoLoVault | UniversalStrategy<UniversalStrategySettings> | UniversalLstMultiplierStrategy<HyperLSTStrategySettings> | BoostedxSTRKCarryStrategy<BoostedxSTRKCarryStrategySettings>;
|
|
2674
2998
|
|
|
2675
2999
|
interface EkuboRouteNode {
|
|
2676
3000
|
pool_key: {
|
|
@@ -2698,14 +3022,23 @@ declare class EkuboQuoter {
|
|
|
2698
3022
|
ENDPOINT: string;
|
|
2699
3023
|
tokenMarketData: TokenMarketData;
|
|
2700
3024
|
constructor(config: IConfig, pricer: PricerBase);
|
|
3025
|
+
private _callQuoterApi;
|
|
2701
3026
|
/**
|
|
2702
|
-
*
|
|
2703
|
-
* @param fromToken
|
|
2704
|
-
* @param toToken
|
|
2705
|
-
* @param
|
|
2706
|
-
* @returns
|
|
3027
|
+
* Given exactly `inputAmount` of `fromToken`, how much `toToken` do I receive?
|
|
3028
|
+
* @param fromToken - address of the token being sold
|
|
3029
|
+
* @param toToken - address of the token being bought
|
|
3030
|
+
* @param inputAmount - must be positive (the amount of fromToken to sell)
|
|
3031
|
+
* @returns EkuboQuote where `total_calculated` is the output amount (positive)
|
|
3032
|
+
*/
|
|
3033
|
+
getQuoteExactInput(fromToken: string, toToken: string, inputAmount: Web3Number): Promise<EkuboQuote>;
|
|
3034
|
+
/**
|
|
3035
|
+
* To receive exactly `outputAmount` of `toToken`, how much `fromToken` must I provide?
|
|
3036
|
+
* @param fromToken - address of the token being sold
|
|
3037
|
+
* @param toToken - address of the token being bought
|
|
3038
|
+
* @param outputAmount - must be positive (the desired amount of toToken to receive)
|
|
3039
|
+
* @returns EkuboQuote where `total_calculated` is the required input amount (negative per Ekubo convention)
|
|
2707
3040
|
*/
|
|
2708
|
-
|
|
3041
|
+
getQuoteExactOutput(fromToken: string, toToken: string, outputAmount: Web3Number): Promise<EkuboQuote>;
|
|
2709
3042
|
getDexPrice(baseToken: TokenInfo, quoteToken: TokenInfo, amount: Web3Number): Promise<number>;
|
|
2710
3043
|
getLSTTrueExchangeRate(baseToken: TokenInfo, quoteToken: TokenInfo, amount: Web3Number): Promise<number>;
|
|
2711
3044
|
getSwapLimitAmount(fromToken: TokenInfo, toToken: TokenInfo, amount: Web3Number, max_slippage?: number): Promise<Web3Number>;
|
|
@@ -2736,6 +3069,7 @@ declare class Global {
|
|
|
2736
3069
|
static getTokens(): Promise<TokenInfo[]>;
|
|
2737
3070
|
static assert(condition: any, message: string): void;
|
|
2738
3071
|
static getTokenInfoFromAddr(addr: ContractAddr): Promise<TokenInfo>;
|
|
3072
|
+
static getTokenInfoFromName(tokenName: string): Promise<TokenInfo>;
|
|
2739
3073
|
static setGlobalCache(key: string, data: any, ttl?: number): void;
|
|
2740
3074
|
static getGlobalCache<T>(key: string): T | null;
|
|
2741
3075
|
}
|
|
@@ -2867,6 +3201,16 @@ declare class Midas {
|
|
|
2867
3201
|
} | number>;
|
|
2868
3202
|
}
|
|
2869
3203
|
|
|
3204
|
+
type UsdPriceResolver = (symbol: string) => Promise<number>;
|
|
3205
|
+
declare class EkuboPricer extends PricerBase {
|
|
3206
|
+
private readonly resolveUsdPrice?;
|
|
3207
|
+
EKUBO_PRICE_FETCHER_ADDRESS: string;
|
|
3208
|
+
readonly contract: Contract;
|
|
3209
|
+
constructor(config: IConfig, tokens: TokenInfo[], resolveUsdPrice?: UsdPriceResolver | undefined);
|
|
3210
|
+
private div2Power128;
|
|
3211
|
+
getPrice(tokenAddr: string, blockIdentifier?: BlockIdentifier): Promise<PriceInfo>;
|
|
3212
|
+
}
|
|
3213
|
+
|
|
2870
3214
|
declare class TelegramNotif {
|
|
2871
3215
|
private subscribers;
|
|
2872
3216
|
readonly bot: TelegramBot;
|
|
@@ -2903,7 +3247,7 @@ declare class PricerRedis extends Pricer {
|
|
|
2903
3247
|
/** sets current local price in redis */
|
|
2904
3248
|
private _setRedisPrices;
|
|
2905
3249
|
/** Returns price from redis */
|
|
2906
|
-
getPrice(tokenSymbol: string): Promise<PriceInfo>;
|
|
3250
|
+
getPrice(tokenSymbol: string, blockNumber?: BlockIdentifier): Promise<PriceInfo>;
|
|
2907
3251
|
}
|
|
2908
3252
|
|
|
2909
3253
|
declare function getAPIUsingHeadlessBrowser(url: string): Promise<any>;
|
|
@@ -2930,6 +3274,7 @@ declare function executeDeployCalls(contractsInfo: DeployContractResult[], acc:
|
|
|
2930
3274
|
declare function executeTransactions(calls: Call[], acc: Account, provider: RpcProvider, remarks?: string): Promise<{
|
|
2931
3275
|
transaction_hash: string;
|
|
2932
3276
|
}>;
|
|
3277
|
+
declare function myWaitForTransaction(transaction_hash: string, provider: RpcProvider, retry?: number): Promise<boolean>;
|
|
2933
3278
|
declare const Deployer: {
|
|
2934
3279
|
getAccount: typeof getAccount;
|
|
2935
3280
|
myDeclare: typeof myDeclare;
|
|
@@ -2937,6 +3282,7 @@ declare const Deployer: {
|
|
|
2937
3282
|
prepareMultiDeployContracts: typeof prepareMultiDeployContracts;
|
|
2938
3283
|
executeDeployCalls: typeof executeDeployCalls;
|
|
2939
3284
|
executeTransactions: typeof executeTransactions;
|
|
3285
|
+
myWaitForTransaction: typeof myWaitForTransaction;
|
|
2940
3286
|
};
|
|
2941
3287
|
|
|
2942
3288
|
/**
|
|
@@ -3017,4 +3363,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
3017
3363
|
decrypt(encryptedData: string, password: string): any;
|
|
3018
3364
|
}
|
|
3019
3365
|
|
|
3020
|
-
export { type APYInfo, APYType, AUDIT_URL, AUMTypes, AVNU_EXCHANGE, AVNU_EXCHANGE_FOR_LEGACY_USDC, AVNU_LEGACY_SANITIZER, AVNU_MIDDLEWARE, AVNU_QUOTE_URL,
|
|
3366
|
+
export { type APYInfo, APYType, AUDIT_URL, AUMTypes, AVNU_EXCHANGE, AVNU_EXCHANGE_FOR_LEGACY_USDC, AVNU_LEGACY_SANITIZER, AVNU_MIDDLEWARE, AVNU_QUOTE_URL, type AccessControlInfo, AccessControlType, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type AmountInfo, type AmountsInfo, type ApproveCallParams, AuditStatus, AutoCompounderSTRK, AvnuAdapter, type AvnuAdapterConfig, type AvnuDepositParams, type AvnuSwapCallParams, type AvnuWithdrawParams, AvnuWrapper, BaseAdapter, type BaseAdapterConfig, BaseStrategy, BoostedxSTRKCarryStrategies, BoostedxSTRKCarryStrategy, type BoostedxSTRKCarryStrategySettings, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, DEFAULT_TROVES_STRATEGIES_API, type DecreaseLeverParams, Deployer, type DepositParams, type DualActionAmount, type DualTokenInfo, ERC20, EXTENDED_CONTRACT, EXTENDED_SANITIZER, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, EkuboPricer, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FactoryStrategyType, FatalError, type FeeBps, type FilterOption, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HealthFactorMath, HyperLSTStrategies, type HyperLSTStrategySettings, type IConfig, type ICurator, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type InputModeFromAction, InstantWithdrawalVault, LSTAPRService, LSTPriceType, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type LoggerConfig, type LoggerLevel, type ManageCall, MarginType, Midas, MyNumber, type NetAPYDetails, type NetAPYSplit, Network, PRICE_ROUTER, type ParsedStarknetCall, PasswordJsonCryptoUtil, type PositionAPY, type PositionAmount, type PositionInfo, PositionTypeAvnuExtended, Pragma, type PriceInfo, type PriceMethod, Pricer, PricerAvnuApi, PricerBase, PricerFromApi, PricerLST, PricerRedis, Protocols, type RedemptionInfo, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SVK_SIMPLE_SANITIZER, type SecurityMetadata, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, type SourceCodeInfo, SourceCodeType, StandardMerkleTree, type StandardMerkleTreeData, StarknetCallParser, type StarknetCallParserOptions, Store, type StoreConfig, type StrategyAlert, type StrategyApyHistoryUIConfig, type StrategyCapabilities, type StrategyFilterMetadata, type StrategyInputMode, StrategyLiveStatus, type StrategyMetadata, type StrategyRegistryEntry, type StrategySettings, StrategyTag, StrategyType, type SupportedPosition, SvkTrovesAdapter, type SvkTrovesAdapterConfig, type Swap, type SwapInfo, type SwapPriceInfo, TRANSFER_SANITIZER, TelegramGroupNotif, TelegramNotif, type TokenAmount, TokenIndexingType, type TokenInfo, TokenMarketData, TokenTransferAdapter, type TokenTransferAdapterConfig, UNIVERSAL_ADAPTER_IDS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, UnwrapLabsCurator, type UsdPriceResolver, type UserPositionCard, type UserPositionCardSubValueColor, type UserPositionCardsInput, type UserYoloInfo, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, type VaultPosition, VaultType, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuDepositParams, type VesuModifyDelegationCallParams, VesuModifyPositionAdapter, type VesuModifyPositionAdapterConfig, type VesuModifyPositionCallParams, type VesuModifyPositionDepositParams, type VesuModifyPositionWithdrawParams, VesuMultiplyAdapter, type VesuMultiplyAdapterConfig, type VesuMultiplyCallParams, VesuPoolMetadata, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, VesuSupplyOnlyAdapter, type VesuSupplyOnlyAdapterConfig, type VesuWithdrawParams, Web3Number, type WithdrawParams, YoLoVault, type YoloSettings, type YoloSpendingLevel, type YoloVaultSettings, type YoloVaultStatus, YoloVaultStrategies, ZkLend, _riskFactor, assert, buildStrategyRegistry, configureLogger, createBoostedXSTRKCarryStrategy, createEkuboCLStrategy, createHyperLSTStrategy, createSenseiStrategy, createStrategy, createUniversalStrategy, createVesuRebalanceStrategy, createYoloVaultStrategy, 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, toAmountsInfo, toBigInt };
|