@defisaver/positions-sdk 2.1.117-dev-13004-dev → 2.1.117-dev-13004-2-dev

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.
@@ -19,6 +19,8 @@ import {
19
19
  import { getChainlinkAssetAddress } from '../services/priceService';
20
20
  import { getViemProvider, setViemBlockNumber } from '../services/viem';
21
21
 
22
+ const HARDCODED_USD_STABLE_PRICE = '100000000'; // $1 with 8 decimals
23
+
22
24
  export async function _getMorphoBlueMarketData(provider: Client, network: NetworkNumber, selectedMarket: MorphoBlueMarketData): Promise<MorphoBlueMarketInfo> {
23
25
  const {
24
26
  loanToken, collateralToken, oracle, irm, lltv, oracleType,
@@ -34,12 +36,12 @@ export async function _getMorphoBlueMarketData(provider: Client, network: Networ
34
36
 
35
37
  let marketInfo;
36
38
  let loanTokenPrice;
37
- const isTokenUSDA = loanTokenInfo.symbol === 'USDA';
39
+ const isHardcodedUsdStable = ['USDA', 'RLUSD'].includes(loanTokenInfo.symbol);
38
40
  const isMainnet = isMainnetNetwork(network);
39
41
  if (isMainnet) {
40
42
  const feedRegistryContract = FeedRegistryContractViem(provider, NetworkNumber.Eth);
41
43
  const [_loanTokenPrice, _marketInfo] = await Promise.all([
42
- isTokenUSDA ? Promise.resolve('100000000') : feedRegistryContract.read.latestAnswer([loanTokenFeedAddress, USD_QUOTE]),
44
+ isHardcodedUsdStable ? Promise.resolve(HARDCODED_USD_STABLE_PRICE) : feedRegistryContract.read.latestAnswer([loanTokenFeedAddress, USD_QUOTE]),
43
45
  morphoBlueViewContract.read.getMarketInfoNotTuple([loanToken, collateralToken, oracle, irm, BigInt(lltvInWei)]),
44
46
  ]);
45
47
  marketInfo = _marketInfo;
@@ -49,7 +51,7 @@ export async function _getMorphoBlueMarketData(provider: Client, network: Networ
49
51
  const feedRegistryContract = DFSFeedRegistryContractViem(provider, network);
50
52
 
51
53
  const [loanTokenPriceRound, _marketInfo] = await Promise.all([
52
- isTokenUSDA ? Promise.resolve([0, '100000000']) // Normalize to match the expected object structure
54
+ isHardcodedUsdStable ? Promise.resolve([0, HARDCODED_USD_STABLE_PRICE]) // Normalize to match the expected object structure
53
55
  : feedRegistryContract.read.latestRoundData([loanTokenFeedAddress, USD_QUOTE]),
54
56
  morphoBlueViewContract.read.getMarketInfoNotTuple([loanToken, collateralToken, oracle, irm, BigInt(lltvInWei)]),
55
57
  ]);