@defisaver/positions-sdk 2.1.47 → 2.1.49-pt-apr-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/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/markets/aave/marketAssets.js +1 -1
- package/cjs/moneymarket/moneymarketCommonService.js +1 -1
- package/cjs/spark/index.js +1 -0
- package/cjs/staking/staking.js +5 -1
- 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/markets/aave/marketAssets.js +1 -1
- package/esm/moneymarket/moneymarketCommonService.js +1 -1
- package/esm/spark/index.js +1 -0
- package/esm/staking/staking.js +5 -1
- package/esm/types/aave.d.ts +2 -0
- package/package.json +2 -2
- package/src/aaveV3/index.ts +23 -13
- package/src/config/contracts.ts +39 -14
- package/src/helpers/aaveHelpers/index.ts +5 -1
- package/src/markets/aave/marketAssets.ts +1 -1
- package/src/moneymarket/moneymarketCommonService.ts +1 -1
- package/src/spark/index.ts +1 -0
- package/src/staking/staking.ts +3 -1
- 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
|
};
|
|
@@ -15,7 +15,7 @@ export const aaveV3AssetsDefaultMarketOpt = [
|
|
|
15
15
|
export const aaveV3AssetsDefaultMarketArb = ['DAI', 'LINK', 'USDC.e', 'WBTC', 'ETH', 'USDT', 'AAVE', 'EURS', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC', 'FRAX', 'ARB', 'weETH', 'GHO', 'ezETH', 'rsETH', 'tBTC'];
|
|
16
16
|
export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC', 'ezETH', 'GHO', 'wrsETH', 'LBTC', 'EURC', 'AAVE', 'tBTC'];
|
|
17
17
|
export const aaveV3AssetsDefaultMarketLinea = ['ETH', 'USDC', 'weETH', 'ezETH', 'USDT', 'wstETH', 'wrsETH', 'WBTC', 'mUSD'];
|
|
18
|
-
export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'XPL'];
|
|
18
|
+
export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'XPL', 'PT USDe Apr', 'PT sUSDe Apr'];
|
|
19
19
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
20
20
|
export const aaveV3AssetsDefaultMarket = {
|
|
21
21
|
[NetworkNumber.Eth]: aaveV3AssetsDefaultMarketEth,
|
|
@@ -20,7 +20,7 @@ export const STABLE_ASSETS = [
|
|
|
20
20
|
'DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'USDA',
|
|
21
21
|
'USDe', 'sUSDe', 'USDS', 'sUSDS', 'USR', 'EURC', 'BOLD', 'BOLD Legacy', 'RLUSD', 'PT sUSDe July', 'PT eUSDe May',
|
|
22
22
|
'USDtb', 'eUSDe', 'PT USDe July', 'PT eUSDe Aug', 'PT sUSDe Sep', 'PT USDe Sep', 'PT sUSDe Nov', 'PT USDe Nov', 'PT sUSDe Jan', 'PT USDe Jan',
|
|
23
|
-
'PT sUSDe Feb', 'PT USDe Feb',
|
|
23
|
+
'PT sUSDe Feb', 'PT USDe Feb', 'PT USDe Apr', 'PT sUSDe Apr',
|
|
24
24
|
];
|
|
25
25
|
export const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
26
26
|
let borrowUnstable = 0;
|
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/staking/staking.js
CHANGED
|
@@ -66,7 +66,7 @@ export const STAKING_ASSETS = [
|
|
|
66
66
|
'cbETH', 'wstETH', 'cbETH', 'rETH', 'sDAI', 'weETH', 'sUSDe', 'osETH',
|
|
67
67
|
'ezETH', 'ETHx', 'rsETH', 'pufETH', 'wrsETH', 'wsuperOETHb', 'sUSDS', 'tETH', 'PT sUSDe Sep', 'PT USDe Sep',
|
|
68
68
|
'PT sUSDe Nov', 'PT USDe Nov', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'syrupUSDC', 'wstUSR',
|
|
69
|
-
'PT sUSDe Feb', 'PT USDe Feb',
|
|
69
|
+
'PT sUSDe Feb', 'PT USDe Feb', 'PT USDe Apr', 'PT sUSDe Apr',
|
|
70
70
|
];
|
|
71
71
|
export const getStakingApy = memoize((asset_1, ...args_1) => __awaiter(void 0, [asset_1, ...args_1], void 0, function* (asset, network = NetworkNumber.Eth) {
|
|
72
72
|
try {
|
|
@@ -130,6 +130,10 @@ export const getStakingApy = memoize((asset_1, ...args_1) => __awaiter(void 0, [
|
|
|
130
130
|
return yield getApyFromDfsApi('PT sUSDe Feb', network);
|
|
131
131
|
if (asset === 'PT USDe Feb')
|
|
132
132
|
return yield getApyFromDfsApi('PT USDe Feb', network);
|
|
133
|
+
if (asset === 'PT sUSDe Apr')
|
|
134
|
+
return yield getApyFromDfsApi('PT sUSDe Apr', network);
|
|
135
|
+
if (asset === 'PT USDe Apr')
|
|
136
|
+
return yield getApyFromDfsApi('PT USDe Apr', network);
|
|
133
137
|
}
|
|
134
138
|
catch (e) {
|
|
135
139
|
console.error(`Failed to fetch APY for ${asset}`);
|
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/positions-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.49-pt-apr-dev",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@defisaver/tokens": "
|
|
24
|
+
"@defisaver/tokens": "1.7.19-pt-apr-1-dev",
|
|
25
25
|
"@types/lodash": "^4.17.15",
|
|
26
26
|
"@types/memoizee": "^0.4.12",
|
|
27
27
|
"decimal.js": "^10.6.0",
|
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 };
|