@strkfarm/sdk 1.0.47 → 1.0.51

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.
@@ -42,7 +42,7 @@ export class PricerFromApi extends PricerBase {
42
42
 
43
43
  async getPriceFromMyAPI(tokenSymbol: string) {
44
44
  logger.verbose(`getPrice from redis: ${tokenSymbol}`);
45
- const endpoint = 'https://app.strkfarm.com'
45
+ const endpoint = 'https://app.troves.fi'
46
46
  const url = `${endpoint}/api/price/${tokenSymbol}`;
47
47
  const priceInfoRes = await fetch(url);
48
48
  const priceInfo = await priceInfoRes.json();
@@ -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
+ }];
@@ -3,6 +3,7 @@ import {
3
3
  FAQ,
4
4
  FlowChartColors,
5
5
  getNoRiskTags,
6
+ highlightTextWithLinks,
6
7
  IConfig,
7
8
  IInvestmentFlow,
8
9
  IProtocol,
@@ -32,6 +33,7 @@ import { DualTokenInfo } from "./base-strategy";
32
33
  import { log } from "winston";
33
34
  import { EkuboHarvests } from "@/modules/harvests";
34
35
  import { logger } from "@/utils/logger";
36
+ import { COMMON_CONTRACTS } from "./constants";
35
37
 
36
38
  export interface EkuboPoolKey {
37
39
  token0: ContractAddr;
@@ -564,7 +566,7 @@ export class EkuboCLVault extends BaseStrategy<
564
566
  return this._getCurrentPrice(poolKey, blockIdentifier);
565
567
  }
566
568
 
567
- private async _getCurrentPrice(
569
+ async _getCurrentPrice(
568
570
  poolKey: EkuboPoolKey,
569
571
  blockIdentifier: BlockIdentifier = "pending"
570
572
  ) {
@@ -592,17 +594,13 @@ export class EkuboCLVault extends BaseStrategy<
592
594
  const token0Info = await Global.getTokenInfoFromAddr(poolKey.token0);
593
595
  const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
594
596
  const price = sqrtRatio * sqrtRatio * (10 ** token0Info.decimals) / ( 10 ** token1Info.decimals);
595
- const tick = EkuboCLVault.priceToTick(
596
- price,
597
- true,
598
- Number(poolKey.tick_spacing)
599
- );
597
+ const tick = priceInfo.tick;
600
598
  console.log(
601
599
  `EkuboCLVault: getCurrentPrice: blockIdentifier: ${blockIdentifier}, price: ${price}, tick: ${tick.mag}, ${tick.sign}`
602
600
  );
603
601
  return {
604
602
  price,
605
- tick: tick.mag * (tick.sign == 0 ? 1 : -1),
603
+ tick: Number(tick.mag) * (tick.sign ? -1 : 1),
606
604
  sqrtRatio: priceInfo.sqrt_ratio.toString(),
607
605
  };
608
606
  }
@@ -1507,22 +1505,23 @@ export class EkuboCLVault extends BaseStrategy<
1507
1505
  }
1508
1506
 
1509
1507
  const _description =
1510
- "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.";
1508
+ "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";
1511
1509
  const _protocol: IProtocol = {
1512
1510
  name: "Ekubo",
1513
1511
  logo: "https://app.ekubo.org/favicon.ico",
1514
1512
  };
1515
1513
  // need to fine tune better
1516
1514
  const _riskFactor: RiskFactor[] = [
1517
- { type: RiskType.SMART_CONTRACT_RISK, value: 0.5, weight: 25 },
1518
- { type: RiskType.IMPERMANENT_LOSS, value: 1, weight: 75 },
1515
+ { type: RiskType.SMART_CONTRACT_RISK, value: 0.5, weight: 34, reason: "Audited smart contracts" },
1516
+ { type: RiskType.IMPERMANENT_LOSS, value: 0.75, weight: 33, reason: "Low risk due to co-related assets" },
1517
+ { type: RiskType.MARKET_RISK, value: 0.75, weight: 33, reason: "Low risk due to co-related assets" },
1519
1518
  ];
1520
1519
 
1521
1520
  const _riskFactorStable: RiskFactor[] = [
1522
1521
  { type: RiskType.SMART_CONTRACT_RISK, value: 0.5, weight: 25 },
1523
1522
  ];
1524
1523
  const AUDIT_URL =
1525
- "https://assets.strkfarm.com/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
1524
+ "https://assets.troves.fi/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
1526
1525
 
1527
1526
  const faqs: FAQ[] = [
1528
1527
  {
@@ -1547,7 +1546,7 @@ const faqs: FAQ[] = [
1547
1546
  Yes, the strategy has been audited. You can review the audit report in
1548
1547
  our docs{" "}
1549
1548
  <a
1550
- href="https://docs.strkfarm.com/p/ekubo-cl-vaults#technical-details"
1549
+ href="https://docs.troves.fi/p/ekubo-cl-vaults#technical-details"
1551
1550
  style={{ textDecoration: "underline", marginLeft: "5px" }}
1552
1551
  >
1553
1552
  Here
@@ -1560,28 +1559,7 @@ const faqs: FAQ[] = [
1560
1559
 
1561
1560
  const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
1562
1561
  name: "Ekubo xSTRK/STRK",
1563
- description: (
1564
- <div>
1565
- <p>{_description.replace("{{POOL_NAME}}", "xSTRK/STRK")}</p>
1566
- <ul
1567
- style={{
1568
- marginLeft: "20px",
1569
- listStyle: "circle",
1570
- fontSize: "12px",
1571
- }}
1572
- >
1573
- <li style={{ marginTop: "10px" }}>
1574
- During withdrawal, you may receive either or both tokens depending
1575
- on market conditions and prevailing prices.
1576
- </li>
1577
- <li style={{ marginTop: "10px" }}>
1578
- Sometimes you might see a negative APY — this is usually not a big
1579
- deal. It happens when xSTRK's price drops on DEXes, but things
1580
- typically bounce back within a few days or a week.
1581
- </li>
1582
- </ul>
1583
- </div>
1584
- ),
1562
+ description: <></>,
1585
1563
  address: ContractAddr.from(
1586
1564
  "0x01f083b98674bc21effee29ef443a00c7b9a500fd92cf30341a3da12c73f2324"
1587
1565
  ),
@@ -1631,7 +1609,9 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
1631
1609
  multiplier: 1,
1632
1610
  logo: 'https://endur.fi/favicon.ico',
1633
1611
  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.",
1634
- }]
1612
+ }],
1613
+ contractDetails: [],
1614
+ investmentSteps: []
1635
1615
  };
1636
1616
 
1637
1617
  /**
@@ -1641,48 +1621,18 @@ export const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[
1641
1621
  [
1642
1622
  xSTRKSTRK,
1643
1623
  {
1624
+ ...xSTRKSTRK,
1644
1625
  name: "Ekubo USDC/USDT",
1645
- description: (
1646
- <div>
1647
- <p>{_description.replace("{{POOL_NAME}}", "USDC/USDT")}</p>
1648
- <ul
1649
- style={{
1650
- marginLeft: "20px",
1651
- listStyle: "circle",
1652
- fontSize: "12px",
1653
- }}
1654
- >
1655
- <li style={{ marginTop: "10px" }}>
1656
- During withdrawal, you may receive either or both tokens depending
1657
- on market conditions and prevailing prices.
1658
- </li>
1659
- </ul>
1660
- </div>
1661
- ),
1626
+ description: <></>,
1662
1627
  address: ContractAddr.from(
1663
1628
  "0xd647ed735f0db52f2a5502b6e06ed21dc4284a43a36af4b60d3c80fbc56c91"
1664
1629
  ),
1665
1630
  launchBlock: 1385576,
1666
- type: "Other",
1667
1631
  // must be same order as poolKey token0 and token1
1668
1632
  depositTokens: [
1669
1633
  Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
1670
1634
  Global.getDefaultTokens().find((t) => t.symbol === "USDT")!,
1671
1635
  ],
1672
- protocols: [_protocol],
1673
- auditUrl: AUDIT_URL,
1674
- maxTVL: Web3Number.fromWei("0", 6),
1675
- risk: {
1676
- riskFactor: _riskFactorStable,
1677
- netRisk:
1678
- _riskFactorStable.reduce(
1679
- (acc, curr) => acc + curr.value * curr.weight,
1680
- 0
1681
- ) / _riskFactorStable.reduce((acc, curr) => acc + curr.weight, 0),
1682
- notARisks: getNoRiskTags(_riskFactorStable),
1683
- },
1684
- apyMethodology:
1685
- "APY based on 7-day historical performance, including fees and rewards.",
1686
1636
  additionalInfo: {
1687
1637
  newBounds: {
1688
1638
  lower: -1,
@@ -1697,48 +1647,82 @@ export const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[
1697
1647
  direction: "any",
1698
1648
  },
1699
1649
  },
1700
- faqs: [...faqs],
1701
1650
  },
1702
- // {
1703
- // ...xSTRKSTRK,
1704
- // name: "Ekubo STRK/USDC",
1705
- // description: (
1706
- // <div>
1707
- // <p>{_description.replace("{{POOL_NAME}}", "STRK/USDC")}</p>
1708
- // <ul
1709
- // style={{
1710
- // marginLeft: "20px",
1711
- // listStyle: "circle",
1712
- // fontSize: "12px",
1713
- // }}
1714
- // >
1715
- // <li style={{ marginTop: "10px" }}>
1716
- // During withdrawal, you may receive either or both tokens depending
1717
- // on market conditions and prevailing prices.
1718
- // </li>
1719
- // </ul>
1720
- // </div>
1721
- // ),
1722
- // address: ContractAddr.from(
1723
- // "0xb7bd37121041261446d8eedec618955a4490641034942da688e8cbddea7b23"
1724
- // ),
1725
- // launchBlock: 1492136,
1726
- // // must be same order as poolKey token0 and token1
1727
- // depositTokens: [
1728
- // Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
1729
- // Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
1730
- // ],
1731
- // maxTVL: Web3Number.fromWei("0", 6),
1732
- // additionalInfo: {
1733
- // newBounds: "Managed by Re7",
1734
- // feeBps: 1000,
1735
- // rebalanceConditions: {
1736
- // customShouldRebalance: async (currentPrice: number) =>
1737
- // true,
1738
- // minWaitHours: 6,
1739
- // direction: "any",
1740
- // },
1741
- // },
1742
- // },
1651
+ {
1652
+ ...xSTRKSTRK,
1653
+ name: "Ekubo STRK/USDC",
1654
+ description: <></>,
1655
+ address: ContractAddr.from(
1656
+ "0xb7bd37121041261446d8eedec618955a4490641034942da688e8cbddea7b23"
1657
+ ),
1658
+ launchBlock: 1492136,
1659
+ // must be same order as poolKey token0 and token1
1660
+ depositTokens: [
1661
+ Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
1662
+ Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
1663
+ ],
1664
+ maxTVL: Web3Number.fromWei("0", 6),
1665
+ additionalInfo: {
1666
+ newBounds: "Managed by Re7",
1667
+ feeBps: 1000,
1668
+ rebalanceConditions: {
1669
+ customShouldRebalance: async (currentPrice: number) =>
1670
+ true,
1671
+ minWaitHours: 6,
1672
+ direction: "any",
1673
+ },
1674
+ },
1675
+ },
1743
1676
  ];
1744
1677
 
1678
+ // auto assign contract details to each strategy
1679
+ EkuboCLVaultStrategies.forEach((s) => {
1680
+ // set contract details
1681
+ s.contractDetails = [{
1682
+ address: s.address,
1683
+ name: "Vault",
1684
+ sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/tree/main/src/strategies/cl_vault"
1685
+ },
1686
+ ...COMMON_CONTRACTS];
1687
+ // set docs link
1688
+ s.docs = "https://docs.troves.fi/p/ekubo-cl-vaults"
1689
+
1690
+ // set description
1691
+ s.description = (
1692
+ <div>
1693
+ <p>{highlightTextWithLinks(
1694
+ _description.replace("{{POOL_NAME}}", s.name.split(" ")[1]),
1695
+ [{
1696
+ highlight: "Ekubo liquidity pool",
1697
+ link: "https://app.ekubo.org/positions",
1698
+ }, {
1699
+ highlight: "DeFi Spring rewards",
1700
+ link: "https://defispring.starknet.io/"
1701
+ }, {
1702
+ highlight: "ERC-20 token",
1703
+ link: "https://www.investopedia.com/news/what-erc20-and-what-does-it-mean-ethereum/"
1704
+ }]
1705
+ )}
1706
+ </p>
1707
+ <div style={{padding: '16px 16px', background: 'var(--chakra-colors-mycard_light)', marginTop: '16px', borderRadius: '16px'}}>
1708
+ <h4 style={{fontWeight: 'bold'}}>Key points to note:</h4>
1709
+ <div style={{display: "flex", flexDirection: "column", gap: "10px", color: 'var(--chakra-colors-text_secondary)'}}>
1710
+ <p style={{}}>1. During withdrawal, you may receive either or both tokens depending
1711
+ on market conditions and prevailing prices.</p>
1712
+ {s.name.includes('xSTRK/STRK') && <p style={{}}>
1713
+ 2. Sometimes you might see a negative APY — this is usually not a big
1714
+ deal. It happens when xSTRK's price drops on DEXes, but things
1715
+ typically bounce back within a few days or a week.
1716
+ </p>}
1717
+ </div>
1718
+ </div>
1719
+ </div>
1720
+ );
1721
+
1722
+ // add investment steps
1723
+ s.investmentSteps = [
1724
+ "Supply tokens to Ekubo's pool",
1725
+ "Monitor and Rebalance position to optimize yield",
1726
+ "Harvest and supply Defi Spring STRK rewards every week (Auto-compound)",
1727
+ ]
1728
+ });
@@ -1,4 +1,4 @@
1
1
  export * from './autoCompounderStrk';
2
2
  export * from './vesu-rebalance';
3
3
  export * from './ekubo-cl-vault';
4
- export * from './base-strategy';
4
+ export * from './base-strategy';
@@ -3,6 +3,7 @@ import {
3
3
  FAQ,
4
4
  FlowChartColors,
5
5
  getNoRiskTags,
6
+ highlightTextWithLinks,
6
7
  IConfig,
7
8
  IInvestmentFlow,
8
9
  IProtocol,
@@ -26,6 +27,7 @@ import {
26
27
  import { getAPIUsingHeadlessBrowser } from "@/node/headless";
27
28
  import { VesuHarvests } from "@/modules/harvests";
28
29
  import VesuPoolIDs from "@/data/vesu_pools.json";
30
+ import { COMMON_CONTRACTS } from "./constants";
29
31
 
30
32
  interface PoolProps {
31
33
  pool_id: ContractAddr;
@@ -882,20 +884,20 @@ export class VesuRebalance extends BaseStrategy<
882
884
  }
883
885
  }
884
886
 
885
- const _description =
886
- "Automatically diversify {{TOKEN}} holdings into different Vesu pools while reducing risk and maximizing yield. Defi spring STRK Rewards are auto-compounded as well.";
887
+ const _description = "Automatically diversify {{TOKEN}} holdings into different Vesu pools while reducing risk and maximizing yield. Defi spring STRK Rewards are auto-compounded as well.";
888
+
887
889
  const _protocol: IProtocol = {
888
890
  name: "Vesu",
889
891
  logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
890
892
  };
891
893
  // need to fine tune better
892
894
  const _riskFactor: RiskFactor[] = [
893
- { type: RiskType.SMART_CONTRACT_RISK, value: 0.5, weight: 25 },
894
- { type: RiskType.COUNTERPARTY_RISK, value: 1, weight: 50 },
895
- { type: RiskType.ORACLE_RISK, value: 0.5, weight: 25 }
895
+ { type: RiskType.SMART_CONTRACT_RISK, value: 0.5, weight: 25, reason: "Audited by CSC" },
896
+ { type: RiskType.COUNTERPARTY_RISK, value: 1, weight: 50, reason: "Reasonable max LTV ratios and Curated by well-known risk managers like Re7" },
897
+ { type: RiskType.ORACLE_RISK, value: 0.5, weight: 25, reason: "Uses Pragma price feeds, Most reputable price feed on Starknet" }
896
898
  ];
897
899
  const AUDIT_URL =
898
- "https://assets.strkfarm.com/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
900
+ "https://assets.troves.fi/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
899
901
 
900
902
  const faqs: FAQ[] = [
901
903
  {
@@ -940,7 +942,7 @@ const faqs: FAQ[] = [
940
942
  {
941
943
  question: "Is the strategy audited?",
942
944
  answer:
943
- <div>Yes, the strategy has been audited. You can review the audit report in our docs <a href="https://docs.strkfarm.com/p/strategies/vesu-fusion-rebalancing-vaults#technical-details" style={{textDecoration: 'underline', marginLeft: '5px'}}>Here</a>.</div>
945
+ <div>Yes, the strategy has been audited. You can review the audit report in our docs <a href="https://docs.troves.fi/p/strategies/vesu-fusion-rebalancing-vaults#technical-details" style={{textDecoration: 'underline', marginLeft: '5px'}}>Here</a>.</div>
944
946
  }
945
947
  ];
946
948
 
@@ -951,7 +953,7 @@ export const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[]
951
953
  [
952
954
  {
953
955
  name: "Vesu Fusion STRK",
954
- description: _description.replace("{{TOKEN}}", "STRK"),
956
+ description: _description,
955
957
  address: ContractAddr.from(
956
958
  "0x7fb5bcb8525954a60fde4e8fb8220477696ce7117ef264775a1770e23571929"
957
959
  ),
@@ -973,7 +975,9 @@ export const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[]
973
975
  additionalInfo: {
974
976
  feeBps: 1000
975
977
  },
976
- faqs
978
+ faqs,
979
+ contractDetails: [],
980
+ investmentSteps: []
977
981
  },
978
982
  {
979
983
  name: "Vesu Fusion ETH",
@@ -999,7 +1003,9 @@ export const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[]
999
1003
  additionalInfo: {
1000
1004
  feeBps: 1000
1001
1005
  },
1002
- faqs
1006
+ faqs,
1007
+ contractDetails: [],
1008
+ investmentSteps: []
1003
1009
  },
1004
1010
  {
1005
1011
  name: "Vesu Fusion USDC",
@@ -1025,7 +1031,9 @@ export const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[]
1025
1031
  additionalInfo: {
1026
1032
  feeBps: 1000
1027
1033
  },
1028
- faqs
1034
+ faqs,
1035
+ contractDetails: [],
1036
+ investmentSteps: []
1029
1037
  },
1030
1038
  {
1031
1039
  name: "Vesu Fusion USDT",
@@ -1051,7 +1059,9 @@ export const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[]
1051
1059
  additionalInfo: {
1052
1060
  feeBps: 1000
1053
1061
  },
1054
- faqs
1062
+ faqs,
1063
+ contractDetails: [],
1064
+ investmentSteps: []
1055
1065
  // }, {
1056
1066
  // name: 'Vesu Fusion WBTC',
1057
1067
  // description: _description.replace('{{TOKEN}}', 'WBTC'),
@@ -1068,5 +1078,38 @@ export const VesuRebalanceStrategies: IStrategyMetadata<VesuRebalanceSettings>[]
1068
1078
  // additionalInfo: {
1069
1079
  // feeBps: 1000,
1070
1080
  // },
1081
+
1071
1082
  }
1072
- ];
1083
+ ];
1084
+
1085
+ // auto assign contract details to each strategy
1086
+ VesuRebalanceStrategies.forEach((s) => {
1087
+ // set contract details
1088
+ s.contractDetails = [{
1089
+ address: s.address,
1090
+ name: "Vault",
1091
+ sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/tree/main/src/strategies/vesu_rebalance"
1092
+ },
1093
+ ...COMMON_CONTRACTS];
1094
+ // set docs link
1095
+ s.docs = "https://docs.troves.fi/p/strategies/vesu-fusion-rebalancing-vaults"
1096
+
1097
+ // set description
1098
+ s.description = highlightTextWithLinks(
1099
+ _description.replace("{{TOKEN}}", s.depositTokens[0].symbol),
1100
+ [{
1101
+ highlight: "Vesu pools",
1102
+ link: "https://vesu.xyz/pools",
1103
+ }, {
1104
+ highlight: "Defi spring STRK Rewards",
1105
+ link: "https://defispring.starknet.io/"
1106
+ }]
1107
+ );
1108
+
1109
+ // add investment steps
1110
+ s.investmentSteps = [
1111
+ "Split the amount and Supply to configured Vesu pools",
1112
+ "Monitor and Rebalance funds across multiple Vesu pools to maximize yield",
1113
+ "Harvest and supply Defi Spring STRK rewards every week (Auto-compound)",
1114
+ ]
1115
+ });