@defisaver/positions-sdk 2.1.161-portfolio-api-1-dev → 2.1.161-portfolio-api-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 (193) hide show
  1. package/cjs/aaveV2/index.js +2 -0
  2. package/cjs/aaveV3/index.d.ts +41 -12
  3. package/cjs/aaveV3/index.js +237 -2
  4. package/cjs/aaveV3/sgho.d.ts +2 -16
  5. package/cjs/aaveV4/lend.d.ts +2 -43
  6. package/cjs/claiming/aaveV3.d.ts +2 -2
  7. package/cjs/claiming/ethena.d.ts +2 -1
  8. package/cjs/claiming/king.d.ts +2 -1
  9. package/cjs/claiming/spark.d.ts +2 -2
  10. package/cjs/curveUsd/index.d.ts +5 -2
  11. package/cjs/curveUsd/index.js +30 -15
  12. package/cjs/fluid/index.d.ts +10 -49
  13. package/cjs/fluid/index.js +36 -1
  14. package/cjs/helpers/aaveHelpers/index.d.ts +9 -1
  15. package/cjs/helpers/aaveHelpers/index.js +26 -6
  16. package/cjs/helpers/aaveV4Helpers/index.js +1 -0
  17. package/cjs/helpers/compoundHelpers/index.js +2 -0
  18. package/cjs/helpers/curveUsdHelpers/index.d.ts +3 -1
  19. package/cjs/helpers/curveUsdHelpers/index.js +15 -2
  20. package/cjs/helpers/fluidHelpers/index.js +1 -0
  21. package/cjs/helpers/liquityV2Helpers/index.js +1 -0
  22. package/cjs/helpers/llamaLendHelpers/index.js +1 -0
  23. package/cjs/helpers/makerHelpers/index.d.ts +1 -1
  24. package/cjs/helpers/makerHelpers/index.js +2 -2
  25. package/cjs/helpers/morphoBlueHelpers/index.js +2 -0
  26. package/cjs/helpers/morphoMidnightHelpers/index.js +2 -0
  27. package/cjs/helpers/sparkHelpers/index.js +1 -0
  28. package/cjs/liquity/index.d.ts +2 -12
  29. package/cjs/liquity/index.js +15 -2
  30. package/cjs/liquityV2/index.d.ts +8 -23
  31. package/cjs/liquityV2/index.js +37 -19
  32. package/cjs/maker/index.d.ts +7 -2
  33. package/cjs/maker/index.js +44 -12
  34. package/cjs/markets/index.d.ts +1 -0
  35. package/cjs/markets/index.js +3 -1
  36. package/cjs/markets/maker/index.d.ts +1 -0
  37. package/cjs/markets/maker/index.js +13 -0
  38. package/cjs/moneymarket/moneymarketCommonService.d.ts +9 -0
  39. package/cjs/moneymarket/moneymarketCommonService.js +13 -1
  40. package/cjs/portfolio/index.d.ts +17 -5
  41. package/cjs/portfolio/index.js +583 -381
  42. package/cjs/portfolio/lendingProtocols.d.ts +184 -0
  43. package/cjs/portfolio/lendingProtocols.js +196 -0
  44. package/cjs/savings/index.d.ts +8 -2
  45. package/cjs/savings/index.js +37 -5
  46. package/cjs/savings/morphoVaults/index.d.ts +1 -1
  47. package/cjs/savings/morphoVaults/index.js +56 -18
  48. package/cjs/savings/morphoVaults/options.d.ts +2 -0
  49. package/cjs/savings/morphoVaults/options.js +61 -1
  50. package/cjs/spark/index.js +1 -0
  51. package/cjs/staking/staking.d.ts +20 -0
  52. package/cjs/staking/staking.js +19 -1
  53. package/cjs/types/aave.d.ts +86 -0
  54. package/cjs/types/aaveV4.d.ts +45 -0
  55. package/cjs/types/compound.d.ts +2 -0
  56. package/cjs/types/curveUsd.d.ts +6 -0
  57. package/cjs/types/fluid.d.ts +14 -0
  58. package/cjs/types/index.d.ts +1 -0
  59. package/cjs/types/index.js +1 -0
  60. package/cjs/types/liquity.d.ts +16 -0
  61. package/cjs/types/liquityV2.d.ts +26 -0
  62. package/cjs/types/maker.d.ts +4 -0
  63. package/cjs/types/morphoBlue.d.ts +2 -0
  64. package/cjs/types/morphoMidnight.d.ts +1 -0
  65. package/cjs/types/portfolio.d.ts +127 -6
  66. package/cjs/types/savings/index.d.ts +9 -1
  67. package/cjs/types/savings/morphoVaults.d.ts +10 -2
  68. package/cjs/types/savings/morphoVaults.js +9 -1
  69. package/cjs/types/spark.d.ts +2 -0
  70. package/cjs/umbrella/index.d.ts +2 -3
  71. package/esm/aaveV2/index.js +2 -0
  72. package/esm/aaveV3/index.d.ts +41 -12
  73. package/esm/aaveV3/index.js +231 -2
  74. package/esm/aaveV3/sgho.d.ts +2 -16
  75. package/esm/aaveV4/lend.d.ts +2 -43
  76. package/esm/claiming/aaveV3.d.ts +2 -2
  77. package/esm/claiming/aaveV3.js +1 -1
  78. package/esm/claiming/ethena.d.ts +2 -1
  79. package/esm/claiming/king.d.ts +2 -1
  80. package/esm/claiming/spark.d.ts +2 -2
  81. package/esm/claiming/spark.js +1 -1
  82. package/esm/curveUsd/index.d.ts +5 -2
  83. package/esm/curveUsd/index.js +30 -15
  84. package/esm/fluid/index.d.ts +10 -49
  85. package/esm/fluid/index.js +33 -0
  86. package/esm/helpers/aaveHelpers/index.d.ts +9 -1
  87. package/esm/helpers/aaveHelpers/index.js +23 -5
  88. package/esm/helpers/aaveV4Helpers/index.js +1 -0
  89. package/esm/helpers/compoundHelpers/index.js +2 -0
  90. package/esm/helpers/curveUsdHelpers/index.d.ts +3 -1
  91. package/esm/helpers/curveUsdHelpers/index.js +16 -3
  92. package/esm/helpers/fluidHelpers/index.js +1 -0
  93. package/esm/helpers/liquityV2Helpers/index.js +1 -0
  94. package/esm/helpers/llamaLendHelpers/index.js +2 -1
  95. package/esm/helpers/makerHelpers/index.d.ts +1 -1
  96. package/esm/helpers/makerHelpers/index.js +2 -2
  97. package/esm/helpers/morphoBlueHelpers/index.js +2 -0
  98. package/esm/helpers/morphoMidnightHelpers/index.js +2 -0
  99. package/esm/helpers/sparkHelpers/index.js +1 -0
  100. package/esm/liquity/index.d.ts +2 -12
  101. package/esm/liquity/index.js +16 -3
  102. package/esm/liquityV2/index.d.ts +8 -23
  103. package/esm/liquityV2/index.js +35 -18
  104. package/esm/maker/index.d.ts +7 -2
  105. package/esm/maker/index.js +44 -14
  106. package/esm/markets/index.d.ts +1 -0
  107. package/esm/markets/index.js +1 -0
  108. package/esm/markets/maker/index.d.ts +1 -0
  109. package/esm/markets/maker/index.js +10 -0
  110. package/esm/moneymarket/moneymarketCommonService.d.ts +9 -0
  111. package/esm/moneymarket/moneymarketCommonService.js +11 -0
  112. package/esm/portfolio/index.d.ts +17 -5
  113. package/esm/portfolio/index.js +584 -385
  114. package/esm/portfolio/lendingProtocols.d.ts +184 -0
  115. package/esm/portfolio/lendingProtocols.js +189 -0
  116. package/esm/savings/index.d.ts +8 -2
  117. package/esm/savings/index.js +35 -4
  118. package/esm/savings/morphoVaults/index.d.ts +1 -1
  119. package/esm/savings/morphoVaults/index.js +57 -19
  120. package/esm/savings/morphoVaults/options.d.ts +2 -0
  121. package/esm/savings/morphoVaults/options.js +61 -1
  122. package/esm/spark/index.js +1 -0
  123. package/esm/staking/staking.d.ts +20 -0
  124. package/esm/staking/staking.js +17 -0
  125. package/esm/types/aave.d.ts +86 -0
  126. package/esm/types/aaveV4.d.ts +45 -0
  127. package/esm/types/compound.d.ts +2 -0
  128. package/esm/types/curveUsd.d.ts +6 -0
  129. package/esm/types/fluid.d.ts +14 -0
  130. package/esm/types/index.d.ts +1 -0
  131. package/esm/types/index.js +1 -0
  132. package/esm/types/liquity.d.ts +16 -0
  133. package/esm/types/liquityV2.d.ts +26 -0
  134. package/esm/types/maker.d.ts +4 -0
  135. package/esm/types/morphoBlue.d.ts +2 -0
  136. package/esm/types/morphoMidnight.d.ts +1 -0
  137. package/esm/types/portfolio.d.ts +127 -6
  138. package/esm/types/savings/index.d.ts +9 -1
  139. package/esm/types/savings/morphoVaults.d.ts +10 -2
  140. package/esm/types/savings/morphoVaults.js +8 -0
  141. package/esm/types/spark.d.ts +2 -0
  142. package/esm/umbrella/index.d.ts +2 -3
  143. package/package.json +3 -2
  144. package/src/aaveV2/index.ts +2 -0
  145. package/src/aaveV3/index.ts +293 -2
  146. package/src/aaveV3/sgho.ts +2 -17
  147. package/src/aaveV4/lend.ts +2 -48
  148. package/src/claiming/aaveV3.ts +4 -2
  149. package/src/claiming/ethena.ts +5 -5
  150. package/src/claiming/king.ts +3 -3
  151. package/src/claiming/spark.ts +6 -4
  152. package/src/curveUsd/index.ts +33 -16
  153. package/src/fluid/index.ts +44 -3
  154. package/src/helpers/aaveHelpers/index.ts +27 -7
  155. package/src/helpers/aaveV4Helpers/index.ts +1 -0
  156. package/src/helpers/compoundHelpers/index.ts +2 -0
  157. package/src/helpers/curveUsdHelpers/index.ts +23 -3
  158. package/src/helpers/fluidHelpers/index.ts +1 -0
  159. package/src/helpers/liquityV2Helpers/index.ts +1 -0
  160. package/src/helpers/llamaLendHelpers/index.ts +2 -1
  161. package/src/helpers/makerHelpers/index.ts +2 -1
  162. package/src/helpers/morphoBlueHelpers/index.ts +2 -0
  163. package/src/helpers/morphoMidnightHelpers/index.ts +2 -0
  164. package/src/helpers/sparkHelpers/index.ts +1 -0
  165. package/src/liquity/index.ts +19 -5
  166. package/src/liquityV2/index.ts +48 -22
  167. package/src/maker/index.ts +77 -30
  168. package/src/markets/index.ts +2 -1
  169. package/src/markets/maker/index.ts +10 -0
  170. package/src/moneymarket/moneymarketCommonService.ts +15 -0
  171. package/src/portfolio/index.ts +477 -248
  172. package/src/portfolio/lendingProtocols.ts +281 -0
  173. package/src/savings/index.ts +45 -5
  174. package/src/savings/morphoVaults/index.ts +73 -21
  175. package/src/savings/morphoVaults/options.ts +67 -1
  176. package/src/spark/index.ts +1 -0
  177. package/src/staking/staking.ts +28 -0
  178. package/src/types/aave.ts +90 -0
  179. package/src/types/aaveV4.ts +50 -0
  180. package/src/types/compound.ts +2 -0
  181. package/src/types/curveUsd.ts +7 -0
  182. package/src/types/fluid.ts +15 -0
  183. package/src/types/index.ts +2 -1
  184. package/src/types/liquity.ts +19 -1
  185. package/src/types/liquityV2.ts +28 -1
  186. package/src/types/maker.ts +6 -0
  187. package/src/types/morphoBlue.ts +2 -0
  188. package/src/types/morphoMidnight.ts +1 -0
  189. package/src/types/portfolio.ts +153 -7
  190. package/src/types/savings/index.ts +12 -1
  191. package/src/types/savings/morphoVaults.ts +11 -1
  192. package/src/types/spark.ts +2 -0
  193. package/src/umbrella/index.ts +2 -1
@@ -1,10 +1,14 @@
1
- import { MorphoVault, MorphoVaultType } from '../../types';
1
+ import {
2
+ MorphoVault, MorphoVaultType, MorphoVaultVersion, NetworkNumber,
3
+ } from '../../types';
2
4
 
3
5
  export const MORPHO_VAULT_FLAGSHIP_ETH: MorphoVault = {
4
6
  type: MorphoVaultType.MorphoVaultFlagshipEth,
5
7
  name: 'Flagship ETH',
6
8
  address: '0x38989BBA00BDF8181F4082995b3DEAe96163aC5D',
7
9
  asset: 'WETH',
10
+ network: NetworkNumber.Eth,
11
+ version: MorphoVaultVersion.V1,
8
12
  deploymentBlock: 18927491,
9
13
  isLegacy: true,
10
14
  };
@@ -14,6 +18,8 @@ export const MORPHO_VAULT_GAUNTLET_USDC_CORE: MorphoVault = {
14
18
  name: 'Gauntlet USDC Core',
15
19
  address: '0x8eB67A509616cd6A7c1B3c8C21D48FF57df3d458',
16
20
  asset: 'USDC',
21
+ network: NetworkNumber.Eth,
22
+ version: MorphoVaultVersion.V1,
17
23
  deploymentBlock: 19777569,
18
24
  isLegacy: true,
19
25
  };
@@ -23,6 +29,8 @@ export const MORPHO_VAULT_GAUNTLET_USDC_PRIME: MorphoVault = {
23
29
  name: 'Gauntlet USDC Prime',
24
30
  address: '0xdd0f28e19C1780eb6396170735D45153D261490d',
25
31
  asset: 'USDC',
32
+ network: NetworkNumber.Eth,
33
+ version: MorphoVaultVersion.V1,
26
34
  deploymentBlock: 19777569,
27
35
  isLegacy: true,
28
36
  };
@@ -32,6 +40,8 @@ export const MORPHO_VAULT_RE7_WETH: MorphoVault = {
32
40
  name: 'RE7 WETH',
33
41
  address: '0x78Fc2c2eD1A4cDb5402365934aE5648aDAd094d0',
34
42
  asset: 'WETH',
43
+ network: NetworkNumber.Eth,
44
+ version: MorphoVaultVersion.V1,
35
45
  deploymentBlock: 19121118,
36
46
  isLegacy: true,
37
47
  };
@@ -41,6 +51,8 @@ export const MORPHO_VAULT_GAUNTLET_WETH_CORE: MorphoVault = {
41
51
  name: 'Gauntlet WETH Core',
42
52
  address: '0x4881Ef0BF6d2365D3dd6499ccd7532bcdBCE0658',
43
53
  asset: 'WETH',
54
+ network: NetworkNumber.Eth,
55
+ version: MorphoVaultVersion.V1,
44
56
  deploymentBlock: 19541126,
45
57
  isLegacy: true,
46
58
  };
@@ -50,6 +62,8 @@ export const MORPHO_VAULT_GAUNTLET_WETH_PRIME: MorphoVault = {
50
62
  name: 'Gauntlet WETH Prime',
51
63
  address: '0x2371e134e3455e0593363cBF89d3b6cf53740618',
52
64
  asset: 'WETH',
65
+ network: NetworkNumber.Eth,
66
+ version: MorphoVaultVersion.V1,
53
67
  deploymentBlock: 19372149,
54
68
  isLegacy: true,
55
69
  };
@@ -59,6 +73,8 @@ export const MORPHO_VAULT_BOOSTED_USDC: MorphoVault = {
59
73
  name: 'Boosted USDC',
60
74
  address: '0xd63070114470f685b75B74D60EEc7c1113d33a3D',
61
75
  asset: 'USDC',
76
+ network: NetworkNumber.Eth,
77
+ version: MorphoVaultVersion.V1,
62
78
  deploymentBlock: 20377233,
63
79
  isLegacy: true,
64
80
  };
@@ -68,6 +84,8 @@ export const MORPHO_VAULT_FLAGSHIP_USDT: MorphoVault = {
68
84
  name: 'Flagship USDT',
69
85
  address: '0x2C25f6C25770fFEC5959D34B94Bf898865e5D6b1',
70
86
  asset: 'USDT',
87
+ network: NetworkNumber.Eth,
88
+ version: MorphoVaultVersion.V1,
71
89
  deploymentBlock: 19127039,
72
90
  isLegacy: true,
73
91
  };
@@ -77,6 +95,8 @@ export const MORPHO_VAULT_GAUNTLET_USDA_CORE: MorphoVault = {
77
95
  name: 'Gauntlet USDA Core',
78
96
  address: '0x125D41A6e5dbf455cD9Df8F80BCC6fd172D52Cc6',
79
97
  asset: 'USDA',
98
+ network: NetworkNumber.Eth,
99
+ version: MorphoVaultVersion.V1,
80
100
  deploymentBlock: 19633608,
81
101
  isLegacy: true,
82
102
  };
@@ -86,6 +106,8 @@ export const MORPHO_VAULT_GAUNTLET_USDT_PRIME: MorphoVault = {
86
106
  name: 'Gauntlet USDT Prime',
87
107
  address: '0x8CB3649114051cA5119141a34C200D65dc0Faa73',
88
108
  asset: 'USDT',
109
+ network: NetworkNumber.Eth,
110
+ version: MorphoVaultVersion.V1,
89
111
  deploymentBlock: 19486541,
90
112
  isLegacy: true,
91
113
  };
@@ -95,6 +117,8 @@ export const MORPHO_VAULT_GAUNTLET_RESOLV_USDC: MorphoVault = {
95
117
  name: 'Gauntlet Resolv USDC',
96
118
  address: '0x132E6C9C33A62D7727cd359b1f51e5B566E485Eb',
97
119
  asset: 'USDC',
120
+ network: NetworkNumber.Eth,
121
+ version: MorphoVaultVersion.V1,
98
122
  deploymentBlock: 21487882,
99
123
  isLegacy: true,
100
124
  };
@@ -106,6 +130,8 @@ export const MORPHO_VAULT_STEAKHOUSE_USDT: MorphoVault = {
106
130
  name: 'Steakhouse USDT',
107
131
  address: '0xbEef047a543E45807105E51A8BBEFCc5950fcfBa',
108
132
  asset: 'USDT',
133
+ network: NetworkNumber.Eth,
134
+ version: MorphoVaultVersion.V1,
109
135
  deploymentBlock: 19043398,
110
136
  isLegacy: false,
111
137
  };
@@ -115,6 +141,8 @@ export const MORPHO_VAULT_STEAKHOUSE_USDC: MorphoVault = {
115
141
  name: 'Steakhouse USDC',
116
142
  address: '0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB',
117
143
  asset: 'USDC',
144
+ network: NetworkNumber.Eth,
145
+ version: MorphoVaultVersion.V1,
118
146
  deploymentBlock: 18928285,
119
147
  isLegacy: false,
120
148
  };
@@ -124,6 +152,8 @@ export const MORPHO_VAULT_STEAKHOUSE_ETH: MorphoVault = {
124
152
  name: 'Steakhouse WETH',
125
153
  address: '0xBEEf050ecd6a16c4e7bfFbB52Ebba7846C4b8cD4',
126
154
  asset: 'WETH',
155
+ network: NetworkNumber.Eth,
156
+ version: MorphoVaultVersion.V1,
127
157
  deploymentBlock: 19380443,
128
158
  isLegacy: false,
129
159
  };
@@ -133,6 +163,8 @@ export const MORPHO_VAULT_STEAKHOUSE_PYUSD: MorphoVault = {
133
163
  name: 'Steakhouse PYUSD',
134
164
  address: '0xbEEF02e5E13584ab96848af90261f0C8Ee04722a',
135
165
  asset: 'PYUSD',
166
+ network: NetworkNumber.Eth,
167
+ version: MorphoVaultVersion.V1,
136
168
  deploymentBlock: 19043398,
137
169
  isLegacy: false,
138
170
  };
@@ -144,6 +176,8 @@ export const MORPHO_VAULT_SMOKEHOUSE_USDT: MorphoVault = {
144
176
  name: 'Smokehouse USDT',
145
177
  address: '0xA0804346780b4c2e3bE118ac957D1DB82F9d7484',
146
178
  asset: 'USDT',
179
+ network: NetworkNumber.Eth,
180
+ version: MorphoVaultVersion.V1,
147
181
  deploymentBlock: 21522238,
148
182
  isLegacy: false,
149
183
  };
@@ -153,6 +187,8 @@ export const MORPHO_VAULT_SMOKEHOUSE_USDC: MorphoVault = {
153
187
  name: 'Smokehouse USDC',
154
188
  address: '0xBEeFFF209270748ddd194831b3fa287a5386f5bC',
155
189
  asset: 'USDC',
190
+ network: NetworkNumber.Eth,
191
+ version: MorphoVaultVersion.V1,
156
192
  deploymentBlock: 21337719,
157
193
  isLegacy: false,
158
194
  };
@@ -162,10 +198,36 @@ export const MORPHO_VAULT_SMOKEHOUSE_DAI: MorphoVault = {
162
198
  name: 'Smokehouse DAI',
163
199
  address: '0xbeeFfF68CC520D68f82641EFF84330C631E2490E',
164
200
  asset: 'DAI',
201
+ network: NetworkNumber.Eth,
202
+ version: MorphoVaultVersion.V1,
165
203
  deploymentBlock: 21343808,
166
204
  isLegacy: false,
167
205
  };
168
206
 
207
+ // Vault V2
208
+
209
+ export const MORPHO_VAULT_GAUNTLET_USDG_PREMIUM: MorphoVault = {
210
+ type: MorphoVaultType.MorphoVaultGauntletUSDGPremium,
211
+ name: 'Gauntlet USDG Premium',
212
+ address: '0x390c1bb01F3F627144a40617e287d4cE3D5aBCfa',
213
+ asset: 'USDG',
214
+ network: NetworkNumber.Arb,
215
+ version: MorphoVaultVersion.V2,
216
+ deploymentBlock: 510799903,
217
+ isLegacy: false,
218
+ };
219
+
220
+ export const MORPHO_VAULT_STEAKHOUSE_USDG_PRO: MorphoVault = {
221
+ type: MorphoVaultType.MorphoVaultSteakhouseUSDGPro,
222
+ name: 'Steakhouse USDG Pro',
223
+ address: '0xbeeFf72B77e7584a450E887125F25E8D8819016a',
224
+ asset: 'USDG',
225
+ network: NetworkNumber.Arb,
226
+ version: MorphoVaultVersion.V2,
227
+ deploymentBlock: 512247107,
228
+ isLegacy: false,
229
+ };
230
+
169
231
  export const MORPHO_VAULTS: Record<MorphoVaultType, MorphoVault> = {
170
232
  [MorphoVaultType.MorphoVaultFlagshipEth]: MORPHO_VAULT_FLAGSHIP_ETH,
171
233
  [MorphoVaultType.MorphoVaultGauntletUSDCCore]: MORPHO_VAULT_GAUNTLET_USDC_CORE,
@@ -189,6 +251,10 @@ export const MORPHO_VAULTS: Record<MorphoVaultType, MorphoVault> = {
189
251
  [MorphoVaultType.MorphoVaultSmokehouseUSDT]: MORPHO_VAULT_SMOKEHOUSE_USDT,
190
252
  [MorphoVaultType.MorphoVaultSmokehouseUSDC]: MORPHO_VAULT_SMOKEHOUSE_USDC,
191
253
  [MorphoVaultType.MorphoVaultSmokehouseDAI]: MORPHO_VAULT_SMOKEHOUSE_DAI,
254
+
255
+ // Vault V2
256
+ [MorphoVaultType.MorphoVaultGauntletUSDGPremium]: MORPHO_VAULT_GAUNTLET_USDG_PREMIUM,
257
+ [MorphoVaultType.MorphoVaultSteakhouseUSDGPro]: MORPHO_VAULT_STEAKHOUSE_USDG_PRO,
192
258
  };
193
259
 
194
260
  export const getMorphoVault = (type: MorphoVaultType): MorphoVault => MORPHO_VAULTS[type];
@@ -108,6 +108,7 @@ export const _getSparkMarketsData = async (provider: Client, network: NetworkNum
108
108
  collateralAssets: eModeCategoriesData[emodeCategoryId] ? [...eModeCategoriesData[emodeCategoryId].collateralAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
109
109
  borrowAssets: eModeCategoriesData[emodeCategoryId] ? [...eModeCategoriesData[emodeCategoryId].borrowAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
110
110
  ltvZeroAssets: [],
111
+ isolated: false,
111
112
  };
112
113
 
113
114
  return ({
@@ -137,6 +137,34 @@ export const calculateInterestEarned = (principal: string, interest: string, typ
137
137
  return (+principal * (((1 + (+interest / 100) / BLOCKS_IN_A_YEAR)) ** (BLOCKS_IN_A_YEAR * interval))) - +principal; // eslint-disable-line
138
138
  };
139
139
 
140
+ /**
141
+ * Net APY for positions that have a single known borrow rate (and optionally a single supply rate)
142
+ * instead of per-asset `assetsData` to feed into `calculateNetApy` (Maker, crvUSD, Liquity v1).
143
+ * All rates are yearly percentages that are already compounded. `incentives` are extra yields
144
+ * (e.g. the native staking yield of the collateral) applied to their own USD base and summed into `incentiveUsd`.
145
+ */
146
+ export const calculateNetApyFromRates = ({
147
+ suppliedUsd, borrowedUsd, supplyRate = '0', borrowRate = '0', incentives = [],
148
+ }: {
149
+ suppliedUsd: string,
150
+ borrowedUsd: string,
151
+ supplyRate?: string,
152
+ borrowRate?: string,
153
+ incentives?: { apy: string, amountUsd: string }[],
154
+ }) => {
155
+ const supplyInterest = new Dec(calculateInterestEarned(suppliedUsd, supplyRate, 'year', true));
156
+ const borrowInterest = new Dec(calculateInterestEarned(borrowedUsd, borrowRate, 'year', true));
157
+ const incentiveUsd = incentives
158
+ .reduce((acc, { apy, amountUsd }) => acc.add(calculateInterestEarned(amountUsd, apy, 'year', true)), new Dec(0))
159
+ .toString();
160
+
161
+ const totalInterestUsd = supplyInterest.sub(borrowInterest).add(incentiveUsd).toString();
162
+ const balance = new Dec(suppliedUsd).sub(borrowedUsd);
163
+ const netApy = balance.isZero() ? '0' : new Dec(totalInterestUsd).div(balance).times(100).toString();
164
+
165
+ return { netApy, totalInterestUsd, incentiveUsd };
166
+ };
167
+
140
168
  export const calculateNetApy = ({
141
169
  usedAssets, assetsData, optionalData,
142
170
  }: { usedAssets: MMUsedAssets, assetsData: MMAssetsData, optionalData?: any }) => {
package/src/types/aave.ts CHANGED
@@ -49,6 +49,7 @@ export interface EModeCategoryData {
49
49
  borrowAssets: string[],
50
50
  ltvzeroBitmap?: string,
51
51
  ltvZeroAssets: string[],
52
+ isolated: boolean,
52
53
  }
53
54
  export interface EModeCategoryDataMapping {
54
55
  enteringTerms: boolean[],
@@ -155,6 +156,8 @@ export interface AavePositionData extends MMPositionData, AavePositionAggregated
155
156
  collRatio: string,
156
157
  // Safety ratio as evaluated by automation bots (LTV-0 collateral credited at LLTV - 5%). Aave v3 only.
157
158
  safetyRatioWithLtvZeroFallback?: string,
159
+ // Normalised safety ratio (100 = liquidation on every protocol). Aave v3: the LTV-0 fallback ratio, Aave v2: `ratio`.
160
+ safetyRatio?: string,
158
161
  suppliedUsd: string,
159
162
  borrowedUsd: string,
160
163
  borrowLimitUsd: string,
@@ -194,6 +197,7 @@ export interface AaveV3AggregatedPositionData {
194
197
  collRatio: string,
195
198
  borrowLimitWithLtvZeroFallbackUsd: string,
196
199
  safetyRatioWithLtvZeroFallback: string,
200
+ safetyRatio: string,
197
201
  netApy: string,
198
202
  incentiveUsd: string,
199
203
  totalInterestUsd: string,
@@ -219,3 +223,89 @@ export interface AaveHelperCommon {
219
223
  selectedMarket: Partial<AaveMarketInfo>,
220
224
  network?: NetworkNumber,
221
225
  }
226
+
227
+ export interface SghoUserData {
228
+ shares: string;
229
+ balance: string;
230
+ maxDeposit: string;
231
+ maxWithdraw: string;
232
+ underlyingBalance: string;
233
+ }
234
+
235
+ export interface SghoData {
236
+ totalAssets: string;
237
+ totalSupply: string;
238
+ supplyCap: string;
239
+ /** Target savings rate as an APY percent (e.g. "4.25" for 4.25%). */
240
+ targetRate: string;
241
+ paused: boolean;
242
+ user: SghoUserData;
243
+ }
244
+
245
+ /** stkAAVE, stkGHO and sGHO of an address, from getStakeAaveData. */
246
+ export interface StakeAaveData {
247
+ activatedCooldown: string,
248
+ activatedCooldownAmount: string,
249
+ stkAaveRewardsBalance: string,
250
+ aaveRewardsBalance: string,
251
+ stkAaveBalance: string,
252
+ stkGhoBalance: string,
253
+ ghoMeritApy: string,
254
+ stkAaveApy: string,
255
+ sgho: SghoData,
256
+ }
257
+
258
+ export interface UmbrellaTokenInfo {
259
+ token: EthAddress,
260
+ /** USD, converted from the oracle's 8 decimals. */
261
+ price: string,
262
+ name: string,
263
+ symbol: string,
264
+ decimals: number,
265
+ }
266
+
267
+ export interface UmbrellaRewardTokenData {
268
+ rewardTokenData: UmbrellaTokenInfo,
269
+ maxEmissionPerSecond: bigint,
270
+ distributionEnd: bigint,
271
+ }
272
+
273
+ export interface UmbrellaStakingAccountData {
274
+ stakeUserBalance: string,
275
+ rewardsTokenUserData: { reward: EthAddress, currentReward: string }[],
276
+ userCooldownAmount: string,
277
+ // Passed through unconverted: the view's bigint, or '0' when the view returns none.
278
+ userEndOfCooldown: bigint | string,
279
+ userWithdrawalWindow: bigint | string,
280
+ }
281
+
282
+ /**
283
+ * One Umbrella stake token of an address, from getUmbrellaData: the view contracts' structs merged, with the amounts
284
+ * the app reads converted to decimal strings. The bigint fields are the views' raw values, as the SDK passes them.
285
+ */
286
+ export interface UmbrellaStakingTokenData {
287
+ stakeTokenData: UmbrellaTokenInfo,
288
+ totalAssets: string,
289
+ targetLiquidity: string,
290
+ isStakeConfigured: boolean,
291
+ rewardsTokenData: UmbrellaRewardTokenData[],
292
+ stakeToken: EthAddress,
293
+ stakeUserBalance: bigint,
294
+ rewardsTokenUserData: { reward: EthAddress, currentReward: bigint }[],
295
+ stkToken: EthAddress,
296
+ totalShares: string,
297
+ stkUnderlyingToken: EthAddress,
298
+ aToken: EthAddress,
299
+ cooldownPeriod: bigint,
300
+ unstakeWindow: bigint,
301
+ stkTokenToWaTokenRate: string,
302
+ waTokenToATokenRate: string,
303
+ rewardsEmissionRates: string[],
304
+ userCooldownAmount: bigint,
305
+ userEndOfCooldown: bigint,
306
+ userWithdrawalWindow: bigint,
307
+ account: UmbrellaStakingAccountData,
308
+ }
309
+
310
+ /** Keyed by Umbrella stake (UmbrellaGHO, UmbrellaUSDC, UmbrellaUSDT, UmbrellaETH). */
311
+ export type UmbrellaStakingData = Record<string, UmbrellaStakingTokenData>;
@@ -183,6 +183,7 @@ export interface AaveV4AggregatedPositionData {
183
183
  leftToBorrowUsd: string,
184
184
  ratio: string,
185
185
  collRatio: string,
186
+ safetyRatio: string,
186
187
  liqRatio: string,
187
188
  liqPercent: string,
188
189
  leveragedType: LeverageType,
@@ -206,3 +207,52 @@ export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
206
207
  healthFactor: string,
207
208
  riskPremiumBps: number,
208
209
  }
210
+
211
+ /** One Aave V4 tokenized spoke (Lend vault) as the view contract returns it for a user. */
212
+ export interface AaveV4TokenizationSpokeData {
213
+ underlyingAsset: EthAddress;
214
+ assetId: string;
215
+ decimals: number;
216
+ spoke: EthAddress;
217
+ spokeActive: boolean;
218
+ spokeHalted: boolean;
219
+ spokeDepositCap: string;
220
+ spokeTotalAssets: string;
221
+ spokeTotalShares: string;
222
+ hub: EthAddress;
223
+ hubLiquidity: string;
224
+ hubDrawnRate: string;
225
+ convertToShares: string;
226
+ convertToAssets: string;
227
+ user: EthAddress;
228
+ userSuppliedAssets: string;
229
+ userSuppliedShares: string;
230
+ }
231
+
232
+ /** Parsed tokenization spoke data with human-readable supplied amounts for display */
233
+ export interface AaveV4TokenizationSpokeDataParsed {
234
+ vaultAddress: EthAddress;
235
+ key: string | null;
236
+ symbol: string;
237
+ hubKey: string;
238
+ // ---- Spoke ----
239
+ spokeActive: boolean;
240
+ spokeHalted: boolean;
241
+ /** Deposit cap in asset units (wei string) */
242
+ spokeDepositCap: string;
243
+ /** Total assets currently in spoke in asset units (wei string) */
244
+ spokeTotalAssets: string;
245
+ // ---- Hub ----
246
+ /** Available hub liquidity in asset units (wei string) */
247
+ hubLiquidity: string;
248
+ /** The conversion rate from assets to shares expressed in asset units. */
249
+ convertToShares: string;
250
+ // ---- User ----
251
+ userSuppliedAssetsEth: string;
252
+ userSuppliedSharesEth: string;
253
+ userSuppliedAssets: string;
254
+ userSuppliedShares: string;
255
+ underlyingAsset: EthAddress;
256
+ spoke: EthAddress;
257
+ decimals: number;
258
+ }
@@ -128,6 +128,7 @@ export interface CompoundAggregatedPositionData {
128
128
  leftToBorrowUsd: string,
129
129
  ratio: string,
130
130
  collRatio: string,
131
+ safetyRatio: string,
131
132
  netApy: string,
132
133
  incentiveUsd: string,
133
134
  totalInterestUsd: string,
@@ -148,6 +149,7 @@ export interface CompoundAggregatedPositionData {
148
149
  export interface CompoundPositionData extends MMPositionData {
149
150
  ratio: string,
150
151
  minRatio: string,
152
+ safetyRatio?: string,
151
153
  suppliedUsd: string,
152
154
  borrowedUsd: string,
153
155
  borrowLimitUsd: string,
@@ -83,6 +83,10 @@ export interface CrvUSDAggregatedPositionData {
83
83
  collFactor: string,
84
84
  leveragedType: LeverageType,
85
85
  exposure: string,
86
+ // Yearly net return (%) on the position's equity: market borrow rate on crvUSD debt vs native yield of staked collateral.
87
+ netApy: string,
88
+ totalInterestUsd: string,
89
+ incentiveUsd: string,
86
90
  leveragedAsset?: string,
87
91
  liquidationPrice?: string,
88
92
  }
@@ -131,6 +135,9 @@ export interface CrvUSDUserData extends CrvUSDPositionAggregatedFields {
131
135
  collateralPrice: string,
132
136
  collRatio: string,
133
137
  exposure: string,
138
+ netApy: string,
139
+ totalInterestUsd: string,
140
+ incentiveUsd: string,
134
141
  // Fields of crvUSDView's userData that _getCurveUsdUserData spreads in unconverted. Optional, so objects built by
135
142
  // hand still type-check.
136
143
  marketCollateralAmount?: bigint,
@@ -344,6 +344,7 @@ export interface FluidAggregatedVaultData {
344
344
  merklBorrowIncentives: IncentiveData[],
345
345
  ratio: string,
346
346
  collRatio: string,
347
+ safetyRatio: string,
347
348
  minRatio: string,
348
349
  totalInterestUsd: string,
349
350
  leveragedType?: LeverageType,
@@ -487,3 +488,17 @@ export interface FluidFTokenDataStructOutput {
487
488
  rewardsRate: bigint;
488
489
  withdrawable: bigint;
489
490
  }
491
+
492
+ /** One Fluid lending (fToken) deposit of an address, from getAllUserEarnPositionsWithFTokens and getFluidDepositData. */
493
+ export interface FluidEarnPositionData {
494
+ fTokenAddress: string | undefined,
495
+ fTokenSymbol: string,
496
+ decimals: string,
497
+ totalDeposited: string,
498
+ withdrawable: string,
499
+ apy: string,
500
+ depositRate: string,
501
+ withdrawRate: string,
502
+ deposited: string,
503
+ depositedShares: string,
504
+ }
@@ -14,4 +14,5 @@ export * from './merit';
14
14
  export * from './merkl';
15
15
  export * from './savings';
16
16
  export * from './common';
17
- export * from './aaveV4';
17
+ export * from './aaveV4';
18
+ export * from './claiming';
@@ -26,7 +26,25 @@ export interface LiquityTroveInfo {
26
26
  totalETH: string,
27
27
  totalLUSD: string,
28
28
  minCollateralRatio: number,
29
+ // Collateral ratio rebased so 100 sits on `minCollateralRatio` (normalised safety ratio).
30
+ safetyRatio: string,
29
31
  priceForRecovery: string,
30
32
  debtInFront: string,
31
33
  exposure: string,
32
- }
34
+ // Always '0' for Liquity v1: LUSD debt is interest free (one-off borrowing fee only) and ETH collateral earns no yield.
35
+ netApy: string,
36
+ totalInterestUsd: string,
37
+ incentiveUsd: string,
38
+ }
39
+ /** LQTY staking and the LUSD stability pool deposit of an address, from getLiquityStakingData. */
40
+ export interface LiquityStakingData {
41
+ totalLUSDDeposited: string,
42
+ totalLQTYStaked: string,
43
+ stakedLQTY: string,
44
+ stakedLUSDBalance: string,
45
+ rewardETH: string,
46
+ rewardLUSD: string,
47
+ stabilityRewardETH: string,
48
+ stabilityRewardLQTY: string,
49
+ showStakingBalances: boolean,
50
+ }
@@ -104,6 +104,7 @@ export interface LiquityV2AggregatedTroveData {
104
104
  liquidationPrice: string,
105
105
  ratio: string,
106
106
  collRatio: string,
107
+ safetyRatio: string,
107
108
  exposure: string,
108
109
  }
109
110
 
@@ -112,6 +113,7 @@ export interface LiquityV2TroveData {
112
113
  troveId: string,
113
114
  ratio: string,
114
115
  collRatio: string,
116
+ safetyRatio?: string,
115
117
  liqRatio: string,
116
118
  borrowLimitRatio: string,
117
119
  interestRate: string,
@@ -131,4 +133,29 @@ export interface LiquityV2TroveData {
131
133
  debtInFront: string,
132
134
  lastInterestRateAdjTime: string,
133
135
  exposure: string,
134
- }
136
+ }
137
+ /** The stability pool deposit of an address in one market, from getLiquityV2Staking. */
138
+ export interface LiquityV2StakingData {
139
+ totalBOLDDeposited: string,
140
+ stakedBOLDBalance: string,
141
+ stabilityRewardColl: string,
142
+ stabilityRewardYield: string,
143
+ showStakingBalances: boolean,
144
+ debtTokenBalance: string,
145
+ stabilityPoolApy: string,
146
+ }
147
+
148
+ /** sBOLD, yBOLD and stYBOLD of an address, from getLiquitySAndYBold. */
149
+ export interface LiquityV2SBoldYBoldData {
150
+ spApy: string,
151
+ yBoldApy: string,
152
+ totalBoldDepositedSBold: string,
153
+ boldRateSBold: string,
154
+ maxWithdrawSBold: string,
155
+ totalBoldDepositedYBold: string,
156
+ boldRateYBold: string,
157
+ maxWithdrawYBold: string,
158
+ sBoldBalance: string,
159
+ yBoldBalance: string,
160
+ stYBoldBalance: string,
161
+ }
@@ -47,6 +47,8 @@ export interface CdpData {
47
47
  debtAssetMarketPrice: string,
48
48
  liquidationPrice: string,
49
49
  ratio: string,
50
+ // Collateral ratio rebased so 100 sits on `liqPercent` (normalised safety ratio).
51
+ safetyRatio: string,
50
52
  liqRatio: string,
51
53
  liqPercent: number,
52
54
  assetPrice: string,
@@ -62,4 +64,8 @@ export interface CdpData {
62
64
  liquidationFee: string,
63
65
  lastUpdated: number,
64
66
  exposure: string,
67
+ // Yearly net return (%) on the vault's equity: stability fee on DAI debt vs native yield of staked collateral.
68
+ netApy: string,
69
+ totalInterestUsd: string,
70
+ incentiveUsd: string,
65
71
  }
@@ -206,6 +206,7 @@ export interface MorphoBlueAggregatedPositionData {
206
206
  totalInterestUsd: string,
207
207
  ltv: string,
208
208
  ratio: string,
209
+ safetyRatio: string, // borrowLimitUsd / borrowedUsd as a percentage (100 = liquidation)
209
210
  leveragedType: LeverageType,
210
211
  leveragedAsset?: string,
211
212
  currentVolatilePairRatio?: string,
@@ -229,6 +230,7 @@ export interface MorphoBluePositionData {
229
230
  totalInterestUsd: string,
230
231
  ltv: string,
231
232
  ratio: string,
233
+ safetyRatio?: string,
232
234
  leveragedType: LeverageType,
233
235
  leveragedAsset?: string,
234
236
  currentVolatilePairRatio?: string,
@@ -191,6 +191,7 @@ export interface MorphoMidnightAggregatedPositionData {
191
191
  ltv: string,
192
192
  ratio: string, // health ratio as a percentage (from MidnightView.ratio, 1e18-scaled)
193
193
  healthRatio: string, // liquidationLimitUsd / borrowedUsd
194
+ safetyRatio: string, // borrowLimitUsd / borrowedUsd as a percentage (100 = liquidation)
194
195
  leveragedType: LeverageType,
195
196
  leveragedAsset?: string,
196
197
  currentVolatilePairRatio?: string,