@strkfarm/sdk 1.1.22 → 1.1.23
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 +14097 -1666
- package/dist/index.browser.mjs +102 -6
- package/dist/index.d.ts +11 -0
- package/dist/index.js +103 -7
- package/dist/index.mjs +103 -7
- package/package.json +3 -1
- package/src/modules/apollo-client.ts +8 -0
- package/src/notifs/telegram-group.ts +1 -1
- package/src/strategies/ekubo-cl-vault.tsx +132 -6
package/dist/index.browser.mjs
CHANGED
|
@@ -15289,6 +15289,17 @@ var erc4626_abi_default = [
|
|
|
15289
15289
|
}
|
|
15290
15290
|
];
|
|
15291
15291
|
|
|
15292
|
+
// src/strategies/ekubo-cl-vault.tsx
|
|
15293
|
+
import { gql } from "@apollo/client";
|
|
15294
|
+
|
|
15295
|
+
// src/modules/apollo-client.ts
|
|
15296
|
+
import { ApolloClient, InMemoryCache } from "@apollo/client";
|
|
15297
|
+
var apolloClient = new ApolloClient({
|
|
15298
|
+
uri: "https://api.troves.fi/",
|
|
15299
|
+
cache: new InMemoryCache()
|
|
15300
|
+
});
|
|
15301
|
+
var apollo_client_default = apolloClient;
|
|
15302
|
+
|
|
15292
15303
|
// src/strategies/ekubo-cl-vault.tsx
|
|
15293
15304
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
15294
15305
|
var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
@@ -15446,11 +15457,75 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15446
15457
|
handleFeesCall() {
|
|
15447
15458
|
return [this.contract.populate("handle_fees", [])];
|
|
15448
15459
|
}
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15460
|
+
async getFeeHistory(timePeriod = "24h") {
|
|
15461
|
+
const { data } = await apollo_client_default.query({
|
|
15462
|
+
query: gql`
|
|
15463
|
+
query ContractFeeEarnings(
|
|
15464
|
+
$timeframe: String!
|
|
15465
|
+
$contract: String!
|
|
15466
|
+
) {
|
|
15467
|
+
contractFeeEarnings(timeframe: $timeframe, contract: $contract) {
|
|
15468
|
+
contract
|
|
15469
|
+
dailyEarnings {
|
|
15470
|
+
date
|
|
15471
|
+
tokenAddress
|
|
15472
|
+
amount
|
|
15473
|
+
}
|
|
15474
|
+
totalCollections
|
|
15475
|
+
}
|
|
15476
|
+
}
|
|
15477
|
+
`,
|
|
15478
|
+
variables: {
|
|
15479
|
+
timeframe: timePeriod,
|
|
15480
|
+
contract: this.address.address
|
|
15481
|
+
},
|
|
15482
|
+
fetchPolicy: "no-cache"
|
|
15483
|
+
});
|
|
15484
|
+
const poolKey = await this.getPoolKey();
|
|
15485
|
+
const token0Info = await Global.getTokenInfoFromAddr(poolKey.token0);
|
|
15486
|
+
const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
|
|
15487
|
+
const price0 = await this.pricer.getPrice(token0Info.symbol);
|
|
15488
|
+
const price1 = await this.pricer.getPrice(token1Info.symbol);
|
|
15489
|
+
let totalToken0Amount = Web3Number.fromWei(0, token0Info.decimals);
|
|
15490
|
+
let totalToken1Amount = Web3Number.fromWei(0, token1Info.decimals);
|
|
15491
|
+
let totalToken0Usd = 0;
|
|
15492
|
+
let totalToken1Usd = 0;
|
|
15493
|
+
const parsedFeeInfo = [];
|
|
15494
|
+
const feeInfo = data.contractFeeEarnings.dailyEarnings;
|
|
15495
|
+
for (const d of feeInfo) {
|
|
15496
|
+
const tokenInfo = await Global.getTokenInfoFromAddr(ContractAddr.from(d.tokenAddress));
|
|
15497
|
+
const amount = Web3Number.fromWei(d.amount, tokenInfo.decimals);
|
|
15498
|
+
if (tokenInfo.address.eq(poolKey.token0)) {
|
|
15499
|
+
totalToken0Amount = totalToken0Amount.plus(amount);
|
|
15500
|
+
totalToken0Usd = totalToken0Usd + amount.multipliedBy(price0.price).toNumber();
|
|
15501
|
+
} else {
|
|
15502
|
+
totalToken1Amount = totalToken1Amount.plus(amount);
|
|
15503
|
+
totalToken1Usd = totalToken1Usd + amount.multipliedBy(price1.price).toNumber();
|
|
15504
|
+
}
|
|
15505
|
+
parsedFeeInfo.push({
|
|
15506
|
+
date: d.date,
|
|
15507
|
+
tokenInfo,
|
|
15508
|
+
amount: Web3Number.fromWei(d.amount, tokenInfo.decimals)
|
|
15509
|
+
});
|
|
15510
|
+
}
|
|
15511
|
+
return {
|
|
15512
|
+
summary: {
|
|
15513
|
+
usdValue: totalToken0Usd + totalToken1Usd,
|
|
15514
|
+
token0: {
|
|
15515
|
+
tokenInfo: token0Info,
|
|
15516
|
+
amount: totalToken0Amount,
|
|
15517
|
+
usdValue: totalToken0Usd
|
|
15518
|
+
},
|
|
15519
|
+
token1: {
|
|
15520
|
+
tokenInfo: token1Info,
|
|
15521
|
+
amount: totalToken1Amount,
|
|
15522
|
+
usdValue: totalToken1Usd
|
|
15523
|
+
}
|
|
15524
|
+
},
|
|
15525
|
+
history: parsedFeeInfo
|
|
15526
|
+
};
|
|
15527
|
+
}
|
|
15528
|
+
async netSharesBasedTrueAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15454
15529
|
const tvlNow = await this._getTVL(blockIdentifier);
|
|
15455
15530
|
const supplyNow = await this.totalSupply(blockIdentifier);
|
|
15456
15531
|
const priceNow = await this.getCurrentPrice(blockIdentifier);
|
|
@@ -15488,6 +15563,23 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15488
15563
|
) / 1e4;
|
|
15489
15564
|
return apyForGivenBlocks * (365 * 24 * 3600) / timeDiffSeconds;
|
|
15490
15565
|
}
|
|
15566
|
+
async feeBasedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15567
|
+
const feeInfo = await this.getFeeHistory("24h");
|
|
15568
|
+
const tvlNow = await this.getTVL("latest");
|
|
15569
|
+
return feeInfo.summary.usdValue * 365 / tvlNow.usdValue;
|
|
15570
|
+
}
|
|
15571
|
+
/**
|
|
15572
|
+
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
15573
|
+
* @returns {Promise<number>} The weighted average APY across all pools
|
|
15574
|
+
*/
|
|
15575
|
+
async netAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15576
|
+
const isUSDCQouteToken = this.metadata.additionalInfo.quoteAsset.symbol === "USDC";
|
|
15577
|
+
if (!isUSDCQouteToken) {
|
|
15578
|
+
return this.netSharesBasedTrueAPY(blockIdentifier, sinceBlocks);
|
|
15579
|
+
} else {
|
|
15580
|
+
return this.feeBasedAPY(blockIdentifier, sinceBlocks);
|
|
15581
|
+
}
|
|
15582
|
+
}
|
|
15491
15583
|
async getHarvestRewardShares(fromBlock, toBlock) {
|
|
15492
15584
|
const len = Number(await this.contract.call("get_total_rewards"));
|
|
15493
15585
|
let shares = Web3Number.fromWei(0, 18);
|
|
@@ -16701,7 +16793,7 @@ var ETHUSDCRe7Strategy = {
|
|
|
16701
16793
|
Global.getDefaultTokens().find((t) => t.symbol === "ETH"),
|
|
16702
16794
|
Global.getDefaultTokens().find((t) => t.symbol === "USDC")
|
|
16703
16795
|
],
|
|
16704
|
-
apyMethodology: "APY
|
|
16796
|
+
apyMethodology: "Annualized fee APY, calculated as fees earned in the last 24h divided by TVL",
|
|
16705
16797
|
additionalInfo: {
|
|
16706
16798
|
newBounds: "Managed by Re7",
|
|
16707
16799
|
truePrice: 1,
|
|
@@ -16722,6 +16814,10 @@ var ETHUSDCRe7Strategy = {
|
|
|
16722
16814
|
/* @__PURE__ */ jsx3("a", { href: "https://www.re7labs.xyz", style: { textDecoration: "underline", marginLeft: "2px" }, target: "_blank", children: "here" }),
|
|
16723
16815
|
"."
|
|
16724
16816
|
] })
|
|
16817
|
+
},
|
|
16818
|
+
{
|
|
16819
|
+
question: "How is the APY calculated?",
|
|
16820
|
+
answer: /* @__PURE__ */ jsx3("div", { children: "It's an annualized fee APY, calculated as fees earned in the last 24h divided by TVL. Factors like impermanent loss are not considered." })
|
|
16725
16821
|
}
|
|
16726
16822
|
],
|
|
16727
16823
|
risk: highRisk,
|
package/dist/index.d.ts
CHANGED
|
@@ -642,6 +642,11 @@ interface EkuboBounds {
|
|
|
642
642
|
lowerTick: bigint;
|
|
643
643
|
upperTick: bigint;
|
|
644
644
|
}
|
|
645
|
+
interface FeeHistory {
|
|
646
|
+
date: string;
|
|
647
|
+
tokenInfo: TokenInfo;
|
|
648
|
+
amount: Web3Number;
|
|
649
|
+
}
|
|
645
650
|
/**
|
|
646
651
|
* Settings for the CLVaultStrategy
|
|
647
652
|
*
|
|
@@ -696,6 +701,12 @@ declare class EkuboCLVault extends BaseStrategy<DualTokenInfo, DualActionAmount>
|
|
|
696
701
|
rebalanceCall(newBounds: EkuboBounds, swapParams: SwapInfo): Call[];
|
|
697
702
|
handleUnusedCall(swapParams: SwapInfo): Call[];
|
|
698
703
|
handleFeesCall(): Call[];
|
|
704
|
+
getFeeHistory(timePeriod?: '24h' | '30d' | '3m'): Promise<{
|
|
705
|
+
summary: DualTokenInfo;
|
|
706
|
+
history: FeeHistory[];
|
|
707
|
+
}>;
|
|
708
|
+
netSharesBasedTrueAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
709
|
+
feeBasedAPY(blockIdentifier?: BlockIdentifier, sinceBlocks?: number): Promise<number>;
|
|
699
710
|
/**
|
|
700
711
|
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
701
712
|
* @returns {Promise<number>} The weighted average APY across all pools
|
package/dist/index.js
CHANGED
|
@@ -15385,6 +15385,17 @@ var erc4626_abi_default = [
|
|
|
15385
15385
|
}
|
|
15386
15386
|
];
|
|
15387
15387
|
|
|
15388
|
+
// src/strategies/ekubo-cl-vault.tsx
|
|
15389
|
+
var import_client2 = require("@apollo/client");
|
|
15390
|
+
|
|
15391
|
+
// src/modules/apollo-client.ts
|
|
15392
|
+
var import_client = require("@apollo/client");
|
|
15393
|
+
var apolloClient = new import_client.ApolloClient({
|
|
15394
|
+
uri: "https://api.troves.fi/",
|
|
15395
|
+
cache: new import_client.InMemoryCache()
|
|
15396
|
+
});
|
|
15397
|
+
var apollo_client_default = apolloClient;
|
|
15398
|
+
|
|
15388
15399
|
// src/strategies/ekubo-cl-vault.tsx
|
|
15389
15400
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
15390
15401
|
var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
@@ -15542,11 +15553,75 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15542
15553
|
handleFeesCall() {
|
|
15543
15554
|
return [this.contract.populate("handle_fees", [])];
|
|
15544
15555
|
}
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15556
|
+
async getFeeHistory(timePeriod = "24h") {
|
|
15557
|
+
const { data } = await apollo_client_default.query({
|
|
15558
|
+
query: import_client2.gql`
|
|
15559
|
+
query ContractFeeEarnings(
|
|
15560
|
+
$timeframe: String!
|
|
15561
|
+
$contract: String!
|
|
15562
|
+
) {
|
|
15563
|
+
contractFeeEarnings(timeframe: $timeframe, contract: $contract) {
|
|
15564
|
+
contract
|
|
15565
|
+
dailyEarnings {
|
|
15566
|
+
date
|
|
15567
|
+
tokenAddress
|
|
15568
|
+
amount
|
|
15569
|
+
}
|
|
15570
|
+
totalCollections
|
|
15571
|
+
}
|
|
15572
|
+
}
|
|
15573
|
+
`,
|
|
15574
|
+
variables: {
|
|
15575
|
+
timeframe: timePeriod,
|
|
15576
|
+
contract: this.address.address
|
|
15577
|
+
},
|
|
15578
|
+
fetchPolicy: "no-cache"
|
|
15579
|
+
});
|
|
15580
|
+
const poolKey = await this.getPoolKey();
|
|
15581
|
+
const token0Info = await Global.getTokenInfoFromAddr(poolKey.token0);
|
|
15582
|
+
const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
|
|
15583
|
+
const price0 = await this.pricer.getPrice(token0Info.symbol);
|
|
15584
|
+
const price1 = await this.pricer.getPrice(token1Info.symbol);
|
|
15585
|
+
let totalToken0Amount = Web3Number.fromWei(0, token0Info.decimals);
|
|
15586
|
+
let totalToken1Amount = Web3Number.fromWei(0, token1Info.decimals);
|
|
15587
|
+
let totalToken0Usd = 0;
|
|
15588
|
+
let totalToken1Usd = 0;
|
|
15589
|
+
const parsedFeeInfo = [];
|
|
15590
|
+
const feeInfo = data.contractFeeEarnings.dailyEarnings;
|
|
15591
|
+
for (const d of feeInfo) {
|
|
15592
|
+
const tokenInfo = await Global.getTokenInfoFromAddr(ContractAddr.from(d.tokenAddress));
|
|
15593
|
+
const amount = Web3Number.fromWei(d.amount, tokenInfo.decimals);
|
|
15594
|
+
if (tokenInfo.address.eq(poolKey.token0)) {
|
|
15595
|
+
totalToken0Amount = totalToken0Amount.plus(amount);
|
|
15596
|
+
totalToken0Usd = totalToken0Usd + amount.multipliedBy(price0.price).toNumber();
|
|
15597
|
+
} else {
|
|
15598
|
+
totalToken1Amount = totalToken1Amount.plus(amount);
|
|
15599
|
+
totalToken1Usd = totalToken1Usd + amount.multipliedBy(price1.price).toNumber();
|
|
15600
|
+
}
|
|
15601
|
+
parsedFeeInfo.push({
|
|
15602
|
+
date: d.date,
|
|
15603
|
+
tokenInfo,
|
|
15604
|
+
amount: Web3Number.fromWei(d.amount, tokenInfo.decimals)
|
|
15605
|
+
});
|
|
15606
|
+
}
|
|
15607
|
+
return {
|
|
15608
|
+
summary: {
|
|
15609
|
+
usdValue: totalToken0Usd + totalToken1Usd,
|
|
15610
|
+
token0: {
|
|
15611
|
+
tokenInfo: token0Info,
|
|
15612
|
+
amount: totalToken0Amount,
|
|
15613
|
+
usdValue: totalToken0Usd
|
|
15614
|
+
},
|
|
15615
|
+
token1: {
|
|
15616
|
+
tokenInfo: token1Info,
|
|
15617
|
+
amount: totalToken1Amount,
|
|
15618
|
+
usdValue: totalToken1Usd
|
|
15619
|
+
}
|
|
15620
|
+
},
|
|
15621
|
+
history: parsedFeeInfo
|
|
15622
|
+
};
|
|
15623
|
+
}
|
|
15624
|
+
async netSharesBasedTrueAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15550
15625
|
const tvlNow = await this._getTVL(blockIdentifier);
|
|
15551
15626
|
const supplyNow = await this.totalSupply(blockIdentifier);
|
|
15552
15627
|
const priceNow = await this.getCurrentPrice(blockIdentifier);
|
|
@@ -15584,6 +15659,23 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15584
15659
|
) / 1e4;
|
|
15585
15660
|
return apyForGivenBlocks * (365 * 24 * 3600) / timeDiffSeconds;
|
|
15586
15661
|
}
|
|
15662
|
+
async feeBasedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15663
|
+
const feeInfo = await this.getFeeHistory("24h");
|
|
15664
|
+
const tvlNow = await this.getTVL("latest");
|
|
15665
|
+
return feeInfo.summary.usdValue * 365 / tvlNow.usdValue;
|
|
15666
|
+
}
|
|
15667
|
+
/**
|
|
15668
|
+
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
15669
|
+
* @returns {Promise<number>} The weighted average APY across all pools
|
|
15670
|
+
*/
|
|
15671
|
+
async netAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15672
|
+
const isUSDCQouteToken = this.metadata.additionalInfo.quoteAsset.symbol === "USDC";
|
|
15673
|
+
if (!isUSDCQouteToken) {
|
|
15674
|
+
return this.netSharesBasedTrueAPY(blockIdentifier, sinceBlocks);
|
|
15675
|
+
} else {
|
|
15676
|
+
return this.feeBasedAPY(blockIdentifier, sinceBlocks);
|
|
15677
|
+
}
|
|
15678
|
+
}
|
|
15587
15679
|
async getHarvestRewardShares(fromBlock, toBlock) {
|
|
15588
15680
|
const len = Number(await this.contract.call("get_total_rewards"));
|
|
15589
15681
|
let shares = Web3Number.fromWei(0, 18);
|
|
@@ -16797,7 +16889,7 @@ var ETHUSDCRe7Strategy = {
|
|
|
16797
16889
|
Global.getDefaultTokens().find((t) => t.symbol === "ETH"),
|
|
16798
16890
|
Global.getDefaultTokens().find((t) => t.symbol === "USDC")
|
|
16799
16891
|
],
|
|
16800
|
-
apyMethodology: "APY
|
|
16892
|
+
apyMethodology: "Annualized fee APY, calculated as fees earned in the last 24h divided by TVL",
|
|
16801
16893
|
additionalInfo: {
|
|
16802
16894
|
newBounds: "Managed by Re7",
|
|
16803
16895
|
truePrice: 1,
|
|
@@ -16818,6 +16910,10 @@ var ETHUSDCRe7Strategy = {
|
|
|
16818
16910
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { href: "https://www.re7labs.xyz", style: { textDecoration: "underline", marginLeft: "2px" }, target: "_blank", children: "here" }),
|
|
16819
16911
|
"."
|
|
16820
16912
|
] })
|
|
16913
|
+
},
|
|
16914
|
+
{
|
|
16915
|
+
question: "How is the APY calculated?",
|
|
16916
|
+
answer: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: "It's an annualized fee APY, calculated as fees earned in the last 24h divided by TVL. Factors like impermanent loss are not considered." })
|
|
16821
16917
|
}
|
|
16822
16918
|
],
|
|
16823
16919
|
risk: highRisk,
|
|
@@ -28033,7 +28129,7 @@ var TelegramNotif = class {
|
|
|
28033
28129
|
var import_node_telegram_bot_api2 = __toESM(require("node-telegram-bot-api"));
|
|
28034
28130
|
var TelegramGroupNotif = class {
|
|
28035
28131
|
constructor(token, groupId, topicId) {
|
|
28036
|
-
this.bot = new import_node_telegram_bot_api2.default(token, { polling:
|
|
28132
|
+
this.bot = new import_node_telegram_bot_api2.default(token, { polling: false });
|
|
28037
28133
|
this.groupId = groupId;
|
|
28038
28134
|
this.topicId = topicId;
|
|
28039
28135
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -15288,6 +15288,17 @@ var erc4626_abi_default = [
|
|
|
15288
15288
|
}
|
|
15289
15289
|
];
|
|
15290
15290
|
|
|
15291
|
+
// src/strategies/ekubo-cl-vault.tsx
|
|
15292
|
+
import { gql } from "@apollo/client";
|
|
15293
|
+
|
|
15294
|
+
// src/modules/apollo-client.ts
|
|
15295
|
+
import { ApolloClient, InMemoryCache } from "@apollo/client";
|
|
15296
|
+
var apolloClient = new ApolloClient({
|
|
15297
|
+
uri: "https://api.troves.fi/",
|
|
15298
|
+
cache: new InMemoryCache()
|
|
15299
|
+
});
|
|
15300
|
+
var apollo_client_default = apolloClient;
|
|
15301
|
+
|
|
15291
15302
|
// src/strategies/ekubo-cl-vault.tsx
|
|
15292
15303
|
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
15293
15304
|
var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
@@ -15445,11 +15456,75 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15445
15456
|
handleFeesCall() {
|
|
15446
15457
|
return [this.contract.populate("handle_fees", [])];
|
|
15447
15458
|
}
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15459
|
+
async getFeeHistory(timePeriod = "24h") {
|
|
15460
|
+
const { data } = await apollo_client_default.query({
|
|
15461
|
+
query: gql`
|
|
15462
|
+
query ContractFeeEarnings(
|
|
15463
|
+
$timeframe: String!
|
|
15464
|
+
$contract: String!
|
|
15465
|
+
) {
|
|
15466
|
+
contractFeeEarnings(timeframe: $timeframe, contract: $contract) {
|
|
15467
|
+
contract
|
|
15468
|
+
dailyEarnings {
|
|
15469
|
+
date
|
|
15470
|
+
tokenAddress
|
|
15471
|
+
amount
|
|
15472
|
+
}
|
|
15473
|
+
totalCollections
|
|
15474
|
+
}
|
|
15475
|
+
}
|
|
15476
|
+
`,
|
|
15477
|
+
variables: {
|
|
15478
|
+
timeframe: timePeriod,
|
|
15479
|
+
contract: this.address.address
|
|
15480
|
+
},
|
|
15481
|
+
fetchPolicy: "no-cache"
|
|
15482
|
+
});
|
|
15483
|
+
const poolKey = await this.getPoolKey();
|
|
15484
|
+
const token0Info = await Global.getTokenInfoFromAddr(poolKey.token0);
|
|
15485
|
+
const token1Info = await Global.getTokenInfoFromAddr(poolKey.token1);
|
|
15486
|
+
const price0 = await this.pricer.getPrice(token0Info.symbol);
|
|
15487
|
+
const price1 = await this.pricer.getPrice(token1Info.symbol);
|
|
15488
|
+
let totalToken0Amount = Web3Number.fromWei(0, token0Info.decimals);
|
|
15489
|
+
let totalToken1Amount = Web3Number.fromWei(0, token1Info.decimals);
|
|
15490
|
+
let totalToken0Usd = 0;
|
|
15491
|
+
let totalToken1Usd = 0;
|
|
15492
|
+
const parsedFeeInfo = [];
|
|
15493
|
+
const feeInfo = data.contractFeeEarnings.dailyEarnings;
|
|
15494
|
+
for (const d of feeInfo) {
|
|
15495
|
+
const tokenInfo = await Global.getTokenInfoFromAddr(ContractAddr.from(d.tokenAddress));
|
|
15496
|
+
const amount = Web3Number.fromWei(d.amount, tokenInfo.decimals);
|
|
15497
|
+
if (tokenInfo.address.eq(poolKey.token0)) {
|
|
15498
|
+
totalToken0Amount = totalToken0Amount.plus(amount);
|
|
15499
|
+
totalToken0Usd = totalToken0Usd + amount.multipliedBy(price0.price).toNumber();
|
|
15500
|
+
} else {
|
|
15501
|
+
totalToken1Amount = totalToken1Amount.plus(amount);
|
|
15502
|
+
totalToken1Usd = totalToken1Usd + amount.multipliedBy(price1.price).toNumber();
|
|
15503
|
+
}
|
|
15504
|
+
parsedFeeInfo.push({
|
|
15505
|
+
date: d.date,
|
|
15506
|
+
tokenInfo,
|
|
15507
|
+
amount: Web3Number.fromWei(d.amount, tokenInfo.decimals)
|
|
15508
|
+
});
|
|
15509
|
+
}
|
|
15510
|
+
return {
|
|
15511
|
+
summary: {
|
|
15512
|
+
usdValue: totalToken0Usd + totalToken1Usd,
|
|
15513
|
+
token0: {
|
|
15514
|
+
tokenInfo: token0Info,
|
|
15515
|
+
amount: totalToken0Amount,
|
|
15516
|
+
usdValue: totalToken0Usd
|
|
15517
|
+
},
|
|
15518
|
+
token1: {
|
|
15519
|
+
tokenInfo: token1Info,
|
|
15520
|
+
amount: totalToken1Amount,
|
|
15521
|
+
usdValue: totalToken1Usd
|
|
15522
|
+
}
|
|
15523
|
+
},
|
|
15524
|
+
history: parsedFeeInfo
|
|
15525
|
+
};
|
|
15526
|
+
}
|
|
15527
|
+
async netSharesBasedTrueAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15453
15528
|
const tvlNow = await this._getTVL(blockIdentifier);
|
|
15454
15529
|
const supplyNow = await this.totalSupply(blockIdentifier);
|
|
15455
15530
|
const priceNow = await this.getCurrentPrice(blockIdentifier);
|
|
@@ -15487,6 +15562,23 @@ var EkuboCLVault = class _EkuboCLVault extends BaseStrategy {
|
|
|
15487
15562
|
) / 1e4;
|
|
15488
15563
|
return apyForGivenBlocks * (365 * 24 * 3600) / timeDiffSeconds;
|
|
15489
15564
|
}
|
|
15565
|
+
async feeBasedAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15566
|
+
const feeInfo = await this.getFeeHistory("24h");
|
|
15567
|
+
const tvlNow = await this.getTVL("latest");
|
|
15568
|
+
return feeInfo.summary.usdValue * 365 / tvlNow.usdValue;
|
|
15569
|
+
}
|
|
15570
|
+
/**
|
|
15571
|
+
* Calculates assets before and now in a given token of TVL per share to observe growth
|
|
15572
|
+
* @returns {Promise<number>} The weighted average APY across all pools
|
|
15573
|
+
*/
|
|
15574
|
+
async netAPY(blockIdentifier = "latest", sinceBlocks = 6e5) {
|
|
15575
|
+
const isUSDCQouteToken = this.metadata.additionalInfo.quoteAsset.symbol === "USDC";
|
|
15576
|
+
if (!isUSDCQouteToken) {
|
|
15577
|
+
return this.netSharesBasedTrueAPY(blockIdentifier, sinceBlocks);
|
|
15578
|
+
} else {
|
|
15579
|
+
return this.feeBasedAPY(blockIdentifier, sinceBlocks);
|
|
15580
|
+
}
|
|
15581
|
+
}
|
|
15490
15582
|
async getHarvestRewardShares(fromBlock, toBlock) {
|
|
15491
15583
|
const len = Number(await this.contract.call("get_total_rewards"));
|
|
15492
15584
|
let shares = Web3Number.fromWei(0, 18);
|
|
@@ -16700,7 +16792,7 @@ var ETHUSDCRe7Strategy = {
|
|
|
16700
16792
|
Global.getDefaultTokens().find((t) => t.symbol === "ETH"),
|
|
16701
16793
|
Global.getDefaultTokens().find((t) => t.symbol === "USDC")
|
|
16702
16794
|
],
|
|
16703
|
-
apyMethodology: "APY
|
|
16795
|
+
apyMethodology: "Annualized fee APY, calculated as fees earned in the last 24h divided by TVL",
|
|
16704
16796
|
additionalInfo: {
|
|
16705
16797
|
newBounds: "Managed by Re7",
|
|
16706
16798
|
truePrice: 1,
|
|
@@ -16721,6 +16813,10 @@ var ETHUSDCRe7Strategy = {
|
|
|
16721
16813
|
/* @__PURE__ */ jsx3("a", { href: "https://www.re7labs.xyz", style: { textDecoration: "underline", marginLeft: "2px" }, target: "_blank", children: "here" }),
|
|
16722
16814
|
"."
|
|
16723
16815
|
] })
|
|
16816
|
+
},
|
|
16817
|
+
{
|
|
16818
|
+
question: "How is the APY calculated?",
|
|
16819
|
+
answer: /* @__PURE__ */ jsx3("div", { children: "It's an annualized fee APY, calculated as fees earned in the last 24h divided by TVL. Factors like impermanent loss are not considered." })
|
|
16724
16820
|
}
|
|
16725
16821
|
],
|
|
16726
16822
|
risk: highRisk,
|
|
@@ -27936,7 +28032,7 @@ var TelegramNotif = class {
|
|
|
27936
28032
|
import TelegramBot2 from "node-telegram-bot-api";
|
|
27937
28033
|
var TelegramGroupNotif = class {
|
|
27938
28034
|
constructor(token, groupId, topicId) {
|
|
27939
|
-
this.bot = new TelegramBot2(token, { polling:
|
|
28035
|
+
this.bot = new TelegramBot2(token, { polling: false });
|
|
27940
28036
|
this.groupId = groupId;
|
|
27941
28037
|
this.topicId = topicId;
|
|
27942
28038
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strkfarm/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.23",
|
|
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",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"starknet": "8.5.2"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
+
"@apollo/client": "3.11.8",
|
|
60
61
|
"@avnu/avnu-sdk": "3.0.2",
|
|
61
62
|
"@ericnordelo/strk-merkle-tree": "^1.0.0",
|
|
62
63
|
"@noble/curves": "^1.0.0",
|
|
@@ -68,6 +69,7 @@
|
|
|
68
69
|
"chalk": "^4.1.2",
|
|
69
70
|
"commander": "^12.1.0",
|
|
70
71
|
"ethers": "^6.13.5",
|
|
72
|
+
"graphql": "16.9.0",
|
|
71
73
|
"inquirer": "^10.1.2",
|
|
72
74
|
"node-telegram-bot-api": "^0.66.0",
|
|
73
75
|
"proxy-from-env": "^1.1.0",
|
|
@@ -7,7 +7,7 @@ export class TelegramGroupNotif {
|
|
|
7
7
|
private topicId?: number;
|
|
8
8
|
|
|
9
9
|
constructor(token: string, groupId: string, topicId?: number) {
|
|
10
|
-
this.bot = new TelegramBot(token, { polling:
|
|
10
|
+
this.bot = new TelegramBot(token, { polling: false });
|
|
11
11
|
this.groupId = groupId;
|
|
12
12
|
this.topicId = topicId;
|
|
13
13
|
}
|