@strkfarm/sdk 2.0.0-dev.34 → 2.0.0-dev.36
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 +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/index.browser.global.js +16173 -24081
- package/dist/index.browser.mjs +8572 -16661
- package/dist/index.d.ts +600 -2666
- package/dist/index.js +8660 -16784
- package/dist/index.mjs +8585 -16674
- package/package.json +3 -3
- package/src/data/redeem-request-nft.abi.json +752 -0
- package/src/data/universal-vault.abi.json +8 -7
- package/src/dataTypes/bignumber.browser.ts +5 -1
- package/src/dataTypes/bignumber.node.ts +5 -0
- package/src/global.ts +21 -1
- package/src/interfaces/common.tsx +39 -4
- package/src/modules/avnu.ts +19 -10
- package/src/modules/index.ts +1 -1
- package/src/strategies/base-strategy.ts +92 -8
- package/src/strategies/constants.ts +8 -3
- package/src/strategies/ekubo-cl-vault.tsx +150 -16
- package/src/strategies/factory.ts +21 -1
- package/src/strategies/index.ts +2 -6
- package/src/strategies/registry.ts +28 -5
- package/src/strategies/sensei.ts +29 -13
- package/src/strategies/svk-strategy.ts +29 -4
- package/src/strategies/token-boosted-xstrk-carry-strategy.tsx +1057 -0
- package/src/strategies/universal-adapters/adapter-utils.ts +2 -0
- package/src/strategies/universal-adapters/avnu-adapter.ts +19 -10
- package/src/strategies/universal-adapters/index.ts +1 -2
- package/src/strategies/universal-adapters/svk-troves-adapter.ts +160 -13
- package/src/strategies/universal-adapters/vesu-modify-position-adapter.ts +91 -42
- package/src/strategies/universal-adapters/vesu-multiply-adapter.ts +75 -52
- package/src/strategies/universal-adapters/vesu-position-common.ts +38 -31
- package/src/strategies/universal-lst-muliplier-strategy.tsx +222 -269
- package/src/strategies/universal-strategy.tsx +166 -105
- package/src/strategies/vesu-rebalance.tsx +3 -6
- package/src/strategies/yoloVault.ts +1084 -0
- package/src/utils/health-factor-math.ts +29 -0
- package/src/modules/ExtendedWrapperSDk/index.ts +0 -62
- package/src/modules/ExtendedWrapperSDk/types.ts +0 -334
- package/src/modules/ExtendedWrapperSDk/wrapper.ts +0 -611
- package/src/strategies/universal-adapters/extended-adapter.ts +0 -835
- package/src/strategies/universal-adapters/usdc<>usdce-adapter.ts +0 -200
- package/src/strategies/vesu-extended-strategy/services/executionService.ts +0 -2233
- package/src/strategies/vesu-extended-strategy/services/extended-vesu-state-manager.ts +0 -4254
- package/src/strategies/vesu-extended-strategy/services/ltv-imbalance-rebalance-math.ts +0 -783
- package/src/strategies/vesu-extended-strategy/services/operationService.ts +0 -56
- package/src/strategies/vesu-extended-strategy/types/transaction-metadata.ts +0 -88
- package/src/strategies/vesu-extended-strategy/utils/config.runtime.ts +0 -78
- package/src/strategies/vesu-extended-strategy/utils/constants.ts +0 -48
- package/src/strategies/vesu-extended-strategy/utils/helper.ts +0 -528
- package/src/strategies/vesu-extended-strategy/vesu-extended-strategy.tsx +0 -1014
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
InstantWithdrawalVault,
|
|
21
21
|
VaultType,
|
|
22
22
|
StrategyLiveStatus,
|
|
23
|
+
UnwrapLabsCurator,
|
|
23
24
|
} from "@/interfaces";
|
|
24
25
|
import { PricerBase } from "@/modules/pricerBase";
|
|
25
26
|
import { assert } from "@/utils";
|
|
@@ -37,19 +38,25 @@ import EkuboMathAbi from "@/data/ekubo-math.abi.json";
|
|
|
37
38
|
import ERC4626Abi from "@/data/erc4626.abi.json";
|
|
38
39
|
import { Global } from "@/global";
|
|
39
40
|
import { AvnuWrapper, ERC20, SwapInfo } from "@/modules";
|
|
40
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
APYInfo,
|
|
43
|
+
BaseStrategy,
|
|
44
|
+
SingleTokenInfo,
|
|
45
|
+
UserPositionCard,
|
|
46
|
+
UserPositionCardsInput,
|
|
47
|
+
} from "./base-strategy";
|
|
41
48
|
import { DualActionAmount } from "./base-strategy";
|
|
42
49
|
import { DualTokenInfo } from "./base-strategy";
|
|
43
50
|
import { log } from "winston";
|
|
44
51
|
import { EkuboHarvests, HarvestInfo } from "@/modules/harvests";
|
|
45
52
|
import { logger } from "@/utils/logger";
|
|
46
|
-
import { COMMON_CONTRACTS } from "./constants";
|
|
47
53
|
import { DepegRiskLevel, ImpermanentLossLevel, MarketRiskLevel, SmartContractRiskLevel } from "@/interfaces/risks";
|
|
48
54
|
import { from, gql } from "@apollo/client";
|
|
49
55
|
import apolloClient from "@/modules/apollo-client";
|
|
50
56
|
import { binarySearch } from "@/utils/math-utils";
|
|
51
57
|
import { PositionInfo } from "./universal-adapters/baseAdapter";
|
|
52
58
|
import { Quote } from "@avnu/avnu-sdk";
|
|
59
|
+
import { MY_ACCESS_CONTROL } from "./constants";
|
|
53
60
|
|
|
54
61
|
export interface EkuboPoolKey {
|
|
55
62
|
token0: ContractAddr;
|
|
@@ -126,7 +133,10 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
126
133
|
pricer: PricerBase,
|
|
127
134
|
metadata: IStrategyMetadata<CLVaultStrategySettings>
|
|
128
135
|
) {
|
|
129
|
-
super(config
|
|
136
|
+
super(config, {
|
|
137
|
+
depositInputMode: "dual",
|
|
138
|
+
withdrawInputMode: "dual"
|
|
139
|
+
});
|
|
130
140
|
this.pricer = pricer;
|
|
131
141
|
|
|
132
142
|
assert(
|
|
@@ -639,6 +649,55 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
639
649
|
*/
|
|
640
650
|
}
|
|
641
651
|
|
|
652
|
+
async getMaxTVL(): Promise<Web3Number> {
|
|
653
|
+
// This strategy doesn't have a maxTVL so returning 0 simply
|
|
654
|
+
return new Web3Number('0', 18);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
async getUserPositionCards(input: UserPositionCardsInput): Promise<UserPositionCard[]> {
|
|
658
|
+
const quoteToken = this.metadata.additionalInfo.quoteAsset;
|
|
659
|
+
const [userTVL, quotePrice] = await Promise.all([
|
|
660
|
+
this.getUserTVL(input.user),
|
|
661
|
+
this.pricer.getPrice(quoteToken.symbol),
|
|
662
|
+
]);
|
|
663
|
+
|
|
664
|
+
const token0IsQuote = userTVL.token0.tokenInfo.address.eq(quoteToken.address);
|
|
665
|
+
const token1IsQuote = userTVL.token1.tokenInfo.address.eq(quoteToken.address);
|
|
666
|
+
const token0QuoteAmount = token0IsQuote
|
|
667
|
+
? userTVL.token0.amount.toNumber()
|
|
668
|
+
: userTVL.token0.usdValue / (quotePrice.price || 1);
|
|
669
|
+
const token1QuoteAmount = token1IsQuote
|
|
670
|
+
? userTVL.token1.amount.toNumber()
|
|
671
|
+
: userTVL.token1.usdValue / (quotePrice.price || 1);
|
|
672
|
+
const totalQuoteAmount = token0QuoteAmount + token1QuoteAmount;
|
|
673
|
+
const quoteAmountDisplay = Number.isFinite(totalQuoteAmount)
|
|
674
|
+
? totalQuoteAmount.toLocaleString("en-US", {
|
|
675
|
+
maximumFractionDigits: quoteToken.displayDecimals ?? 2,
|
|
676
|
+
minimumFractionDigits: 0,
|
|
677
|
+
})
|
|
678
|
+
: "0";
|
|
679
|
+
const allocationValue = `${this.formatTokenAmountForCard(userTVL.token0.amount, userTVL.token0.tokenInfo)} / ${this.formatTokenAmountForCard(userTVL.token1.amount, userTVL.token1.tokenInfo)}`;
|
|
680
|
+
const allocationSubValue = `${this.formatUSDForCard(userTVL.token0.usdValue)} / ${this.formatUSDForCard(userTVL.token1.usdValue)}`;
|
|
681
|
+
|
|
682
|
+
const cards: UserPositionCard[] = [
|
|
683
|
+
{
|
|
684
|
+
title: "Your Holdings",
|
|
685
|
+
tooltip: `${quoteToken.symbol} equivalent value of your Ekubo position`,
|
|
686
|
+
value: `${quoteAmountDisplay} ${quoteToken.symbol}`,
|
|
687
|
+
subValue: `≈ ${this.formatUSDForCard(userTVL.usdValue)}`,
|
|
688
|
+
subValueColor: "positive",
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
title: "Holding Allocation",
|
|
692
|
+
tooltip: "Split of your position between token0 and token1",
|
|
693
|
+
value: allocationValue,
|
|
694
|
+
subValue: `≈ ${allocationSubValue}`,
|
|
695
|
+
subValueColor: "default",
|
|
696
|
+
},
|
|
697
|
+
];
|
|
698
|
+
return cards;
|
|
699
|
+
}
|
|
700
|
+
|
|
642
701
|
async feeBasedAPY(
|
|
643
702
|
timeperiod: '24h' | '7d' | '30d' | '3m' = '24h'
|
|
644
703
|
): Promise<number> {
|
|
@@ -816,8 +875,26 @@ export class EkuboCLVault extends BaseStrategy<
|
|
|
816
875
|
const P1 = await this.pricer.getPrice(token1Info.symbol);
|
|
817
876
|
const token0Usd = Number(amount0.toFixed(13)) * P0.price;
|
|
818
877
|
const token1Usd = Number(amount1.toFixed(13)) * P1.price;
|
|
878
|
+
const totalUsdValue = token0Usd + token1Usd;
|
|
879
|
+
|
|
880
|
+
if (
|
|
881
|
+
(totalUsdValue === 0 || token0Usd === 0 || token1Usd === 0 || amount0.eq(0) || amount1.eq(0)) &&
|
|
882
|
+
this.metadata.settings?.liveStatus === StrategyLiveStatus.ACTIVE
|
|
883
|
+
) {
|
|
884
|
+
logger.warn(
|
|
885
|
+
`${this.metadata.name}:getTVL - Zero value detected: ` +
|
|
886
|
+
`usdValue=${totalUsdValue}, ` +
|
|
887
|
+
`amount0=${amount0.toString()}, ` +
|
|
888
|
+
`amount1=${amount1.toString()}, ` +
|
|
889
|
+
`token0Price=${P0.price}, ` +
|
|
890
|
+
`token1Price=${P1.price}, ` +
|
|
891
|
+
`token0Usd=${token0Usd}, ` +
|
|
892
|
+
`token1Usd=${token1Usd}`
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
|
|
819
896
|
return {
|
|
820
|
-
usdValue:
|
|
897
|
+
usdValue: totalUsdValue,
|
|
821
898
|
token0: {
|
|
822
899
|
tokenInfo: token0Info,
|
|
823
900
|
amount: amount0,
|
|
@@ -2364,10 +2441,7 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
|
2364
2441
|
],
|
|
2365
2442
|
protocols: [_protocol],
|
|
2366
2443
|
auditUrl: AUDIT_URL,
|
|
2367
|
-
curator:
|
|
2368
|
-
name: "Unwrap Labs",
|
|
2369
|
-
logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
|
|
2370
|
-
},
|
|
2444
|
+
curator: UnwrapLabsCurator,
|
|
2371
2445
|
risk: {
|
|
2372
2446
|
riskFactor: _lstPoolRiskFactors,
|
|
2373
2447
|
netRisk:
|
|
@@ -2377,7 +2451,7 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
|
2377
2451
|
},
|
|
2378
2452
|
apyMethodology:
|
|
2379
2453
|
"APY based on 30-day historical performance, including fees and rewards.",
|
|
2380
|
-
|
|
2454
|
+
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
2381
2455
|
additionalInfo: {
|
|
2382
2456
|
newBounds: {
|
|
2383
2457
|
lower: -1,
|
|
@@ -2395,7 +2469,6 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
|
2395
2469
|
quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
|
|
2396
2470
|
},
|
|
2397
2471
|
settings: {
|
|
2398
|
-
maxTVL: Web3Number.fromWei("0", 18),
|
|
2399
2472
|
isAudited: true,
|
|
2400
2473
|
isPaused: false,
|
|
2401
2474
|
liveStatus: StrategyLiveStatus.ACTIVE,
|
|
@@ -2453,9 +2526,8 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
|
2453
2526
|
contractLink: "https://github.com/trovesfi/troves-contracts",
|
|
2454
2527
|
},
|
|
2455
2528
|
accessControl: {
|
|
2456
|
-
type: AccessControlType.
|
|
2457
|
-
addresses: [
|
|
2458
|
-
timeLock: "2 Days",
|
|
2529
|
+
type: AccessControlType.ROLE_BASED_ACCESS,
|
|
2530
|
+
addresses: [MY_ACCESS_CONTROL.address],
|
|
2459
2531
|
},
|
|
2460
2532
|
},
|
|
2461
2533
|
redemptionInfo: {
|
|
@@ -2561,7 +2633,7 @@ const createLSTStrategy = (params: {
|
|
|
2561
2633
|
)!,
|
|
2562
2634
|
Global.getDefaultTokens().find((t) => t.symbol === params.depositToken1Symbol)!
|
|
2563
2635
|
],
|
|
2564
|
-
|
|
2636
|
+
realizedApyMethodology: "The realizedAPY is based on past 14 days performance by the vault",
|
|
2565
2637
|
additionalInfo: {
|
|
2566
2638
|
...xSTRKSTRK.additionalInfo,
|
|
2567
2639
|
quoteAsset: Global.getDefaultTokens().find(
|
|
@@ -2582,6 +2654,16 @@ const createLSTStrategy = (params: {
|
|
|
2582
2654
|
|
|
2583
2655
|
const lstStrategies: IStrategyMetadata<CLVaultStrategySettings>[] = [
|
|
2584
2656
|
xSTRKSTRK,
|
|
2657
|
+
createLSTStrategy({
|
|
2658
|
+
id: "ekubo_cl_xstrkbtcstrkbtc",
|
|
2659
|
+
name: "Ekubo xstrkBTC/strkBTC",
|
|
2660
|
+
address: "0x03d1d1932ef6882d4acf763dd0430f4abed3e2a9da28e028f1e2e8dd934b8bf7",
|
|
2661
|
+
launchBlock: 9651140,
|
|
2662
|
+
depositToken0Symbol: "xstrkBTC",
|
|
2663
|
+
depositToken1Symbol: "strkBTC",
|
|
2664
|
+
quoteTokenSymbol: "strkBTC",
|
|
2665
|
+
lstSymbol: "xstrkBTC",
|
|
2666
|
+
}),
|
|
2585
2667
|
createLSTStrategy({
|
|
2586
2668
|
id: "ekubo_cl_xwbtcwbtc",
|
|
2587
2669
|
name: "Ekubo xWBTC/WBTC",
|
|
@@ -2669,7 +2751,7 @@ const createRe7Settings = (quoteTokenSymbol: string, isBTC: boolean, isDeprecate
|
|
|
2669
2751
|
(t) => t.symbol === quoteTokenSymbol
|
|
2670
2752
|
)!,
|
|
2671
2753
|
alerts: getRe7Alerts(),
|
|
2672
|
-
tags: isBTC ? [StrategyTag.BTC, StrategyTag.AUTOMATED_LP] : [StrategyTag.AUTOMATED_LP] as StrategyTag[]
|
|
2754
|
+
tags: isBTC ? [StrategyTag.BTC, StrategyTag.AUTOMATED_LP] : [StrategyTag.AUTOMATED_LP] as StrategyTag[]
|
|
2673
2755
|
});
|
|
2674
2756
|
|
|
2675
2757
|
// Helper to create Re7 FAQs
|
|
@@ -2769,6 +2851,13 @@ const createRe7Strategy = (
|
|
|
2769
2851
|
discontinuationInfo: isDeprecated ? {
|
|
2770
2852
|
info: "This strategy has been deprecated and is no longer accepting new deposits."
|
|
2771
2853
|
} : undefined,
|
|
2854
|
+
security: {
|
|
2855
|
+
...xSTRKSTRK.security,
|
|
2856
|
+
accessControl: {
|
|
2857
|
+
...xSTRKSTRK.security.accessControl,
|
|
2858
|
+
addresses: [ContractAddr.from("0x707bf89863473548fb2844c9f3f96d83fe2394453259035a5791e4b1490642")],
|
|
2859
|
+
},
|
|
2860
|
+
},
|
|
2772
2861
|
};
|
|
2773
2862
|
};
|
|
2774
2863
|
|
|
@@ -2916,7 +3005,52 @@ const RE7Strategies: IStrategyMetadata<CLVaultStrategySettings>[] = [
|
|
|
2916
3005
|
"USDC",
|
|
2917
3006
|
mediumRisk,
|
|
2918
3007
|
true // isBTC
|
|
2919
|
-
)
|
|
3008
|
+
),
|
|
3009
|
+
createRe7Strategy(
|
|
3010
|
+
"ekubo_cl_strkbtcusdc",
|
|
3011
|
+
"Ekubo strkBTC/USDC",
|
|
3012
|
+
"0x02dfe5af1665a7adf549008161c818eb18dcf89fc9518ab812294f2b691b2845",
|
|
3013
|
+
9650986,
|
|
3014
|
+
"USDC",
|
|
3015
|
+
"strkBTC",
|
|
3016
|
+
"USDC",
|
|
3017
|
+
mediumRisk,
|
|
3018
|
+
true // isBTC
|
|
3019
|
+
),
|
|
3020
|
+
createRe7Strategy(
|
|
3021
|
+
"ekubo_cl_strkbtcstrk",
|
|
3022
|
+
"Ekubo strkBTC/STRK",
|
|
3023
|
+
"0x04784e62a4847484528ba65f500b37a9347e88632e90d866e213f2c2651be828",
|
|
3024
|
+
9650592,
|
|
3025
|
+
"STRK",
|
|
3026
|
+
"strkBTC",
|
|
3027
|
+
"USDC",
|
|
3028
|
+
mediumRisk,
|
|
3029
|
+
true // isBTC
|
|
3030
|
+
),
|
|
3031
|
+
createRe7Strategy(
|
|
3032
|
+
"ekubo_cl_strkbtceth",
|
|
3033
|
+
"Ekubo strkBTC/ETH",
|
|
3034
|
+
"0x07118ecd7dece83462b0ac8302c682fb17c7e18b0be13d81867c5bf3f80933ef",
|
|
3035
|
+
9650986,
|
|
3036
|
+
"ETH",
|
|
3037
|
+
"strkBTC",
|
|
3038
|
+
"USDC",
|
|
3039
|
+
mediumRisk,
|
|
3040
|
+
true // isBTC
|
|
3041
|
+
),
|
|
3042
|
+
// wbtc/strkBTC
|
|
3043
|
+
createRe7Strategy(
|
|
3044
|
+
"ekubo_cl_wbtcstrkbtc",
|
|
3045
|
+
"Ekubo WBTC/strkBTC",
|
|
3046
|
+
"0x07e927222730899442b2438bfd6218ff8ac44bd7a3420646fca359b8392e42c1",
|
|
3047
|
+
9650986,
|
|
3048
|
+
"WBTC",
|
|
3049
|
+
"strkBTC",
|
|
3050
|
+
"strkBTC",
|
|
3051
|
+
stableCoinRisk,
|
|
3052
|
+
true // isBTC
|
|
3053
|
+
),
|
|
2920
3054
|
];
|
|
2921
3055
|
|
|
2922
3056
|
/**
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
UniversalLstMultiplierStrategy,
|
|
10
10
|
HyperLSTStrategySettings
|
|
11
11
|
} from "./universal-lst-muliplier-strategy";
|
|
12
|
+
import { YoLoVault, YoloVaultSettings } from "./yoloVault";
|
|
12
13
|
import { VesuRebalance, VesuRebalanceSettings } from "./vesu-rebalance";
|
|
13
14
|
import { SenseiVault, SenseiVaultSettings } from "./sensei";
|
|
14
15
|
|
|
@@ -17,7 +18,8 @@ export enum FactoryStrategyType {
|
|
|
17
18
|
EKUBO_CL = "EKUBO_CL",
|
|
18
19
|
HYPER_LST = "HYPER_LST",
|
|
19
20
|
VESU_REBALANCE = "VESU_REBALANCE",
|
|
20
|
-
SENSEI = "SENSEI"
|
|
21
|
+
SENSEI = "SENSEI",
|
|
22
|
+
YOLO_VAULT = "YOLO_VAULT"
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export function createUniversalStrategy(
|
|
@@ -36,6 +38,14 @@ export function createEkuboCLStrategy(
|
|
|
36
38
|
return new EkuboCLVault(config, pricer, metadata);
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
export function createYoloVaultStrategy(
|
|
42
|
+
config: IConfig,
|
|
43
|
+
pricer: PricerBase,
|
|
44
|
+
metadata: IStrategyMetadata<YoloVaultSettings>
|
|
45
|
+
): YoLoVault {
|
|
46
|
+
return new YoLoVault(config, pricer, metadata);
|
|
47
|
+
}
|
|
48
|
+
|
|
39
49
|
export function createHyperLSTStrategy(
|
|
40
50
|
config: IConfig,
|
|
41
51
|
pricer: PricerBase,
|
|
@@ -67,6 +77,10 @@ export function getStrategyTypeFromMetadata(
|
|
|
67
77
|
metadata: IStrategyMetadata<any>
|
|
68
78
|
): FactoryStrategyType {
|
|
69
79
|
const info = metadata.additionalInfo;
|
|
80
|
+
|
|
81
|
+
if (info && "mainToken" in info && "secondaryToken" in info && "minEpochDurationSeconds" in info && "feeBps" in info) {
|
|
82
|
+
return FactoryStrategyType.YOLO_VAULT;
|
|
83
|
+
}
|
|
70
84
|
|
|
71
85
|
// Check for HyperLST (extends UniversalStrategySettings with borrowable_assets and underlyingToken)
|
|
72
86
|
if (info && "borrowable_assets" in info && "underlyingToken" in info) {
|
|
@@ -153,6 +167,12 @@ export function createStrategy(
|
|
|
153
167
|
pricer,
|
|
154
168
|
metadata as IStrategyMetadata<SenseiVaultSettings>
|
|
155
169
|
);
|
|
170
|
+
case FactoryStrategyType.YOLO_VAULT:
|
|
171
|
+
return createYoloVaultStrategy(
|
|
172
|
+
config,
|
|
173
|
+
pricer,
|
|
174
|
+
metadata as IStrategyMetadata<YoloVaultSettings>
|
|
175
|
+
);
|
|
156
176
|
default:
|
|
157
177
|
throw new Error(`Unknown strategy type: ${type}`);
|
|
158
178
|
}
|
package/src/strategies/index.ts
CHANGED
|
@@ -3,15 +3,11 @@ export * from './vesu-rebalance';
|
|
|
3
3
|
export * from './ekubo-cl-vault';
|
|
4
4
|
export * from './base-strategy';
|
|
5
5
|
export * from './sensei';
|
|
6
|
+
export * from './yoloVault';
|
|
6
7
|
export * from './universal-adapters';
|
|
7
8
|
export * from './universal-strategy';
|
|
8
9
|
export * from './universal-lst-muliplier-strategy';
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './vesu-extended-strategy/utils/config.runtime';
|
|
11
|
-
export * from './vesu-extended-strategy/utils/helper';
|
|
12
|
-
export * from './vesu-extended-strategy/types/transaction-metadata';
|
|
13
|
-
export * from './vesu-extended-strategy/services/executionService';
|
|
14
|
-
export * from './vesu-extended-strategy/services/extended-vesu-state-manager';
|
|
10
|
+
export * from './token-boosted-xstrk-carry-strategy';
|
|
15
11
|
export * from "./registry";
|
|
16
12
|
export * from "./factory";
|
|
17
13
|
export * from "./types";
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
import { UniversalStrategies } from "./universal-strategy";
|
|
11
11
|
import { VesuRebalanceStrategies } from "./vesu-rebalance";
|
|
12
12
|
import { SenseiStrategies } from "./sensei";
|
|
13
|
+
import { YoloVaultStrategies } from "./yoloVault";
|
|
14
|
+
import { BoostedxSTRKCarryStrategies } from "./token-boosted-xstrk-carry-strategy";
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Filter option definition
|
|
@@ -38,6 +40,8 @@ export enum StrategyType {
|
|
|
38
40
|
HYPER_LST = "hyper-lst",
|
|
39
41
|
VESU_REBALANCE = "vesu-rebalance",
|
|
40
42
|
SENSEI = "sensei",
|
|
43
|
+
YOLO_VAULT = "yolo-vault",
|
|
44
|
+
BOOSTEDXSTRKCARRY = "boostedxstrkcarry",
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
/**
|
|
@@ -143,6 +147,25 @@ export function buildStrategyRegistry(): StrategyRegistryEntry[] {
|
|
|
143
147
|
});
|
|
144
148
|
}
|
|
145
149
|
|
|
150
|
+
// Register Yolo Vault strategies
|
|
151
|
+
if (YoloVaultStrategies && Array.isArray(YoloVaultStrategies)) {
|
|
152
|
+
YoloVaultStrategies.forEach((metadata) => {
|
|
153
|
+
registry.push({
|
|
154
|
+
metadata: metadata as any,
|
|
155
|
+
type: StrategyType.YOLO_VAULT,
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (BoostedxSTRKCarryStrategies && Array.isArray(BoostedxSTRKCarryStrategies)) {
|
|
161
|
+
BoostedxSTRKCarryStrategies.forEach((metadata) => {
|
|
162
|
+
registry.push({
|
|
163
|
+
metadata: metadata as any,
|
|
164
|
+
type: StrategyType.BOOSTEDXSTRKCARRY,
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
146
169
|
return registry;
|
|
147
170
|
}
|
|
148
171
|
|
|
@@ -171,13 +194,13 @@ export function getAllStrategyMetadata(): StrategyMetadata[] {
|
|
|
171
194
|
*/
|
|
172
195
|
export function getFilterMetadata(): StrategyFilterMetadata {
|
|
173
196
|
const allMetadata = getAllStrategyMetadata();
|
|
174
|
-
|
|
197
|
+
|
|
175
198
|
// Extract unique assets
|
|
176
199
|
const assetSet = new Set<string>();
|
|
177
200
|
allMetadata.forEach((meta) => {
|
|
178
201
|
meta.assets.forEach((asset) => assetSet.add(asset));
|
|
179
202
|
});
|
|
180
|
-
|
|
203
|
+
|
|
181
204
|
const allowedAssets = new Set(["eth", "btc", "strk", "usdt", "usdc"]);
|
|
182
205
|
const assets: FilterOption[] = Array.from(assetSet)
|
|
183
206
|
.filter((asset) => allowedAssets.has(asset.toLowerCase()))
|
|
@@ -195,7 +218,7 @@ export function getFilterMetadata(): StrategyFilterMetadata {
|
|
|
195
218
|
id,
|
|
196
219
|
label: id.toUpperCase()
|
|
197
220
|
}));
|
|
198
|
-
|
|
221
|
+
|
|
199
222
|
// Extract unique protocols
|
|
200
223
|
const protocolSet = new Set<string>();
|
|
201
224
|
allMetadata.forEach((meta) => {
|
|
@@ -207,12 +230,12 @@ export function getFilterMetadata(): StrategyFilterMetadata {
|
|
|
207
230
|
id,
|
|
208
231
|
label: id.charAt(0).toUpperCase() + id.slice(1)
|
|
209
232
|
}));
|
|
210
|
-
|
|
233
|
+
|
|
211
234
|
const quickFilters: FilterOption[] = [
|
|
212
235
|
{ id: "all", label: "All Strategies" },
|
|
213
236
|
...getAllStrategyTags().map((tag) => ({ id: tag.toLowerCase().replaceAll(" ", "-"), label: tag })),
|
|
214
237
|
];
|
|
215
|
-
|
|
238
|
+
|
|
216
239
|
return {
|
|
217
240
|
assets,
|
|
218
241
|
protocols,
|
package/src/strategies/sensei.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { getNoRiskTags, highlightTextWithLinks, IConfig, IProtocol, IStrategyMetadata, RiskFactor, RiskType, StrategyTag, TokenInfo, AuditStatus, SourceCodeType, AccessControlType, InstantWithdrawalVault, StrategyLiveStatus, VaultType } from "@/interfaces";
|
|
2
|
-
import {
|
|
1
|
+
import { getNoRiskTags, highlightTextWithLinks, IConfig, IProtocol, IStrategyMetadata, RiskFactor, RiskType, StrategyTag, TokenInfo, AuditStatus, SourceCodeType, AccessControlType, InstantWithdrawalVault, StrategyLiveStatus, VaultType, UnwrapLabsCurator } from "@/interfaces";
|
|
2
|
+
import {
|
|
3
|
+
BaseStrategy,
|
|
4
|
+
SingleActionAmount,
|
|
5
|
+
SingleTokenInfo,
|
|
6
|
+
UserPositionCard,
|
|
7
|
+
UserPositionCardsInput,
|
|
8
|
+
} from "./base-strategy";
|
|
3
9
|
import { ContractAddr, Web3Number } from "@/dataTypes";
|
|
4
10
|
import { Call, Contract, num, uint256, BlockIdentifier } from "starknet";
|
|
5
11
|
import SenseiABI from "@/data/sensei.abi.json";
|
|
@@ -94,7 +100,7 @@ export class SenseiVault extends BaseStrategy<
|
|
|
94
100
|
tokenInfo: this.metadata.depositTokens[0],
|
|
95
101
|
};
|
|
96
102
|
} catch (error) {
|
|
97
|
-
console.error(
|
|
103
|
+
console.error(`[SDK] Error fetching TVL for ${this.metadata.id}:`, error);
|
|
98
104
|
return {
|
|
99
105
|
usdValue: 0,
|
|
100
106
|
amount: new Web3Number('0', this.metadata.depositTokens[0].decimals),
|
|
@@ -499,7 +505,10 @@ export class SenseiVault extends BaseStrategy<
|
|
|
499
505
|
return apy;
|
|
500
506
|
*/
|
|
501
507
|
}
|
|
502
|
-
|
|
508
|
+
|
|
509
|
+
async getUserPositionCards(_input: UserPositionCardsInput): Promise<UserPositionCard[]> {
|
|
510
|
+
return [];
|
|
511
|
+
}
|
|
503
512
|
}
|
|
504
513
|
|
|
505
514
|
const senseiDescription = `Deposit your {{token1}} to automatically loop your funds via Endur ({{token2}}) and Vesu to create a delta neutral position. This strategy is designed to maximize your yield on {{token1}}. Your position is automatically adjusted periodically to maintain a healthy health factor. You receive a NFT as representation for your stake on Troves. You can withdraw anytime by redeeming your NFT for {{token1}}.`;
|
|
@@ -585,10 +594,7 @@ export const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[] =
|
|
|
585
594
|
),
|
|
586
595
|
launchBlock: 1053811,
|
|
587
596
|
type: "Other",
|
|
588
|
-
curator:
|
|
589
|
-
name: "Unwrap Labs",
|
|
590
|
-
logo: "https://assets.troves.fi/integrations/unwraplabs/white.png"
|
|
591
|
-
},
|
|
597
|
+
curator: UnwrapLabsCurator,
|
|
592
598
|
vaultType: {
|
|
593
599
|
type: VaultType.LOOPING,
|
|
594
600
|
description: "Creates leveraged looping position on xSTRK by borrowing STRK to increase yield"
|
|
@@ -598,7 +604,6 @@ export const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[] =
|
|
|
598
604
|
],
|
|
599
605
|
protocols: [endurProtocol, vesuProtocol],
|
|
600
606
|
settings: {
|
|
601
|
-
maxTVL: new Web3Number("1500000", 18),
|
|
602
607
|
alerts: [
|
|
603
608
|
{
|
|
604
609
|
type: "info",
|
|
@@ -606,7 +611,7 @@ export const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[] =
|
|
|
606
611
|
tab: "all"
|
|
607
612
|
}
|
|
608
613
|
],
|
|
609
|
-
liveStatus: StrategyLiveStatus.
|
|
614
|
+
liveStatus: StrategyLiveStatus.RETIRED,
|
|
610
615
|
isPaused: false,
|
|
611
616
|
isInMaintenance: false,
|
|
612
617
|
isAudited: false,
|
|
@@ -647,7 +652,7 @@ export const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[] =
|
|
|
647
652
|
contractLink: "https://github.com/trovesfi/troves-contracts",
|
|
648
653
|
},
|
|
649
654
|
accessControl: {
|
|
650
|
-
type: AccessControlType.
|
|
655
|
+
type: AccessControlType.ROLE_BASED_ACCESS,
|
|
651
656
|
addresses: [ContractAddr.from("0x0")],
|
|
652
657
|
timeLock: "2 Days",
|
|
653
658
|
},
|
|
@@ -658,11 +663,22 @@ export const SenseiStrategies: IStrategyMetadata<SenseiVaultSettings>[] =
|
|
|
658
663
|
alerts: [],
|
|
659
664
|
},
|
|
660
665
|
usualTimeToEarnings: "2 weeks",
|
|
661
|
-
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2
|
|
666
|
+
usualTimeToEarningsDescription: "Strategy returns depend on LST price on DEXes. Even though the true price of LST on Endur increases continuously, the DEX price may lag sometimes, and historically is seen to rebase at least once every 2 weeks. This is when you realise your earnings.",
|
|
662
667
|
points: [{
|
|
663
668
|
multiplier: 4,
|
|
664
669
|
logo: 'https://endur.fi/favicon.ico',
|
|
665
670
|
toolTip: "This strategy holds xSTRK. Earn 3-4x Endur points on your xSTRK due to the leverage. Points can be found on endur.fi.",
|
|
666
|
-
}]
|
|
671
|
+
}],
|
|
672
|
+
discontinuationInfo: {
|
|
673
|
+
info: highlightTextWithLinks(
|
|
674
|
+
"This strategy is retired. All funds have been moved to Hyper xSTRK.",
|
|
675
|
+
[
|
|
676
|
+
{
|
|
677
|
+
highlight: "Hyper xSTRK",
|
|
678
|
+
link: "/strategy/hyper_xstrk",
|
|
679
|
+
},
|
|
680
|
+
]
|
|
681
|
+
),
|
|
682
|
+
},
|
|
667
683
|
},
|
|
668
684
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ContractAddr, Web3Number } from "@/dataTypes";
|
|
2
|
-
import { IConfig, IStrategyMetadata, TokenInfo, VaultPosition } from "@/interfaces";
|
|
2
|
+
import { IConfig, IStrategyMetadata, Protocols, TokenInfo, VaultPosition } from "@/interfaces";
|
|
3
3
|
import { PricerBase } from "@/modules/pricerBase";
|
|
4
4
|
import { ERC20 } from "@/modules";
|
|
5
5
|
import { BaseStrategy, SingleActionAmount, SingleTokenInfo } from "./base-strategy";
|
|
@@ -121,9 +121,10 @@ export abstract class SVKStrategy<S extends UniversalStrategySettings>
|
|
|
121
121
|
adapter: { getProofs: (isDeposit: boolean, tree: any) => any },
|
|
122
122
|
isDeposit: boolean,
|
|
123
123
|
amount: Web3Number,
|
|
124
|
+
additionalParams?: Record<string, any>,
|
|
124
125
|
): Promise<Call> {
|
|
125
126
|
const proofsInfo = adapter.getProofs(isDeposit, this.getMerkleTree());
|
|
126
|
-
const manageCalls = await proofsInfo.callConstructor({ amount });
|
|
127
|
+
const manageCalls = await proofsInfo.callConstructor({ amount, ...additionalParams });
|
|
127
128
|
return this.getManageCall(
|
|
128
129
|
this.getProofGroupsForManageCalls(manageCalls),
|
|
129
130
|
manageCalls,
|
|
@@ -265,7 +266,19 @@ export abstract class SVKStrategy<S extends UniversalStrategySettings>
|
|
|
265
266
|
*/
|
|
266
267
|
async getVaultPositions(): Promise<VaultPosition[]> {
|
|
267
268
|
const positions = await Promise.all(
|
|
268
|
-
|
|
269
|
+
[
|
|
270
|
+
...this.metadata.additionalInfo.adapters.map(adapter => adapter.adapter.getPositions()),
|
|
271
|
+
(async () => {
|
|
272
|
+
const unused = await this.getUnusedBalance();
|
|
273
|
+
return {
|
|
274
|
+
amount: unused.amount,
|
|
275
|
+
usdValue: unused.usdValue,
|
|
276
|
+
remarks: "Unused Balance",
|
|
277
|
+
tokenInfo: this.asset(),
|
|
278
|
+
protocol: Protocols.NONE
|
|
279
|
+
};
|
|
280
|
+
})()
|
|
281
|
+
]
|
|
269
282
|
)
|
|
270
283
|
return positions.flat().map((position) => ({
|
|
271
284
|
amount: position.amount,
|
|
@@ -293,7 +306,19 @@ export abstract class SVKStrategy<S extends UniversalStrategySettings>
|
|
|
293
306
|
const netAPY = weightedAPYs / totalHoldingsUSDValue;
|
|
294
307
|
return {
|
|
295
308
|
net: netAPY,
|
|
296
|
-
splits: allPositions.map(p => ({apy: p.apy.apy, id: p.remarks ?? ''}))
|
|
309
|
+
splits: allPositions.map(p => ({ apy: p.apy.apy, id: p.remarks ?? '' }))
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
async getTVL(): Promise<SingleTokenInfo> {
|
|
314
|
+
const tvl = await this.contract.call('total_assets', []) as bigint;
|
|
315
|
+
const amount = Web3Number.fromWei(tvl.toString(), this.asset().decimals);
|
|
316
|
+
const price = await this.pricer.getPrice(this.asset().symbol);
|
|
317
|
+
const usdValue = Number(amount.toFixed(6)) * price.price;
|
|
318
|
+
return {
|
|
319
|
+
tokenInfo: this.asset(),
|
|
320
|
+
amount,
|
|
321
|
+
usdValue
|
|
297
322
|
};
|
|
298
323
|
}
|
|
299
324
|
|