@defisaver/positions-sdk 2.1.71 → 2.1.72-aave-v4-3-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.
Files changed (78) hide show
  1. package/cjs/aaveV4/index.d.ts +7 -0
  2. package/cjs/aaveV4/index.js +293 -0
  3. package/cjs/aaveV4/lend.d.ts +45 -0
  4. package/cjs/aaveV4/lend.js +141 -0
  5. package/cjs/config/contracts.d.ts +1551 -0
  6. package/cjs/config/contracts.js +9 -0
  7. package/cjs/contracts.d.ts +32741 -0
  8. package/cjs/contracts.js +2 -1
  9. package/cjs/helpers/aaveV4Helpers/index.d.ts +12 -0
  10. package/cjs/helpers/aaveV4Helpers/index.js +117 -0
  11. package/cjs/helpers/index.d.ts +1 -0
  12. package/cjs/helpers/index.js +2 -1
  13. package/cjs/index.d.ts +2 -1
  14. package/cjs/index.js +3 -1
  15. package/cjs/markets/aave/marketAssets.js +1 -1
  16. package/cjs/markets/aaveV4/index.d.ts +28 -0
  17. package/cjs/markets/aaveV4/index.js +140 -0
  18. package/cjs/markets/index.d.ts +1 -0
  19. package/cjs/markets/index.js +3 -1
  20. package/cjs/portfolio/index.js +20 -0
  21. package/cjs/staking/eligibility.d.ts +6 -0
  22. package/cjs/staking/eligibility.js +37 -19
  23. package/cjs/staking/staking.js +4 -2
  24. package/cjs/types/aaveV4.d.ts +153 -0
  25. package/cjs/types/aaveV4.js +19 -0
  26. package/cjs/types/common.d.ts +2 -1
  27. package/cjs/types/common.js +1 -0
  28. package/cjs/types/index.d.ts +1 -0
  29. package/cjs/types/index.js +1 -0
  30. package/cjs/types/portfolio.d.ts +4 -0
  31. package/esm/aaveV4/index.d.ts +7 -0
  32. package/esm/aaveV4/index.js +250 -0
  33. package/esm/aaveV4/lend.d.ts +45 -0
  34. package/esm/aaveV4/lend.js +134 -0
  35. package/esm/config/contracts.d.ts +1551 -0
  36. package/esm/config/contracts.js +8 -0
  37. package/esm/contracts.d.ts +32741 -0
  38. package/esm/contracts.js +1 -0
  39. package/esm/helpers/aaveV4Helpers/index.d.ts +12 -0
  40. package/esm/helpers/aaveV4Helpers/index.js +108 -0
  41. package/esm/helpers/index.d.ts +1 -0
  42. package/esm/helpers/index.js +1 -0
  43. package/esm/index.d.ts +2 -1
  44. package/esm/index.js +2 -1
  45. package/esm/markets/aave/marketAssets.js +1 -1
  46. package/esm/markets/aaveV4/index.d.ts +28 -0
  47. package/esm/markets/aaveV4/index.js +122 -0
  48. package/esm/markets/index.d.ts +1 -0
  49. package/esm/markets/index.js +1 -0
  50. package/esm/portfolio/index.js +21 -1
  51. package/esm/staking/eligibility.d.ts +6 -0
  52. package/esm/staking/eligibility.js +35 -18
  53. package/esm/staking/staking.js +4 -2
  54. package/esm/types/aaveV4.d.ts +153 -0
  55. package/esm/types/aaveV4.js +16 -0
  56. package/esm/types/common.d.ts +2 -1
  57. package/esm/types/common.js +1 -0
  58. package/esm/types/index.d.ts +1 -0
  59. package/esm/types/index.js +1 -0
  60. package/esm/types/portfolio.d.ts +4 -0
  61. package/package.json +2 -2
  62. package/src/aaveV4/index.ts +286 -0
  63. package/src/aaveV4/lend.ts +180 -0
  64. package/src/config/contracts.ts +9 -1
  65. package/src/contracts.ts +3 -1
  66. package/src/helpers/aaveV4Helpers/index.ts +133 -0
  67. package/src/helpers/index.ts +1 -0
  68. package/src/index.ts +2 -0
  69. package/src/markets/aave/marketAssets.ts +1 -1
  70. package/src/markets/aaveV4/index.ts +149 -0
  71. package/src/markets/index.ts +6 -1
  72. package/src/portfolio/index.ts +20 -0
  73. package/src/staking/eligibility.ts +67 -15
  74. package/src/staking/staking.ts +3 -2
  75. package/src/types/aaveV4.ts +169 -0
  76. package/src/types/common.ts +1 -0
  77. package/src/types/index.ts +2 -1
  78. package/src/types/portfolio.ts +4 -0
@@ -2,6 +2,7 @@ import Dec from 'decimal.js';
2
2
  import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
3
3
  import {
4
4
  AaveMarkets,
5
+ AaveV4Spokes,
5
6
  CompoundMarkets,
6
7
  CrvUsdMarkets,
7
8
  EulerV2Markets,
@@ -14,6 +15,7 @@ import { _getMorphoBlueAccountData, _getMorphoBlueMarketData, getMorphoEarn } fr
14
15
  import {
15
16
  AaveV2MarketData,
16
17
  AaveV3MarketData,
18
+ AaveV4SpokeData,
17
19
  AaveVersions,
18
20
  CdpInfo,
19
21
  CompoundV2MarketsData,
@@ -49,6 +51,7 @@ import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
49
51
  import { fetchMorphoBlueRewards } from '../claiming/morphoBlue';
50
52
  import { getKingRewards } from '../claiming/king';
51
53
  import { fetchEthenaAirdropRewards } from '../claiming/ethena';
54
+ import { _getAaveV4AccountData, _getAaveV4SpokeData } from '../aaveV4';
52
55
 
53
56
  export async function getPortfolioData(provider: EthereumProvider, network: NetworkNumber, defaultProvider: EthereumProvider, addresses: EthAddress[], isSim = false): Promise<{
54
57
  positions: PortfolioPositionsData;
@@ -71,6 +74,7 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
71
74
  const llamaLendMarkets = [NetworkNumber.Eth, NetworkNumber.Arb].includes(network) ? Object.values(LlamaLendMarkets(network)).filter((market) => market.chainIds.includes(network)) : [];
72
75
  const liquityV2Markets = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)) : [];
73
76
  const liquityV2MarketsStaking = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)).filter(market => !market.isLegacy) : [];
77
+ const aaveV4Spokes = Object.values(AaveV4Spokes(network)).filter((market) => market.chainIds.includes(network));
74
78
 
75
79
  const args: [NetworkNumber, any?] = [network, { batch: { multicall: { batchSize: isSim ? 500_000 : 2_500_000 } } }];
76
80
  const client = getViemProvider(provider, ...args);
@@ -87,6 +91,7 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
87
91
  const crvUsdMarketsData: Record<string, CrvUSDGlobalMarketData> = {};
88
92
  const llamaLendMarketsData: Record<string, LlamaLendGlobalMarketData> = {};
89
93
  const liquityV2MarketsData: Record<string, LiquityV2MarketData> = {};
94
+ const aaveV4SpokesData: Record<string, AaveV4SpokeData> = {};
90
95
 
91
96
  const markets = {
92
97
  morphoMarketsData,
@@ -99,6 +104,7 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
99
104
  crvUsdMarketsData,
100
105
  llamaLendMarketsData,
101
106
  liquityV2MarketsData,
107
+ aaveV4SpokesData,
102
108
  };
103
109
 
104
110
  const positions: PortfolioPositionsData = {};
@@ -109,6 +115,7 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
109
115
  for (const address of allAddresses) {
110
116
  positions[address.toLowerCase() as EthAddress] = {
111
117
  aaveV3: {},
118
+ aaveV4: {},
112
119
  morphoBlue: {},
113
120
  compoundV3: {},
114
121
  spark: {},
@@ -177,6 +184,10 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
177
184
  const marketData = await _getAaveV3MarketData(client, network, market);
178
185
  aaveV3MarketsData[market.value] = marketData;
179
186
  }),
187
+ ...aaveV4Spokes.map(async (spoke) => {
188
+ const spokeData = await _getAaveV4SpokeData(client, network, spoke);
189
+ aaveV4SpokesData[spoke.value] = spokeData;
190
+ }),
180
191
  ...aaveV2Markets.map(async (market) => {
181
192
  const marketData = await _getAaveV2MarketsData(client, network, market);
182
193
  aaveV2MarketsData[market.value] = marketData;
@@ -429,6 +440,15 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
429
440
  positions[address.toLowerCase() as EthAddress].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
430
441
  }
431
442
  })).flat(),
443
+ ...aaveV4Spokes.map((spoke) => allAddresses.map(async (address) => {
444
+ try {
445
+ const accData = await _getAaveV4AccountData(client, network, aaveV4SpokesData[spoke.value], address);
446
+ if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].aaveV4[spoke.value] = { error: '', data: accData };
447
+ } catch (error) {
448
+ console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
449
+ positions[address.toLowerCase() as EthAddress].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
450
+ }
451
+ })).flat(),
432
452
  ...morphoMarkets.map((market) => addresses.map(async (address) => {
433
453
  try {
434
454
  const [accDataPromise, earnDataPromise] = await Promise.allSettled([
@@ -1,29 +1,80 @@
1
1
  import Dec from 'decimal.js';
2
2
  import { IncentiveEligibilityId, MMUsedAssets } from '../types/common';
3
3
 
4
- export const isEligibleForEthenaUSDeRewards = (usedAssets: MMUsedAssets, { healthRatio }: { healthRatio: string }) => {
5
- const USDeUSDAmountSupplied = usedAssets.USDe?.suppliedUsd || '0';
6
- const sUSDeUSDAmountSupplied = usedAssets.sUSDe?.suppliedUsd || '0';
7
- const anythingElseSupplied = Object.values(usedAssets).some((asset) => asset.symbol !== 'USDe' && asset.symbol !== 'sUSDe' && asset.isSupplied);
4
+ type EthenaPairEligibilityConfig = {
5
+ baseSymbol: string;
6
+ pairSymbol: string;
7
+ allowedBorrowAssets: string[];
8
+ maxHealthRatio: string; // exclusive upper bound
9
+ rewardSymbol: string;
10
+ };
11
+
12
+ const isEligibleForEthenaPairRewards = (
13
+ usedAssets: MMUsedAssets,
14
+ { healthRatio }: { healthRatio: string },
15
+ {
16
+ baseSymbol,
17
+ pairSymbol,
18
+ allowedBorrowAssets,
19
+ maxHealthRatio,
20
+ rewardSymbol,
21
+ }: EthenaPairEligibilityConfig,
22
+ ) => {
23
+ const baseSuppliedUsd = usedAssets[baseSymbol]?.suppliedUsd || '0';
24
+ const pairSuppliedUsd = usedAssets[pairSymbol]?.suppliedUsd || '0';
25
+
26
+ const anythingElseSupplied = Object.values(usedAssets).some(
27
+ (asset) => asset.isSupplied && asset.symbol !== baseSymbol && asset.symbol !== pairSymbol,
28
+ );
8
29
  if (anythingElseSupplied) return { isEligible: false, eligibleUSDAmount: '0' };
9
- const totalAmountSupplied = new Dec(USDeUSDAmountSupplied).add(sUSDeUSDAmountSupplied).toString();
10
- const percentageInUSDe = new Dec(USDeUSDAmountSupplied).div(totalAmountSupplied).toNumber();
11
- if (percentageInUSDe < 0.45 || percentageInUSDe > 0.55) return { isEligible: false, eligibleUSDAmount: '0' }; // 45% - 55% of total amount supplied must be in USDe
12
- const percentageInSUSDe = new Dec(sUSDeUSDAmountSupplied).div(totalAmountSupplied).toNumber();
13
- if (percentageInSUSDe < 0.45 || percentageInSUSDe > 0.55) return { isEligible: false, eligibleUSDAmount: '0' }; // 45% - 55% of total amount supplied must be in sUSDe
14
30
 
15
- const allowedBorrowAssets = ['USDC', 'USDT', 'USDS'];
16
- const anythingBorrowedNotAllowed = Object.values(usedAssets).some((asset) => asset.isBorrowed && !allowedBorrowAssets.includes(asset.symbol));
31
+ const totalAmountSupplied = new Dec(baseSuppliedUsd).add(pairSuppliedUsd);
32
+ if (totalAmountSupplied.eq(0)) return { isEligible: false, eligibleUSDAmount: '0' };
33
+
34
+ const percentageInBase = new Dec(baseSuppliedUsd).div(totalAmountSupplied).toNumber();
35
+ if (percentageInBase < 0.45 || percentageInBase > 0.55) return { isEligible: false, eligibleUSDAmount: '0' };
36
+
37
+ const percentageInPair = new Dec(pairSuppliedUsd).div(totalAmountSupplied).toNumber();
38
+ if (percentageInPair < 0.45 || percentageInPair > 0.55) return { isEligible: false, eligibleUSDAmount: '0' };
39
+
40
+ const anythingBorrowedNotAllowed = Object.values(usedAssets).some(
41
+ (asset) => asset.isBorrowed && !allowedBorrowAssets.includes(asset.symbol),
42
+ );
17
43
  if (anythingBorrowedNotAllowed) return { isEligible: false, eligibleUSDAmount: '0' };
18
44
 
19
- if (new Dec(healthRatio).gte(2.5)) return { isEligible: false, eligibleUSDAmount: '0' }; // health ratio must be below 2.5
45
+ if (new Dec(healthRatio).gte(maxHealthRatio)) return { isEligible: false, eligibleUSDAmount: '0' };
20
46
 
21
- const halfAmountSupplied = new Dec(totalAmountSupplied).div(2).toString();
22
- const USDeAmountEligibleForRewards = Dec.min(USDeUSDAmountSupplied, halfAmountSupplied).toString(); // rewards are given to amount of USDe supplied up to half of total amount supplied
47
+ const halfAmountSupplied = totalAmountSupplied.div(2);
48
+ const rewardSuppliedUsd = usedAssets[rewardSymbol]?.suppliedUsd || '0';
49
+ const eligibleUSDAmount = Dec.min(rewardSuppliedUsd, halfAmountSupplied).toString();
23
50
 
24
- return { isEligible: true, eligibleUSDAmount: USDeAmountEligibleForRewards };
51
+ return { isEligible: true, eligibleUSDAmount };
25
52
  };
26
53
 
54
+ export const isEligibleForEthenaUSDeRewards = (usedAssets: MMUsedAssets, { healthRatio }: { healthRatio: string }) => isEligibleForEthenaPairRewards(
55
+ usedAssets,
56
+ { healthRatio },
57
+ {
58
+ baseSymbol: 'USDe',
59
+ pairSymbol: 'sUSDe',
60
+ allowedBorrowAssets: ['USDC', 'USDT', 'USDS'],
61
+ maxHealthRatio: '2.5',
62
+ rewardSymbol: 'USDe',
63
+ },
64
+ );
65
+
66
+ export const isEligibleForEthenaGHORewards = (usedAssets: MMUsedAssets, { healthRatio }: { healthRatio: string }) => isEligibleForEthenaPairRewards(
67
+ usedAssets,
68
+ { healthRatio },
69
+ {
70
+ baseSymbol: 'syrupUSDT',
71
+ pairSymbol: 'GHO',
72
+ allowedBorrowAssets: ['USDT'],
73
+ maxHealthRatio: '2',
74
+ rewardSymbol: 'GHO',
75
+ },
76
+ );
77
+
27
78
  export const isEligibleForAaveV3ArbitrumEthSupply = (usedAssets: MMUsedAssets) => {
28
79
  const ETHAmountSupplied = usedAssets.ETH?.suppliedUsd || '0';
29
80
  const ETHAmountBorrowed = usedAssets.ETH?.borrowedUsd || '0';
@@ -51,4 +102,5 @@ export const EligibilityMapping: { [key in IncentiveEligibilityId]: (usedAssets:
51
102
  [IncentiveEligibilityId.AaveV3ArbitrumEthSupply]: isEligibleForAaveV3ArbitrumEthSupply,
52
103
  [IncentiveEligibilityId.AaveV3ArbitrumETHLSBorrow]: isEligibleForAaveV3ArbitrumETHLSBorrow,
53
104
  [IncentiveEligibilityId.AaveV3EthenaLiquidLeveragePlasma]: isEligibleForEthenaUSDeRewards,
105
+ [IncentiveEligibilityId.AaveV3EthenaLiquidLeveragePlasmaGHO]: isEligibleForEthenaGHORewards,
54
106
  };
@@ -64,7 +64,7 @@ export const STAKING_ASSETS = [
64
64
  'cbETH', 'wstETH', 'cbETH', 'rETH', 'sDAI', 'weETH', 'sUSDe', 'osETH',
65
65
  'ezETH', 'ETHx', 'rsETH', 'pufETH', 'wrsETH', 'wsuperOETHb', 'sUSDS', 'tETH', 'PT sUSDe Sep', 'PT USDe Sep',
66
66
  'PT sUSDe Nov', 'PT USDe Nov', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'syrupUSDC', 'wstUSR',
67
- 'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr',
67
+ 'PT sUSDe Feb', 'PT USDe Feb', 'PT sUSDe Apr', 'PT USDe Apr', 'PT sUSDe May', 'PT USDe May', 'PT srUSDe Apr', 'GHO',
68
68
  ];
69
69
 
70
70
  export const getStakingApy = memoize(async (asset: string, network: number = NetworkNumber.Eth) => {
@@ -89,7 +89,7 @@ export const getStakingApy = memoize(async (asset: string, network: number = Net
89
89
  if (asset === 'PT sUSDe Sep') return await getApyFromDfsApi('PT sUSDe Sep', network);
90
90
  if (asset === 'PT USDe Sep') return await getApyFromDfsApi('PT USDe Sep', network);
91
91
  if (asset === 'tETH') return await getApyFromDfsApi('tETH');
92
- if (asset === 'USDe') return await getApyFromDfsApi('USDe');
92
+ if (asset === 'USDe') return await getApyFromDfsApi('USDe', network);
93
93
  if (asset === 'PT sUSDe Nov') return await getApyFromDfsApi('PT sUSDe Nov', network);
94
94
  if (asset === 'PT USDe Nov') return await getApyFromDfsApi('PT USDe Nov', network);
95
95
  if (asset === 'PT USDe Jan') return await getApyFromDfsApi('PT USDe Jan', network);
@@ -104,6 +104,7 @@ export const getStakingApy = memoize(async (asset: string, network: number = Net
104
104
  if (asset === 'PT sUSDe May') return await getApyFromDfsApi('PT sUSDe May', network);
105
105
  if (asset === 'PT USDe May') return await getApyFromDfsApi('PT USDe May', network);
106
106
  if (asset === 'PT srUSDe Apr') return await getApyFromDfsApi('PT srUSDe Apr', network);
107
+ if (asset === 'GHO') return await getApyFromDfsApi('GHO', network);
107
108
  } catch (e) {
108
109
  console.error(`Failed to fetch APY for ${asset}`);
109
110
  }
@@ -0,0 +1,169 @@
1
+ import {
2
+ EthAddress, IncentiveData, LeverageType, NetworkNumber,
3
+ } from './common';
4
+
5
+ export enum AaveV4HubsType {
6
+ AaveV4CoreHub = 'aave_v4_core_hub',
7
+ AaveV4PlusHub = 'aave_v4_plus_hub',
8
+ AaveV4PrimeHub = 'aave_v4_prime_hub',
9
+ }
10
+
11
+ export enum AaveV4SpokesType {
12
+ AaveV4BluechipSpoke = 'aave_v4_bluechip_spoke',
13
+ AaveV4EthenaSpoke = 'aave_v4_ethena_spoke',
14
+ AaveV4EtherfiSpoke = 'aave_v4_etherfi_spoke',
15
+ AaveV4GoldSpoke = 'aave_v4_gold_spoke',
16
+ AaveV4KelpSpoke = 'aave_v4_kelp_spoke',
17
+ AaveV4LidoSpoke = 'aave_v4_lido_spoke',
18
+ AaveV4MainSpoke = 'aave_v4_main_spoke',
19
+ }
20
+
21
+ export interface AaveV4HubInfo {
22
+ chainIds: NetworkNumber[],
23
+ label: string,
24
+ value: AaveV4HubsType,
25
+ address: EthAddress,
26
+ }
27
+
28
+ export interface AaveV4HubAssetOnChainData {
29
+ assetId: number,
30
+ drawnRate: bigint,
31
+ liquidity: bigint,
32
+ liquidityFee: number,
33
+ swept: bigint,
34
+ totalDrawn: bigint,
35
+ totalDrawnShares: bigint,
36
+ totalPremiumShares: bigint,
37
+ }
38
+
39
+ export interface AaveV4HubOnChainData {
40
+ assets: Record<number, AaveV4HubAssetOnChainData>,
41
+ }
42
+
43
+ export interface AaveV4SpokeInfo {
44
+ chainIds: NetworkNumber[],
45
+ label: string,
46
+ value: AaveV4SpokesType,
47
+ url: string,
48
+ address: EthAddress,
49
+ hubs: EthAddress[],
50
+ }
51
+
52
+ export interface AaveV4SpokeData {
53
+ assetsData: AaveV4AssetsData,
54
+ oracle: EthAddress,
55
+ oracleDecimals: number,
56
+ address: EthAddress,
57
+ }
58
+
59
+ export interface AaveV4ReserveAssetOnChain {
60
+ underlying: EthAddress,
61
+ hub: EthAddress,
62
+ assetId: number,
63
+ decimals: number,
64
+ paused: boolean,
65
+ frozen: boolean,
66
+ borrowable: boolean,
67
+ collateralRisk: number,
68
+ collateralFactor: number,
69
+ maxLiquidationBonus: number,
70
+ liquidationFee: number,
71
+ price: bigint,
72
+ totalSupplied: bigint,
73
+ totalDrawn: bigint,
74
+ totalPremium: bigint,
75
+ totalDebt: bigint,
76
+ supplyCap: bigint,
77
+ borrowCap: bigint,
78
+ deficitRay: bigint,
79
+ spokeActive: boolean,
80
+ spokeHalted: boolean
81
+ }
82
+
83
+ export interface AaveV4ReserveAssetData {
84
+ symbol: string,
85
+ underlying: EthAddress,
86
+ hub: EthAddress,
87
+ hubName: string,
88
+ assetId: number,
89
+ reserveId: number,
90
+ paused: boolean,
91
+ frozen: boolean,
92
+ borrowable: boolean,
93
+ collateralRisk: number,
94
+ collateralFactor: number,
95
+ liquidationFee: number,
96
+ price: string,
97
+ totalSupplied: string,
98
+ totalDrawn: string,
99
+ totalPremium: string,
100
+ totalDebt: string,
101
+ supplyCap: string,
102
+ borrowCap: string,
103
+ spokeActive: boolean,
104
+ spokeHalted: boolean,
105
+ drawnRate: string,
106
+ supplyRate: string,
107
+ borrowRate: string,
108
+ supplyIncentives: IncentiveData[];
109
+ borrowIncentives: IncentiveData[];
110
+ canBeBorrowed: boolean;
111
+ canBeSupplied: boolean;
112
+ canBeWithdrawn: boolean;
113
+ canBePayBacked: boolean;
114
+ utilization: string;
115
+ }
116
+
117
+ export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
118
+
119
+ export interface AaveV4UsedReserveAsset {
120
+ symbol: string,
121
+ hubName: string,
122
+ assetId: number,
123
+ reserveId: number,
124
+ supplied: string,
125
+ suppliedUsd: string,
126
+ drawn: string,
127
+ drawnUsd: string,
128
+ premium: string,
129
+ premiumUsd: string,
130
+ borrowed: string,
131
+ borrowedUsd: string,
132
+ isSupplied: boolean,
133
+ isBorrowed: boolean,
134
+ collateral: boolean,
135
+ collateralFactor: number,
136
+ }
137
+
138
+ export interface AaveV4AggregatedPositionData {
139
+ suppliedUsd: string,
140
+ suppliedCollateralUsd: string,
141
+ borrowLimitUsd: string,
142
+ liquidationLimitUsd: string,
143
+ borrowedUsd: string,
144
+ drawnUsd: string,
145
+ premiumUsd: string,
146
+ leftToBorrowUsd: string,
147
+ ratio: string,
148
+ collRatio: string,
149
+ liqRatio: string,
150
+ liqPercent: string,
151
+ leveragedType: LeverageType,
152
+ leveragedAsset: string,
153
+ liquidationPrice: string,
154
+ minCollRatio: string,
155
+ collLiquidationRatio: string,
156
+ minHealthRatio: string,
157
+ netApy: string,
158
+ incentiveUsd: string,
159
+ totalInterestUsd: string,
160
+ currentVolatilePairRatio?: string,
161
+ }
162
+
163
+ export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
164
+
165
+ export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
166
+ usedAssets: AaveV4UsedReserveAssets,
167
+ healthFactor: string,
168
+ riskPremiumBps: number,
169
+ }
@@ -8,6 +8,7 @@ export enum IncentiveEligibilityId {
8
8
  AaveV3ArbitrumEthSupply = '0x5d16261c6715a653248269861bbacf68a9774cde',
9
9
  AaveV3ArbitrumETHLSBorrow = '0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351',
10
10
  AaveV3EthenaLiquidLeveragePlasma = '0xeefac321069fbecc9d6b2aed2948f6d5503d8633BORROW_BL',
11
+ AaveV3EthenaLiquidLeveragePlasmaGHO = 'replace_when_known',
11
12
  }
12
13
 
13
14
  export enum LeverageType {
@@ -13,4 +13,5 @@ export * from './portfolio';
13
13
  export * from './merit';
14
14
  export * from './merkl';
15
15
  export * from './savings';
16
- export * from './common';
16
+ export * from './common';
17
+ export * from './aaveV4';
@@ -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';
@@ -54,6 +55,9 @@ export interface PortfolioPositionsDataForAddress {
54
55
  [key: string]: FluidVaultData;
55
56
  };
56
57
  };
58
+ aaveV4: {
59
+ [key in AaveV4SpokesType]?: PortfolioProtocolData<AaveV4AccountData>;
60
+ };
57
61
  }
58
62
 
59
63
  export interface PortfolioPositionsData {