@defisaver/positions-sdk 2.1.160-shifter-v2-dev → 2.1.161-aave-3.7-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/aaveV2/index.js +0 -2
- package/cjs/aaveV3/index.js +7 -1
- package/cjs/curveUsd/index.d.ts +2 -5
- package/cjs/curveUsd/index.js +15 -30
- package/cjs/fluid/index.d.ts +0 -5
- package/cjs/fluid/index.js +1 -36
- package/cjs/helpers/aaveHelpers/index.d.ts +9 -1
- package/cjs/helpers/aaveHelpers/index.js +23 -9
- package/cjs/helpers/aaveV4Helpers/index.js +0 -1
- package/cjs/helpers/compoundHelpers/index.js +0 -2
- package/cjs/helpers/curveUsdHelpers/index.d.ts +1 -3
- package/cjs/helpers/curveUsdHelpers/index.js +2 -16
- package/cjs/helpers/fluidHelpers/index.js +0 -1
- package/cjs/helpers/liquityV2Helpers/index.js +0 -1
- package/cjs/helpers/llamaLendHelpers/index.js +0 -2
- package/cjs/helpers/makerHelpers/index.d.ts +1 -1
- package/cjs/helpers/makerHelpers/index.js +2 -2
- package/cjs/helpers/morphoBlueHelpers/index.js +0 -2
- package/cjs/helpers/morphoMidnightHelpers/index.js +0 -2
- package/cjs/helpers/sparkHelpers/index.js +0 -1
- package/cjs/liquity/index.js +2 -16
- package/cjs/maker/index.d.ts +2 -7
- package/cjs/maker/index.js +12 -45
- package/cjs/markets/index.d.ts +0 -1
- package/cjs/markets/index.js +1 -3
- package/cjs/portfolio/index.d.ts +1 -5
- package/cjs/portfolio/index.js +2 -274
- package/cjs/savings/index.js +5 -2
- package/cjs/savings/morphoVaults/index.d.ts +1 -1
- package/cjs/savings/morphoVaults/index.js +56 -18
- package/cjs/savings/morphoVaults/options.d.ts +2 -0
- package/cjs/savings/morphoVaults/options.js +61 -1
- package/cjs/spark/index.js +1 -0
- package/cjs/staking/staking.d.ts +0 -20
- package/cjs/staking/staking.js +1 -19
- package/cjs/types/aave.d.ts +1 -2
- package/cjs/types/aaveV4.d.ts +0 -1
- package/cjs/types/compound.d.ts +0 -2
- package/cjs/types/curveUsd.d.ts +0 -6
- package/cjs/types/fluid.d.ts +0 -1
- package/cjs/types/liquity.d.ts +0 -4
- package/cjs/types/liquityV2.d.ts +0 -2
- package/cjs/types/maker.d.ts +0 -4
- package/cjs/types/morphoBlue.d.ts +0 -2
- package/cjs/types/morphoMidnight.d.ts +0 -1
- package/cjs/types/portfolio.d.ts +10 -26
- package/cjs/types/savings/morphoVaults.d.ts +10 -2
- package/cjs/types/savings/morphoVaults.js +9 -1
- package/cjs/types/spark.d.ts +0 -2
- package/esm/aaveV2/index.js +0 -2
- package/esm/aaveV3/index.js +7 -1
- package/esm/curveUsd/index.d.ts +2 -5
- package/esm/curveUsd/index.js +15 -30
- package/esm/fluid/index.d.ts +0 -5
- package/esm/fluid/index.js +0 -33
- package/esm/helpers/aaveHelpers/index.d.ts +9 -1
- package/esm/helpers/aaveHelpers/index.js +20 -8
- package/esm/helpers/aaveV4Helpers/index.js +0 -1
- package/esm/helpers/compoundHelpers/index.js +0 -2
- package/esm/helpers/curveUsdHelpers/index.d.ts +1 -3
- package/esm/helpers/curveUsdHelpers/index.js +2 -16
- package/esm/helpers/fluidHelpers/index.js +0 -1
- package/esm/helpers/liquityV2Helpers/index.js +0 -1
- package/esm/helpers/llamaLendHelpers/index.js +0 -2
- package/esm/helpers/makerHelpers/index.d.ts +1 -1
- package/esm/helpers/makerHelpers/index.js +2 -2
- package/esm/helpers/morphoBlueHelpers/index.js +0 -2
- package/esm/helpers/morphoMidnightHelpers/index.js +0 -2
- package/esm/helpers/sparkHelpers/index.js +0 -1
- package/esm/liquity/index.js +2 -16
- package/esm/maker/index.d.ts +2 -7
- package/esm/maker/index.js +13 -44
- package/esm/markets/index.d.ts +0 -1
- package/esm/markets/index.js +0 -1
- package/esm/portfolio/index.d.ts +1 -5
- package/esm/portfolio/index.js +5 -276
- package/esm/savings/index.js +5 -2
- package/esm/savings/morphoVaults/index.d.ts +1 -1
- package/esm/savings/morphoVaults/index.js +57 -19
- package/esm/savings/morphoVaults/options.d.ts +2 -0
- package/esm/savings/morphoVaults/options.js +61 -1
- package/esm/spark/index.js +1 -0
- package/esm/staking/staking.d.ts +0 -20
- package/esm/staking/staking.js +0 -17
- package/esm/types/aave.d.ts +1 -2
- package/esm/types/aaveV4.d.ts +0 -1
- package/esm/types/compound.d.ts +0 -2
- package/esm/types/curveUsd.d.ts +0 -6
- package/esm/types/fluid.d.ts +0 -1
- package/esm/types/liquity.d.ts +0 -4
- package/esm/types/liquityV2.d.ts +0 -2
- package/esm/types/maker.d.ts +0 -4
- package/esm/types/morphoBlue.d.ts +0 -2
- package/esm/types/morphoMidnight.d.ts +0 -1
- package/esm/types/portfolio.d.ts +10 -26
- package/esm/types/savings/morphoVaults.d.ts +10 -2
- package/esm/types/savings/morphoVaults.js +8 -0
- package/esm/types/spark.d.ts +0 -2
- package/package.json +1 -1
- package/src/aaveV2/index.ts +0 -2
- package/src/aaveV3/index.ts +6 -1
- package/src/curveUsd/index.ts +16 -33
- package/src/fluid/index.ts +0 -40
- package/src/helpers/aaveHelpers/index.ts +24 -10
- package/src/helpers/aaveV4Helpers/index.ts +0 -1
- package/src/helpers/compoundHelpers/index.ts +0 -2
- package/src/helpers/curveUsdHelpers/index.ts +2 -23
- package/src/helpers/fluidHelpers/index.ts +0 -1
- package/src/helpers/liquityV2Helpers/index.ts +0 -1
- package/src/helpers/llamaLendHelpers/index.ts +0 -2
- package/src/helpers/makerHelpers/index.ts +1 -2
- package/src/helpers/morphoBlueHelpers/index.ts +0 -2
- package/src/helpers/morphoMidnightHelpers/index.ts +0 -2
- package/src/helpers/sparkHelpers/index.ts +0 -1
- package/src/liquity/index.ts +2 -17
- package/src/maker/index.ts +29 -77
- package/src/markets/index.ts +1 -2
- package/src/portfolio/index.ts +4 -259
- package/src/savings/index.ts +5 -2
- package/src/savings/morphoVaults/index.ts +73 -21
- package/src/savings/morphoVaults/options.ts +67 -1
- package/src/spark/index.ts +1 -0
- package/src/staking/staking.ts +0 -28
- package/src/types/aave.ts +1 -3
- package/src/types/aaveV4.ts +0 -1
- package/src/types/compound.ts +0 -2
- package/src/types/curveUsd.ts +0 -7
- package/src/types/fluid.ts +0 -1
- package/src/types/liquity.ts +0 -6
- package/src/types/liquityV2.ts +0 -2
- package/src/types/maker.ts +0 -6
- package/src/types/morphoBlue.ts +0 -2
- package/src/types/morphoMidnight.ts +0 -1
- package/src/types/portfolio.ts +12 -31
- package/src/types/savings/morphoVaults.ts +11 -1
- package/src/types/spark.ts +0 -2
- package/cjs/markets/maker/index.d.ts +0 -1
- package/cjs/markets/maker/index.js +0 -13
- package/esm/markets/maker/index.d.ts +0 -1
- package/esm/markets/maker/index.js +0 -10
- package/src/markets/maker/index.ts +0 -10
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { MorphoVaultType } from '../../types';
|
|
1
|
+
import { MorphoVaultType, MorphoVaultVersion, NetworkNumber, } from '../../types';
|
|
2
2
|
export const MORPHO_VAULT_FLAGSHIP_ETH = {
|
|
3
3
|
type: MorphoVaultType.MorphoVaultFlagshipEth,
|
|
4
4
|
name: 'Flagship ETH',
|
|
5
5
|
address: '0x38989BBA00BDF8181F4082995b3DEAe96163aC5D',
|
|
6
6
|
asset: 'WETH',
|
|
7
|
+
network: NetworkNumber.Eth,
|
|
8
|
+
version: MorphoVaultVersion.V1,
|
|
7
9
|
deploymentBlock: 18927491,
|
|
8
10
|
isLegacy: true,
|
|
9
11
|
};
|
|
@@ -12,6 +14,8 @@ export const MORPHO_VAULT_GAUNTLET_USDC_CORE = {
|
|
|
12
14
|
name: 'Gauntlet USDC Core',
|
|
13
15
|
address: '0x8eB67A509616cd6A7c1B3c8C21D48FF57df3d458',
|
|
14
16
|
asset: 'USDC',
|
|
17
|
+
network: NetworkNumber.Eth,
|
|
18
|
+
version: MorphoVaultVersion.V1,
|
|
15
19
|
deploymentBlock: 19777569,
|
|
16
20
|
isLegacy: true,
|
|
17
21
|
};
|
|
@@ -20,6 +24,8 @@ export const MORPHO_VAULT_GAUNTLET_USDC_PRIME = {
|
|
|
20
24
|
name: 'Gauntlet USDC Prime',
|
|
21
25
|
address: '0xdd0f28e19C1780eb6396170735D45153D261490d',
|
|
22
26
|
asset: 'USDC',
|
|
27
|
+
network: NetworkNumber.Eth,
|
|
28
|
+
version: MorphoVaultVersion.V1,
|
|
23
29
|
deploymentBlock: 19777569,
|
|
24
30
|
isLegacy: true,
|
|
25
31
|
};
|
|
@@ -28,6 +34,8 @@ export const MORPHO_VAULT_RE7_WETH = {
|
|
|
28
34
|
name: 'RE7 WETH',
|
|
29
35
|
address: '0x78Fc2c2eD1A4cDb5402365934aE5648aDAd094d0',
|
|
30
36
|
asset: 'WETH',
|
|
37
|
+
network: NetworkNumber.Eth,
|
|
38
|
+
version: MorphoVaultVersion.V1,
|
|
31
39
|
deploymentBlock: 19121118,
|
|
32
40
|
isLegacy: true,
|
|
33
41
|
};
|
|
@@ -36,6 +44,8 @@ export const MORPHO_VAULT_GAUNTLET_WETH_CORE = {
|
|
|
36
44
|
name: 'Gauntlet WETH Core',
|
|
37
45
|
address: '0x4881Ef0BF6d2365D3dd6499ccd7532bcdBCE0658',
|
|
38
46
|
asset: 'WETH',
|
|
47
|
+
network: NetworkNumber.Eth,
|
|
48
|
+
version: MorphoVaultVersion.V1,
|
|
39
49
|
deploymentBlock: 19541126,
|
|
40
50
|
isLegacy: true,
|
|
41
51
|
};
|
|
@@ -44,6 +54,8 @@ export const MORPHO_VAULT_GAUNTLET_WETH_PRIME = {
|
|
|
44
54
|
name: 'Gauntlet WETH Prime',
|
|
45
55
|
address: '0x2371e134e3455e0593363cBF89d3b6cf53740618',
|
|
46
56
|
asset: 'WETH',
|
|
57
|
+
network: NetworkNumber.Eth,
|
|
58
|
+
version: MorphoVaultVersion.V1,
|
|
47
59
|
deploymentBlock: 19372149,
|
|
48
60
|
isLegacy: true,
|
|
49
61
|
};
|
|
@@ -52,6 +64,8 @@ export const MORPHO_VAULT_BOOSTED_USDC = {
|
|
|
52
64
|
name: 'Boosted USDC',
|
|
53
65
|
address: '0xd63070114470f685b75B74D60EEc7c1113d33a3D',
|
|
54
66
|
asset: 'USDC',
|
|
67
|
+
network: NetworkNumber.Eth,
|
|
68
|
+
version: MorphoVaultVersion.V1,
|
|
55
69
|
deploymentBlock: 20377233,
|
|
56
70
|
isLegacy: true,
|
|
57
71
|
};
|
|
@@ -60,6 +74,8 @@ export const MORPHO_VAULT_FLAGSHIP_USDT = {
|
|
|
60
74
|
name: 'Flagship USDT',
|
|
61
75
|
address: '0x2C25f6C25770fFEC5959D34B94Bf898865e5D6b1',
|
|
62
76
|
asset: 'USDT',
|
|
77
|
+
network: NetworkNumber.Eth,
|
|
78
|
+
version: MorphoVaultVersion.V1,
|
|
63
79
|
deploymentBlock: 19127039,
|
|
64
80
|
isLegacy: true,
|
|
65
81
|
};
|
|
@@ -68,6 +84,8 @@ export const MORPHO_VAULT_GAUNTLET_USDA_CORE = {
|
|
|
68
84
|
name: 'Gauntlet USDA Core',
|
|
69
85
|
address: '0x125D41A6e5dbf455cD9Df8F80BCC6fd172D52Cc6',
|
|
70
86
|
asset: 'USDA',
|
|
87
|
+
network: NetworkNumber.Eth,
|
|
88
|
+
version: MorphoVaultVersion.V1,
|
|
71
89
|
deploymentBlock: 19633608,
|
|
72
90
|
isLegacy: true,
|
|
73
91
|
};
|
|
@@ -76,6 +94,8 @@ export const MORPHO_VAULT_GAUNTLET_USDT_PRIME = {
|
|
|
76
94
|
name: 'Gauntlet USDT Prime',
|
|
77
95
|
address: '0x8CB3649114051cA5119141a34C200D65dc0Faa73',
|
|
78
96
|
asset: 'USDT',
|
|
97
|
+
network: NetworkNumber.Eth,
|
|
98
|
+
version: MorphoVaultVersion.V1,
|
|
79
99
|
deploymentBlock: 19486541,
|
|
80
100
|
isLegacy: true,
|
|
81
101
|
};
|
|
@@ -84,6 +104,8 @@ export const MORPHO_VAULT_GAUNTLET_RESOLV_USDC = {
|
|
|
84
104
|
name: 'Gauntlet Resolv USDC',
|
|
85
105
|
address: '0x132E6C9C33A62D7727cd359b1f51e5B566E485Eb',
|
|
86
106
|
asset: 'USDC',
|
|
107
|
+
network: NetworkNumber.Eth,
|
|
108
|
+
version: MorphoVaultVersion.V1,
|
|
87
109
|
deploymentBlock: 21487882,
|
|
88
110
|
isLegacy: true,
|
|
89
111
|
};
|
|
@@ -93,6 +115,8 @@ export const MORPHO_VAULT_STEAKHOUSE_USDT = {
|
|
|
93
115
|
name: 'Steakhouse USDT',
|
|
94
116
|
address: '0xbEef047a543E45807105E51A8BBEFCc5950fcfBa',
|
|
95
117
|
asset: 'USDT',
|
|
118
|
+
network: NetworkNumber.Eth,
|
|
119
|
+
version: MorphoVaultVersion.V1,
|
|
96
120
|
deploymentBlock: 19043398,
|
|
97
121
|
isLegacy: false,
|
|
98
122
|
};
|
|
@@ -101,6 +125,8 @@ export const MORPHO_VAULT_STEAKHOUSE_USDC = {
|
|
|
101
125
|
name: 'Steakhouse USDC',
|
|
102
126
|
address: '0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB',
|
|
103
127
|
asset: 'USDC',
|
|
128
|
+
network: NetworkNumber.Eth,
|
|
129
|
+
version: MorphoVaultVersion.V1,
|
|
104
130
|
deploymentBlock: 18928285,
|
|
105
131
|
isLegacy: false,
|
|
106
132
|
};
|
|
@@ -109,6 +135,8 @@ export const MORPHO_VAULT_STEAKHOUSE_ETH = {
|
|
|
109
135
|
name: 'Steakhouse WETH',
|
|
110
136
|
address: '0xBEEf050ecd6a16c4e7bfFbB52Ebba7846C4b8cD4',
|
|
111
137
|
asset: 'WETH',
|
|
138
|
+
network: NetworkNumber.Eth,
|
|
139
|
+
version: MorphoVaultVersion.V1,
|
|
112
140
|
deploymentBlock: 19380443,
|
|
113
141
|
isLegacy: false,
|
|
114
142
|
};
|
|
@@ -117,6 +145,8 @@ export const MORPHO_VAULT_STEAKHOUSE_PYUSD = {
|
|
|
117
145
|
name: 'Steakhouse PYUSD',
|
|
118
146
|
address: '0xbEEF02e5E13584ab96848af90261f0C8Ee04722a',
|
|
119
147
|
asset: 'PYUSD',
|
|
148
|
+
network: NetworkNumber.Eth,
|
|
149
|
+
version: MorphoVaultVersion.V1,
|
|
120
150
|
deploymentBlock: 19043398,
|
|
121
151
|
isLegacy: false,
|
|
122
152
|
};
|
|
@@ -126,6 +156,8 @@ export const MORPHO_VAULT_SMOKEHOUSE_USDT = {
|
|
|
126
156
|
name: 'Smokehouse USDT',
|
|
127
157
|
address: '0xA0804346780b4c2e3bE118ac957D1DB82F9d7484',
|
|
128
158
|
asset: 'USDT',
|
|
159
|
+
network: NetworkNumber.Eth,
|
|
160
|
+
version: MorphoVaultVersion.V1,
|
|
129
161
|
deploymentBlock: 21522238,
|
|
130
162
|
isLegacy: false,
|
|
131
163
|
};
|
|
@@ -134,6 +166,8 @@ export const MORPHO_VAULT_SMOKEHOUSE_USDC = {
|
|
|
134
166
|
name: 'Smokehouse USDC',
|
|
135
167
|
address: '0xBEeFFF209270748ddd194831b3fa287a5386f5bC',
|
|
136
168
|
asset: 'USDC',
|
|
169
|
+
network: NetworkNumber.Eth,
|
|
170
|
+
version: MorphoVaultVersion.V1,
|
|
137
171
|
deploymentBlock: 21337719,
|
|
138
172
|
isLegacy: false,
|
|
139
173
|
};
|
|
@@ -142,9 +176,32 @@ export const MORPHO_VAULT_SMOKEHOUSE_DAI = {
|
|
|
142
176
|
name: 'Smokehouse DAI',
|
|
143
177
|
address: '0xbeeFfF68CC520D68f82641EFF84330C631E2490E',
|
|
144
178
|
asset: 'DAI',
|
|
179
|
+
network: NetworkNumber.Eth,
|
|
180
|
+
version: MorphoVaultVersion.V1,
|
|
145
181
|
deploymentBlock: 21343808,
|
|
146
182
|
isLegacy: false,
|
|
147
183
|
};
|
|
184
|
+
// Vault V2
|
|
185
|
+
export const MORPHO_VAULT_GAUNTLET_USDG_PREMIUM = {
|
|
186
|
+
type: MorphoVaultType.MorphoVaultGauntletUSDGPremium,
|
|
187
|
+
name: 'Gauntlet USDG Premium',
|
|
188
|
+
address: '0x390c1bb01F3F627144a40617e287d4cE3D5aBCfa',
|
|
189
|
+
asset: 'USDG',
|
|
190
|
+
network: NetworkNumber.Arb,
|
|
191
|
+
version: MorphoVaultVersion.V2,
|
|
192
|
+
deploymentBlock: 510799903,
|
|
193
|
+
isLegacy: false,
|
|
194
|
+
};
|
|
195
|
+
export const MORPHO_VAULT_STEAKHOUSE_USDG_PRO = {
|
|
196
|
+
type: MorphoVaultType.MorphoVaultSteakhouseUSDGPro,
|
|
197
|
+
name: 'Steakhouse USDG Pro',
|
|
198
|
+
address: '0xbeeFf72B77e7584a450E887125F25E8D8819016a',
|
|
199
|
+
asset: 'USDG',
|
|
200
|
+
network: NetworkNumber.Arb,
|
|
201
|
+
version: MorphoVaultVersion.V2,
|
|
202
|
+
deploymentBlock: 512247107,
|
|
203
|
+
isLegacy: false,
|
|
204
|
+
};
|
|
148
205
|
export const MORPHO_VAULTS = {
|
|
149
206
|
[MorphoVaultType.MorphoVaultFlagshipEth]: MORPHO_VAULT_FLAGSHIP_ETH,
|
|
150
207
|
[MorphoVaultType.MorphoVaultGauntletUSDCCore]: MORPHO_VAULT_GAUNTLET_USDC_CORE,
|
|
@@ -166,5 +223,8 @@ export const MORPHO_VAULTS = {
|
|
|
166
223
|
[MorphoVaultType.MorphoVaultSmokehouseUSDT]: MORPHO_VAULT_SMOKEHOUSE_USDT,
|
|
167
224
|
[MorphoVaultType.MorphoVaultSmokehouseUSDC]: MORPHO_VAULT_SMOKEHOUSE_USDC,
|
|
168
225
|
[MorphoVaultType.MorphoVaultSmokehouseDAI]: MORPHO_VAULT_SMOKEHOUSE_DAI,
|
|
226
|
+
// Vault V2
|
|
227
|
+
[MorphoVaultType.MorphoVaultGauntletUSDGPremium]: MORPHO_VAULT_GAUNTLET_USDG_PREMIUM,
|
|
228
|
+
[MorphoVaultType.MorphoVaultSteakhouseUSDGPro]: MORPHO_VAULT_STEAKHOUSE_USDG_PRO,
|
|
169
229
|
};
|
|
170
230
|
export const getMorphoVault = (type) => MORPHO_VAULTS[type];
|
package/esm/spark/index.js
CHANGED
|
@@ -81,6 +81,7 @@ export const _getSparkMarketsData = (provider, network, selectedMarket) => __awa
|
|
|
81
81
|
collateralAssets: eModeCategoriesData[emodeCategoryId] ? [...eModeCategoriesData[emodeCategoryId].collateralAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
|
|
82
82
|
borrowAssets: eModeCategoriesData[emodeCategoryId] ? [...eModeCategoriesData[emodeCategoryId].borrowAssets, selectedMarket.assets[i]] : [selectedMarket.assets[i]],
|
|
83
83
|
ltvZeroAssets: [],
|
|
84
|
+
isolated: false,
|
|
84
85
|
};
|
|
85
86
|
return ({
|
|
86
87
|
symbol: selectedMarket.assets[i],
|
package/esm/staking/staking.d.ts
CHANGED
|
@@ -3,26 +3,6 @@ import { MMAssetsData, MMUsedAssets } from '../types/common';
|
|
|
3
3
|
export declare const STAKING_ASSETS: string[];
|
|
4
4
|
export declare const getStakingApy: ((asset: string, network?: number) => Promise<string>) & memoize.Memoized<(asset: string, network?: number) => Promise<string>>;
|
|
5
5
|
export declare const calculateInterestEarned: (principal: string, interest: string, type: string, apy?: boolean) => number;
|
|
6
|
-
/**
|
|
7
|
-
* Net APY for positions that have a single known borrow rate (and optionally a single supply rate)
|
|
8
|
-
* instead of per-asset `assetsData` to feed into `calculateNetApy` (Maker, crvUSD, Liquity v1).
|
|
9
|
-
* All rates are yearly percentages that are already compounded. `incentives` are extra yields
|
|
10
|
-
* (e.g. the native staking yield of the collateral) applied to their own USD base and summed into `incentiveUsd`.
|
|
11
|
-
*/
|
|
12
|
-
export declare const calculateNetApyFromRates: ({ suppliedUsd, borrowedUsd, supplyRate, borrowRate, incentives, }: {
|
|
13
|
-
suppliedUsd: string;
|
|
14
|
-
borrowedUsd: string;
|
|
15
|
-
supplyRate?: string;
|
|
16
|
-
borrowRate?: string;
|
|
17
|
-
incentives?: {
|
|
18
|
-
apy: string;
|
|
19
|
-
amountUsd: string;
|
|
20
|
-
}[];
|
|
21
|
-
}) => {
|
|
22
|
-
netApy: string;
|
|
23
|
-
totalInterestUsd: string;
|
|
24
|
-
incentiveUsd: string;
|
|
25
|
-
};
|
|
26
6
|
export declare const calculateNetApy: ({ usedAssets, assetsData, optionalData, }: {
|
|
27
7
|
usedAssets: MMUsedAssets;
|
|
28
8
|
assetsData: MMAssetsData;
|
package/esm/staking/staking.js
CHANGED
|
@@ -182,23 +182,6 @@ export const calculateInterestEarned = (principal, interest, type, apy = false)
|
|
|
182
182
|
}
|
|
183
183
|
return (+principal * (Math.pow(((1 + (+interest / 100) / BLOCKS_IN_A_YEAR)), (BLOCKS_IN_A_YEAR * interval)))) - +principal; // eslint-disable-line
|
|
184
184
|
};
|
|
185
|
-
/**
|
|
186
|
-
* Net APY for positions that have a single known borrow rate (and optionally a single supply rate)
|
|
187
|
-
* instead of per-asset `assetsData` to feed into `calculateNetApy` (Maker, crvUSD, Liquity v1).
|
|
188
|
-
* All rates are yearly percentages that are already compounded. `incentives` are extra yields
|
|
189
|
-
* (e.g. the native staking yield of the collateral) applied to their own USD base and summed into `incentiveUsd`.
|
|
190
|
-
*/
|
|
191
|
-
export const calculateNetApyFromRates = ({ suppliedUsd, borrowedUsd, supplyRate = '0', borrowRate = '0', incentives = [], }) => {
|
|
192
|
-
const supplyInterest = new Dec(calculateInterestEarned(suppliedUsd, supplyRate, 'year', true));
|
|
193
|
-
const borrowInterest = new Dec(calculateInterestEarned(borrowedUsd, borrowRate, 'year', true));
|
|
194
|
-
const incentiveUsd = incentives
|
|
195
|
-
.reduce((acc, { apy, amountUsd }) => acc.add(calculateInterestEarned(amountUsd, apy, 'year', true)), new Dec(0))
|
|
196
|
-
.toString();
|
|
197
|
-
const totalInterestUsd = supplyInterest.sub(borrowInterest).add(incentiveUsd).toString();
|
|
198
|
-
const balance = new Dec(suppliedUsd).sub(borrowedUsd);
|
|
199
|
-
const netApy = balance.isZero() ? '0' : new Dec(totalInterestUsd).div(balance).times(100).toString();
|
|
200
|
-
return { netApy, totalInterestUsd, incentiveUsd };
|
|
201
|
-
};
|
|
202
185
|
export const calculateNetApy = ({ usedAssets, assetsData, optionalData, }) => {
|
|
203
186
|
const sumValues = Object.values(usedAssets).reduce((_acc, usedAsset) => {
|
|
204
187
|
const acc = Object.assign({}, _acc);
|
package/esm/types/aave.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export interface EModeCategoryData {
|
|
|
40
40
|
borrowAssets: string[];
|
|
41
41
|
ltvzeroBitmap?: string;
|
|
42
42
|
ltvZeroAssets: string[];
|
|
43
|
+
isolated: boolean;
|
|
43
44
|
}
|
|
44
45
|
export interface EModeCategoryDataMapping {
|
|
45
46
|
enteringTerms: boolean[];
|
|
@@ -126,7 +127,6 @@ export interface AavePositionData extends MMPositionData {
|
|
|
126
127
|
minRatio: string;
|
|
127
128
|
collRatio: string;
|
|
128
129
|
safetyRatioWithLtvZeroFallback?: string;
|
|
129
|
-
safetyRatio?: string;
|
|
130
130
|
suppliedUsd: string;
|
|
131
131
|
borrowedUsd: string;
|
|
132
132
|
borrowLimitUsd: string;
|
|
@@ -160,7 +160,6 @@ export interface AaveV3AggregatedPositionData {
|
|
|
160
160
|
collRatio: string;
|
|
161
161
|
borrowLimitWithLtvZeroFallbackUsd: string;
|
|
162
162
|
safetyRatioWithLtvZeroFallback: string;
|
|
163
|
-
safetyRatio: string;
|
|
164
163
|
netApy: string;
|
|
165
164
|
incentiveUsd: string;
|
|
166
165
|
totalInterestUsd: string;
|
package/esm/types/aaveV4.d.ts
CHANGED
package/esm/types/compound.d.ts
CHANGED
|
@@ -96,7 +96,6 @@ export interface CompoundAggregatedPositionData {
|
|
|
96
96
|
leftToBorrowUsd: string;
|
|
97
97
|
ratio: string;
|
|
98
98
|
collRatio: string;
|
|
99
|
-
safetyRatio: string;
|
|
100
99
|
netApy: string;
|
|
101
100
|
incentiveUsd: string;
|
|
102
101
|
totalInterestUsd: string;
|
|
@@ -116,7 +115,6 @@ export interface CompoundAggregatedPositionData {
|
|
|
116
115
|
export interface CompoundPositionData extends MMPositionData {
|
|
117
116
|
ratio: string;
|
|
118
117
|
minRatio: string;
|
|
119
|
-
safetyRatio?: string;
|
|
120
118
|
suppliedUsd: string;
|
|
121
119
|
borrowedUsd: string;
|
|
122
120
|
borrowLimitUsd: string;
|
package/esm/types/curveUsd.d.ts
CHANGED
|
@@ -73,9 +73,6 @@ export interface CrvUSDAggregatedPositionData {
|
|
|
73
73
|
collFactor: string;
|
|
74
74
|
leveragedType: LeverageType;
|
|
75
75
|
exposure: string;
|
|
76
|
-
netApy: string;
|
|
77
|
-
totalInterestUsd: string;
|
|
78
|
-
incentiveUsd: string;
|
|
79
76
|
leveragedAsset?: string;
|
|
80
77
|
liquidationPrice?: string;
|
|
81
78
|
}
|
|
@@ -116,7 +113,4 @@ export interface CrvUSDUserData {
|
|
|
116
113
|
collateralPrice: string;
|
|
117
114
|
collRatio: string;
|
|
118
115
|
exposure: string;
|
|
119
|
-
netApy: string;
|
|
120
|
-
totalInterestUsd: string;
|
|
121
|
-
incentiveUsd: string;
|
|
122
116
|
}
|
package/esm/types/fluid.d.ts
CHANGED
package/esm/types/liquity.d.ts
CHANGED
|
@@ -24,11 +24,7 @@ export interface LiquityTroveInfo {
|
|
|
24
24
|
totalETH: string;
|
|
25
25
|
totalLUSD: string;
|
|
26
26
|
minCollateralRatio: number;
|
|
27
|
-
safetyRatio: string;
|
|
28
27
|
priceForRecovery: string;
|
|
29
28
|
debtInFront: string;
|
|
30
29
|
exposure: string;
|
|
31
|
-
netApy: string;
|
|
32
|
-
totalInterestUsd: string;
|
|
33
|
-
incentiveUsd: string;
|
|
34
30
|
}
|
package/esm/types/liquityV2.d.ts
CHANGED
|
@@ -94,7 +94,6 @@ export interface LiquityV2AggregatedTroveData {
|
|
|
94
94
|
liquidationPrice: string;
|
|
95
95
|
ratio: string;
|
|
96
96
|
collRatio: string;
|
|
97
|
-
safetyRatio: string;
|
|
98
97
|
exposure: string;
|
|
99
98
|
}
|
|
100
99
|
export interface LiquityV2TroveData {
|
|
@@ -102,7 +101,6 @@ export interface LiquityV2TroveData {
|
|
|
102
101
|
troveId: string;
|
|
103
102
|
ratio: string;
|
|
104
103
|
collRatio: string;
|
|
105
|
-
safetyRatio?: string;
|
|
106
104
|
liqRatio: string;
|
|
107
105
|
borrowLimitRatio: string;
|
|
108
106
|
interestRate: string;
|
package/esm/types/maker.d.ts
CHANGED
|
@@ -43,7 +43,6 @@ export interface CdpData {
|
|
|
43
43
|
debtAssetMarketPrice: string;
|
|
44
44
|
liquidationPrice: string;
|
|
45
45
|
ratio: string;
|
|
46
|
-
safetyRatio: string;
|
|
47
46
|
liqRatio: string;
|
|
48
47
|
liqPercent: number;
|
|
49
48
|
assetPrice: string;
|
|
@@ -59,7 +58,4 @@ export interface CdpData {
|
|
|
59
58
|
liquidationFee: string;
|
|
60
59
|
lastUpdated: number;
|
|
61
60
|
exposure: string;
|
|
62
|
-
netApy: string;
|
|
63
|
-
totalInterestUsd: string;
|
|
64
|
-
incentiveUsd: string;
|
|
65
61
|
}
|
|
@@ -185,7 +185,6 @@ export interface MorphoBlueAggregatedPositionData {
|
|
|
185
185
|
totalInterestUsd: string;
|
|
186
186
|
ltv: string;
|
|
187
187
|
ratio: string;
|
|
188
|
-
safetyRatio: string;
|
|
189
188
|
leveragedType: LeverageType;
|
|
190
189
|
leveragedAsset?: string;
|
|
191
190
|
currentVolatilePairRatio?: string;
|
|
@@ -208,7 +207,6 @@ export interface MorphoBluePositionData {
|
|
|
208
207
|
totalInterestUsd: string;
|
|
209
208
|
ltv: string;
|
|
210
209
|
ratio: string;
|
|
211
|
-
safetyRatio?: string;
|
|
212
210
|
leveragedType: LeverageType;
|
|
213
211
|
leveragedAsset?: string;
|
|
214
212
|
currentVolatilePairRatio?: string;
|
package/esm/types/portfolio.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AaveV4AccountData,
|
|
1
|
+
import { AaveV2PositionData, AaveV3PositionData, AaveVersions } from './aave';
|
|
2
|
+
import { AaveV4AccountData, AaveV4SpokesType } from './aaveV4';
|
|
3
3
|
import { EthAddress } from './common';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { CompoundV2PositionData, CompoundV3PositionData, CompoundVersions } from './compound';
|
|
5
|
+
import { CrvUSDUserData, CrvUSDVersions } from './curveUsd';
|
|
6
|
+
import { FluidVaultData } from './fluid';
|
|
7
7
|
import { LiquityTroveInfo } from './liquity';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { SparkMarketsData, SparkPositionData, SparkVersions } from './spark';
|
|
8
|
+
import { LlamaLendUserData, LlamaLendVersionsType } from './llamaLend';
|
|
9
|
+
import { CdpData } from './maker';
|
|
10
|
+
import { MorphoBluePositionData, MorphoBlueVersions } from './morphoBlue';
|
|
11
|
+
import { MorphoMidnightPositionData, MorphoMidnightVersions } from './morphoMidnight';
|
|
12
|
+
import { SparkPositionData, SparkVersions } from './spark';
|
|
14
13
|
export interface PortfolioProtocolData<T> {
|
|
15
14
|
error: string;
|
|
16
15
|
data: T | null;
|
|
@@ -60,18 +59,3 @@ export interface PortfolioPositionsDataForAddress {
|
|
|
60
59
|
export interface PortfolioPositionsData {
|
|
61
60
|
[key: EthAddress]: PortfolioPositionsDataForAddress;
|
|
62
61
|
}
|
|
63
|
-
export interface PortfolioMarketsData {
|
|
64
|
-
morphoMarketsData: Record<string, MorphoBlueMarketInfo>;
|
|
65
|
-
morphoMidnightMarketsData: Record<string, MorphoMidnightMarketInfo>;
|
|
66
|
-
compoundV3MarketsData: Record<string, CompoundV3MarketsData>;
|
|
67
|
-
sparkMarketsData: Record<string, SparkMarketsData>;
|
|
68
|
-
aaveV3MarketsData: Record<string, AaveV3MarketData>;
|
|
69
|
-
aaveV2MarketsData: Record<string, AaveV2MarketData>;
|
|
70
|
-
compoundV2MarketsData: Record<string, CompoundV2MarketsData>;
|
|
71
|
-
crvUsdMarketsData: Record<string, CrvUSDGlobalMarketData>;
|
|
72
|
-
llamaLendMarketsData: Record<string, LlamaLendGlobalMarketData>;
|
|
73
|
-
liquityV2MarketsData: Record<string, LiquityV2MarketData>;
|
|
74
|
-
aaveV4SpokesData: Record<string, AaveV4SpokeData>;
|
|
75
|
-
fluidMarketsData: Record<string, FluidMarketData>;
|
|
76
|
-
makerMarketsData: Record<string, IlkInfo>;
|
|
77
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress } from '../common';
|
|
1
|
+
import { EthAddress, NetworkNumber } from '../common';
|
|
2
2
|
export declare enum MorphoVaultType {
|
|
3
3
|
MorphoVaultFlagshipEth = "morpho_vault_flagship_eth",
|
|
4
4
|
MorphoVaultGauntletUSDCCore = "morpho_vault_gauntlet_usdc_core",
|
|
@@ -17,13 +17,21 @@ export declare enum MorphoVaultType {
|
|
|
17
17
|
MorphoVaultSteakhousePYUSD = "morpho_vault_steakhouse_pyusd",
|
|
18
18
|
MorphoVaultSmokehouseUSDT = "morpho_vault_smokehouse_usdt",
|
|
19
19
|
MorphoVaultSmokehouseUSDC = "morpho_vault_smokehouse_usdc",
|
|
20
|
-
MorphoVaultSmokehouseDAI = "morpho_vault_smokehouse_dai"
|
|
20
|
+
MorphoVaultSmokehouseDAI = "morpho_vault_smokehouse_dai",
|
|
21
|
+
MorphoVaultGauntletUSDGPremium = "morpho_vault_gauntlet_usdg_premium",
|
|
22
|
+
MorphoVaultSteakhouseUSDGPro = "morpho_vault_steakhouse_usdg_pro"
|
|
23
|
+
}
|
|
24
|
+
export declare enum MorphoVaultVersion {
|
|
25
|
+
V1 = 1,
|
|
26
|
+
V2 = 2
|
|
21
27
|
}
|
|
22
28
|
export interface MorphoVault {
|
|
23
29
|
type: MorphoVaultType;
|
|
24
30
|
name: string;
|
|
25
31
|
address: EthAddress;
|
|
26
32
|
asset: string;
|
|
33
|
+
network: NetworkNumber;
|
|
34
|
+
version: MorphoVaultVersion;
|
|
27
35
|
deploymentBlock: number;
|
|
28
36
|
isLegacy: boolean;
|
|
29
37
|
}
|
|
@@ -20,4 +20,12 @@ export var MorphoVaultType;
|
|
|
20
20
|
MorphoVaultType["MorphoVaultSmokehouseUSDT"] = "morpho_vault_smokehouse_usdt";
|
|
21
21
|
MorphoVaultType["MorphoVaultSmokehouseUSDC"] = "morpho_vault_smokehouse_usdc";
|
|
22
22
|
MorphoVaultType["MorphoVaultSmokehouseDAI"] = "morpho_vault_smokehouse_dai";
|
|
23
|
+
// Vault V2
|
|
24
|
+
MorphoVaultType["MorphoVaultGauntletUSDGPremium"] = "morpho_vault_gauntlet_usdg_premium";
|
|
25
|
+
MorphoVaultType["MorphoVaultSteakhouseUSDGPro"] = "morpho_vault_steakhouse_usdg_pro";
|
|
23
26
|
})(MorphoVaultType || (MorphoVaultType = {}));
|
|
27
|
+
export var MorphoVaultVersion;
|
|
28
|
+
(function (MorphoVaultVersion) {
|
|
29
|
+
MorphoVaultVersion[MorphoVaultVersion["V1"] = 1] = "V1";
|
|
30
|
+
MorphoVaultVersion[MorphoVaultVersion["V2"] = 2] = "V2";
|
|
31
|
+
})(MorphoVaultVersion || (MorphoVaultVersion = {}));
|
package/esm/types/spark.d.ts
CHANGED
|
@@ -85,7 +85,6 @@ export interface SparkAggregatedPositionData {
|
|
|
85
85
|
leftToBorrowUsd: string;
|
|
86
86
|
ratio: string;
|
|
87
87
|
collRatio: string;
|
|
88
|
-
safetyRatio: string;
|
|
89
88
|
netApy: string;
|
|
90
89
|
incentiveUsd: string;
|
|
91
90
|
totalInterestUsd: string;
|
|
@@ -105,7 +104,6 @@ export interface SparkPositionData extends MMPositionData {
|
|
|
105
104
|
ratio: string;
|
|
106
105
|
minRatio: string;
|
|
107
106
|
collRatio: string;
|
|
108
|
-
safetyRatio?: string;
|
|
109
107
|
suppliedUsd: string;
|
|
110
108
|
borrowedUsd: string;
|
|
111
109
|
borrowLimitUsd: string;
|
package/package.json
CHANGED
package/src/aaveV2/index.ts
CHANGED
|
@@ -210,8 +210,6 @@ export const _getAaveV2AccountData = async (provider: Client, network: NetworkNu
|
|
|
210
210
|
payload.collRatio = payload.borrowedUsd && payload.borrowedUsd !== '0'
|
|
211
211
|
? new Dec(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString()
|
|
212
212
|
: '0';
|
|
213
|
-
// Aave v2 has no LTV-0 fallback (AaveV3View only), so its safety ratio is the plain ratio.
|
|
214
|
-
payload.safetyRatio = payload.ratio;
|
|
215
213
|
|
|
216
214
|
// Calculate borrow limits per asset
|
|
217
215
|
Object.values(payload.usedAssets).forEach((item) => {
|
package/src/aaveV3/index.ts
CHANGED
|
@@ -61,7 +61,10 @@ export const aaveV3EmodeCategoriesMapping = (extractedState: any, usedAssets: Aa
|
|
|
61
61
|
...extractedState, usedAssets, eModeCategory: e.id,
|
|
62
62
|
});
|
|
63
63
|
const willStayOverCollateralized = new Dec(afterEnteringCategory.ratio === 'NaN' ? '0' : afterEnteringCategory.ratio).eq(0) || new Dec(afterEnteringCategory.ratio).gt(afterEnteringCategory.liqPercent);
|
|
64
|
-
const
|
|
64
|
+
const collateralOnlyFromCategory = e.id === 0 || !e.isolated
|
|
65
|
+
? true
|
|
66
|
+
: !usedAssetsValues.filter(u => u.isSupplied && u.collateral && !e.collateralAssets.includes(u.symbol)).length;
|
|
67
|
+
const enteringTerms = [borrowingOnlyFromCategory, willStayOverCollateralized, collateralOnlyFromCategory];
|
|
65
68
|
categoriesMapping[e.id] = {
|
|
66
69
|
enteringTerms,
|
|
67
70
|
canEnterCategory: !enteringTerms.includes(false),
|
|
@@ -118,6 +121,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
|
|
|
118
121
|
borrowableBitmap: eModesInfo[i].borrowableBitmap.toString(),
|
|
119
122
|
collateralBitmap: eModesInfo[i].collateralBitmap.toString(),
|
|
120
123
|
ltvzeroBitmap: eModesInfo[i].ltvzeroBitmap.toString(),
|
|
124
|
+
isolated: eModesInfo[i].isolated ?? false,
|
|
121
125
|
borrowAssets: [],
|
|
122
126
|
collateralAssets: [],
|
|
123
127
|
ltvZeroAssets: [],
|
|
@@ -345,6 +349,7 @@ export async function _getAaveV3MarketData(provider: Client, network: NetworkNum
|
|
|
345
349
|
collateralAssets: assetsData.map((a) => a.symbol),
|
|
346
350
|
borrowAssets: assetsData.map((a) => a.symbol),
|
|
347
351
|
ltvZeroAssets: [],
|
|
352
|
+
isolated: false,
|
|
348
353
|
};
|
|
349
354
|
|
|
350
355
|
return { assetsData: payload, eModeCategoriesData };
|
package/src/curveUsd/index.ts
CHANGED
|
@@ -14,13 +14,6 @@ import { getCrvUsdAggregatedData } from '../helpers/curveUsdHelpers';
|
|
|
14
14
|
import { CrvUsdMarkets } from '../markets';
|
|
15
15
|
import { wethToEth } from '../services/utils';
|
|
16
16
|
import { getViemProvider, setViemBlockNumber } from '../services/viem';
|
|
17
|
-
import { getStakingApy, STAKING_ASSETS } from '../staking';
|
|
18
|
-
|
|
19
|
-
/** Converts a per-second AMM rate (wei, 18 decimals) into a yearly compounded borrow APY in %. */
|
|
20
|
-
const ammRateToBorrowApy = (rateWei: string) => {
|
|
21
|
-
const exponent = new Dec(assetAmountInEth(rateWei)).mul(365).mul(86400);
|
|
22
|
-
return new Dec(new Dec(2.718281828459).pow(exponent).minus(1)).mul(100).toString();
|
|
23
|
-
};
|
|
24
17
|
|
|
25
18
|
const getAndFormatBands = async (provider: Client, network: NetworkNumber, selectedMarket: CrvUSDMarketData, _minBand: string, _maxBand: string) => {
|
|
26
19
|
const contract = CrvUSDViewContractViem(provider, network);
|
|
@@ -76,8 +69,15 @@ export const _getCurveUsdGlobalData = async (provider: Client, network: NetworkN
|
|
|
76
69
|
const totalDebt = assetAmountInEth(data.totalDebt.toString(), debtAsset);
|
|
77
70
|
const ammPrice = assetAmountInEth(data.ammPrice.toString(), debtAsset);
|
|
78
71
|
|
|
79
|
-
const
|
|
80
|
-
const
|
|
72
|
+
const rate = assetAmountInEth(data.ammRate.toString());
|
|
73
|
+
const futureRate = assetAmountInEth(data.monetaryPolicyRate.toString());
|
|
74
|
+
|
|
75
|
+
const exponentRate = new Dec(rate).mul(365).mul(86400);
|
|
76
|
+
const exponentFutureRate = new Dec(futureRate).mul(365).mul(86400);
|
|
77
|
+
const borrowRate = new Dec(new Dec(2.718281828459).pow(exponentRate).minus(1)).mul(100)
|
|
78
|
+
.toString();
|
|
79
|
+
const futureBorrowRate = new Dec(new Dec(2.718281828459).pow(exponentFutureRate).minus(1)).mul(100)
|
|
80
|
+
.toString();
|
|
81
81
|
|
|
82
82
|
const bandsData = await getAndFormatBands(provider, network, selectedMarket, data.minBand.toString(), data.maxBand.toString());
|
|
83
83
|
|
|
@@ -164,22 +164,13 @@ export const getCrvUsdAccountBalances = async (
|
|
|
164
164
|
controllerAddress: EthAddress,
|
|
165
165
|
): Promise<PositionBalances> => _getCrvUsdAccountBalances(getViemProvider(provider, network), network, block, addressMapping, address, controllerAddress);
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
* @param borrowRate market borrow APY in % (`CrvUSDGlobalMarketData.borrowRate`); when omitted it is read from the view contract
|
|
169
|
-
*/
|
|
170
|
-
export const _getCurveUsdUserData = async (provider: Client, network: NetworkNumber, address: EthAddress, selectedMarket: CrvUSDMarketData, activeBand: string, borrowRate?: string): Promise<CrvUSDUserData> => {
|
|
167
|
+
export const _getCurveUsdUserData = async (provider: Client, network: NetworkNumber, address: EthAddress, selectedMarket: CrvUSDMarketData, activeBand: string): Promise<CrvUSDUserData> => {
|
|
171
168
|
const contract = CrvUSDViewContractViem(provider, network);
|
|
169
|
+
|
|
170
|
+
const data = await contract.read.userData([selectedMarket.controllerAddress, address]);
|
|
172
171
|
const collAsset = selectedMarket.collAsset;
|
|
173
172
|
const debtAsset = selectedMarket.baseAsset;
|
|
174
173
|
|
|
175
|
-
const [data, collStakingApy, marketBorrowRate] = await Promise.all([
|
|
176
|
-
contract.read.userData([selectedMarket.controllerAddress, address]),
|
|
177
|
-
STAKING_ASSETS.includes(collAsset) ? getStakingApy(collAsset) : Promise.resolve('0'),
|
|
178
|
-
borrowRate !== undefined
|
|
179
|
-
? Promise.resolve(borrowRate)
|
|
180
|
-
: contract.read.globalData([selectedMarket.controllerAddress]).then((globalData) => ammRateToBorrowApy(globalData.ammRate.toString())),
|
|
181
|
-
]);
|
|
182
|
-
|
|
183
174
|
const health = assetAmountInEth(data.health.toString());
|
|
184
175
|
const healthPercent = new Dec(health).mul(100).toString();
|
|
185
176
|
const collPrice = assetAmountInEth(data.collateralPrice.toString(), debtAsset);
|
|
@@ -211,7 +202,7 @@ export const _getCurveUsdUserData = async (provider: Client, network: NetworkNum
|
|
|
211
202
|
isBorrowed: new Dec(debtBorrowed).gt('0'),
|
|
212
203
|
symbol: 'crvUSD',
|
|
213
204
|
price: '1',
|
|
214
|
-
interestRate:
|
|
205
|
+
interestRate: '0',
|
|
215
206
|
},
|
|
216
207
|
} : {};
|
|
217
208
|
|
|
@@ -241,15 +232,8 @@ export const _getCurveUsdUserData = async (provider: Client, network: NetworkNum
|
|
|
241
232
|
numOfBands: data.N.toString(),
|
|
242
233
|
usedAssets,
|
|
243
234
|
status,
|
|
244
|
-
borrowRate: marketBorrowRate,
|
|
245
235
|
...getCrvUsdAggregatedData({
|
|
246
|
-
loanExists: data.loanExists,
|
|
247
|
-
usedAssets,
|
|
248
|
-
network: NetworkNumber.Eth,
|
|
249
|
-
selectedMarket,
|
|
250
|
-
numOfBands: data.N.toString(),
|
|
251
|
-
borrowRate: marketBorrowRate,
|
|
252
|
-
collStakingApy,
|
|
236
|
+
loanExists: data.loanExists, usedAssets, network: NetworkNumber.Eth, selectedMarket, numOfBands: data.N.toString(),
|
|
253
237
|
}),
|
|
254
238
|
userBands,
|
|
255
239
|
};
|
|
@@ -261,11 +245,10 @@ export const getCurveUsdUserData = async (
|
|
|
261
245
|
address: EthAddress,
|
|
262
246
|
selectedMarket: CrvUSDMarketData,
|
|
263
247
|
activeBand: string,
|
|
264
|
-
|
|
265
|
-
): Promise<CrvUSDUserData> => _getCurveUsdUserData(getViemProvider(provider, network), network, address, selectedMarket, activeBand, borrowRate);
|
|
248
|
+
): Promise<CrvUSDUserData> => _getCurveUsdUserData(getViemProvider(provider, network), network, address, selectedMarket, activeBand);
|
|
266
249
|
|
|
267
250
|
export const getCurveUsdFullPositionData = async (provider: EthereumProvider, network: NetworkNumber, address: EthAddress, selectedMarket: CrvUSDMarketData): Promise<CrvUSDUserData> => {
|
|
268
251
|
const marketData = await getCurveUsdGlobalData(provider, network, selectedMarket);
|
|
269
|
-
const positionData = await getCurveUsdUserData(provider, network, address, selectedMarket, marketData.activeBand
|
|
252
|
+
const positionData = await getCurveUsdUserData(provider, network, address, selectedMarket, marketData.activeBand);
|
|
270
253
|
return positionData;
|
|
271
254
|
};
|