@strkfarm/sdk 1.1.4 → 1.1.5
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.browser.global.js +256 -115
- package/dist/index.browser.mjs +203 -64
- package/dist/index.d.ts +6 -1
- package/dist/index.js +206 -69
- package/dist/index.mjs +206 -69
- package/package.json +1 -1
- package/src/global.ts +19 -1
- package/src/interfaces/common.tsx +1 -0
- package/src/interfaces/risks.ts +175 -0
- package/src/notifs/telegram.ts +3 -3
- package/src/strategies/ekubo-cl-vault.tsx +201 -71
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
IStrategyMetadata,
|
|
11
11
|
RiskFactor,
|
|
12
12
|
RiskType,
|
|
13
|
+
TokenInfo,
|
|
13
14
|
} from "@/interfaces";
|
|
14
15
|
import { PricerBase } from "@/modules/pricerBase";
|
|
15
16
|
import { assert } from "@/utils";
|
|
@@ -34,6 +35,7 @@ import { log } from "winston";
|
|
|
34
35
|
import { EkuboHarvests } from "@/modules/harvests";
|
|
35
36
|
import { logger } from "@/utils/logger";
|
|
36
37
|
import { COMMON_CONTRACTS } from "./constants";
|
|
38
|
+
import { ImpermanentLossLevel, MarketRiskLevel, SmartContractRiskLevel } from "@/interfaces/risks";
|
|
37
39
|
|
|
38
40
|
export interface EkuboPoolKey {
|
|
39
41
|
token0: ContractAddr;
|
|
@@ -69,6 +71,7 @@ export interface CLVaultStrategySettings {
|
|
|
69
71
|
direction: "any" | "uponly"; // any for pools like USDC/USDT, uponly for pools like xSTRK/STRK
|
|
70
72
|
customShouldRebalance: (currentPoolPrice: number) => Promise<boolean>; // any additional logic for deciding factor to rebalance or not based on pools
|
|
71
73
|
};
|
|
74
|
+
quoteAsset: TokenInfo
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
export class EkuboCLVault extends BaseStrategy<
|
|
@@ -1588,15 +1591,41 @@ const _protocol: IProtocol = {
|
|
|
1588
1591
|
logo: "https://app.ekubo.org/favicon.ico",
|
|
1589
1592
|
};
|
|
1590
1593
|
// need to fine tune better
|
|
1591
|
-
const
|
|
1592
|
-
{ type: RiskType.SMART_CONTRACT_RISK, value:
|
|
1593
|
-
{ type: RiskType.IMPERMANENT_LOSS, value:
|
|
1594
|
-
{ type: RiskType.MARKET_RISK, value:
|
|
1594
|
+
const _corelatedPoolRiskFactors: RiskFactor[] = [
|
|
1595
|
+
{ type: RiskType.SMART_CONTRACT_RISK, value: SmartContractRiskLevel.WELL_AUDITED, weight: 34, reason: "Audited smart contracts" },
|
|
1596
|
+
{ type: RiskType.IMPERMANENT_LOSS, value: ImpermanentLossLevel.HIGHLY_CORRELATED, weight: 33, reason: "Low risk due to co-related assets" },
|
|
1597
|
+
{ type: RiskType.MARKET_RISK, value: MarketRiskLevel.VERY_LOW_VOLATILITY, weight: 33, reason: "Low risk due to co-related assets" },
|
|
1595
1598
|
];
|
|
1596
1599
|
|
|
1597
|
-
const
|
|
1598
|
-
{ type: RiskType.SMART_CONTRACT_RISK, value:
|
|
1600
|
+
const mediumVolatilityPoolRiskFactors: RiskFactor[] = [
|
|
1601
|
+
{ type: RiskType.SMART_CONTRACT_RISK, value: SmartContractRiskLevel.WELL_AUDITED, weight: 34, reason: "Audited smart contracts" },
|
|
1602
|
+
{ type: RiskType.IMPERMANENT_LOSS, value: ImpermanentLossLevel.NON_CORRELATED, weight: 33, reason: "Low risk due to co-related assets" },
|
|
1603
|
+
{ type: RiskType.MARKET_RISK, value: MarketRiskLevel.MODERATE_VOLATILITY, weight: 33, reason: "Low risk due to co-related assets" },
|
|
1599
1604
|
];
|
|
1605
|
+
|
|
1606
|
+
const highVolatilityPoolRiskFactors: RiskFactor[] = [
|
|
1607
|
+
{ type: RiskType.SMART_CONTRACT_RISK, value: SmartContractRiskLevel.WELL_AUDITED, weight: 34, reason: "Audited smart contracts" },
|
|
1608
|
+
{ type: RiskType.IMPERMANENT_LOSS, value: ImpermanentLossLevel.NON_CORRELATED, weight: 33, reason: "Low risk due to co-related assets" },
|
|
1609
|
+
{ type: RiskType.MARKET_RISK, value: MarketRiskLevel.HIGH_VOLATILITY, weight: 33, reason: "Low risk due to co-related assets" },
|
|
1610
|
+
];
|
|
1611
|
+
|
|
1612
|
+
const mediumRisk = {
|
|
1613
|
+
riskFactor: mediumVolatilityPoolRiskFactors,
|
|
1614
|
+
netRisk:
|
|
1615
|
+
mediumVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
|
|
1616
|
+
mediumVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
|
|
1617
|
+
notARisks: getNoRiskTags(mediumVolatilityPoolRiskFactors),
|
|
1618
|
+
};
|
|
1619
|
+
|
|
1620
|
+
const highRisk = {
|
|
1621
|
+
riskFactor: highVolatilityPoolRiskFactors,
|
|
1622
|
+
netRisk:
|
|
1623
|
+
highVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
|
|
1624
|
+
highVolatilityPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
|
|
1625
|
+
notARisks: getNoRiskTags(highVolatilityPoolRiskFactors),
|
|
1626
|
+
};
|
|
1627
|
+
|
|
1628
|
+
|
|
1600
1629
|
const AUDIT_URL =
|
|
1601
1630
|
"https://assets.troves.fi/strkfarm/audit_report_vesu_and_ekubo_strats.pdf";
|
|
1602
1631
|
|
|
@@ -1616,6 +1645,11 @@ const faqs: FAQ[] = [
|
|
|
1616
1645
|
answer:
|
|
1617
1646
|
"During withdrawal, you may receive either or both tokens depending on market conditions and prevailing prices.",
|
|
1618
1647
|
},
|
|
1648
|
+
{
|
|
1649
|
+
question: "Are there any deposit/withdrawal fees?",
|
|
1650
|
+
answer:
|
|
1651
|
+
"No, there are no deposit/withdrawal fees. However, there is a performance fee varying between 10-20% of the fees and rewards generated. The exact fee is determined by the strategy and the APY shown is net of this fee.",
|
|
1652
|
+
},
|
|
1619
1653
|
{
|
|
1620
1654
|
question: "Is the strategy audited?",
|
|
1621
1655
|
answer: (
|
|
@@ -1651,11 +1685,11 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
|
1651
1685
|
auditUrl: AUDIT_URL,
|
|
1652
1686
|
maxTVL: Web3Number.fromWei("0", 18),
|
|
1653
1687
|
risk: {
|
|
1654
|
-
riskFactor:
|
|
1688
|
+
riskFactor: _corelatedPoolRiskFactors,
|
|
1655
1689
|
netRisk:
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
notARisks: getNoRiskTags(
|
|
1690
|
+
_corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.value * curr.weight, 0) /
|
|
1691
|
+
_corelatedPoolRiskFactors.reduce((acc, curr) => acc + curr.weight, 0),
|
|
1692
|
+
notARisks: getNoRiskTags(_corelatedPoolRiskFactors),
|
|
1659
1693
|
},
|
|
1660
1694
|
apyMethodology:
|
|
1661
1695
|
"APY based on 7-day historical performance, including fees and rewards.",
|
|
@@ -1673,6 +1707,7 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
|
1673
1707
|
minWaitHours: 24,
|
|
1674
1708
|
direction: "uponly",
|
|
1675
1709
|
},
|
|
1710
|
+
quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
|
|
1676
1711
|
},
|
|
1677
1712
|
faqs: [
|
|
1678
1713
|
...faqs,
|
|
@@ -1691,76 +1726,171 @@ const xSTRKSTRK: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
|
1691
1726
|
investmentSteps: []
|
|
1692
1727
|
};
|
|
1693
1728
|
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
upper: 1,
|
|
1717
|
-
},
|
|
1718
|
-
truePrice: 1,
|
|
1719
|
-
feeBps: 1000,
|
|
1720
|
-
rebalanceConditions: {
|
|
1721
|
-
customShouldRebalance: async (currentPrice: number) =>
|
|
1722
|
-
currentPrice > 0.99 && currentPrice < 1.01,
|
|
1723
|
-
minWaitHours: 6,
|
|
1724
|
-
direction: "any",
|
|
1725
|
-
},
|
|
1726
|
-
},
|
|
1729
|
+
const ETHUSDCRe7Strategy: IStrategyMetadata<CLVaultStrategySettings> = {
|
|
1730
|
+
...xSTRKSTRK,
|
|
1731
|
+
name: "Ekubo ETH/USDC",
|
|
1732
|
+
description: <></>,
|
|
1733
|
+
address: ContractAddr.from(
|
|
1734
|
+
"0x160d8fa4569ef6a12e6bf47cb943d7b5ebba8a41a69a14c1d943050ba5ff947"
|
|
1735
|
+
),
|
|
1736
|
+
launchBlock: 1501761,
|
|
1737
|
+
// must be same order as poolKey token0 and token1
|
|
1738
|
+
depositTokens: [
|
|
1739
|
+
Global.getDefaultTokens().find((t) => t.symbol === "ETH")!,
|
|
1740
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDC")!
|
|
1741
|
+
],
|
|
1742
|
+
additionalInfo: {
|
|
1743
|
+
newBounds: "Managed by Re7",
|
|
1744
|
+
truePrice: 1,
|
|
1745
|
+
feeBps: 1000,
|
|
1746
|
+
rebalanceConditions: {
|
|
1747
|
+
customShouldRebalance: async (currentPrice: number) =>
|
|
1748
|
+
currentPrice > 0.99 && currentPrice < 1.01,
|
|
1749
|
+
minWaitHours: 6,
|
|
1750
|
+
direction: "any"
|
|
1727
1751
|
},
|
|
1752
|
+
quoteAsset: Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
|
|
1753
|
+
},
|
|
1754
|
+
faqs: [
|
|
1755
|
+
...faqs,
|
|
1728
1756
|
{
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
address: ContractAddr.from(
|
|
1733
|
-
"0xb7bd37121041261446d8eedec618955a4490641034942da688e8cbddea7b23"
|
|
1734
|
-
),
|
|
1735
|
-
launchBlock: 1492136,
|
|
1736
|
-
// must be same order as poolKey token0 and token1
|
|
1737
|
-
depositTokens: [
|
|
1738
|
-
Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
|
|
1739
|
-
Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
|
|
1740
|
-
],
|
|
1741
|
-
maxTVL: Web3Number.fromWei("0", 6),
|
|
1742
|
-
additionalInfo: {
|
|
1743
|
-
newBounds: "Managed by Re7",
|
|
1744
|
-
feeBps: 1000,
|
|
1745
|
-
rebalanceConditions: {
|
|
1746
|
-
customShouldRebalance: async (currentPrice: number) =>
|
|
1747
|
-
true,
|
|
1748
|
-
minWaitHours: 6,
|
|
1749
|
-
direction: "any",
|
|
1750
|
-
},
|
|
1751
|
-
},
|
|
1757
|
+
question: "Who is the curator of this strategy?",
|
|
1758
|
+
answer:
|
|
1759
|
+
<div>Re7 Labs is the curator of this strategy. Re7 Labs is a well-known Web3 asset management firm. This strategy is completely managed by them, including ownership of the vault. Troves is developer of the smart contracts and maintains infrastructure to help users access these strategies. You can find more information about them on their website <a href='https://www.re7labs.xyz' style={{textDecoration: "underline", marginLeft: "2px"}} target="_blank">here</a>.</div>
|
|
1752
1760
|
},
|
|
1761
|
+
],
|
|
1762
|
+
risk: highRisk,
|
|
1763
|
+
points: [],
|
|
1764
|
+
curator: { name: "Re7 Labs", logo: "https://www.re7labs.xyz/favicon.ico" }
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1767
|
+
const RE7Strategies: IStrategyMetadata<CLVaultStrategySettings>[] = [
|
|
1768
|
+
ETHUSDCRe7Strategy,
|
|
1769
|
+
{
|
|
1770
|
+
...ETHUSDCRe7Strategy,
|
|
1771
|
+
name: "Ekubo USDC/USDT",
|
|
1772
|
+
description: <></>,
|
|
1773
|
+
address: ContractAddr.from(
|
|
1774
|
+
"0x3a4f8debaf12af97bb911099bc011d63d6c208d4c5ba8e15d7f437785b0aaa2"
|
|
1775
|
+
),
|
|
1776
|
+
launchBlock: 1501761,
|
|
1777
|
+
// must be same order as poolKey token0 and token1
|
|
1778
|
+
depositTokens: [
|
|
1779
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDC")!,
|
|
1780
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDT")!
|
|
1781
|
+
],
|
|
1782
|
+
risk: xSTRKSTRK.risk,
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
...ETHUSDCRe7Strategy,
|
|
1786
|
+
name: "Ekubo STRK/USDC",
|
|
1787
|
+
description: <></>,
|
|
1788
|
+
address: ContractAddr.from(
|
|
1789
|
+
"0x351b36d0d9d8b40010658825adeeddb1397436cd41acd0ff6c6e23aaa8b5b30"
|
|
1790
|
+
),
|
|
1791
|
+
launchBlock: 1501762,
|
|
1792
|
+
// must be same order as poolKey token0 and token1
|
|
1793
|
+
depositTokens: [
|
|
1794
|
+
Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
|
|
1795
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDC")!
|
|
1796
|
+
],
|
|
1797
|
+
risk: highRisk,
|
|
1798
|
+
},
|
|
1799
|
+
{
|
|
1800
|
+
...ETHUSDCRe7Strategy,
|
|
1801
|
+
name: "Ekubo STRK/ETH",
|
|
1802
|
+
description: <></>,
|
|
1803
|
+
address: ContractAddr.from(
|
|
1804
|
+
"0x4ce3024b0ee879009112d7b0e073f8a87153dd35b029347d4247ffe48d28f51"
|
|
1805
|
+
),
|
|
1806
|
+
launchBlock: 1501763,
|
|
1807
|
+
// must be same order as poolKey token0 and token1
|
|
1808
|
+
depositTokens: [
|
|
1809
|
+
Global.getDefaultTokens().find((t) => t.symbol === "STRK")!,
|
|
1810
|
+
Global.getDefaultTokens().find((t) => t.symbol === "ETH")!
|
|
1811
|
+
],
|
|
1812
|
+
risk: highRisk,
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
...ETHUSDCRe7Strategy,
|
|
1816
|
+
name: "Ekubo WBTC/USDC",
|
|
1817
|
+
description: <></>,
|
|
1818
|
+
address: ContractAddr.from(
|
|
1819
|
+
"0x2bcaef2eb7706875a5fdc6853dd961a0590f850bc3a031c59887189b5e84ba1"
|
|
1820
|
+
),
|
|
1821
|
+
launchBlock: 1501764,
|
|
1822
|
+
// must be same order as poolKey token0 and token1
|
|
1823
|
+
depositTokens: [
|
|
1824
|
+
Global.getDefaultTokens().find((t) => t.symbol === "WBTC")!,
|
|
1825
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDC")!
|
|
1826
|
+
],
|
|
1827
|
+
risk: mediumRisk,
|
|
1828
|
+
},
|
|
1829
|
+
{
|
|
1830
|
+
...ETHUSDCRe7Strategy,
|
|
1831
|
+
name: "Ekubo tBTC/USDC",
|
|
1832
|
+
description: <></>,
|
|
1833
|
+
address: ContractAddr.from(
|
|
1834
|
+
"0x4aad891a2d4432fba06b6558631bb13f6bbd7f6f33ab8c3111e344889ea4456"
|
|
1835
|
+
),
|
|
1836
|
+
launchBlock: 1501764,
|
|
1837
|
+
// must be same order as poolKey token0 and token1
|
|
1838
|
+
depositTokens: [
|
|
1839
|
+
Global.getDefaultTokens().find((t) => t.symbol === "tBTC")!,
|
|
1840
|
+
Global.getDefaultTokens().find((t) => t.symbol === "USDC")!
|
|
1841
|
+
],
|
|
1842
|
+
risk: mediumRisk,
|
|
1843
|
+
},
|
|
1844
|
+
{
|
|
1845
|
+
...ETHUSDCRe7Strategy,
|
|
1846
|
+
name: "Ekubo WBTC/ETH",
|
|
1847
|
+
description: <></>,
|
|
1848
|
+
address: ContractAddr.from(
|
|
1849
|
+
"0x1c9232b8186d9317652f05055615f18a120c2ad9e5ee96c39e031c257fb945b"
|
|
1850
|
+
),
|
|
1851
|
+
launchBlock: 1501765,
|
|
1852
|
+
// must be same order as poolKey token0 and token1
|
|
1853
|
+
depositTokens: [
|
|
1854
|
+
Global.getDefaultTokens().find((t) => t.symbol === "WBTC")!,
|
|
1855
|
+
Global.getDefaultTokens().find((t) => t.symbol === "ETH")!
|
|
1856
|
+
],
|
|
1857
|
+
risk: mediumRisk,
|
|
1858
|
+
},
|
|
1859
|
+
{
|
|
1860
|
+
...ETHUSDCRe7Strategy,
|
|
1861
|
+
name: "Ekubo WBTC/STRK",
|
|
1862
|
+
description: <></>,
|
|
1863
|
+
address: ContractAddr.from(
|
|
1864
|
+
"0x1248e385c23a929a015ec298a26560fa7745bbd6e41a886550e337b02714b1b"
|
|
1865
|
+
),
|
|
1866
|
+
launchBlock: 1501766,
|
|
1867
|
+
// must be same order as poolKey token0 and token1
|
|
1868
|
+
depositTokens: [
|
|
1869
|
+
Global.getDefaultTokens().find((t) => t.symbol === "WBTC")!,
|
|
1870
|
+
Global.getDefaultTokens().find((t) => t.symbol === "STRK")!
|
|
1871
|
+
],
|
|
1872
|
+
risk: highRisk,
|
|
1873
|
+
}
|
|
1874
|
+
];
|
|
1875
|
+
|
|
1876
|
+
/**
|
|
1877
|
+
* Represents the Ekubo CL Vault Strategies.
|
|
1878
|
+
*/
|
|
1879
|
+
export const EkuboCLVaultStrategies: IStrategyMetadata<CLVaultStrategySettings>[] = [
|
|
1880
|
+
xSTRKSTRK,
|
|
1881
|
+
...RE7Strategies,
|
|
1753
1882
|
];
|
|
1754
1883
|
|
|
1755
1884
|
// auto assign contract details to each strategy
|
|
1756
1885
|
EkuboCLVaultStrategies.forEach((s) => {
|
|
1757
1886
|
// set contract details
|
|
1758
1887
|
s.contractDetails = [{
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1888
|
+
address: s.address,
|
|
1889
|
+
name: "Vault",
|
|
1890
|
+
sourceCodeUrl: "https://github.com/strkfarm/strkfarm-contracts/tree/main/src/strategies/cl_vault"
|
|
1891
|
+
},
|
|
1892
|
+
// ...COMMON_CONTRACTS
|
|
1893
|
+
];
|
|
1764
1894
|
// set docs link
|
|
1765
1895
|
s.docs = "https://docs.troves.fi/p/ekubo-cl-vaults"
|
|
1766
1896
|
|