@strkfarm/sdk 1.1.27 → 1.1.28
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 +16 -17
- package/dist/index.browser.mjs +16 -17
- package/dist/index.d.ts +6 -1
- package/dist/index.js +22 -23
- package/dist/index.mjs +22 -23
- package/package.json +1 -1
- package/src/strategies/universal-lst-muliplier-strategy.tsx +15 -1
- package/src/strategies/universal-strategy.tsx +3 -18
|
@@ -53965,7 +53965,6 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
53965
53965
|
const stats = await this.getLSTStats();
|
|
53966
53966
|
const result2 = /* @__PURE__ */ new Map();
|
|
53967
53967
|
for (const stat of stats) {
|
|
53968
|
-
console.log("stat", stat);
|
|
53969
53968
|
result2.set(stat.assetAddress, stat);
|
|
53970
53969
|
}
|
|
53971
53970
|
return result2;
|
|
@@ -90711,20 +90710,12 @@ spurious results.`);
|
|
|
90711
90710
|
logger2.verbose(`${this.metadata.name}::netAPY: positions: ${JSON.stringify(positions)}`);
|
|
90712
90711
|
const baseAPYs = [];
|
|
90713
90712
|
const rewardAPYs = [];
|
|
90714
|
-
const underlyingAddresses = vesuAdapters.map((adapter) => adapter.config.debt.address);
|
|
90715
|
-
let lstAPRs;
|
|
90716
|
-
try {
|
|
90717
|
-
lstAPRs = await LSTAPRService.getLSTAPRs(underlyingAddresses);
|
|
90718
|
-
} catch (error2) {
|
|
90719
|
-
logger2.warn(`${this.metadata.name}::netAPY: Failed to fetch LST APRs from Endur API, using fallback: ${error2}`);
|
|
90720
|
-
lstAPRs = /* @__PURE__ */ new Map();
|
|
90721
|
-
}
|
|
90722
90713
|
for (const [index, pool] of pools.entries()) {
|
|
90723
90714
|
const vesuAdapter = vesuAdapters[index];
|
|
90724
90715
|
const collateralAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.collateral.symbol.toLowerCase())?.stats;
|
|
90725
90716
|
const debtAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.debt.symbol.toLowerCase())?.stats;
|
|
90726
90717
|
const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
|
|
90727
|
-
const lstAPY =
|
|
90718
|
+
const lstAPY = await this.getLSTAPR(vesuAdapter.config.collateral.address);
|
|
90728
90719
|
logger2.verbose(`${this.metadata.name}::netAPY: ${vesuAdapter.config.collateral.symbol} LST APR from Endur: ${lstAPY}`);
|
|
90729
90720
|
baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
|
|
90730
90721
|
rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr?.value || "0") / 1e18, 0]);
|
|
@@ -90953,13 +90944,8 @@ spurious results.`);
|
|
|
90953
90944
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
90954
90945
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
90955
90946
|
*/
|
|
90956
|
-
async getLSTAPR() {
|
|
90957
|
-
|
|
90958
|
-
return await LSTAPRService.getLSTAPR(this.asset().address);
|
|
90959
|
-
} catch (error2) {
|
|
90960
|
-
logger2.warn(`${this.getTag()}: Failed to get LST APR: ${error2}`);
|
|
90961
|
-
return 0;
|
|
90962
|
-
}
|
|
90947
|
+
async getLSTAPR(address) {
|
|
90948
|
+
return 0;
|
|
90963
90949
|
}
|
|
90964
90950
|
async getVesuHealthFactors() {
|
|
90965
90951
|
return await Promise.all(this.getVesuAdapters().map((v) => v.getHealthFactor()));
|
|
@@ -91652,6 +91638,19 @@ spurious results.`);
|
|
|
91652
91638
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
91653
91639
|
return vesuAdapter1.config.debt;
|
|
91654
91640
|
}
|
|
91641
|
+
/**
|
|
91642
|
+
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
91643
|
+
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
91644
|
+
*/
|
|
91645
|
+
async getLSTAPR(_address) {
|
|
91646
|
+
try {
|
|
91647
|
+
const vesuAdapter1 = this.getVesuAdapters()[0];
|
|
91648
|
+
return await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
|
|
91649
|
+
} catch (error2) {
|
|
91650
|
+
logger2.warn(`${this.getTag()}: Failed to get LST APR: ${error2}`);
|
|
91651
|
+
return 0;
|
|
91652
|
+
}
|
|
91653
|
+
}
|
|
91655
91654
|
async getLSTExchangeRate() {
|
|
91656
91655
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
91657
91656
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
package/dist/index.browser.mjs
CHANGED
|
@@ -2362,7 +2362,6 @@ var LSTAPRService = class {
|
|
|
2362
2362
|
const stats = await this.getLSTStats();
|
|
2363
2363
|
const result = /* @__PURE__ */ new Map();
|
|
2364
2364
|
for (const stat of stats) {
|
|
2365
|
-
console.log("stat", stat);
|
|
2366
2365
|
result.set(stat.assetAddress, stat);
|
|
2367
2366
|
}
|
|
2368
2367
|
return result;
|
|
@@ -26807,20 +26806,12 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
26807
26806
|
logger.verbose(`${this.metadata.name}::netAPY: positions: ${JSON.stringify(positions)}`);
|
|
26808
26807
|
const baseAPYs = [];
|
|
26809
26808
|
const rewardAPYs = [];
|
|
26810
|
-
const underlyingAddresses = vesuAdapters.map((adapter) => adapter.config.debt.address);
|
|
26811
|
-
let lstAPRs;
|
|
26812
|
-
try {
|
|
26813
|
-
lstAPRs = await LSTAPRService.getLSTAPRs(underlyingAddresses);
|
|
26814
|
-
} catch (error) {
|
|
26815
|
-
logger.warn(`${this.metadata.name}::netAPY: Failed to fetch LST APRs from Endur API, using fallback: ${error}`);
|
|
26816
|
-
lstAPRs = /* @__PURE__ */ new Map();
|
|
26817
|
-
}
|
|
26818
26809
|
for (const [index, pool] of pools.entries()) {
|
|
26819
26810
|
const vesuAdapter = vesuAdapters[index];
|
|
26820
26811
|
const collateralAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.collateral.symbol.toLowerCase())?.stats;
|
|
26821
26812
|
const debtAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.debt.symbol.toLowerCase())?.stats;
|
|
26822
26813
|
const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
|
|
26823
|
-
const lstAPY =
|
|
26814
|
+
const lstAPY = await this.getLSTAPR(vesuAdapter.config.collateral.address);
|
|
26824
26815
|
logger.verbose(`${this.metadata.name}::netAPY: ${vesuAdapter.config.collateral.symbol} LST APR from Endur: ${lstAPY}`);
|
|
26825
26816
|
baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
|
|
26826
26817
|
rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr?.value || "0") / 1e18, 0]);
|
|
@@ -27049,13 +27040,8 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
27049
27040
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
27050
27041
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
27051
27042
|
*/
|
|
27052
|
-
async getLSTAPR() {
|
|
27053
|
-
|
|
27054
|
-
return await LSTAPRService.getLSTAPR(this.asset().address);
|
|
27055
|
-
} catch (error) {
|
|
27056
|
-
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
27057
|
-
return 0;
|
|
27058
|
-
}
|
|
27043
|
+
async getLSTAPR(address) {
|
|
27044
|
+
return 0;
|
|
27059
27045
|
}
|
|
27060
27046
|
async getVesuHealthFactors() {
|
|
27061
27047
|
return await Promise.all(this.getVesuAdapters().map((v) => v.getHealthFactor()));
|
|
@@ -27749,6 +27735,19 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
27749
27735
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
27750
27736
|
return vesuAdapter1.config.debt;
|
|
27751
27737
|
}
|
|
27738
|
+
/**
|
|
27739
|
+
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
27740
|
+
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
27741
|
+
*/
|
|
27742
|
+
async getLSTAPR(_address) {
|
|
27743
|
+
try {
|
|
27744
|
+
const vesuAdapter1 = this.getVesuAdapters()[0];
|
|
27745
|
+
return await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
|
|
27746
|
+
} catch (error) {
|
|
27747
|
+
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
27748
|
+
return 0;
|
|
27749
|
+
}
|
|
27750
|
+
}
|
|
27752
27751
|
async getLSTExchangeRate() {
|
|
27753
27752
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
27754
27753
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
package/dist/index.d.ts
CHANGED
|
@@ -1229,7 +1229,7 @@ declare class UniversalStrategy<S extends UniversalStrategySettings> extends Bas
|
|
|
1229
1229
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
1230
1230
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
1231
1231
|
*/
|
|
1232
|
-
getLSTAPR(): Promise<number>;
|
|
1232
|
+
getLSTAPR(address: ContractAddr): Promise<number>;
|
|
1233
1233
|
getVesuHealthFactors(): Promise<number[]>;
|
|
1234
1234
|
computeRebalanceConditionAndReturnCalls(): Promise<Call[]>;
|
|
1235
1235
|
private getNewHealthFactor;
|
|
@@ -1299,6 +1299,11 @@ declare class UniversalLstMultiplierStrategy extends UniversalStrategy<Universal
|
|
|
1299
1299
|
leg1DepositAmount: Web3Number;
|
|
1300
1300
|
}): Promise<Call[]>;
|
|
1301
1301
|
getLSTUnderlyingTokenInfo(): TokenInfo;
|
|
1302
|
+
/**
|
|
1303
|
+
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
1304
|
+
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
1305
|
+
*/
|
|
1306
|
+
getLSTAPR(_address: ContractAddr): Promise<number>;
|
|
1302
1307
|
getLSTExchangeRate(): Promise<number>;
|
|
1303
1308
|
/**
|
|
1304
1309
|
*
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ __export(index_exports, {
|
|
|
49
49
|
HyperLSTStrategies: () => HyperLSTStrategies,
|
|
50
50
|
ILending: () => ILending,
|
|
51
51
|
Initializable: () => Initializable,
|
|
52
|
-
LSTAPRService: () =>
|
|
52
|
+
LSTAPRService: () => LSTAPRService2,
|
|
53
53
|
MarginType: () => MarginType,
|
|
54
54
|
Network: () => Network,
|
|
55
55
|
PRICE_ROUTER: () => PRICE_ROUTER,
|
|
@@ -26802,20 +26802,12 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
26802
26802
|
logger.verbose(`${this.metadata.name}::netAPY: positions: ${JSON.stringify(positions)}`);
|
|
26803
26803
|
const baseAPYs = [];
|
|
26804
26804
|
const rewardAPYs = [];
|
|
26805
|
-
const underlyingAddresses = vesuAdapters.map((adapter) => adapter.config.debt.address);
|
|
26806
|
-
let lstAPRs;
|
|
26807
|
-
try {
|
|
26808
|
-
lstAPRs = await LSTAPRService.getLSTAPRs(underlyingAddresses);
|
|
26809
|
-
} catch (error) {
|
|
26810
|
-
logger.warn(`${this.metadata.name}::netAPY: Failed to fetch LST APRs from Endur API, using fallback: ${error}`);
|
|
26811
|
-
lstAPRs = /* @__PURE__ */ new Map();
|
|
26812
|
-
}
|
|
26813
26805
|
for (const [index, pool] of pools.entries()) {
|
|
26814
26806
|
const vesuAdapter = vesuAdapters[index];
|
|
26815
26807
|
const collateralAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.collateral.symbol.toLowerCase())?.stats;
|
|
26816
26808
|
const debtAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.debt.symbol.toLowerCase())?.stats;
|
|
26817
26809
|
const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
|
|
26818
|
-
const lstAPY =
|
|
26810
|
+
const lstAPY = await this.getLSTAPR(vesuAdapter.config.collateral.address);
|
|
26819
26811
|
logger.verbose(`${this.metadata.name}::netAPY: ${vesuAdapter.config.collateral.symbol} LST APR from Endur: ${lstAPY}`);
|
|
26820
26812
|
baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
|
|
26821
26813
|
rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr?.value || "0") / 1e18, 0]);
|
|
@@ -27044,13 +27036,8 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
27044
27036
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
27045
27037
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
27046
27038
|
*/
|
|
27047
|
-
async getLSTAPR() {
|
|
27048
|
-
|
|
27049
|
-
return await LSTAPRService.getLSTAPR(this.asset().address);
|
|
27050
|
-
} catch (error) {
|
|
27051
|
-
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
27052
|
-
return 0;
|
|
27053
|
-
}
|
|
27039
|
+
async getLSTAPR(address) {
|
|
27040
|
+
return 0;
|
|
27054
27041
|
}
|
|
27055
27042
|
async getVesuHealthFactors() {
|
|
27056
27043
|
return await Promise.all(this.getVesuAdapters().map((v) => v.getHealthFactor()));
|
|
@@ -27744,6 +27731,19 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
27744
27731
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
27745
27732
|
return vesuAdapter1.config.debt;
|
|
27746
27733
|
}
|
|
27734
|
+
/**
|
|
27735
|
+
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
27736
|
+
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
27737
|
+
*/
|
|
27738
|
+
async getLSTAPR(_address) {
|
|
27739
|
+
try {
|
|
27740
|
+
const vesuAdapter1 = this.getVesuAdapters()[0];
|
|
27741
|
+
return await LSTAPRService2.getLSTAPR(vesuAdapter1.config.debt.address);
|
|
27742
|
+
} catch (error) {
|
|
27743
|
+
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
27744
|
+
return 0;
|
|
27745
|
+
}
|
|
27746
|
+
}
|
|
27747
27747
|
async getLSTExchangeRate() {
|
|
27748
27748
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
27749
27749
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
@@ -28133,7 +28133,7 @@ var PricerLST2 = class extends Pricer {
|
|
|
28133
28133
|
};
|
|
28134
28134
|
|
|
28135
28135
|
// src/modules/lst-apr.ts
|
|
28136
|
-
var
|
|
28136
|
+
var LSTAPRService2 = class {
|
|
28137
28137
|
// 5 minutes
|
|
28138
28138
|
/**
|
|
28139
28139
|
* Fetches LST stats from Endur API with caching
|
|
@@ -28215,7 +28215,6 @@ var LSTAPRService = class {
|
|
|
28215
28215
|
const stats = await this.getLSTStats();
|
|
28216
28216
|
const result = /* @__PURE__ */ new Map();
|
|
28217
28217
|
for (const stat of stats) {
|
|
28218
|
-
console.log("stat", stat);
|
|
28219
28218
|
result.set(stat.assetAddress, stat);
|
|
28220
28219
|
}
|
|
28221
28220
|
return result;
|
|
@@ -28229,10 +28228,10 @@ var LSTAPRService = class {
|
|
|
28229
28228
|
logger.verbose(`LSTAPRService: Cache cleared`);
|
|
28230
28229
|
}
|
|
28231
28230
|
};
|
|
28232
|
-
|
|
28233
|
-
|
|
28234
|
-
|
|
28235
|
-
|
|
28231
|
+
LSTAPRService2.ENDUR_API_URL = "https://app.endur.fi/api/lst/stats";
|
|
28232
|
+
LSTAPRService2.cache = null;
|
|
28233
|
+
LSTAPRService2.cacheTimestamp = 0;
|
|
28234
|
+
LSTAPRService2.CACHE_DURATION = 5 * 60 * 1e3;
|
|
28236
28235
|
|
|
28237
28236
|
// src/notifs/telegram.ts
|
|
28238
28237
|
var import_node_telegram_bot_api = __toESM(require("node-telegram-bot-api"));
|
package/dist/index.mjs
CHANGED
|
@@ -26704,20 +26704,12 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
26704
26704
|
logger.verbose(`${this.metadata.name}::netAPY: positions: ${JSON.stringify(positions)}`);
|
|
26705
26705
|
const baseAPYs = [];
|
|
26706
26706
|
const rewardAPYs = [];
|
|
26707
|
-
const underlyingAddresses = vesuAdapters.map((adapter) => adapter.config.debt.address);
|
|
26708
|
-
let lstAPRs;
|
|
26709
|
-
try {
|
|
26710
|
-
lstAPRs = await LSTAPRService.getLSTAPRs(underlyingAddresses);
|
|
26711
|
-
} catch (error) {
|
|
26712
|
-
logger.warn(`${this.metadata.name}::netAPY: Failed to fetch LST APRs from Endur API, using fallback: ${error}`);
|
|
26713
|
-
lstAPRs = /* @__PURE__ */ new Map();
|
|
26714
|
-
}
|
|
26715
26707
|
for (const [index, pool] of pools.entries()) {
|
|
26716
26708
|
const vesuAdapter = vesuAdapters[index];
|
|
26717
26709
|
const collateralAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.collateral.symbol.toLowerCase())?.stats;
|
|
26718
26710
|
const debtAsset = pool.assets.find((a) => a.symbol.toLowerCase() === vesuAdapter.config.debt.symbol.toLowerCase())?.stats;
|
|
26719
26711
|
const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
|
|
26720
|
-
const lstAPY =
|
|
26712
|
+
const lstAPY = await this.getLSTAPR(vesuAdapter.config.collateral.address);
|
|
26721
26713
|
logger.verbose(`${this.metadata.name}::netAPY: ${vesuAdapter.config.collateral.symbol} LST APR from Endur: ${lstAPY}`);
|
|
26722
26714
|
baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
|
|
26723
26715
|
rewardAPYs.push(...[Number(collateralAsset.defiSpringSupplyApr?.value || "0") / 1e18, 0]);
|
|
@@ -26946,13 +26938,8 @@ var UniversalStrategy = class _UniversalStrategy extends BaseStrategy {
|
|
|
26946
26938
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
26947
26939
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
26948
26940
|
*/
|
|
26949
|
-
async getLSTAPR() {
|
|
26950
|
-
|
|
26951
|
-
return await LSTAPRService.getLSTAPR(this.asset().address);
|
|
26952
|
-
} catch (error) {
|
|
26953
|
-
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
26954
|
-
return 0;
|
|
26955
|
-
}
|
|
26941
|
+
async getLSTAPR(address) {
|
|
26942
|
+
return 0;
|
|
26956
26943
|
}
|
|
26957
26944
|
async getVesuHealthFactors() {
|
|
26958
26945
|
return await Promise.all(this.getVesuAdapters().map((v) => v.getHealthFactor()));
|
|
@@ -27646,6 +27633,19 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
|
|
|
27646
27633
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
27647
27634
|
return vesuAdapter1.config.debt;
|
|
27648
27635
|
}
|
|
27636
|
+
/**
|
|
27637
|
+
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
27638
|
+
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
27639
|
+
*/
|
|
27640
|
+
async getLSTAPR(_address) {
|
|
27641
|
+
try {
|
|
27642
|
+
const vesuAdapter1 = this.getVesuAdapters()[0];
|
|
27643
|
+
return await LSTAPRService2.getLSTAPR(vesuAdapter1.config.debt.address);
|
|
27644
|
+
} catch (error) {
|
|
27645
|
+
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
27646
|
+
return 0;
|
|
27647
|
+
}
|
|
27648
|
+
}
|
|
27649
27649
|
async getLSTExchangeRate() {
|
|
27650
27650
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
27651
27651
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
@@ -28035,7 +28035,7 @@ var PricerLST2 = class extends Pricer {
|
|
|
28035
28035
|
};
|
|
28036
28036
|
|
|
28037
28037
|
// src/modules/lst-apr.ts
|
|
28038
|
-
var
|
|
28038
|
+
var LSTAPRService2 = class {
|
|
28039
28039
|
// 5 minutes
|
|
28040
28040
|
/**
|
|
28041
28041
|
* Fetches LST stats from Endur API with caching
|
|
@@ -28117,7 +28117,6 @@ var LSTAPRService = class {
|
|
|
28117
28117
|
const stats = await this.getLSTStats();
|
|
28118
28118
|
const result = /* @__PURE__ */ new Map();
|
|
28119
28119
|
for (const stat of stats) {
|
|
28120
|
-
console.log("stat", stat);
|
|
28121
28120
|
result.set(stat.assetAddress, stat);
|
|
28122
28121
|
}
|
|
28123
28122
|
return result;
|
|
@@ -28131,10 +28130,10 @@ var LSTAPRService = class {
|
|
|
28131
28130
|
logger.verbose(`LSTAPRService: Cache cleared`);
|
|
28132
28131
|
}
|
|
28133
28132
|
};
|
|
28134
|
-
|
|
28135
|
-
|
|
28136
|
-
|
|
28137
|
-
|
|
28133
|
+
LSTAPRService2.ENDUR_API_URL = "https://app.endur.fi/api/lst/stats";
|
|
28134
|
+
LSTAPRService2.cache = null;
|
|
28135
|
+
LSTAPRService2.cacheTimestamp = 0;
|
|
28136
|
+
LSTAPRService2.CACHE_DURATION = 5 * 60 * 1e3;
|
|
28138
28137
|
|
|
28139
28138
|
// src/notifs/telegram.ts
|
|
28140
28139
|
import TelegramBot from "node-telegram-bot-api";
|
|
@@ -28663,7 +28662,7 @@ export {
|
|
|
28663
28662
|
HyperLSTStrategies,
|
|
28664
28663
|
ILending,
|
|
28665
28664
|
Initializable,
|
|
28666
|
-
LSTAPRService,
|
|
28665
|
+
LSTAPRService2 as LSTAPRService,
|
|
28667
28666
|
MarginType,
|
|
28668
28667
|
Network,
|
|
28669
28668
|
PRICE_ROUTER,
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { Global } from "@/global";
|
|
|
6
6
|
import { ApproveCallParams, CommonAdapter, getVesuSingletonAddress, ManageCall, Swap, VesuAdapter, VesuModifyDelegationCallParams, VesuMultiplyCallParams, VesuPools } from "./universal-adapters";
|
|
7
7
|
import { AVNU_MIDDLEWARE } from "./universal-adapters/adapter-utils";
|
|
8
8
|
import { DepegRiskLevel, LiquidationRiskLevel, SmartContractRiskLevel, TechnicalRiskLevel } from "@/interfaces/risks";
|
|
9
|
-
import { EkuboQuoter, ERC20, PricerLST } from "@/modules";
|
|
9
|
+
import { EkuboQuoter, ERC20, LSTAPRService, PricerLST } from "@/modules";
|
|
10
10
|
import { assert, logger } from "@/utils";
|
|
11
11
|
import { SingleTokenInfo } from "./base-strategy";
|
|
12
12
|
import { Call, Contract, uint256 } from "starknet";
|
|
@@ -151,6 +151,20 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<UniversalS
|
|
|
151
151
|
return vesuAdapter1.config.debt;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
156
|
+
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
157
|
+
*/
|
|
158
|
+
async getLSTAPR(_address: ContractAddr): Promise<number> {
|
|
159
|
+
try {
|
|
160
|
+
const vesuAdapter1 = this.getVesuAdapters()[0];
|
|
161
|
+
return await LSTAPRService.getLSTAPR(vesuAdapter1.config.debt.address);
|
|
162
|
+
} catch (error) {
|
|
163
|
+
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
154
168
|
async getLSTExchangeRate() {
|
|
155
169
|
const [vesuAdapter1] = this.getVesuAdapters();
|
|
156
170
|
const lstTokenInfo = vesuAdapter1.config.collateral;
|
|
@@ -228,16 +228,6 @@ export class UniversalStrategy<
|
|
|
228
228
|
const baseAPYs: number[] = [];
|
|
229
229
|
const rewardAPYs: number[] = [];
|
|
230
230
|
|
|
231
|
-
// Get LST APRs for all collateral assets with fallback
|
|
232
|
-
const underlyingAddresses = vesuAdapters.map(adapter => adapter.config.debt.address);
|
|
233
|
-
let lstAPRs: Map<string, number>;
|
|
234
|
-
try {
|
|
235
|
-
lstAPRs = await LSTAPRService.getLSTAPRs(underlyingAddresses);
|
|
236
|
-
} catch (error) {
|
|
237
|
-
logger.warn(`${this.metadata.name}::netAPY: Failed to fetch LST APRs from Endur API, using fallback: ${error}`);
|
|
238
|
-
// Fallback: create empty map (will result in 0 LST APR)
|
|
239
|
-
lstAPRs = new Map();
|
|
240
|
-
}
|
|
241
231
|
|
|
242
232
|
for (const [index, pool] of pools.entries()) {
|
|
243
233
|
const vesuAdapter = vesuAdapters[index];
|
|
@@ -246,7 +236,7 @@ export class UniversalStrategy<
|
|
|
246
236
|
const supplyApy = Number(collateralAsset.supplyApy.value || 0) / 1e18;
|
|
247
237
|
|
|
248
238
|
// Use LST APR from Endur API instead of Vesu's lstApr
|
|
249
|
-
const lstAPY =
|
|
239
|
+
const lstAPY = await this.getLSTAPR(vesuAdapter.config.collateral.address);
|
|
250
240
|
logger.verbose(`${this.metadata.name}::netAPY: ${vesuAdapter.config.collateral.symbol} LST APR from Endur: ${lstAPY}`);
|
|
251
241
|
|
|
252
242
|
baseAPYs.push(...[supplyApy + lstAPY, Number(debtAsset.borrowApr.value) / 1e18]);
|
|
@@ -521,13 +511,8 @@ export class UniversalStrategy<
|
|
|
521
511
|
* Gets LST APR for the strategy's underlying asset from Endur API
|
|
522
512
|
* @returns Promise<number> The LST APR (not divided by 1e18)
|
|
523
513
|
*/
|
|
524
|
-
async getLSTAPR(): Promise<number> {
|
|
525
|
-
|
|
526
|
-
return await LSTAPRService.getLSTAPR(this.asset().address);
|
|
527
|
-
} catch (error) {
|
|
528
|
-
logger.warn(`${this.getTag()}: Failed to get LST APR: ${error}`);
|
|
529
|
-
return 0;
|
|
530
|
-
}
|
|
514
|
+
async getLSTAPR(address: ContractAddr): Promise<number> {
|
|
515
|
+
return 0;
|
|
531
516
|
}
|
|
532
517
|
|
|
533
518
|
async getVesuHealthFactors() {
|