@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.
@@ -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;
@@ -589,18 +591,16 @@ export class EkuboCLVault extends BaseStrategy<
589
591
  console.log(
590
592
  `EkuboCLVault: getCurrentPrice: blockIdentifier: ${blockIdentifier}, sqrtRatio: ${sqrtRatio}, ${priceInfo.sqrt_ratio.toString()}`
591
593
  );
592
- const price = sqrtRatio * sqrtRatio;
593
- const tick = EkuboCLVault.priceToTick(
594
- price,
595
- true,
596
- Number(poolKey.tick_spacing)
597
- );
594
+ const token0Info = await Global.getTokenInfoFromAddr(poolKey.token0);
595
+ const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
596
+ const price = sqrtRatio * sqrtRatio * (10 ** token0Info.decimals) / ( 10 ** token1Info.decimals);
597
+ const tick = priceInfo.tick;
598
598
  console.log(
599
599
  `EkuboCLVault: getCurrentPrice: blockIdentifier: ${blockIdentifier}, price: ${price}, tick: ${tick.mag}, ${tick.sign}`
600
600
  );
601
601
  return {
602
602
  price,
603
- tick: tick.mag * (tick.sign == 0 ? 1 : -1),
603
+ tick: Number(tick.mag) * (tick.sign ? -1 : 1),
604
604
  sqrtRatio: priceInfo.sqrt_ratio.toString(),
605
605
  };
606
606
  }
@@ -1505,15 +1505,16 @@ export class EkuboCLVault extends BaseStrategy<
1505
1505
  }
1506
1506
 
1507
1507
  const _description =
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. 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";
1509
1509
  const _protocol: IProtocol = {
1510
1510
  name: "Ekubo",
1511
1511
  logo: "https://app.ekubo.org/favicon.ico",
1512
1512
  };
1513
1513
  // need to fine tune better
1514
1514
  const _riskFactor: RiskFactor[] = [
1515
- { type: RiskType.SMART_CONTRACT_RISK, value: 0.5, weight: 25 },
1516
- { 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" },
1517
1518
  ];
1518
1519
 
1519
1520
  const _riskFactorStable: RiskFactor[] = [
@@ -1558,28 +1559,7 @@ const faqs: FAQ[] = [
1558
1559
 
1559
1560
  const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
1560
1561
  name: "Ekubo xSTRK/STRK",
1561
- description: (
1562
- <div>
1563
- <p>{_description.replace("{{POOL_NAME}}", "xSTRK/STRK")}</p>
1564
- <ul
1565
- style={{
1566
- marginLeft: "20px",
1567
- listStyle: "circle",
1568
- fontSize: "12px",
1569
- }}
1570
- >
1571
- <li style={{ marginTop: "10px" }}>
1572
- During withdrawal, you may receive either or both tokens depending
1573
- on market conditions and prevailing prices.
1574
- </li>
1575
- <li style={{ marginTop: "10px" }}>
1576
- Sometimes you might see a negative APY — this is usually not a big
1577
- deal. It happens when xSTRK's price drops on DEXes, but things
1578
- typically bounce back within a few days or a week.
1579
- </li>
1580
- </ul>
1581
- </div>
1582
- ),
1562
+ description: <></>,
1583
1563
  address: ContractAddr.from(
1584
1564
  "0x01f083b98674bc21effee29ef443a00c7b9a500fd92cf30341a3da12c73f2324"
1585
1565
  ),
@@ -1629,7 +1609,9 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
1629
1609
  multiplier: 1,
1630
1610
  logo: 'https://endur.fi/favicon.ico',
1631
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.",
1632
- }]
1612
+ }],
1613
+ contractDetails: [],
1614
+ investmentSteps: []
1633
1615
  };
1634
1616
 
1635
1617
  /**
@@ -1639,48 +1621,18 @@ export const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[
1639
1621
  [
1640
1622
  xSTRKSTRK,
1641
1623
  {
1624
+ ...xSTRKSTRK,
1642
1625
  name: "Ekubo USDC/USDT",
1643
- description: (
1644
- <div>
1645
- <p>{_description.replace("{{POOL_NAME}}", "USDC/USDT")}</p>
1646
- <ul
1647
- style={{
1648
- marginLeft: "20px",
1649
- listStyle: "circle",
1650
- fontSize: "12px",
1651
- }}
1652
- >
1653
- <li style={{ marginTop: "10px" }}>
1654
- During withdrawal, you may receive either or both tokens depending
1655
- on market conditions and prevailing prices.
1656
- </li>
1657
- </ul>
1658
- </div>
1659
- ),
1626
+ description: <></>,
1660
1627
  address: ContractAddr.from(
1661
1628
  "0xd647ed735f0db52f2a5502b6e06ed21dc4284a43a36af4b60d3c80fbc56c91"
1662
1629
  ),
1663
1630
  launchBlock: 1385576,
1664
- type: "Other",
1665
1631
  // must be same order as poolKey token0 and token1
1666
1632
  depositTokens: [
1667
1633
  Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
1668
1634
  Global.getDefaultTokens().find((t) => t.symbol === "USDT")!,
1669
1635
  ],
1670
- protocols: [_protocol],
1671
- auditUrl: AUDIT_URL,
1672
- maxTVL: Web3Number.fromWei("0", 6),
1673
- risk: {
1674
- riskFactor: _riskFactorStable,
1675
- netRisk:
1676
- _riskFactorStable.reduce(
1677
- (acc, curr) => acc + curr.value * curr.weight,
1678
- 0
1679
- ) / _riskFactorStable.reduce((acc, curr) => acc + curr.weight, 0),
1680
- notARisks: getNoRiskTags(_riskFactorStable),
1681
- },
1682
- apyMethodology:
1683
- "APY based on 7-day historical performance, including fees and rewards.",
1684
1636
  additionalInfo: {
1685
1637
  newBounds: {
1686
1638
  lower: -1,
@@ -1695,50 +1647,82 @@ export const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[
1695
1647
  direction: "any",
1696
1648
  },
1697
1649
  },
1698
- faqs: [...faqs],
1699
1650
  },
1700
- // {
1701
- // ...xSTRKSTRK,
1702
- // name: "Ekubo STRK/USDC",
1703
- // description: (
1704
- // <div>
1705
- // <p>{_description.replace("{{POOL_NAME}}", "STRK/USDC")}</p>
1706
- // <ul
1707
- // style={{
1708
- // marginLeft: "20px",
1709
- // listStyle: "circle",
1710
- // fontSize: "12px",
1711
- // }}
1712
- // >
1713
- // <li style={{ marginTop: "10px" }}>
1714
- // During withdrawal, you may receive either or both tokens depending
1715
- // on market conditions and prevailing prices.
1716
- // </li>
1717
- // </ul>
1718
- // </div>
1719
- // ),
1720
- // address: ContractAddr.from(
1721
- // "0xb7bd37121041261446d8eedec618955a4490641034942da688e8cbddea7b23"
1722
- // ),
1723
- // launchBlock: 1492136,
1724
- // // must be same order as poolKey token0 and token1
1725
- // depositTokens: [
1726
- // Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
1727
- // Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
1728
- // ],
1729
- // maxTVL: Web3Number.fromWei("0", 6),
1730
- // additionalInfo: {
1731
- // newBounds: "Managed by Re7",
1732
- // feeBps: 1000,
1733
- // rebalanceConditions: {
1734
- // customShouldRebalance: async (currentPrice: number) =>
1735
- // true,
1736
- // minWaitHours: 6,
1737
- // direction: "any",
1738
- // },
1739
- // },
1740
- // },
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
+ },
1741
1676
  ];
1742
1677
 
1743
-
1744
- // 0x65b6a3ae00e7343ca8b2463d81401716c6581c18336206f31085c06a7d63936
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.strkfarm.com/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,17 +884,17 @@ 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
900
  "https://assets.strkfarm.com/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
@@ -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.strkfarm.com/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
+ });