@defisaver/positions-sdk 2.1.48 → 2.1.49-aave-v4-dev-2
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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +64 -64
- package/cjs/aaveV4/index.d.ts +7 -0
- package/cjs/aaveV4/index.js +167 -0
- package/cjs/config/contracts.d.ts +1277 -0
- package/cjs/config/contracts.js +9 -0
- package/cjs/contracts.d.ts +23120 -0
- package/cjs/contracts.js +2 -1
- package/cjs/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/cjs/helpers/aaveV4Helpers/index.js +109 -0
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/markets/aave/marketAssets.js +1 -1
- package/cjs/markets/aaveV4/index.d.ts +7 -0
- package/cjs/markets/aaveV4/index.js +22 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/moneymarket/moneymarketCommonService.js +1 -1
- package/cjs/portfolio/index.js +20 -0
- package/cjs/savings/morphoVaults/index.js +17 -17
- package/cjs/staking/staking.js +5 -1
- package/cjs/types/aaveV4.d.ts +129 -0
- package/cjs/types/aaveV4.js +11 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/portfolio.d.ts +4 -0
- package/esm/aaveV4/index.d.ts +7 -0
- package/esm/aaveV4/index.js +158 -0
- package/esm/config/contracts.d.ts +1277 -0
- package/esm/config/contracts.js +8 -0
- package/esm/contracts.d.ts +23120 -0
- package/esm/contracts.js +1 -0
- package/esm/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/esm/helpers/aaveV4Helpers/index.js +100 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/markets/aave/marketAssets.js +1 -1
- package/esm/markets/aaveV4/index.d.ts +7 -0
- package/esm/markets/aaveV4/index.js +16 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/moneymarket/moneymarketCommonService.js +1 -1
- package/esm/portfolio/index.js +21 -1
- package/esm/savings/morphoVaults/index.js +17 -17
- package/esm/staking/staking.js +5 -1
- package/esm/types/aaveV4.d.ts +129 -0
- package/esm/types/aaveV4.js +8 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/portfolio.d.ts +4 -0
- package/package.json +48 -48
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +635 -635
- package/src/aaveV3/merit.ts +97 -97
- package/src/aaveV3/merkl.ts +74 -74
- package/src/aaveV4/index.ts +169 -0
- package/src/claiming/aaveV3.ts +154 -154
- package/src/claiming/compV3.ts +22 -22
- package/src/claiming/ethena.ts +61 -61
- package/src/claiming/index.ts +12 -12
- package/src/claiming/king.ts +66 -66
- package/src/claiming/morphoBlue.ts +118 -118
- package/src/claiming/spark.ts +225 -225
- package/src/compoundV2/index.ts +244 -244
- package/src/compoundV3/index.ts +274 -274
- package/src/config/contracts.ts +1328 -1320
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +174 -172
- package/src/curveUsd/index.ts +254 -254
- package/src/eulerV2/index.ts +324 -324
- package/src/exchange/index.ts +25 -25
- package/src/fluid/index.ts +1800 -1800
- package/src/helpers/aaveHelpers/index.ts +191 -191
- package/src/helpers/aaveV4Helpers/index.ts +121 -0
- package/src/helpers/compoundHelpers/index.ts +283 -283
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +222 -222
- package/src/helpers/fluidHelpers/index.ts +326 -326
- package/src/helpers/index.ts +11 -10
- package/src/helpers/liquityV2Helpers/index.ts +82 -82
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +52 -52
- package/src/helpers/morphoBlueHelpers/index.ts +396 -396
- package/src/helpers/sparkHelpers/index.ts +158 -158
- package/src/index.ts +51 -49
- package/src/liquity/index.ts +159 -159
- package/src/liquityV2/index.ts +703 -703
- package/src/llamaLend/index.ts +305 -305
- package/src/maker/index.ts +223 -223
- package/src/markets/aave/index.ts +118 -118
- package/src/markets/aave/marketAssets.ts +54 -54
- package/src/markets/aaveV4/index.ts +19 -0
- package/src/markets/compound/index.ts +243 -243
- package/src/markets/compound/marketsAssets.ts +97 -97
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2900 -2900
- package/src/markets/index.ts +26 -25
- package/src/markets/liquityV2/index.ts +102 -102
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +971 -971
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +85 -85
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +618 -598
- package/src/savings/index.ts +95 -95
- package/src/savings/makerDsr/index.ts +53 -53
- package/src/savings/makerDsr/options.ts +9 -9
- package/src/savings/morphoVaults/index.ts +80 -80
- package/src/savings/morphoVaults/options.ts +193 -193
- package/src/savings/skyOptions/index.ts +95 -95
- package/src/savings/skyOptions/options.ts +10 -10
- package/src/savings/sparkSavingsVaults/index.ts +60 -60
- package/src/savings/sparkSavingsVaults/options.ts +35 -35
- package/src/savings/yearnV3Vaults/index.ts +61 -61
- package/src/savings/yearnV3Vaults/options.ts +55 -55
- package/src/savings/yearnVaults/index.ts +73 -73
- package/src/savings/yearnVaults/options.ts +32 -32
- package/src/services/priceService.ts +278 -278
- package/src/services/utils.ts +115 -115
- package/src/services/viem.ts +34 -34
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +459 -459
- package/src/staking/eligibility.ts +53 -53
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +192 -190
- package/src/types/aave.ts +198 -198
- package/src/types/aaveV4.ts +142 -0
- package/src/types/claiming.ts +114 -114
- package/src/types/common.ts +107 -107
- package/src/types/compound.ts +144 -144
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +175 -175
- package/src/types/fluid.ts +483 -483
- package/src/types/index.ts +16 -15
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +126 -126
- package/src/types/llamaLend.ts +159 -159
- package/src/types/maker.ts +63 -63
- package/src/types/merit.ts +1 -1
- package/src/types/merkl.ts +70 -70
- package/src/types/morphoBlue.ts +200 -200
- package/src/types/portfolio.ts +64 -60
- package/src/types/savings/index.ts +23 -23
- package/src/types/savings/makerDsr.ts +13 -13
- package/src/types/savings/morphoVaults.ts +32 -32
- package/src/types/savings/sky.ts +14 -14
- package/src/types/savings/sparkSavingsVaults.ts +15 -15
- package/src/types/savings/yearnV3Vaults.ts +17 -17
- package/src/types/savings/yearnVaults.ts +14 -14
- package/src/types/spark.ts +134 -134
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
package/esm/contracts.js
CHANGED
|
@@ -132,3 +132,4 @@ export const StkAAVEViem = createViemContractFromConfigFunc('StkAAVE');
|
|
|
132
132
|
export const YearnViewContractViem = createViemContractFromConfigFunc('YearnView');
|
|
133
133
|
export const MakerDsrContractViem = createViemContractFromConfigFunc('MakerDsr');
|
|
134
134
|
export const SkySavingsContractView = createViemContractFromConfigFunc('SkySavings');
|
|
135
|
+
export const AaveV4ViewContractViem = createViemContractFromConfigFunc('AaveV4View');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AaveV4AggregatedPositionData, AaveV4AssetsData, AaveV4ReserveAssetData, AaveV4UsedReserveAsset, AaveV4UsedReserveAssets } from '../../types';
|
|
2
|
+
import { NetworkNumber } from '../../types/common';
|
|
3
|
+
export declare const aaveV4GetCollateralFactor: (assetData: AaveV4ReserveAssetData, usedAssetData: AaveV4UsedReserveAsset, useUserCollateralFactor?: boolean) => number;
|
|
4
|
+
export declare const isLeveragedPosAaveV4: (usedAssets: AaveV4UsedReserveAssets, dustLimit?: number) => {
|
|
5
|
+
leveragedType: string;
|
|
6
|
+
leveragedAsset: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const aaveV4GetAggregatedPositionData: ({ usedAssets, assetsData, network, useUserCollateralFactor, }: {
|
|
9
|
+
usedAssets: AaveV4UsedReserveAssets;
|
|
10
|
+
assetsData: AaveV4AssetsData;
|
|
11
|
+
network: NetworkNumber;
|
|
12
|
+
useUserCollateralFactor?: boolean;
|
|
13
|
+
}) => AaveV4AggregatedPositionData;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import Dec from 'decimal.js';
|
|
2
|
+
import { calcLeverageLiqPrice, getAssetsTotal, STABLE_ASSETS } from '../../moneymarket';
|
|
3
|
+
export const aaveV4GetCollateralFactor = (assetData, usedAssetData, useUserCollateralFactor = false) => (useUserCollateralFactor ? usedAssetData.collateralFactor : assetData.collateralFactor);
|
|
4
|
+
export const isLeveragedPosAaveV4 = (usedAssets, dustLimit = 5) => {
|
|
5
|
+
let borrowUnstable = 0;
|
|
6
|
+
let supplyStable = 0;
|
|
7
|
+
let borrowStable = 0;
|
|
8
|
+
let supplyUnstable = 0;
|
|
9
|
+
let longAsset = '';
|
|
10
|
+
let shortAsset = '';
|
|
11
|
+
Object.values(usedAssets).forEach(({ symbol, suppliedUsd, borrowedUsd, collateral, reserveId, }) => {
|
|
12
|
+
const spokeAsset = `${symbol}-${reserveId}`;
|
|
13
|
+
const isSupplied = (+suppliedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
14
|
+
const isBorrowed = (+borrowedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
15
|
+
if (isSupplied && STABLE_ASSETS.includes(symbol) && collateral)
|
|
16
|
+
supplyStable += 1;
|
|
17
|
+
if (isBorrowed && STABLE_ASSETS.includes(symbol))
|
|
18
|
+
borrowStable += 1;
|
|
19
|
+
if (isBorrowed && !STABLE_ASSETS.includes(symbol)) {
|
|
20
|
+
borrowUnstable += 1;
|
|
21
|
+
shortAsset = spokeAsset;
|
|
22
|
+
}
|
|
23
|
+
if (isSupplied && !STABLE_ASSETS.includes(symbol) && collateral) {
|
|
24
|
+
supplyUnstable += 1;
|
|
25
|
+
longAsset = spokeAsset;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
29
|
+
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
30
|
+
// lsd -> liquid staking derivative
|
|
31
|
+
const isLsdLeveraged = supplyUnstable === 1 && borrowUnstable === 1 && shortAsset === 'ETH' && ['stETH', 'wstETH', 'cbETH', 'rETH', 'ezETH', 'weETH'].includes(longAsset);
|
|
32
|
+
if (isLong) {
|
|
33
|
+
return {
|
|
34
|
+
leveragedType: 'long',
|
|
35
|
+
leveragedAsset: longAsset,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (isShort) {
|
|
39
|
+
return {
|
|
40
|
+
leveragedType: 'short',
|
|
41
|
+
leveragedAsset: shortAsset,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (isLsdLeveraged) {
|
|
45
|
+
return {
|
|
46
|
+
leveragedType: 'lsd-leverage',
|
|
47
|
+
leveragedAsset: longAsset,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
leveragedType: '',
|
|
52
|
+
leveragedAsset: '',
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export const aaveV4GetAggregatedPositionData = ({ usedAssets, assetsData, network, useUserCollateralFactor = false, }) => {
|
|
56
|
+
var _a;
|
|
57
|
+
const payload = {};
|
|
58
|
+
payload.suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
59
|
+
payload.suppliedCollateralUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
|
|
60
|
+
payload.borrowLimitUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ symbol, suppliedUsd, reserveId }) => new Dec(suppliedUsd).mul(aaveV4GetCollateralFactor(assetsData[`${symbol}-${reserveId}`], usedAssets[`${symbol}-${reserveId}`], useUserCollateralFactor)));
|
|
61
|
+
payload.liquidationLimitUsd = payload.borrowLimitUsd;
|
|
62
|
+
payload.borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
|
|
63
|
+
payload.drawnUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ drawnUsd }) => drawnUsd);
|
|
64
|
+
payload.premiumUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ premiumUsd }) => premiumUsd);
|
|
65
|
+
const leftToBorrowUsd = new Dec(payload.borrowLimitUsd).sub(payload.borrowedUsd);
|
|
66
|
+
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
67
|
+
payload.ratio = +payload.suppliedUsd ? new Dec(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
68
|
+
payload.collRatio = +payload.suppliedUsd ? new Dec(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
69
|
+
payload.liqRatio = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
|
|
70
|
+
payload.liqPercent = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
71
|
+
const { leveragedType, leveragedAsset } = isLeveragedPosAaveV4(usedAssets);
|
|
72
|
+
payload.leveragedType = leveragedType;
|
|
73
|
+
payload.leveragedAsset = leveragedAsset;
|
|
74
|
+
payload.liquidationPrice = '';
|
|
75
|
+
if (leveragedType !== '') {
|
|
76
|
+
const leveragedAssetData = Object.values(assetsData).find((asset) => asset.symbol === leveragedAsset);
|
|
77
|
+
let assetPrice = (leveragedAssetData === null || leveragedAssetData === void 0 ? void 0 : leveragedAssetData.price) || '0';
|
|
78
|
+
if (leveragedType === 'lsd-leverage') {
|
|
79
|
+
// Treat ETH like a stablecoin in a long stETH position
|
|
80
|
+
const ethPrice = ((_a = Object.values(assetsData).find((asset) => asset.symbol === 'ETH')) === null || _a === void 0 ? void 0 : _a.price) || '0';
|
|
81
|
+
payload.leveragedLsdAssetRatio = new Dec((leveragedAssetData === null || leveragedAssetData === void 0 ? void 0 : leveragedAssetData.price) || '0').div(ethPrice).toDP(18).toString();
|
|
82
|
+
assetPrice = new Dec(assetPrice).div(ethPrice).toString();
|
|
83
|
+
}
|
|
84
|
+
payload.liquidationPrice = calcLeverageLiqPrice(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
85
|
+
}
|
|
86
|
+
payload.minCollRatio = new Dec(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
|
|
87
|
+
payload.collLiquidationRatio = new Dec(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
88
|
+
// payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
|
|
89
|
+
payload.minHealthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
|
|
90
|
+
// TODO: Re-implement netApy calculation
|
|
91
|
+
// const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({
|
|
92
|
+
// usedAssets,
|
|
93
|
+
// assetsData,
|
|
94
|
+
// optionalData: { healthRatio: payload.healthRatio },
|
|
95
|
+
// });
|
|
96
|
+
payload.netApy = '0';
|
|
97
|
+
payload.incentiveUsd = '0';
|
|
98
|
+
payload.totalInterestUsd = '0';
|
|
99
|
+
return payload;
|
|
100
|
+
};
|
package/esm/helpers/index.d.ts
CHANGED
package/esm/helpers/index.js
CHANGED
|
@@ -118,73 +118,73 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, provider, n
|
|
|
118
118
|
return { borrowRate, supplyRate };
|
|
119
119
|
});
|
|
120
120
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
121
|
-
const MARKET_QUERY = `
|
|
122
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
123
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
124
|
-
reallocatableLiquidityAssets
|
|
125
|
-
targetBorrowUtilization
|
|
126
|
-
loanAsset {
|
|
127
|
-
address
|
|
128
|
-
decimals
|
|
129
|
-
priceUsd
|
|
130
|
-
}
|
|
131
|
-
state {
|
|
132
|
-
liquidityAssets
|
|
133
|
-
borrowAssets
|
|
134
|
-
supplyAssets
|
|
135
|
-
}
|
|
136
|
-
publicAllocatorSharedLiquidity {
|
|
137
|
-
assets
|
|
138
|
-
vault {
|
|
139
|
-
address
|
|
140
|
-
name
|
|
141
|
-
}
|
|
142
|
-
allocationMarket {
|
|
143
|
-
uniqueKey
|
|
144
|
-
loanAsset {
|
|
145
|
-
address
|
|
146
|
-
}
|
|
147
|
-
collateralAsset {
|
|
148
|
-
address
|
|
149
|
-
}
|
|
150
|
-
irmAddress
|
|
151
|
-
oracle {
|
|
152
|
-
address
|
|
153
|
-
}
|
|
154
|
-
lltv
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
loanAsset {
|
|
158
|
-
address
|
|
159
|
-
}
|
|
160
|
-
collateralAsset {
|
|
161
|
-
address
|
|
162
|
-
}
|
|
163
|
-
oracle {
|
|
164
|
-
address
|
|
165
|
-
}
|
|
166
|
-
irmAddress
|
|
167
|
-
lltv
|
|
168
|
-
}
|
|
169
|
-
}
|
|
121
|
+
const MARKET_QUERY = `
|
|
122
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
123
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
124
|
+
reallocatableLiquidityAssets
|
|
125
|
+
targetBorrowUtilization
|
|
126
|
+
loanAsset {
|
|
127
|
+
address
|
|
128
|
+
decimals
|
|
129
|
+
priceUsd
|
|
130
|
+
}
|
|
131
|
+
state {
|
|
132
|
+
liquidityAssets
|
|
133
|
+
borrowAssets
|
|
134
|
+
supplyAssets
|
|
135
|
+
}
|
|
136
|
+
publicAllocatorSharedLiquidity {
|
|
137
|
+
assets
|
|
138
|
+
vault {
|
|
139
|
+
address
|
|
140
|
+
name
|
|
141
|
+
}
|
|
142
|
+
allocationMarket {
|
|
143
|
+
uniqueKey
|
|
144
|
+
loanAsset {
|
|
145
|
+
address
|
|
146
|
+
}
|
|
147
|
+
collateralAsset {
|
|
148
|
+
address
|
|
149
|
+
}
|
|
150
|
+
irmAddress
|
|
151
|
+
oracle {
|
|
152
|
+
address
|
|
153
|
+
}
|
|
154
|
+
lltv
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
loanAsset {
|
|
158
|
+
address
|
|
159
|
+
}
|
|
160
|
+
collateralAsset {
|
|
161
|
+
address
|
|
162
|
+
}
|
|
163
|
+
oracle {
|
|
164
|
+
address
|
|
165
|
+
}
|
|
166
|
+
irmAddress
|
|
167
|
+
lltv
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
170
|
`;
|
|
171
|
-
const REWARDS_QUERY = `
|
|
172
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
173
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
174
|
-
uniqueKey
|
|
175
|
-
state {
|
|
176
|
-
rewards {
|
|
177
|
-
amountPerSuppliedToken
|
|
178
|
-
supplyApr
|
|
179
|
-
amountPerBorrowedToken
|
|
180
|
-
borrowApr
|
|
181
|
-
asset {
|
|
182
|
-
address
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
171
|
+
const REWARDS_QUERY = `
|
|
172
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
173
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
174
|
+
uniqueKey
|
|
175
|
+
state {
|
|
176
|
+
rewards {
|
|
177
|
+
amountPerSuppliedToken
|
|
178
|
+
supplyApr
|
|
179
|
+
amountPerBorrowedToken
|
|
180
|
+
borrowApr
|
|
181
|
+
asset {
|
|
182
|
+
address
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
188
|
`;
|
|
189
189
|
/**
|
|
190
190
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './setup';
|
|
2
2
|
import * as fluid from './fluid';
|
|
3
|
+
import * as aaveV4 from './aaveV4';
|
|
3
4
|
import * as aaveV3 from './aaveV3';
|
|
4
5
|
import * as aaveV2 from './aaveV2';
|
|
5
6
|
import * as compoundV3 from './compoundV3';
|
|
@@ -21,4 +22,4 @@ import * as portfolio from './portfolio';
|
|
|
21
22
|
import * as claiming from './claiming';
|
|
22
23
|
import * as savings from './savings';
|
|
23
24
|
export * from './types';
|
|
24
|
-
export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
|
25
|
+
export { aaveV2, aaveV3, aaveV4, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './setup';
|
|
2
2
|
import * as fluid from './fluid';
|
|
3
|
+
import * as aaveV4 from './aaveV4';
|
|
3
4
|
import * as aaveV3 from './aaveV3';
|
|
4
5
|
import * as aaveV2 from './aaveV2';
|
|
5
6
|
import * as compoundV3 from './compoundV3';
|
|
@@ -21,4 +22,4 @@ import * as portfolio from './portfolio';
|
|
|
21
22
|
import * as claiming from './claiming';
|
|
22
23
|
import * as savings from './savings';
|
|
23
24
|
export * from './types';
|
|
24
|
-
export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
|
25
|
+
export { aaveV2, aaveV3, aaveV4, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
|
@@ -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,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AaveV4SpokeInfo, AaveV4SpokesType } from '../../types';
|
|
2
|
+
import { NetworkNumber } from '../../types/common';
|
|
3
|
+
export declare const AAVE_V4_CORE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
4
|
+
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
5
|
+
readonly aave_v4_core_spoke: AaveV4SpokeInfo;
|
|
6
|
+
};
|
|
7
|
+
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AaveV4SpokesType } from '../../types';
|
|
2
|
+
import { NetworkNumber } from '../../types/common';
|
|
3
|
+
export const AAVE_V4_CORE_SPOKE = (networkId) => ({
|
|
4
|
+
chainIds: [NetworkNumber.Eth],
|
|
5
|
+
label: 'Core Spoke',
|
|
6
|
+
value: AaveV4SpokesType.AaveV4CoreSpoke,
|
|
7
|
+
url: 'core',
|
|
8
|
+
address: '0xBa97c5E52cd5BC3D7950Ae70779F8FfE92d40CdC',
|
|
9
|
+
hubs: [
|
|
10
|
+
'0xaD905aD5EA5B98cD50AE40Cfe368344686a21366',
|
|
11
|
+
],
|
|
12
|
+
});
|
|
13
|
+
export const AaveV4Spokes = (networkId) => ({
|
|
14
|
+
[AaveV4SpokesType.AaveV4CoreSpoke]: AAVE_V4_CORE_SPOKE(networkId),
|
|
15
|
+
});
|
|
16
|
+
export const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, AaveV4Spokes(network !== null && network !== void 0 ? network : NetworkNumber.Eth))[type]);
|
package/esm/markets/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { LlamaLendMarkets } from './llamaLend';
|
|
|
7
7
|
export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
|
|
8
8
|
export { EulerV2Markets } from './euler';
|
|
9
9
|
export { FluidMarkets, getFluidVersionsDataForNetwork, getFluidMarketInfoById, getFTokenAddress, getFluidMarketInfoByAddress, } from './fluid';
|
|
10
|
+
export { AaveV4Spokes } from './aaveV4';
|
package/esm/markets/index.js
CHANGED
|
@@ -7,3 +7,4 @@ export { LlamaLendMarkets } from './llamaLend';
|
|
|
7
7
|
export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
|
|
8
8
|
export { EulerV2Markets } from './euler';
|
|
9
9
|
export { FluidMarkets, getFluidVersionsDataForNetwork, getFluidMarketInfoById, getFTokenAddress, getFluidMarketInfoByAddress, } from './fluid';
|
|
10
|
+
export { AaveV4Spokes } from './aaveV4';
|
|
@@ -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/portfolio/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
11
|
import { NetworkNumber } from '../types/common';
|
|
12
|
-
import { AaveMarkets, CompoundMarkets, CrvUsdMarkets, EulerV2Markets, LiquityV2Markets, LlamaLendMarkets, MorphoBlueMarkets, SparkMarkets, } from '../markets';
|
|
12
|
+
import { AaveMarkets, AaveV4Spokes, CompoundMarkets, CrvUsdMarkets, EulerV2Markets, LiquityV2Markets, LlamaLendMarkets, MorphoBlueMarkets, SparkMarkets, } from '../markets';
|
|
13
13
|
import { _getMorphoBlueAccountData, _getMorphoBlueMarketData, getMorphoEarn } from '../morphoBlue';
|
|
14
14
|
import { AaveVersions, CompoundVersions, } from '../types';
|
|
15
15
|
import { _getCompoundV3AccountData, _getCompoundV3MarketsData } from '../compoundV3';
|
|
@@ -34,6 +34,7 @@ import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
|
|
|
34
34
|
import { fetchMorphoBlueRewards } from '../claiming/morphoBlue';
|
|
35
35
|
import { getKingRewards } from '../claiming/king';
|
|
36
36
|
import { fetchEthenaAirdropRewards } from '../claiming/ethena';
|
|
37
|
+
import { _getAaveV4AccountData, _getAaveV4SpokeData } from '../aaveV4';
|
|
37
38
|
export function getPortfolioData(provider, network, defaultProvider, addresses, summerFiAddresses) {
|
|
38
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
40
|
const isMainnet = network === NetworkNumber.Eth;
|
|
@@ -50,6 +51,7 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
50
51
|
const llamaLendMarkets = [NetworkNumber.Eth, NetworkNumber.Arb].includes(network) ? Object.values(LlamaLendMarkets(network)).filter((market) => market.chainIds.includes(network)) : [];
|
|
51
52
|
const liquityV2Markets = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)) : [];
|
|
52
53
|
const liquityV2MarketsStaking = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)).filter(market => !market.isLegacy) : [];
|
|
54
|
+
const aaveV4Spokes = Object.values(AaveV4Spokes(network)).filter((market) => market.chainIds.includes(network));
|
|
53
55
|
const client = getViemProvider(provider, network, {
|
|
54
56
|
batch: {
|
|
55
57
|
multicall: {
|
|
@@ -75,6 +77,7 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
75
77
|
const crvUsdMarketsData = {};
|
|
76
78
|
const llamaLendMarketsData = {};
|
|
77
79
|
const liquityV2MarketsData = {};
|
|
80
|
+
const aaveV4SpokesData = {};
|
|
78
81
|
const markets = {
|
|
79
82
|
morphoMarketsData,
|
|
80
83
|
compoundV3MarketsData,
|
|
@@ -86,6 +89,7 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
86
89
|
crvUsdMarketsData,
|
|
87
90
|
llamaLendMarketsData,
|
|
88
91
|
liquityV2MarketsData,
|
|
92
|
+
aaveV4SpokesData,
|
|
89
93
|
};
|
|
90
94
|
const positions = {};
|
|
91
95
|
const stakingPositions = {};
|
|
@@ -94,6 +98,7 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
94
98
|
for (const address of allAddresses) {
|
|
95
99
|
positions[address.toLowerCase()] = {
|
|
96
100
|
aaveV3: {},
|
|
101
|
+
aaveV4: {},
|
|
97
102
|
morphoBlue: {},
|
|
98
103
|
compoundV3: {},
|
|
99
104
|
spark: {},
|
|
@@ -159,6 +164,10 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
159
164
|
const marketData = yield _getAaveV3MarketData(client, network, market);
|
|
160
165
|
aaveV3MarketsData[market.value] = marketData;
|
|
161
166
|
})),
|
|
167
|
+
...aaveV4Spokes.map((spoke) => __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const spokeData = yield _getAaveV4SpokeData(client, network, spoke);
|
|
169
|
+
aaveV4SpokesData[spoke.value] = spokeData;
|
|
170
|
+
})),
|
|
162
171
|
...aaveV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
163
172
|
const marketData = yield _getAaveV2MarketsData(client, network, market);
|
|
164
173
|
aaveV2MarketsData[market.value] = marketData;
|
|
@@ -428,6 +437,17 @@ export function getPortfolioData(provider, network, defaultProvider, addresses,
|
|
|
428
437
|
positions[address.toLowerCase()].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
429
438
|
}
|
|
430
439
|
}))).flat(),
|
|
440
|
+
...aaveV4Spokes.map((spoke) => allAddresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
441
|
+
try {
|
|
442
|
+
const accData = yield _getAaveV4AccountData(client, network, aaveV4SpokesData[spoke.value], address);
|
|
443
|
+
if (new Dec(accData.suppliedUsd).gt(0))
|
|
444
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: '', data: accData };
|
|
445
|
+
}
|
|
446
|
+
catch (error) {
|
|
447
|
+
console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
|
|
448
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
|
|
449
|
+
}
|
|
450
|
+
}))).flat(),
|
|
431
451
|
...morphoMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
432
452
|
try {
|
|
433
453
|
const [accDataPromise, earnDataPromise] = yield Promise.allSettled([
|
|
@@ -14,23 +14,23 @@ import * as morphoVaultsOptions from './options';
|
|
|
14
14
|
import { getViemProvider } from '../../services/viem';
|
|
15
15
|
import { getMorphoVaultContractViem } from '../../contracts';
|
|
16
16
|
export { morphoVaultsOptions, };
|
|
17
|
-
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
18
|
-
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
19
|
-
id,
|
|
20
|
-
dailyApy,
|
|
21
|
-
dailyApys {
|
|
22
|
-
apy, netApy
|
|
23
|
-
},
|
|
24
|
-
monthlyApys {
|
|
25
|
-
apy, netApy
|
|
26
|
-
},
|
|
27
|
-
liquidity {
|
|
28
|
-
underlying, usd,
|
|
29
|
-
},
|
|
30
|
-
asset {
|
|
31
|
-
priceUsd
|
|
32
|
-
}
|
|
33
|
-
}
|
|
17
|
+
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
18
|
+
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
19
|
+
id,
|
|
20
|
+
dailyApy,
|
|
21
|
+
dailyApys {
|
|
22
|
+
apy, netApy
|
|
23
|
+
},
|
|
24
|
+
monthlyApys {
|
|
25
|
+
apy, netApy
|
|
26
|
+
},
|
|
27
|
+
liquidity {
|
|
28
|
+
underlying, usd,
|
|
29
|
+
},
|
|
30
|
+
asset {
|
|
31
|
+
priceUsd
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
34
|
}`;
|
|
35
35
|
const MORPHO_BLUE_API = 'https://blue-api.morpho.org/graphql';
|
|
36
36
|
export const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
|
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}`);
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { EthAddress, IncentiveData, NetworkNumber } from './common';
|
|
2
|
+
export declare enum AaveV4SpokesType {
|
|
3
|
+
AaveV4CoreSpoke = "aave_v4_core_spoke"
|
|
4
|
+
}
|
|
5
|
+
export declare enum AaveV4HubsType {
|
|
6
|
+
AaveV4CoreHub = "aave_v4_core_hub"
|
|
7
|
+
}
|
|
8
|
+
export interface AaveV4SpokeInfo {
|
|
9
|
+
chainIds: NetworkNumber[];
|
|
10
|
+
label: string;
|
|
11
|
+
value: AaveV4SpokesType;
|
|
12
|
+
url: string;
|
|
13
|
+
address: EthAddress;
|
|
14
|
+
hubs: EthAddress[];
|
|
15
|
+
}
|
|
16
|
+
export interface AaveV4HubAssetOnChainData {
|
|
17
|
+
assetId: number;
|
|
18
|
+
drawnRate: bigint;
|
|
19
|
+
}
|
|
20
|
+
export interface AaveV4HubOnChainData {
|
|
21
|
+
assets: Record<number, AaveV4HubAssetOnChainData>;
|
|
22
|
+
}
|
|
23
|
+
export interface AaveV4ReserveAssetOnChain {
|
|
24
|
+
underlying: EthAddress;
|
|
25
|
+
hub: EthAddress;
|
|
26
|
+
assetId: number;
|
|
27
|
+
decimals: number;
|
|
28
|
+
paused: boolean;
|
|
29
|
+
frozen: boolean;
|
|
30
|
+
borrowable: boolean;
|
|
31
|
+
collateralRisk: number;
|
|
32
|
+
collateralFactor: number;
|
|
33
|
+
maxLiquidationBonus: number;
|
|
34
|
+
liquidationFee: number;
|
|
35
|
+
price: bigint;
|
|
36
|
+
totalSupplied: bigint;
|
|
37
|
+
totalDrawn: bigint;
|
|
38
|
+
totalPremium: bigint;
|
|
39
|
+
totalDebt: bigint;
|
|
40
|
+
supplyCap: bigint;
|
|
41
|
+
borrowCap: bigint;
|
|
42
|
+
deficitRay: bigint;
|
|
43
|
+
spokeActive: boolean;
|
|
44
|
+
spokePaused: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface AaveV4ReserveAssetData {
|
|
47
|
+
symbol: string;
|
|
48
|
+
underlying: EthAddress;
|
|
49
|
+
hub: EthAddress;
|
|
50
|
+
assetId: number;
|
|
51
|
+
reserveId: number;
|
|
52
|
+
paused: boolean;
|
|
53
|
+
frozen: boolean;
|
|
54
|
+
borrowable: boolean;
|
|
55
|
+
collateralRisk: number;
|
|
56
|
+
collateralFactor: number;
|
|
57
|
+
liquidationFee: number;
|
|
58
|
+
price: string;
|
|
59
|
+
totalSupplied: string;
|
|
60
|
+
totalDrawn: string;
|
|
61
|
+
totalPremium: string;
|
|
62
|
+
totalDebt: string;
|
|
63
|
+
supplyCap: string;
|
|
64
|
+
borrowCap: string;
|
|
65
|
+
spokeActive: boolean;
|
|
66
|
+
spokePaused: boolean;
|
|
67
|
+
drawnRate: string;
|
|
68
|
+
supplyRate: string;
|
|
69
|
+
supplyIncentives: IncentiveData[];
|
|
70
|
+
borrowIncentives: IncentiveData[];
|
|
71
|
+
canBeBorrowed: boolean;
|
|
72
|
+
canBeSupplied: boolean;
|
|
73
|
+
canBeWithdrawn: boolean;
|
|
74
|
+
canBePayBacked: boolean;
|
|
75
|
+
utilization: string;
|
|
76
|
+
}
|
|
77
|
+
export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
|
|
78
|
+
export interface AaveV4SpokeData {
|
|
79
|
+
assetsData: AaveV4AssetsData;
|
|
80
|
+
oracle: EthAddress;
|
|
81
|
+
oracleDecimals: number;
|
|
82
|
+
address: EthAddress;
|
|
83
|
+
}
|
|
84
|
+
export interface AaveV4UsedReserveAsset {
|
|
85
|
+
symbol: string;
|
|
86
|
+
assetId: number;
|
|
87
|
+
reserveId: number;
|
|
88
|
+
supplied: string;
|
|
89
|
+
suppliedUsd: string;
|
|
90
|
+
drawn: string;
|
|
91
|
+
drawnUsd: string;
|
|
92
|
+
premium: string;
|
|
93
|
+
premiumUsd: string;
|
|
94
|
+
borrowed: string;
|
|
95
|
+
borrowedUsd: string;
|
|
96
|
+
isSupplied: boolean;
|
|
97
|
+
isBorrowed: boolean;
|
|
98
|
+
collateral: boolean;
|
|
99
|
+
collateralFactor: number;
|
|
100
|
+
}
|
|
101
|
+
export interface AaveV4AggregatedPositionData {
|
|
102
|
+
suppliedUsd: string;
|
|
103
|
+
suppliedCollateralUsd: string;
|
|
104
|
+
borrowLimitUsd: string;
|
|
105
|
+
liquidationLimitUsd: string;
|
|
106
|
+
borrowedUsd: string;
|
|
107
|
+
drawnUsd: string;
|
|
108
|
+
premiumUsd: string;
|
|
109
|
+
leftToBorrowUsd: string;
|
|
110
|
+
ratio: string;
|
|
111
|
+
collRatio: string;
|
|
112
|
+
liqRatio: string;
|
|
113
|
+
liqPercent: string;
|
|
114
|
+
leveragedType: string;
|
|
115
|
+
leveragedAsset: string;
|
|
116
|
+
liquidationPrice: string;
|
|
117
|
+
leveragedLsdAssetRatio?: string;
|
|
118
|
+
minCollRatio: string;
|
|
119
|
+
collLiquidationRatio: string;
|
|
120
|
+
minHealthRatio: string;
|
|
121
|
+
netApy: string;
|
|
122
|
+
incentiveUsd: string;
|
|
123
|
+
totalInterestUsd: string;
|
|
124
|
+
}
|
|
125
|
+
export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
|
|
126
|
+
export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
|
|
127
|
+
usedAssets: AaveV4UsedReserveAssets;
|
|
128
|
+
healthFactor: string;
|
|
129
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var AaveV4SpokesType;
|
|
2
|
+
(function (AaveV4SpokesType) {
|
|
3
|
+
AaveV4SpokesType["AaveV4CoreSpoke"] = "aave_v4_core_spoke";
|
|
4
|
+
})(AaveV4SpokesType || (AaveV4SpokesType = {}));
|
|
5
|
+
export var AaveV4HubsType;
|
|
6
|
+
(function (AaveV4HubsType) {
|
|
7
|
+
AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
|
|
8
|
+
})(AaveV4HubsType || (AaveV4HubsType = {}));
|
package/esm/types/index.d.ts
CHANGED
package/esm/types/index.js
CHANGED