@defisaver/positions-sdk 2.1.59 → 2.1.61-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.
Files changed (163) hide show
  1. package/cjs/aaveV3/index.d.ts +1 -0
  2. package/cjs/aaveV3/index.js +1 -0
  3. package/cjs/aaveV4/index.d.ts +7 -0
  4. package/cjs/aaveV4/index.js +174 -0
  5. package/cjs/compoundV2/index.d.ts +1 -0
  6. package/cjs/compoundV2/index.js +1 -0
  7. package/cjs/compoundV3/index.d.ts +1 -0
  8. package/cjs/compoundV3/index.js +1 -0
  9. package/cjs/config/contracts.d.ts +1277 -0
  10. package/cjs/config/contracts.js +9 -0
  11. package/cjs/contracts.d.ts +23120 -0
  12. package/cjs/contracts.js +2 -1
  13. package/cjs/eulerV2/index.d.ts +1 -0
  14. package/cjs/eulerV2/index.js +1 -0
  15. package/cjs/fluid/index.d.ts +3 -0
  16. package/cjs/helpers/aaveHelpers/index.js +1 -0
  17. package/cjs/helpers/aaveV4Helpers/index.d.ts +13 -0
  18. package/cjs/helpers/aaveV4Helpers/index.js +117 -0
  19. package/cjs/helpers/compoundHelpers/index.js +2 -0
  20. package/cjs/helpers/curveUsdHelpers/index.js +1 -0
  21. package/cjs/helpers/eulerHelpers/index.js +1 -0
  22. package/cjs/helpers/fluidHelpers/index.js +1 -0
  23. package/cjs/helpers/index.d.ts +1 -0
  24. package/cjs/helpers/index.js +2 -1
  25. package/cjs/helpers/liquityV2Helpers/index.js +1 -0
  26. package/cjs/helpers/llamaLendHelpers/index.js +1 -0
  27. package/cjs/helpers/morphoBlueHelpers/index.js +3 -2
  28. package/cjs/helpers/sparkHelpers/index.js +1 -0
  29. package/cjs/index.d.ts +2 -1
  30. package/cjs/index.js +3 -1
  31. package/cjs/liquity/index.js +2 -0
  32. package/cjs/maker/index.js +2 -0
  33. package/cjs/markets/aaveV4/index.d.ts +16 -0
  34. package/cjs/markets/aaveV4/index.js +59 -0
  35. package/cjs/markets/index.d.ts +1 -0
  36. package/cjs/markets/index.js +3 -1
  37. package/cjs/moneymarket/moneymarketCommonService.d.ts +1 -0
  38. package/cjs/moneymarket/moneymarketCommonService.js +8 -1
  39. package/cjs/portfolio/index.js +20 -0
  40. package/cjs/services/utils.d.ts +1 -0
  41. package/cjs/services/utils.js +2 -1
  42. package/cjs/spark/index.d.ts +1 -0
  43. package/cjs/spark/index.js +1 -0
  44. package/cjs/types/aave.d.ts +1 -0
  45. package/cjs/types/aaveV4.d.ts +139 -0
  46. package/cjs/types/aaveV4.js +13 -0
  47. package/cjs/types/common.d.ts +1 -0
  48. package/cjs/types/compound.d.ts +1 -0
  49. package/cjs/types/curveUsd.d.ts +2 -0
  50. package/cjs/types/euler.d.ts +1 -0
  51. package/cjs/types/fluid.d.ts +1 -0
  52. package/cjs/types/index.d.ts +1 -0
  53. package/cjs/types/index.js +1 -0
  54. package/cjs/types/liquity.d.ts +1 -0
  55. package/cjs/types/liquityV2.d.ts +2 -0
  56. package/cjs/types/llamaLend.d.ts +2 -0
  57. package/cjs/types/maker.d.ts +1 -0
  58. package/cjs/types/morphoBlue.d.ts +2 -0
  59. package/cjs/types/portfolio.d.ts +4 -0
  60. package/cjs/types/spark.d.ts +1 -0
  61. package/esm/aaveV3/index.d.ts +1 -0
  62. package/esm/aaveV3/index.js +1 -0
  63. package/esm/aaveV4/index.d.ts +7 -0
  64. package/esm/aaveV4/index.js +165 -0
  65. package/esm/compoundV2/index.d.ts +1 -0
  66. package/esm/compoundV2/index.js +1 -0
  67. package/esm/compoundV3/index.d.ts +1 -0
  68. package/esm/compoundV3/index.js +1 -0
  69. package/esm/config/contracts.d.ts +1277 -0
  70. package/esm/config/contracts.js +8 -0
  71. package/esm/contracts.d.ts +23120 -0
  72. package/esm/contracts.js +1 -0
  73. package/esm/eulerV2/index.d.ts +1 -0
  74. package/esm/eulerV2/index.js +1 -0
  75. package/esm/fluid/index.d.ts +3 -0
  76. package/esm/helpers/aaveHelpers/index.js +2 -1
  77. package/esm/helpers/aaveV4Helpers/index.d.ts +13 -0
  78. package/esm/helpers/aaveV4Helpers/index.js +108 -0
  79. package/esm/helpers/compoundHelpers/index.js +3 -1
  80. package/esm/helpers/curveUsdHelpers/index.js +2 -1
  81. package/esm/helpers/eulerHelpers/index.js +2 -1
  82. package/esm/helpers/fluidHelpers/index.js +2 -1
  83. package/esm/helpers/index.d.ts +1 -0
  84. package/esm/helpers/index.js +1 -0
  85. package/esm/helpers/liquityV2Helpers/index.js +2 -1
  86. package/esm/helpers/llamaLendHelpers/index.js +2 -1
  87. package/esm/helpers/morphoBlueHelpers/index.js +5 -4
  88. package/esm/helpers/sparkHelpers/index.js +2 -1
  89. package/esm/index.d.ts +2 -1
  90. package/esm/index.js +2 -1
  91. package/esm/liquity/index.js +2 -0
  92. package/esm/maker/index.js +2 -0
  93. package/esm/markets/aaveV4/index.d.ts +16 -0
  94. package/esm/markets/aaveV4/index.js +47 -0
  95. package/esm/markets/index.d.ts +1 -0
  96. package/esm/markets/index.js +1 -0
  97. package/esm/moneymarket/moneymarketCommonService.d.ts +1 -0
  98. package/esm/moneymarket/moneymarketCommonService.js +6 -0
  99. package/esm/portfolio/index.js +21 -1
  100. package/esm/services/utils.d.ts +1 -0
  101. package/esm/services/utils.js +1 -0
  102. package/esm/spark/index.d.ts +1 -0
  103. package/esm/spark/index.js +1 -0
  104. package/esm/types/aave.d.ts +1 -0
  105. package/esm/types/aaveV4.d.ts +139 -0
  106. package/esm/types/aaveV4.js +10 -0
  107. package/esm/types/common.d.ts +1 -0
  108. package/esm/types/compound.d.ts +1 -0
  109. package/esm/types/curveUsd.d.ts +2 -0
  110. package/esm/types/euler.d.ts +1 -0
  111. package/esm/types/fluid.d.ts +1 -0
  112. package/esm/types/index.d.ts +1 -0
  113. package/esm/types/index.js +1 -0
  114. package/esm/types/liquity.d.ts +1 -0
  115. package/esm/types/liquityV2.d.ts +2 -0
  116. package/esm/types/llamaLend.d.ts +2 -0
  117. package/esm/types/maker.d.ts +1 -0
  118. package/esm/types/morphoBlue.d.ts +2 -0
  119. package/esm/types/portfolio.d.ts +4 -0
  120. package/esm/types/spark.d.ts +1 -0
  121. package/package.json +1 -1
  122. package/src/aaveV3/index.ts +1 -0
  123. package/src/aaveV4/index.ts +176 -0
  124. package/src/compoundV2/index.ts +1 -0
  125. package/src/compoundV3/index.ts +1 -0
  126. package/src/config/contracts.ts +8 -0
  127. package/src/contracts.ts +3 -1
  128. package/src/eulerV2/index.ts +1 -0
  129. package/src/helpers/aaveHelpers/index.ts +2 -1
  130. package/src/helpers/aaveV4Helpers/index.ts +128 -0
  131. package/src/helpers/compoundHelpers/index.ts +3 -1
  132. package/src/helpers/curveUsdHelpers/index.ts +5 -1
  133. package/src/helpers/eulerHelpers/index.ts +2 -1
  134. package/src/helpers/fluidHelpers/index.ts +4 -1
  135. package/src/helpers/index.ts +1 -0
  136. package/src/helpers/liquityV2Helpers/index.ts +4 -1
  137. package/src/helpers/llamaLendHelpers/index.ts +4 -1
  138. package/src/helpers/morphoBlueHelpers/index.ts +5 -4
  139. package/src/helpers/sparkHelpers/index.ts +2 -1
  140. package/src/index.ts +2 -0
  141. package/src/liquity/index.ts +2 -0
  142. package/src/maker/index.ts +2 -0
  143. package/src/markets/aaveV4/index.ts +68 -0
  144. package/src/markets/index.ts +6 -1
  145. package/src/moneymarket/moneymarketCommonService.ts +6 -0
  146. package/src/portfolio/index.ts +20 -0
  147. package/src/services/utils.ts +1 -0
  148. package/src/spark/index.ts +1 -0
  149. package/src/types/aave.ts +1 -0
  150. package/src/types/aaveV4.ts +155 -0
  151. package/src/types/common.ts +1 -0
  152. package/src/types/compound.ts +1 -0
  153. package/src/types/curveUsd.ts +2 -0
  154. package/src/types/euler.ts +1 -0
  155. package/src/types/fluid.ts +2 -1
  156. package/src/types/index.ts +2 -1
  157. package/src/types/liquity.ts +1 -0
  158. package/src/types/liquityV2.ts +2 -0
  159. package/src/types/llamaLend.ts +2 -0
  160. package/src/types/maker.ts +1 -0
  161. package/src/types/morphoBlue.ts +2 -0
  162. package/src/types/portfolio.ts +4 -0
  163. package/src/types/spark.ts +1 -0
@@ -0,0 +1,155 @@
1
+ import {
2
+ EthAddress, IncentiveData, LeverageType, NetworkNumber,
3
+ } from './common';
4
+
5
+ export enum AaveV4SpokesType {
6
+ AaveV4CoreSpoke = 'aave_v4_core_spoke',
7
+ AaveV4YieldSeekingSpoke = 'aave_v4_yield_seeking_spoke',
8
+ }
9
+
10
+ export enum AaveV4HubsType {
11
+ AaveV4CoreHub = 'aave_v4_core_hub',
12
+ AaveV4YieldSeekingHub = 'aave_v4_yield_seeking_hub',
13
+ }
14
+
15
+ export interface AaveV4SpokeInfo {
16
+ chainIds: NetworkNumber[],
17
+ label: string,
18
+ value: AaveV4SpokesType,
19
+ url: string,
20
+ address: EthAddress,
21
+ hubs: EthAddress[],
22
+ }
23
+
24
+ export interface AaveV4HubInfo {
25
+ chainIds: NetworkNumber[],
26
+ label: string,
27
+ value: AaveV4HubsType,
28
+ address: EthAddress,
29
+ }
30
+
31
+ export interface AaveV4HubAssetOnChainData {
32
+ assetId: number,
33
+ drawnRate: bigint,
34
+ }
35
+
36
+ export interface AaveV4HubOnChainData {
37
+ assets: Record<number, AaveV4HubAssetOnChainData>,
38
+ }
39
+
40
+ export interface AaveV4ReserveAssetOnChain {
41
+ underlying: EthAddress,
42
+ hub: EthAddress,
43
+ assetId: number,
44
+ decimals: number,
45
+ paused: boolean,
46
+ frozen: boolean,
47
+ borrowable: boolean,
48
+ collateralRisk: number,
49
+ collateralFactor: number,
50
+ maxLiquidationBonus: number,
51
+ liquidationFee: number,
52
+ price: bigint,
53
+ totalSupplied: bigint,
54
+ totalDrawn: bigint,
55
+ totalPremium: bigint,
56
+ totalDebt: bigint,
57
+ supplyCap: bigint,
58
+ borrowCap: bigint,
59
+ deficitRay: bigint,
60
+ spokeActive: boolean,
61
+ spokePaused: boolean
62
+ }
63
+
64
+ export interface AaveV4ReserveAssetData {
65
+ symbol: string,
66
+ underlying: EthAddress,
67
+ hub: EthAddress,
68
+ hubName: string,
69
+ assetId: number,
70
+ reserveId: number,
71
+ paused: boolean,
72
+ frozen: boolean,
73
+ borrowable: boolean,
74
+ collateralRisk: number,
75
+ collateralFactor: number,
76
+ liquidationFee: number,
77
+ price: string,
78
+ totalSupplied: string,
79
+ totalDrawn: string,
80
+ totalPremium: string,
81
+ totalDebt: string,
82
+ supplyCap: string,
83
+ borrowCap: string,
84
+ spokeActive: boolean,
85
+ spokePaused: boolean,
86
+ drawnRate: string,
87
+ supplyRate: string,
88
+ supplyIncentives: IncentiveData[];
89
+ borrowIncentives: IncentiveData[];
90
+ canBeBorrowed: boolean;
91
+ canBeSupplied: boolean;
92
+ canBeWithdrawn: boolean;
93
+ canBePayBacked: boolean;
94
+ utilization: string;
95
+ }
96
+
97
+ export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
98
+
99
+ export interface AaveV4SpokeData {
100
+ assetsData: AaveV4AssetsData,
101
+ oracle: EthAddress,
102
+ oracleDecimals: number,
103
+ address: EthAddress,
104
+ }
105
+
106
+ export interface AaveV4UsedReserveAsset {
107
+ symbol: string,
108
+ hubName: string,
109
+ assetId: number,
110
+ reserveId: number,
111
+ supplied: string,
112
+ suppliedUsd: string,
113
+ drawn: string,
114
+ drawnUsd: string,
115
+ premium: string,
116
+ premiumUsd: string,
117
+ borrowed: string,
118
+ borrowedUsd: string,
119
+ isSupplied: boolean,
120
+ isBorrowed: boolean,
121
+ collateral: boolean,
122
+ collateralFactor: number,
123
+ }
124
+
125
+ export interface AaveV4AggregatedPositionData {
126
+ suppliedUsd: string,
127
+ suppliedCollateralUsd: string,
128
+ borrowLimitUsd: string,
129
+ liquidationLimitUsd: string,
130
+ borrowedUsd: string,
131
+ drawnUsd: string,
132
+ premiumUsd: string,
133
+ leftToBorrowUsd: string,
134
+ ratio: string,
135
+ collRatio: string,
136
+ liqRatio: string,
137
+ liqPercent: string,
138
+ leveragedType: LeverageType,
139
+ leveragedAsset: string,
140
+ liquidationPrice: string,
141
+ minCollRatio: string,
142
+ collLiquidationRatio: string,
143
+ minHealthRatio: string,
144
+ netApy: string,
145
+ incentiveUsd: string,
146
+ totalInterestUsd: string,
147
+ currentVolatilePairRatio?: string,
148
+ }
149
+
150
+ export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
151
+
152
+ export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
153
+ usedAssets: AaveV4UsedReserveAssets,
154
+ healthFactor: string,
155
+ }
@@ -99,6 +99,7 @@ export interface MMPositionData {
99
99
  usedAssets: any,
100
100
  netApy: string,
101
101
  lastUpdated: number,
102
+ exposure: string,
102
103
  // ...
103
104
  }
104
105
 
@@ -123,6 +123,7 @@ export interface CompoundAggregatedPositionData {
123
123
  minDebt: string,
124
124
  minCollRatio: string,
125
125
  collLiquidationRatio: string,
126
+ exposure: string,
126
127
  }
127
128
 
128
129
  export interface CompoundPositionData extends MMPositionData {
@@ -79,6 +79,7 @@ export interface CrvUSDAggregatedPositionData {
79
79
  minAllowedRatio: number,
80
80
  collFactor: string,
81
81
  leveragedType: LeverageType,
82
+ exposure: string,
82
83
  leveragedAsset?: string,
83
84
  liquidationPrice?: string,
84
85
  }
@@ -121,4 +122,5 @@ export interface CrvUSDUserData {
121
122
  borrowRate?: string,
122
123
  collateralPrice: string,
123
124
  collRatio: string,
125
+ exposure: string,
124
126
  }
@@ -174,4 +174,5 @@ export interface EulerV2AggregatedPositionData {
174
174
  minDebt: string,
175
175
  minCollRatio: string,
176
176
  collLiquidationRatio: string,
177
+ exposure: string,
177
178
  }
@@ -342,7 +342,7 @@ export interface FluidAggregatedVaultData {
342
342
  incentiveUsd: string,
343
343
  ratio: string,
344
344
  collRatio: string,
345
- minRatio: string
345
+ minRatio: string,
346
346
  totalInterestUsd: string,
347
347
  leveragedType?: LeverageType,
348
348
  leveragedAsset?: string,
@@ -350,6 +350,7 @@ export interface FluidAggregatedVaultData {
350
350
  currentVolatilePairRatio?: string,
351
351
  minCollRatio?: string,
352
352
  collLiquidationRatio?: string,
353
+ exposure: string,
353
354
  }
354
355
 
355
356
  export interface BaseFluidVaultData {
@@ -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';
@@ -28,4 +28,5 @@ export interface LiquityTroveInfo {
28
28
  minCollateralRatio: number,
29
29
  priceForRecovery: string,
30
30
  debtInFront: string,
31
+ exposure: string,
31
32
  }
@@ -103,6 +103,7 @@ export interface LiquityV2AggregatedTroveData {
103
103
  liquidationPrice: string,
104
104
  ratio: string,
105
105
  collRatio: string,
106
+ exposure: string,
106
107
  }
107
108
 
108
109
  export interface LiquityV2TroveData {
@@ -126,4 +127,5 @@ export interface LiquityV2TroveData {
126
127
  liquidationPrice: string,
127
128
  debtInFront: string,
128
129
  lastInterestRateAdjTime: string,
130
+ exposure: string,
129
131
  }
@@ -118,6 +118,7 @@ export interface LlamaLendAggregatedPositionData {
118
118
  netApy: string,
119
119
  incentiveUsd: string,
120
120
  totalInterestUsd: string,
121
+ exposure: string,
121
122
  }
122
123
 
123
124
  export interface LlamaLendUsedAsset {
@@ -158,4 +159,5 @@ export interface LlamaLendUserData {
158
159
  userBands: UserBandData[],
159
160
  loanExists: boolean,
160
161
  borrowRate?: string,
162
+ exposure: string,
161
163
  }
@@ -61,4 +61,5 @@ export interface CdpData {
61
61
  globalDebtCurrent: string,
62
62
  liquidationFee: string,
63
63
  lastUpdated: number,
64
+ exposure: string,
64
65
  }
@@ -154,6 +154,7 @@ export interface MorphoBlueAggregatedPositionData {
154
154
  liquidationPrice?: string,
155
155
  minCollRatio?: string,
156
156
  collLiquidationRatio?: string,
157
+ exposure: string,
157
158
  }
158
159
 
159
160
  export interface MorphoBluePositionData {
@@ -176,6 +177,7 @@ export interface MorphoBluePositionData {
176
177
  liquidationPrice?: string,
177
178
  supplyShares: string,
178
179
  borrowShares: string,
180
+ exposure: string,
179
181
  }
180
182
 
181
183
  export interface MorphoBlueVault {
@@ -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 {
@@ -112,6 +112,7 @@ export interface SparkAggregatedPositionData {
112
112
  collLiquidationRatio: string,
113
113
  healthRatio: string;
114
114
  minHealthRatio: string;
115
+ exposure: string,
115
116
  }
116
117
 
117
118
  export interface SparkPositionData extends MMPositionData {