@defisaver/positions-sdk 2.1.52-aave-v4 → 2.1.52-dev-2
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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +64 -64
- package/cjs/config/contracts.d.ts +0 -1277
- package/cjs/config/contracts.js +0 -9
- package/cjs/contracts.d.ts +0 -23120
- package/cjs/contracts.js +1 -2
- package/cjs/fluid/index.d.ts +3 -3
- package/cjs/helpers/aaveHelpers/index.d.ts +2 -2
- package/cjs/helpers/aaveHelpers/index.js +18 -2
- package/cjs/helpers/compoundHelpers/index.js +1 -1
- package/cjs/helpers/eulerHelpers/index.d.ts +2 -2
- package/cjs/helpers/eulerHelpers/index.js +6 -5
- package/cjs/helpers/fluidHelpers/index.js +2 -1
- package/cjs/helpers/index.d.ts +0 -1
- package/cjs/helpers/index.js +1 -2
- package/cjs/helpers/morphoBlueHelpers/index.js +67 -67
- package/cjs/helpers/sparkHelpers/index.js +1 -1
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +1 -3
- package/cjs/markets/index.d.ts +0 -1
- package/cjs/markets/index.js +1 -3
- package/cjs/moneymarket/moneymarketCommonService.d.ts +3 -3
- package/cjs/moneymarket/moneymarketCommonService.js +14 -6
- package/cjs/portfolio/index.js +0 -20
- package/cjs/savings/morphoVaults/index.js +17 -17
- package/cjs/types/aave.d.ts +3 -2
- package/cjs/types/common.d.ts +8 -0
- package/cjs/types/common.js +10 -1
- package/cjs/types/compound.d.ts +2 -2
- package/cjs/types/curveUsd.d.ts +2 -2
- package/cjs/types/euler.d.ts +2 -2
- package/cjs/types/fluid.d.ts +2 -2
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/cjs/types/liquityV2.d.ts +3 -3
- package/cjs/types/llamaLend.d.ts +2 -2
- package/cjs/types/morphoBlue.d.ts +3 -3
- package/cjs/types/portfolio.d.ts +0 -4
- package/cjs/types/spark.d.ts +2 -2
- package/esm/config/contracts.d.ts +0 -1277
- package/esm/config/contracts.js +0 -8
- package/esm/contracts.d.ts +0 -23120
- package/esm/contracts.js +0 -1
- package/esm/fluid/index.d.ts +3 -3
- package/esm/helpers/aaveHelpers/index.d.ts +2 -2
- package/esm/helpers/aaveHelpers/index.js +18 -2
- package/esm/helpers/compoundHelpers/index.js +2 -2
- package/esm/helpers/eulerHelpers/index.d.ts +2 -2
- package/esm/helpers/eulerHelpers/index.js +6 -5
- package/esm/helpers/fluidHelpers/index.js +2 -1
- package/esm/helpers/index.d.ts +0 -1
- package/esm/helpers/index.js +0 -1
- package/esm/helpers/morphoBlueHelpers/index.js +68 -68
- package/esm/helpers/sparkHelpers/index.js +2 -2
- package/esm/index.d.ts +1 -2
- package/esm/index.js +1 -2
- package/esm/markets/index.d.ts +0 -1
- package/esm/markets/index.js +0 -1
- package/esm/moneymarket/moneymarketCommonService.d.ts +3 -3
- package/esm/moneymarket/moneymarketCommonService.js +14 -6
- package/esm/portfolio/index.js +1 -21
- package/esm/savings/morphoVaults/index.js +17 -17
- package/esm/types/aave.d.ts +3 -2
- package/esm/types/common.d.ts +8 -0
- package/esm/types/common.js +9 -0
- package/esm/types/compound.d.ts +2 -2
- package/esm/types/curveUsd.d.ts +2 -2
- package/esm/types/euler.d.ts +2 -2
- package/esm/types/fluid.d.ts +2 -2
- package/esm/types/fluid.js +1 -1
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/esm/types/liquityV2.d.ts +3 -3
- package/esm/types/llamaLend.d.ts +2 -2
- package/esm/types/morphoBlue.d.ts +3 -3
- package/esm/types/portfolio.d.ts +0 -4
- package/esm/types/spark.d.ts +2 -2
- package/package.json +48 -48
- package/src/aaveV2/index.ts +240 -240
- package/src/aaveV3/index.ts +635 -635
- package/src/aaveV3/merit.ts +97 -97
- package/src/aaveV3/merkl.ts +74 -74
- package/src/claiming/aaveV3.ts +154 -154
- package/src/claiming/compV3.ts +22 -22
- package/src/claiming/ethena.ts +61 -61
- package/src/claiming/index.ts +12 -12
- package/src/claiming/king.ts +66 -66
- package/src/claiming/morphoBlue.ts +118 -118
- package/src/claiming/spark.ts +225 -225
- package/src/compoundV2/index.ts +244 -244
- package/src/compoundV3/index.ts +274 -274
- package/src/config/contracts.ts +1320 -1328
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +172 -174
- package/src/curveUsd/index.ts +254 -254
- package/src/eulerV2/index.ts +324 -324
- package/src/exchange/index.ts +25 -25
- package/src/fluid/index.ts +1800 -1800
- package/src/helpers/aaveHelpers/index.ts +207 -191
- package/src/helpers/compoundHelpers/index.ts +283 -283
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +222 -222
- package/src/helpers/fluidHelpers/index.ts +326 -326
- package/src/helpers/index.ts +10 -11
- package/src/helpers/liquityV2Helpers/index.ts +82 -82
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +52 -52
- package/src/helpers/morphoBlueHelpers/index.ts +396 -396
- package/src/helpers/sparkHelpers/index.ts +160 -158
- package/src/index.ts +49 -51
- package/src/liquity/index.ts +159 -159
- package/src/liquityV2/index.ts +703 -703
- package/src/llamaLend/index.ts +305 -305
- package/src/maker/index.ts +223 -223
- package/src/markets/aave/index.ts +118 -118
- package/src/markets/aave/marketAssets.ts +54 -54
- package/src/markets/compound/index.ts +243 -243
- package/src/markets/compound/marketsAssets.ts +97 -97
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2900 -2900
- package/src/markets/index.ts +25 -26
- package/src/markets/liquityV2/index.ts +102 -102
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +988 -988
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +92 -85
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +586 -606
- package/src/savings/index.ts +95 -95
- package/src/savings/makerDsr/index.ts +53 -53
- package/src/savings/makerDsr/options.ts +9 -9
- package/src/savings/morphoVaults/index.ts +80 -80
- package/src/savings/morphoVaults/options.ts +193 -193
- package/src/savings/skyOptions/index.ts +95 -95
- package/src/savings/skyOptions/options.ts +10 -10
- package/src/savings/sparkSavingsVaults/index.ts +60 -60
- package/src/savings/sparkSavingsVaults/options.ts +35 -35
- package/src/savings/yearnV3Vaults/index.ts +61 -61
- package/src/savings/yearnV3Vaults/options.ts +55 -55
- package/src/savings/yearnVaults/index.ts +73 -73
- package/src/savings/yearnVaults/options.ts +32 -32
- package/src/services/priceService.ts +278 -278
- package/src/services/utils.ts +115 -115
- package/src/services/viem.ts +57 -57
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +459 -459
- package/src/staking/eligibility.ts +53 -53
- package/src/staking/index.ts +1 -1
- package/src/staking/staking.ts +192 -192
- package/src/types/aave.ts +200 -198
- package/src/types/claiming.ts +114 -114
- package/src/types/common.ts +116 -107
- package/src/types/compound.ts +145 -144
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +176 -175
- package/src/types/fluid.ts +485 -483
- package/src/types/index.ts +15 -16
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +128 -126
- package/src/types/llamaLend.ts +161 -159
- package/src/types/maker.ts +63 -63
- package/src/types/merit.ts +1 -1
- package/src/types/merkl.ts +70 -70
- package/src/types/morphoBlue.ts +202 -202
- package/src/types/portfolio.ts +60 -64
- package/src/types/savings/index.ts +23 -23
- package/src/types/savings/makerDsr.ts +13 -13
- package/src/types/savings/morphoVaults.ts +32 -32
- package/src/types/savings/sky.ts +14 -14
- package/src/types/savings/sparkSavingsVaults.ts +15 -15
- package/src/types/savings/yearnV3Vaults.ts +17 -17
- package/src/types/savings/yearnVaults.ts +14 -14
- package/src/types/spark.ts +135 -134
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
- package/cjs/aaveV4/index.d.ts +0 -7
- package/cjs/aaveV4/index.js +0 -174
- package/cjs/helpers/aaveV4Helpers/index.d.ts +0 -13
- package/cjs/helpers/aaveV4Helpers/index.js +0 -109
- package/cjs/markets/aaveV4/index.d.ts +0 -13
- package/cjs/markets/aaveV4/index.js +0 -39
- package/cjs/types/aaveV4.d.ts +0 -137
- package/cjs/types/aaveV4.js +0 -11
- package/esm/aaveV4/index.d.ts +0 -7
- package/esm/aaveV4/index.js +0 -165
- package/esm/helpers/aaveV4Helpers/index.d.ts +0 -13
- package/esm/helpers/aaveV4Helpers/index.js +0 -100
- package/esm/markets/aaveV4/index.d.ts +0 -13
- package/esm/markets/aaveV4/index.js +0 -29
- package/esm/types/aaveV4.d.ts +0 -137
- package/esm/types/aaveV4.js +0 -8
- package/src/aaveV4/index.ts +0 -176
- package/src/helpers/aaveV4Helpers/index.ts +0 -121
- package/src/markets/aaveV4/index.ts +0 -42
- package/src/types/aaveV4.ts +0 -151
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
export enum UmbrellaStaking {
|
|
2
|
-
UmbrellaGHO = 'UmbrellaGHO',
|
|
3
|
-
UmbrellaUSDC = 'UmbrellaUSDC',
|
|
4
|
-
UmbrellaUSDT = 'UmbrellaUSDT',
|
|
5
|
-
UmbrellaETH = 'UmbrellaETH',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const tokenMapping = {
|
|
9
|
-
[UmbrellaStaking.UmbrellaUSDC]: '0x6bf183243FdD1e306ad2C4450BC7dcf6f0bf8Aa6',
|
|
10
|
-
[UmbrellaStaking.UmbrellaUSDT]: '0xA484Ab92fe32B143AEE7019fC1502b1dAA522D31',
|
|
11
|
-
[UmbrellaStaking.UmbrellaETH]: '0xaAFD07D53A7365D3e9fb6F3a3B09EC19676B73Ce',
|
|
12
|
-
[UmbrellaStaking.UmbrellaGHO]: '0x4f827A63755855cDf3e8f3bcD20265C833f15033',
|
|
13
|
-
} as const;
|
|
14
|
-
|
|
15
|
-
// ----- chat gpt code for result mapping ---------
|
|
16
|
-
export const normalize = (addr?: string) => addr?.toLowerCase?.() ?? '';
|
|
17
|
-
|
|
18
|
-
export const tokenEntries = Object.entries(tokenMapping).map(([symbol, address]) => [
|
|
19
|
-
symbol,
|
|
20
|
-
normalize(address),
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
// 👇 Define how to extract the token address from each source type
|
|
24
|
-
export const extractAddress = (item?: { stakeToken?: string, stkToken?: string, stakeTokenData?: { token?: string } }): string => normalize(item?.stakeToken
|
|
25
|
-
|| item?.stkToken
|
|
26
|
-
|| item?.stakeTokenData?.token,
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
// 👇 Utility to find the matching object in a dataset
|
|
1
|
+
export enum UmbrellaStaking {
|
|
2
|
+
UmbrellaGHO = 'UmbrellaGHO',
|
|
3
|
+
UmbrellaUSDC = 'UmbrellaUSDC',
|
|
4
|
+
UmbrellaUSDT = 'UmbrellaUSDT',
|
|
5
|
+
UmbrellaETH = 'UmbrellaETH',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const tokenMapping = {
|
|
9
|
+
[UmbrellaStaking.UmbrellaUSDC]: '0x6bf183243FdD1e306ad2C4450BC7dcf6f0bf8Aa6',
|
|
10
|
+
[UmbrellaStaking.UmbrellaUSDT]: '0xA484Ab92fe32B143AEE7019fC1502b1dAA522D31',
|
|
11
|
+
[UmbrellaStaking.UmbrellaETH]: '0xaAFD07D53A7365D3e9fb6F3a3B09EC19676B73Ce',
|
|
12
|
+
[UmbrellaStaking.UmbrellaGHO]: '0x4f827A63755855cDf3e8f3bcD20265C833f15033',
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
// ----- chat gpt code for result mapping ---------
|
|
16
|
+
export const normalize = (addr?: string) => addr?.toLowerCase?.() ?? '';
|
|
17
|
+
|
|
18
|
+
export const tokenEntries = Object.entries(tokenMapping).map(([symbol, address]) => [
|
|
19
|
+
symbol,
|
|
20
|
+
normalize(address),
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
// 👇 Define how to extract the token address from each source type
|
|
24
|
+
export const extractAddress = (item?: { stakeToken?: string, stkToken?: string, stakeTokenData?: { token?: string } }): string => normalize(item?.stakeToken
|
|
25
|
+
|| item?.stkToken
|
|
26
|
+
|| item?.stakeTokenData?.token,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
// 👇 Utility to find the matching object in a dataset
|
|
30
30
|
export const findMatching = (dataset: any[], targetAddr: string) => dataset.find((item) => extractAddress(item) === targetAddr);
|
package/cjs/aaveV4/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Client } from 'viem';
|
|
2
|
-
import { AaveV4AccountData, AaveV4SpokeData, AaveV4SpokeInfo } from '../types';
|
|
3
|
-
import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
|
|
4
|
-
export declare function _getAaveV4SpokeData(provider: Client, network: NetworkNumber, market: AaveV4SpokeInfo, blockNumber?: 'latest' | number): Promise<AaveV4SpokeData>;
|
|
5
|
-
export declare function getAaveV4SpokeData(provider: EthereumProvider, network: NetworkNumber, spoke: AaveV4SpokeInfo, blockNumber?: 'latest' | number): Promise<AaveV4SpokeData>;
|
|
6
|
-
export declare function _getAaveV4AccountData(provider: Client, network: NetworkNumber, spokeData: AaveV4SpokeData, address: EthAddress, blockNumber?: 'latest' | number): Promise<AaveV4AccountData>;
|
|
7
|
-
export declare function getAaveV4AccountData(provider: EthereumProvider, network: NetworkNumber, marketData: AaveV4SpokeData, address: EthAddress, blockNumber?: 'latest' | number): Promise<any>;
|
package/cjs/aaveV4/index.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports._getAaveV4SpokeData = _getAaveV4SpokeData;
|
|
16
|
-
exports.getAaveV4SpokeData = getAaveV4SpokeData;
|
|
17
|
-
exports._getAaveV4AccountData = _getAaveV4AccountData;
|
|
18
|
-
exports.getAaveV4AccountData = getAaveV4AccountData;
|
|
19
|
-
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
20
|
-
const tokens_1 = require("@defisaver/tokens");
|
|
21
|
-
const viem_1 = require("../services/viem");
|
|
22
|
-
const common_1 = require("../types/common");
|
|
23
|
-
const contracts_1 = require("../contracts");
|
|
24
|
-
const staking_1 = require("../staking");
|
|
25
|
-
const utils_1 = require("../services/utils");
|
|
26
|
-
const aaveV4Helpers_1 = require("../helpers/aaveV4Helpers");
|
|
27
|
-
const aaveV4_1 = require("../markets/aaveV4");
|
|
28
|
-
const fetchHubData = (viewContract, hubAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
-
const hubData = yield viewContract.read.getHubAllAssetsData([hubAddress]);
|
|
30
|
-
return {
|
|
31
|
-
assets: hubData.reduce((acc, assetOnChainData) => {
|
|
32
|
-
acc[assetOnChainData.assetId] = {
|
|
33
|
-
assetId: assetOnChainData.assetId,
|
|
34
|
-
drawnRate: assetOnChainData.drawnRate,
|
|
35
|
-
};
|
|
36
|
-
return acc;
|
|
37
|
-
}, {}),
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
const formatReserveAsset = (reserveAsset, hubAsset, reserveId, oracleDecimals, network) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
-
const assetInfo = (0, tokens_1.getAssetInfoByAddress)(reserveAsset.underlying, network);
|
|
42
|
-
const symbol = (0, utils_1.wethToEth)(assetInfo.symbol);
|
|
43
|
-
const hubInfo = (0, aaveV4_1.getAaveV4HubByAddress)(network, reserveAsset.hub);
|
|
44
|
-
if (!hubInfo) {
|
|
45
|
-
throw new Error(`Hub not found with address: ${reserveAsset.hub}`);
|
|
46
|
-
}
|
|
47
|
-
const isStakingAsset = staking_1.STAKING_ASSETS.includes(symbol);
|
|
48
|
-
const supplyIncentives = [];
|
|
49
|
-
const borrowIncentives = [];
|
|
50
|
-
if (isStakingAsset) {
|
|
51
|
-
const yieldApy = yield (0, staking_1.getStakingApy)(symbol, network);
|
|
52
|
-
supplyIncentives.push({
|
|
53
|
-
apy: yieldApy,
|
|
54
|
-
token: symbol,
|
|
55
|
-
incentiveKind: common_1.IncentiveKind.Staking,
|
|
56
|
-
description: `Native ${symbol} yield.`,
|
|
57
|
-
});
|
|
58
|
-
if (reserveAsset.borrowable) {
|
|
59
|
-
// when borrowing assets whose value increases over time
|
|
60
|
-
borrowIncentives.push({
|
|
61
|
-
apy: new decimal_js_1.default(yieldApy).mul(-1).toString(),
|
|
62
|
-
token: symbol,
|
|
63
|
-
incentiveKind: common_1.IncentiveKind.Reward,
|
|
64
|
-
description: `Due to the native yield of ${symbol}, the value of the debt would increase over time.`,
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return ({
|
|
69
|
-
symbol,
|
|
70
|
-
underlying: reserveAsset.underlying,
|
|
71
|
-
hub: hubInfo.address,
|
|
72
|
-
hubName: hubInfo === null || hubInfo === void 0 ? void 0 : hubInfo.label,
|
|
73
|
-
assetId: reserveAsset.assetId,
|
|
74
|
-
reserveId,
|
|
75
|
-
paused: reserveAsset.paused,
|
|
76
|
-
frozen: reserveAsset.frozen,
|
|
77
|
-
borrowable: reserveAsset.borrowable,
|
|
78
|
-
collateralRisk: new decimal_js_1.default(reserveAsset.collateralRisk).div(10000).toNumber(),
|
|
79
|
-
collateralFactor: new decimal_js_1.default(reserveAsset.collateralFactor).div(10000).toNumber(),
|
|
80
|
-
liquidationFee: new decimal_js_1.default(reserveAsset.liquidationFee).div(10000).toNumber(),
|
|
81
|
-
price: new decimal_js_1.default(reserveAsset.price).div(new decimal_js_1.default(10).pow(oracleDecimals)).toString(),
|
|
82
|
-
totalSupplied: (0, tokens_1.assetAmountInEth)(reserveAsset.totalSupplied.toString(), symbol),
|
|
83
|
-
totalDrawn: (0, tokens_1.assetAmountInEth)(reserveAsset.totalDrawn.toString(), symbol),
|
|
84
|
-
totalPremium: (0, tokens_1.assetAmountInEth)(reserveAsset.totalPremium.toString(), symbol),
|
|
85
|
-
totalDebt: (0, tokens_1.assetAmountInEth)(reserveAsset.totalDebt.toString(), symbol),
|
|
86
|
-
supplyCap: (0, tokens_1.assetAmountInEth)(reserveAsset.supplyCap.toString(), symbol),
|
|
87
|
-
borrowCap: (0, tokens_1.assetAmountInEth)(reserveAsset.borrowCap.toString(), symbol),
|
|
88
|
-
spokeActive: reserveAsset.spokeActive,
|
|
89
|
-
spokePaused: reserveAsset.spokePaused,
|
|
90
|
-
drawnRate: new decimal_js_1.default(hubAsset.drawnRate).div(new decimal_js_1.default(10).pow(27)).toString(),
|
|
91
|
-
supplyRate: '0', // To be implemented
|
|
92
|
-
supplyIncentives,
|
|
93
|
-
borrowIncentives,
|
|
94
|
-
canBeBorrowed: reserveAsset.spokeActive && !reserveAsset.spokePaused && !reserveAsset.paused && !reserveAsset.frozen,
|
|
95
|
-
canBeSupplied: reserveAsset.spokeActive && !reserveAsset.spokePaused && !reserveAsset.paused && !reserveAsset.frozen,
|
|
96
|
-
canBeWithdrawn: reserveAsset.spokeActive && !reserveAsset.spokePaused && !reserveAsset.paused,
|
|
97
|
-
canBePayBacked: reserveAsset.spokeActive && !reserveAsset.spokePaused && !reserveAsset.paused,
|
|
98
|
-
utilization: new decimal_js_1.default(reserveAsset.totalDrawn.toString()).times(100).div(new decimal_js_1.default(reserveAsset.totalSupplied.toString())).toString(),
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
function _getAaveV4SpokeData(provider_1, network_1, market_1) {
|
|
102
|
-
return __awaiter(this, arguments, void 0, function* (provider, network, market, blockNumber = 'latest') {
|
|
103
|
-
const viewContract = (0, contracts_1.AaveV4ViewContractViem)(provider, network, blockNumber);
|
|
104
|
-
const hubsData = {};
|
|
105
|
-
const [spokeData] = yield Promise.all([
|
|
106
|
-
viewContract.read.getSpokeDataFull([market.address]),
|
|
107
|
-
...market.hubs.map((hubAddress) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
hubsData[hubAddress] = yield fetchHubData(viewContract, hubAddress);
|
|
109
|
-
})),
|
|
110
|
-
]);
|
|
111
|
-
const reserveAssetsArray = yield Promise.all(spokeData[1].map((reserveAssetOnChain, index) => __awaiter(this, void 0, void 0, function* () { return formatReserveAsset(reserveAssetOnChain, hubsData[reserveAssetOnChain.hub].assets[reserveAssetOnChain.assetId], index, +spokeData[0].oracleDecimals.toString(), network); })));
|
|
112
|
-
return {
|
|
113
|
-
assetsData: reserveAssetsArray.reduce((acc, reserveAsset) => {
|
|
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
|
-
function getAaveV4SpokeData(provider_1, network_1, spoke_1) {
|
|
124
|
-
return __awaiter(this, arguments, void 0, function* (provider, network, spoke, blockNumber = 'latest') {
|
|
125
|
-
return _getAaveV4SpokeData((0, viem_1.getViemProvider)(provider, network), network, spoke, blockNumber);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function _getAaveV4AccountData(provider_1, network_1, spokeData_1, address_1) {
|
|
129
|
-
return __awaiter(this, arguments, void 0, function* (provider, network, spokeData, address, blockNumber = 'latest') {
|
|
130
|
-
const viewContract = (0, contracts_1.AaveV4ViewContractViem)(provider, network, blockNumber);
|
|
131
|
-
const loanData = yield viewContract.read.getLoanData([spokeData.address, address]);
|
|
132
|
-
const healthFactor = new decimal_js_1.default(loanData.healthFactor).div(1e18).toString();
|
|
133
|
-
const usedAssets = loanData.reserves.reduce((acc, usedReserveAsset) => {
|
|
134
|
-
const identifier = `${(0, utils_1.wethToEth)((0, tokens_1.getAssetInfoByAddress)(usedReserveAsset.underlying, network).symbol)}-${+usedReserveAsset.reserveId.toString()}`;
|
|
135
|
-
const reserveData = spokeData.assetsData[identifier];
|
|
136
|
-
const price = reserveData.price;
|
|
137
|
-
const supplied = (0, tokens_1.assetAmountInEth)(usedReserveAsset.supplied.toString(), reserveData.symbol);
|
|
138
|
-
const drawn = (0, tokens_1.assetAmountInEth)(usedReserveAsset.drawn.toString(), reserveData.symbol);
|
|
139
|
-
const premium = (0, tokens_1.assetAmountInEth)(usedReserveAsset.premium.toString(), reserveData.symbol);
|
|
140
|
-
const borrowed = (0, tokens_1.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 decimal_js_1.default(supplied).mul(price).toString(),
|
|
148
|
-
drawn,
|
|
149
|
-
drawnUsd: new decimal_js_1.default(drawn).mul(price).toString(),
|
|
150
|
-
premium,
|
|
151
|
-
premiumUsd: new decimal_js_1.default(premium).mul(price).toString(),
|
|
152
|
-
borrowed,
|
|
153
|
-
borrowedUsd: new decimal_js_1.default(borrowed).mul(price).toString(),
|
|
154
|
-
isSupplied: !new decimal_js_1.default(supplied).eq(0),
|
|
155
|
-
isBorrowed: usedReserveAsset.isBorrowing,
|
|
156
|
-
collateral: usedReserveAsset.isUsingAsCollateral,
|
|
157
|
-
collateralFactor: new decimal_js_1.default(usedReserveAsset.collateralFactor).div(10000).toNumber(),
|
|
158
|
-
};
|
|
159
|
-
return acc;
|
|
160
|
-
}, {});
|
|
161
|
-
return Object.assign({ usedAssets,
|
|
162
|
-
healthFactor }, (0, aaveV4Helpers_1.aaveV4GetAggregatedPositionData)({
|
|
163
|
-
usedAssets,
|
|
164
|
-
assetsData: spokeData.assetsData,
|
|
165
|
-
network,
|
|
166
|
-
useUserCollateralFactor: true,
|
|
167
|
-
}));
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function getAaveV4AccountData(provider_1, network_1, marketData_1, address_1) {
|
|
171
|
-
return __awaiter(this, arguments, void 0, function* (provider, network, marketData, address, blockNumber = 'latest') {
|
|
172
|
-
return _getAaveV4AccountData((0, viem_1.getViemProvider)(provider, network), network, marketData, address, blockNumber);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AaveV4AggregatedPositionData, AaveV4AssetsData, AaveV4ReserveAssetData, AaveV4UsedReserveAsset, AaveV4UsedReserveAssets } from '../../types';
|
|
2
|
-
import { NetworkNumber } from '../../types/common';
|
|
3
|
-
export declare const aaveV4GetCollateralFactor: (assetData: AaveV4ReserveAssetData, usedAssetData: AaveV4UsedReserveAsset, useUserCollateralFactor?: boolean) => number;
|
|
4
|
-
export declare const isLeveragedPosAaveV4: (usedAssets: AaveV4UsedReserveAssets, dustLimit?: number) => {
|
|
5
|
-
leveragedType: string;
|
|
6
|
-
leveragedAsset: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const aaveV4GetAggregatedPositionData: ({ usedAssets, assetsData, network, useUserCollateralFactor, }: {
|
|
9
|
-
usedAssets: AaveV4UsedReserveAssets;
|
|
10
|
-
assetsData: AaveV4AssetsData;
|
|
11
|
-
network: NetworkNumber;
|
|
12
|
-
useUserCollateralFactor?: boolean;
|
|
13
|
-
}) => AaveV4AggregatedPositionData;
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.aaveV4GetAggregatedPositionData = exports.isLeveragedPosAaveV4 = exports.aaveV4GetCollateralFactor = void 0;
|
|
7
|
-
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
|
-
const moneymarket_1 = require("../../moneymarket");
|
|
9
|
-
const aaveV4GetCollateralFactor = (assetData, usedAssetData, useUserCollateralFactor = false) => (useUserCollateralFactor ? usedAssetData.collateralFactor : assetData.collateralFactor);
|
|
10
|
-
exports.aaveV4GetCollateralFactor = aaveV4GetCollateralFactor;
|
|
11
|
-
const isLeveragedPosAaveV4 = (usedAssets, dustLimit = 5) => {
|
|
12
|
-
let borrowUnstable = 0;
|
|
13
|
-
let supplyStable = 0;
|
|
14
|
-
let borrowStable = 0;
|
|
15
|
-
let supplyUnstable = 0;
|
|
16
|
-
let longAsset = '';
|
|
17
|
-
let shortAsset = '';
|
|
18
|
-
Object.values(usedAssets).forEach(({ symbol, suppliedUsd, borrowedUsd, collateral, reserveId, }) => {
|
|
19
|
-
const spokeAsset = `${symbol}-${reserveId}`;
|
|
20
|
-
const isSupplied = (+suppliedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
21
|
-
const isBorrowed = (+borrowedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
22
|
-
if (isSupplied && moneymarket_1.STABLE_ASSETS.includes(symbol) && collateral)
|
|
23
|
-
supplyStable += 1;
|
|
24
|
-
if (isBorrowed && moneymarket_1.STABLE_ASSETS.includes(symbol))
|
|
25
|
-
borrowStable += 1;
|
|
26
|
-
if (isBorrowed && !moneymarket_1.STABLE_ASSETS.includes(symbol)) {
|
|
27
|
-
borrowUnstable += 1;
|
|
28
|
-
shortAsset = spokeAsset;
|
|
29
|
-
}
|
|
30
|
-
if (isSupplied && !moneymarket_1.STABLE_ASSETS.includes(symbol) && collateral) {
|
|
31
|
-
supplyUnstable += 1;
|
|
32
|
-
longAsset = spokeAsset;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
36
|
-
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
37
|
-
// lsd -> liquid staking derivative
|
|
38
|
-
const isLsdLeveraged = supplyUnstable === 1 && borrowUnstable === 1 && shortAsset === 'ETH' && ['stETH', 'wstETH', 'cbETH', 'rETH', 'ezETH', 'weETH'].includes(longAsset);
|
|
39
|
-
if (isLong) {
|
|
40
|
-
return {
|
|
41
|
-
leveragedType: 'long',
|
|
42
|
-
leveragedAsset: longAsset,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (isShort) {
|
|
46
|
-
return {
|
|
47
|
-
leveragedType: 'short',
|
|
48
|
-
leveragedAsset: shortAsset,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
if (isLsdLeveraged) {
|
|
52
|
-
return {
|
|
53
|
-
leveragedType: 'lsd-leverage',
|
|
54
|
-
leveragedAsset: longAsset,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
leveragedType: '',
|
|
59
|
-
leveragedAsset: '',
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
exports.isLeveragedPosAaveV4 = isLeveragedPosAaveV4;
|
|
63
|
-
const aaveV4GetAggregatedPositionData = ({ usedAssets, assetsData, network, useUserCollateralFactor = false, }) => {
|
|
64
|
-
var _a;
|
|
65
|
-
const payload = {};
|
|
66
|
-
payload.suppliedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
67
|
-
payload.suppliedCollateralUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
|
|
68
|
-
payload.borrowLimitUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ symbol, suppliedUsd, reserveId }) => new decimal_js_1.default(suppliedUsd).mul((0, exports.aaveV4GetCollateralFactor)(assetsData[`${symbol}-${reserveId}`], usedAssets[`${symbol}-${reserveId}`], useUserCollateralFactor)));
|
|
69
|
-
payload.liquidationLimitUsd = payload.borrowLimitUsd;
|
|
70
|
-
payload.borrowedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
|
|
71
|
-
payload.drawnUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ drawnUsd }) => drawnUsd);
|
|
72
|
-
payload.premiumUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ premiumUsd }) => premiumUsd);
|
|
73
|
-
const leftToBorrowUsd = new decimal_js_1.default(payload.borrowLimitUsd).sub(payload.borrowedUsd);
|
|
74
|
-
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
75
|
-
payload.ratio = +payload.suppliedUsd ? new decimal_js_1.default(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
76
|
-
payload.collRatio = +payload.suppliedUsd ? new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
77
|
-
payload.liqRatio = new decimal_js_1.default(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
|
|
78
|
-
payload.liqPercent = new decimal_js_1.default(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
79
|
-
const { leveragedType, leveragedAsset } = (0, exports.isLeveragedPosAaveV4)(usedAssets);
|
|
80
|
-
payload.leveragedType = leveragedType;
|
|
81
|
-
payload.leveragedAsset = leveragedAsset;
|
|
82
|
-
payload.liquidationPrice = '';
|
|
83
|
-
if (leveragedType !== '') {
|
|
84
|
-
const leveragedAssetData = assetsData[leveragedAsset];
|
|
85
|
-
let assetPrice = (leveragedAssetData === null || leveragedAssetData === void 0 ? void 0 : leveragedAssetData.price) || '0';
|
|
86
|
-
if (leveragedType === 'lsd-leverage') {
|
|
87
|
-
// Treat ETH like a stablecoin in a long stETH position
|
|
88
|
-
const ethPrice = ((_a = Object.values(assetsData).find((asset) => asset.symbol === 'ETH')) === null || _a === void 0 ? void 0 : _a.price) || '0';
|
|
89
|
-
payload.leveragedLsdAssetRatio = new decimal_js_1.default((leveragedAssetData === null || leveragedAssetData === void 0 ? void 0 : leveragedAssetData.price) || '0').div(ethPrice).toDP(18).toString();
|
|
90
|
-
assetPrice = new decimal_js_1.default(assetPrice).div(ethPrice).toString();
|
|
91
|
-
}
|
|
92
|
-
payload.liquidationPrice = (0, moneymarket_1.calcLeverageLiqPrice)(leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
93
|
-
}
|
|
94
|
-
payload.minCollRatio = new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
|
|
95
|
-
payload.collLiquidationRatio = new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
96
|
-
// payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
|
|
97
|
-
payload.minHealthRatio = new decimal_js_1.default(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
|
|
98
|
-
// TODO: Re-implement netApy calculation
|
|
99
|
-
// const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({
|
|
100
|
-
// usedAssets,
|
|
101
|
-
// assetsData,
|
|
102
|
-
// optionalData: { healthRatio: payload.healthRatio },
|
|
103
|
-
// });
|
|
104
|
-
payload.netApy = '0';
|
|
105
|
-
payload.incentiveUsd = '0';
|
|
106
|
-
payload.totalInterestUsd = '0';
|
|
107
|
-
return payload;
|
|
108
|
-
};
|
|
109
|
-
exports.aaveV4GetAggregatedPositionData = aaveV4GetAggregatedPositionData;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AaveV4HubInfo, AaveV4HubsType, AaveV4SpokeInfo, AaveV4SpokesType } from '../../types';
|
|
2
|
-
import { NetworkNumber } from '../../types/common';
|
|
3
|
-
export declare const AAVE_V4_CORE_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
4
|
-
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
5
|
-
readonly aave_v4_core_spoke: AaveV4SpokeInfo;
|
|
6
|
-
};
|
|
7
|
-
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
8
|
-
export declare const AAVE_V4_CORE_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
9
|
-
export declare const AaveV4Hubs: (networkId: NetworkNumber) => {
|
|
10
|
-
readonly aave_v4_core_hub: AaveV4HubInfo;
|
|
11
|
-
};
|
|
12
|
-
export declare const getAaveV4HubTypeInfo: (type: AaveV4HubsType, network?: NetworkNumber) => AaveV4HubInfo;
|
|
13
|
-
export declare const getAaveV4HubByAddress: (networkId: NetworkNumber, address: string) => AaveV4HubInfo | undefined;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAaveV4HubByAddress = exports.getAaveV4HubTypeInfo = exports.AaveV4Hubs = exports.AAVE_V4_CORE_HUB = exports.getAaveV4SpokeTypeInfo = exports.AaveV4Spokes = exports.AAVE_V4_CORE_SPOKE = void 0;
|
|
4
|
-
const types_1 = require("../../types");
|
|
5
|
-
const common_1 = require("../../types/common");
|
|
6
|
-
// SPOKES
|
|
7
|
-
const AAVE_V4_CORE_SPOKE = (networkId) => ({
|
|
8
|
-
chainIds: [common_1.NetworkNumber.Eth],
|
|
9
|
-
label: 'Core Spoke',
|
|
10
|
-
value: types_1.AaveV4SpokesType.AaveV4CoreSpoke,
|
|
11
|
-
url: 'core',
|
|
12
|
-
address: '0xBa97c5E52cd5BC3D7950Ae70779F8FfE92d40CdC',
|
|
13
|
-
hubs: [
|
|
14
|
-
'0xaD905aD5EA5B98cD50AE40Cfe368344686a21366',
|
|
15
|
-
],
|
|
16
|
-
});
|
|
17
|
-
exports.AAVE_V4_CORE_SPOKE = AAVE_V4_CORE_SPOKE;
|
|
18
|
-
const AaveV4Spokes = (networkId) => ({
|
|
19
|
-
[types_1.AaveV4SpokesType.AaveV4CoreSpoke]: (0, exports.AAVE_V4_CORE_SPOKE)(networkId),
|
|
20
|
-
});
|
|
21
|
-
exports.AaveV4Spokes = AaveV4Spokes;
|
|
22
|
-
const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, (0, exports.AaveV4Spokes)(network !== null && network !== void 0 ? network : common_1.NetworkNumber.Eth))[type]);
|
|
23
|
-
exports.getAaveV4SpokeTypeInfo = getAaveV4SpokeTypeInfo;
|
|
24
|
-
// HUBS
|
|
25
|
-
const AAVE_V4_CORE_HUB = (networkId) => ({
|
|
26
|
-
chainIds: [common_1.NetworkNumber.Eth],
|
|
27
|
-
label: 'Core Hub',
|
|
28
|
-
value: types_1.AaveV4HubsType.AaveV4CoreHub,
|
|
29
|
-
address: '0xaD905aD5EA5B98cD50AE40Cfe368344686a21366',
|
|
30
|
-
});
|
|
31
|
-
exports.AAVE_V4_CORE_HUB = AAVE_V4_CORE_HUB;
|
|
32
|
-
const AaveV4Hubs = (networkId) => ({
|
|
33
|
-
[types_1.AaveV4HubsType.AaveV4CoreHub]: (0, exports.AAVE_V4_CORE_HUB)(networkId),
|
|
34
|
-
});
|
|
35
|
-
exports.AaveV4Hubs = AaveV4Hubs;
|
|
36
|
-
const getAaveV4HubTypeInfo = (type, network) => (Object.assign({}, (0, exports.AaveV4Hubs)(network !== null && network !== void 0 ? network : common_1.NetworkNumber.Eth))[type]);
|
|
37
|
-
exports.getAaveV4HubTypeInfo = getAaveV4HubTypeInfo;
|
|
38
|
-
const getAaveV4HubByAddress = (networkId, address) => Object.values((0, exports.AaveV4Hubs)(networkId)).find(hub => hub.address.toLowerCase() === address.toLowerCase());
|
|
39
|
-
exports.getAaveV4HubByAddress = getAaveV4HubByAddress;
|
package/cjs/types/aaveV4.d.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { EthAddress, IncentiveData, NetworkNumber } from './common';
|
|
2
|
-
export declare enum AaveV4SpokesType {
|
|
3
|
-
AaveV4CoreSpoke = "aave_v4_core_spoke"
|
|
4
|
-
}
|
|
5
|
-
export declare enum AaveV4HubsType {
|
|
6
|
-
AaveV4CoreHub = "aave_v4_core_hub"
|
|
7
|
-
}
|
|
8
|
-
export interface AaveV4SpokeInfo {
|
|
9
|
-
chainIds: NetworkNumber[];
|
|
10
|
-
label: string;
|
|
11
|
-
value: AaveV4SpokesType;
|
|
12
|
-
url: string;
|
|
13
|
-
address: EthAddress;
|
|
14
|
-
hubs: EthAddress[];
|
|
15
|
-
}
|
|
16
|
-
export interface AaveV4HubInfo {
|
|
17
|
-
chainIds: NetworkNumber[];
|
|
18
|
-
label: string;
|
|
19
|
-
value: AaveV4HubsType;
|
|
20
|
-
address: EthAddress;
|
|
21
|
-
}
|
|
22
|
-
export interface AaveV4HubAssetOnChainData {
|
|
23
|
-
assetId: number;
|
|
24
|
-
drawnRate: bigint;
|
|
25
|
-
}
|
|
26
|
-
export interface AaveV4HubOnChainData {
|
|
27
|
-
assets: Record<number, AaveV4HubAssetOnChainData>;
|
|
28
|
-
}
|
|
29
|
-
export interface AaveV4ReserveAssetOnChain {
|
|
30
|
-
underlying: EthAddress;
|
|
31
|
-
hub: EthAddress;
|
|
32
|
-
assetId: number;
|
|
33
|
-
decimals: number;
|
|
34
|
-
paused: boolean;
|
|
35
|
-
frozen: boolean;
|
|
36
|
-
borrowable: boolean;
|
|
37
|
-
collateralRisk: number;
|
|
38
|
-
collateralFactor: number;
|
|
39
|
-
maxLiquidationBonus: number;
|
|
40
|
-
liquidationFee: number;
|
|
41
|
-
price: bigint;
|
|
42
|
-
totalSupplied: bigint;
|
|
43
|
-
totalDrawn: bigint;
|
|
44
|
-
totalPremium: bigint;
|
|
45
|
-
totalDebt: bigint;
|
|
46
|
-
supplyCap: bigint;
|
|
47
|
-
borrowCap: bigint;
|
|
48
|
-
deficitRay: bigint;
|
|
49
|
-
spokeActive: boolean;
|
|
50
|
-
spokePaused: boolean;
|
|
51
|
-
}
|
|
52
|
-
export interface AaveV4ReserveAssetData {
|
|
53
|
-
symbol: string;
|
|
54
|
-
underlying: EthAddress;
|
|
55
|
-
hub: EthAddress;
|
|
56
|
-
hubName: string;
|
|
57
|
-
assetId: number;
|
|
58
|
-
reserveId: number;
|
|
59
|
-
paused: boolean;
|
|
60
|
-
frozen: boolean;
|
|
61
|
-
borrowable: boolean;
|
|
62
|
-
collateralRisk: number;
|
|
63
|
-
collateralFactor: number;
|
|
64
|
-
liquidationFee: number;
|
|
65
|
-
price: string;
|
|
66
|
-
totalSupplied: string;
|
|
67
|
-
totalDrawn: string;
|
|
68
|
-
totalPremium: string;
|
|
69
|
-
totalDebt: string;
|
|
70
|
-
supplyCap: string;
|
|
71
|
-
borrowCap: string;
|
|
72
|
-
spokeActive: boolean;
|
|
73
|
-
spokePaused: boolean;
|
|
74
|
-
drawnRate: string;
|
|
75
|
-
supplyRate: string;
|
|
76
|
-
supplyIncentives: IncentiveData[];
|
|
77
|
-
borrowIncentives: IncentiveData[];
|
|
78
|
-
canBeBorrowed: boolean;
|
|
79
|
-
canBeSupplied: boolean;
|
|
80
|
-
canBeWithdrawn: boolean;
|
|
81
|
-
canBePayBacked: boolean;
|
|
82
|
-
utilization: string;
|
|
83
|
-
}
|
|
84
|
-
export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
|
|
85
|
-
export interface AaveV4SpokeData {
|
|
86
|
-
assetsData: AaveV4AssetsData;
|
|
87
|
-
oracle: EthAddress;
|
|
88
|
-
oracleDecimals: number;
|
|
89
|
-
address: EthAddress;
|
|
90
|
-
}
|
|
91
|
-
export interface AaveV4UsedReserveAsset {
|
|
92
|
-
symbol: string;
|
|
93
|
-
hubName: string;
|
|
94
|
-
assetId: number;
|
|
95
|
-
reserveId: number;
|
|
96
|
-
supplied: string;
|
|
97
|
-
suppliedUsd: string;
|
|
98
|
-
drawn: string;
|
|
99
|
-
drawnUsd: string;
|
|
100
|
-
premium: string;
|
|
101
|
-
premiumUsd: string;
|
|
102
|
-
borrowed: string;
|
|
103
|
-
borrowedUsd: string;
|
|
104
|
-
isSupplied: boolean;
|
|
105
|
-
isBorrowed: boolean;
|
|
106
|
-
collateral: boolean;
|
|
107
|
-
collateralFactor: number;
|
|
108
|
-
}
|
|
109
|
-
export interface AaveV4AggregatedPositionData {
|
|
110
|
-
suppliedUsd: string;
|
|
111
|
-
suppliedCollateralUsd: string;
|
|
112
|
-
borrowLimitUsd: string;
|
|
113
|
-
liquidationLimitUsd: string;
|
|
114
|
-
borrowedUsd: string;
|
|
115
|
-
drawnUsd: string;
|
|
116
|
-
premiumUsd: string;
|
|
117
|
-
leftToBorrowUsd: string;
|
|
118
|
-
ratio: string;
|
|
119
|
-
collRatio: string;
|
|
120
|
-
liqRatio: string;
|
|
121
|
-
liqPercent: string;
|
|
122
|
-
leveragedType: string;
|
|
123
|
-
leveragedAsset: string;
|
|
124
|
-
liquidationPrice: string;
|
|
125
|
-
leveragedLsdAssetRatio?: string;
|
|
126
|
-
minCollRatio: string;
|
|
127
|
-
collLiquidationRatio: string;
|
|
128
|
-
minHealthRatio: string;
|
|
129
|
-
netApy: string;
|
|
130
|
-
incentiveUsd: string;
|
|
131
|
-
totalInterestUsd: string;
|
|
132
|
-
}
|
|
133
|
-
export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
|
|
134
|
-
export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
|
|
135
|
-
usedAssets: AaveV4UsedReserveAssets;
|
|
136
|
-
healthFactor: string;
|
|
137
|
-
}
|
package/cjs/types/aaveV4.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AaveV4HubsType = exports.AaveV4SpokesType = void 0;
|
|
4
|
-
var AaveV4SpokesType;
|
|
5
|
-
(function (AaveV4SpokesType) {
|
|
6
|
-
AaveV4SpokesType["AaveV4CoreSpoke"] = "aave_v4_core_spoke";
|
|
7
|
-
})(AaveV4SpokesType || (exports.AaveV4SpokesType = AaveV4SpokesType = {}));
|
|
8
|
-
var AaveV4HubsType;
|
|
9
|
-
(function (AaveV4HubsType) {
|
|
10
|
-
AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
|
|
11
|
-
})(AaveV4HubsType || (exports.AaveV4HubsType = AaveV4HubsType = {}));
|
package/esm/aaveV4/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Client } from 'viem';
|
|
2
|
-
import { AaveV4AccountData, AaveV4SpokeData, AaveV4SpokeInfo } from '../types';
|
|
3
|
-
import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
|
|
4
|
-
export declare function _getAaveV4SpokeData(provider: Client, network: NetworkNumber, market: AaveV4SpokeInfo, blockNumber?: 'latest' | number): Promise<AaveV4SpokeData>;
|
|
5
|
-
export declare function getAaveV4SpokeData(provider: EthereumProvider, network: NetworkNumber, spoke: AaveV4SpokeInfo, blockNumber?: 'latest' | number): Promise<AaveV4SpokeData>;
|
|
6
|
-
export declare function _getAaveV4AccountData(provider: Client, network: NetworkNumber, spokeData: AaveV4SpokeData, address: EthAddress, blockNumber?: 'latest' | number): Promise<AaveV4AccountData>;
|
|
7
|
-
export declare function getAaveV4AccountData(provider: EthereumProvider, network: NetworkNumber, marketData: AaveV4SpokeData, address: EthAddress, blockNumber?: 'latest' | number): Promise<any>;
|