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