@defisaver/positions-sdk 2.1.46 → 2.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.
@@ -74,21 +74,31 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
74
74
  (0, merit_1.getMeritCampaigns)(network, market.value),
75
75
  ]);
76
76
  isBorrowAllowed = (0, utils_1.isLayer2Network)(network) ? isBorrowAllowed : true;
77
+ // same break logic as view contract
78
+ let missCounter = 0;
77
79
  const eModeCategoriesData = {};
78
80
  for (let i = 0; i < eModesInfo.length; i++) {
79
- if (!eModesInfo[i].label)
80
- break;
81
- eModeCategoriesData[i + 1] = {
82
- label: eModesInfo[i].label,
83
- id: i + 1,
84
- liquidationBonus: new decimal_js_1.default(eModesInfo[i].liquidationBonus).div(10000).toString(),
85
- liquidationRatio: new decimal_js_1.default(eModesInfo[i].liquidationThreshold).div(10000).toString(),
86
- collateralFactor: new decimal_js_1.default(eModesInfo[i].ltv).div(10000).toString(),
87
- borrowableBitmap: eModesInfo[i].borrowableBitmap.toString(),
88
- collateralBitmap: eModesInfo[i].collateralBitmap.toString(),
89
- borrowAssets: [],
90
- collateralAssets: [],
91
- };
81
+ if (eModesInfo[i].liquidationThreshold !== 0) {
82
+ eModeCategoriesData[i + 1] = {
83
+ label: eModesInfo[i].label,
84
+ id: i + 1,
85
+ liquidationBonus: new decimal_js_1.default(eModesInfo[i].liquidationBonus).div(10000).toString(),
86
+ liquidationRatio: new decimal_js_1.default(eModesInfo[i].liquidationThreshold).div(10000).toString(),
87
+ collateralFactor: new decimal_js_1.default(eModesInfo[i].ltv).div(10000).toString(),
88
+ borrowableBitmap: eModesInfo[i].borrowableBitmap.toString(),
89
+ collateralBitmap: eModesInfo[i].collateralBitmap.toString(),
90
+ ltvzeroBitmap: eModesInfo[i].ltvzeroBitmap.toString(),
91
+ borrowAssets: [],
92
+ collateralAssets: [],
93
+ ltvZeroAssets: [],
94
+ };
95
+ missCounter = 0;
96
+ }
97
+ else {
98
+ ++missCounter;
99
+ if (missCounter > 2)
100
+ break;
101
+ }
92
102
  }
93
103
  if (networksWithIncentives.includes(network) && rewardInfo) {
94
104
  rewardInfo = rewardInfo.reduce((all, _market) => {
@@ -106,6 +116,8 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
106
116
  eModeCategoriesData[eModeIndex].collateralAssets.push(symbol);
107
117
  if ((0, utils_1.isEnabledOnBitmap)(Number(eModeCategoriesData[eModeIndex].borrowableBitmap), Number(tokenMarket.assetId)))
108
118
  eModeCategoriesData[eModeIndex].borrowAssets.push(symbol);
119
+ if ((0, utils_1.isEnabledOnBitmap)(Number(eModeCategoriesData[eModeIndex].ltvzeroBitmap), Number(tokenMarket.assetId)))
120
+ eModeCategoriesData[eModeIndex].ltvZeroAssets.push(symbol);
109
121
  }
110
122
  const borrowCap = tokenMarket.borrowCap.toString();
111
123
  const borrowCapInWei = new decimal_js_1.default((0, tokens_1.assetAmountInWei)(borrowCap, symbol));
@@ -290,6 +302,7 @@ function _getAaveV3MarketData(provider_1, network_1, market_1) {
290
302
  collateralFactor: '0',
291
303
  collateralAssets: assetsData.map((a) => a.symbol),
292
304
  borrowAssets: assetsData.map((a) => a.symbol),
305
+ ltvZeroAssets: [],
293
306
  };
294
307
  return { assetsData: payload, eModeCategoriesData };
295
308
  });