@strkfarm/sdk 1.1.8 → 1.1.9
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 +1195 -74
- package/dist/index.browser.mjs +1350 -227
- package/dist/index.d.ts +168 -30
- package/dist/index.js +1366 -239
- package/dist/index.mjs +1351 -228
- package/package.json +1 -1
- package/src/data/vesu-multiple.abi.json +475 -0
- package/src/dataTypes/_bignumber.ts +13 -0
- 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 +457 -0
- package/src/strategies/universal-strategy.tsx +134 -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> {
|
|
@@ -338,28 +343,6 @@ declare class AvnuWrapper {
|
|
|
338
343
|
static buildZeroSwap(tokenToSell: ContractAddr, address: string): SwapInfo;
|
|
339
344
|
}
|
|
340
345
|
|
|
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
346
|
declare class AutoCompounderSTRK {
|
|
364
347
|
readonly config: IConfig;
|
|
365
348
|
readonly addr: ContractAddr;
|
|
@@ -919,7 +902,7 @@ declare class BaseAdapter extends CacheClass {
|
|
|
919
902
|
target: ContractAddr;
|
|
920
903
|
method: string;
|
|
921
904
|
packedArguments: bigint[];
|
|
922
|
-
}): LeafData;
|
|
905
|
+
}, sanitizer?: ContractAddr): LeafData;
|
|
923
906
|
}
|
|
924
907
|
|
|
925
908
|
interface FlashloanCallParams {
|
|
@@ -1002,11 +985,60 @@ interface VesuAdapterConfig {
|
|
|
1002
985
|
vaultAllocator: ContractAddr;
|
|
1003
986
|
id: string;
|
|
1004
987
|
}
|
|
988
|
+
interface TokenAmount {
|
|
989
|
+
token: ContractAddr;
|
|
990
|
+
amount: Web3Number;
|
|
991
|
+
}
|
|
992
|
+
interface Swap {
|
|
993
|
+
route: RouteNode[];
|
|
994
|
+
token_amount: TokenAmount;
|
|
995
|
+
}
|
|
996
|
+
interface RouteNode {
|
|
997
|
+
pool_key: EkuboPoolKey;
|
|
998
|
+
sqrt_ratio_limit: Web3Number;
|
|
999
|
+
skip_ahead: Web3Number;
|
|
1000
|
+
}
|
|
1001
|
+
interface IncreaseLeverParams {
|
|
1002
|
+
pool_id: ContractAddr;
|
|
1003
|
+
collateral_asset: ContractAddr;
|
|
1004
|
+
debt_asset: ContractAddr;
|
|
1005
|
+
user: ContractAddr;
|
|
1006
|
+
add_margin: Web3Number;
|
|
1007
|
+
margin_swap: Swap[];
|
|
1008
|
+
margin_swap_limit_amount: Web3Number;
|
|
1009
|
+
lever_swap: Swap[];
|
|
1010
|
+
lever_swap_limit_amount: Web3Number;
|
|
1011
|
+
}
|
|
1012
|
+
interface DecreaseLeverParams {
|
|
1013
|
+
pool_id: ContractAddr;
|
|
1014
|
+
collateral_asset: ContractAddr;
|
|
1015
|
+
debt_asset: ContractAddr;
|
|
1016
|
+
user: ContractAddr;
|
|
1017
|
+
sub_margin: Web3Number;
|
|
1018
|
+
recipient: ContractAddr;
|
|
1019
|
+
lever_swap: Swap[];
|
|
1020
|
+
lever_swap_limit_amount: Web3Number;
|
|
1021
|
+
lever_swap_weights: Web3Number[];
|
|
1022
|
+
withdraw_swap: Swap[];
|
|
1023
|
+
withdraw_swap_limit_amount: Web3Number;
|
|
1024
|
+
withdraw_swap_weights: Web3Number[];
|
|
1025
|
+
close_position: boolean;
|
|
1026
|
+
}
|
|
1027
|
+
interface VesuMultiplyCallParams {
|
|
1028
|
+
increaseParams?: Omit<IncreaseLeverParams, 'user' | 'pool_id' | 'collateral_asset' | 'debt_asset'>;
|
|
1029
|
+
decreaseParams?: Omit<DecreaseLeverParams, 'user' | 'pool_id' | 'collateral_asset' | 'debt_asset' | 'recipient'>;
|
|
1030
|
+
isIncrease: boolean;
|
|
1031
|
+
}
|
|
1032
|
+
interface VesuModifyDelegationCallParams {
|
|
1033
|
+
delegation: boolean;
|
|
1034
|
+
}
|
|
1005
1035
|
declare const VesuPools: {
|
|
1006
1036
|
Genesis: ContractAddr;
|
|
1037
|
+
Re7xSTRK: ContractAddr;
|
|
1007
1038
|
};
|
|
1008
1039
|
declare class VesuAdapter extends BaseAdapter {
|
|
1009
1040
|
VESU_SINGLETON: ContractAddr;
|
|
1041
|
+
VESU_MULTIPLY: ContractAddr;
|
|
1010
1042
|
config: VesuAdapterConfig;
|
|
1011
1043
|
networkConfig: IConfig | undefined;
|
|
1012
1044
|
pricer: PricerBase | undefined;
|
|
@@ -1036,6 +1068,10 @@ declare class VesuAdapter extends BaseAdapter {
|
|
|
1036
1068
|
};
|
|
1037
1069
|
};
|
|
1038
1070
|
getModifyPositionCall: (params: VesuModifyPositionCallParams) => ManageCall;
|
|
1071
|
+
getMultiplyAdapter: () => AdapterLeafType<VesuMultiplyCallParams>;
|
|
1072
|
+
getMultiplyCall: (params: VesuMultiplyCallParams) => ManageCall;
|
|
1073
|
+
getVesuModifyDelegationAdapter: (id: string) => LeafAdapterFn<VesuModifyDelegationCallParams>;
|
|
1074
|
+
getVesuModifyDelegationCall: (params: VesuModifyDelegationCallParams) => ManageCall;
|
|
1039
1075
|
getDefispringRewardsAdapter: (id: string) => () => AdapterLeafType<VesuDefiSpringRewardsCallParams>;
|
|
1040
1076
|
getDefiSpringClaimCall: () => GenerateCallFn<VesuDefiSpringRewardsCallParams>;
|
|
1041
1077
|
formatAmountTypeEnum(amountType: VesuAmountType): CairoCustomEnum;
|
|
@@ -1057,6 +1093,11 @@ declare class VesuAdapter extends BaseAdapter {
|
|
|
1057
1093
|
static getVesuPools(retry?: number): Promise<VesuPoolsInfo>;
|
|
1058
1094
|
}
|
|
1059
1095
|
|
|
1096
|
+
interface UniversalManageCall {
|
|
1097
|
+
proofs: string[];
|
|
1098
|
+
manageCall: ManageCall;
|
|
1099
|
+
step: UNIVERSAL_MANAGE_IDS;
|
|
1100
|
+
}
|
|
1060
1101
|
interface UniversalStrategySettings {
|
|
1061
1102
|
vaultAddress: ContractAddr;
|
|
1062
1103
|
manager: ContractAddr;
|
|
@@ -1129,6 +1170,8 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1129
1170
|
usdValue: number;
|
|
1130
1171
|
}>;
|
|
1131
1172
|
getUnusedBalance(): Promise<SingleTokenInfo>;
|
|
1173
|
+
protected getVesuAUM(adapter: VesuAdapter): Promise<Web3Number>;
|
|
1174
|
+
getPrevAUM(): Promise<Web3Number>;
|
|
1132
1175
|
getAUM(): Promise<{
|
|
1133
1176
|
net: SingleTokenInfo;
|
|
1134
1177
|
prevAum: Web3Number;
|
|
@@ -1137,7 +1180,9 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1137
1180
|
aum: Web3Number;
|
|
1138
1181
|
}[];
|
|
1139
1182
|
}>;
|
|
1183
|
+
protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
|
|
1140
1184
|
getVesuAdapters(): VesuAdapter[];
|
|
1185
|
+
getVesuPositions(): Promise<VaultPosition[]>;
|
|
1141
1186
|
getVaultPositions(): Promise<VaultPosition[]>;
|
|
1142
1187
|
getSetManagerCall(strategist: ContractAddr, root?: string): Call;
|
|
1143
1188
|
getManageCall(proofIds: string[], manageCalls: ManageCall[]): Call;
|
|
@@ -1146,11 +1191,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1146
1191
|
isDeposit: boolean;
|
|
1147
1192
|
depositAmount: Web3Number;
|
|
1148
1193
|
debtAmount: Web3Number;
|
|
1149
|
-
}):
|
|
1150
|
-
proofs: string[];
|
|
1151
|
-
manageCall: ManageCall;
|
|
1152
|
-
step: UNIVERSAL_MANAGE_IDS;
|
|
1153
|
-
}[];
|
|
1194
|
+
}): UniversalManageCall[];
|
|
1154
1195
|
getTag(): string;
|
|
1155
1196
|
getVesuHealthFactors(): Promise<number[]>;
|
|
1156
1197
|
computeRebalanceConditionAndReturnCalls(): Promise<Call[]>;
|
|
@@ -1163,7 +1204,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1163
1204
|
* @returns
|
|
1164
1205
|
*/
|
|
1165
1206
|
private getLegRebalanceAmount;
|
|
1166
|
-
|
|
1207
|
+
getVesuModifyPositionCall(params: {
|
|
1167
1208
|
isDeposit: boolean;
|
|
1168
1209
|
leg1DepositAmount: Web3Number;
|
|
1169
1210
|
}): Promise<Call>;
|
|
@@ -1197,8 +1238,105 @@ declare enum UNIVERSAL_ADAPTERS {
|
|
|
1197
1238
|
VESU_LEG1 = "vesu_leg1_adapter",
|
|
1198
1239
|
VESU_LEG2 = "vesu_leg2_adapter"
|
|
1199
1240
|
}
|
|
1241
|
+
declare function getContractDetails(settings: UniversalStrategySettings): {
|
|
1242
|
+
address: ContractAddr;
|
|
1243
|
+
name: string;
|
|
1244
|
+
}[];
|
|
1200
1245
|
declare const UniversalStrategies: IStrategyMetadata<UniversalStrategySettings>[];
|
|
1201
1246
|
|
|
1247
|
+
declare class UniversalLstMultiplierStrategy extends UniversalStrategy<UniversalStrategySettings> {
|
|
1248
|
+
private quoteAmountToFetchPrice;
|
|
1249
|
+
constructor(config: IConfig, pricer: PricerBase, metadata: IStrategyMetadata<UniversalStrategySettings>);
|
|
1250
|
+
getVesuAdapters(): VesuAdapter[];
|
|
1251
|
+
protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
|
|
1252
|
+
getLSTDexPrice(): Promise<number>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Uses vesu's multiple call to create leverage on LST
|
|
1255
|
+
* Deposit amount is in LST
|
|
1256
|
+
* @param params
|
|
1257
|
+
*/
|
|
1258
|
+
getVesuMultiplyCall(params: {
|
|
1259
|
+
isDeposit: boolean;
|
|
1260
|
+
leg1DepositAmount: Web3Number;
|
|
1261
|
+
}): Promise<Call[]>;
|
|
1262
|
+
getLSTUnderlyingTokenInfo(): TokenInfo;
|
|
1263
|
+
getLSTExchangeRate(): Promise<number>;
|
|
1264
|
+
/**
|
|
1265
|
+
*
|
|
1266
|
+
* @param params marginAmount is in LST, debtAmount is in underlying
|
|
1267
|
+
*/
|
|
1268
|
+
getModifyLeverCall(params: {
|
|
1269
|
+
marginAmount: Web3Number;
|
|
1270
|
+
debtAmount: Web3Number;
|
|
1271
|
+
isIncrease: boolean;
|
|
1272
|
+
}): Promise<Call[]>;
|
|
1273
|
+
}
|
|
1274
|
+
declare const HyperLSTStrategies: IStrategyMetadata<UniversalStrategySettings>[];
|
|
1275
|
+
|
|
1276
|
+
interface EkuboRouteNode {
|
|
1277
|
+
pool_key: {
|
|
1278
|
+
token0: string;
|
|
1279
|
+
token1: string;
|
|
1280
|
+
fee: string;
|
|
1281
|
+
tick_spacing: number;
|
|
1282
|
+
extension: string;
|
|
1283
|
+
};
|
|
1284
|
+
sqrt_ratio_limit: string;
|
|
1285
|
+
skip_ahead: number;
|
|
1286
|
+
}
|
|
1287
|
+
interface EkuboSplit {
|
|
1288
|
+
amount_specified: string;
|
|
1289
|
+
amount_calculated: string;
|
|
1290
|
+
route: EkuboRouteNode[];
|
|
1291
|
+
}
|
|
1292
|
+
interface EkuboQuote {
|
|
1293
|
+
total_calculated: string;
|
|
1294
|
+
price_impact: number;
|
|
1295
|
+
splits: EkuboSplit[];
|
|
1296
|
+
}
|
|
1297
|
+
declare class EkuboQuoter {
|
|
1298
|
+
private readonly config;
|
|
1299
|
+
ENDPOINT: string;
|
|
1300
|
+
constructor(config: IConfig);
|
|
1301
|
+
/**
|
|
1302
|
+
*
|
|
1303
|
+
* @param fromToken
|
|
1304
|
+
* @param toToken
|
|
1305
|
+
* @param amount Can be negative too, which would mean to get exact amount out
|
|
1306
|
+
* @returns
|
|
1307
|
+
*/
|
|
1308
|
+
getQuote(fromToken: string, toToken: string, amount: Web3Number): Promise<EkuboQuote>;
|
|
1309
|
+
/**
|
|
1310
|
+
* Formats Ekubo response for Vesu multiple use
|
|
1311
|
+
* @param quote
|
|
1312
|
+
* @param fromTokenInfo
|
|
1313
|
+
* @returns
|
|
1314
|
+
*/
|
|
1315
|
+
getVesuMultiplyQuote(quote: EkuboQuote, fromTokenInfo: TokenInfo, toTokenInfo: TokenInfo): Swap[];
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
declare class FatalError extends Error {
|
|
1319
|
+
constructor(message: string, err?: Error);
|
|
1320
|
+
}
|
|
1321
|
+
/** Contains globally useful functions.
|
|
1322
|
+
* - fatalError: Things to do when a fatal error occurs
|
|
1323
|
+
*/
|
|
1324
|
+
declare class Global {
|
|
1325
|
+
static cache: Record<string, {
|
|
1326
|
+
value: any;
|
|
1327
|
+
ttl: number;
|
|
1328
|
+
timestamp: number;
|
|
1329
|
+
}>;
|
|
1330
|
+
static fatalError(message: string, err?: Error): void;
|
|
1331
|
+
static httpError(url: string, err: Error, message?: string): void;
|
|
1332
|
+
static getDefaultTokens(): TokenInfo[];
|
|
1333
|
+
static getTokens(): Promise<TokenInfo[]>;
|
|
1334
|
+
static assert(condition: any, message: string): void;
|
|
1335
|
+
static getTokenInfoFromAddr(addr: ContractAddr): Promise<TokenInfo>;
|
|
1336
|
+
static setGlobalCache(key: string, data: any, ttl?: number): void;
|
|
1337
|
+
static getGlobalCache<T>(key: string): T | null;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1202
1340
|
declare class TelegramNotif {
|
|
1203
1341
|
private subscribers;
|
|
1204
1342
|
readonly bot: TelegramBot;
|
|
@@ -1331,4 +1469,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
1331
1469
|
decrypt(encryptedData: string, password: string): any;
|
|
1332
1470
|
}
|
|
1333
1471
|
|
|
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 };
|
|
1472
|
+
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 };
|