@strkfarm/sdk 1.1.47 → 1.1.48

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.
@@ -94909,7 +94909,7 @@ spurious results.`);
94909
94909
  * @param params
94910
94910
  */
94911
94911
  async getVesuMultiplyCall(params) {
94912
- const [vesuAdapter1] = this.getVesuAdapters();
94912
+ const vesuAdapter1 = this.getVesuSameTokenAdapter();
94913
94913
  const legLTV = await vesuAdapter1.getLTVConfig(this.config);
94914
94914
  logger2.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
94915
94915
  if (!params.isDeposit) {
@@ -95385,7 +95385,7 @@ spurious results.`);
95385
95385
  adapters: [],
95386
95386
  targetHealthFactor: 1.1,
95387
95387
  minHealthFactor: 1.05,
95388
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
95388
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC"),
95389
95389
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC")
95390
95390
  };
95391
95391
  var hyperxsBTC = {
@@ -95398,7 +95398,7 @@ spurious results.`);
95398
95398
  adapters: [],
95399
95399
  targetHealthFactor: 1.1,
95400
95400
  minHealthFactor: 1.05,
95401
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
95401
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC"),
95402
95402
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC")
95403
95403
  };
95404
95404
  var hyperxLBTC = {
@@ -95411,7 +95411,7 @@ spurious results.`);
95411
95411
  adapters: [],
95412
95412
  targetHealthFactor: 1.1,
95413
95413
  minHealthFactor: 1.05,
95414
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
95414
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "LBTC"),
95415
95415
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC")
95416
95416
  };
95417
95417
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
@@ -31002,7 +31002,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
31002
31002
  * @param params
31003
31003
  */
31004
31004
  async getVesuMultiplyCall(params) {
31005
- const [vesuAdapter1] = this.getVesuAdapters();
31005
+ const vesuAdapter1 = this.getVesuSameTokenAdapter();
31006
31006
  const legLTV = await vesuAdapter1.getLTVConfig(this.config);
31007
31007
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
31008
31008
  if (!params.isDeposit) {
@@ -31478,7 +31478,7 @@ var hyperxtBTC = {
31478
31478
  adapters: [],
31479
31479
  targetHealthFactor: 1.1,
31480
31480
  minHealthFactor: 1.05,
31481
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31481
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC"),
31482
31482
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC")
31483
31483
  };
31484
31484
  var hyperxsBTC = {
@@ -31491,7 +31491,7 @@ var hyperxsBTC = {
31491
31491
  adapters: [],
31492
31492
  targetHealthFactor: 1.1,
31493
31493
  minHealthFactor: 1.05,
31494
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31494
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC"),
31495
31495
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC")
31496
31496
  };
31497
31497
  var hyperxLBTC = {
@@ -31504,7 +31504,7 @@ var hyperxLBTC = {
31504
31504
  adapters: [],
31505
31505
  targetHealthFactor: 1.1,
31506
31506
  minHealthFactor: 1.05,
31507
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31507
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "LBTC"),
31508
31508
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC")
31509
31509
  };
31510
31510
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
package/dist/index.js CHANGED
@@ -31002,7 +31002,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
31002
31002
  * @param params
31003
31003
  */
31004
31004
  async getVesuMultiplyCall(params) {
31005
- const [vesuAdapter1] = this.getVesuAdapters();
31005
+ const vesuAdapter1 = this.getVesuSameTokenAdapter();
31006
31006
  const legLTV = await vesuAdapter1.getLTVConfig(this.config);
31007
31007
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
31008
31008
  if (!params.isDeposit) {
@@ -31478,7 +31478,7 @@ var hyperxtBTC = {
31478
31478
  adapters: [],
31479
31479
  targetHealthFactor: 1.1,
31480
31480
  minHealthFactor: 1.05,
31481
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31481
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC"),
31482
31482
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC")
31483
31483
  };
31484
31484
  var hyperxsBTC = {
@@ -31491,7 +31491,7 @@ var hyperxsBTC = {
31491
31491
  adapters: [],
31492
31492
  targetHealthFactor: 1.1,
31493
31493
  minHealthFactor: 1.05,
31494
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31494
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC"),
31495
31495
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC")
31496
31496
  };
31497
31497
  var hyperxLBTC = {
@@ -31504,7 +31504,7 @@ var hyperxLBTC = {
31504
31504
  adapters: [],
31505
31505
  targetHealthFactor: 1.1,
31506
31506
  minHealthFactor: 1.05,
31507
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31507
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "LBTC"),
31508
31508
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC")
31509
31509
  };
31510
31510
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
package/dist/index.mjs CHANGED
@@ -30900,7 +30900,7 @@ var UniversalLstMultiplierStrategy = class _UniversalLstMultiplierStrategy exten
30900
30900
  * @param params
30901
30901
  */
30902
30902
  async getVesuMultiplyCall(params) {
30903
- const [vesuAdapter1] = this.getVesuAdapters();
30903
+ const vesuAdapter1 = this.getVesuSameTokenAdapter();
30904
30904
  const legLTV = await vesuAdapter1.getLTVConfig(this.config);
30905
30905
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
30906
30906
  if (!params.isDeposit) {
@@ -31376,7 +31376,7 @@ var hyperxtBTC = {
31376
31376
  adapters: [],
31377
31377
  targetHealthFactor: 1.1,
31378
31378
  minHealthFactor: 1.05,
31379
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31379
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "tBTC" || token.symbol === "WBTC"),
31380
31380
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "tBTC")
31381
31381
  };
31382
31382
  var hyperxsBTC = {
@@ -31389,7 +31389,7 @@ var hyperxsBTC = {
31389
31389
  adapters: [],
31390
31390
  targetHealthFactor: 1.1,
31391
31391
  minHealthFactor: 1.05,
31392
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31392
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "solvBTC"),
31393
31393
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "solvBTC")
31394
31394
  };
31395
31395
  var hyperxLBTC = {
@@ -31402,7 +31402,7 @@ var hyperxLBTC = {
31402
31402
  adapters: [],
31403
31403
  targetHealthFactor: 1.1,
31404
31404
  minHealthFactor: 1.05,
31405
- borrowable_assets: borrowableAssets.map((asset) => Global.getDefaultTokens().find((token) => token.symbol === asset)),
31405
+ borrowable_assets: Global.getDefaultTokens().filter((token) => token.symbol === "LBTC"),
31406
31406
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "LBTC")
31407
31407
  };
31408
31408
  function getInvestmentSteps(lstSymbol, underlyingSymbol) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strkfarm/sdk",
3
- "version": "1.1.47",
3
+ "version": "1.1.48",
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",
@@ -429,7 +429,7 @@ export class UniversalLstMultiplierStrategy extends UniversalStrategy<HyperLSTSt
429
429
  isDeposit: boolean,
430
430
  leg1DepositAmount: Web3Number
431
431
  }) {
432
- const [vesuAdapter1] = this.getVesuAdapters();
432
+ const vesuAdapter1 = this.getVesuSameTokenAdapter();
433
433
  const legLTV = await vesuAdapter1.getLTVConfig(this.config);
434
434
  logger.verbose(`${this.getTag()}::getVesuMultiplyCall legLTV: ${legLTV}`);
435
435
 
@@ -1046,7 +1046,7 @@ const hyperxtBTC: HyperLSTStrategySettings = {
1046
1046
  adapters: [],
1047
1047
  targetHealthFactor: 1.1,
1048
1048
  minHealthFactor: 1.05,
1049
- borrowable_assets: borrowableAssets.map(asset => Global.getDefaultTokens().find(token => token.symbol === asset)!),
1049
+ borrowable_assets: Global.getDefaultTokens().filter(token => token.symbol === 'tBTC' || token.symbol === 'WBTC'),
1050
1050
  underlyingToken: Global.getDefaultTokens().find(token => token.symbol === 'tBTC')!,
1051
1051
  }
1052
1052
 
@@ -1060,7 +1060,7 @@ const hyperxsBTC: HyperLSTStrategySettings = {
1060
1060
  adapters: [],
1061
1061
  targetHealthFactor: 1.1,
1062
1062
  minHealthFactor: 1.05,
1063
- borrowable_assets: borrowableAssets.map(asset => Global.getDefaultTokens().find(token => token.symbol === asset)!),
1063
+ borrowable_assets: Global.getDefaultTokens().filter(token => token.symbol === 'solvBTC'),
1064
1064
  underlyingToken: Global.getDefaultTokens().find(token => token.symbol === 'solvBTC')!,
1065
1065
  }
1066
1066
 
@@ -1074,7 +1074,7 @@ const hyperxLBTC: HyperLSTStrategySettings = {
1074
1074
  adapters: [],
1075
1075
  targetHealthFactor: 1.1,
1076
1076
  minHealthFactor: 1.05,
1077
- borrowable_assets: borrowableAssets.map(asset => Global.getDefaultTokens().find(token => token.symbol === asset)!),
1077
+ borrowable_assets: Global.getDefaultTokens().filter(token => token.symbol === 'LBTC'),
1078
1078
  underlyingToken: Global.getDefaultTokens().find(token => token.symbol === 'LBTC')!,
1079
1079
  }
1080
1080
 
@@ -1,159 +0,0 @@
1
- // import axios from 'axios';
2
- // import { ContractAddr } from '../dataTypes';
3
- // import { logger } from '../utils/logger';
4
-
5
- // /**
6
- // * Midas module for interacting with Midas API
7
- // * Provides functions to get APY, price, and TVL data for Midas tokens
8
- // */
9
- // export class Midas {
10
- // // Static mapping of contract addresses to Midas API symbols
11
- // private static readonly CONTRACT_TO_SYMBOL: Record<string, string> = {
12
- // '0x4e4fb1a9ca7e84bae609b9dc0078ad7719e49187ae7e425bb47d131710eddac': 'mre7btc', // mRe7BTC
13
- // '0x4be8945e61dc3e19ebadd1579a6bd53b262f51ba89e6f8b0c4bc9a7e3c633fc': 'mre7', // mRe7YIELD
14
- // };
15
-
16
- // private static readonly BASE_URL = 'https://api-prod.midas.app/api/data';
17
-
18
- // /**
19
- // * Check if a contract address is supported by Midas
20
- // * @param contractAddr The contract address to check
21
- // * @returns True if the contract address is supported
22
- // */
23
- // static isSupported(contractAddr: ContractAddr): boolean {
24
- // return contractAddr.address in Midas.CONTRACT_TO_SYMBOL;
25
- // }
26
-
27
- // /**
28
- // * Get the Midas symbol for a given contract address
29
- // * @param contractAddr The contract address to look up
30
- // * @returns The Midas symbol for the contract
31
- // * @throws Error if contract address is not found
32
- // */
33
- // static getSymbolFromContract(contractAddr: ContractAddr): string {
34
- // const symbol = Midas.CONTRACT_TO_SYMBOL[contractAddr.address];
35
- // if (!symbol) {
36
- // throw new Error(`Contract address ${contractAddr.address} not found in Midas mapping`);
37
- // }
38
- // return symbol;
39
- // }
40
-
41
- // /**
42
- // * Get APY data for all Midas tokens
43
- // * @returns Object with token symbols as keys and APY values as numbers
44
- // * @throws Error if API request fails
45
- // */
46
- // static async getAPYs(): Promise<Record<string, number>> {
47
- // try {
48
- // const response = await axios.get(`${Midas.BASE_URL}/apys`);
49
- // return response.data;
50
- // } catch (error) {
51
- // logger.error('Failed to fetch APYs from Midas API:', error);
52
- // throw new Error(`Failed to fetch APYs: ${error instanceof Error ? error.message : 'Unknown error'}`);
53
- // }
54
- // }
55
-
56
- // /**
57
- // * Get APY for a specific token by contract address
58
- // * @param contractAddr The contract address of the token
59
- // * @returns The APY value for the token
60
- // * @throws Error if contract address not found or API request fails
61
- // */
62
- // static async getAPY(contractAddr: ContractAddr): Promise<number> {
63
- // const symbol = Midas.getSymbolFromContract(contractAddr);
64
- // const apys = await Midas.getAPYs();
65
-
66
- // if (!(symbol in apys)) {
67
- // throw new Error(`Symbol ${symbol} not found in APY data`);
68
- // }
69
-
70
- // return apys[symbol];
71
- // }
72
-
73
- // /**
74
- // * Get price data for a specific token
75
- // * @param contractAddr The contract address of the token
76
- // * @param timestampFrom Optional start timestamp (defaults to 30 days ago)
77
- // * @param timestampTo Optional end timestamp (defaults to now)
78
- // * @param environment Environment (defaults to 'mainnet')
79
- // * @returns The latest price for the token
80
- // * @throws Error if contract address not found or API request fails
81
- // */
82
- // static async getPrice(
83
- // contractAddr: ContractAddr,
84
- // timestampFrom?: number,
85
- // timestampTo?: number,
86
- // environment: string = 'mainnet'
87
- // ): Promise<number> {
88
- // const symbol = Midas.getSymbolFromContract(contractAddr);
89
-
90
- // // Default to 30 days ago if not provided
91
- // const from = timestampFrom ?? Math.floor(Date.now() / 1000) - (30 * 24 * 60 * 60);
92
- // // Default to now if not provided
93
- // const to = timestampTo ?? Math.floor(Date.now() / 1000);
94
-
95
- // try {
96
- // const response = await axios.get(`${Midas.BASE_URL}/${symbol}/price`, {
97
- // params: {
98
- // timestampFrom: from,
99
- // timestampTo: to,
100
- // environment
101
- // }
102
- // });
103
-
104
- // const priceData = response.data;
105
- // if (!Array.isArray(priceData) || priceData.length === 0) {
106
- // throw new Error(`No price data found for ${symbol}`);
107
- // }
108
-
109
- // // Return the latest price (first item in the array)
110
- // return priceData[0].price;
111
- // } catch (error) {
112
- // logger.error(`Failed to fetch price for ${symbol}:`, error);
113
- // throw new Error(`Failed to fetch price for ${symbol}: ${error instanceof Error ? error.message : 'Unknown error'}`);
114
- // }
115
- // }
116
-
117
- // /**
118
- // * Get TVL data for all tokens
119
- // * @param environment Environment (defaults to 'mainnet')
120
- // * @returns Object with TVL data including totalTvl and tokenTvl
121
- // * @throws Error if API request fails
122
- // */
123
- // static async getTVLData(environment: string = 'mainnet'): Promise<{
124
- // lastUpdatedAt: string;
125
- // totalTvl: number;
126
- // tokenTvl: Record<string, any>;
127
- // }> {
128
- // try {
129
- // const response = await axios.get(`${Midas.BASE_URL}/tvl`, {
130
- // params: { environment }
131
- // });
132
- // return response.data;
133
- // } catch (error) {
134
- // logger.error('Failed to fetch TVL data from Midas API:', error);
135
- // throw new Error(`Failed to fetch TVL data: ${error instanceof Error ? error.message : 'Unknown error'}`);
136
- // }
137
- // }
138
-
139
- // /**
140
- // * Get TVL for a specific token by contract address
141
- // * @param contractAddr The contract address of the token
142
- // * @param environment Environment (defaults to 'mainnet')
143
- // * @returns The TVL data for the token (USD and native amounts)
144
- // * @throws Error if contract address not found or API request fails
145
- // */
146
- // static async getTVL(
147
- // contractAddr: ContractAddr,
148
- // environment: string = 'mainnet'
149
- // ): Promise<{ usd: number; native: number } | number> {
150
- // const symbol = Midas.getSymbolFromContract(contractAddr);
151
- // const tvlData = await Midas.getTVLData(environment);
152
-
153
- // if (!(symbol in tvlData.tokenTvl)) {
154
- // throw new Error(`Symbol ${symbol} not found in TVL data`);
155
- // }
156
-
157
- // return tvlData.tokenTvl[symbol];
158
- // }
159
- // }
@@ -1,202 +0,0 @@
1
- // import { ContractAddr, Web3Number } from '../dataTypes';
2
- // import { TokenInfo, IConfig } from '../interfaces';
3
- // import { PricerBase } from './pricerBase';
4
- // import { LSTAPRService } from './lst-apr';
5
- // import { Midas } from './midas';
6
- // import { SingleTokenInfo } from '../strategies/base-strategy';
7
- // import { logger } from '../utils/logger';
8
- // import { Contract } from 'starknet';
9
- // import { uint256 } from 'starknet';
10
- // import ERC4626Abi from '../data/erc4626.abi.json';
11
-
12
- // /**
13
- // * TokenMarketData class that combines LST APR and Midas modules
14
- // * to provide unified APY, price, and TVL functions for tokens
15
- // */
16
- // export class TokenMarketData {
17
- // private pricer: PricerBase;
18
- // private config: IConfig;
19
-
20
- // constructor(pricer: PricerBase, config: IConfig) {
21
- // this.pricer = pricer;
22
- // this.config = config;
23
- // }
24
-
25
- // /**
26
- // * Get APY for a token
27
- // * - If it's an LST token, returns LST APY
28
- // * - If it's a Midas token, returns Midas APY
29
- // * - Otherwise returns 0
30
- // * @param tokenInfo The token to get APY for
31
- // * @returns APY in absolute terms (not percentage)
32
- // */
33
- // async getAPY(tokenInfo: TokenInfo): Promise<number> {
34
- // try {
35
- // // Check if it's an LST token
36
- // if (LSTAPRService.isLST(tokenInfo.address)) {
37
- // const underlying = LSTAPRService.getUnderlyingFromLST(tokenInfo.address);
38
- // const lstApr = await LSTAPRService.getLSTAPR(underlying.address);
39
- // logger.verbose(`TokenMarketData: LST APY for ${tokenInfo.symbol}: ${lstApr}`);
40
- // return lstApr;
41
- // }
42
-
43
- // // Check if it's a Midas token by trying to get symbol
44
- // if (Midas.isSupported(tokenInfo.address)) {
45
- // const midasApy = await Midas.getAPY(tokenInfo.address);
46
- // logger.verbose(`TokenMarketData: Midas APY for ${tokenInfo.symbol}: ${midasApy}`);
47
- // return midasApy;
48
- // }
49
-
50
- // // Default to 0 for unsupported tokens
51
- // logger.verbose(`TokenMarketData: No APY data available for ${tokenInfo.symbol}, returning 0`);
52
- // return 0;
53
- // } catch (error) {
54
- // logger.error(`TokenMarketData: Error getting APY for ${tokenInfo.symbol}:`, error);
55
- // return 0;
56
- // }
57
- // }
58
-
59
- // /**
60
- // * Get price for a token using the pricer module
61
- // * @param tokenInfo The token to get price for
62
- // * @returns Price as a number
63
- // * @throws Error if price is 0 or unavailable
64
- // */
65
- // async getPrice(tokenInfo: TokenInfo): Promise<number> {
66
- // try {
67
- // const priceInfo = await this.pricer.getPrice(tokenInfo.symbol);
68
-
69
- // if (priceInfo.price === 0) {
70
- // throw new Error(`Price is 0 for token ${tokenInfo.symbol}`);
71
- // }
72
-
73
- // logger.verbose(`TokenMarketData: Price for ${tokenInfo.symbol}: ${priceInfo.price}`);
74
- // return priceInfo.price;
75
- // } catch (error) {
76
- // logger.error(`TokenMarketData: Error getting price for ${tokenInfo.symbol}:`, error);
77
- // throw new Error(`Failed to get price for ${tokenInfo.symbol}: ${error instanceof Error ? error.message : 'Unknown error'}`);
78
- // }
79
- // }
80
-
81
- // /**
82
- // * Get true price for a token
83
- // * - For LST tokens: Uses convert_to_assets to get true exchange rate
84
- // * - For Midas tokens: Uses Midas price API
85
- // * - For other tokens: Falls back to regular pricer
86
- // * @param tokenInfo The token to get true price for
87
- // * @returns True price as a number
88
- // * @throws Error if price is 0 or unavailable
89
- // */
90
- // async getTruePrice(tokenInfo: TokenInfo): Promise<number> {
91
- // try {
92
- // // For LST tokens, use convert_to_assets
93
- // if (LSTAPRService.isLST(tokenInfo.address)) {
94
- // const lstABI = new Contract({
95
- // abi: ERC4626Abi,
96
- // address: tokenInfo.address.address,
97
- // providerOrAccount: this.config.provider
98
- // });
99
-
100
- // const price: any = await lstABI.call('convert_to_assets', [
101
- // uint256.bnToUint256((new Web3Number(1, tokenInfo.decimals)).toWei())
102
- // ]);
103
- // const exchangeRate = Number(uint256.uint256ToBN(price).toString()) / Math.pow(10, tokenInfo.decimals);
104
-
105
- // if (exchangeRate === 0) {
106
- // throw new Error(`True price is 0 for LST token ${tokenInfo.symbol}`);
107
- // }
108
-
109
- // logger.verbose(`TokenMarketData: LST true price for ${tokenInfo.symbol}: ${exchangeRate}`);
110
- // return exchangeRate;
111
- // }
112
-
113
- // // For Midas tokens, use Midas price API
114
- // if (Midas.isSupported(tokenInfo.address)) {
115
- // const midasPrice = await Midas.getPrice(tokenInfo.address);
116
-
117
- // if (midasPrice === 0) {
118
- // throw new Error(`True price is 0 for Midas token ${tokenInfo.symbol}`);
119
- // }
120
-
121
- // logger.verbose(`TokenMarketData: Midas true price for ${tokenInfo.symbol}: ${midasPrice}`);
122
- // return midasPrice;
123
- // }
124
-
125
- // // For other tokens, fall back to regular pricer
126
- // const price = await this.getPrice(tokenInfo);
127
-
128
- // if (price === 0) {
129
- // throw new Error(`True price is 0 for token ${tokenInfo.symbol}`);
130
- // }
131
-
132
- // logger.verbose(`TokenMarketData: Regular price for ${tokenInfo.symbol}: ${price}`);
133
- // return price;
134
- // } catch (error) {
135
- // logger.error(`TokenMarketData: Error getting true price for ${tokenInfo.symbol}:`, error);
136
- // throw new Error(`Failed to get true price for ${tokenInfo.symbol}: ${error instanceof Error ? error.message : 'Unknown error'}`);
137
- // }
138
- // }
139
-
140
- // /**
141
- // * Get TVL for a token
142
- // * - If it's a Midas token, returns Midas TVL data
143
- // * - Otherwise returns 0
144
- // * @param tokenInfo The token to get TVL for
145
- // * @returns TVL as SingleTokenInfo or 0
146
- // */
147
- // async getTVL(tokenInfo: TokenInfo): Promise<SingleTokenInfo> {
148
- // // Check if it's a Midas token by trying to get TVL
149
- // if (Midas.isSupported(tokenInfo.address)) {
150
- // const midasTvl = await Midas.getTVL(tokenInfo.address);
151
-
152
- // // Handle different TVL response formats
153
- // let usdValue: number;
154
- // let nativeAmount: number;
155
-
156
- // if (typeof midasTvl === 'number') {
157
- // // Simple number format (e.g., mre7: 18193466)
158
- // usdValue = midasTvl;
159
- // nativeAmount = 0; // We don't have native amount in this format
160
- // } else if (typeof midasTvl === 'object' && 'usd' in midasTvl && 'native' in midasTvl) {
161
- // // Object format with usd and native (e.g., mre7btc: {usd: 998826, native: 9.3228})
162
- // usdValue = midasTvl.usd;
163
- // nativeAmount = midasTvl.native;
164
- // } else {
165
- // throw new Error(`Unexpected TVL format for ${tokenInfo.symbol}`);
166
- // }
167
-
168
- // const tvlInfo: SingleTokenInfo = {
169
- // tokenInfo,
170
- // amount: Web3Number.fromWei(nativeAmount, tokenInfo.decimals),
171
- // usdValue
172
- // };
173
-
174
- // logger.verbose(`TokenMarketData: Midas TVL for ${tokenInfo.symbol}: USD=${usdValue}, Native=${nativeAmount}`);
175
- // return tvlInfo;
176
- // }
177
-
178
- // return {
179
- // tokenInfo,
180
- // amount: Web3Number.fromWei('0', tokenInfo.decimals),
181
- // usdValue: 0
182
- // }
183
- // }
184
-
185
- // /**
186
- // * Check if a token is supported for APY data
187
- // * @param tokenInfo The token to check
188
- // * @returns True if the token has APY data available
189
- // */
190
- // isAPYSupported(tokenInfo: TokenInfo): boolean {
191
- // return LSTAPRService.isLST(tokenInfo.address) || Midas.isSupported(tokenInfo.address);
192
- // }
193
-
194
- // /**
195
- // * Check if a token is supported for TVL data
196
- // * @param tokenInfo The token to check
197
- // * @returns True if the token has TVL data available
198
- // */
199
- // isTVLSupported(tokenInfo: TokenInfo): boolean {
200
- // return Midas.isSupported(tokenInfo.address);
201
- // }
202
- // }