@defisaver/positions-sdk 2.1.51 → 2.1.52-aave-v4-1-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 (121) hide show
  1. package/cjs/aaveV4/index.d.ts +7 -0
  2. package/cjs/aaveV4/index.js +174 -0
  3. package/cjs/config/contracts.d.ts +1277 -0
  4. package/cjs/config/contracts.js +9 -0
  5. package/cjs/contracts.d.ts +23120 -0
  6. package/cjs/contracts.js +2 -1
  7. package/cjs/fluid/index.d.ts +6 -6
  8. package/cjs/helpers/aaveHelpers/index.d.ts +2 -2
  9. package/cjs/helpers/aaveHelpers/index.js +16 -5
  10. package/cjs/helpers/aaveV4Helpers/index.d.ts +13 -0
  11. package/cjs/helpers/aaveV4Helpers/index.js +117 -0
  12. package/cjs/helpers/compoundHelpers/index.js +15 -18
  13. package/cjs/helpers/eulerHelpers/index.d.ts +2 -2
  14. package/cjs/helpers/eulerHelpers/index.js +21 -13
  15. package/cjs/helpers/fluidHelpers/index.js +16 -5
  16. package/cjs/helpers/index.d.ts +1 -0
  17. package/cjs/helpers/index.js +2 -1
  18. package/cjs/helpers/morphoBlueHelpers/index.js +15 -5
  19. package/cjs/helpers/sparkHelpers/index.d.ts +2 -2
  20. package/cjs/helpers/sparkHelpers/index.js +15 -5
  21. package/cjs/index.d.ts +2 -1
  22. package/cjs/index.js +3 -1
  23. package/cjs/markets/aaveV4/index.d.ts +16 -0
  24. package/cjs/markets/aaveV4/index.js +59 -0
  25. package/cjs/markets/index.d.ts +1 -0
  26. package/cjs/markets/index.js +3 -1
  27. package/cjs/moneymarket/moneymarketCommonService.d.ts +3 -3
  28. package/cjs/moneymarket/moneymarketCommonService.js +9 -9
  29. package/cjs/portfolio/index.js +20 -0
  30. package/cjs/types/aave.d.ts +3 -3
  31. package/cjs/types/aaveV4.d.ts +139 -0
  32. package/cjs/types/aaveV4.js +13 -0
  33. package/cjs/types/common.d.ts +8 -1
  34. package/cjs/types/common.js +10 -2
  35. package/cjs/types/compound.d.ts +3 -3
  36. package/cjs/types/curveUsd.d.ts +2 -2
  37. package/cjs/types/euler.d.ts +3 -3
  38. package/cjs/types/fluid.d.ts +3 -3
  39. package/cjs/types/index.d.ts +2 -0
  40. package/cjs/types/index.js +2 -0
  41. package/cjs/types/liquityV2.d.ts +3 -3
  42. package/cjs/types/llamaLend.d.ts +2 -2
  43. package/cjs/types/morphoBlue.d.ts +5 -5
  44. package/cjs/types/portfolio.d.ts +4 -0
  45. package/cjs/types/spark.d.ts +3 -3
  46. package/esm/aaveV4/index.d.ts +7 -0
  47. package/esm/aaveV4/index.js +165 -0
  48. package/esm/config/contracts.d.ts +1277 -0
  49. package/esm/config/contracts.js +8 -0
  50. package/esm/contracts.d.ts +23120 -0
  51. package/esm/contracts.js +1 -0
  52. package/esm/fluid/index.d.ts +6 -6
  53. package/esm/helpers/aaveHelpers/index.d.ts +2 -2
  54. package/esm/helpers/aaveHelpers/index.js +16 -5
  55. package/esm/helpers/aaveV4Helpers/index.d.ts +13 -0
  56. package/esm/helpers/aaveV4Helpers/index.js +108 -0
  57. package/esm/helpers/compoundHelpers/index.js +16 -19
  58. package/esm/helpers/eulerHelpers/index.d.ts +2 -2
  59. package/esm/helpers/eulerHelpers/index.js +21 -13
  60. package/esm/helpers/fluidHelpers/index.js +16 -5
  61. package/esm/helpers/index.d.ts +1 -0
  62. package/esm/helpers/index.js +1 -0
  63. package/esm/helpers/morphoBlueHelpers/index.js +16 -6
  64. package/esm/helpers/sparkHelpers/index.d.ts +2 -2
  65. package/esm/helpers/sparkHelpers/index.js +16 -6
  66. package/esm/index.d.ts +2 -1
  67. package/esm/index.js +2 -1
  68. package/esm/markets/aaveV4/index.d.ts +16 -0
  69. package/esm/markets/aaveV4/index.js +47 -0
  70. package/esm/markets/index.d.ts +1 -0
  71. package/esm/markets/index.js +1 -0
  72. package/esm/moneymarket/moneymarketCommonService.d.ts +3 -3
  73. package/esm/moneymarket/moneymarketCommonService.js +9 -9
  74. package/esm/portfolio/index.js +21 -1
  75. package/esm/types/aave.d.ts +3 -3
  76. package/esm/types/aaveV4.d.ts +139 -0
  77. package/esm/types/aaveV4.js +10 -0
  78. package/esm/types/common.d.ts +8 -1
  79. package/esm/types/common.js +9 -1
  80. package/esm/types/compound.d.ts +3 -3
  81. package/esm/types/curveUsd.d.ts +2 -2
  82. package/esm/types/euler.d.ts +3 -3
  83. package/esm/types/fluid.d.ts +3 -3
  84. package/esm/types/fluid.js +1 -1
  85. package/esm/types/index.d.ts +2 -0
  86. package/esm/types/index.js +2 -0
  87. package/esm/types/liquityV2.d.ts +3 -3
  88. package/esm/types/llamaLend.d.ts +2 -2
  89. package/esm/types/morphoBlue.d.ts +5 -5
  90. package/esm/types/portfolio.d.ts +4 -0
  91. package/esm/types/spark.d.ts +3 -3
  92. package/package.json +1 -1
  93. package/src/aaveV4/index.ts +176 -0
  94. package/src/config/contracts.ts +8 -0
  95. package/src/contracts.ts +3 -1
  96. package/src/helpers/aaveHelpers/index.ts +18 -7
  97. package/src/helpers/aaveV4Helpers/index.ts +128 -0
  98. package/src/helpers/compoundHelpers/index.ts +16 -23
  99. package/src/helpers/eulerHelpers/index.ts +21 -14
  100. package/src/helpers/fluidHelpers/index.ts +15 -6
  101. package/src/helpers/index.ts +1 -0
  102. package/src/helpers/morphoBlueHelpers/index.ts +15 -6
  103. package/src/helpers/sparkHelpers/index.ts +18 -7
  104. package/src/index.ts +2 -0
  105. package/src/markets/aaveV4/index.ts +68 -0
  106. package/src/markets/index.ts +6 -1
  107. package/src/moneymarket/moneymarketCommonService.ts +10 -11
  108. package/src/portfolio/index.ts +20 -0
  109. package/src/types/aave.ts +3 -2
  110. package/src/types/aaveV4.ts +155 -0
  111. package/src/types/common.ts +9 -1
  112. package/src/types/compound.ts +3 -2
  113. package/src/types/curveUsd.ts +2 -2
  114. package/src/types/euler.ts +3 -2
  115. package/src/types/fluid.ts +5 -3
  116. package/src/types/index.ts +3 -1
  117. package/src/types/liquityV2.ts +5 -3
  118. package/src/types/llamaLend.ts +4 -2
  119. package/src/types/morphoBlue.ts +5 -5
  120. package/src/types/portfolio.ts +4 -0
  121. package/src/types/spark.ts +3 -2
@@ -1,5 +1,6 @@
1
1
  import Dec from 'decimal.js';
2
2
  import { BLOCKS_IN_A_YEAR } from '../constants';
3
+ import { LeverageType } from '../types/common';
3
4
  export const getAssetsTotal = (assets, filter, transform) => Object.values(assets)
4
5
  .filter(filter)
5
6
  .map(transform)
@@ -8,9 +9,9 @@ export const getAssetsTotal = (assets, filter, transform) => Object.values(asset
8
9
  export const calcLongLiqPrice = (assetPrice, borrowedUsd, borrowLimitUsd) => new Dec(assetPrice).mul(borrowedUsd).div(borrowLimitUsd).toString();
9
10
  export const calcShortLiqPrice = (assetPrice, borrowedUsd, borrowLimitUsd) => new Dec(assetPrice).div(borrowedUsd).mul(borrowLimitUsd).toString();
10
11
  export const calcLeverageLiqPrice = (leverageType, assetPrice, borrowedUsd, borrowLimitUsd) => {
11
- if (leverageType === 'short')
12
+ if (leverageType === LeverageType.Short || leverageType === LeverageType.VolatilePairReverse)
12
13
  return calcShortLiqPrice(assetPrice, borrowedUsd, borrowLimitUsd);
13
- if (leverageType === 'long' || leverageType === 'lsd-leverage')
14
+ if (leverageType === LeverageType.Long || leverageType === LeverageType.VolatilePair)
14
15
  return calcLongLiqPrice(assetPrice, borrowedUsd, borrowLimitUsd);
15
16
  console.error('invalid leverageType', leverageType);
16
17
  return '0';
@@ -47,28 +48,27 @@ export const isLeveragedPos = (usedAssets, dustLimit = 5) => {
47
48
  });
48
49
  const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
49
50
  const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
50
- // lsd -> liquid staking derivative
51
- const isLsdLeveraged = supplyUnstable === 1 && borrowUnstable === 1 && shortAsset === 'ETH' && ['stETH', 'wstETH', 'cbETH', 'rETH', 'ezETH', 'weETH'].includes(longAsset);
51
+ const isVolatilePair = supplyUnstable === 1 && borrowUnstable === 1 && supplyStable === 0 && borrowStable === 0;
52
52
  if (isLong) {
53
53
  return {
54
- leveragedType: 'long',
54
+ leveragedType: LeverageType.Long,
55
55
  leveragedAsset: longAsset,
56
56
  };
57
57
  }
58
58
  if (isShort) {
59
59
  return {
60
- leveragedType: 'short',
60
+ leveragedType: LeverageType.Short,
61
61
  leveragedAsset: shortAsset,
62
62
  };
63
63
  }
64
- if (isLsdLeveraged) {
64
+ if (isVolatilePair) {
65
65
  return {
66
- leveragedType: 'lsd-leverage',
66
+ leveragedType: LeverageType.VolatilePair,
67
67
  leveragedAsset: longAsset,
68
68
  };
69
69
  }
70
70
  return {
71
- leveragedType: '',
71
+ leveragedType: LeverageType.None,
72
72
  leveragedAsset: '',
73
73
  };
74
74
  };
@@ -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([
@@ -1,4 +1,4 @@
1
- import { IncentiveData, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
1
+ import { IncentiveData, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
2
2
  export declare enum AaveVersions {
3
3
  AaveV1 = "v1",
4
4
  AaveV2 = "v2default",
@@ -161,14 +161,14 @@ export interface AaveV3AggregatedPositionData {
161
161
  totalInterestUsd: string;
162
162
  liqRatio: string;
163
163
  liqPercent: string;
164
- leveragedType: string;
164
+ leveragedType: LeverageType;
165
165
  leveragedAsset?: string;
166
- leveragedLsdAssetRatio?: string;
167
166
  liquidationPrice?: string;
168
167
  minCollRatio?: string;
169
168
  collLiquidationRatio?: string;
170
169
  healthRatio?: string;
171
170
  minHealthRatio?: string;
171
+ currentVolatilePairRatio?: string;
172
172
  }
173
173
  export interface AaveHelperCommon {
174
174
  usedAssets: any;
@@ -0,0 +1,139 @@
1
+ import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
2
+ export declare enum AaveV4SpokesType {
3
+ AaveV4CoreSpoke = "aave_v4_core_spoke",
4
+ AaveV4YieldSeekingSpoke = "aave_v4_yield_seeking_spoke"
5
+ }
6
+ export declare enum AaveV4HubsType {
7
+ AaveV4CoreHub = "aave_v4_core_hub",
8
+ AaveV4YieldSeekingHub = "aave_v4_yield_seeking_hub"
9
+ }
10
+ export interface AaveV4SpokeInfo {
11
+ chainIds: NetworkNumber[];
12
+ label: string;
13
+ value: AaveV4SpokesType;
14
+ url: string;
15
+ address: EthAddress;
16
+ hubs: EthAddress[];
17
+ }
18
+ export interface AaveV4HubInfo {
19
+ chainIds: NetworkNumber[];
20
+ label: string;
21
+ value: AaveV4HubsType;
22
+ address: EthAddress;
23
+ }
24
+ export interface AaveV4HubAssetOnChainData {
25
+ assetId: number;
26
+ drawnRate: bigint;
27
+ }
28
+ export interface AaveV4HubOnChainData {
29
+ assets: Record<number, AaveV4HubAssetOnChainData>;
30
+ }
31
+ export interface AaveV4ReserveAssetOnChain {
32
+ underlying: EthAddress;
33
+ hub: EthAddress;
34
+ assetId: number;
35
+ decimals: number;
36
+ paused: boolean;
37
+ frozen: boolean;
38
+ borrowable: boolean;
39
+ collateralRisk: number;
40
+ collateralFactor: number;
41
+ maxLiquidationBonus: number;
42
+ liquidationFee: number;
43
+ price: bigint;
44
+ totalSupplied: bigint;
45
+ totalDrawn: bigint;
46
+ totalPremium: bigint;
47
+ totalDebt: bigint;
48
+ supplyCap: bigint;
49
+ borrowCap: bigint;
50
+ deficitRay: bigint;
51
+ spokeActive: boolean;
52
+ spokePaused: boolean;
53
+ }
54
+ export interface AaveV4ReserveAssetData {
55
+ symbol: string;
56
+ underlying: EthAddress;
57
+ hub: EthAddress;
58
+ hubName: string;
59
+ assetId: number;
60
+ reserveId: number;
61
+ paused: boolean;
62
+ frozen: boolean;
63
+ borrowable: boolean;
64
+ collateralRisk: number;
65
+ collateralFactor: number;
66
+ liquidationFee: number;
67
+ price: string;
68
+ totalSupplied: string;
69
+ totalDrawn: string;
70
+ totalPremium: string;
71
+ totalDebt: string;
72
+ supplyCap: string;
73
+ borrowCap: string;
74
+ spokeActive: boolean;
75
+ spokePaused: boolean;
76
+ drawnRate: string;
77
+ supplyRate: string;
78
+ supplyIncentives: IncentiveData[];
79
+ borrowIncentives: IncentiveData[];
80
+ canBeBorrowed: boolean;
81
+ canBeSupplied: boolean;
82
+ canBeWithdrawn: boolean;
83
+ canBePayBacked: boolean;
84
+ utilization: string;
85
+ }
86
+ export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
87
+ export interface AaveV4SpokeData {
88
+ assetsData: AaveV4AssetsData;
89
+ oracle: EthAddress;
90
+ oracleDecimals: number;
91
+ address: EthAddress;
92
+ }
93
+ export interface AaveV4UsedReserveAsset {
94
+ symbol: string;
95
+ hubName: string;
96
+ assetId: number;
97
+ reserveId: number;
98
+ supplied: string;
99
+ suppliedUsd: string;
100
+ drawn: string;
101
+ drawnUsd: string;
102
+ premium: string;
103
+ premiumUsd: string;
104
+ borrowed: string;
105
+ borrowedUsd: string;
106
+ isSupplied: boolean;
107
+ isBorrowed: boolean;
108
+ collateral: boolean;
109
+ collateralFactor: number;
110
+ }
111
+ export interface AaveV4AggregatedPositionData {
112
+ suppliedUsd: string;
113
+ suppliedCollateralUsd: string;
114
+ borrowLimitUsd: string;
115
+ liquidationLimitUsd: string;
116
+ borrowedUsd: string;
117
+ drawnUsd: string;
118
+ premiumUsd: string;
119
+ leftToBorrowUsd: string;
120
+ ratio: string;
121
+ collRatio: string;
122
+ liqRatio: string;
123
+ liqPercent: string;
124
+ leveragedType: LeverageType;
125
+ leveragedAsset: string;
126
+ liquidationPrice: string;
127
+ minCollRatio: string;
128
+ collLiquidationRatio: string;
129
+ minHealthRatio: string;
130
+ netApy: string;
131
+ incentiveUsd: string;
132
+ totalInterestUsd: string;
133
+ currentVolatilePairRatio?: string;
134
+ }
135
+ export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
136
+ export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
137
+ usedAssets: AaveV4UsedReserveAssets;
138
+ healthFactor: string;
139
+ }
@@ -0,0 +1,10 @@
1
+ export var AaveV4SpokesType;
2
+ (function (AaveV4SpokesType) {
3
+ AaveV4SpokesType["AaveV4CoreSpoke"] = "aave_v4_core_spoke";
4
+ AaveV4SpokesType["AaveV4YieldSeekingSpoke"] = "aave_v4_yield_seeking_spoke";
5
+ })(AaveV4SpokesType || (AaveV4SpokesType = {}));
6
+ export var AaveV4HubsType;
7
+ (function (AaveV4HubsType) {
8
+ AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
9
+ AaveV4HubsType["AaveV4YieldSeekingHub"] = "aave_v4_yield_seeking_hub";
10
+ })(AaveV4HubsType || (AaveV4HubsType = {}));
@@ -3,11 +3,18 @@ export declare enum IncentiveKind {
3
3
  Reward = "reward"
4
4
  }
5
5
  export declare enum IncentiveEligibilityId {
6
- AaveV3EthenaLiquidLeverage = "0x7361e6f04060154e0268a8402b073cbf97e11ae3BORROW_BL",
6
+ AaveV3EthenaLiquidLeverage = "0x8014e0076e5393e62c49a7134070d8fccc922e46BORROW_BL",
7
7
  AaveV3ArbitrumEthSupply = "0x5d16261c6715a653248269861bbacf68a9774cde",
8
8
  AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351",
9
9
  AaveV3EthenaLiquidLeveragePlasma = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL"
10
10
  }
11
+ export declare enum LeverageType {
12
+ Long = "long",
13
+ Short = "short",
14
+ VolatilePair = "volatile-pair",
15
+ VolatilePairReverse = "volatile-pair-reverse",
16
+ None = ""
17
+ }
11
18
  export interface IncentiveData {
12
19
  token: string;
13
20
  apy: string;
@@ -5,11 +5,19 @@ export var IncentiveKind;
5
5
  })(IncentiveKind || (IncentiveKind = {}));
6
6
  export var IncentiveEligibilityId;
7
7
  (function (IncentiveEligibilityId) {
8
- IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "0x7361e6f04060154e0268a8402b073cbf97e11ae3BORROW_BL";
8
+ IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "0x8014e0076e5393e62c49a7134070d8fccc922e46BORROW_BL";
9
9
  IncentiveEligibilityId["AaveV3ArbitrumEthSupply"] = "0x5d16261c6715a653248269861bbacf68a9774cde";
10
10
  IncentiveEligibilityId["AaveV3ArbitrumETHLSBorrow"] = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351";
11
11
  IncentiveEligibilityId["AaveV3EthenaLiquidLeveragePlasma"] = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL";
12
12
  })(IncentiveEligibilityId || (IncentiveEligibilityId = {}));
13
+ export var LeverageType;
14
+ (function (LeverageType) {
15
+ LeverageType["Long"] = "long";
16
+ LeverageType["Short"] = "short";
17
+ LeverageType["VolatilePair"] = "volatile-pair";
18
+ LeverageType["VolatilePairReverse"] = "volatile-pair-reverse";
19
+ LeverageType["None"] = "";
20
+ })(LeverageType || (LeverageType = {}));
13
21
  export var NetworkNumber;
14
22
  (function (NetworkNumber) {
15
23
  NetworkNumber[NetworkNumber["Eth"] = 1] = "Eth";
@@ -1,4 +1,4 @@
1
- import { EthAddress, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
1
+ import { EthAddress, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
2
2
  export declare enum CompoundVersions {
3
3
  'CompoundV2' = "v2",
4
4
  'CompoundV3USDC' = "v3-USDC",
@@ -94,9 +94,9 @@ export interface CompoundAggregatedPositionData {
94
94
  totalInterestUsd: string;
95
95
  liqRatio: string;
96
96
  liqPercent: string;
97
- leveragedType: string;
97
+ leveragedType: LeverageType;
98
98
  leveragedAsset?: string;
99
- leveragedLsdAssetRatio?: string;
99
+ currentVolatilePairRatio?: string;
100
100
  liquidationPrice?: string;
101
101
  minRatio: string;
102
102
  debtTooLow: boolean;
@@ -1,4 +1,4 @@
1
- import { EthAddress, NetworkNumber } from './common';
1
+ import { EthAddress, LeverageType, NetworkNumber } from './common';
2
2
  export declare enum CrvUSDVersions {
3
3
  'crvUSDwstETH' = "wstETH",
4
4
  'crvUSDWBTC' = "WBTC",
@@ -71,7 +71,7 @@ export interface CrvUSDAggregatedPositionData {
71
71
  borrowLimitUsd: string;
72
72
  minAllowedRatio: number;
73
73
  collFactor: string;
74
- leveragedType: string;
74
+ leveragedType: LeverageType;
75
75
  leveragedAsset?: string;
76
76
  liquidationPrice?: string;
77
77
  }
@@ -1,4 +1,4 @@
1
- import { EthAddress, IncentiveData, MMPositionData, NetworkNumber } from './common';
1
+ import { EthAddress, IncentiveData, LeverageType, MMPositionData, NetworkNumber } from './common';
2
2
  export declare enum EulerV2Versions {
3
3
  eUSDC2 = "eUSDC-2",
4
4
  eWETH2 = "eWETH-2"
@@ -141,9 +141,9 @@ export interface EulerV2AggregatedPositionData {
141
141
  totalInterestUsd: string;
142
142
  liqRatio: string;
143
143
  liqPercent: string;
144
- leveragedType: string;
144
+ leveragedType: LeverageType;
145
145
  leveragedAsset?: string;
146
- leveragedLsdAssetRatio?: string;
146
+ currentVolatilePairRatio?: string;
147
147
  liquidationPrice?: string;
148
148
  minRatio: string;
149
149
  minDebt: string;
@@ -1,4 +1,4 @@
1
- import { EthAddress, IncentiveData, NetworkNumber } from './common';
1
+ import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
2
2
  export interface FluidMarketInfo {
3
3
  chainIds: number[];
4
4
  label: string;
@@ -323,10 +323,10 @@ export interface FluidAggregatedVaultData {
323
323
  collRatio: string;
324
324
  minRatio: string;
325
325
  totalInterestUsd: string;
326
- leveragedType?: string;
326
+ leveragedType?: LeverageType;
327
327
  leveragedAsset?: string;
328
328
  liquidationPrice?: string;
329
- leveragedLsdAssetRatio?: string;
329
+ currentVolatilePairRatio?: string;
330
330
  minCollRatio?: string;
331
331
  collLiquidationRatio?: string;
332
332
  }
@@ -1,4 +1,4 @@
1
- import { NetworkNumber } from './common';
1
+ import { NetworkNumber, } from './common';
2
2
  export var FluidMainnetVersion;
3
3
  (function (FluidMainnetVersion) {
4
4
  FluidMainnetVersion["FLUID_ETH_USDC_1"] = "FLUID_ETH_USDC_1";
@@ -13,3 +13,5 @@ export * from './portfolio';
13
13
  export * from './merit';
14
14
  export * from './merkl';
15
15
  export * from './savings';
16
+ export * from './common';
17
+ export * from './aaveV4';
@@ -13,3 +13,5 @@ export * from './portfolio';
13
13
  export * from './merit';
14
14
  export * from './merkl';
15
15
  export * from './savings';
16
+ export * from './common';
17
+ export * from './aaveV4';
@@ -1,4 +1,4 @@
1
- import { EthAddress, IncentiveData, NetworkNumber } from './common';
1
+ import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
2
2
  export declare enum LiquityV2Versions {
3
3
  LiquityV2Eth = "liquityv2eth",
4
4
  LiquityV2WstEth = "liquityv2wsteth",
@@ -88,7 +88,7 @@ export interface LiquityV2AggregatedTroveData {
88
88
  netApy: string;
89
89
  incentiveUsd: string;
90
90
  totalInterestUsd: string;
91
- leveragedType: string;
91
+ leveragedType: LeverageType;
92
92
  leveragedAsset: string;
93
93
  liquidationPrice: string;
94
94
  ratio: string;
@@ -110,7 +110,7 @@ export interface LiquityV2TroveData {
110
110
  totalInterestUsd: string;
111
111
  interestBatchManager: EthAddress;
112
112
  troveStatus: string;
113
- leveragedType: string;
113
+ leveragedType: LeverageType;
114
114
  leveragedAsset: string;
115
115
  liquidationPrice: string;
116
116
  debtInFront: string;
@@ -1,4 +1,4 @@
1
- import { EthAddress, IncentiveData, NetworkNumber } from './common';
1
+ import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
2
2
  import { BandData, UserBandData } from './curveUsd';
3
3
  export declare enum LLVersionsEth {
4
4
  LLWstethCrvusd = "llamaLendwstETHcrvUSD",
@@ -112,7 +112,7 @@ export interface LlamaLendAggregatedPositionData {
112
112
  borrowLimitUsd: string;
113
113
  minAllowedRatio: number;
114
114
  collFactor: string;
115
- leveragedType: string;
115
+ leveragedType: LeverageType;
116
116
  leveragedAsset?: string;
117
117
  liquidationPrice?: string;
118
118
  netApy: string;
@@ -1,4 +1,4 @@
1
- import { EthAddress, IncentiveData, MMUsedAssets, NetworkNumber } from './common';
1
+ import { EthAddress, IncentiveData, LeverageType, MMUsedAssets, NetworkNumber } from './common';
2
2
  export declare enum MorphoBlueVersions {
3
3
  MorphoBlueWstEthUSDC = "morphobluewstethusdc",// wstETH/USDC
4
4
  MorphoBlueSDAIUSDC = "morphobluesdaiusdc",// sDAI/USDC
@@ -121,9 +121,9 @@ export interface MorphoBlueAggregatedPositionData {
121
121
  totalInterestUsd: string;
122
122
  ltv: string;
123
123
  ratio: string;
124
- leveragedType: string;
124
+ leveragedType: LeverageType;
125
125
  leveragedAsset?: string;
126
- leveragedLsdAssetRatio?: string;
126
+ currentVolatilePairRatio?: string;
127
127
  liquidationPrice?: string;
128
128
  minCollRatio?: string;
129
129
  collLiquidationRatio?: string;
@@ -142,9 +142,9 @@ export interface MorphoBluePositionData {
142
142
  totalInterestUsd: string;
143
143
  ltv: string;
144
144
  ratio: string;
145
- leveragedType: string;
145
+ leveragedType: LeverageType;
146
146
  leveragedAsset?: string;
147
- leveragedLsdAssetRatio?: string;
147
+ currentVolatilePairRatio?: string;
148
148
  liquidationPrice?: string;
149
149
  supplyShares: string;
150
150
  borrowShares: string;
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import { EModeCategoriesData } from './aave';
2
- import { EthAddress, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
2
+ import { EthAddress, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
3
3
  export declare enum SparkVersions {
4
4
  SparkV1 = "v1default"
5
5
  }
@@ -90,9 +90,9 @@ export interface SparkAggregatedPositionData {
90
90
  totalInterestUsd: string;
91
91
  liqRatio: string;
92
92
  liqPercent: string;
93
- leveragedType: string;
93
+ leveragedType: LeverageType;
94
94
  leveragedAsset?: string;
95
- leveragedLsdAssetRatio?: string;
95
+ currentVolatilePairRatio?: string;
96
96
  liquidationPrice?: string;
97
97
  minCollRatio: string;
98
98
  collLiquidationRatio: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/positions-sdk",
3
- "version": "2.1.51",
3
+ "version": "2.1.52-aave-v4-1-dev",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",