@defisaver/positions-sdk 2.1.52-aave-v4 → 2.1.52-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/config/contracts.d.ts +0 -1277
- package/cjs/config/contracts.js +0 -9
- package/cjs/contracts.d.ts +0 -23120
- package/cjs/contracts.js +1 -2
- package/cjs/fluid/index.d.ts +3 -3
- package/cjs/helpers/aaveHelpers/index.d.ts +2 -2
- package/cjs/helpers/aaveHelpers/index.js +18 -2
- package/cjs/helpers/compoundHelpers/index.js +1 -1
- package/cjs/helpers/eulerHelpers/index.d.ts +2 -2
- package/cjs/helpers/eulerHelpers/index.js +6 -5
- package/cjs/helpers/fluidHelpers/index.js +2 -1
- package/cjs/helpers/index.d.ts +0 -1
- package/cjs/helpers/index.js +1 -2
- package/cjs/helpers/morphoBlueHelpers/index.js +67 -67
- package/cjs/helpers/sparkHelpers/index.js +1 -1
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +1 -3
- package/cjs/markets/index.d.ts +0 -1
- package/cjs/markets/index.js +1 -3
- package/cjs/moneymarket/moneymarketCommonService.d.ts +3 -3
- package/cjs/moneymarket/moneymarketCommonService.js +14 -6
- package/cjs/portfolio/index.js +0 -20
- package/cjs/savings/morphoVaults/index.js +17 -17
- package/cjs/types/aave.d.ts +3 -2
- package/cjs/types/common.d.ts +8 -0
- package/cjs/types/common.js +10 -1
- package/cjs/types/compound.d.ts +2 -2
- package/cjs/types/curveUsd.d.ts +2 -2
- package/cjs/types/euler.d.ts +2 -2
- package/cjs/types/fluid.d.ts +2 -2
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/cjs/types/liquityV2.d.ts +3 -3
- package/cjs/types/llamaLend.d.ts +2 -2
- package/cjs/types/morphoBlue.d.ts +3 -3
- package/cjs/types/portfolio.d.ts +0 -4
- package/cjs/types/spark.d.ts +2 -2
- package/esm/config/contracts.d.ts +0 -1277
- package/esm/config/contracts.js +0 -8
- package/esm/contracts.d.ts +0 -23120
- package/esm/contracts.js +0 -1
- package/esm/fluid/index.d.ts +3 -3
- package/esm/helpers/aaveHelpers/index.d.ts +2 -2
- package/esm/helpers/aaveHelpers/index.js +18 -2
- package/esm/helpers/compoundHelpers/index.js +2 -2
- package/esm/helpers/eulerHelpers/index.d.ts +2 -2
- package/esm/helpers/eulerHelpers/index.js +6 -5
- package/esm/helpers/fluidHelpers/index.js +2 -1
- package/esm/helpers/index.d.ts +0 -1
- package/esm/helpers/index.js +0 -1
- package/esm/helpers/morphoBlueHelpers/index.js +68 -68
- package/esm/helpers/sparkHelpers/index.js +2 -2
- package/esm/index.d.ts +1 -2
- package/esm/index.js +1 -2
- package/esm/markets/index.d.ts +0 -1
- package/esm/markets/index.js +0 -1
- package/esm/moneymarket/moneymarketCommonService.d.ts +3 -3
- package/esm/moneymarket/moneymarketCommonService.js +14 -6
- package/esm/portfolio/index.js +1 -21
- package/esm/savings/morphoVaults/index.js +17 -17
- package/esm/types/aave.d.ts +3 -2
- package/esm/types/common.d.ts +8 -0
- package/esm/types/common.js +9 -0
- package/esm/types/compound.d.ts +2 -2
- package/esm/types/curveUsd.d.ts +2 -2
- package/esm/types/euler.d.ts +2 -2
- package/esm/types/fluid.d.ts +2 -2
- package/esm/types/fluid.js +1 -1
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/esm/types/liquityV2.d.ts +3 -3
- package/esm/types/llamaLend.d.ts +2 -2
- package/esm/types/morphoBlue.d.ts +3 -3
- package/esm/types/portfolio.d.ts +0 -4
- package/esm/types/spark.d.ts +2 -2
- 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/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 +1320 -1328
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +172 -174
- 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 +207 -191
- 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 +10 -11
- 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 +160 -158
- package/src/index.ts +49 -51
- 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/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 +25 -26
- 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 +988 -988
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +92 -85
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +586 -606
- 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 +57 -57
- 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 -192
- package/src/types/aave.ts +200 -198
- package/src/types/claiming.ts +114 -114
- package/src/types/common.ts +116 -107
- package/src/types/compound.ts +145 -144
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +176 -175
- package/src/types/fluid.ts +485 -483
- package/src/types/index.ts +15 -16
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +128 -126
- package/src/types/llamaLend.ts +161 -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 +202 -202
- package/src/types/portfolio.ts +60 -64
- 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 +135 -134
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
- package/cjs/aaveV4/index.d.ts +0 -7
- package/cjs/aaveV4/index.js +0 -174
- package/cjs/helpers/aaveV4Helpers/index.d.ts +0 -13
- package/cjs/helpers/aaveV4Helpers/index.js +0 -109
- package/cjs/markets/aaveV4/index.d.ts +0 -13
- package/cjs/markets/aaveV4/index.js +0 -39
- package/cjs/types/aaveV4.d.ts +0 -137
- package/cjs/types/aaveV4.js +0 -11
- package/esm/aaveV4/index.d.ts +0 -7
- package/esm/aaveV4/index.js +0 -165
- package/esm/helpers/aaveV4Helpers/index.d.ts +0 -13
- package/esm/helpers/aaveV4Helpers/index.js +0 -100
- package/esm/markets/aaveV4/index.d.ts +0 -13
- package/esm/markets/aaveV4/index.js +0 -29
- package/esm/types/aaveV4.d.ts +0 -137
- package/esm/types/aaveV4.js +0 -8
- package/src/aaveV4/index.ts +0 -176
- package/src/helpers/aaveV4Helpers/index.ts +0 -121
- package/src/markets/aaveV4/index.ts +0 -42
- package/src/types/aaveV4.ts +0 -151
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import Dec from 'decimal.js';
|
|
2
|
-
import { calcLeverageLiqPrice, getAssetsTotal, STABLE_ASSETS } from '../../moneymarket';
|
|
3
|
-
import {
|
|
4
|
-
AaveV4AggregatedPositionData, AaveV4AssetsData, AaveV4ReserveAssetData, AaveV4UsedReserveAsset, AaveV4UsedReserveAssets,
|
|
5
|
-
} from '../../types';
|
|
6
|
-
import { NetworkNumber } from '../../types/common';
|
|
7
|
-
|
|
8
|
-
export const aaveV4GetCollateralFactor = (assetData: AaveV4ReserveAssetData, usedAssetData: AaveV4UsedReserveAsset, useUserCollateralFactor: boolean = false): number => (useUserCollateralFactor ? usedAssetData.collateralFactor : assetData.collateralFactor);
|
|
9
|
-
|
|
10
|
-
export const isLeveragedPosAaveV4 = (usedAssets: AaveV4UsedReserveAssets, dustLimit = 5) => {
|
|
11
|
-
let borrowUnstable = 0;
|
|
12
|
-
let supplyStable = 0;
|
|
13
|
-
let borrowStable = 0;
|
|
14
|
-
let supplyUnstable = 0;
|
|
15
|
-
let longAsset = '';
|
|
16
|
-
let shortAsset = '';
|
|
17
|
-
Object.values(usedAssets).forEach(({
|
|
18
|
-
symbol, suppliedUsd, borrowedUsd, collateral, reserveId,
|
|
19
|
-
}) => {
|
|
20
|
-
const spokeAsset = `${symbol}-${reserveId}`;
|
|
21
|
-
const isSupplied = (+suppliedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
22
|
-
const isBorrowed = (+borrowedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
23
|
-
if (isSupplied && STABLE_ASSETS.includes(symbol) && collateral) supplyStable += 1;
|
|
24
|
-
if (isBorrowed && STABLE_ASSETS.includes(symbol)) borrowStable += 1;
|
|
25
|
-
if (isBorrowed && !STABLE_ASSETS.includes(symbol)) {
|
|
26
|
-
borrowUnstable += 1;
|
|
27
|
-
shortAsset = spokeAsset;
|
|
28
|
-
}
|
|
29
|
-
if (isSupplied && !STABLE_ASSETS.includes(symbol) && collateral) {
|
|
30
|
-
supplyUnstable += 1;
|
|
31
|
-
longAsset = spokeAsset;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
35
|
-
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
36
|
-
// lsd -> liquid staking derivative
|
|
37
|
-
const isLsdLeveraged = supplyUnstable === 1 && borrowUnstable === 1 && shortAsset === 'ETH' && ['stETH', 'wstETH', 'cbETH', 'rETH', 'ezETH', 'weETH'].includes(longAsset);
|
|
38
|
-
if (isLong) {
|
|
39
|
-
return {
|
|
40
|
-
leveragedType: 'long',
|
|
41
|
-
leveragedAsset: longAsset,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
if (isShort) {
|
|
45
|
-
return {
|
|
46
|
-
leveragedType: 'short',
|
|
47
|
-
leveragedAsset: shortAsset,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (isLsdLeveraged) {
|
|
51
|
-
return {
|
|
52
|
-
leveragedType: 'lsd-leverage',
|
|
53
|
-
leveragedAsset: longAsset,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
leveragedType: '',
|
|
58
|
-
leveragedAsset: '',
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const aaveV4GetAggregatedPositionData = ({
|
|
63
|
-
usedAssets,
|
|
64
|
-
assetsData,
|
|
65
|
-
network,
|
|
66
|
-
useUserCollateralFactor = false,
|
|
67
|
-
}: {
|
|
68
|
-
usedAssets: AaveV4UsedReserveAssets,
|
|
69
|
-
assetsData: AaveV4AssetsData,
|
|
70
|
-
network: NetworkNumber,
|
|
71
|
-
useUserCollateralFactor?: boolean,
|
|
72
|
-
}): AaveV4AggregatedPositionData => {
|
|
73
|
-
const payload = {} as AaveV4AggregatedPositionData;
|
|
74
|
-
payload.suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }: { isSupplied: boolean }) => isSupplied, ({ suppliedUsd }: { suppliedUsd: string }) => suppliedUsd);
|
|
75
|
-
payload.suppliedCollateralUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }: { isSupplied: boolean, collateral: string }) => isSupplied && collateral, ({ suppliedUsd }: { suppliedUsd: string }) => suppliedUsd);
|
|
76
|
-
payload.borrowLimitUsd = getAssetsTotal(
|
|
77
|
-
usedAssets,
|
|
78
|
-
({ isSupplied, collateral }: { isSupplied: boolean, collateral: string }) => isSupplied && collateral,
|
|
79
|
-
({ symbol, suppliedUsd, reserveId }: { symbol: string, suppliedUsd: string, reserveId: number }) => new Dec(suppliedUsd).mul(aaveV4GetCollateralFactor(assetsData[`${symbol}-${reserveId}`], usedAssets[`${symbol}-${reserveId}`], useUserCollateralFactor)),
|
|
80
|
-
);
|
|
81
|
-
payload.liquidationLimitUsd = payload.borrowLimitUsd;
|
|
82
|
-
payload.borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }: { isBorrowed: boolean }) => isBorrowed, ({ borrowedUsd }: { borrowedUsd: string }) => borrowedUsd);
|
|
83
|
-
payload.drawnUsd = getAssetsTotal(usedAssets, ({ isBorrowed }: { isBorrowed: boolean }) => isBorrowed, ({ drawnUsd }: { drawnUsd: string }) => drawnUsd);
|
|
84
|
-
payload.premiumUsd = getAssetsTotal(usedAssets, ({ isBorrowed }: { isBorrowed: boolean }) => isBorrowed, ({ premiumUsd }: { premiumUsd: string }) => premiumUsd);
|
|
85
|
-
const leftToBorrowUsd = new Dec(payload.borrowLimitUsd).sub(payload.borrowedUsd);
|
|
86
|
-
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
87
|
-
payload.ratio = +payload.suppliedUsd ? new Dec(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
88
|
-
payload.collRatio = +payload.suppliedUsd ? new Dec(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
89
|
-
payload.liqRatio = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
|
|
90
|
-
payload.liqPercent = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
91
|
-
const { leveragedType, leveragedAsset } = isLeveragedPosAaveV4(usedAssets);
|
|
92
|
-
payload.leveragedType = leveragedType;
|
|
93
|
-
payload.leveragedAsset = leveragedAsset;
|
|
94
|
-
payload.liquidationPrice = '';
|
|
95
|
-
if (leveragedType !== '') {
|
|
96
|
-
const leveragedAssetData = assetsData[leveragedAsset];
|
|
97
|
-
let assetPrice = leveragedAssetData?.price || '0';
|
|
98
|
-
if (leveragedType === 'lsd-leverage') {
|
|
99
|
-
// Treat ETH like a stablecoin in a long stETH position
|
|
100
|
-
const ethPrice = Object.values(assetsData).find((asset) => asset.symbol === 'ETH')?.price || '0';
|
|
101
|
-
payload.leveragedLsdAssetRatio = new Dec(leveragedAssetData?.price || '0').div(ethPrice).toDP(18).toString();
|
|
102
|
-
assetPrice = new Dec(assetPrice).div(ethPrice).toString();
|
|
103
|
-
}
|
|
104
|
-
payload.liquidationPrice = calcLeverageLiqPrice(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
105
|
-
}
|
|
106
|
-
payload.minCollRatio = new Dec(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
|
|
107
|
-
payload.collLiquidationRatio = new Dec(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
108
|
-
// payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
|
|
109
|
-
payload.minHealthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
|
|
110
|
-
|
|
111
|
-
// TODO: Re-implement netApy calculation
|
|
112
|
-
// const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({
|
|
113
|
-
// usedAssets,
|
|
114
|
-
// assetsData,
|
|
115
|
-
// optionalData: { healthRatio: payload.healthRatio },
|
|
116
|
-
// });
|
|
117
|
-
payload.netApy = '0';
|
|
118
|
-
payload.incentiveUsd = '0';
|
|
119
|
-
payload.totalInterestUsd = '0';
|
|
120
|
-
return payload;
|
|
121
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AaveV4HubInfo, AaveV4HubsType, AaveV4SpokeInfo, AaveV4SpokesType,
|
|
3
|
-
} from '../../types';
|
|
4
|
-
import { NetworkNumber } from '../../types/common';
|
|
5
|
-
|
|
6
|
-
// SPOKES
|
|
7
|
-
|
|
8
|
-
export const AAVE_V4_CORE_SPOKE = (networkId: NetworkNumber): AaveV4SpokeInfo => ({
|
|
9
|
-
chainIds: [NetworkNumber.Eth],
|
|
10
|
-
label: 'Core Spoke',
|
|
11
|
-
value: AaveV4SpokesType.AaveV4CoreSpoke,
|
|
12
|
-
url: 'core',
|
|
13
|
-
address: '0xBa97c5E52cd5BC3D7950Ae70779F8FfE92d40CdC',
|
|
14
|
-
hubs: [
|
|
15
|
-
'0xaD905aD5EA5B98cD50AE40Cfe368344686a21366',
|
|
16
|
-
],
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export const AaveV4Spokes = (networkId: NetworkNumber) => ({
|
|
20
|
-
[AaveV4SpokesType.AaveV4CoreSpoke]: AAVE_V4_CORE_SPOKE(networkId),
|
|
21
|
-
}) as const;
|
|
22
|
-
|
|
23
|
-
export const getAaveV4SpokeTypeInfo = (type: AaveV4SpokesType, network?: NetworkNumber) => ({ ...AaveV4Spokes(network ?? NetworkNumber.Eth) }[type]);
|
|
24
|
-
|
|
25
|
-
// HUBS
|
|
26
|
-
|
|
27
|
-
export const AAVE_V4_CORE_HUB = (networkId: NetworkNumber): AaveV4HubInfo => ({
|
|
28
|
-
chainIds: [NetworkNumber.Eth],
|
|
29
|
-
label: 'Core Hub',
|
|
30
|
-
value: AaveV4HubsType.AaveV4CoreHub,
|
|
31
|
-
address: '0xaD905aD5EA5B98cD50AE40Cfe368344686a21366',
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export const AaveV4Hubs = (networkId: NetworkNumber) => ({
|
|
35
|
-
[AaveV4HubsType.AaveV4CoreHub]: AAVE_V4_CORE_HUB(networkId),
|
|
36
|
-
}) as const;
|
|
37
|
-
|
|
38
|
-
export const getAaveV4HubTypeInfo = (type: AaveV4HubsType, network?: NetworkNumber) => ({ ...AaveV4Hubs(network ?? NetworkNumber.Eth) }[type]);
|
|
39
|
-
|
|
40
|
-
export const getAaveV4HubByAddress = (networkId: NetworkNumber, address: string): AaveV4HubInfo | undefined => Object.values(AaveV4Hubs(networkId)).find(
|
|
41
|
-
hub => hub.address.toLowerCase() === address.toLowerCase(),
|
|
42
|
-
);
|
package/src/types/aaveV4.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { EthAddress, IncentiveData, NetworkNumber } from './common';
|
|
2
|
-
|
|
3
|
-
export enum AaveV4SpokesType {
|
|
4
|
-
AaveV4CoreSpoke = 'aave_v4_core_spoke',
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export enum AaveV4HubsType {
|
|
8
|
-
AaveV4CoreHub = 'aave_v4_core_hub',
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface AaveV4SpokeInfo {
|
|
12
|
-
chainIds: NetworkNumber[],
|
|
13
|
-
label: string,
|
|
14
|
-
value: AaveV4SpokesType,
|
|
15
|
-
url: string,
|
|
16
|
-
address: EthAddress,
|
|
17
|
-
hubs: EthAddress[],
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface AaveV4HubInfo {
|
|
21
|
-
chainIds: NetworkNumber[],
|
|
22
|
-
label: string,
|
|
23
|
-
value: AaveV4HubsType,
|
|
24
|
-
address: EthAddress,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface AaveV4HubAssetOnChainData {
|
|
28
|
-
assetId: number,
|
|
29
|
-
drawnRate: bigint,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface AaveV4HubOnChainData {
|
|
33
|
-
assets: Record<number, AaveV4HubAssetOnChainData>,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface AaveV4ReserveAssetOnChain {
|
|
37
|
-
underlying: EthAddress,
|
|
38
|
-
hub: EthAddress,
|
|
39
|
-
assetId: number,
|
|
40
|
-
decimals: number,
|
|
41
|
-
paused: boolean,
|
|
42
|
-
frozen: boolean,
|
|
43
|
-
borrowable: boolean,
|
|
44
|
-
collateralRisk: number,
|
|
45
|
-
collateralFactor: number,
|
|
46
|
-
maxLiquidationBonus: number,
|
|
47
|
-
liquidationFee: number,
|
|
48
|
-
price: bigint,
|
|
49
|
-
totalSupplied: bigint,
|
|
50
|
-
totalDrawn: bigint,
|
|
51
|
-
totalPremium: bigint,
|
|
52
|
-
totalDebt: bigint,
|
|
53
|
-
supplyCap: bigint,
|
|
54
|
-
borrowCap: bigint,
|
|
55
|
-
deficitRay: bigint,
|
|
56
|
-
spokeActive: boolean,
|
|
57
|
-
spokePaused: boolean
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface AaveV4ReserveAssetData {
|
|
61
|
-
symbol: string,
|
|
62
|
-
underlying: EthAddress,
|
|
63
|
-
hub: EthAddress,
|
|
64
|
-
hubName: string,
|
|
65
|
-
assetId: number,
|
|
66
|
-
reserveId: number,
|
|
67
|
-
paused: boolean,
|
|
68
|
-
frozen: boolean,
|
|
69
|
-
borrowable: boolean,
|
|
70
|
-
collateralRisk: number,
|
|
71
|
-
collateralFactor: number,
|
|
72
|
-
liquidationFee: number,
|
|
73
|
-
price: string,
|
|
74
|
-
totalSupplied: string,
|
|
75
|
-
totalDrawn: string,
|
|
76
|
-
totalPremium: string,
|
|
77
|
-
totalDebt: string,
|
|
78
|
-
supplyCap: string,
|
|
79
|
-
borrowCap: string,
|
|
80
|
-
spokeActive: boolean,
|
|
81
|
-
spokePaused: boolean,
|
|
82
|
-
drawnRate: string,
|
|
83
|
-
supplyRate: string,
|
|
84
|
-
supplyIncentives: IncentiveData[];
|
|
85
|
-
borrowIncentives: IncentiveData[];
|
|
86
|
-
canBeBorrowed: boolean;
|
|
87
|
-
canBeSupplied: boolean;
|
|
88
|
-
canBeWithdrawn: boolean;
|
|
89
|
-
canBePayBacked: boolean;
|
|
90
|
-
utilization: string;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
|
|
94
|
-
|
|
95
|
-
export interface AaveV4SpokeData {
|
|
96
|
-
assetsData: AaveV4AssetsData,
|
|
97
|
-
oracle: EthAddress,
|
|
98
|
-
oracleDecimals: number,
|
|
99
|
-
address: EthAddress,
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface AaveV4UsedReserveAsset {
|
|
103
|
-
symbol: string,
|
|
104
|
-
hubName: string,
|
|
105
|
-
assetId: number,
|
|
106
|
-
reserveId: number,
|
|
107
|
-
supplied: string,
|
|
108
|
-
suppliedUsd: string,
|
|
109
|
-
drawn: string,
|
|
110
|
-
drawnUsd: string,
|
|
111
|
-
premium: string,
|
|
112
|
-
premiumUsd: string,
|
|
113
|
-
borrowed: string,
|
|
114
|
-
borrowedUsd: string,
|
|
115
|
-
isSupplied: boolean,
|
|
116
|
-
isBorrowed: boolean,
|
|
117
|
-
collateral: boolean,
|
|
118
|
-
collateralFactor: number,
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface AaveV4AggregatedPositionData {
|
|
122
|
-
suppliedUsd: string,
|
|
123
|
-
suppliedCollateralUsd: string,
|
|
124
|
-
borrowLimitUsd: string,
|
|
125
|
-
liquidationLimitUsd: string,
|
|
126
|
-
borrowedUsd: string,
|
|
127
|
-
drawnUsd: string,
|
|
128
|
-
premiumUsd: string,
|
|
129
|
-
leftToBorrowUsd: string,
|
|
130
|
-
ratio: string,
|
|
131
|
-
collRatio: string,
|
|
132
|
-
liqRatio: string,
|
|
133
|
-
liqPercent: string,
|
|
134
|
-
leveragedType: string,
|
|
135
|
-
leveragedAsset: string,
|
|
136
|
-
liquidationPrice: string,
|
|
137
|
-
leveragedLsdAssetRatio?: string,
|
|
138
|
-
minCollRatio: string,
|
|
139
|
-
collLiquidationRatio: string,
|
|
140
|
-
minHealthRatio: string,
|
|
141
|
-
netApy: string,
|
|
142
|
-
incentiveUsd: string,
|
|
143
|
-
totalInterestUsd: string,
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
|
|
147
|
-
|
|
148
|
-
export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
|
|
149
|
-
usedAssets: AaveV4UsedReserveAssets,
|
|
150
|
-
healthFactor: string,
|
|
151
|
-
}
|