@strkfarm/sdk 1.1.38 → 1.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.global.js +726 -185
- package/dist/index.browser.mjs +725 -182
- package/dist/index.d.ts +126 -13
- package/dist/index.js +726 -182
- package/dist/index.mjs +725 -182
- package/package.json +1 -1
- package/src/global.ts +18 -0
- package/src/modules/avnu.ts +5 -4
- package/src/modules/harvests.ts +16 -15
- package/src/strategies/ekubo-cl-vault.tsx +255 -79
- package/src/strategies/universal-adapters/baseAdapter.ts +184 -2
- package/src/strategies/universal-adapters/vesu-adapter.ts +34 -17
- package/src/strategies/universal-adapters/vesu-supply-only-adapter.ts +322 -0
- package/src/strategies/universal-lst-muliplier-strategy.tsx +231 -72
- package/src/strategies/universal-strategy.tsx +5 -5
- package/src/utils/health-factor-math.ts +83 -0
- package/src/utils/math-utils.ts +150 -0
package/dist/index.d.ts
CHANGED
|
@@ -343,7 +343,7 @@ interface SwapInfo {
|
|
|
343
343
|
declare class AvnuWrapper {
|
|
344
344
|
getQuotes(fromToken: string, toToken: string, amountWei: string, taker: string, retry?: number, excludeSources?: string[]): Promise<Quote>;
|
|
345
345
|
getSwapInfo(quote: Pick<Quote, 'quoteId' | 'buyTokenAddress' | 'buyAmount' | 'sellTokenAddress' | 'sellAmount'>, taker: string, integratorFeeBps: number, integratorFeeRecipient: string, minAmount?: string, options?: AvnuOptions): Promise<SwapInfo>;
|
|
346
|
-
static buildZeroSwap(tokenToSell: ContractAddr,
|
|
346
|
+
static buildZeroSwap(tokenToSell: ContractAddr, beneficiary: string, tokenToBuy?: ContractAddr): SwapInfo;
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
declare class AutoCompounderSTRK {
|
|
@@ -631,6 +631,20 @@ declare class VesuRebalance extends BaseStrategy<SingleTokenInfo, SingleActionAm
|
|
|
631
631
|
*/
|
|
632
632
|
declare const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[];
|
|
633
633
|
|
|
634
|
+
interface HarvestInfo {
|
|
635
|
+
rewardsContract: ContractAddr;
|
|
636
|
+
token: ContractAddr;
|
|
637
|
+
startDate: Date;
|
|
638
|
+
endDate: Date;
|
|
639
|
+
claim: {
|
|
640
|
+
id: number;
|
|
641
|
+
amount: Web3Number;
|
|
642
|
+
claimee: ContractAddr;
|
|
643
|
+
};
|
|
644
|
+
actualReward: Web3Number;
|
|
645
|
+
proof: string[];
|
|
646
|
+
}
|
|
647
|
+
|
|
634
648
|
interface EkuboPoolKey {
|
|
635
649
|
token0: ContractAddr;
|
|
636
650
|
token1: ContractAddr;
|
|
@@ -820,6 +834,47 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
820
834
|
amount1: Web3Number;
|
|
821
835
|
}>;
|
|
822
836
|
harvest(acc: Account, maxIterations?: number, priceRatioPrecision?: number): Promise<Call[]>;
|
|
837
|
+
/**
|
|
838
|
+
* @description This funciton requires atleast one of the pool tokens to be reward token
|
|
839
|
+
* i.e. STRK.
|
|
840
|
+
* @param params
|
|
841
|
+
*/
|
|
842
|
+
_handleRewardAndVaultTokenMatchHarvest(params: {
|
|
843
|
+
claim: HarvestInfo;
|
|
844
|
+
isToken1: boolean;
|
|
845
|
+
token0Info: TokenInfo;
|
|
846
|
+
token1Info: TokenInfo;
|
|
847
|
+
postFeeAmount: Web3Number;
|
|
848
|
+
poolKey: EkuboPoolKey;
|
|
849
|
+
bounds: EkuboBounds;
|
|
850
|
+
maxIterations: number;
|
|
851
|
+
priceRatioPrecision: number;
|
|
852
|
+
acc: Account;
|
|
853
|
+
}): Promise<Call[]>;
|
|
854
|
+
/**
|
|
855
|
+
* @description This function handles harvesting of reward token that is not the same as any of the vault token
|
|
856
|
+
* i.e. STRK is not part of vault tokens like BTC/ETH
|
|
857
|
+
* @param params
|
|
858
|
+
* @returns
|
|
859
|
+
*/
|
|
860
|
+
_handleRewardAndVaultTokenMismatchHarvest(params: {
|
|
861
|
+
claim: HarvestInfo;
|
|
862
|
+
token0Info: TokenInfo;
|
|
863
|
+
token1Info: TokenInfo;
|
|
864
|
+
postFeeAmount: Web3Number;
|
|
865
|
+
poolKey: EkuboPoolKey;
|
|
866
|
+
bounds: EkuboBounds;
|
|
867
|
+
maxIterations: number;
|
|
868
|
+
priceRatioPrecision: number;
|
|
869
|
+
acc: Account;
|
|
870
|
+
}): Promise<never[]>;
|
|
871
|
+
harvestMismatchEstimateCallFn(params: {
|
|
872
|
+
postFeeAmount: Web3Number;
|
|
873
|
+
claim: HarvestInfo;
|
|
874
|
+
token0Info: TokenInfo;
|
|
875
|
+
token1Info: TokenInfo;
|
|
876
|
+
acc: Account;
|
|
877
|
+
}): Promise<null>;
|
|
823
878
|
getInvestmentFlows(): Promise<IInvestmentFlow[]>;
|
|
824
879
|
}
|
|
825
880
|
/**
|
|
@@ -912,7 +967,35 @@ type AdapterLeafType<T> = {
|
|
|
912
967
|
callConstructor: GenerateCallFn<T>;
|
|
913
968
|
};
|
|
914
969
|
type LeafAdapterFn<T> = () => AdapterLeafType<T>;
|
|
915
|
-
declare
|
|
970
|
+
declare enum APYType {
|
|
971
|
+
BASE = "base",
|
|
972
|
+
REWARD = "reward",
|
|
973
|
+
LST = "lst"
|
|
974
|
+
}
|
|
975
|
+
interface SupportedPosition {
|
|
976
|
+
asset: TokenInfo;
|
|
977
|
+
isDebt: boolean;
|
|
978
|
+
}
|
|
979
|
+
interface BaseAdapterConfig {
|
|
980
|
+
baseToken: TokenInfo;
|
|
981
|
+
supportedPositions: SupportedPosition[];
|
|
982
|
+
networkConfig: IConfig;
|
|
983
|
+
pricer: PricerBase;
|
|
984
|
+
vaultAllocator: ContractAddr;
|
|
985
|
+
vaultAddress: ContractAddr;
|
|
986
|
+
}
|
|
987
|
+
type PositionAPY = {
|
|
988
|
+
apy: number;
|
|
989
|
+
type: APYType;
|
|
990
|
+
};
|
|
991
|
+
type PositionInfo = {
|
|
992
|
+
amount: Web3Number;
|
|
993
|
+
usdValue: number;
|
|
994
|
+
remarks?: string;
|
|
995
|
+
apy: PositionAPY;
|
|
996
|
+
};
|
|
997
|
+
declare abstract class BaseAdapter extends CacheClass {
|
|
998
|
+
constructor();
|
|
916
999
|
protected constructSimpleLeafData(params: {
|
|
917
1000
|
id: string;
|
|
918
1001
|
target: ContractAddr;
|
|
@@ -1115,10 +1198,11 @@ declare class VesuAdapter extends BaseAdapter {
|
|
|
1115
1198
|
isV2: boolean;
|
|
1116
1199
|
};
|
|
1117
1200
|
getDebtCap(config: IConfig): Promise<Web3Number>;
|
|
1201
|
+
getCurrentDebtUtilisationAmount(config: IConfig): Promise<Web3Number>;
|
|
1118
1202
|
getMaxBorrowableByInterestRate(config: IConfig, asset: TokenInfo, maxBorrowAPY: number): Promise<Web3Number>;
|
|
1119
|
-
getLTVConfig(config: IConfig): Promise<number>;
|
|
1120
|
-
getPositions(config: IConfig): Promise<VaultPosition[]>;
|
|
1121
|
-
getCollateralization(config: IConfig): Promise<Omit<VaultPosition, 'amount'>[]>;
|
|
1203
|
+
getLTVConfig(config: IConfig, blockNumber?: BlockIdentifier): Promise<number>;
|
|
1204
|
+
getPositions(config: IConfig, blockNumber?: BlockIdentifier): Promise<VaultPosition[]>;
|
|
1205
|
+
getCollateralization(config: IConfig, blockNumber?: BlockIdentifier): Promise<Omit<VaultPosition, 'amount'>[]>;
|
|
1122
1206
|
getAssetPrices(): Promise<{
|
|
1123
1207
|
collateralTokenAmount: Web3Number;
|
|
1124
1208
|
collateralUSDAmount: number;
|
|
@@ -1128,7 +1212,7 @@ declare class VesuAdapter extends BaseAdapter {
|
|
|
1128
1212
|
debtPrice: number;
|
|
1129
1213
|
ltv: number;
|
|
1130
1214
|
}>;
|
|
1131
|
-
getHealthFactor(): Promise<number>;
|
|
1215
|
+
getHealthFactor(blockNumber?: BlockIdentifier): Promise<number>;
|
|
1132
1216
|
static getVesuPools(retry?: number): Promise<VesuPoolsInfo>;
|
|
1133
1217
|
fullUtilizationRate(interestRateConfig: InterestRateConfig, timeDelta: bigint, utilization: bigint, fullUtilizationRate: bigint): bigint;
|
|
1134
1218
|
/**
|
|
@@ -1260,7 +1344,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1260
1344
|
}>;
|
|
1261
1345
|
protected getRewardsAUM(prevAum: Web3Number): Promise<Web3Number>;
|
|
1262
1346
|
getVesuAdapters(): VesuAdapter[];
|
|
1263
|
-
getVesuPositions(): Promise<VaultPosition[]>;
|
|
1347
|
+
getVesuPositions(blockNumber?: BlockIdentifier): Promise<VaultPosition[]>;
|
|
1264
1348
|
getVaultPositions(): Promise<VaultPosition[]>;
|
|
1265
1349
|
getSetManagerCall(strategist: ContractAddr, root?: string): Call;
|
|
1266
1350
|
getManageCall(proofIds: string[], manageCalls: ManageCall[]): Call;
|
|
@@ -1276,7 +1360,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1276
1360
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
1277
1361
|
*/
|
|
1278
1362
|
getLSTAPR(address: ContractAddr): Promise<number>;
|
|
1279
|
-
getVesuHealthFactors(): Promise<number[]>;
|
|
1363
|
+
getVesuHealthFactors(blockNumber?: BlockIdentifier): Promise<number[]>;
|
|
1280
1364
|
computeRebalanceConditionAndReturnCalls(): Promise<Call[]>;
|
|
1281
1365
|
private getNewHealthFactor;
|
|
1282
1366
|
/**
|
|
@@ -1329,6 +1413,7 @@ declare const UniversalStrategies: IStrategyMetadata<UniversalStrategySettings>[
|
|
|
1329
1413
|
|
|
1330
1414
|
interface HyperLSTStrategySettings extends UniversalStrategySettings {
|
|
1331
1415
|
borrowable_assets: TokenInfo[];
|
|
1416
|
+
underlyingToken: TokenInfo;
|
|
1332
1417
|
}
|
|
1333
1418
|
declare class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTStrategySettings> {
|
|
1334
1419
|
private quoteAmountToFetchPrice;
|
|
@@ -1342,9 +1427,24 @@ declare class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTS
|
|
|
1342
1427
|
getAvnuSwapMultiplyCall(params: {
|
|
1343
1428
|
isDeposit: boolean;
|
|
1344
1429
|
leg1DepositAmount: Web3Number;
|
|
1345
|
-
}): Promise<
|
|
1346
|
-
|
|
1430
|
+
}): Promise<{
|
|
1431
|
+
call: Call | undefined;
|
|
1432
|
+
vesuAdapter: VesuAdapter;
|
|
1433
|
+
}>;
|
|
1434
|
+
_getAvnuDepositSwapLegCall(params: {
|
|
1435
|
+
isDeposit: boolean;
|
|
1436
|
+
leg1DepositAmount: Web3Number;
|
|
1437
|
+
minHF: number;
|
|
1438
|
+
vesuAdapter: VesuAdapter;
|
|
1439
|
+
}): Promise<Call | undefined>;
|
|
1347
1440
|
getLSTMultiplierRebalanceCall(): Promise<{
|
|
1441
|
+
shouldRebalance: boolean;
|
|
1442
|
+
manageCalls: {
|
|
1443
|
+
vesuAdapter: VesuAdapter;
|
|
1444
|
+
manageCall: Call;
|
|
1445
|
+
}[];
|
|
1446
|
+
}>;
|
|
1447
|
+
_getLSTMultiplierRebalanceCall(vesuAdapter: VesuAdapter): Promise<{
|
|
1348
1448
|
shouldRebalance: boolean;
|
|
1349
1449
|
manageCall: Call | undefined;
|
|
1350
1450
|
}>;
|
|
@@ -1361,13 +1461,24 @@ declare class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTS
|
|
|
1361
1461
|
leg1DepositAmount: Web3Number;
|
|
1362
1462
|
}): Promise<Call[]>;
|
|
1363
1463
|
getLSTUnderlyingTokenInfo(): TokenInfo;
|
|
1364
|
-
getMaxBorrowableAmount(
|
|
1464
|
+
getMaxBorrowableAmount(params?: {
|
|
1465
|
+
isAPYComputation: boolean;
|
|
1466
|
+
}): Promise<{
|
|
1365
1467
|
netMaxBorrowableAmount: Web3Number;
|
|
1366
1468
|
maxBorrowables: {
|
|
1367
1469
|
amount: Web3Number;
|
|
1470
|
+
dexSwappableAmount: Web3Number;
|
|
1471
|
+
maxBorrowableAmount: Web3Number;
|
|
1368
1472
|
borrowableAsset: TokenInfo;
|
|
1369
1473
|
}[];
|
|
1370
1474
|
}>;
|
|
1475
|
+
getMaxSwappableWithMaxSlippage(fromToken: TokenInfo, toToken: TokenInfo, maxSlippage: number, maxAmount: Web3Number): Promise<Web3Number>;
|
|
1476
|
+
getMaxBorrowableAmountByVesuAdapter(vesuAdapter: VesuAdapter, isAPYComputation: boolean): Promise<{
|
|
1477
|
+
amount: Web3Number;
|
|
1478
|
+
dexSwappableAmount: Web3Number;
|
|
1479
|
+
maxBorrowableAmount: Web3Number;
|
|
1480
|
+
borrowableAsset: TokenInfo;
|
|
1481
|
+
}>;
|
|
1371
1482
|
/**
|
|
1372
1483
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
1373
1484
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
@@ -1380,7 +1491,9 @@ declare class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTS
|
|
|
1380
1491
|
id: string;
|
|
1381
1492
|
}[];
|
|
1382
1493
|
}>;
|
|
1383
|
-
maxNewDeposits(
|
|
1494
|
+
maxNewDeposits(params?: {
|
|
1495
|
+
isAPYComputation: boolean;
|
|
1496
|
+
}): Promise<number>;
|
|
1384
1497
|
protected getUnusedBalanceAPY(): Promise<{
|
|
1385
1498
|
apy: number;
|
|
1386
1499
|
weight: number;
|
|
@@ -1670,4 +1783,4 @@ declare class PasswordJsonCryptoUtil {
|
|
|
1670
1783
|
decrypt(encryptedData: string, password: string): any;
|
|
1671
1784
|
}
|
|
1672
1785
|
|
|
1673
|
-
export { AUMTypes, AVNU_EXCHANGE, AVNU_MIDDLEWARE, 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 HyperLSTStrategySettings, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, LSTAPRService, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PRICE_ROUTER, PasswordJsonCryptoUtil, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerLST, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type Swap, type SwapInfo, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, 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, extensionMap, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, logger, toBigInt };
|
|
1786
|
+
export { APYType, AUMTypes, AVNU_EXCHANGE, AVNU_MIDDLEWARE, type AccountInfo, type AdapterLeafType, type AllAccountsStore, type ApproveCallParams, AutoCompounderSTRK, type AvnuSwapCallParams, AvnuWrapper, BaseAdapter, type BaseAdapterConfig, 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 HyperLSTStrategySettings, type IConfig, type IInvestmentFlow, ILending, type ILendingMetadata, type ILendingPosition, type IProtocol, type IStrategyMetadata, type IncreaseLeverParams, Initializable, LSTAPRService, type LSTStats, type LeafAdapterFn, type LeafData, type LendingToken, type ManageCall, MarginType, Network, PRICE_ROUTER, PasswordJsonCryptoUtil, type PositionAPY, type PositionInfo, Pragma, type PriceInfo, Pricer, PricerFromApi, PricerLST, PricerRedis, Protocols, type RequiredFields, type RequiredKeys, type RequiredStoreConfig, type RiskFactor, RiskType, type Route, type RouteNode, SIMPLE_SANITIZER, SIMPLE_SANITIZER_V2, SIMPLE_SANITIZER_VESU_V1_DELEGATIONS, SenseiStrategies, SenseiVault, type SenseiVaultSettings, type SingleActionAmount, type SingleTokenInfo, StandardMerkleTree, type StandardMerkleTreeData, Store, type StoreConfig, type SupportedPosition, type Swap, type SwapInfo, TelegramGroupNotif, TelegramNotif, type TokenAmount, type TokenInfo, UNIVERSAL_ADAPTERS, UNIVERSAL_MANAGE_IDS, UniversalLstMultiplierStrategy, type UniversalManageCall, UniversalStrategies, UniversalStrategy, type UniversalStrategySettings, VESU_SINGLETON, VESU_V2_MODIFY_POSITION_SANITIZER, 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, extensionMap, getAPIUsingHeadlessBrowser, getContractDetails, getDefaultStoreConfig, getMainnetConfig, getNoRiskTags, getRiskColor, getRiskExplaination, getTrovesEndpoint, getVesuSingletonAddress, highlightTextWithLinks, type i257, logger, toBigInt };
|