@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.
- package/cjs/markets/morphoBlue/index.d.ts +34 -34
- package/cjs/markets/morphoBlue/index.js +791 -800
- package/cjs/morphoBlue/index.js +4 -3
- package/esm/markets/morphoBlue/index.d.ts +34 -34
- package/esm/markets/morphoBlue/index.js +717 -726
- package/esm/morphoBlue/index.js +4 -3
- package/package.json +1 -1
- package/src/markets/morphoBlue/index.ts +715 -804
- package/src/morphoBlue/index.ts +5 -3
package/esm/morphoBlue/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { isMainnetNetwork, wethToEth } from '../services/utils';
|
|
|
17
17
|
import { getBorrowRate, getMorphoBlueAggregatedPositionData, getRewardsForMarket, getSupplyRate, } from '../helpers/morphoBlueHelpers';
|
|
18
18
|
import { getChainlinkAssetAddress } from '../services/priceService';
|
|
19
19
|
import { getViemProvider, setViemBlockNumber } from '../services/viem';
|
|
20
|
+
const HARDCODED_USD_STABLE_PRICE = '100000000'; // $1 with 8 decimals
|
|
20
21
|
export function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
21
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
23
|
const { loanToken, collateralToken, oracle, irm, lltv, oracleType, } = selectedMarket;
|
|
@@ -27,12 +28,12 @@ export function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
27
28
|
const morphoBlueViewContract = MorphoBlueViewContractViem(provider, network);
|
|
28
29
|
let marketInfo;
|
|
29
30
|
let loanTokenPrice;
|
|
30
|
-
const
|
|
31
|
+
const isHardcodedUsdStable = ['USDA', 'RLUSD'].includes(loanTokenInfo.symbol);
|
|
31
32
|
const isMainnet = isMainnetNetwork(network);
|
|
32
33
|
if (isMainnet) {
|
|
33
34
|
const feedRegistryContract = FeedRegistryContractViem(provider, NetworkNumber.Eth);
|
|
34
35
|
const [_loanTokenPrice, _marketInfo] = yield Promise.all([
|
|
35
|
-
|
|
36
|
+
isHardcodedUsdStable ? Promise.resolve(HARDCODED_USD_STABLE_PRICE) : feedRegistryContract.read.latestAnswer([loanTokenFeedAddress, USD_QUOTE]),
|
|
36
37
|
morphoBlueViewContract.read.getMarketInfoNotTuple([loanToken, collateralToken, oracle, irm, BigInt(lltvInWei)]),
|
|
37
38
|
]);
|
|
38
39
|
marketInfo = _marketInfo;
|
|
@@ -42,7 +43,7 @@ export function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
|
42
43
|
// Currently only base network is supported
|
|
43
44
|
const feedRegistryContract = DFSFeedRegistryContractViem(provider, network);
|
|
44
45
|
const [loanTokenPriceRound, _marketInfo] = yield Promise.all([
|
|
45
|
-
|
|
46
|
+
isHardcodedUsdStable ? Promise.resolve([0, HARDCODED_USD_STABLE_PRICE]) // Normalize to match the expected object structure
|
|
46
47
|
: feedRegistryContract.read.latestRoundData([loanTokenFeedAddress, USD_QUOTE]),
|
|
47
48
|
morphoBlueViewContract.read.getMarketInfoNotTuple([loanToken, collateralToken, oracle, irm, BigInt(lltvInWei)]),
|
|
48
49
|
]);
|