@defisaver/positions-sdk 2.1.47 → 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.
- package/cjs/aaveV3/index.js +26 -13
- package/cjs/config/contracts.d.ts +8395 -2636
- package/cjs/config/contracts.js +39 -14
- package/cjs/contracts.d.ts +5267 -255
- package/cjs/helpers/aaveHelpers/index.js +5 -1
- package/cjs/spark/index.js +1 -0
- package/cjs/types/aave.d.ts +2 -0
- package/esm/aaveV3/index.js +26 -13
- package/esm/config/contracts.d.ts +8395 -2636
- package/esm/config/contracts.js +39 -14
- package/esm/contracts.d.ts +5267 -255
- package/esm/helpers/aaveHelpers/index.js +5 -1
- package/esm/spark/index.js +1 -0
- package/esm/types/aave.d.ts +2 -0
- package/package.json +1 -1
- package/src/aaveV3/index.ts +23 -13
- package/src/config/contracts.ts +39 -14
- package/src/helpers/aaveHelpers/index.ts +5 -1
- package/src/spark/index.ts +1 -0
- package/src/types/aave.ts +2 -0
|
@@ -54,13 +54,17 @@ export const aaveAnyGetSuppliableAsCollAssets = (_a) => {
|
|
|
54
54
|
export const aaveAnyGetEmodeMutableProps = ({ eModeCategory, eModeCategoriesData, assetsData, }, _asset) => {
|
|
55
55
|
const asset = getNativeAssetFromWrapped(_asset);
|
|
56
56
|
const assetData = assetsData[asset];
|
|
57
|
-
const eModeCategoryData = (eModeCategoriesData === null || eModeCategoriesData === void 0 ? void 0 : eModeCategoriesData[eModeCategory]) || {
|
|
57
|
+
const eModeCategoryData = (eModeCategoriesData === null || eModeCategoriesData === void 0 ? void 0 : eModeCategoriesData[eModeCategory]) || {
|
|
58
|
+
collateralAssets: [], ltvZeroAssets: [], collateralFactor: '0', liquidationRatio: '0',
|
|
59
|
+
};
|
|
58
60
|
if (eModeCategory === 0
|
|
59
61
|
|| !eModeCategoryData.collateralAssets.includes(asset)
|
|
60
62
|
|| new Dec(eModeCategoryData.collateralFactor || 0).eq(0)) {
|
|
61
63
|
const { liquidationRatio, collateralFactor } = assetData;
|
|
62
64
|
return ({ liquidationRatio, collateralFactor });
|
|
63
65
|
}
|
|
66
|
+
if (eModeCategoryData.ltvZeroAssets.includes(asset))
|
|
67
|
+
return ({ liquidationRatio: '0', collateralFactor: '0' });
|
|
64
68
|
const { liquidationRatio, collateralFactor } = eModeCategoryData;
|
|
65
69
|
return ({ liquidationRatio, collateralFactor });
|
|
66
70
|
};
|
package/esm/spark/index.js
CHANGED
|
@@ -80,6 +80,7 @@ export const _getSparkMarketsData = (provider, network, selectedMarket) => __awa
|
|
|
80
80
|
collateralFactor: new Dec(market.ltv).div(10000).toString(),
|
|
81
81
|
collateralAssets: eModeCategoriesData[emodeCategoryId] ? [...eModeCategoriesData[emodeCategoryId].collateralAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
|
|
82
82
|
borrowAssets: eModeCategoriesData[emodeCategoryId] ? [...eModeCategoriesData[emodeCategoryId].borrowAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
|
|
83
|
+
ltvZeroAssets: [],
|
|
83
84
|
};
|
|
84
85
|
return ({
|
|
85
86
|
symbol: selectedMarket.assets[i],
|
package/esm/types/aave.d.ts
CHANGED
|
@@ -38,6 +38,8 @@ export interface EModeCategoryData {
|
|
|
38
38
|
collateralBitmap?: string;
|
|
39
39
|
collateralAssets: string[];
|
|
40
40
|
borrowAssets: string[];
|
|
41
|
+
ltvzeroBitmap?: string;
|
|
42
|
+
ltvZeroAssets: string[];
|
|
41
43
|
}
|
|
42
44
|
export interface EModeCategoryDataMapping {
|
|
43
45
|
enteringTerms: boolean[];
|
package/package.json
CHANGED
package/src/aaveV3/index.ts
CHANGED
|
@@ -84,7 +84,6 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
|
|
|
84
84
|
const aaveIncentivesContract = AaveIncentiveDataProviderV3ContractViem(provider, network);
|
|
85
85
|
const marketAddress = market.providerAddress;
|
|
86
86
|
const networksWithIncentives = [NetworkNumber.Eth, NetworkNumber.Arb, NetworkNumber.Opt, NetworkNumber.Linea, NetworkNumber.Plasma];
|
|
87
|
-
|
|
88
87
|
// eslint-disable-next-line prefer-const
|
|
89
88
|
let [loanInfo, eModesInfo, isBorrowAllowed, rewardInfo, merkleRewardsMap, meritRewardsMap] = await Promise.all([
|
|
90
89
|
loanInfoContract.read.getFullTokensInfo([marketAddress, _addresses as EthAddress[]], setViemBlockNumber(blockNumber)),
|
|
@@ -96,20 +95,29 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
|
|
|
96
95
|
]);
|
|
97
96
|
isBorrowAllowed = isLayer2Network(network) ? isBorrowAllowed : true;
|
|
98
97
|
|
|
98
|
+
// same break logic as view contract
|
|
99
|
+
let missCounter = 0;
|
|
99
100
|
const eModeCategoriesData: EModeCategoriesData = {};
|
|
100
101
|
for (let i = 0; i < eModesInfo.length; i++) {
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
102
|
+
if (eModesInfo[i].liquidationThreshold !== 0) {
|
|
103
|
+
eModeCategoriesData[i + 1] = {
|
|
104
|
+
label: eModesInfo[i].label,
|
|
105
|
+
id: i + 1,
|
|
106
|
+
liquidationBonus: new Dec(eModesInfo[i].liquidationBonus).div(10000).toString(),
|
|
107
|
+
liquidationRatio: new Dec(eModesInfo[i].liquidationThreshold).div(10000).toString(),
|
|
108
|
+
collateralFactor: new Dec(eModesInfo[i].ltv).div(10000).toString(),
|
|
109
|
+
borrowableBitmap: eModesInfo[i].borrowableBitmap.toString(),
|
|
110
|
+
collateralBitmap: eModesInfo[i].collateralBitmap.toString(),
|
|
111
|
+
ltvzeroBitmap: eModesInfo[i].ltvzeroBitmap.toString(),
|
|
112
|
+
borrowAssets: [],
|
|
113
|
+
collateralAssets: [],
|
|
114
|
+
ltvZeroAssets: [],
|
|
115
|
+
};
|
|
116
|
+
missCounter = 0;
|
|
117
|
+
} else {
|
|
118
|
+
++missCounter;
|
|
119
|
+
if (missCounter > 2) break;
|
|
120
|
+
}
|
|
113
121
|
}
|
|
114
122
|
|
|
115
123
|
if (networksWithIncentives.includes(network) && rewardInfo) {
|
|
@@ -128,6 +136,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
|
|
|
128
136
|
for (const eModeIndex in eModeCategoriesData) {
|
|
129
137
|
if (isEnabledOnBitmap(Number(eModeCategoriesData[eModeIndex].collateralBitmap), Number(tokenMarket.assetId))) eModeCategoriesData[eModeIndex].collateralAssets.push(symbol);
|
|
130
138
|
if (isEnabledOnBitmap(Number(eModeCategoriesData[eModeIndex].borrowableBitmap), Number(tokenMarket.assetId))) eModeCategoriesData[eModeIndex].borrowAssets.push(symbol);
|
|
139
|
+
if (isEnabledOnBitmap(Number(eModeCategoriesData[eModeIndex].ltvzeroBitmap), Number(tokenMarket.assetId))) eModeCategoriesData[eModeIndex].ltvZeroAssets.push(symbol);
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
const borrowCap = tokenMarket.borrowCap.toString();
|
|
@@ -326,6 +335,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
|
|
|
326
335
|
collateralFactor: '0',
|
|
327
336
|
collateralAssets: assetsData.map((a) => a.symbol),
|
|
328
337
|
borrowAssets: assetsData.map((a) => a.symbol),
|
|
338
|
+
ltvZeroAssets: [],
|
|
329
339
|
};
|
|
330
340
|
|
|
331
341
|
return { assetsData: payload, eModeCategoriesData };
|