@defisaver/positions-sdk 2.1.78 → 2.1.79-aave-v4-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/aaveV4/index.d.ts +7 -0
- package/cjs/aaveV4/index.js +298 -0
- package/cjs/aaveV4/lend.d.ts +45 -0
- package/cjs/aaveV4/lend.js +141 -0
- package/cjs/claiming/spark.js +1 -1
- package/cjs/config/contracts.d.ts +1551 -0
- package/cjs/config/contracts.js +9 -0
- package/cjs/contracts.d.ts +32741 -0
- package/cjs/contracts.js +2 -1
- package/cjs/helpers/aaveV4Helpers/index.d.ts +12 -0
- package/cjs/helpers/aaveV4Helpers/index.js +117 -0
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/markets/aaveV4/index.d.ts +34 -0
- package/cjs/markets/aaveV4/index.js +182 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/portfolio/index.js +20 -0
- package/cjs/types/aaveV4.d.ts +156 -0
- package/cjs/types/aaveV4.js +22 -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 +255 -0
- package/esm/aaveV4/lend.d.ts +45 -0
- package/esm/aaveV4/lend.js +134 -0
- package/esm/claiming/spark.js +1 -1
- package/esm/config/contracts.d.ts +1551 -0
- package/esm/config/contracts.js +8 -0
- package/esm/contracts.d.ts +32741 -0
- package/esm/contracts.js +1 -0
- package/esm/helpers/aaveV4Helpers/index.d.ts +12 -0
- package/esm/helpers/aaveV4Helpers/index.js +108 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/markets/aaveV4/index.d.ts +34 -0
- package/esm/markets/aaveV4/index.js +161 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/portfolio/index.js +21 -1
- package/esm/types/aaveV4.d.ts +156 -0
- package/esm/types/aaveV4.js +19 -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 +2 -2
- package/src/aaveV4/index.ts +291 -0
- package/src/aaveV4/lend.ts +180 -0
- package/src/claiming/spark.ts +1 -1
- package/src/config/contracts.ts +8 -0
- package/src/contracts.ts +2 -0
- package/src/helpers/aaveV4Helpers/index.ts +133 -0
- package/src/helpers/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/markets/aaveV4/index.ts +191 -0
- package/src/markets/index.ts +6 -1
- package/src/portfolio/index.ts +20 -0
- package/src/types/aaveV4.ts +172 -0
- package/src/types/index.ts +2 -1
- package/src/types/portfolio.ts +4 -0
package/esm/contracts.js
CHANGED
|
@@ -140,3 +140,4 @@ export const StkAAVEViem = createViemContractFromConfigFunc('StkAAVE');
|
|
|
140
140
|
export const YearnViewContractViem = createViemContractFromConfigFunc('YearnView');
|
|
141
141
|
export const MakerDsrContractViem = createViemContractFromConfigFunc('MakerDsr');
|
|
142
142
|
export const SkySavingsContractView = createViemContractFromConfigFunc('SkySavings');
|
|
143
|
+
export const AaveV4ViewContractViem = createViemContractFromConfigFunc('AaveV4View');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AaveV4AggregatedPositionData, AaveV4AssetsData, AaveV4ReserveAssetData, AaveV4UsedReserveAsset, AaveV4UsedReserveAssets, LeverageType, NetworkNumber } from '../../types';
|
|
2
|
+
export declare const aaveV4GetCollateralFactor: (assetData: AaveV4ReserveAssetData, usedAssetData: AaveV4UsedReserveAsset, useUserCollateralFactor?: boolean) => number;
|
|
3
|
+
export declare const isLeveragedPosAaveV4: (usedAssets: AaveV4UsedReserveAssets, dustLimit?: number) => {
|
|
4
|
+
leveragedType: LeverageType;
|
|
5
|
+
leveragedAsset: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const aaveV4GetAggregatedPositionData: ({ usedAssets, assetsData, network, useUserCollateralFactor, }: {
|
|
8
|
+
usedAssets: AaveV4UsedReserveAssets;
|
|
9
|
+
assetsData: AaveV4AssetsData;
|
|
10
|
+
network: NetworkNumber;
|
|
11
|
+
useUserCollateralFactor?: boolean;
|
|
12
|
+
}) => AaveV4AggregatedPositionData;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import Dec from 'decimal.js';
|
|
2
|
+
import { calcLeverageLiqPrice, getAssetsTotal, STABLE_ASSETS } from '../../moneymarket';
|
|
3
|
+
import { LeverageType, } from '../../types';
|
|
4
|
+
export const aaveV4GetCollateralFactor = (assetData, usedAssetData, useUserCollateralFactor = false) => (useUserCollateralFactor ? usedAssetData.collateralFactor : assetData.collateralFactor);
|
|
5
|
+
export const isLeveragedPosAaveV4 = (usedAssets, dustLimit = 5) => {
|
|
6
|
+
let borrowUnstable = 0;
|
|
7
|
+
let supplyStable = 0;
|
|
8
|
+
let borrowStable = 0;
|
|
9
|
+
let supplyUnstable = 0;
|
|
10
|
+
let longAsset = '';
|
|
11
|
+
let shortAsset = '';
|
|
12
|
+
Object.values(usedAssets).forEach(({ symbol, suppliedUsd, borrowedUsd, collateral, reserveId, }) => {
|
|
13
|
+
const spokeAsset = `${symbol}-${reserveId}`;
|
|
14
|
+
const isSupplied = (+suppliedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
15
|
+
const isBorrowed = (+borrowedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
16
|
+
if (isSupplied && STABLE_ASSETS.includes(symbol) && collateral)
|
|
17
|
+
supplyStable += 1;
|
|
18
|
+
if (isBorrowed && STABLE_ASSETS.includes(symbol))
|
|
19
|
+
borrowStable += 1;
|
|
20
|
+
if (isBorrowed && !STABLE_ASSETS.includes(symbol)) {
|
|
21
|
+
borrowUnstable += 1;
|
|
22
|
+
shortAsset = spokeAsset;
|
|
23
|
+
}
|
|
24
|
+
if (isSupplied && !STABLE_ASSETS.includes(symbol) && collateral) {
|
|
25
|
+
supplyUnstable += 1;
|
|
26
|
+
longAsset = spokeAsset;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
30
|
+
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
31
|
+
const isVolatilePair = supplyUnstable === 1 && borrowUnstable === 1 && supplyStable === 0 && borrowStable === 0;
|
|
32
|
+
if (isLong) {
|
|
33
|
+
return {
|
|
34
|
+
leveragedType: LeverageType.Long,
|
|
35
|
+
leveragedAsset: longAsset,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (isShort) {
|
|
39
|
+
return {
|
|
40
|
+
leveragedType: LeverageType.Short,
|
|
41
|
+
leveragedAsset: shortAsset,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (isVolatilePair) {
|
|
45
|
+
return {
|
|
46
|
+
leveragedType: LeverageType.VolatilePair,
|
|
47
|
+
leveragedAsset: longAsset,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
leveragedType: LeverageType.None,
|
|
52
|
+
leveragedAsset: '',
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export const aaveV4GetAggregatedPositionData = ({ usedAssets, assetsData, network, useUserCollateralFactor = false, }) => {
|
|
56
|
+
const payload = {};
|
|
57
|
+
payload.suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
58
|
+
payload.suppliedCollateralUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
|
|
59
|
+
payload.borrowLimitUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ symbol, suppliedUsd, reserveId }) => new Dec(suppliedUsd).mul(aaveV4GetCollateralFactor(assetsData[`${symbol}-${reserveId}`], usedAssets[`${symbol}-${reserveId}`], useUserCollateralFactor)));
|
|
60
|
+
payload.liquidationLimitUsd = payload.borrowLimitUsd;
|
|
61
|
+
payload.borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
|
|
62
|
+
payload.drawnUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ drawnUsd }) => drawnUsd);
|
|
63
|
+
payload.premiumUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ premiumUsd }) => premiumUsd);
|
|
64
|
+
const leftToBorrowUsd = new Dec(payload.borrowLimitUsd).sub(payload.borrowedUsd);
|
|
65
|
+
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
66
|
+
payload.ratio = +payload.suppliedUsd ? new Dec(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
67
|
+
payload.collRatio = +payload.suppliedUsd ? new Dec(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
68
|
+
payload.liqRatio = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
|
|
69
|
+
payload.liqPercent = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
70
|
+
const { leveragedType, leveragedAsset } = isLeveragedPosAaveV4(usedAssets);
|
|
71
|
+
payload.leveragedType = leveragedType;
|
|
72
|
+
payload.leveragedAsset = leveragedAsset;
|
|
73
|
+
payload.liquidationPrice = '';
|
|
74
|
+
if (leveragedType !== '') {
|
|
75
|
+
const leveragedAssetData = assetsData[leveragedAsset];
|
|
76
|
+
let assetPrice = (leveragedAssetData === null || leveragedAssetData === void 0 ? void 0 : leveragedAssetData.price) || '0';
|
|
77
|
+
if (leveragedType === LeverageType.VolatilePair) {
|
|
78
|
+
const borrowedAsset = Object.values(usedAssets).find(({ borrowedUsd }) => +borrowedUsd > 0);
|
|
79
|
+
const borrowedAssetPrice = assetsData[`${borrowedAsset.symbol}-${borrowedAsset.reserveId}`].price;
|
|
80
|
+
const leveragedAssetPrice = assetsData[leveragedAsset].price;
|
|
81
|
+
const isReverse = new Dec(leveragedAssetPrice).lt(borrowedAssetPrice);
|
|
82
|
+
if (isReverse) {
|
|
83
|
+
payload.leveragedType = LeverageType.VolatilePairReverse;
|
|
84
|
+
payload.currentVolatilePairRatio = new Dec(borrowedAssetPrice).div(leveragedAssetPrice).toDP(18).toString();
|
|
85
|
+
assetPrice = new Dec(borrowedAssetPrice).div(assetPrice).toString();
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
assetPrice = new Dec(assetPrice).div(borrowedAssetPrice).toString();
|
|
89
|
+
payload.currentVolatilePairRatio = new Dec(leveragedAssetPrice).div(borrowedAssetPrice).toDP(18).toString();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
payload.liquidationPrice = calcLeverageLiqPrice(payload.leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
93
|
+
}
|
|
94
|
+
payload.minCollRatio = new Dec(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
|
|
95
|
+
payload.collLiquidationRatio = new Dec(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
96
|
+
// payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
|
|
97
|
+
payload.minHealthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
|
|
98
|
+
// TODO: Re-implement netApy calculation
|
|
99
|
+
// const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({
|
|
100
|
+
// usedAssets,
|
|
101
|
+
// assetsData,
|
|
102
|
+
// optionalData: { healthRatio: payload.healthRatio },
|
|
103
|
+
// });
|
|
104
|
+
payload.netApy = '0';
|
|
105
|
+
payload.incentiveUsd = '0';
|
|
106
|
+
payload.totalInterestUsd = '0';
|
|
107
|
+
return payload;
|
|
108
|
+
};
|
package/esm/helpers/index.d.ts
CHANGED
package/esm/helpers/index.js
CHANGED
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, };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AaveV4HubInfo, AaveV4HubsType, AaveV4SpokeInfo, AaveV4SpokesType, NetworkNumber } from '../../types';
|
|
2
|
+
export declare const AAVE_V4_CORE_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
3
|
+
export declare const AAVE_V4_PLUS_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
4
|
+
export declare const AAVE_V4_PRIME_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
5
|
+
export declare const AaveV4Hubs: (networkId: NetworkNumber) => {
|
|
6
|
+
readonly aave_v4_core_hub: AaveV4HubInfo;
|
|
7
|
+
readonly aave_v4_plus_hub: AaveV4HubInfo;
|
|
8
|
+
readonly aave_v4_prime_hub: AaveV4HubInfo;
|
|
9
|
+
};
|
|
10
|
+
export declare const getAaveV4HubTypeInfo: (type: AaveV4HubsType, network?: NetworkNumber) => AaveV4HubInfo;
|
|
11
|
+
export declare const getAaveV4HubByAddress: (networkId: NetworkNumber, address: string) => AaveV4HubInfo | undefined;
|
|
12
|
+
export declare const AAVE_V4_BLUECHIP_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
13
|
+
export declare const AAVE_V4_ETHENA_CORRELATED_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
14
|
+
export declare const AAVE_V4_ETHENA_ECOSYSTEM_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
15
|
+
export declare const AAVE_V4_ETHERFI_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
16
|
+
export declare const AAVE_V4_FOREX_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
17
|
+
export declare const AAVE_V4_GOLD_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
18
|
+
export declare const AAVE_V4_KELP_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
19
|
+
export declare const AAVE_V4_LIDO_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
20
|
+
export declare const AAVE_V4_LOMBARD_BTC_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
21
|
+
export declare const AAVE_V4_MAIN_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
22
|
+
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
23
|
+
readonly aave_v4_bluechip_spoke: AaveV4SpokeInfo;
|
|
24
|
+
readonly aave_v4_ethena_correlated_spoke: AaveV4SpokeInfo;
|
|
25
|
+
readonly aave_v4_ethena_ecosystem_spoke: AaveV4SpokeInfo;
|
|
26
|
+
readonly aave_v4_etherfi_spoke: AaveV4SpokeInfo;
|
|
27
|
+
readonly aave_v4_forex_spoke: AaveV4SpokeInfo;
|
|
28
|
+
readonly aave_v4_gold_spoke: AaveV4SpokeInfo;
|
|
29
|
+
readonly aave_v4_kelp_spoke: AaveV4SpokeInfo;
|
|
30
|
+
readonly aave_v4_lido_spoke: AaveV4SpokeInfo;
|
|
31
|
+
readonly aave_v4_lombard_btc_spoke: AaveV4SpokeInfo;
|
|
32
|
+
readonly aave_v4_main_spoke: AaveV4SpokeInfo;
|
|
33
|
+
};
|
|
34
|
+
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { AaveV4HubsType, AaveV4SpokesType, NetworkNumber, } from '../../types';
|
|
2
|
+
// HUBS
|
|
3
|
+
export const AAVE_V4_CORE_HUB = (networkId) => ({
|
|
4
|
+
chainIds: [NetworkNumber.Eth],
|
|
5
|
+
label: 'Core Hub',
|
|
6
|
+
value: AaveV4HubsType.AaveV4CoreHub,
|
|
7
|
+
address: '0x630c2cFF89cb11E62dE047EaeD8C4B396906bD7D',
|
|
8
|
+
});
|
|
9
|
+
export const AAVE_V4_PLUS_HUB = (networkId) => ({
|
|
10
|
+
chainIds: [NetworkNumber.Eth],
|
|
11
|
+
label: 'Plus Hub',
|
|
12
|
+
value: AaveV4HubsType.AaveV4PlusHub,
|
|
13
|
+
address: '0x903395aEF788bD0A3a4c7a08651a9115add7c36b',
|
|
14
|
+
});
|
|
15
|
+
export const AAVE_V4_PRIME_HUB = (networkId) => ({
|
|
16
|
+
chainIds: [NetworkNumber.Eth],
|
|
17
|
+
label: 'Prime Hub',
|
|
18
|
+
value: AaveV4HubsType.AaveV4PrimeHub,
|
|
19
|
+
address: '0xf64d97bd0454DF721d0edB468265f204D3A3421D',
|
|
20
|
+
});
|
|
21
|
+
export const AaveV4Hubs = (networkId) => ({
|
|
22
|
+
[AaveV4HubsType.AaveV4CoreHub]: AAVE_V4_CORE_HUB(networkId),
|
|
23
|
+
[AaveV4HubsType.AaveV4PlusHub]: AAVE_V4_PLUS_HUB(networkId),
|
|
24
|
+
[AaveV4HubsType.AaveV4PrimeHub]: AAVE_V4_PRIME_HUB(networkId),
|
|
25
|
+
});
|
|
26
|
+
export const getAaveV4HubTypeInfo = (type, network) => (Object.assign({}, AaveV4Hubs(network !== null && network !== void 0 ? network : NetworkNumber.Eth))[type]);
|
|
27
|
+
export const getAaveV4HubByAddress = (networkId, address) => Object.values(AaveV4Hubs(networkId)).find(hub => hub.address.toLowerCase() === address.toLowerCase());
|
|
28
|
+
// SPOKES
|
|
29
|
+
export const AAVE_V4_BLUECHIP_SPOKE = (networkId) => ({
|
|
30
|
+
chainIds: [NetworkNumber.Eth],
|
|
31
|
+
label: 'Bluechip Spoke',
|
|
32
|
+
value: AaveV4SpokesType.AaveV4BluechipSpoke,
|
|
33
|
+
url: 'bluechip',
|
|
34
|
+
address: '0xF1Fa1042474dC8bd4Ef830Fe70aE22C85A326729',
|
|
35
|
+
hubs: [
|
|
36
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
37
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
38
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
39
|
+
],
|
|
40
|
+
});
|
|
41
|
+
export const AAVE_V4_ETHENA_CORRELATED_SPOKE = (networkId) => ({
|
|
42
|
+
chainIds: [NetworkNumber.Eth],
|
|
43
|
+
label: 'Ethena Correlated Spoke',
|
|
44
|
+
value: AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke,
|
|
45
|
+
url: 'ethena-correlated',
|
|
46
|
+
address: '0xa1A984B65b661599a61680f56a6c864ECED96CA6',
|
|
47
|
+
hubs: [
|
|
48
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
49
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
50
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
51
|
+
],
|
|
52
|
+
});
|
|
53
|
+
export const AAVE_V4_ETHENA_ECOSYSTEM_SPOKE = (networkId) => ({
|
|
54
|
+
chainIds: [NetworkNumber.Eth],
|
|
55
|
+
label: 'Ethena Ecosystem Spoke',
|
|
56
|
+
value: AaveV4SpokesType.AaveV4EthenaEcosystemSpoke,
|
|
57
|
+
url: 'ethena-ecosystem',
|
|
58
|
+
address: '0x417Fae379865b8E298332e2F6fdcc2526D55a090',
|
|
59
|
+
hubs: [
|
|
60
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
61
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
62
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
63
|
+
],
|
|
64
|
+
});
|
|
65
|
+
export const AAVE_V4_ETHERFI_SPOKE = (networkId) => ({
|
|
66
|
+
chainIds: [NetworkNumber.Eth],
|
|
67
|
+
label: 'Etherfi Spoke',
|
|
68
|
+
value: AaveV4SpokesType.AaveV4EtherfiSpoke,
|
|
69
|
+
url: 'etherfi',
|
|
70
|
+
address: '0x7ED7431793eCbe5d42D64CA9b2593d026beB051B',
|
|
71
|
+
hubs: [
|
|
72
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
73
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
74
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
export const AAVE_V4_FOREX_SPOKE = (networkId) => ({
|
|
78
|
+
chainIds: [NetworkNumber.Eth],
|
|
79
|
+
label: 'Forex Spoke',
|
|
80
|
+
value: AaveV4SpokesType.AaveV4ForexSpoke,
|
|
81
|
+
url: 'forex',
|
|
82
|
+
address: '0x37b36B7dfaBB69B12519B7Faaf019a6C0B261264',
|
|
83
|
+
hubs: [
|
|
84
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
85
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
86
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
export const AAVE_V4_GOLD_SPOKE = (networkId) => ({
|
|
90
|
+
chainIds: [NetworkNumber.Eth],
|
|
91
|
+
label: 'Gold Spoke',
|
|
92
|
+
value: AaveV4SpokesType.AaveV4GoldSpoke,
|
|
93
|
+
url: 'gold',
|
|
94
|
+
address: '0x332EFa0E2121091Ae94f44F8c2C383B061ae2Ea7',
|
|
95
|
+
hubs: [
|
|
96
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
97
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
98
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
99
|
+
],
|
|
100
|
+
});
|
|
101
|
+
export const AAVE_V4_KELP_SPOKE = (networkId) => ({
|
|
102
|
+
chainIds: [NetworkNumber.Eth],
|
|
103
|
+
label: 'Kelp Spoke',
|
|
104
|
+
value: AaveV4SpokesType.AaveV4KelpSpoke,
|
|
105
|
+
url: 'kelp',
|
|
106
|
+
address: '0xC8FA3983843E7a978244e34c0e2562159A3D0783',
|
|
107
|
+
hubs: [
|
|
108
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
109
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
110
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
111
|
+
],
|
|
112
|
+
});
|
|
113
|
+
export const AAVE_V4_LIDO_SPOKE = (networkId) => ({
|
|
114
|
+
chainIds: [NetworkNumber.Eth],
|
|
115
|
+
label: 'Lido Spoke',
|
|
116
|
+
value: AaveV4SpokesType.AaveV4LidoSpoke,
|
|
117
|
+
url: 'lido',
|
|
118
|
+
address: '0xa9Dd188591A6F0C92bD1dC3A461a64c188694FB3',
|
|
119
|
+
hubs: [
|
|
120
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
121
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
122
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
123
|
+
],
|
|
124
|
+
});
|
|
125
|
+
export const AAVE_V4_LOMBARD_BTC_SPOKE = (networkId) => ({
|
|
126
|
+
chainIds: [NetworkNumber.Eth],
|
|
127
|
+
label: 'Lombard BTC Spoke',
|
|
128
|
+
value: AaveV4SpokesType.AaveV4LombardBtcSpoke,
|
|
129
|
+
url: 'lombard-btc',
|
|
130
|
+
address: '0xc78F5e5566C9Bde0C531fC8c7F5dC5954daFcA9e',
|
|
131
|
+
hubs: [
|
|
132
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
133
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
134
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
export const AAVE_V4_MAIN_SPOKE = (networkId) => ({
|
|
138
|
+
chainIds: [NetworkNumber.Eth],
|
|
139
|
+
label: 'Main Spoke',
|
|
140
|
+
value: AaveV4SpokesType.AaveV4MainSpoke,
|
|
141
|
+
url: 'main',
|
|
142
|
+
address: '0x6488A415e9eA693EC7Ef32579507e1907c0AC798',
|
|
143
|
+
hubs: [
|
|
144
|
+
AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
|
|
145
|
+
AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
|
|
146
|
+
AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
|
|
147
|
+
],
|
|
148
|
+
});
|
|
149
|
+
export const AaveV4Spokes = (networkId) => ({
|
|
150
|
+
[AaveV4SpokesType.AaveV4BluechipSpoke]: AAVE_V4_BLUECHIP_SPOKE(networkId),
|
|
151
|
+
[AaveV4SpokesType.AaveV4EthenaCorrelatedSpoke]: AAVE_V4_ETHENA_CORRELATED_SPOKE(networkId),
|
|
152
|
+
[AaveV4SpokesType.AaveV4EthenaEcosystemSpoke]: AAVE_V4_ETHENA_ECOSYSTEM_SPOKE(networkId),
|
|
153
|
+
[AaveV4SpokesType.AaveV4EtherfiSpoke]: AAVE_V4_ETHERFI_SPOKE(networkId),
|
|
154
|
+
[AaveV4SpokesType.AaveV4ForexSpoke]: AAVE_V4_FOREX_SPOKE(networkId),
|
|
155
|
+
[AaveV4SpokesType.AaveV4GoldSpoke]: AAVE_V4_GOLD_SPOKE(networkId),
|
|
156
|
+
[AaveV4SpokesType.AaveV4KelpSpoke]: AAVE_V4_KELP_SPOKE(networkId),
|
|
157
|
+
[AaveV4SpokesType.AaveV4LidoSpoke]: AAVE_V4_LIDO_SPOKE(networkId),
|
|
158
|
+
[AaveV4SpokesType.AaveV4LombardBtcSpoke]: AAVE_V4_LOMBARD_BTC_SPOKE(networkId),
|
|
159
|
+
[AaveV4SpokesType.AaveV4MainSpoke]: AAVE_V4_MAIN_SPOKE(networkId),
|
|
160
|
+
});
|
|
161
|
+
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';
|
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_1, network_1, defaultProvider_1, addresses_1) {
|
|
38
39
|
return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
|
|
39
40
|
const isMainnet = network === NetworkNumber.Eth;
|
|
@@ -50,6 +51,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
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 args = [network, { batch: { multicall: { batchSize: isSim ? 500000 : 2500000 } } }];
|
|
54
56
|
const client = getViemProvider(provider, ...args);
|
|
55
57
|
const defaultClient = getViemProvider(defaultProvider, ...args);
|
|
@@ -64,6 +66,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
64
66
|
const crvUsdMarketsData = {};
|
|
65
67
|
const llamaLendMarketsData = {};
|
|
66
68
|
const liquityV2MarketsData = {};
|
|
69
|
+
const aaveV4SpokesData = {};
|
|
67
70
|
const markets = {
|
|
68
71
|
morphoMarketsData,
|
|
69
72
|
compoundV3MarketsData,
|
|
@@ -75,6 +78,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
75
78
|
crvUsdMarketsData,
|
|
76
79
|
llamaLendMarketsData,
|
|
77
80
|
liquityV2MarketsData,
|
|
81
|
+
aaveV4SpokesData,
|
|
78
82
|
};
|
|
79
83
|
const positions = {};
|
|
80
84
|
const stakingPositions = {};
|
|
@@ -83,6 +87,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
83
87
|
for (const address of allAddresses) {
|
|
84
88
|
positions[address.toLowerCase()] = {
|
|
85
89
|
aaveV3: {},
|
|
90
|
+
aaveV4: {},
|
|
86
91
|
morphoBlue: {},
|
|
87
92
|
compoundV3: {},
|
|
88
93
|
spark: {},
|
|
@@ -148,6 +153,10 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
148
153
|
const marketData = yield _getAaveV3MarketData(client, network, market);
|
|
149
154
|
aaveV3MarketsData[market.value] = marketData;
|
|
150
155
|
})),
|
|
156
|
+
...aaveV4Spokes.map((spoke) => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
const spokeData = yield _getAaveV4SpokeData(client, network, spoke);
|
|
158
|
+
aaveV4SpokesData[spoke.value] = spokeData;
|
|
159
|
+
})),
|
|
151
160
|
...aaveV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
152
161
|
const marketData = yield _getAaveV2MarketsData(client, network, market);
|
|
153
162
|
aaveV2MarketsData[market.value] = marketData;
|
|
@@ -417,6 +426,17 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
417
426
|
positions[address.toLowerCase()].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
418
427
|
}
|
|
419
428
|
}))).flat(),
|
|
429
|
+
...aaveV4Spokes.map((spoke) => allAddresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
430
|
+
try {
|
|
431
|
+
const accData = yield _getAaveV4AccountData(client, network, aaveV4SpokesData[spoke.value], address);
|
|
432
|
+
if (new Dec(accData.suppliedUsd).gt(0))
|
|
433
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: '', data: accData };
|
|
434
|
+
}
|
|
435
|
+
catch (error) {
|
|
436
|
+
console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
|
|
437
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
|
|
438
|
+
}
|
|
439
|
+
}))).flat(),
|
|
420
440
|
...morphoMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
421
441
|
try {
|
|
422
442
|
const [accDataPromise, earnDataPromise] = yield Promise.allSettled([
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
|
|
2
|
+
export declare enum AaveV4HubsType {
|
|
3
|
+
AaveV4CoreHub = "aave_v4_core_hub",
|
|
4
|
+
AaveV4PlusHub = "aave_v4_plus_hub",
|
|
5
|
+
AaveV4PrimeHub = "aave_v4_prime_hub"
|
|
6
|
+
}
|
|
7
|
+
export declare enum AaveV4SpokesType {
|
|
8
|
+
AaveV4BluechipSpoke = "aave_v4_bluechip_spoke",
|
|
9
|
+
AaveV4EthenaCorrelatedSpoke = "aave_v4_ethena_correlated_spoke",
|
|
10
|
+
AaveV4EthenaEcosystemSpoke = "aave_v4_ethena_ecosystem_spoke",
|
|
11
|
+
AaveV4EtherfiSpoke = "aave_v4_etherfi_spoke",
|
|
12
|
+
AaveV4ForexSpoke = "aave_v4_forex_spoke",
|
|
13
|
+
AaveV4GoldSpoke = "aave_v4_gold_spoke",
|
|
14
|
+
AaveV4KelpSpoke = "aave_v4_kelp_spoke",
|
|
15
|
+
AaveV4LidoSpoke = "aave_v4_lido_spoke",
|
|
16
|
+
AaveV4LombardBtcSpoke = "aave_v4_lombard_btc_spoke",
|
|
17
|
+
AaveV4MainSpoke = "aave_v4_main_spoke"
|
|
18
|
+
}
|
|
19
|
+
export interface AaveV4HubInfo {
|
|
20
|
+
chainIds: NetworkNumber[];
|
|
21
|
+
label: string;
|
|
22
|
+
value: AaveV4HubsType;
|
|
23
|
+
address: EthAddress;
|
|
24
|
+
}
|
|
25
|
+
export interface AaveV4HubAssetOnChainData {
|
|
26
|
+
assetId: number;
|
|
27
|
+
drawnRate: bigint;
|
|
28
|
+
liquidity: bigint;
|
|
29
|
+
liquidityFee: number;
|
|
30
|
+
swept: bigint;
|
|
31
|
+
totalDrawn: bigint;
|
|
32
|
+
totalDrawnShares: bigint;
|
|
33
|
+
totalPremiumShares: bigint;
|
|
34
|
+
}
|
|
35
|
+
export interface AaveV4HubOnChainData {
|
|
36
|
+
assets: Record<number, AaveV4HubAssetOnChainData>;
|
|
37
|
+
}
|
|
38
|
+
export interface AaveV4SpokeInfo {
|
|
39
|
+
chainIds: NetworkNumber[];
|
|
40
|
+
label: string;
|
|
41
|
+
value: AaveV4SpokesType;
|
|
42
|
+
url: string;
|
|
43
|
+
address: EthAddress;
|
|
44
|
+
hubs: EthAddress[];
|
|
45
|
+
}
|
|
46
|
+
export interface AaveV4SpokeData {
|
|
47
|
+
assetsData: AaveV4AssetsData;
|
|
48
|
+
oracle: EthAddress;
|
|
49
|
+
oracleDecimals: number;
|
|
50
|
+
address: EthAddress;
|
|
51
|
+
}
|
|
52
|
+
export interface AaveV4ReserveAssetOnChain {
|
|
53
|
+
underlying: EthAddress;
|
|
54
|
+
hub: EthAddress;
|
|
55
|
+
assetId: number;
|
|
56
|
+
decimals: number;
|
|
57
|
+
paused: boolean;
|
|
58
|
+
frozen: boolean;
|
|
59
|
+
borrowable: boolean;
|
|
60
|
+
collateralRisk: number;
|
|
61
|
+
collateralFactor: number;
|
|
62
|
+
maxLiquidationBonus: number;
|
|
63
|
+
liquidationFee: number;
|
|
64
|
+
price: bigint;
|
|
65
|
+
totalSupplied: bigint;
|
|
66
|
+
totalDrawn: bigint;
|
|
67
|
+
totalPremium: bigint;
|
|
68
|
+
totalDebt: bigint;
|
|
69
|
+
supplyCap: bigint;
|
|
70
|
+
borrowCap: bigint;
|
|
71
|
+
deficitRay: bigint;
|
|
72
|
+
spokeActive: boolean;
|
|
73
|
+
spokeHalted: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface AaveV4ReserveAssetData {
|
|
76
|
+
symbol: string;
|
|
77
|
+
underlying: EthAddress;
|
|
78
|
+
hub: EthAddress;
|
|
79
|
+
hubName: string;
|
|
80
|
+
assetId: number;
|
|
81
|
+
reserveId: number;
|
|
82
|
+
paused: boolean;
|
|
83
|
+
frozen: boolean;
|
|
84
|
+
borrowable: boolean;
|
|
85
|
+
collateralRisk: number;
|
|
86
|
+
collateralFactor: number;
|
|
87
|
+
liquidationFee: number;
|
|
88
|
+
price: string;
|
|
89
|
+
totalSupplied: string;
|
|
90
|
+
totalDrawn: string;
|
|
91
|
+
totalPremium: string;
|
|
92
|
+
totalDebt: string;
|
|
93
|
+
supplyCap: string;
|
|
94
|
+
borrowCap: string;
|
|
95
|
+
spokeActive: boolean;
|
|
96
|
+
spokeHalted: boolean;
|
|
97
|
+
drawnRate: string;
|
|
98
|
+
supplyRate: string;
|
|
99
|
+
borrowRate: string;
|
|
100
|
+
supplyIncentives: IncentiveData[];
|
|
101
|
+
borrowIncentives: IncentiveData[];
|
|
102
|
+
canBeBorrowed: boolean;
|
|
103
|
+
canBeSupplied: boolean;
|
|
104
|
+
canBeWithdrawn: boolean;
|
|
105
|
+
canBePayBacked: boolean;
|
|
106
|
+
utilization: string;
|
|
107
|
+
}
|
|
108
|
+
export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
|
|
109
|
+
export interface AaveV4UsedReserveAsset {
|
|
110
|
+
symbol: string;
|
|
111
|
+
hubName: string;
|
|
112
|
+
assetId: number;
|
|
113
|
+
reserveId: number;
|
|
114
|
+
supplied: string;
|
|
115
|
+
suppliedUsd: string;
|
|
116
|
+
drawn: string;
|
|
117
|
+
drawnUsd: string;
|
|
118
|
+
premium: string;
|
|
119
|
+
premiumUsd: string;
|
|
120
|
+
borrowed: string;
|
|
121
|
+
borrowedUsd: string;
|
|
122
|
+
isSupplied: boolean;
|
|
123
|
+
isBorrowed: boolean;
|
|
124
|
+
collateral: boolean;
|
|
125
|
+
collateralFactor: number;
|
|
126
|
+
}
|
|
127
|
+
export interface AaveV4AggregatedPositionData {
|
|
128
|
+
suppliedUsd: string;
|
|
129
|
+
suppliedCollateralUsd: string;
|
|
130
|
+
borrowLimitUsd: string;
|
|
131
|
+
liquidationLimitUsd: string;
|
|
132
|
+
borrowedUsd: string;
|
|
133
|
+
drawnUsd: string;
|
|
134
|
+
premiumUsd: string;
|
|
135
|
+
leftToBorrowUsd: string;
|
|
136
|
+
ratio: string;
|
|
137
|
+
collRatio: string;
|
|
138
|
+
liqRatio: string;
|
|
139
|
+
liqPercent: string;
|
|
140
|
+
leveragedType: LeverageType;
|
|
141
|
+
leveragedAsset: string;
|
|
142
|
+
liquidationPrice: string;
|
|
143
|
+
minCollRatio: string;
|
|
144
|
+
collLiquidationRatio: string;
|
|
145
|
+
minHealthRatio: string;
|
|
146
|
+
netApy: string;
|
|
147
|
+
incentiveUsd: string;
|
|
148
|
+
totalInterestUsd: string;
|
|
149
|
+
currentVolatilePairRatio?: string;
|
|
150
|
+
}
|
|
151
|
+
export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
|
|
152
|
+
export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
|
|
153
|
+
usedAssets: AaveV4UsedReserveAssets;
|
|
154
|
+
healthFactor: string;
|
|
155
|
+
riskPremiumBps: number;
|
|
156
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var AaveV4HubsType;
|
|
2
|
+
(function (AaveV4HubsType) {
|
|
3
|
+
AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
|
|
4
|
+
AaveV4HubsType["AaveV4PlusHub"] = "aave_v4_plus_hub";
|
|
5
|
+
AaveV4HubsType["AaveV4PrimeHub"] = "aave_v4_prime_hub";
|
|
6
|
+
})(AaveV4HubsType || (AaveV4HubsType = {}));
|
|
7
|
+
export var AaveV4SpokesType;
|
|
8
|
+
(function (AaveV4SpokesType) {
|
|
9
|
+
AaveV4SpokesType["AaveV4BluechipSpoke"] = "aave_v4_bluechip_spoke";
|
|
10
|
+
AaveV4SpokesType["AaveV4EthenaCorrelatedSpoke"] = "aave_v4_ethena_correlated_spoke";
|
|
11
|
+
AaveV4SpokesType["AaveV4EthenaEcosystemSpoke"] = "aave_v4_ethena_ecosystem_spoke";
|
|
12
|
+
AaveV4SpokesType["AaveV4EtherfiSpoke"] = "aave_v4_etherfi_spoke";
|
|
13
|
+
AaveV4SpokesType["AaveV4ForexSpoke"] = "aave_v4_forex_spoke";
|
|
14
|
+
AaveV4SpokesType["AaveV4GoldSpoke"] = "aave_v4_gold_spoke";
|
|
15
|
+
AaveV4SpokesType["AaveV4KelpSpoke"] = "aave_v4_kelp_spoke";
|
|
16
|
+
AaveV4SpokesType["AaveV4LidoSpoke"] = "aave_v4_lido_spoke";
|
|
17
|
+
AaveV4SpokesType["AaveV4LombardBtcSpoke"] = "aave_v4_lombard_btc_spoke";
|
|
18
|
+
AaveV4SpokesType["AaveV4MainSpoke"] = "aave_v4_main_spoke";
|
|
19
|
+
})(AaveV4SpokesType || (AaveV4SpokesType = {}));
|
package/esm/types/index.d.ts
CHANGED
package/esm/types/index.js
CHANGED
package/esm/types/portfolio.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AaveV2PositionData, AaveV3PositionData, AaveVersions } from './aave';
|
|
2
|
+
import { AaveV4AccountData, AaveV4SpokesType } from './aaveV4';
|
|
2
3
|
import { EthAddress } from './common';
|
|
3
4
|
import { CompoundV2PositionData, CompoundV3PositionData, CompoundVersions } from './compound';
|
|
4
5
|
import { CrvUSDUserData, CrvUSDVersions } from './curveUsd';
|
|
@@ -51,6 +52,9 @@ export interface PortfolioPositionsDataForAddress {
|
|
|
51
52
|
[key: string]: FluidVaultData;
|
|
52
53
|
};
|
|
53
54
|
};
|
|
55
|
+
aaveV4: {
|
|
56
|
+
[key in AaveV4SpokesType]?: PortfolioProtocolData<AaveV4AccountData>;
|
|
57
|
+
};
|
|
54
58
|
}
|
|
55
59
|
export interface PortfolioPositionsData {
|
|
56
60
|
[key: EthAddress]: PortfolioPositionsDataForAddress;
|