@strkfarm/sdk 2.0.0-dev.36 → 2.0.0-dev.38

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.
@@ -3,17 +3,31 @@ import { Global } from "@/global";
3
3
  import {
4
4
  AccessControlType,
5
5
  AuditStatus,
6
+ FAQ,
6
7
  getMainnetConfig,
8
+ getNoRiskTags,
7
9
  IConfig,
8
10
  InstantWithdrawalVault,
9
11
  IStrategyMetadata,
10
12
  Protocols,
13
+ RiskFactor,
14
+ RiskType,
11
15
  SourceCodeType,
12
16
  StrategyTag,
13
17
  TokenInfo,
14
18
  VaultPosition,
15
19
  VaultType,
16
20
  } from "@/interfaces";
21
+ import {
22
+ CounterpartyRiskLevel,
23
+ DepegRiskLevel,
24
+ LiquidationRiskLevel,
25
+ LowLiquidityRiskLevel,
26
+ MarketRiskLevel,
27
+ OracleRiskLevel,
28
+ SmartContractRiskLevel,
29
+ TechnicalRiskLevel,
30
+ } from "@/interfaces/risks";
17
31
  import { ERC20, PricerFromApi, TokenMarketData } from "@/modules";
18
32
  import { PricerBase } from "@/modules/pricerBase";
19
33
  import { logger, assert } from "@/utils";
@@ -891,15 +905,15 @@ const boostedxSTRKCarrySettings: BoostedxSTRKCarryStrategySettings = {
891
905
  leafAdapters: [],
892
906
  adapters: [],
893
907
  // Calc using the maxLTV / targetLTV (0.5)
894
- targetHealthFactor: 1.32,
908
+ targetHealthFactor: 1.36,
895
909
  // Calc using the maxLTV / maxAcceptableLTV (0.55)
896
- minHealthFactor: 1.2,
910
+ minHealthFactor: 1.3,
897
911
  vesuPoolId: VesuPools.Prime,
898
912
  // New metadata-driven token configuration
899
913
  depositToken: Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
900
914
  debtToken: Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
901
915
  lstHyperToken: Global.getDefaultTokens().find((t) => t.symbol === "xSTRK")!,
902
- maxLTV: 0.66,
916
+ maxLTV: 0.68,
903
917
  targetLTV: 0.5,
904
918
  // BTC.Fi rewards flag - false for USDC (uses old report flow)
905
919
  hasBtcFiRewards: false,
@@ -931,13 +945,13 @@ const wbtcBoostedSettings: BoostedxSTRKCarryStrategySettings = {
931
945
  ),
932
946
  leafAdapters: [],
933
947
  adapters: [],
934
- targetHealthFactor: 1.32,
935
- minHealthFactor: 1.2,
948
+ targetHealthFactor: 1.4,
949
+ minHealthFactor: 1.35,
936
950
  vesuPoolId: VesuPools.Prime,
937
951
  depositToken: Global.getDefaultTokens().find((t) => t.symbol === "WBTC")!,
938
952
  debtToken: Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
939
953
  lstHyperToken: Global.getDefaultTokens().find((t) => t.symbol === "xSTRK")!,
940
- maxLTV: 0.66,
954
+ maxLTV: 0.70,
941
955
  targetLTV: 0.5,
942
956
  hasBtcFiRewards: true,
943
957
  hyperLstVaultAddress: ContractAddr.from(
@@ -949,6 +963,158 @@ const wbtcBoostedSettings: BoostedxSTRKCarryStrategySettings = {
949
963
  trovesStrategyId: "hyper_xstrk",
950
964
  };
951
965
 
966
+ // Risk weights drive the displayed net risk score (weighted average of factor levels).
967
+ // Highest weights go to risks that can directly impair principal or block exits; lower weights
968
+ // for mitigated or secondary drivers. Weights sum to 100 for easy reasoning about share of total.
969
+ const boostedCarryRiskFactors: RiskFactor[] = [
970
+ {
971
+ type: RiskType.SMART_CONTRACT_RISK,
972
+ value: SmartContractRiskLevel.WELL_AUDITED,
973
+ // 20% — core trust assumption; SVK is audited but still multi-contract (vault, manager, adapters).
974
+ weight: 20,
975
+ reason:
976
+ "Built on the Starknet Vault Kit (SVK), with audits under the Sherlock-audited branch.",
977
+ },
978
+ {
979
+ type: RiskType.LIQUIDATION_RISK,
980
+ value: LiquidationRiskLevel.MODERATE_PROBABILITY,
981
+ // 20% — tied with smart contract; uncorrelated collateral/debt is the main principal risk here.
982
+ weight: 20,
983
+ reason:
984
+ "Collateral (USDC or WBTC) and STRK debt are not price-correlated. We target ~50% LTV and rebalance above ~55%, with a health-factor buffer, but extreme moves or prolonged monitoring gaps can still trigger liquidation.",
985
+ },
986
+ {
987
+ type: RiskType.LOW_LIQUIDITY_RISK,
988
+ value: LowLiquidityRiskLevel.MODERATE_CONCERNS,
989
+ // 15% — below liquidation but above ops risks; every unwind/withdraw depends on xSTRK→STRK depth.
990
+ weight: 15,
991
+ reason:
992
+ "Closing the loop requires selling xSTRK to STRK on DEXes to repay Vesu debt. xSTRK liquidity can be thin at fair prices; larger withdrawals or rebalances may take longer or complete in smaller chunks.",
993
+ },
994
+ {
995
+ type: RiskType.TECHNICAL_RISK,
996
+ value: TechnicalRiskLevel.SOME_COMPLEXITY,
997
+ // 13% — monitoring/rebalancing stack matters, but usually recoverable without instant loss.
998
+ weight: 13,
999
+ reason:
1000
+ "Yield routes across Vesu, Avnu, and Hyper xSTRK with automated monitoring. Technical failures can delay rebalancing.",
1001
+ },
1002
+ {
1003
+ type: RiskType.DEPEG_RISK,
1004
+ value: DepegRiskLevel.OCCASIONAL_DEPEG,
1005
+ // 12% — affects yield and swap notionals; USDC/WBTC depeg is rarer than xSTRK/STRK drift.
1006
+ weight: 12,
1007
+ reason:
1008
+ "xSTRK yield depends on its exchange rate vs STRK; USDC and WBTC carry standard stablecoin and BTC market risks.",
1009
+ },
1010
+ {
1011
+ type: RiskType.ORACLE_RISK,
1012
+ value: OracleRiskLevel.SINGLE_RELIABLE,
1013
+ // 10% — Vesu HF depends on feeds; Starknet oracles are established but not redundant here.
1014
+ weight: 10,
1015
+ reason:
1016
+ "Vesu collateral and debt valuations rely on Starknet price feeds.",
1017
+ },
1018
+ {
1019
+ type: RiskType.COUNTERPARTY_RISK,
1020
+ value: CounterpartyRiskLevel.REPUTABLE_COUNTERPARTY,
1021
+ // 10% — same tier as oracle; Vesu/Endur/Troves are mature but still protocol counterparty risk.
1022
+ weight: 10,
1023
+ reason:
1024
+ "Exposure to Vesu lending, Endur (xSTRK), and Troves Hyper vault infrastructure.",
1025
+ },
1026
+ {
1027
+ type: RiskType.MARKET_RISK,
1028
+ value: MarketRiskLevel.MODERATE_VOLATILITY,
1029
+ // 5% — largely captured by liquidation + depeg factors; kept small to avoid double-counting vol.
1030
+ weight: 5,
1031
+ reason:
1032
+ "STRK, BTC, and stablecoin volatility can move loan-to-value and swap costs.",
1033
+ },
1034
+ ];
1035
+
1036
+ function getBoostedCarryRisk() {
1037
+ const netRisk =
1038
+ boostedCarryRiskFactors.reduce(
1039
+ (acc, curr) => acc + curr.value * curr.weight,
1040
+ 0,
1041
+ ) / boostedCarryRiskFactors.reduce((acc, curr) => acc + curr.weight, 0);
1042
+ return {
1043
+ riskFactor: boostedCarryRiskFactors,
1044
+ netRisk,
1045
+ notARisks: getNoRiskTags(boostedCarryRiskFactors),
1046
+ };
1047
+ }
1048
+
1049
+ function getBoostedCarryFAQs(
1050
+ depositSymbol: string,
1051
+ debtSymbol: string,
1052
+ lstSymbol: string,
1053
+ ): FAQ[] {
1054
+ return [
1055
+ {
1056
+ question: `What is ${depositSymbol} Boosted?`,
1057
+ answer: `${depositSymbol} Boosted is a carry-style vault: your ${depositSymbol} is supplied as collateral on Vesu, ${debtSymbol} is borrowed, swapped to ${lstSymbol}, and deposited into Hyper-${lstSymbol} for additional yield on top of the lending loop.`,
1058
+ },
1059
+ {
1060
+ question: "How does this strategy generate yield?",
1061
+ answer: `Yield comes from several layers: ${lstSymbol} staking yield inside Hyper-${lstSymbol}, the spread between borrowing ${debtSymbol} and holding ${lstSymbol}, and efficient routing via Avnu. The vault targets about 50% loan-to-value and rebalances when LTV rises above ~55% so risk and yield stay in balance.`,
1062
+ },
1063
+ {
1064
+ question: "Which protocols are used?",
1065
+ answer: (
1066
+ <span>
1067
+ <strong>Vesu</strong> for collateral and borrowing, <strong>Avnu</strong>{" "}
1068
+ for swaps, <strong>Endur</strong> for {lstSymbol}, and the Troves{" "}
1069
+ <strong>Hyper-{lstSymbol}</strong> vault for the boosted leg.
1070
+ </span>
1071
+ ),
1072
+ },
1073
+ {
1074
+ question: "Is there liquidation risk?",
1075
+ answer: `Yes. Your ${depositSymbol} collateral and ${debtSymbol} debt can move in different directions, which affects your health factor on Vesu. We actively monitor positions and rebalance automatically through our systems to keep loan-to-value near target. However, unexpected technical failures or very sharp market moves can still lead to liquidation. Under normal conditions we aim for a buffer of roughly 30% adverse price movement before liquidation becomes likely — but if monitoring is unavailable for many hours during a trending market, that buffer can be consumed. In extreme scenarios, liquidation remains possible.`,
1076
+ },
1077
+ {
1078
+ question: "What do I receive when I deposit?",
1079
+ answer:
1080
+ "You receive vault tokens representing your share of the vault. They reflect both principal and accrued yield.",
1081
+ },
1082
+ {
1083
+ question: "How long do withdrawals take?",
1084
+ answer:
1085
+ "Withdrawals typically take 1–2 hours. You receive an NFT for your request; funds are sent to the NFT owner once the vault unwinds its positions. The vault must sell xSTRK back to STRK to repay debt — if DEX liquidity is thin or your withdrawal is large, unwinding can take longer or happen in smaller steps to limit slippage.",
1086
+ },
1087
+ {
1088
+ question: "Is this vault non-custodial?",
1089
+ answer:
1090
+ "Yes. The vault runs on-chain. You hold your vault tokens, and positions are transparent via on-chain contracts.",
1091
+ },
1092
+ {
1093
+ question: "Are there any fees?",
1094
+ answer:
1095
+ "Troves charges a 10% performance fee on yield only — not on your deposited principal. The APY shown is already net of this fee. When you withdraw, a 0.1% redemption fee applies. That small fee helps keep the vault efficient for long-term depositors, very short stays create extra swap and rebalancing costs for everyone. If you stay for a reasonable period, your yield will typically far outweigh this one-time charge.",
1096
+ },
1097
+ {
1098
+ question: "Is the vault audited?",
1099
+ answer: (
1100
+ <span>
1101
+ Yes. The strategy is built on the audited Starknet Vault Kit. See the
1102
+ security details beside the strategy name and the{" "}
1103
+ <a
1104
+ href="https://github.com/trovesfi/starknet_vault_kit/tree/sherlock-audited"
1105
+ target="_blank"
1106
+ rel="noopener noreferrer"
1107
+ style={{ textDecoration: "underline" }}
1108
+ >
1109
+ open-source repo
1110
+ </a>
1111
+ .
1112
+ </span>
1113
+ ),
1114
+ },
1115
+ ];
1116
+ }
1117
+
952
1118
  function getStrategySettings(
953
1119
  settings: BoostedxSTRKCarryStrategySettings,
954
1120
  meta: { id: string; name: string; launchBlock: number },
@@ -960,7 +1126,7 @@ function getStrategySettings(
960
1126
  return {
961
1127
  id: meta.id,
962
1128
  name: meta.name,
963
- description: `Deposits ${depositToken.symbol} as collateral on Vesu, borrows ${debtToken.symbol}, swaps to ${lstToken.symbol}, and deposits into Hyper-${lstToken.symbol} for boosted yield`,
1129
+ description: `Deposits ${depositToken.symbol} as collateral on Vesu, borrows ${debtToken.symbol}, swaps to ${lstToken.symbol}, and deposits into Hyper-${lstToken.symbol} for boosted yield. Target LTV is about 50%, with rebalances happening when LTV is above 55%.`,
964
1130
  address: settings.vaultAddress,
965
1131
  launchBlock: meta.launchBlock,
966
1132
  type: "ERC4626" as const,
@@ -970,13 +1136,8 @@ function getStrategySettings(
970
1136
  },
971
1137
  depositTokens: [depositToken],
972
1138
  additionalInfo: getBoostedxSTRKCarrySettings(settings),
973
- // TODO: config lateron
974
- risk: {
975
- riskFactor: [],
976
- netRisk: 0,
977
- notARisks: [],
978
- },
979
- protocols: [Protocols.VESU, Protocols.TROVES],
1139
+ risk: getBoostedCarryRisk(),
1140
+ protocols: [Protocols.VESU, Protocols.ENDUR, Protocols.TROVES],
980
1141
  curator: {
981
1142
  name: "Unwrap Labs",
982
1143
  logo: "https://assets.troves.fi/integrations/unwraplabs/white.png",
@@ -984,7 +1145,7 @@ function getStrategySettings(
984
1145
  settings: {
985
1146
  maxTVL: Web3Number.fromWei(0, depositToken.decimals),
986
1147
  isPaused: false,
987
- isAudited: false,
1148
+ isAudited: true,
988
1149
  isInstantWithdrawal: false,
989
1150
  hideHarvestInfo: true,
990
1151
  quoteToken: depositToken,
@@ -997,27 +1158,33 @@ function getStrategySettings(
997
1158
  ],
998
1159
  },
999
1160
  contractDetails: getContractDetails(settings),
1000
- // TODO: config later
1001
- faqs: [],
1161
+ faqs: getBoostedCarryFAQs(
1162
+ depositToken.symbol,
1163
+ debtToken.symbol,
1164
+ lstToken.symbol,
1165
+ ),
1166
+ apyMethodology:
1167
+ "APY reflects net returns after a 10% performance fee on yield (not on principal). Underlying xSTRK appreciation and Vesu borrow costs can move over time; displayed APY is an estimate.",
1002
1168
  investmentSteps: [
1003
1169
  `Deposit ${depositToken.symbol} into the vault`,
1004
1170
  `${depositToken.symbol} is supplied as collateral on Vesu, ${debtToken.symbol} is borrowed`,
1005
1171
  `Borrowed ${debtToken.symbol} is swapped to ${lstToken.symbol} via Avnu`,
1006
1172
  `${lstToken.symbol} is deposited into the Hyper-${lstToken.symbol} vault for additional yield`,
1007
- `On withdrawal, the pipeline reverses to return ${depositToken.symbol}`,
1173
+ `Actively monitored and rebalanced to maintain optimal LTV and yield.`,
1008
1174
  ],
1009
1175
  // TODO: config later
1010
1176
  tags: [StrategyTag.META_VAULT],
1011
1177
  security: {
1012
1178
  auditStatus: AuditStatus.AUDITED,
1013
1179
  sourceCode: {
1014
- type: SourceCodeType.CLOSED_SOURCE,
1015
- contractLink: "https://github.com/trovesfi/troves-contracts",
1180
+ type: SourceCodeType.OPEN_SOURCE,
1181
+ contractLink: "https://github.com/trovesfi/starknet_vault_kit/tree/sherlock-audited",
1016
1182
  },
1183
+ // TODO
1017
1184
  accessControl: {
1018
1185
  type: AccessControlType.STANDARD_ACCOUNT,
1019
1186
  addresses: [ContractAddr.from("0x0")],
1020
- timeLock: "2 Days",
1187
+ timeLock: "0 Days",
1021
1188
  },
1022
1189
  },
1023
1190
  redemptionInfo: {
@@ -1036,12 +1203,11 @@ function getStrategySettings(
1036
1203
  },
1037
1204
  ],
1038
1205
  },
1039
- usualTimeToEarnings: null,
1040
- usualTimeToEarningsDescription: null,
1206
+ usualTimeToEarnings: "2 weeks",
1207
+ usualTimeToEarningsDescription: "This strategy depends on Hyper xSTRK's yield, which depends on the price of xSTRK on DEX appreciating. It may be possible the increase is not continuous and generally rebases atleast once every 2 weeks.",
1041
1208
  };
1042
1209
  }
1043
1210
 
1044
- // TODO: rename to BoostedCollateralStrategies later on or smthin
1045
1211
  export const BoostedxSTRKCarryStrategies: IStrategyMetadata<BoostedxSTRKCarryStrategySettings>[] =
1046
1212
  [
1047
1213
  getStrategySettings(boostedxSTRKCarrySettings, {