@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.
- package/cjs/aaveV3/index.d.ts +1 -0
- package/cjs/aaveV3/index.js +1 -0
- package/cjs/aaveV4/index.d.ts +7 -0
- package/cjs/aaveV4/index.js +174 -0
- package/cjs/compoundV2/index.d.ts +1 -0
- package/cjs/compoundV2/index.js +1 -0
- package/cjs/compoundV3/index.d.ts +1 -0
- package/cjs/compoundV3/index.js +1 -0
- package/cjs/config/contracts.d.ts +1277 -0
- package/cjs/config/contracts.js +9 -0
- package/cjs/contracts.d.ts +23120 -0
- package/cjs/contracts.js +2 -1
- package/cjs/eulerV2/index.d.ts +1 -0
- package/cjs/eulerV2/index.js +1 -0
- package/cjs/fluid/index.d.ts +3 -0
- package/cjs/helpers/aaveHelpers/index.js +1 -0
- package/cjs/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/cjs/helpers/aaveV4Helpers/index.js +117 -0
- package/cjs/helpers/compoundHelpers/index.js +2 -0
- package/cjs/helpers/curveUsdHelpers/index.js +1 -0
- package/cjs/helpers/eulerHelpers/index.js +1 -0
- package/cjs/helpers/fluidHelpers/index.js +1 -0
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/helpers/liquityV2Helpers/index.js +1 -0
- package/cjs/helpers/llamaLendHelpers/index.js +1 -0
- package/cjs/helpers/morphoBlueHelpers/index.js +3 -2
- package/cjs/helpers/sparkHelpers/index.js +1 -0
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/liquity/index.js +2 -0
- package/cjs/maker/index.js +2 -0
- package/cjs/markets/aaveV4/index.d.ts +16 -0
- package/cjs/markets/aaveV4/index.js +59 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/moneymarket/moneymarketCommonService.d.ts +1 -0
- package/cjs/moneymarket/moneymarketCommonService.js +8 -1
- package/cjs/portfolio/index.js +20 -0
- package/cjs/services/utils.d.ts +1 -0
- package/cjs/services/utils.js +2 -1
- package/cjs/spark/index.d.ts +1 -0
- package/cjs/spark/index.js +1 -0
- package/cjs/types/aave.d.ts +1 -0
- package/cjs/types/aaveV4.d.ts +139 -0
- package/cjs/types/aaveV4.js +13 -0
- package/cjs/types/common.d.ts +1 -0
- package/cjs/types/compound.d.ts +1 -0
- package/cjs/types/curveUsd.d.ts +2 -0
- package/cjs/types/euler.d.ts +1 -0
- package/cjs/types/fluid.d.ts +1 -0
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/liquity.d.ts +1 -0
- package/cjs/types/liquityV2.d.ts +2 -0
- package/cjs/types/llamaLend.d.ts +2 -0
- package/cjs/types/maker.d.ts +1 -0
- package/cjs/types/morphoBlue.d.ts +2 -0
- package/cjs/types/portfolio.d.ts +4 -0
- package/cjs/types/spark.d.ts +1 -0
- package/esm/aaveV3/index.d.ts +1 -0
- package/esm/aaveV3/index.js +1 -0
- package/esm/aaveV4/index.d.ts +7 -0
- package/esm/aaveV4/index.js +165 -0
- package/esm/compoundV2/index.d.ts +1 -0
- package/esm/compoundV2/index.js +1 -0
- package/esm/compoundV3/index.d.ts +1 -0
- package/esm/compoundV3/index.js +1 -0
- package/esm/config/contracts.d.ts +1277 -0
- package/esm/config/contracts.js +8 -0
- package/esm/contracts.d.ts +23120 -0
- package/esm/contracts.js +1 -0
- package/esm/eulerV2/index.d.ts +1 -0
- package/esm/eulerV2/index.js +1 -0
- package/esm/fluid/index.d.ts +3 -0
- package/esm/helpers/aaveHelpers/index.js +2 -1
- package/esm/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/esm/helpers/aaveV4Helpers/index.js +108 -0
- package/esm/helpers/compoundHelpers/index.js +3 -1
- package/esm/helpers/curveUsdHelpers/index.js +2 -1
- package/esm/helpers/eulerHelpers/index.js +2 -1
- package/esm/helpers/fluidHelpers/index.js +2 -1
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/liquityV2Helpers/index.js +2 -1
- package/esm/helpers/llamaLendHelpers/index.js +2 -1
- package/esm/helpers/morphoBlueHelpers/index.js +5 -4
- package/esm/helpers/sparkHelpers/index.js +2 -1
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/liquity/index.js +2 -0
- package/esm/maker/index.js +2 -0
- package/esm/markets/aaveV4/index.d.ts +16 -0
- package/esm/markets/aaveV4/index.js +47 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/moneymarket/moneymarketCommonService.d.ts +1 -0
- package/esm/moneymarket/moneymarketCommonService.js +6 -0
- package/esm/portfolio/index.js +21 -1
- package/esm/services/utils.d.ts +1 -0
- package/esm/services/utils.js +1 -0
- package/esm/spark/index.d.ts +1 -0
- package/esm/spark/index.js +1 -0
- package/esm/types/aave.d.ts +1 -0
- package/esm/types/aaveV4.d.ts +139 -0
- package/esm/types/aaveV4.js +10 -0
- package/esm/types/common.d.ts +1 -0
- package/esm/types/compound.d.ts +1 -0
- package/esm/types/curveUsd.d.ts +2 -0
- package/esm/types/euler.d.ts +1 -0
- package/esm/types/fluid.d.ts +1 -0
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/liquity.d.ts +1 -0
- package/esm/types/liquityV2.d.ts +2 -0
- package/esm/types/llamaLend.d.ts +2 -0
- package/esm/types/maker.d.ts +1 -0
- package/esm/types/morphoBlue.d.ts +2 -0
- package/esm/types/portfolio.d.ts +4 -0
- package/esm/types/spark.d.ts +1 -0
- package/package.json +1 -1
- package/src/aaveV3/index.ts +1 -0
- package/src/aaveV4/index.ts +176 -0
- package/src/compoundV2/index.ts +1 -0
- package/src/compoundV3/index.ts +1 -0
- package/src/config/contracts.ts +8 -0
- package/src/contracts.ts +3 -1
- package/src/eulerV2/index.ts +1 -0
- package/src/helpers/aaveHelpers/index.ts +2 -1
- package/src/helpers/aaveV4Helpers/index.ts +128 -0
- package/src/helpers/compoundHelpers/index.ts +3 -1
- package/src/helpers/curveUsdHelpers/index.ts +5 -1
- package/src/helpers/eulerHelpers/index.ts +2 -1
- package/src/helpers/fluidHelpers/index.ts +4 -1
- package/src/helpers/index.ts +1 -0
- package/src/helpers/liquityV2Helpers/index.ts +4 -1
- package/src/helpers/llamaLendHelpers/index.ts +4 -1
- package/src/helpers/morphoBlueHelpers/index.ts +5 -4
- package/src/helpers/sparkHelpers/index.ts +2 -1
- package/src/index.ts +2 -0
- package/src/liquity/index.ts +2 -0
- package/src/maker/index.ts +2 -0
- package/src/markets/aaveV4/index.ts +68 -0
- package/src/markets/index.ts +6 -1
- package/src/moneymarket/moneymarketCommonService.ts +6 -0
- package/src/portfolio/index.ts +20 -0
- package/src/services/utils.ts +1 -0
- package/src/spark/index.ts +1 -0
- package/src/types/aave.ts +1 -0
- package/src/types/aaveV4.ts +155 -0
- package/src/types/common.ts +1 -0
- package/src/types/compound.ts +1 -0
- package/src/types/curveUsd.ts +2 -0
- package/src/types/euler.ts +1 -0
- package/src/types/fluid.ts +2 -1
- package/src/types/index.ts +2 -1
- package/src/types/liquity.ts +1 -0
- package/src/types/liquityV2.ts +2 -0
- package/src/types/llamaLend.ts +2 -0
- package/src/types/maker.ts +1 -0
- package/src/types/morphoBlue.ts +2 -0
- package/src/types/portfolio.ts +4 -0
- package/src/types/spark.ts +1 -0
package/esm/spark/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare const EMPTY_SPARK_DATA: {
|
|
|
26
26
|
suppliedCollateralUsd: string;
|
|
27
27
|
totalSupplied: string;
|
|
28
28
|
eModeCategories: never[];
|
|
29
|
+
exposure: string;
|
|
29
30
|
};
|
|
30
31
|
export declare const _getSparkAccountBalances: (provider: Client, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
|
|
31
32
|
export declare const getSparkAccountBalances: (provider: EthereumProvider, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress) => Promise<PositionBalances>;
|
package/esm/spark/index.js
CHANGED
|
@@ -224,6 +224,7 @@ export const EMPTY_SPARK_DATA = {
|
|
|
224
224
|
suppliedCollateralUsd: '0',
|
|
225
225
|
totalSupplied: '0',
|
|
226
226
|
eModeCategories: [],
|
|
227
|
+
exposure: 'N/A',
|
|
227
228
|
};
|
|
228
229
|
export const _getSparkAccountBalances = (provider, network, block, addressMapping, address) => __awaiter(void 0, void 0, void 0, function* () {
|
|
229
230
|
let balances = {
|
package/esm/types/aave.d.ts
CHANGED
|
@@ -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 = {}));
|
package/esm/types/common.d.ts
CHANGED
package/esm/types/compound.d.ts
CHANGED
package/esm/types/curveUsd.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export interface CrvUSDAggregatedPositionData {
|
|
|
72
72
|
minAllowedRatio: number;
|
|
73
73
|
collFactor: string;
|
|
74
74
|
leveragedType: LeverageType;
|
|
75
|
+
exposure: string;
|
|
75
76
|
leveragedAsset?: string;
|
|
76
77
|
liquidationPrice?: string;
|
|
77
78
|
}
|
|
@@ -111,4 +112,5 @@ export interface CrvUSDUserData {
|
|
|
111
112
|
borrowRate?: string;
|
|
112
113
|
collateralPrice: string;
|
|
113
114
|
collRatio: string;
|
|
115
|
+
exposure: string;
|
|
114
116
|
}
|
package/esm/types/euler.d.ts
CHANGED
package/esm/types/fluid.d.ts
CHANGED
package/esm/types/index.d.ts
CHANGED
package/esm/types/index.js
CHANGED
package/esm/types/liquity.d.ts
CHANGED
package/esm/types/liquityV2.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export interface LiquityV2AggregatedTroveData {
|
|
|
93
93
|
liquidationPrice: string;
|
|
94
94
|
ratio: string;
|
|
95
95
|
collRatio: string;
|
|
96
|
+
exposure: string;
|
|
96
97
|
}
|
|
97
98
|
export interface LiquityV2TroveData {
|
|
98
99
|
usedAssets: LiquityV2UsedAssets;
|
|
@@ -115,4 +116,5 @@ export interface LiquityV2TroveData {
|
|
|
115
116
|
liquidationPrice: string;
|
|
116
117
|
debtInFront: string;
|
|
117
118
|
lastInterestRateAdjTime: string;
|
|
119
|
+
exposure: string;
|
|
118
120
|
}
|
package/esm/types/llamaLend.d.ts
CHANGED
|
@@ -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
|
export interface LlamaLendUsedAsset {
|
|
123
124
|
isSupplied: boolean;
|
|
@@ -155,4 +156,5 @@ export interface LlamaLendUserData {
|
|
|
155
156
|
userBands: UserBandData[];
|
|
156
157
|
loanExists: boolean;
|
|
157
158
|
borrowRate?: string;
|
|
159
|
+
exposure: string;
|
|
158
160
|
}
|
package/esm/types/maker.d.ts
CHANGED
|
@@ -135,6 +135,7 @@ export interface MorphoBlueAggregatedPositionData {
|
|
|
135
135
|
liquidationPrice?: string;
|
|
136
136
|
minCollRatio?: string;
|
|
137
137
|
collLiquidationRatio?: string;
|
|
138
|
+
exposure: string;
|
|
138
139
|
}
|
|
139
140
|
export interface MorphoBluePositionData {
|
|
140
141
|
usedAssets: MMUsedAssets;
|
|
@@ -156,6 +157,7 @@ export interface MorphoBluePositionData {
|
|
|
156
157
|
liquidationPrice?: string;
|
|
157
158
|
supplyShares: string;
|
|
158
159
|
borrowShares: string;
|
|
160
|
+
exposure: string;
|
|
159
161
|
}
|
|
160
162
|
export interface MorphoBlueVault {
|
|
161
163
|
address: string;
|
package/esm/types/portfolio.d.ts
CHANGED
|
@@ -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;
|
package/esm/types/spark.d.ts
CHANGED
package/package.json
CHANGED
package/src/aaveV3/index.ts
CHANGED
|
@@ -365,6 +365,7 @@ export const EMPTY_AAVE_DATA = {
|
|
|
365
365
|
eModeCategories: [],
|
|
366
366
|
collRatio: '0',
|
|
367
367
|
suppliedCollateralUsd: '0',
|
|
368
|
+
exposure: 'N/A',
|
|
368
369
|
};
|
|
369
370
|
|
|
370
371
|
export const _getAaveV3AccountBalances = async (provider: Client, network: NetworkNumber, block: Blockish, addressMapping: boolean, address: EthAddress): Promise<PositionBalances> => {
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { Client } from 'viem';
|
|
2
|
+
import Dec from 'decimal.js';
|
|
3
|
+
import { assetAmountInEth, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
4
|
+
import { getViemProvider } from '../services/viem';
|
|
5
|
+
import {
|
|
6
|
+
AaveV4AccountData,
|
|
7
|
+
AaveV4HubAssetOnChainData,
|
|
8
|
+
AaveV4HubOnChainData,
|
|
9
|
+
AaveV4ReserveAssetData, AaveV4ReserveAssetOnChain, AaveV4SpokeData, AaveV4SpokeInfo,
|
|
10
|
+
AaveV4UsedReserveAssets,
|
|
11
|
+
} from '../types';
|
|
12
|
+
import {
|
|
13
|
+
EthAddress, EthereumProvider, IncentiveData, IncentiveKind, NetworkNumber,
|
|
14
|
+
} from '../types/common';
|
|
15
|
+
import { AaveV4ViewContractViem } from '../contracts';
|
|
16
|
+
import { getStakingApy, STAKING_ASSETS } from '../staking';
|
|
17
|
+
import { wethToEth } from '../services/utils';
|
|
18
|
+
import { aaveV4GetAggregatedPositionData } from '../helpers/aaveV4Helpers';
|
|
19
|
+
import { getAaveV4HubByAddress } from '../markets/aaveV4';
|
|
20
|
+
|
|
21
|
+
const fetchHubData = async (viewContract: ReturnType<typeof AaveV4ViewContractViem>, hubAddress: EthAddress): Promise<AaveV4HubOnChainData> => {
|
|
22
|
+
const hubData = await viewContract.read.getHubAllAssetsData([hubAddress]);
|
|
23
|
+
return {
|
|
24
|
+
assets: hubData.reduce((acc: Record<number, AaveV4HubAssetOnChainData>, assetOnChainData) => {
|
|
25
|
+
acc[assetOnChainData.assetId] = {
|
|
26
|
+
assetId: assetOnChainData.assetId,
|
|
27
|
+
drawnRate: assetOnChainData.drawnRate,
|
|
28
|
+
};
|
|
29
|
+
return acc;
|
|
30
|
+
}, {}),
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const formatReserveAsset = async (reserveAsset: AaveV4ReserveAssetOnChain, hubAsset: AaveV4HubAssetOnChainData, reserveId: number, oracleDecimals: number, network: NetworkNumber): Promise<AaveV4ReserveAssetData> => {
|
|
35
|
+
const assetInfo = getAssetInfoByAddress(reserveAsset.underlying, network);
|
|
36
|
+
const symbol = wethToEth(assetInfo.symbol);
|
|
37
|
+
const hubInfo = getAaveV4HubByAddress(network, reserveAsset.hub);
|
|
38
|
+
if (!hubInfo) {
|
|
39
|
+
throw new Error(`Hub not found with address: ${reserveAsset.hub}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const isStakingAsset = STAKING_ASSETS.includes(symbol);
|
|
43
|
+
const supplyIncentives: IncentiveData[] = [];
|
|
44
|
+
const borrowIncentives: IncentiveData[] = [];
|
|
45
|
+
|
|
46
|
+
if (isStakingAsset) {
|
|
47
|
+
const yieldApy = await getStakingApy(symbol, network as NetworkNumber);
|
|
48
|
+
supplyIncentives.push({
|
|
49
|
+
apy: yieldApy,
|
|
50
|
+
token: symbol,
|
|
51
|
+
incentiveKind: IncentiveKind.Staking,
|
|
52
|
+
description: `Native ${symbol} yield.`,
|
|
53
|
+
});
|
|
54
|
+
if (reserveAsset.borrowable) {
|
|
55
|
+
// when borrowing assets whose value increases over time
|
|
56
|
+
borrowIncentives.push({
|
|
57
|
+
apy: new Dec(yieldApy).mul(-1).toString(),
|
|
58
|
+
token: symbol,
|
|
59
|
+
incentiveKind: IncentiveKind.Reward,
|
|
60
|
+
description: `Due to the native yield of ${symbol}, the value of the debt would increase over time.`,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return ({
|
|
66
|
+
symbol,
|
|
67
|
+
underlying: reserveAsset.underlying,
|
|
68
|
+
hub: hubInfo.address,
|
|
69
|
+
hubName: hubInfo?.label,
|
|
70
|
+
assetId: reserveAsset.assetId,
|
|
71
|
+
reserveId,
|
|
72
|
+
paused: reserveAsset.paused,
|
|
73
|
+
frozen: reserveAsset.frozen,
|
|
74
|
+
borrowable: reserveAsset.borrowable,
|
|
75
|
+
collateralRisk: new Dec(reserveAsset.collateralRisk).div(10000).toNumber(),
|
|
76
|
+
collateralFactor: new Dec(reserveAsset.collateralFactor).div(10000).toNumber(),
|
|
77
|
+
liquidationFee: new Dec(reserveAsset.liquidationFee).div(10000).toNumber(),
|
|
78
|
+
price: new Dec(reserveAsset.price).div(new Dec(10).pow(oracleDecimals)).toString(),
|
|
79
|
+
totalSupplied: assetAmountInEth(reserveAsset.totalSupplied.toString(), symbol),
|
|
80
|
+
totalDrawn: assetAmountInEth(reserveAsset.totalDrawn.toString(), symbol),
|
|
81
|
+
totalPremium: assetAmountInEth(reserveAsset.totalPremium.toString(), symbol),
|
|
82
|
+
totalDebt: assetAmountInEth(reserveAsset.totalDebt.toString(), symbol),
|
|
83
|
+
supplyCap: assetAmountInEth(reserveAsset.supplyCap.toString(), symbol),
|
|
84
|
+
borrowCap: assetAmountInEth(reserveAsset.borrowCap.toString(), symbol),
|
|
85
|
+
spokeActive: reserveAsset.spokeActive,
|
|
86
|
+
spokePaused: reserveAsset.spokePaused,
|
|
87
|
+
drawnRate: new Dec(hubAsset.drawnRate).div(new Dec(10).pow(27)).toString(),
|
|
88
|
+
supplyRate: '0', // To be implemented
|
|
89
|
+
supplyIncentives,
|
|
90
|
+
borrowIncentives,
|
|
91
|
+
canBeBorrowed: reserveAsset.spokeActive && !reserveAsset.spokePaused && !reserveAsset.paused && !reserveAsset.frozen,
|
|
92
|
+
canBeSupplied: reserveAsset.spokeActive && !reserveAsset.spokePaused && !reserveAsset.paused && !reserveAsset.frozen,
|
|
93
|
+
canBeWithdrawn: reserveAsset.spokeActive && !reserveAsset.spokePaused && !reserveAsset.paused,
|
|
94
|
+
canBePayBacked: reserveAsset.spokeActive && !reserveAsset.spokePaused && !reserveAsset.paused,
|
|
95
|
+
utilization: new Dec(reserveAsset.totalDrawn.toString()).times(100).div(new Dec(reserveAsset.totalSupplied.toString())).toString(),
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export async function _getAaveV4SpokeData(provider: Client, network: NetworkNumber, market: AaveV4SpokeInfo, blockNumber: 'latest' | number = 'latest'): Promise<AaveV4SpokeData> {
|
|
100
|
+
const viewContract = AaveV4ViewContractViem(provider, network, blockNumber);
|
|
101
|
+
|
|
102
|
+
const hubsData: Record<EthAddress, AaveV4HubOnChainData> = {};
|
|
103
|
+
const [spokeData] = await Promise.all([
|
|
104
|
+
viewContract.read.getSpokeDataFull([market.address]),
|
|
105
|
+
...market.hubs.map(async (hubAddress) => {
|
|
106
|
+
hubsData[hubAddress] = await fetchHubData(viewContract, hubAddress);
|
|
107
|
+
}),
|
|
108
|
+
]);
|
|
109
|
+
|
|
110
|
+
const reserveAssetsArray = await Promise.all(spokeData[1].map(async (reserveAssetOnChain: AaveV4ReserveAssetOnChain, index: number) => formatReserveAsset(reserveAssetOnChain, hubsData[reserveAssetOnChain.hub].assets[reserveAssetOnChain.assetId], index, +spokeData[0].oracleDecimals.toString(), network)));
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
assetsData: reserveAssetsArray.reduce((acc: Record<string, AaveV4ReserveAssetData>, reserveAsset: AaveV4ReserveAssetData) => {
|
|
114
|
+
acc[`${reserveAsset.symbol}-${reserveAsset.reserveId}`] = reserveAsset;
|
|
115
|
+
return acc;
|
|
116
|
+
}, {}),
|
|
117
|
+
oracle: spokeData[0].oracle,
|
|
118
|
+
oracleDecimals: +spokeData[0].oracleDecimals.toString(),
|
|
119
|
+
address: market.address,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function getAaveV4SpokeData(provider: EthereumProvider, network: NetworkNumber, spoke: AaveV4SpokeInfo, blockNumber: 'latest' | number = 'latest'): Promise<AaveV4SpokeData> {
|
|
124
|
+
return _getAaveV4SpokeData(getViemProvider(provider, network), network, spoke, blockNumber);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export async function _getAaveV4AccountData(provider: Client, network: NetworkNumber, spokeData: AaveV4SpokeData, address: EthAddress, blockNumber: 'latest' | number = 'latest'): Promise<AaveV4AccountData> {
|
|
128
|
+
const viewContract = AaveV4ViewContractViem(provider, network, blockNumber);
|
|
129
|
+
|
|
130
|
+
const loanData = await viewContract.read.getLoanData([spokeData.address, address]);
|
|
131
|
+
|
|
132
|
+
const healthFactor = new Dec(loanData.healthFactor).div(1e18).toString();
|
|
133
|
+
const usedAssets = loanData.reserves.reduce((acc: AaveV4UsedReserveAssets, usedReserveAsset) => {
|
|
134
|
+
const identifier = `${wethToEth(getAssetInfoByAddress(usedReserveAsset.underlying, network).symbol)}-${+usedReserveAsset.reserveId.toString()}`;
|
|
135
|
+
const reserveData = spokeData.assetsData[identifier];
|
|
136
|
+
const price = reserveData.price;
|
|
137
|
+
const supplied = assetAmountInEth(usedReserveAsset.supplied.toString(), reserveData.symbol);
|
|
138
|
+
const drawn = assetAmountInEth(usedReserveAsset.drawn.toString(), reserveData.symbol);
|
|
139
|
+
const premium = assetAmountInEth(usedReserveAsset.premium.toString(), reserveData.symbol);
|
|
140
|
+
const borrowed = assetAmountInEth(usedReserveAsset.totalDebt.toString(), reserveData.symbol);
|
|
141
|
+
acc[identifier] = {
|
|
142
|
+
symbol: reserveData.symbol,
|
|
143
|
+
hubName: reserveData.hubName,
|
|
144
|
+
assetId: reserveData.assetId,
|
|
145
|
+
reserveId: +usedReserveAsset.reserveId.toString(),
|
|
146
|
+
supplied,
|
|
147
|
+
suppliedUsd: new Dec(supplied).mul(price).toString(),
|
|
148
|
+
drawn,
|
|
149
|
+
drawnUsd: new Dec(drawn).mul(price).toString(),
|
|
150
|
+
premium,
|
|
151
|
+
premiumUsd: new Dec(premium).mul(price).toString(),
|
|
152
|
+
borrowed,
|
|
153
|
+
borrowedUsd: new Dec(borrowed).mul(price).toString(),
|
|
154
|
+
isSupplied: !new Dec(supplied).eq(0),
|
|
155
|
+
isBorrowed: usedReserveAsset.isBorrowing,
|
|
156
|
+
collateral: usedReserveAsset.isUsingAsCollateral,
|
|
157
|
+
collateralFactor: new Dec(usedReserveAsset.collateralFactor).div(10000).toNumber(),
|
|
158
|
+
};
|
|
159
|
+
return acc;
|
|
160
|
+
}, {});
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
usedAssets,
|
|
164
|
+
healthFactor,
|
|
165
|
+
...aaveV4GetAggregatedPositionData({
|
|
166
|
+
usedAssets,
|
|
167
|
+
assetsData: spokeData.assetsData,
|
|
168
|
+
network,
|
|
169
|
+
useUserCollateralFactor: true,
|
|
170
|
+
}),
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export async function getAaveV4AccountData(provider: EthereumProvider, network: NetworkNumber, marketData: AaveV4SpokeData, address: EthAddress, blockNumber: 'latest' | number = 'latest'): Promise<any> {
|
|
175
|
+
return _getAaveV4AccountData(getViemProvider(provider, network), network, marketData, address, blockNumber);
|
|
176
|
+
}
|
package/src/compoundV2/index.ts
CHANGED
|
@@ -100,6 +100,7 @@ export const EMPTY_COMPOUND_DATA = {
|
|
|
100
100
|
incentiveUsd: '0',
|
|
101
101
|
totalInterestUsd: '0',
|
|
102
102
|
borrowStableSupplyUnstable: false,
|
|
103
|
+
exposure: 'N/A',
|
|
103
104
|
};
|
|
104
105
|
|
|
105
106
|
const getCollateralAssetsAddresses = async (provider: Client, network: NetworkNumber, account: EthAddress) => {
|
package/src/compoundV3/index.ts
CHANGED
package/src/config/contracts.ts
CHANGED
|
@@ -1318,4 +1318,12 @@ export const SkySavings = {
|
|
|
1318
1318
|
} as const;
|
|
1319
1319
|
export const YearnV3Vault = {
|
|
1320
1320
|
"abi": [{"stateMutability":"view","type":"function","name":"balanceOf","inputs":[{"name":"addr","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalAssets","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalDebt","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalSupply","inputs":[],"outputs":[{"name":"","type":"uint256"}]}]
|
|
1321
|
+
} as const;
|
|
1322
|
+
export const AaveV4View = {
|
|
1323
|
+
"abi": [{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getHealthFactor","outputs":[{"internalType":"uint256","name":"healthFactor","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_hub","type":"address"}],"name":"getHubAllAssetsData","outputs":[{"components":[{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"swept","type":"uint256"},{"internalType":"uint16","name":"liquidityFee","type":"uint16"},{"internalType":"uint120","name":"drawnIndex","type":"uint120"},{"internalType":"uint96","name":"drawnRate","type":"uint96"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"address","name":"irStrategy","type":"address"},{"internalType":"address","name":"reinvestmentController","type":"address"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint256","name":"deficitRay","type":"uint256"}],"internalType":"structAaveV4View.HubAssetData[]","name":"hubAssetData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_hub","type":"address"},{"internalType":"uint256","name":"_assetId","type":"uint256"}],"name":"getHubAssetData","outputs":[{"components":[{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"swept","type":"uint256"},{"internalType":"uint16","name":"liquidityFee","type":"uint16"},{"internalType":"uint120","name":"drawnIndex","type":"uint120"},{"internalType":"uint96","name":"drawnRate","type":"uint96"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"address","name":"irStrategy","type":"address"},{"internalType":"address","name":"reinvestmentController","type":"address"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint256","name":"deficitRay","type":"uint256"}],"internalType":"structAaveV4View.HubAssetData","name":"hubAssetData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getLoanData","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"riskPremium","type":"uint256"},{"internalType":"uint256","name":"avgCollateralFactor","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"},{"internalType":"uint256","name":"totalCollateralInUsd","type":"uint256"},{"internalType":"uint256","name":"totalDebtInUsd","type":"uint256"},{"internalType":"uint256","name":"activeCollateralCount","type":"uint256"},{"internalType":"uint256","name":"borrowedCount","type":"uint256"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"supplied","type":"uint256"},{"internalType":"uint256","name":"drawn","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"}],"internalType":"structAaveV4View.UserReserveData[]","name":"reserves","type":"tuple[]"}],"internalType":"structAaveV4View.LoanData","name":"loanData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address[]","name":"_spokes","type":"address[]"}],"name":"getLoanDataForMultipleSpokes","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"riskPremium","type":"uint256"},{"internalType":"uint256","name":"avgCollateralFactor","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"},{"internalType":"uint256","name":"totalCollateralInUsd","type":"uint256"},{"internalType":"uint256","name":"totalDebtInUsd","type":"uint256"},{"internalType":"uint256","name":"activeCollateralCount","type":"uint256"},{"internalType":"uint256","name":"borrowedCount","type":"uint256"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"supplied","type":"uint256"},{"internalType":"uint256","name":"drawn","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"}],"internalType":"structAaveV4View.UserReserveData[]","name":"reserves","type":"tuple[]"}],"internalType":"structAaveV4View.LoanData[]","name":"loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"getLoanDataForMultipleUsers","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"riskPremium","type":"uint256"},{"internalType":"uint256","name":"avgCollateralFactor","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"},{"internalType":"uint256","name":"totalCollateralInUsd","type":"uint256"},{"internalType":"uint256","name":"totalDebtInUsd","type":"uint256"},{"internalType":"uint256","name":"activeCollateralCount","type":"uint256"},{"internalType":"uint256","name":"borrowedCount","type":"uint256"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"supplied","type":"uint256"},{"internalType":"uint256","name":"drawn","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"}],"internalType":"structAaveV4View.UserReserveData[]","name":"reserves","type":"tuple[]"}],"internalType":"structAaveV4View.LoanData[]","name":"loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getLoanDataFull","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"riskPremium","type":"uint256"},{"internalType":"uint256","name":"avgCollateralFactor","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"},{"internalType":"uint256","name":"totalCollateralInUsd","type":"uint256"},{"internalType":"uint256","name":"totalDebtInUsd","type":"uint256"},{"internalType":"uint256","name":"activeCollateralCount","type":"uint256"},{"internalType":"uint256","name":"borrowedCount","type":"uint256"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"},{"internalType":"bool","name":"reservePaused","type":"bool"},{"internalType":"bool","name":"reserveFrozen","type":"bool"},{"internalType":"bool","name":"borrowable","type":"bool"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokePaused","type":"bool"},{"internalType":"uint256","name":"userSupplied","type":"uint256"},{"internalType":"uint256","name":"userDrawn","type":"uint256"},{"internalType":"uint256","name":"userPremium","type":"uint256"},{"internalType":"uint256","name":"userTotalDebt","type":"uint256"},{"internalType":"uint24","name":"collateralRisk","type":"uint24"},{"internalType":"uint16","name":"userCollateralFactor","type":"uint16"},{"internalType":"uint32","name":"userMaxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"userLiquidationFee","type":"uint16"},{"internalType":"uint16","name":"latestCollateralFactor","type":"uint16"},{"internalType":"uint32","name":"latestMaxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"latestLiquidationFee","type":"uint16"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint16","name":"hubAssetId","type":"uint16"},{"internalType":"uint256","name":"hubLiquidity","type":"uint256"},{"internalType":"uint96","name":"drawnRate","type":"uint96"},{"internalType":"uint120","name":"drawnIndex","type":"uint120"},{"internalType":"uint256","name":"spokeTotalSupplied","type":"uint256"},{"internalType":"uint256","name":"spokeTotalDrawn","type":"uint256"},{"internalType":"uint256","name":"spokeTotalPremium","type":"uint256"},{"internalType":"uint256","name":"spokeTotalDebt","type":"uint256"},{"internalType":"uint256","name":"spokeSupplyCap","type":"uint256"},{"internalType":"uint256","name":"spokeBorrowCap","type":"uint256"},{"internalType":"uint256","name":"spokeDeficitRay","type":"uint256"}],"internalType":"structAaveV4View.UserReserveDataFull[]","name":"reserves","type":"tuple[]"}],"internalType":"structAaveV4View.LoanDataWithFullReserves","name":"loanData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256","name":"_reserveId","type":"uint256"}],"name":"getReserveData","outputs":[{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"structAaveV4View.ReserveData","name":"reserveData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256","name":"_reserveId","type":"uint256"}],"name":"getReserveDataFull","outputs":[{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"frozen","type":"bool"},{"internalType":"bool","name":"borrowable","type":"bool"},{"internalType":"uint24","name":"collateralRisk","type":"uint24"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"deficitRay","type":"uint256"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokePaused","type":"bool"}],"internalType":"structAaveV4View.ReserveDataFull","name":"reserveData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256","name":"_reserveId","type":"uint256"}],"name":"getReservePrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256[]","name":"_reserveIds","type":"uint256[]"}],"name":"getReservePrices","outputs":[{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256[]","name":"_reserveIds","type":"uint256[]"}],"name":"getReservesData","outputs":[{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"structAaveV4View.ReserveData[]","name":"reserveData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256[]","name":"_reserveIds","type":"uint256[]"}],"name":"getReservesDataFull","outputs":[{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"frozen","type":"bool"},{"internalType":"bool","name":"borrowable","type":"bool"},{"internalType":"uint24","name":"collateralRisk","type":"uint24"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"deficitRay","type":"uint256"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokePaused","type":"bool"}],"internalType":"structAaveV4View.ReserveDataFull[]","name":"reserveData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"}],"name":"getSpokeData","outputs":[{"components":[{"internalType":"uint128","name":"targetHealthFactor","type":"uint128"},{"internalType":"uint64","name":"healthFactorForMaxBonus","type":"uint64"},{"internalType":"uint16","name":"liquidationBonusFactor","type":"uint16"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"uint256","name":"oracleDecimals","type":"uint256"},{"internalType":"uint256","name":"reserveCount","type":"uint256"}],"internalType":"structAaveV4View.SpokeData","name":"spokeData","type":"tuple"},{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"structAaveV4View.ReserveData[]","name":"reserves","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"}],"name":"getSpokeDataFull","outputs":[{"components":[{"internalType":"uint128","name":"targetHealthFactor","type":"uint128"},{"internalType":"uint64","name":"healthFactorForMaxBonus","type":"uint64"},{"internalType":"uint16","name":"liquidationBonusFactor","type":"uint16"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"uint256","name":"oracleDecimals","type":"uint256"},{"internalType":"uint256","name":"reserveCount","type":"uint256"}],"internalType":"structAaveV4View.SpokeData","name":"spokeData","type":"tuple"},{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"frozen","type":"bool"},{"internalType":"bool","name":"borrowable","type":"bool"},{"internalType":"uint24","name":"collateralRisk","type":"uint24"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"deficitRay","type":"uint256"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokePaused","type":"bool"}],"internalType":"structAaveV4View.ReserveDataFull[]","name":"reserves","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_hub","type":"address"},{"internalType":"uint256","name":"_assetId","type":"uint256"}],"name":"getSpokesForAsset","outputs":[{"internalType":"address[]","name":"spokes","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256[]","name":"_reserveIds","type":"uint256[]"}],"name":"getUserReserveData","outputs":[{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"supplied","type":"uint256"},{"internalType":"uint256","name":"drawn","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"}],"internalType":"structAaveV4View.UserReserveData[]","name":"_userReserves","type":"tuple[]"}],"stateMutability":"view","type":"function"}],
|
|
1324
|
+
"networks": {
|
|
1325
|
+
"1": {
|
|
1326
|
+
"address": "0xF0D440dE7f82A1e598992A648E5Bfa5d69b8E3a9",
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1321
1329
|
} as const;
|
package/src/contracts.ts
CHANGED
|
@@ -169,4 +169,6 @@ export const YearnViewContractViem = createViemContractFromConfigFunc('YearnView
|
|
|
169
169
|
|
|
170
170
|
export const MakerDsrContractViem = createViemContractFromConfigFunc('MakerDsr');
|
|
171
171
|
|
|
172
|
-
export const SkySavingsContractView = createViemContractFromConfigFunc('SkySavings');
|
|
172
|
+
export const SkySavingsContractView = createViemContractFromConfigFunc('SkySavings');
|
|
173
|
+
|
|
174
|
+
export const AaveV4ViewContractViem = createViemContractFromConfigFunc('AaveV4View');
|