@defisaver/positions-sdk 2.1.127-dev → 2.1.127-midnight-1-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/config/contracts.d.ts +249 -0
- package/cjs/config/contracts.js +11 -1
- package/cjs/contracts.d.ts +1510 -0
- package/cjs/contracts.js +3 -2
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +0 -1
- package/cjs/helpers/morphoMidnightHelpers/index.d.ts +50 -0
- package/cjs/helpers/morphoMidnightHelpers/index.js +170 -0
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +4 -1
- package/cjs/markets/morphoMidnight/index.d.ts +16 -0
- package/cjs/markets/morphoMidnight/index.js +159 -0
- package/cjs/morphoBlue/index.d.ts +6 -8
- package/cjs/morphoBlue/index.js +40 -69
- package/cjs/morphoMidnight/index.d.ts +14 -0
- package/cjs/morphoMidnight/index.js +244 -0
- package/cjs/portfolio/discovery.js +4 -0
- package/cjs/portfolio/index.js +45 -1
- package/cjs/services/viem.d.ts +11 -11
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/morphoBlue.d.ts +0 -9
- package/cjs/types/morphoMidnight.d.ts +94 -0
- package/cjs/types/morphoMidnight.js +15 -0
- package/cjs/types/portfolio.d.ts +4 -0
- package/esm/config/contracts.d.ts +249 -0
- package/esm/config/contracts.js +9 -0
- package/esm/contracts.d.ts +1510 -0
- package/esm/contracts.js +1 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/morphoBlueHelpers/index.js +0 -1
- package/esm/helpers/morphoMidnightHelpers/index.d.ts +50 -0
- package/esm/helpers/morphoMidnightHelpers/index.js +159 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/markets/morphoMidnight/index.d.ts +16 -0
- package/esm/markets/morphoMidnight/index.js +148 -0
- package/esm/morphoBlue/index.d.ts +6 -8
- package/esm/morphoBlue/index.js +39 -62
- package/esm/morphoMidnight/index.d.ts +14 -0
- package/esm/morphoMidnight/index.js +231 -0
- package/esm/portfolio/discovery.js +5 -1
- package/esm/portfolio/index.js +47 -3
- package/esm/services/viem.d.ts +11 -11
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/morphoBlue.d.ts +0 -9
- package/esm/types/morphoMidnight.d.ts +94 -0
- package/esm/types/morphoMidnight.js +12 -0
- package/esm/types/portfolio.d.ts +4 -0
- package/package.json +1 -1
- package/src/config/contracts.ts +9 -0
- package/src/contracts.ts +1 -0
- package/src/helpers/index.ts +1 -0
- package/src/helpers/morphoBlueHelpers/index.ts +0 -1
- package/src/helpers/morphoMidnightHelpers/index.ts +219 -0
- package/src/index.ts +2 -0
- package/src/markets/index.ts +1 -0
- package/src/markets/morphoMidnight/index.ts +161 -0
- package/src/morphoBlue/index.ts +44 -101
- package/src/morphoMidnight/index.ts +261 -0
- package/src/portfolio/discovery.ts +6 -0
- package/src/portfolio/index.ts +46 -2
- package/src/types/index.ts +1 -0
- package/src/types/morphoBlue.ts +0 -11
- package/src/types/morphoMidnight.ts +110 -0
- package/src/types/portfolio.ts +4 -0
package/cjs/morphoBlue/index.js
CHANGED
|
@@ -12,12 +12,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.getMorphoBlueAccountBalances = exports._getMorphoBlueAccountBalances =
|
|
15
|
+
exports.getMorphoBlueAccountBalances = exports._getMorphoBlueAccountBalances = void 0;
|
|
16
16
|
exports._getMorphoBlueMarketData = _getMorphoBlueMarketData;
|
|
17
|
-
exports._getMorphoBluePortfolioMarketData = _getMorphoBluePortfolioMarketData;
|
|
18
17
|
exports.getMorphoBlueMarketData = getMorphoBlueMarketData;
|
|
19
|
-
exports.getMorphoBluePortfolioMarketData = getMorphoBluePortfolioMarketData;
|
|
20
|
-
exports.getMorphoBlueMarketRewards = getMorphoBlueMarketRewards;
|
|
21
18
|
exports._getMorphoBlueAccountData = _getMorphoBlueAccountData;
|
|
22
19
|
exports.getMorphoBlueAccountData = getMorphoBlueAccountData;
|
|
23
20
|
exports.getMorphoEarn = getMorphoEarn;
|
|
@@ -32,21 +29,7 @@ const morphoBlueHelpers_1 = require("../helpers/morphoBlueHelpers");
|
|
|
32
29
|
const priceService_1 = require("../services/priceService");
|
|
33
30
|
const viem_1 = require("../services/viem");
|
|
34
31
|
const HARDCODED_USD_STABLE_PRICE = '100000000'; // $1 with 8 decimals
|
|
35
|
-
|
|
36
|
-
token: 'MORPHO',
|
|
37
|
-
apy,
|
|
38
|
-
incentiveKind: common_1.IncentiveKind.Reward,
|
|
39
|
-
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
40
|
-
}];
|
|
41
|
-
const addMorphoBlueRewardsToMarketInfo = (marketInfo, rewards) => (Object.assign(Object.assign({}, marketInfo), { assetsData: Object.assign(Object.assign({}, marketInfo.assetsData), { [marketInfo.loanToken]: Object.assign(Object.assign({}, marketInfo.assetsData[marketInfo.loanToken]), { supplyIncentives: [
|
|
42
|
-
...marketInfo.assetsData[marketInfo.loanToken].supplyIncentives.filter(({ token }) => token !== 'MORPHO'),
|
|
43
|
-
...getMorphoRewardIncentives(rewards.supplyApy),
|
|
44
|
-
], borrowIncentives: [
|
|
45
|
-
...marketInfo.assetsData[marketInfo.loanToken].borrowIncentives.filter(({ token }) => token !== 'MORPHO'),
|
|
46
|
-
...getMorphoRewardIncentives(rewards.borrowApy),
|
|
47
|
-
] }) }) }));
|
|
48
|
-
exports.addMorphoBlueRewardsToMarketInfo = addMorphoBlueRewardsToMarketInfo;
|
|
49
|
-
function getMorphoBlueMarketDataInternal(provider, network, selectedMarket) {
|
|
32
|
+
function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
50
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
34
|
const { loanToken, collateralToken, oracle, irm, lltv, oracleType, } = selectedMarket;
|
|
52
35
|
const lltvInWei = new decimal_js_1.default(lltv).mul(constants_1.WAD).toString();
|
|
@@ -78,6 +61,16 @@ function getMorphoBlueMarketDataInternal(provider, network, selectedMarket) {
|
|
|
78
61
|
marketInfo = _marketInfo;
|
|
79
62
|
loanTokenPrice = loanTokenPriceRound[1].toString();
|
|
80
63
|
}
|
|
64
|
+
let morphoSupplyApy = '0';
|
|
65
|
+
let morphoBorrowApy = '0';
|
|
66
|
+
try {
|
|
67
|
+
const { supplyApy: _morphoSupplyApy, borrowApy: _morphoBorrowApy } = yield (0, morphoBlueHelpers_1.getRewardsForMarket)(selectedMarket.marketId, network);
|
|
68
|
+
morphoSupplyApy = _morphoSupplyApy;
|
|
69
|
+
morphoBorrowApy = _morphoBorrowApy;
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
console.error(e);
|
|
73
|
+
}
|
|
81
74
|
const supplyRate = (0, morphoBlueHelpers_1.getSupplyRate)(marketInfo.totalSupplyAssets.toString(), marketInfo.totalBorrowAssets.toString(), marketInfo.borrowRate.toString(), marketInfo.fee.toString());
|
|
82
75
|
const compoundedBorrowRate = (0, morphoBlueHelpers_1.getBorrowRate)(marketInfo.borrowRate.toString(), marketInfo.totalBorrowShares.toString());
|
|
83
76
|
const utillization = new decimal_js_1.default(marketInfo.totalBorrowAssets.toString()).div(marketInfo.totalSupplyAssets.toString()).mul(100).toString();
|
|
@@ -96,8 +89,18 @@ function getMorphoBlueMarketDataInternal(provider, network, selectedMarket) {
|
|
|
96
89
|
totalBorrow: new decimal_js_1.default(marketInfo.totalBorrowAssets.toString()).div(scale).toString(),
|
|
97
90
|
canBeSupplied: true,
|
|
98
91
|
canBeBorrowed: true,
|
|
99
|
-
supplyIncentives: [
|
|
100
|
-
|
|
92
|
+
supplyIncentives: [{
|
|
93
|
+
token: 'MORPHO',
|
|
94
|
+
apy: morphoSupplyApy,
|
|
95
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
96
|
+
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
97
|
+
}],
|
|
98
|
+
borrowIncentives: [{
|
|
99
|
+
token: 'MORPHO',
|
|
100
|
+
apy: morphoBorrowApy,
|
|
101
|
+
incentiveKind: common_1.IncentiveKind.Reward,
|
|
102
|
+
description: 'Eligible for protocol-level MORPHO incentives.',
|
|
103
|
+
}],
|
|
101
104
|
};
|
|
102
105
|
assetsData[(0, utils_1.wethToEth)(collateralTokenInfo.symbol)] = {
|
|
103
106
|
symbol: (0, utils_1.wethToEth)(collateralTokenInfo.symbol),
|
|
@@ -132,56 +135,11 @@ function getMorphoBlueMarketDataInternal(provider, network, selectedMarket) {
|
|
|
132
135
|
};
|
|
133
136
|
});
|
|
134
137
|
}
|
|
135
|
-
function _getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
136
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
-
const marketInfo = yield getMorphoBlueMarketDataInternal(provider, network, selectedMarket);
|
|
138
|
-
try {
|
|
139
|
-
const rewards = yield (0, morphoBlueHelpers_1.getRewardsForMarket)(selectedMarket.marketId, network);
|
|
140
|
-
return (0, exports.addMorphoBlueRewardsToMarketInfo)(marketInfo, rewards);
|
|
141
|
-
}
|
|
142
|
-
catch (error) {
|
|
143
|
-
console.error(error);
|
|
144
|
-
return (0, exports.addMorphoBlueRewardsToMarketInfo)(marketInfo, { supplyApy: '0', borrowApy: '0' });
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
function _getMorphoBluePortfolioMarketData(provider, network, selectedMarket) {
|
|
149
|
-
return getMorphoBlueMarketDataInternal(provider, network, selectedMarket);
|
|
150
|
-
}
|
|
151
138
|
function getMorphoBlueMarketData(provider, network, selectedMarket) {
|
|
152
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
140
|
return _getMorphoBlueMarketData((0, viem_1.getViemProvider)(provider, network), network, selectedMarket);
|
|
154
141
|
});
|
|
155
142
|
}
|
|
156
|
-
function getMorphoBluePortfolioMarketData(provider, network, selectedMarket) {
|
|
157
|
-
return _getMorphoBluePortfolioMarketData((0, viem_1.getViemProvider)(provider, network), network, selectedMarket);
|
|
158
|
-
}
|
|
159
|
-
const getMorphoBluePositionDataWithMarketInfo = (data, marketInfo) => (Object.assign(Object.assign({}, data), (0, morphoBlueHelpers_1.getMorphoBlueAggregatedPositionData)({
|
|
160
|
-
usedAssets: data.usedAssets,
|
|
161
|
-
assetsData: marketInfo.assetsData,
|
|
162
|
-
marketInfo,
|
|
163
|
-
})));
|
|
164
|
-
exports.getMorphoBluePositionDataWithMarketInfo = getMorphoBluePositionDataWithMarketInfo;
|
|
165
|
-
const getMorphoEarnDataWithMarketInfo = (data, marketInfo) => {
|
|
166
|
-
const loanTokenInfo = marketInfo.assetsData[marketInfo.loanToken];
|
|
167
|
-
const usedAssets = {
|
|
168
|
-
[marketInfo.loanToken]: {
|
|
169
|
-
symbol: loanTokenInfo.symbol,
|
|
170
|
-
supplied: data.amount,
|
|
171
|
-
borrowed: '0',
|
|
172
|
-
isSupplied: new decimal_js_1.default(data.amount).gt(0),
|
|
173
|
-
isBorrowed: false,
|
|
174
|
-
collateral: false,
|
|
175
|
-
suppliedUsd: data.amountUsd,
|
|
176
|
-
borrowedUsd: '0',
|
|
177
|
-
},
|
|
178
|
-
};
|
|
179
|
-
return Object.assign(Object.assign({}, data), { apy: (0, staking_1.calculateNetApy)({ usedAssets, assetsData: marketInfo.assetsData }).netApy });
|
|
180
|
-
};
|
|
181
|
-
exports.getMorphoEarnDataWithMarketInfo = getMorphoEarnDataWithMarketInfo;
|
|
182
|
-
function getMorphoBlueMarketRewards(network, selectedMarket) {
|
|
183
|
-
return (0, morphoBlueHelpers_1.getRewardsForMarket)(selectedMarket.marketId, network);
|
|
184
|
-
}
|
|
185
143
|
const _getMorphoBlueAccountBalances = (provider, network, block, addressMapping, address, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
|
|
186
144
|
let balances = {
|
|
187
145
|
collateral: {},
|
|
@@ -271,10 +229,23 @@ function getMorphoEarn(provider, network, account, selectedMarket, marketInfo) {
|
|
|
271
229
|
const loanTokenInfo = marketInfo.assetsData[marketInfo.loanToken];
|
|
272
230
|
const loanTokenSupplied = (0, tokens_1.assetAmountInEth)(loanInfo.suppliedInAssets.toString(), marketInfo.loanToken);
|
|
273
231
|
const loanTokenSuppliedUsd = new decimal_js_1.default(loanTokenSupplied).mul(loanTokenInfo.price).toString();
|
|
274
|
-
|
|
275
|
-
|
|
232
|
+
const usedAssets = {
|
|
233
|
+
[marketInfo.loanToken]: {
|
|
234
|
+
symbol: loanTokenInfo.symbol,
|
|
235
|
+
supplied: loanTokenSupplied,
|
|
236
|
+
borrowed: '0',
|
|
237
|
+
isSupplied: new decimal_js_1.default(loanInfo.suppliedInAssets.toString()).gt(0),
|
|
238
|
+
isBorrowed: false,
|
|
239
|
+
collateral: false,
|
|
240
|
+
suppliedUsd: loanTokenSuppliedUsd,
|
|
241
|
+
borrowedUsd: '0',
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
const { netApy } = (0, staking_1.calculateNetApy)({ usedAssets, assetsData: marketInfo.assetsData });
|
|
245
|
+
return {
|
|
246
|
+
apy: netApy,
|
|
276
247
|
amount: loanTokenSupplied,
|
|
277
248
|
amountUsd: loanTokenSuppliedUsd,
|
|
278
|
-
}
|
|
249
|
+
};
|
|
279
250
|
});
|
|
280
251
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Client } from 'viem';
|
|
2
|
+
import { Blockish, EthAddress, EthereumProvider, NetworkNumber, PositionBalances } from '../types/common';
|
|
3
|
+
import { MorphoMidnightMarketData, MorphoMidnightMarketInfo, MorphoMidnightPositionData } from '../types';
|
|
4
|
+
export declare function _getMorphoMidnightMarketData(provider: Client, network: NetworkNumber, selectedMarket: MorphoMidnightMarketData): Promise<MorphoMidnightMarketInfo>;
|
|
5
|
+
export declare function getMorphoMidnightMarketData(provider: EthereumProvider, network: NetworkNumber, selectedMarket: MorphoMidnightMarketData): Promise<MorphoMidnightMarketInfo>;
|
|
6
|
+
export declare function _getMorphoMidnightAccountData(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoMidnightMarketData, marketInfo: MorphoMidnightMarketInfo): Promise<MorphoMidnightPositionData>;
|
|
7
|
+
export declare function getMorphoMidnightAccountData(provider: EthereumProvider, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoMidnightMarketData, marketInfo: MorphoMidnightMarketInfo): Promise<MorphoMidnightPositionData>;
|
|
8
|
+
export declare const _getMorphoMidnightAccountBalances: (provider: Client, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, selectedMarket: MorphoMidnightMarketData) => Promise<PositionBalances>;
|
|
9
|
+
export declare const getMorphoMidnightAccountBalances: (provider: EthereumProvider, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress, selectedMarket: MorphoMidnightMarketData) => Promise<PositionBalances>;
|
|
10
|
+
export declare function getMorphoMidnightEarn(provider: Client, network: NetworkNumber, account: EthAddress, selectedMarket: MorphoMidnightMarketData, marketInfo: MorphoMidnightMarketInfo): Promise<{
|
|
11
|
+
apy: string;
|
|
12
|
+
amount: string;
|
|
13
|
+
amountUsd: string;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getMorphoMidnightAccountBalances = exports._getMorphoMidnightAccountBalances = void 0;
|
|
16
|
+
exports._getMorphoMidnightMarketData = _getMorphoMidnightMarketData;
|
|
17
|
+
exports.getMorphoMidnightMarketData = getMorphoMidnightMarketData;
|
|
18
|
+
exports._getMorphoMidnightAccountData = _getMorphoMidnightAccountData;
|
|
19
|
+
exports.getMorphoMidnightAccountData = getMorphoMidnightAccountData;
|
|
20
|
+
exports.getMorphoMidnightEarn = getMorphoMidnightEarn;
|
|
21
|
+
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
22
|
+
const tokens_1 = require("@defisaver/tokens");
|
|
23
|
+
const common_1 = require("../types/common");
|
|
24
|
+
const contracts_1 = require("../contracts");
|
|
25
|
+
const constants_1 = require("../constants");
|
|
26
|
+
const staking_1 = require("../staking");
|
|
27
|
+
const utils_1 = require("../services/utils");
|
|
28
|
+
const morphoMidnightHelpers_1 = require("../helpers/morphoMidnightHelpers");
|
|
29
|
+
const priceService_1 = require("../services/priceService");
|
|
30
|
+
const viem_1 = require("../services/viem");
|
|
31
|
+
const HARDCODED_USD_STABLE_PRICE = '100000000'; // $1 with 8 decimals
|
|
32
|
+
const nowInSeconds = () => Math.floor(Date.now() / 1000);
|
|
33
|
+
function _getMorphoMidnightMarketData(provider, network, selectedMarket) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const { loanToken, collaterals, marketId } = selectedMarket;
|
|
36
|
+
const loanTokenInfo = (0, tokens_1.getAssetInfoByAddress)(loanToken, network);
|
|
37
|
+
const loanSym = (0, utils_1.wethToEth)(loanTokenInfo.symbol);
|
|
38
|
+
const loanTokenFeedAddress = (0, priceService_1.getChainlinkAssetAddress)(loanTokenInfo.symbol, network);
|
|
39
|
+
const viewContract = (0, contracts_1.MorphoMidnightViewContractViem)(provider, network);
|
|
40
|
+
const isHardcodedUsdStable = ['USDA', 'RLUSD'].includes(loanTokenInfo.symbol);
|
|
41
|
+
let marketInfo;
|
|
42
|
+
let loanTokenPrice;
|
|
43
|
+
if ((0, utils_1.isMainnetNetwork)(network)) {
|
|
44
|
+
const feedRegistryContract = (0, contracts_1.FeedRegistryContractViem)(provider, common_1.NetworkNumber.Eth);
|
|
45
|
+
const [_loanTokenPrice, _marketInfo] = yield Promise.all([
|
|
46
|
+
isHardcodedUsdStable ? Promise.resolve(HARDCODED_USD_STABLE_PRICE) : feedRegistryContract.read.latestAnswer([loanTokenFeedAddress, constants_1.USD_QUOTE]),
|
|
47
|
+
viewContract.read.getMarketInfo([marketId]),
|
|
48
|
+
]);
|
|
49
|
+
marketInfo = _marketInfo;
|
|
50
|
+
loanTokenPrice = _loanTokenPrice;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Currently only Base is supported
|
|
54
|
+
const feedRegistryContract = (0, contracts_1.DFSFeedRegistryContractViem)(provider, network);
|
|
55
|
+
const [loanTokenPriceRound, _marketInfo] = yield Promise.all([
|
|
56
|
+
isHardcodedUsdStable ? Promise.resolve([0, HARDCODED_USD_STABLE_PRICE]) : feedRegistryContract.read.latestRoundData([loanTokenFeedAddress, constants_1.USD_QUOTE]),
|
|
57
|
+
viewContract.read.getMarketInfo([marketId]),
|
|
58
|
+
]);
|
|
59
|
+
marketInfo = _marketInfo;
|
|
60
|
+
loanTokenPrice = loanTokenPriceRound[1].toString();
|
|
61
|
+
}
|
|
62
|
+
const loanTokenUsd = new decimal_js_1.default(loanTokenPrice).div(1e8).toString();
|
|
63
|
+
const totalUnits = marketInfo.totalUnits.toString();
|
|
64
|
+
const withdrawable = marketInfo.withdrawable.toString();
|
|
65
|
+
const totalDebt = decimal_js_1.default.max(new decimal_js_1.default(totalUnits).sub(withdrawable), 0).toString();
|
|
66
|
+
const assetsData = {};
|
|
67
|
+
assetsData[loanSym] = {
|
|
68
|
+
symbol: loanSym,
|
|
69
|
+
address: loanToken,
|
|
70
|
+
price: loanTokenUsd,
|
|
71
|
+
supplyRate: '0', // fixed rate is orderbook-derived, not exposed on-chain (MVP)
|
|
72
|
+
borrowRate: '0',
|
|
73
|
+
totalSupply: (0, tokens_1.assetAmountInEth)(totalUnits, loanSym),
|
|
74
|
+
totalBorrow: (0, tokens_1.assetAmountInEth)(totalDebt, loanSym),
|
|
75
|
+
canBeSupplied: true,
|
|
76
|
+
canBeBorrowed: true,
|
|
77
|
+
supplyIncentives: [],
|
|
78
|
+
borrowIncentives: [],
|
|
79
|
+
};
|
|
80
|
+
const collateralSymbols = [];
|
|
81
|
+
collaterals.forEach((coll, i) => {
|
|
82
|
+
const collInfo = (0, tokens_1.getAssetInfoByAddress)(coll.token, network);
|
|
83
|
+
const collSym = (0, utils_1.wethToEth)(collInfo.symbol);
|
|
84
|
+
collateralSymbols.push(collSym);
|
|
85
|
+
// Oracle price is returned in loan-token terms, scaled by 10^(36 + loanDec - collDec)
|
|
86
|
+
const scale = new decimal_js_1.default(10).pow(new decimal_js_1.default(36).add(loanTokenInfo.decimals).sub(collInfo.decimals).toString()).toString();
|
|
87
|
+
const rawPrice = marketInfo.prices[i] ? marketInfo.prices[i].toString() : '0';
|
|
88
|
+
const oracleRate = new decimal_js_1.default(rawPrice).div(scale).toString();
|
|
89
|
+
assetsData[collSym] = {
|
|
90
|
+
symbol: collSym,
|
|
91
|
+
address: coll.token,
|
|
92
|
+
price: new decimal_js_1.default(loanTokenUsd).mul(oracleRate).toString(),
|
|
93
|
+
supplyRate: '0',
|
|
94
|
+
borrowRate: '0',
|
|
95
|
+
lltv: new decimal_js_1.default(coll.lltv).toString(),
|
|
96
|
+
canBeSupplied: true,
|
|
97
|
+
canBeBorrowed: false,
|
|
98
|
+
supplyIncentives: [],
|
|
99
|
+
borrowIncentives: [],
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
const utillization = new decimal_js_1.default(totalUnits).eq(0) ? '0' : new decimal_js_1.default(totalDebt).div(totalUnits).mul(100).toString();
|
|
103
|
+
return {
|
|
104
|
+
id: marketInfo.id,
|
|
105
|
+
loanToken: loanSym,
|
|
106
|
+
collaterals: collateralSymbols,
|
|
107
|
+
maturity: selectedMarket.maturity,
|
|
108
|
+
isMatured: nowInSeconds() >= selectedMarket.maturity,
|
|
109
|
+
totalUnits: (0, tokens_1.assetAmountInEth)(totalUnits, loanSym),
|
|
110
|
+
withdrawable: (0, tokens_1.assetAmountInEth)(withdrawable, loanSym),
|
|
111
|
+
totalDebt: (0, tokens_1.assetAmountInEth)(totalDebt, loanSym),
|
|
112
|
+
lossFactor: marketInfo.lossFactor.toString(),
|
|
113
|
+
tickSpacing: marketInfo.tickSpacing,
|
|
114
|
+
utillization,
|
|
115
|
+
assetsData,
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function getMorphoMidnightMarketData(provider, network, selectedMarket) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
return _getMorphoMidnightMarketData((0, viem_1.getViemProvider)(provider, network), network, selectedMarket);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
function _getMorphoMidnightAccountData(provider, network, account, selectedMarket, marketInfo) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
const { marketId, collaterals } = selectedMarket;
|
|
127
|
+
const viewContract = (0, contracts_1.MorphoMidnightViewContractViem)(provider, network);
|
|
128
|
+
const positionInfo = yield viewContract.read.getPositionInfo([marketId, account]);
|
|
129
|
+
const usedAssets = {};
|
|
130
|
+
const loanTokenData = marketInfo.assetsData[marketInfo.loanToken];
|
|
131
|
+
const credit = (0, tokens_1.assetAmountInEth)(positionInfo.credit.toString(), marketInfo.loanToken);
|
|
132
|
+
const debt = (0, tokens_1.assetAmountInEth)(positionInfo.debt.toString(), marketInfo.loanToken);
|
|
133
|
+
// A user holds either credit (lender) or debt (borrower) in a market, never both.
|
|
134
|
+
usedAssets[marketInfo.loanToken] = {
|
|
135
|
+
symbol: marketInfo.loanToken,
|
|
136
|
+
supplied: credit,
|
|
137
|
+
borrowed: debt,
|
|
138
|
+
isSupplied: new decimal_js_1.default(positionInfo.credit.toString()).gt(0),
|
|
139
|
+
isBorrowed: new decimal_js_1.default(positionInfo.debt.toString()).gt(0),
|
|
140
|
+
collateral: false,
|
|
141
|
+
suppliedUsd: new decimal_js_1.default(credit).mul(loanTokenData.price).toString(),
|
|
142
|
+
borrowedUsd: new decimal_js_1.default(debt).mul(loanTokenData.price).toString(),
|
|
143
|
+
};
|
|
144
|
+
// positionInfo.collateral is index-aligned with the market's collateral set (0 where unused).
|
|
145
|
+
collaterals.forEach((coll, i) => {
|
|
146
|
+
const collInfo = (0, tokens_1.getAssetInfoByAddress)(coll.token, network);
|
|
147
|
+
const collSym = (0, utils_1.wethToEth)(collInfo.symbol);
|
|
148
|
+
const rawAmount = positionInfo.collateral[i] ? positionInfo.collateral[i].toString() : '0';
|
|
149
|
+
const supplied = (0, tokens_1.assetAmountInEth)(rawAmount, collSym);
|
|
150
|
+
const collData = marketInfo.assetsData[collSym];
|
|
151
|
+
usedAssets[collSym] = {
|
|
152
|
+
symbol: collSym,
|
|
153
|
+
supplied,
|
|
154
|
+
borrowed: '0',
|
|
155
|
+
isSupplied: new decimal_js_1.default(rawAmount).gt(0),
|
|
156
|
+
isBorrowed: false,
|
|
157
|
+
collateral: true,
|
|
158
|
+
suppliedUsd: new decimal_js_1.default(supplied).mul((collData === null || collData === void 0 ? void 0 : collData.price) || 0).toString(),
|
|
159
|
+
borrowedUsd: '0',
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
// Enrich borrower positions with the orderbook-derived rate + principal/interest split (off-chain).
|
|
163
|
+
// MidnightView only stores `debt` (= face value at maturity), so we default to full-debt-as-principal and
|
|
164
|
+
// override from the transactions API when available. Never throw here — the position must still render.
|
|
165
|
+
let borrowRate = '0';
|
|
166
|
+
let debtBase = debt; // fallback: treat the full on-chain debt as principal until fill history is known
|
|
167
|
+
let debtInterest = '0';
|
|
168
|
+
let assetsDataForApy = marketInfo.assetsData;
|
|
169
|
+
if (new decimal_js_1.default(positionInfo.debt.toString()).gt(0)) {
|
|
170
|
+
try {
|
|
171
|
+
const borrowInfo = yield (0, morphoMidnightHelpers_1.getMorphoMidnightUserBorrowInfo)(account, marketId, marketInfo.maturity, marketInfo.loanToken);
|
|
172
|
+
borrowRate = borrowInfo.borrowRate;
|
|
173
|
+
debtBase = borrowInfo.debtBase;
|
|
174
|
+
debtInterest = borrowInfo.debtInterest;
|
|
175
|
+
usedAssets[marketInfo.loanToken].borrowRate = borrowRate;
|
|
176
|
+
// Reflect the real borrow cost in netApy without mutating the shared marketInfo.assetsData.
|
|
177
|
+
assetsDataForApy = Object.assign(Object.assign({}, marketInfo.assetsData), { [marketInfo.loanToken]: Object.assign(Object.assign({}, loanTokenData), { borrowRate }) });
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
// Orderbook API unavailable — keep the on-chain-only fallback above.
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return Object.assign({ usedAssets,
|
|
184
|
+
credit,
|
|
185
|
+
debt,
|
|
186
|
+
borrowRate,
|
|
187
|
+
debtBase,
|
|
188
|
+
debtInterest, maturity: marketInfo.maturity, isMatured: marketInfo.isMatured }, (0, morphoMidnightHelpers_1.getMorphoMidnightAggregatedPositionData)({ usedAssets, assetsData: assetsDataForApy, marketInfo }));
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function getMorphoMidnightAccountData(provider, network, account, selectedMarket, marketInfo) {
|
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
return _getMorphoMidnightAccountData((0, viem_1.getViemProvider)(provider, network), network, account, selectedMarket, marketInfo);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
const _getMorphoMidnightAccountBalances = (provider, network, block, addressMapping, address, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () {
|
|
197
|
+
const balances = { collateral: {}, debt: {} };
|
|
198
|
+
if (!address)
|
|
199
|
+
return balances;
|
|
200
|
+
const { marketId, loanToken, collaterals } = selectedMarket;
|
|
201
|
+
const viewContract = (0, contracts_1.MorphoMidnightViewContractViem)(provider, network, block);
|
|
202
|
+
const positionInfo = yield viewContract.read.getPositionInfo([marketId, address], (0, viem_1.setViemBlockNumber)(block));
|
|
203
|
+
const loanTokenInfo = (0, tokens_1.getAssetInfoByAddress)(loanToken, network);
|
|
204
|
+
balances.debt = {
|
|
205
|
+
[addressMapping ? loanTokenInfo.address.toLowerCase() : (0, utils_1.wethToEth)(loanTokenInfo.symbol)]: (0, tokens_1.assetAmountInEth)(positionInfo.debt.toString(), (0, utils_1.wethToEth)(loanTokenInfo.symbol)),
|
|
206
|
+
};
|
|
207
|
+
const collateral = {};
|
|
208
|
+
collaterals.forEach((coll, i) => {
|
|
209
|
+
const collInfo = (0, tokens_1.getAssetInfoByAddress)(coll.token, network);
|
|
210
|
+
const rawAmount = positionInfo.collateral[i] ? positionInfo.collateral[i].toString() : '0';
|
|
211
|
+
collateral[addressMapping ? collInfo.address.toLowerCase() : (0, utils_1.wethToEth)(collInfo.symbol)] = (0, tokens_1.assetAmountInEth)(rawAmount, (0, utils_1.wethToEth)(collInfo.symbol));
|
|
212
|
+
});
|
|
213
|
+
balances.collateral = collateral;
|
|
214
|
+
return balances;
|
|
215
|
+
});
|
|
216
|
+
exports._getMorphoMidnightAccountBalances = _getMorphoMidnightAccountBalances;
|
|
217
|
+
const getMorphoMidnightAccountBalances = (provider, network, block, addressMapping, address, selectedMarket) => __awaiter(void 0, void 0, void 0, function* () { return (0, exports._getMorphoMidnightAccountBalances)((0, viem_1.getViemProvider)(provider, network), network, block, addressMapping, address, selectedMarket); });
|
|
218
|
+
exports.getMorphoMidnightAccountBalances = getMorphoMidnightAccountBalances;
|
|
219
|
+
// Lender-side (credit-only) supply position, mirroring getMorphoEarn. `amount` is the credit face value
|
|
220
|
+
// redeemable at maturity; `apy` is '0' in MVP because the fixed yield is orderbook-derived, not on-chain.
|
|
221
|
+
function getMorphoMidnightEarn(provider, network, account, selectedMarket, marketInfo) {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
const { marketId } = selectedMarket;
|
|
224
|
+
const viewContract = (0, contracts_1.MorphoMidnightViewContractViem)(provider, network);
|
|
225
|
+
const positionInfo = yield viewContract.read.getPositionInfo([marketId, account]);
|
|
226
|
+
const loanTokenData = marketInfo.assetsData[marketInfo.loanToken];
|
|
227
|
+
const credit = (0, tokens_1.assetAmountInEth)(positionInfo.credit.toString(), marketInfo.loanToken);
|
|
228
|
+
const creditUsd = new decimal_js_1.default(credit).mul(loanTokenData.price).toString();
|
|
229
|
+
const usedAssets = {
|
|
230
|
+
[marketInfo.loanToken]: {
|
|
231
|
+
symbol: marketInfo.loanToken,
|
|
232
|
+
supplied: credit,
|
|
233
|
+
borrowed: '0',
|
|
234
|
+
isSupplied: new decimal_js_1.default(positionInfo.credit.toString()).gt(0),
|
|
235
|
+
isBorrowed: false,
|
|
236
|
+
collateral: false,
|
|
237
|
+
suppliedUsd: creditUsd,
|
|
238
|
+
borrowedUsd: '0',
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
const { netApy } = (0, staking_1.calculateNetApy)({ usedAssets, assetsData: marketInfo.assetsData });
|
|
242
|
+
return { apy: netApy, amount: credit, amountUsd: creditUsd };
|
|
243
|
+
});
|
|
244
|
+
}
|
|
@@ -24,6 +24,7 @@ const compoundV3_1 = require("../compoundV3");
|
|
|
24
24
|
const curveUsd_1 = require("../curveUsd");
|
|
25
25
|
const llamaLend_1 = require("../llamaLend");
|
|
26
26
|
const morphoBlue_1 = require("../morphoBlue");
|
|
27
|
+
const morphoMidnight_1 = require("../morphoMidnight");
|
|
27
28
|
const contracts_1 = require("../contracts");
|
|
28
29
|
const hasAnyBalance = (balances) => ([balances.collateral, balances.debt].some((group) => Object.values(group || {}).some((amount) => new decimal_js_1.default(amount || '0').gt(0))));
|
|
29
30
|
/**
|
|
@@ -87,6 +88,9 @@ function getUserPositionsExistence(provider_1, network_1, address_1) {
|
|
|
87
88
|
Object.values((0, markets_1.MorphoBlueMarkets)(network)).filter((market) => market.chainIds.includes(network)).forEach((market) => {
|
|
88
89
|
tasks.push(balanceTask(market.value, () => (0, morphoBlue_1._getMorphoBlueAccountBalances)(client, network, block, false, address, market)));
|
|
89
90
|
});
|
|
91
|
+
Object.values((0, markets_1.MorphoMidnightMarkets)(network)).filter((market) => market.chainIds.includes(network)).forEach((market) => {
|
|
92
|
+
tasks.push(balanceTask(market.value, () => (0, morphoMidnight_1._getMorphoMidnightAccountBalances)(client, network, block, false, address, market)));
|
|
93
|
+
});
|
|
90
94
|
yield Promise.all(tasks);
|
|
91
95
|
return existence;
|
|
92
96
|
});
|
package/cjs/portfolio/index.js
CHANGED
|
@@ -31,6 +31,7 @@ const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
|
31
31
|
const common_1 = require("../types/common");
|
|
32
32
|
const markets_1 = require("../markets");
|
|
33
33
|
const morphoBlue_1 = require("../morphoBlue");
|
|
34
|
+
const morphoMidnight_1 = require("../morphoMidnight");
|
|
34
35
|
const types_1 = require("../types");
|
|
35
36
|
const compoundV3_1 = require("../compoundV3");
|
|
36
37
|
const spark_1 = require("../spark");
|
|
@@ -59,6 +60,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
59
60
|
const isMainnet = network === common_1.NetworkNumber.Eth;
|
|
60
61
|
const isFluidSupported = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb, common_1.NetworkNumber.Base, common_1.NetworkNumber.Plasma].includes(network);
|
|
61
62
|
const morphoMarkets = Object.values((0, markets_1.MorphoBlueMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
63
|
+
const morphoMidnightMarkets = Object.values((0, markets_1.MorphoMidnightMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
62
64
|
const compoundV3Markets = Object.values((0, markets_1.CompoundMarkets)(network)).filter((market) => market.chainIds.includes(network) && market.value !== types_1.CompoundVersions.CompoundV2);
|
|
63
65
|
const sparkMarkets = Object.values((0, markets_1.SparkMarkets)(network)).filter((market) => market.chainIds.includes(network));
|
|
64
66
|
const eulerV2Markets = Object.values((0, markets_1.EulerV2Markets)(network)).filter((market) => market.chainIds.includes(network));
|
|
@@ -74,6 +76,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
74
76
|
const client = (0, viem_1.getViemProvider)(provider, ...args);
|
|
75
77
|
const defaultClient = (0, viem_1.getViemProvider)(defaultProvider, ...args);
|
|
76
78
|
const morphoMarketsData = {};
|
|
79
|
+
const morphoMidnightMarketsData = {};
|
|
77
80
|
const compoundV3MarketsData = {};
|
|
78
81
|
const sparkMarketsData = {};
|
|
79
82
|
const eulerV2MarketsData = {};
|
|
@@ -87,6 +90,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
87
90
|
const aaveV4SpokesData = {};
|
|
88
91
|
const markets = {
|
|
89
92
|
morphoMarketsData,
|
|
93
|
+
morphoMidnightMarketsData,
|
|
90
94
|
compoundV3MarketsData,
|
|
91
95
|
sparkMarketsData,
|
|
92
96
|
eulerV2MarketsData,
|
|
@@ -107,6 +111,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
107
111
|
aaveV3: {},
|
|
108
112
|
aaveV4: {},
|
|
109
113
|
morphoBlue: {},
|
|
114
|
+
morphoMidnight: {},
|
|
110
115
|
compoundV3: {},
|
|
111
116
|
spark: {},
|
|
112
117
|
eulerV2: {},
|
|
@@ -127,6 +132,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
127
132
|
stakingPositions[address.toLowerCase()] = {
|
|
128
133
|
aaveV3: {},
|
|
129
134
|
morphoBlue: {},
|
|
135
|
+
morphoMidnight: {},
|
|
130
136
|
compoundV3: {},
|
|
131
137
|
spark: {},
|
|
132
138
|
aaveV2: {},
|
|
@@ -151,9 +157,13 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
151
157
|
yield Promise.allSettled([
|
|
152
158
|
// === MARKET DATA (needs to be fetched first) ===
|
|
153
159
|
...morphoMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
const marketData = yield (0, morphoBlue_1.
|
|
160
|
+
const marketData = yield (0, morphoBlue_1._getMorphoBlueMarketData)(client, network, market);
|
|
155
161
|
morphoMarketsData[market.value] = marketData;
|
|
156
162
|
})),
|
|
163
|
+
...morphoMidnightMarkets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const marketData = yield (0, morphoMidnight_1._getMorphoMidnightMarketData)(client, network, market);
|
|
165
|
+
morphoMidnightMarketsData[market.value] = marketData;
|
|
166
|
+
})),
|
|
157
167
|
...compoundV3Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
158
168
|
const marketData = yield (0, compoundV3_1._getCompoundV3MarketsData)(client, network, market, defaultClient);
|
|
159
169
|
compoundV3MarketsData[market.value] = marketData;
|
|
@@ -464,6 +474,40 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
464
474
|
positions[address.toLowerCase()].morphoBlue[market.value] = { error: `Error fetching MorphoBlue account data for address ${address} on market ${market.value}`, data: null };
|
|
465
475
|
}
|
|
466
476
|
}))).flat(),
|
|
477
|
+
...morphoMidnightMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
478
|
+
try {
|
|
479
|
+
const [accDataPromise, earnDataPromise] = yield Promise.allSettled([
|
|
480
|
+
(0, morphoMidnight_1._getMorphoMidnightAccountData)(client, network, address, market, morphoMidnightMarketsData[market.value]),
|
|
481
|
+
(0, morphoMidnight_1.getMorphoMidnightEarn)(client, network, address, market, morphoMidnightMarketsData[market.value]),
|
|
482
|
+
]);
|
|
483
|
+
if (accDataPromise.status === 'rejected') {
|
|
484
|
+
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, accDataPromise.reason);
|
|
485
|
+
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
486
|
+
}
|
|
487
|
+
if (earnDataPromise.status === 'rejected') {
|
|
488
|
+
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, earnDataPromise.reason);
|
|
489
|
+
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
490
|
+
}
|
|
491
|
+
if (accDataPromise.status !== 'rejected') {
|
|
492
|
+
const accData = accDataPromise.value;
|
|
493
|
+
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
494
|
+
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: '', data: accData };
|
|
495
|
+
}
|
|
496
|
+
if (earnDataPromise.status !== 'rejected') {
|
|
497
|
+
const earnData = earnDataPromise.value;
|
|
498
|
+
if (earnData && new decimal_js_1.default(earnData.amount).gt(0)) {
|
|
499
|
+
stakingPositions[address.toLowerCase()].morphoMidnight[market.value] = {
|
|
500
|
+
error: '',
|
|
501
|
+
data: earnData,
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
catch (error) {
|
|
507
|
+
console.error(`Error fetching MorphoMidnight account data for address ${address} on market ${market.value}:`, error);
|
|
508
|
+
positions[address.toLowerCase()].morphoMidnight[market.value] = { error: `Error fetching MorphoMidnight account data for address ${address} on market ${market.value}`, data: null };
|
|
509
|
+
}
|
|
510
|
+
}))).flat(),
|
|
467
511
|
...compoundV3Markets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
468
512
|
try {
|
|
469
513
|
const accData = yield (0, compoundV3_1._getCompoundV3AccountData)(client, network, address, constants_1.ZERO_ADDRESS, { selectedMarket: market, assetsData: compoundV3MarketsData[market.value].assetsData });
|