@strkfarm/sdk 1.1.8 → 1.1.10
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 +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.browser.global.js +1241 -74
- package/dist/index.browser.mjs +1396 -227
- package/dist/index.d.ts +169 -30
- package/dist/index.js +1412 -239
- package/dist/index.mjs +1397 -228
- package/package.json +1 -1
- package/src/data/vesu-multiple.abi.json +475 -0
- package/src/dataTypes/_bignumber.ts +13 -0
- package/src/interfaces/common.tsx +2 -1
- package/src/modules/ekubo-quoter.ts +127 -0
- package/src/modules/index.ts +1 -0
- package/src/strategies/ekubo-cl-vault.tsx +25 -11
- package/src/strategies/index.ts +2 -1
- package/src/strategies/universal-adapters/adapter-utils.ts +3 -0
- package/src/strategies/universal-adapters/baseAdapter.ts +3 -3
- package/src/strategies/universal-adapters/vesu-adapter.ts +244 -3
- package/src/strategies/universal-lst-muliplier-strategy.tsx +497 -0
- package/src/strategies/universal-strategy.tsx +142 -60
- package/src/utils/index.ts +3 -1
- package/src/utils/logger.node.ts +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ declare class _Web3Number<T extends _Web3Number<T>> extends BigNumber {
|
|
|
26
26
|
private getStandardString;
|
|
27
27
|
minimum(value: string | number | T): T;
|
|
28
28
|
maximum(value: string | number | T): T;
|
|
29
|
+
abs(): T;
|
|
30
|
+
toI129(): {
|
|
31
|
+
mag: bigint;
|
|
32
|
+
sign: 0 | 1;
|
|
33
|
+
};
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
declare class Web3Number extends _Web3Number<Web3Number> {
|
|
@@ -138,6 +143,7 @@ interface IStrategyMetadata<T> {
|
|
|
138
143
|
name: string;
|
|
139
144
|
logo: string;
|
|
140
145
|
};
|
|
146
|
+
isPreview?: boolean;
|
|
141
147
|
}
|
|
142
148
|
interface IInvestmentFlow {
|
|
143
149
|
id?: string;
|
|
@@ -338,28 +344,6 @@ declare class AvnuWrapper {
|
|
|
338
344
|
static buildZeroSwap(tokenToSell: ContractAddr, address: string): SwapInfo;
|
|
339
345
|
}
|
|
340
346
|
|
|
341
|
-
declare class FatalError extends Error {
|
|
342
|
-
constructor(message: string, err?: Error);
|
|
343
|
-
}
|
|
344
|
-
/** Contains globally useful functions.
|
|
345
|
-
* - fatalError: Things to do when a fatal error occurs
|
|
346
|
-
*/
|
|
347
|
-
declare class Global {
|
|
348
|
-
static cache: Record<string, {
|
|
349
|
-
value: any;
|
|
350
|
-
ttl: number;
|
|
351
|
-
timestamp: number;
|
|
352
|
-
}>;
|
|
353
|
-
static fatalError(message: string, err?: Error): void;
|
|
354
|
-
static httpError(url: string, err: Error, message?: string): void;
|
|
355
|
-
static getDefaultTokens(): TokenInfo[];
|
|
356
|
-
static getTokens(): Promise<TokenInfo[]>;
|
|
357
|
-
static assert(condition: any, message: string): void;
|
|
358
|
-
static getTokenInfoFromAddr(addr: ContractAddr): Promise<TokenInfo>;
|
|
359
|
-
static setGlobalCache(key: string, data: any, ttl?: number): void;
|
|
360
|
-
static getGlobalCache<T>(key: string): T | null;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
347
|
declare class AutoCompounderSTRK {
|
|
364
348
|
readonly config: IConfig;
|
|
365
349
|
readonly addr: ContractAddr;
|
|
@@ -919,7 +903,7 @@ declare class BaseAdapter extends CacheClass {
|
|
|
919
903
|
target: ContractAddr;
|
|
920
904
|
method: string;
|
|
921
905
|
packedArguments: bigint[];
|
|
922
|
-
}): LeafData;
|
|
906
|
+
}, sanitizer?: ContractAddr): LeafData;
|
|
923
907
|
}
|
|
924
908
|
|
|
925
909
|
interface FlashloanCallParams {
|
|
@@ -1002,11 +986,60 @@ interface VesuAdapterConfig {
|
|
|
1002
986
|
vaultAllocator: ContractAddr;
|
|
1003
987
|
id: string;
|
|
1004
988
|
}
|
|
989
|
+
interface TokenAmount {
|
|
990
|
+
token: ContractAddr;
|
|
991
|
+
amount: Web3Number;
|
|
992
|
+
}
|
|
993
|
+
interface Swap {
|
|
994
|
+
route: RouteNode[];
|
|
995
|
+
token_amount: TokenAmount;
|
|
996
|
+
}
|
|
997
|
+
interface RouteNode {
|
|
998
|
+
pool_key: EkuboPoolKey;
|
|
999
|
+
sqrt_ratio_limit: Web3Number;
|
|
1000
|
+
skip_ahead: Web3Number;
|
|
1001
|
+
}
|
|
1002
|
+
interface IncreaseLeverParams {
|
|
1003
|
+
pool_id: ContractAddr;
|
|
1004
|
+
collateral_asset: ContractAddr;
|
|
1005
|
+
debt_asset: ContractAddr;
|
|
1006
|
+
user: ContractAddr;
|
|
1007
|
+
add_margin: Web3Number;
|
|
1008
|
+
margin_swap: Swap[];
|
|
1009
|
+
margin_swap_limit_amount: Web3Number;
|
|
1010
|
+
lever_swap: Swap[];
|
|
1011
|
+
lever_swap_limit_amount: Web3Number;
|
|
1012
|
+
}
|
|
1013
|
+
interface DecreaseLeverParams {
|
|
1014
|
+
pool_id: ContractAddr;
|
|
1015
|
+
collateral_asset: ContractAddr;
|
|
1016
|
+
debt_asset: ContractAddr;
|
|
1017
|
+
user: ContractAddr;
|
|
1018
|
+
sub_margin: Web3Number;
|
|
1019
|
+
recipient: ContractAddr;
|
|
1020
|
+
lever_swap: Swap[];
|
|
1021
|
+
lever_swap_limit_amount: Web3Number;
|
|
1022
|
+
lever_swap_weights: Web3Number[];
|
|
1023
|
+
withdraw_swap: Swap[];
|
|
1024
|
+
withdraw_swap_limit_amount: Web3Number;
|
|
1025
|
+
withdraw_swap_weights: Web3Number[];
|
|
1026
|
+
close_position: boolean;
|
|
1027
|
+
}
|
|
1028
|
+
interface VesuMultiplyCallParams {
|
|
1029
|
+
increaseParams?: Omit<IncreaseLeverParams, 'user' | 'pool_id' | 'collateral_asset' | 'debt_asset'>;
|
|
1030
|
+
decreaseParams?: Omit<DecreaseLeverParams, 'user' | 'pool_id' | 'collateral_asset' | 'debt_asset' | 'recipient'>;
|
|
1031
|
+
isIncrease: boolean;
|
|
1032
|
+
}
|
|
1033
|
+
interface VesuModifyDelegationCallParams {
|
|
1034
|
+
delegation: boolean;
|
|
1035
|
+
}
|
|
1005
1036
|
declare const VesuPools: {
|
|
1006
1037
|
Genesis: ContractAddr;
|
|
1038
|
+
Re7xSTRK: ContractAddr;
|
|
1007
1039
|
};
|
|
1008
1040
|
declare class VesuAdapter extends BaseAdapter {
|
|
1009
1041
|
VESU_SINGLETON: ContractAddr;
|
|
1042
|
+
VESU_MULTIPLY: ContractAddr;
|
|
1010
1043
|
config: VesuAdapterConfig;
|
|
1011
1044
|
networkConfig: IConfig | undefined;
|
|
1012
1045
|
pricer: PricerBase | undefined;
|
|
@@ -1036,6 +1069,10 @@ declare class VesuAdapter extends BaseAdapter {
|
|
|
1036
1069
|
};
|
|
1037
1070
|
};
|
|
1038
1071
|
getModifyPositionCall: (params: VesuModifyPositionCallParams) => ManageCall;
|
|
1072
|
+
getMultiplyAdapter: () => AdapterLeafType<VesuMultiplyCallParams>;
|
|
1073
|
+
getMultiplyCall: (params: VesuMultiplyCallParams) => ManageCall;
|
|
1074
|
+
getVesuModifyDelegationAdapter: (id: string) => LeafAdapterFn<VesuModifyDelegationCallParams>;
|
|
1075
|
+
getVesuModifyDelegationCall: (params: VesuModifyDelegationCallParams) => ManageCall;
|
|
1039
1076
|
getDefispringRewardsAdapter: (id: string) => () => AdapterLeafType<VesuDefiSpringRewardsCallParams>;
|
|
1040
1077
|
getDefiSpringClaimCall: () => GenerateCallFn<VesuDefiSpringRewardsCallParams>;
|
|
1041
1078
|
formatAmountTypeEnum(amountType: VesuAmountType): CairoCustomEnum;
|
|
@@ -1057,6 +1094,11 @@ declare class VesuAdapter extends BaseAdapter {
|
|
|
1057
1094
|
static getVesuPools(retry?: number): Promise<VesuPoolsInfo>;
|
|
1058
1095
|
}
|
|
1059
1096
|
|
|
1097
|
+
interface UniversalManageCall {
|
|
1098
|
+
proofs: string[];
|
|
1099
|
+
manageCall: ManageCall;
|
|
1100
|
+
step: UNIVERSAL_MANAGE_IDS;
|
|
1101
|
+
}
|
|
1060
1102
|
interface UniversalStrategySettings {
|
|
1061
1103
|
vaultAddress: ContractAddr;
|
|
1062
1104
|
manager: ContractAddr;
|
|
@@ -1129,6 +1171,8 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1129
1171
|
usdValue: number;
|
|
1130
1172
|
}>;
|
|
1131
1173
|
getUnusedBalance(): Promise<SingleTokenInfo>;
|
|
1174
|
+
protected getVesuAUM(adapter: VesuAdapter): Promise<Web3Number>;
|
|
1175
|
+
getPrevAUM(): Promise<Web3Number>;
|
|
1132
1176
|
getAUM(): Promise<{
|
|
1133
1177
|
net: SingleTokenInfo;
|
|
1134
1178
|
prevAum: Web3Number;
|
|
@@ -1137,7 +1181,9 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1137
1181
|
aum: Web3Number;
|
|
1138
1182
|
}[];
|
|
1139
1183
|
}>;
|
|
1184
|
+
protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
|
|
1140
1185
|
getVesuAdapters(): VesuAdapter[];
|
|
1186
|
+
getVesuPositions(): Promise<VaultPosition[]>;
|
|
1141
1187
|
getVaultPositions(): Promise<VaultPosition[]>;
|
|
1142
1188
|
getSetManagerCall(strategist: ContractAddr, root?: string): Call;
|
|
1143
1189
|
getManageCall(proofIds: string[], manageCalls: ManageCall[]): Call;
|
|
@@ -1146,11 +1192,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1146
1192
|
isDeposit: boolean;
|
|
1147
1193
|
depositAmount: Web3Number;
|
|
1148
1194
|
debtAmount: Web3Number;
|
|
1149
|
-
}):
|
|
1150
|
-
proofs: string[];
|
|
1151
|
-
manageCall: ManageCall;
|
|
1152
|
-
step: UNIVERSAL_MANAGE_IDS;
|
|
1153
|
-
}[];
|
|
1195
|
+
}): UniversalManageCall[];
|
|
1154
1196
|
getTag(): string;
|
|
1155
1197
|
getVesuHealthFactors(): Promise<number[]>;
|
|
1156
1198
|
computeRebalanceConditionAndReturnCalls(): Promise<Call[]>;
|
|
@@ -1163,7 +1205,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1163
1205
|
* @returns
|
|
1164
1206
|
*/
|
|
1165
1207
|
private getLegRebalanceAmount;
|
|
1166
|
-
|
|
1208
|
+
getVesuModifyPositionCall(params: {
|
|
1167
1209
|
isDeposit: boolean;
|
|
1168
1210
|
leg1DepositAmount: Web3Number;
|
|
1169
1211
|
}): Promise<Call>;
|
|
@@ -1197,8 +1239,105 @@ declare enum UNIVERSAL_ADAPTERS {
|
|
|
1197
1239
|
VESU_LEG1 = "vesu_leg1_adapter",
|
|
1198
1240
|
VESU_LEG2 = "vesu_leg2_adapter"
|
|
1199
1241
|
}
|
|
1242
|
+
declare function getContractDetails(settings: UniversalStrategySettings): {
|
|
1243
|
+
address: ContractAddr;
|
|
1244
|
+
name: string;
|
|
1245
|
+
}[];
|
|
1200
1246
|
declare const UniversalStrategies: IStrategyMetadata<UniversalStrategySettings>[];
|
|
1201
1247
|
|
|
1248
|
+
declare class UniversalLstMultiplierStrategy extends UniversalStrategy<UniversalStrategySettings> {
|
|
1249
|
+
private quoteAmountToFetchPrice;
|
|
1250
|
+
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<UniversalStrategySettings>);
|
|
1251
|
+
getVesuAdapters(): VesuAdapter[];
|
|
1252
|
+
protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
|
|
1253
|
+
getLSTDexPrice(): Promise<number>;
|
|
1254
|
+
/**
|
|
1255
|
+
* Uses vesu's multiple call to create leverage on LST
|
|
1256
|
+
* Deposit amount is in LST
|
|
1257
|
+
* @param params
|
|
1258
|
+
*/
|
|
1259
|
+
getVesuMultiplyCall(params: {
|
|
1260
|
+
isDeposit: boolean;
|
|
1261
|
+
leg1DepositAmount: Web3Number;
|
|
1262
|
+
}): Promise<Call[]>;
|
|
1263
|
+
getLSTUnderlyingTokenInfo(): TokenInfo;
|
|
1264
|
+
getLSTExchangeRate(): Promise<number>;
|
|
1265
|
+
/**
|
|
1266
|
+
*
|
|
1267
|
+
* @param params marginAmount is in LST, debtAmount is in underlying
|
|
1268
|
+
*/
|
|
1269
|
+
getModifyLeverCall(params: {
|
|
1270
|
+
marginAmount: Web3Number;
|
|
1271
|
+
debtAmount: Web3Number;
|
|
1272
|
+
isIncrease: boolean;
|
|
1273
|
+
}): Promise<Call[]>;
|
|
1274
|
+
}
|
|
1275
|
+
declare const HyperLSTStrategies: IStrategyMetadata<UniversalStrategySettings>[];
|
|
1276
|
+
|
|
1277
|
+
interface EkuboRouteNode {
|
|
1278
|
+
pool_key: {
|
|
1279
|
+
token0: string;
|
|
1280
|
+
token1: string;
|
|
1281
|
+
fee: string;
|
|
1282
|
+
tick_spacing: number;
|
|
1283
|
+
extension: string;
|
|
1284
|
+
};
|
|
1285
|
+
sqrt_ratio_limit: string;
|
|
1286
|
+
skip_ahead: number;
|
|
1287
|
+
}
|
|
1288
|
+
interface EkuboSplit {
|
|
1289
|
+
amount_specified: string;
|
|
1290
|
+
amount_calculated: string;
|
|
1291
|
+
route: EkuboRouteNode[];
|
|
1292
|
+
}
|
|
1293
|
+
interface EkuboQuote {
|
|
1294
|
+
total_calculated: string;
|
|
1295
|
+
price_impact: number;
|
|
1296
|
+
splits: EkuboSplit[];
|
|
1297
|
+
}
|
|
1298
|
+
declare class EkuboQuoter {
|
|
1299
|
+
private readonly config;
|
|
1300
|
+
ENDPOINT: string;
|
|
1301
|
+
constructor(config: IConfig);
|
|
1302
|
+
/**
|
|
1303
|
+
*
|
|
1304
|
+
* @param fromToken
|
|
1305
|
+
* @param toToken
|
|
1306
|
+
* @param amount Can be negative too, which would mean to get exact amount out
|
|
1307
|
+
* @returns
|
|
1308
|
+
*/
|
|
1309
|
+
getQuote(fromToken: string, toToken: string, amount: Web3Number): Promise<EkuboQuote>;
|
|
1310
|
+
/**
|
|
1311
|
+
* Formats Ekubo response for Vesu multiple use
|
|
1312
|
+
* @param quote
|
|
1313
|
+
* @param fromTokenInfo
|
|
1314
|
+
* @returns
|
|
1315
|
+
*/
|
|
1316
|
+
getVesuMultiplyQuote(quote: EkuboQuote, fromTokenInfo: TokenInfo, toTokenInfo: TokenInfo): Swap[];
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
declare class FatalError extends Error {
|
|
1320
|
+
constructor(message: string, err?: Error);
|
|
1321
|
+
}
|
|
1322
|
+
/** Contains globally useful functions.
|
|
1323
|
+
* - fatalError: Things to do when a fatal error occurs
|
|
1324
|
+
*/
|
|
1325
|
+
declare class Global {
|
|
1326
|
+
static cache: Record<string, {
|
|
1327
|
+
value: any;
|
|
1328
|
+
ttl: number;
|
|
1329
|
+
timestamp: number;
|
|
1330
|
+
}>;
|
|
1331
|
+
static fatalError(message: string, err?: Error): void;
|
|
1332
|
+
static httpError(url: string, err: Error, message?: string): void;
|
|
1333
|
+
static getDefaultTokens(): TokenInfo[];
|
|
1334
|
+
static getTokens(): Promise<TokenInfo[]>;
|
|
1335
|
+
static assert(condition: any, message: string): void;
|
|
1336
|
+
static getTokenInfoFromAddr(addr: ContractAddr): Promise<TokenInfo>;
|
|
1337
|
+
static setGlobalCache(key: string, data: any, ttl?: number): void;
|
|
1338
|
+
static getGlobalCache<T>(key: string): T | null;
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1202
1341
|
declare class TelegramNotif {
|
|
1203
1342
|
private subscribers;
|
|
1204
1343
|
readonly bot: TelegramBot;
|
|
@@ -1331,4 +1470,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
1331
1470
|
decrypt(encryptedData: string, password: string): any;
|
|
1332
1471
|
}
|
|
1333
1472
|
|
|
1334
|
-
export { AUMTypes, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type ApproveCallParams, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type FAQ, FatalError, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, Initializable, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type SwapInfo, TelegramNotif, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, type VaultPosition, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyPositionCallParams, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, getAPIUsingHeadlessBrowser, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, highlightTextWithLinks, type i257, logger };
|
|
1473
|
+
export { AUMTypes, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type ApproveCallParams, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, BaseStrategy, type CLVaultStrategySettings, CommonAdapter, type CommonAdapterConfig, ContractAddr, type DecreaseLeverParams, Deployer, type DualActionAmount, type DualTokenInfo, ERC20, type EkuboBounds, EkuboCLVault, EkuboCLVaultStrategies, type EkuboPoolKey, type EkuboQuote, EkuboQuoter, type EkuboRouteNode, type EkuboSplit, type FAQ, FatalError, type FlashloanCallParams, FlowChartColors, type GenerateCallFn, Global, HyperLSTStrategies, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type Swap, type SwapInfo, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, type VaultPosition, VesuAdapter, type VesuAdapterConfig, type VesuAmount, VesuAmountDenomination, VesuAmountType, type VesuDefiSpringRewardsCallParams, type VesuModifyDelegationCallParams, type VesuModifyPositionCallParams, type VesuMultiplyCallParams, VesuPools, VesuRebalance, type VesuRebalanceSettings, VesuRebalanceStrategies, Web3Number, ZkLend, assert, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, highlightTextWithLinks, type i257, logger };
|