@strkfarm/sdk 1.0.46 → 1.0.49

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.mjs CHANGED
@@ -2012,8 +2012,9 @@ var AvnuWrapper = class _AvnuWrapper {
2012
2012
  }
2013
2013
  };
2014
2014
 
2015
- // src/interfaces/common.ts
2015
+ // src/interfaces/common.tsx
2016
2016
  import { RpcProvider as RpcProvider2 } from "starknet";
2017
+ import { Fragment, jsx } from "react/jsx-runtime";
2017
2018
  var RiskType = /* @__PURE__ */ ((RiskType2) => {
2018
2019
  RiskType2["MARKET_RISK"] = "Market Risk";
2019
2020
  RiskType2["IMPERMANENT_LOSS"] = "Impermanent Loss Risk";
@@ -2069,8 +2070,8 @@ var getRiskExplaination = (riskType) => {
2069
2070
  };
2070
2071
  var getRiskColor = (risk) => {
2071
2072
  const value = risk.value;
2072
- if (value === 0) return "green";
2073
- if (value < 2.5) return "yellow";
2073
+ if (value <= 1) return "light_green_2";
2074
+ if (value < 3) return "yellow";
2074
2075
  return "red";
2075
2076
  };
2076
2077
  var getNoRiskTags = (risks) => {
@@ -2079,8 +2080,20 @@ var getNoRiskTags = (risks) => {
2079
2080
  (risk) => !risks.map((risk2) => risk2.type).includes(risk)
2080
2081
  );
2081
2082
  const mergedUnique = [.../* @__PURE__ */ new Set([...noRisks1, ...noRisks2])];
2082
- return mergedUnique.map((risk) => `No ${risk}`);
2083
+ return mergedUnique;
2083
2084
  };
2085
+ function highlightTextWithLinks(put, highlights) {
2086
+ const escapeRegExp = (text) => text.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
2087
+ const pattern = new RegExp(
2088
+ `(${highlights.map((m) => escapeRegExp(m.highlight)).join("|")})`,
2089
+ "gi"
2090
+ );
2091
+ const parts = put.split(pattern);
2092
+ return /* @__PURE__ */ jsx(Fragment, { children: parts.map((part, i) => {
2093
+ const match = highlights.find((m) => m.highlight.toLowerCase() === part.toLowerCase());
2094
+ return match ? /* @__PURE__ */ jsx("a", { href: match.link, target: "_blank", style: { color: "var(--chakra-colors-white)", background: "var(--chakra-colors-highlight)" }, children: part }, i) : /* @__PURE__ */ jsx("span", { children: part }, i);
2095
+ }) });
2096
+ }
2084
2097
 
2085
2098
  // src/interfaces/initializable.ts
2086
2099
  var Initializable = class {
@@ -9202,8 +9215,15 @@ var vesu_pools_default = {
9202
9215
  ]
9203
9216
  };
9204
9217
 
9218
+ // src/strategies/constants.ts
9219
+ var COMMON_CONTRACTS = [{
9220
+ address: ContractAddr.from("0x0636a3f51cc37f5729e4da4b1de6a8549a28f3c0d5bf3b17f150971e451ff9c2"),
9221
+ name: "Access Controller",
9222
+ sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/blob/main/src/components/accessControl.cairo"
9223
+ }];
9224
+
9205
9225
  // src/strategies/vesu-rebalance.tsx
9206
- import { jsx, jsxs } from "react/jsx-runtime";
9226
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
9207
9227
  var VesuRebalance = class _VesuRebalance extends BaseStrategy {
9208
9228
  // 10000 bps = 100%
9209
9229
  /**
@@ -9844,9 +9864,9 @@ var _protocol = {
9844
9864
  logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
9845
9865
  };
9846
9866
  var _riskFactor = [
9847
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25 },
9848
- { type: "Counterparty Risk" /* COUNTERPARTY_RISK */, value: 1, weight: 50 },
9849
- { type: "Oracle Risk" /* ORACLE_RISK */, value: 0.5, weight: 25 }
9867
+ { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25, reason: "Audited by CSC" },
9868
+ { type: "Counterparty Risk" /* COUNTERPARTY_RISK */, value: 1, weight: 50, reason: "Reasonable max LTV ratios and Curated by well-known risk managers like Re7" },
9869
+ { type: "Oracle Risk" /* ORACLE_RISK */, value: 0.5, weight: 25, reason: "Uses Pragma price feeds, Most reputable price feed on Starknet" }
9850
9870
  ];
9851
9871
  var AUDIT_URL = "https://assets.strkfarm.com/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
9852
9872
  var faqs = [
@@ -9886,7 +9906,7 @@ var faqs = [
9886
9906
  question: "Is the strategy audited?",
9887
9907
  answer: /* @__PURE__ */ jsxs("div", { children: [
9888
9908
  "Yes, the strategy has been audited. You can review the audit report in our docs ",
9889
- /* @__PURE__ */ jsx("a", { href: "https://docs.strkfarm.com/p/strategies/vesu-fusion-rebalancing-vaults#technical-details", style: { textDecoration: "underline", marginLeft: "5px" }, children: "Here" }),
9909
+ /* @__PURE__ */ jsx2("a", { href: "https://docs.strkfarm.com/p/strategies/vesu-fusion-rebalancing-vaults#technical-details", style: { textDecoration: "underline", marginLeft: "5px" }, children: "Here" }),
9890
9910
  "."
9891
9911
  ] })
9892
9912
  }
@@ -9894,7 +9914,7 @@ var faqs = [
9894
9914
  var VesuRebalanceStrategies = [
9895
9915
  {
9896
9916
  name: "Vesu Fusion STRK",
9897
- description: _description.replace("{{TOKEN}}", "STRK"),
9917
+ description: _description,
9898
9918
  address: ContractAddr.from(
9899
9919
  "0x7fb5bcb8525954a60fde4e8fb8220477696ce7117ef264775a1770e23571929"
9900
9920
  ),
@@ -9914,7 +9934,9 @@ var VesuRebalanceStrategies = [
9914
9934
  additionalInfo: {
9915
9935
  feeBps: 1e3
9916
9936
  },
9917
- faqs
9937
+ faqs,
9938
+ contractDetails: [],
9939
+ investmentSteps: []
9918
9940
  },
9919
9941
  {
9920
9942
  name: "Vesu Fusion ETH",
@@ -9938,7 +9960,9 @@ var VesuRebalanceStrategies = [
9938
9960
  additionalInfo: {
9939
9961
  feeBps: 1e3
9940
9962
  },
9941
- faqs
9963
+ faqs,
9964
+ contractDetails: [],
9965
+ investmentSteps: []
9942
9966
  },
9943
9967
  {
9944
9968
  name: "Vesu Fusion USDC",
@@ -9962,7 +9986,9 @@ var VesuRebalanceStrategies = [
9962
9986
  additionalInfo: {
9963
9987
  feeBps: 1e3
9964
9988
  },
9965
- faqs
9989
+ faqs,
9990
+ contractDetails: [],
9991
+ investmentSteps: []
9966
9992
  },
9967
9993
  {
9968
9994
  name: "Vesu Fusion USDT",
@@ -9986,7 +10012,9 @@ var VesuRebalanceStrategies = [
9986
10012
  additionalInfo: {
9987
10013
  feeBps: 1e3
9988
10014
  },
9989
- faqs
10015
+ faqs,
10016
+ contractDetails: [],
10017
+ investmentSteps: []
9990
10018
  // }, {
9991
10019
  // name: 'Vesu Fusion WBTC',
9992
10020
  // description: _description.replace('{{TOKEN}}', 'WBTC'),
@@ -10005,6 +10033,32 @@ var VesuRebalanceStrategies = [
10005
10033
  // },
10006
10034
  }
10007
10035
  ];
10036
+ VesuRebalanceStrategies.forEach((s) => {
10037
+ s.contractDetails = [
10038
+ {
10039
+ address: s.address,
10040
+ name: "Vault",
10041
+ sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/tree/main/src/strategies/vesu_rebalance"
10042
+ },
10043
+ ...COMMON_CONTRACTS
10044
+ ];
10045
+ s.docs = "https://docs.strkfarm.com/p/strategies/vesu-fusion-rebalancing-vaults";
10046
+ s.description = highlightTextWithLinks(
10047
+ _description.replace("{{TOKEN}}", s.depositTokens[0].symbol),
10048
+ [{
10049
+ highlight: "Vesu pools",
10050
+ link: "https://vesu.xyz/pools"
10051
+ }, {
10052
+ highlight: "Defi spring STRK Rewards",
10053
+ link: "https://defispring.starknet.io/"
10054
+ }]
10055
+ );
10056
+ s.investmentSteps = [
10057
+ "Split the amount and Supply to configured Vesu pools",
10058
+ "Monitor and Rebalance funds across multiple Vesu pools to maximize yield",
10059
+ "Harvest and supply Defi Spring STRK rewards every week (Auto-compound)"
10060
+ ];
10061
+ });
10008
10062
 
10009
10063
  // src/strategies/ekubo-cl-vault.tsx
10010
10064
  import {
@@ -14913,7 +14967,7 @@ var erc4626_abi_default = [
14913
14967
  ];
14914
14968
 
14915
14969
  // src/strategies/ekubo-cl-vault.tsx
14916
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
14970
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
14917
14971
  var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
14918
14972
  /**
14919
14973
  * Creates a new VesuRebalance strategy instance.
@@ -15320,18 +15374,16 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
15320
15374
  console.log(
15321
15375
  `EkuboCLVault: getCurrentPrice: blockIdentifier: ${blockIdentifier}, sqrtRatio: ${sqrtRatio}, ${priceInfo.sqrt_ratio.toString()}`
15322
15376
  );
15323
- const price = sqrtRatio * sqrtRatio;
15324
- const tick = _EkuboCLVault.priceToTick(
15325
- price,
15326
- true,
15327
- Number(poolKey.tick_spacing)
15328
- );
15377
+ const token0Info = await Global.getTokenInfoFromAddr(poolKey.token0);
15378
+ const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
15379
+ const price = sqrtRatio * sqrtRatio * 10 ** token0Info.decimals / 10 ** token1Info.decimals;
15380
+ const tick = priceInfo.tick;
15329
15381
  console.log(
15330
15382
  `EkuboCLVault: getCurrentPrice: blockIdentifier: ${blockIdentifier}, price: ${price}, tick: ${tick.mag}, ${tick.sign}`
15331
15383
  );
15332
15384
  return {
15333
15385
  price,
15334
- tick: tick.mag * (tick.sign == 0 ? 1 : -1),
15386
+ tick: Number(tick.mag) * (tick.sign ? -1 : 1),
15335
15387
  sqrtRatio: priceInfo.sqrt_ratio.toString()
15336
15388
  };
15337
15389
  }
@@ -15978,14 +16030,15 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
15978
16030
  return [baseFlow, rebalanceFlow];
15979
16031
  }
15980
16032
  };
15981
- var _description2 = "Deploys your {{POOL_NAME}} into an Ekubo liquidity pool, automatically rebalancing positions around the current price to optimize yield and reduce the need for manual adjustments. Trading fees and DeFi Spring rewards are automatically compounded back into the strategy. In return, you receive an ERC-20 token representing your share of the strategy. The APY is calculated based on 7-day historical performance.";
16033
+ var _description2 = "Deploys your {{POOL_NAME}} into an Ekubo liquidity pool, automatically rebalancing positions around the current price to optimize yield and reduce the need for manual adjustments. Trading fees and DeFi Spring rewards are automatically compounded back into the strategy. In return, you receive an ERC-20 token representing your share of the strategy";
15982
16034
  var _protocol2 = {
15983
16035
  name: "Ekubo",
15984
16036
  logo: "https://app.ekubo.org/favicon.ico"
15985
16037
  };
15986
16038
  var _riskFactor2 = [
15987
- { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25 },
15988
- { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 1, weight: 75 }
16039
+ { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 34, reason: "Audited smart contracts" },
16040
+ { type: "Impermanent Loss Risk" /* IMPERMANENT_LOSS */, value: 0.75, weight: 33, reason: "Low risk due to co-related assets" },
16041
+ { type: "Market Risk" /* MARKET_RISK */, value: 0.75, weight: 33, reason: "Low risk due to co-related assets" }
15989
16042
  ];
15990
16043
  var _riskFactorStable = [
15991
16044
  { type: "Smart Contract Risk" /* SMART_CONTRACT_RISK */, value: 0.5, weight: 25 }
@@ -16009,7 +16062,7 @@ var faqs2 = [
16009
16062
  answer: /* @__PURE__ */ jsxs2("div", { children: [
16010
16063
  "Yes, the strategy has been audited. You can review the audit report in our docs",
16011
16064
  " ",
16012
- /* @__PURE__ */ jsx2(
16065
+ /* @__PURE__ */ jsx3(
16013
16066
  "a",
16014
16067
  {
16015
16068
  href: "https://docs.strkfarm.com/p/ekubo-cl-vaults#technical-details",
@@ -16023,23 +16076,7 @@ var faqs2 = [
16023
16076
  ];
16024
16077
  var xSTRKSTRK = {
16025
16078
  name: "Ekubo xSTRK/STRK",
16026
- description: /* @__PURE__ */ jsxs2("div", { children: [
16027
- /* @__PURE__ */ jsx2("p", { children: _description2.replace("{{POOL_NAME}}", "xSTRK/STRK") }),
16028
- /* @__PURE__ */ jsxs2(
16029
- "ul",
16030
- {
16031
- style: {
16032
- marginLeft: "20px",
16033
- listStyle: "circle",
16034
- fontSize: "12px"
16035
- },
16036
- children: [
16037
- /* @__PURE__ */ jsx2("li", { style: { marginTop: "10px" }, children: "During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices." }),
16038
- /* @__PURE__ */ jsx2("li", { style: { marginTop: "10px" }, children: "Sometimes you might see a negative APY \u2014 this is usually not a big deal. It happens when xSTRK's price drops on DEXes, but things typically bounce back within a few days or a week." })
16039
- ]
16040
- }
16041
- )
16042
- ] }),
16079
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16043
16080
  address: ContractAddr.from(
16044
16081
  "0x01f083b98674bc21effee29ef443a00c7b9a500fd92cf30341a3da12c73f2324"
16045
16082
  ),
@@ -16085,48 +16122,25 @@ var xSTRKSTRK = {
16085
16122
  multiplier: 1,
16086
16123
  logo: "https://endur.fi/favicon.ico",
16087
16124
  toolTip: "This strategy holds xSTRK and STRK tokens. Earn 1x Endur points on your xSTRK portion of Liquidity. STRK portion will earn Endur's DEX Bonus points. Points can be found on endur.fi."
16088
- }]
16125
+ }],
16126
+ contractDetails: [],
16127
+ investmentSteps: []
16089
16128
  };
16090
16129
  var EkuboCLVaultStrategies = [
16091
16130
  xSTRKSTRK,
16092
16131
  {
16132
+ ...xSTRKSTRK,
16093
16133
  name: "Ekubo USDC/USDT",
16094
- description: /* @__PURE__ */ jsxs2("div", { children: [
16095
- /* @__PURE__ */ jsx2("p", { children: _description2.replace("{{POOL_NAME}}", "USDC/USDT") }),
16096
- /* @__PURE__ */ jsx2(
16097
- "ul",
16098
- {
16099
- style: {
16100
- marginLeft: "20px",
16101
- listStyle: "circle",
16102
- fontSize: "12px"
16103
- },
16104
- children: /* @__PURE__ */ jsx2("li", { style: { marginTop: "10px" }, children: "During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices." })
16105
- }
16106
- )
16107
- ] }),
16134
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16108
16135
  address: ContractAddr.from(
16109
16136
  "0xd647ed735f0db52f2a5502b6e06ed21dc4284a43a36af4b60d3c80fbc56c91"
16110
16137
  ),
16111
16138
  launchBlock: 1385576,
16112
- type: "Other",
16113
16139
  // must be same order as poolKey token0 and token1
16114
16140
  depositTokens: [
16115
16141
  Global.getDefaultTokens().find((t) => t.symbol === "USDC"),
16116
16142
  Global.getDefaultTokens().find((t) => t.symbol === "USDT")
16117
16143
  ],
16118
- protocols: [_protocol2],
16119
- auditUrl: AUDIT_URL2,
16120
- maxTVL: Web3Number.fromWei("0", 6),
16121
- risk: {
16122
- riskFactor: _riskFactorStable,
16123
- netRisk: _riskFactorStable.reduce(
16124
- (acc, curr) => acc + curr.value * curr.weight,
16125
- 0
16126
- ) / _riskFactorStable.reduce((acc, curr) => acc + curr.weight, 0),
16127
- notARisks: getNoRiskTags(_riskFactorStable)
16128
- },
16129
- apyMethodology: "APY based on 7-day historical performance, including fees and rewards.",
16130
16144
  additionalInfo: {
16131
16145
  newBounds: {
16132
16146
  lower: -1,
@@ -16139,51 +16153,71 @@ var EkuboCLVaultStrategies = [
16139
16153
  minWaitHours: 6,
16140
16154
  direction: "any"
16141
16155
  }
16142
- },
16143
- faqs: [...faqs2]
16156
+ }
16157
+ },
16158
+ {
16159
+ ...xSTRKSTRK,
16160
+ name: "Ekubo STRK/USDC",
16161
+ description: /* @__PURE__ */ jsx3(Fragment2, {}),
16162
+ address: ContractAddr.from(
16163
+ "0xb7bd37121041261446d8eedec618955a4490641034942da688e8cbddea7b23"
16164
+ ),
16165
+ launchBlock: 1492136,
16166
+ // must be same order as poolKey token0 and token1
16167
+ depositTokens: [
16168
+ Global.getDefaultTokens().find((t) => t.symbol === "STRK"),
16169
+ Global.getDefaultTokens().find((t) => t.symbol === "USDC")
16170
+ ],
16171
+ maxTVL: Web3Number.fromWei("0", 6),
16172
+ additionalInfo: {
16173
+ newBounds: "Managed by Re7",
16174
+ feeBps: 1e3,
16175
+ rebalanceConditions: {
16176
+ customShouldRebalance: async (currentPrice) => true,
16177
+ minWaitHours: 6,
16178
+ direction: "any"
16179
+ }
16180
+ }
16144
16181
  }
16145
- // {
16146
- // ...xSTRKSTRK,
16147
- // name: "Ekubo STRK/USDC",
16148
- // description: (
16149
- // <div>
16150
- // <p>{_description.replace("{{POOL_NAME}}", "STRK/USDC")}</p>
16151
- // <ul
16152
- // style={{
16153
- // marginLeft: "20px",
16154
- // listStyle: "circle",
16155
- // fontSize: "12px",
16156
- // }}
16157
- // >
16158
- // <li style={{ marginTop: "10px" }}>
16159
- // During withdrawal, you may receive either or both tokens depending
16160
- // on market conditions and prevailing prices.
16161
- // </li>
16162
- // </ul>
16163
- // </div>
16164
- // ),
16165
- // address: ContractAddr.from(
16166
- // "0xb7bd37121041261446d8eedec618955a4490641034942da688e8cbddea7b23"
16167
- // ),
16168
- // launchBlock: 1492136,
16169
- // // must be same order as poolKey token0 and token1
16170
- // depositTokens: [
16171
- // Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
16172
- // Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
16173
- // ],
16174
- // maxTVL: Web3Number.fromWei("0", 6),
16175
- // additionalInfo: {
16176
- // newBounds: "Managed by Re7",
16177
- // feeBps: 1000,
16178
- // rebalanceConditions: {
16179
- // customShouldRebalance: async (currentPrice: number) =>
16180
- // true,
16181
- // minWaitHours: 6,
16182
- // direction: "any",
16183
- // },
16184
- // },
16185
- // },
16186
16182
  ];
16183
+ EkuboCLVaultStrategies.forEach((s) => {
16184
+ s.contractDetails = [
16185
+ {
16186
+ address: s.address,
16187
+ name: "Vault",
16188
+ sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/tree/main/src/strategies/cl_vault"
16189
+ },
16190
+ ...COMMON_CONTRACTS
16191
+ ];
16192
+ s.docs = "https://docs.strkfarm.com/p/ekubo-cl-vaults";
16193
+ s.description = /* @__PURE__ */ jsxs2("div", { children: [
16194
+ /* @__PURE__ */ jsx3("p", { children: highlightTextWithLinks(
16195
+ _description2.replace("{{POOL_NAME}}", s.name.split(" ")[1]),
16196
+ [{
16197
+ highlight: "Ekubo liquidity pool",
16198
+ link: "https://app.ekubo.org/positions"
16199
+ }, {
16200
+ highlight: "DeFi Spring rewards",
16201
+ link: "https://defispring.starknet.io/"
16202
+ }, {
16203
+ highlight: "ERC-20 token",
16204
+ link: "https://www.investopedia.com/news/what-erc20-and-what-does-it-mean-ethereum/"
16205
+ }]
16206
+ ) }),
16207
+ /* @__PURE__ */ jsxs2("div", { style: { padding: "16px 16px", background: "var(--chakra-colors-mycard_light)", marginTop: "16px", borderRadius: "16px" }, children: [
16208
+ /* @__PURE__ */ jsx3("h4", { style: { fontWeight: "bold" }, children: "Key points to note:" }),
16209
+ /* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: "10px", color: "var(--chakra-colors-text_secondary)" }, children: [
16210
+ /* @__PURE__ */ jsx3("p", { style: {}, children: "1. During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices." }),
16211
+ s.name.includes("xSTRK/STRK") && /* @__PURE__ */ jsx3("p", { style: {}, children: "2. Sometimes you might see a negative APY \u2014 this is usually not a big deal. It happens when xSTRK's price drops on DEXes, but things typically bounce back within a few days or a week." })
16212
+ ] })
16213
+ ] })
16214
+ ] });
16215
+ s.investmentSteps = [
16216
+ "Supply tokens to Ekubo's pool",
16217
+ "Monitor and Rebalance position to optimize yield",
16218
+ "Harvest and supply Defi Spring STRK rewards every week (Auto-compound)"
16219
+ ];
16220
+ });
16187
16221
 
16188
16222
  // src/notifs/telegram.ts
16189
16223
  import TelegramBot from "node-telegram-bot-api";
@@ -16480,5 +16514,6 @@ export {
16480
16514
  getNoRiskTags,
16481
16515
  getRiskColor,
16482
16516
  getRiskExplaination,
16517
+ highlightTextWithLinks,
16483
16518
  logger
16484
16519
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strkfarm/sdk",
3
- "version": "1.0.46",
3
+ "version": "1.0.49",
4
4
  "description": "STRKFarm TS SDK (Meant for our internal use, but feel free to use it)",
5
5
  "typings": "dist/index.d.ts",
6
6
  "types": "dist/index.d.ts",
@@ -56,7 +56,7 @@
56
56
  "axios": "^1.7.2"
57
57
  },
58
58
  "dependencies": {
59
- "@avnu/avnu-sdk": "^3.0.2",
59
+ "@avnu/avnu-sdk": "3.0.2",
60
60
  "bignumber.js": "4.0.4",
61
61
  "browser-assert": "^1.2.1",
62
62
  "chalk": "^4.1.2",
@@ -1,6 +1,6 @@
1
1
  import { ContractAddr, Web3Number } from "@/dataTypes";
2
2
  import { BlockIdentifier, RpcProvider } from "starknet";
3
- import React from "react";
3
+ import React, { ReactNode } from "react";
4
4
 
5
5
  export enum RiskType {
6
6
  MARKET_RISK = "Market Risk",
@@ -21,6 +21,7 @@ export interface RiskFactor {
21
21
  type: RiskType;
22
22
  value: number; // 0 to 5
23
23
  weight: number; // 0 to 100
24
+ reason?: string; // optional reason for the risk factor
24
25
  }
25
26
 
26
27
  export interface TokenInfo {
@@ -79,12 +80,19 @@ export interface IStrategyMetadata<T> {
79
80
  risk: {
80
81
  riskFactor: RiskFactor[];
81
82
  netRisk: number;
82
- notARisks: string[];
83
+ notARisks: RiskType[];
83
84
  };
84
85
  apyMethodology?: string;
85
86
  additionalInfo: T;
87
+ contractDetails: {
88
+ address: ContractAddr;
89
+ name: string;
90
+ sourceCodeUrl?: string;
91
+ }[],
86
92
  faqs: FAQ[];
87
93
  points?: {multiplier: number, logo: string, toolTip?: string}[];
94
+ docs?: string;
95
+ investmentSteps: string[];
88
96
  }
89
97
 
90
98
  export interface IInvestmentFlow {
@@ -132,8 +140,8 @@ export const getRiskExplaination = (riskType: RiskType) => {
132
140
 
133
141
  export const getRiskColor = (risk: RiskFactor) => {
134
142
  const value = risk.value;
135
- if (value === 0) return "green";
136
- if (value < 2.5) return "yellow";
143
+ if (value <= 1) return "light_green_2";
144
+ if (value < 3) return "yellow";
137
145
  return "red";
138
146
  };
139
147
 
@@ -150,5 +158,42 @@ export const getNoRiskTags = (risks: RiskFactor[]) => {
150
158
  const mergedUnique = [...new Set([...noRisks1, ...noRisks2])];
151
159
 
152
160
  // add `No` to the start of each risk
153
- return mergedUnique.map((risk) => `No ${risk}`);
161
+ return mergedUnique
154
162
  };
163
+
164
+ interface HighlightLink {
165
+ highlight: string;
166
+ link: string;
167
+ }
168
+
169
+ export function highlightTextWithLinks(
170
+ put: string,
171
+ highlights: HighlightLink[],
172
+ ): ReactNode {
173
+ // Escape RegExp special characters in highlight strings
174
+ const escapeRegExp = (text: string) =>
175
+ text.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
176
+
177
+ // Create a single regex for all highlight terms
178
+ const pattern = new RegExp(
179
+ `(${highlights.map(m => escapeRegExp(m.highlight)).join('|')})`,
180
+ 'gi'
181
+ );
182
+
183
+ const parts = put.split(pattern);
184
+
185
+ return (
186
+ <>
187
+ {parts.map((part, i) => {
188
+ const match = highlights.find(m => m.highlight.toLowerCase() === part.toLowerCase());
189
+ return match ? (
190
+ <a key={i} href={match.link} target="_blank" style={{ color: 'var(--chakra-colors-white)', background: 'var(--chakra-colors-highlight)' }}>
191
+ {part}
192
+ </a>
193
+ ) : (
194
+ <span key={i}>{part}</span>
195
+ );
196
+ })}
197
+ </>
198
+ );
199
+ }
@@ -0,0 +1,7 @@
1
+ import { ContractAddr } from "@/dataTypes";
2
+
3
+ export const COMMON_CONTRACTS = [{
4
+ address: ContractAddr.from("0x0636a3f51cc37f5729e4da4b1de6a8549a28f3c0d5bf3b17f150971e451ff9c2"),
5
+ name: "Access Controller",
6
+ sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/blob/main/src/components/accessControl.cairo",
7
+ }];