@defisaver/positions-sdk 2.1.68 → 2.1.70-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/aaveV4/index.d.ts +7 -0
- package/cjs/aaveV4/index.js +174 -0
- package/cjs/config/contracts.d.ts +1535 -0
- package/cjs/config/contracts.js +9 -0
- package/cjs/contracts.d.ts +32401 -0
- package/cjs/contracts.js +2 -1
- package/cjs/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/cjs/helpers/aaveV4Helpers/index.js +117 -0
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/markets/aaveV4/index.d.ts +28 -0
- package/cjs/markets/aaveV4/index.js +140 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/markets/morphoBlue/index.js +5 -5
- package/cjs/portfolio/index.js +20 -0
- package/cjs/types/aaveV4.d.ts +145 -0
- package/cjs/types/aaveV4.js +19 -0
- package/cjs/types/common.d.ts +1 -1
- package/cjs/types/common.js +1 -1
- package/cjs/types/index.d.ts +1 -0
- package/cjs/types/index.js +1 -0
- package/cjs/types/portfolio.d.ts +4 -0
- package/esm/aaveV4/index.d.ts +7 -0
- package/esm/aaveV4/index.js +165 -0
- package/esm/config/contracts.d.ts +1535 -0
- package/esm/config/contracts.js +8 -0
- package/esm/contracts.d.ts +32401 -0
- package/esm/contracts.js +1 -0
- package/esm/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/esm/helpers/aaveV4Helpers/index.js +108 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/markets/aaveV4/index.d.ts +28 -0
- package/esm/markets/aaveV4/index.js +122 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/markets/morphoBlue/index.js +5 -5
- package/esm/portfolio/index.js +21 -1
- package/esm/types/aaveV4.d.ts +145 -0
- package/esm/types/aaveV4.js +16 -0
- package/esm/types/common.d.ts +1 -1
- package/esm/types/common.js +1 -1
- package/esm/types/index.d.ts +1 -0
- package/esm/types/index.js +1 -0
- package/esm/types/portfolio.d.ts +4 -0
- package/package.json +1 -1
- package/src/aaveV4/index.ts +176 -0
- package/src/config/contracts.ts +9 -1
- package/src/contracts.ts +3 -1
- package/src/helpers/aaveV4Helpers/index.ts +128 -0
- package/src/helpers/index.ts +1 -0
- package/src/index.ts +2 -0
- package/src/markets/aaveV4/index.ts +149 -0
- package/src/markets/index.ts +6 -1
- package/src/markets/morphoBlue/index.ts +5 -5
- package/src/portfolio/index.ts +20 -0
- package/src/types/aaveV4.ts +161 -0
- package/src/types/common.ts +1 -1
- package/src/types/index.ts +2 -1
- package/src/types/portfolio.ts +4 -0
package/cjs/contracts.js
CHANGED
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.AaveRewardsControllerViem = exports.SparkRewardsControllerViem = exports.UUPSViem = exports.LiquityStabilityPoolViem = exports.LiquityLQTYStakingViem = exports.AaveUmbrellaViewViem = exports.AaveIncentivesControllerViem = exports.FluidViewContractViem = exports.LiquityV2LegacyViewContractViem = exports.LiquityV2ViewContractViem = exports.LiquityActivePoolContractViem = exports.LiquityPriceFeedContractViem = exports.LiquityTroveManagerContractViem = exports.LiquityCollSurplusPoolContractViem = exports.LiquityViewContractViem = exports.BTCPriceFeedContractViem = exports.WeETHPriceFeedContractViem = exports.ComptrollerContractViem = exports.CompoundLoanInfoContractViem = exports.McdJugContractViem = exports.McdDogContractViem = exports.McdSpotterContractViem = exports.McdVatContractViem = exports.McdViewContractViem = exports.McdGetCdpsContractViem = exports.LlamaLendViewContractViem = exports.CrvUSDFactoryContractViem = exports.CrvUSDViewContractViem = exports.EulerV2ViewContractViem = exports.SparkIncentiveDataProviderContractViem = exports.SparkViewContractViem = exports.CompV3ViewContractViem = exports.WstETHPriceFeedContractViem = exports.USDCPriceFeedContractViem = exports.ETHPriceFeedContractViem = exports.COMPPriceFeedContractViem = exports.DFSFeedRegistryContractViem = exports.FeedRegistryContractViem = exports.AaveIncentiveDataProviderV3ContractViem = exports.AaveV3ViewContractViem = exports.AaveLoanInfoV2ContractViem = exports.MorphoBlueViewContractViem = exports.getYearnV3VaultContractViem = exports.getErc20ContractViem = exports.getSparkSavingsVaultContractViem = exports.getYearnVaultContractViem = exports.getMorphoVaultContractViem = exports.createViemContractFromConfigFunc = exports.getConfigContractAbi = exports.getConfigContractAddress = void 0;
|
|
37
|
-
exports.SkySavingsContractView = exports.MakerDsrContractViem = exports.YearnViewContractViem = exports.StkAAVEViem = exports.LiquityV2sBoldVaultViem = void 0;
|
|
37
|
+
exports.AaveV4ViewContractViem = exports.SkySavingsContractView = exports.MakerDsrContractViem = exports.YearnViewContractViem = exports.StkAAVEViem = exports.LiquityV2sBoldVaultViem = void 0;
|
|
38
38
|
const viem_1 = require("viem");
|
|
39
39
|
const configRaw = __importStar(require("./config/contracts"));
|
|
40
40
|
// @ts-ignore
|
|
@@ -177,3 +177,4 @@ exports.StkAAVEViem = (0, exports.createViemContractFromConfigFunc)('StkAAVE');
|
|
|
177
177
|
exports.YearnViewContractViem = (0, exports.createViemContractFromConfigFunc)('YearnView');
|
|
178
178
|
exports.MakerDsrContractViem = (0, exports.createViemContractFromConfigFunc)('MakerDsr');
|
|
179
179
|
exports.SkySavingsContractView = (0, exports.createViemContractFromConfigFunc)('SkySavings');
|
|
180
|
+
exports.AaveV4ViewContractViem = (0, exports.createViemContractFromConfigFunc)('AaveV4View');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AaveV4AggregatedPositionData, AaveV4AssetsData, AaveV4ReserveAssetData, AaveV4UsedReserveAsset, AaveV4UsedReserveAssets } from '../../types';
|
|
2
|
+
import { LeverageType, 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: LeverageType;
|
|
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;
|
|
@@ -0,0 +1,117 @@
|
|
|
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 common_1 = require("../../types/common");
|
|
10
|
+
const aaveV4GetCollateralFactor = (assetData, usedAssetData, useUserCollateralFactor = false) => (useUserCollateralFactor ? usedAssetData.collateralFactor : assetData.collateralFactor);
|
|
11
|
+
exports.aaveV4GetCollateralFactor = aaveV4GetCollateralFactor;
|
|
12
|
+
const isLeveragedPosAaveV4 = (usedAssets, dustLimit = 5) => {
|
|
13
|
+
let borrowUnstable = 0;
|
|
14
|
+
let supplyStable = 0;
|
|
15
|
+
let borrowStable = 0;
|
|
16
|
+
let supplyUnstable = 0;
|
|
17
|
+
let longAsset = '';
|
|
18
|
+
let shortAsset = '';
|
|
19
|
+
Object.values(usedAssets).forEach(({ symbol, suppliedUsd, borrowedUsd, collateral, reserveId, }) => {
|
|
20
|
+
const spokeAsset = `${symbol}-${reserveId}`;
|
|
21
|
+
const isSupplied = (+suppliedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
22
|
+
const isBorrowed = (+borrowedUsd) > dustLimit; // ignore dust like <limit leftover supply
|
|
23
|
+
if (isSupplied && moneymarket_1.STABLE_ASSETS.includes(symbol) && collateral)
|
|
24
|
+
supplyStable += 1;
|
|
25
|
+
if (isBorrowed && moneymarket_1.STABLE_ASSETS.includes(symbol))
|
|
26
|
+
borrowStable += 1;
|
|
27
|
+
if (isBorrowed && !moneymarket_1.STABLE_ASSETS.includes(symbol)) {
|
|
28
|
+
borrowUnstable += 1;
|
|
29
|
+
shortAsset = spokeAsset;
|
|
30
|
+
}
|
|
31
|
+
if (isSupplied && !moneymarket_1.STABLE_ASSETS.includes(symbol) && collateral) {
|
|
32
|
+
supplyUnstable += 1;
|
|
33
|
+
longAsset = spokeAsset;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
37
|
+
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
38
|
+
const isVolatilePair = supplyUnstable === 1 && borrowUnstable === 1 && supplyStable === 0 && borrowStable === 0;
|
|
39
|
+
if (isLong) {
|
|
40
|
+
return {
|
|
41
|
+
leveragedType: common_1.LeverageType.Long,
|
|
42
|
+
leveragedAsset: longAsset,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (isShort) {
|
|
46
|
+
return {
|
|
47
|
+
leveragedType: common_1.LeverageType.Short,
|
|
48
|
+
leveragedAsset: shortAsset,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (isVolatilePair) {
|
|
52
|
+
return {
|
|
53
|
+
leveragedType: common_1.LeverageType.VolatilePair,
|
|
54
|
+
leveragedAsset: longAsset,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
leveragedType: common_1.LeverageType.None,
|
|
59
|
+
leveragedAsset: '',
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
exports.isLeveragedPosAaveV4 = isLeveragedPosAaveV4;
|
|
63
|
+
const aaveV4GetAggregatedPositionData = ({ usedAssets, assetsData, network, useUserCollateralFactor = false, }) => {
|
|
64
|
+
const payload = {};
|
|
65
|
+
payload.suppliedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
|
|
66
|
+
payload.suppliedCollateralUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
|
|
67
|
+
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)));
|
|
68
|
+
payload.liquidationLimitUsd = payload.borrowLimitUsd;
|
|
69
|
+
payload.borrowedUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
|
|
70
|
+
payload.drawnUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ drawnUsd }) => drawnUsd);
|
|
71
|
+
payload.premiumUsd = (0, moneymarket_1.getAssetsTotal)(usedAssets, ({ isBorrowed }) => isBorrowed, ({ premiumUsd }) => premiumUsd);
|
|
72
|
+
const leftToBorrowUsd = new decimal_js_1.default(payload.borrowLimitUsd).sub(payload.borrowedUsd);
|
|
73
|
+
payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
|
|
74
|
+
payload.ratio = +payload.suppliedUsd ? new decimal_js_1.default(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
75
|
+
payload.collRatio = +payload.suppliedUsd ? new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
|
|
76
|
+
payload.liqRatio = new decimal_js_1.default(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
|
|
77
|
+
payload.liqPercent = new decimal_js_1.default(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
78
|
+
const { leveragedType, leveragedAsset } = (0, exports.isLeveragedPosAaveV4)(usedAssets);
|
|
79
|
+
payload.leveragedType = leveragedType;
|
|
80
|
+
payload.leveragedAsset = leveragedAsset;
|
|
81
|
+
payload.liquidationPrice = '';
|
|
82
|
+
if (leveragedType !== '') {
|
|
83
|
+
const leveragedAssetData = assetsData[leveragedAsset];
|
|
84
|
+
let assetPrice = (leveragedAssetData === null || leveragedAssetData === void 0 ? void 0 : leveragedAssetData.price) || '0';
|
|
85
|
+
if (leveragedType === common_1.LeverageType.VolatilePair) {
|
|
86
|
+
const borrowedAsset = Object.values(usedAssets).find(({ borrowedUsd }) => +borrowedUsd > 0);
|
|
87
|
+
const borrowedAssetPrice = assetsData[`${borrowedAsset.symbol}-${borrowedAsset.reserveId}`].price;
|
|
88
|
+
const leveragedAssetPrice = assetsData[leveragedAsset].price;
|
|
89
|
+
const isReverse = new decimal_js_1.default(leveragedAssetPrice).lt(borrowedAssetPrice);
|
|
90
|
+
if (isReverse) {
|
|
91
|
+
payload.leveragedType = common_1.LeverageType.VolatilePairReverse;
|
|
92
|
+
payload.currentVolatilePairRatio = new decimal_js_1.default(borrowedAssetPrice).div(leveragedAssetPrice).toDP(18).toString();
|
|
93
|
+
assetPrice = new decimal_js_1.default(borrowedAssetPrice).div(assetPrice).toString();
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
assetPrice = new decimal_js_1.default(assetPrice).div(borrowedAssetPrice).toString();
|
|
97
|
+
payload.currentVolatilePairRatio = new decimal_js_1.default(leveragedAssetPrice).div(borrowedAssetPrice).toDP(18).toString();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
payload.liquidationPrice = (0, moneymarket_1.calcLeverageLiqPrice)(payload.leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
|
|
101
|
+
}
|
|
102
|
+
payload.minCollRatio = new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
|
|
103
|
+
payload.collLiquidationRatio = new decimal_js_1.default(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
104
|
+
// payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
|
|
105
|
+
payload.minHealthRatio = new decimal_js_1.default(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
|
|
106
|
+
// TODO: Re-implement netApy calculation
|
|
107
|
+
// const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({
|
|
108
|
+
// usedAssets,
|
|
109
|
+
// assetsData,
|
|
110
|
+
// optionalData: { healthRatio: payload.healthRatio },
|
|
111
|
+
// });
|
|
112
|
+
payload.netApy = '0';
|
|
113
|
+
payload.incentiveUsd = '0';
|
|
114
|
+
payload.totalInterestUsd = '0';
|
|
115
|
+
return payload;
|
|
116
|
+
};
|
|
117
|
+
exports.aaveV4GetAggregatedPositionData = aaveV4GetAggregatedPositionData;
|
package/cjs/helpers/index.d.ts
CHANGED
package/cjs/helpers/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.fluidHelpers = exports.eulerV2Helpers = exports.liquityV2Helpers = exports.llamaLendHelpers = exports.morphoBlueHelpers = exports.makerHelpers = exports.curveUsdHelpers = exports.sparkHelpers = exports.compoundHelpers = exports.aaveHelpers = void 0;
|
|
36
|
+
exports.aaveV4Helpers = exports.fluidHelpers = exports.eulerV2Helpers = exports.liquityV2Helpers = exports.llamaLendHelpers = exports.morphoBlueHelpers = exports.makerHelpers = exports.curveUsdHelpers = exports.sparkHelpers = exports.compoundHelpers = exports.aaveHelpers = void 0;
|
|
37
37
|
exports.aaveHelpers = __importStar(require("./aaveHelpers"));
|
|
38
38
|
exports.compoundHelpers = __importStar(require("./compoundHelpers"));
|
|
39
39
|
exports.sparkHelpers = __importStar(require("./sparkHelpers"));
|
|
@@ -44,3 +44,4 @@ exports.llamaLendHelpers = __importStar(require("./llamaLendHelpers"));
|
|
|
44
44
|
exports.liquityV2Helpers = __importStar(require("./liquityV2Helpers"));
|
|
45
45
|
exports.eulerV2Helpers = __importStar(require("./eulerHelpers"));
|
|
46
46
|
exports.fluidHelpers = __importStar(require("./fluidHelpers"));
|
|
47
|
+
exports.aaveV4Helpers = __importStar(require("./aaveV4Helpers"));
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './setup';
|
|
2
2
|
import * as fluid from './fluid';
|
|
3
|
+
import * as aaveV4 from './aaveV4';
|
|
3
4
|
import * as aaveV3 from './aaveV3';
|
|
4
5
|
import * as aaveV2 from './aaveV2';
|
|
5
6
|
import * as compoundV3 from './compoundV3';
|
|
@@ -21,4 +22,4 @@ import * as portfolio from './portfolio';
|
|
|
21
22
|
import * as claiming from './claiming';
|
|
22
23
|
import * as savings from './savings';
|
|
23
24
|
export * from './types';
|
|
24
|
-
export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
|
25
|
+
export { aaveV2, aaveV3, aaveV4, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
package/cjs/index.js
CHANGED
|
@@ -36,10 +36,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.savings = exports.claiming = exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.staking = exports.exchange = exports.maker = exports.liquityV2 = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.aaveV3 = exports.aaveV2 = void 0;
|
|
39
|
+
exports.savings = exports.claiming = exports.portfolio = exports.fluid = exports.eulerV2 = exports.llamaLend = exports.morphoBlue = exports.helpers = exports.markets = exports.moneymarket = exports.staking = exports.exchange = exports.maker = exports.liquityV2 = exports.liquity = exports.curveUsd = exports.spark = exports.compoundV3 = exports.compoundV2 = exports.aaveV4 = exports.aaveV3 = exports.aaveV2 = void 0;
|
|
40
40
|
require("./setup");
|
|
41
41
|
const fluid = __importStar(require("./fluid"));
|
|
42
42
|
exports.fluid = fluid;
|
|
43
|
+
const aaveV4 = __importStar(require("./aaveV4"));
|
|
44
|
+
exports.aaveV4 = aaveV4;
|
|
43
45
|
const aaveV3 = __importStar(require("./aaveV3"));
|
|
44
46
|
exports.aaveV3 = aaveV3;
|
|
45
47
|
const aaveV2 = __importStar(require("./aaveV2"));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AaveV4HubInfo, AaveV4HubsType, AaveV4SpokeInfo, AaveV4SpokesType, NetworkNumber } from '../../types';
|
|
2
|
+
export declare const AAVE_V4_CORE_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
3
|
+
export declare const AAVE_V4_PLUS_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
4
|
+
export declare const AAVE_V4_PRIME_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
|
|
5
|
+
export declare const AaveV4Hubs: (networkId: NetworkNumber) => {
|
|
6
|
+
readonly aave_v4_core_hub: AaveV4HubInfo;
|
|
7
|
+
readonly aave_v4_plus_hub: AaveV4HubInfo;
|
|
8
|
+
readonly aave_v4_prime_hub: AaveV4HubInfo;
|
|
9
|
+
};
|
|
10
|
+
export declare const getAaveV4HubTypeInfo: (type: AaveV4HubsType, network?: NetworkNumber) => AaveV4HubInfo;
|
|
11
|
+
export declare const getAaveV4HubByAddress: (networkId: NetworkNumber, address: string) => AaveV4HubInfo | undefined;
|
|
12
|
+
export declare const AAVE_V4_BLUECHIP_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
13
|
+
export declare const AAVE_V4_ETHENA_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
14
|
+
export declare const AAVE_V4_ETHERFI_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
15
|
+
export declare const AAVE_V4_GOLD_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
16
|
+
export declare const AAVE_V4_KELP_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
17
|
+
export declare const AAVE_V4_LIDO_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
18
|
+
export declare const AAVE_V4_MAIN_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
|
|
19
|
+
export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
|
|
20
|
+
readonly aave_v4_bluechip_spoke: AaveV4SpokeInfo;
|
|
21
|
+
readonly aave_v4_ethena_spoke: AaveV4SpokeInfo;
|
|
22
|
+
readonly aave_v4_etherfi_spoke: AaveV4SpokeInfo;
|
|
23
|
+
readonly aave_v4_gold_spoke: AaveV4SpokeInfo;
|
|
24
|
+
readonly aave_v4_kelp_spoke: AaveV4SpokeInfo;
|
|
25
|
+
readonly aave_v4_lido_spoke: AaveV4SpokeInfo;
|
|
26
|
+
readonly aave_v4_main_spoke: AaveV4SpokeInfo;
|
|
27
|
+
};
|
|
28
|
+
export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAaveV4SpokeTypeInfo = exports.AaveV4Spokes = exports.AAVE_V4_MAIN_SPOKE = exports.AAVE_V4_LIDO_SPOKE = exports.AAVE_V4_KELP_SPOKE = exports.AAVE_V4_GOLD_SPOKE = exports.AAVE_V4_ETHERFI_SPOKE = exports.AAVE_V4_ETHENA_SPOKE = exports.AAVE_V4_BLUECHIP_SPOKE = exports.getAaveV4HubByAddress = exports.getAaveV4HubTypeInfo = exports.AaveV4Hubs = exports.AAVE_V4_PRIME_HUB = exports.AAVE_V4_PLUS_HUB = exports.AAVE_V4_CORE_HUB = void 0;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
// HUBS
|
|
6
|
+
const AAVE_V4_CORE_HUB = (networkId) => ({
|
|
7
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
8
|
+
label: 'Core Hub',
|
|
9
|
+
value: types_1.AaveV4HubsType.AaveV4CoreHub,
|
|
10
|
+
address: '0x8b5aABDbf90744FA259fa7A708c00fF5Cf43FD75',
|
|
11
|
+
});
|
|
12
|
+
exports.AAVE_V4_CORE_HUB = AAVE_V4_CORE_HUB;
|
|
13
|
+
const AAVE_V4_PLUS_HUB = (networkId) => ({
|
|
14
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
15
|
+
label: 'Plus Hub',
|
|
16
|
+
value: types_1.AaveV4HubsType.AaveV4PlusHub,
|
|
17
|
+
address: '0xDf488F18631Ff7DcF39Ab305C9BE5AeC06F673d0',
|
|
18
|
+
});
|
|
19
|
+
exports.AAVE_V4_PLUS_HUB = AAVE_V4_PLUS_HUB;
|
|
20
|
+
const AAVE_V4_PRIME_HUB = (networkId) => ({
|
|
21
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
22
|
+
label: 'Prime Hub',
|
|
23
|
+
value: types_1.AaveV4HubsType.AaveV4PrimeHub,
|
|
24
|
+
address: '0xaa605F00a695fE90f4818CcB11C0daF22e23Aa69',
|
|
25
|
+
});
|
|
26
|
+
exports.AAVE_V4_PRIME_HUB = AAVE_V4_PRIME_HUB;
|
|
27
|
+
const AaveV4Hubs = (networkId) => ({
|
|
28
|
+
[types_1.AaveV4HubsType.AaveV4CoreHub]: (0, exports.AAVE_V4_CORE_HUB)(networkId),
|
|
29
|
+
[types_1.AaveV4HubsType.AaveV4PlusHub]: (0, exports.AAVE_V4_PLUS_HUB)(networkId),
|
|
30
|
+
[types_1.AaveV4HubsType.AaveV4PrimeHub]: (0, exports.AAVE_V4_PRIME_HUB)(networkId),
|
|
31
|
+
});
|
|
32
|
+
exports.AaveV4Hubs = AaveV4Hubs;
|
|
33
|
+
const getAaveV4HubTypeInfo = (type, network) => (Object.assign({}, (0, exports.AaveV4Hubs)(network !== null && network !== void 0 ? network : types_1.NetworkNumber.Eth))[type]);
|
|
34
|
+
exports.getAaveV4HubTypeInfo = getAaveV4HubTypeInfo;
|
|
35
|
+
const getAaveV4HubByAddress = (networkId, address) => Object.values((0, exports.AaveV4Hubs)(networkId)).find(hub => hub.address.toLowerCase() === address.toLowerCase());
|
|
36
|
+
exports.getAaveV4HubByAddress = getAaveV4HubByAddress;
|
|
37
|
+
// SPOKES
|
|
38
|
+
const AAVE_V4_BLUECHIP_SPOKE = (networkId) => ({
|
|
39
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
40
|
+
label: 'Bluechip Spoke',
|
|
41
|
+
value: types_1.AaveV4SpokesType.AaveV4BluechipSpoke,
|
|
42
|
+
url: 'bluechip',
|
|
43
|
+
address: '0xe8344a3A199Cb995241BEcD6129a93Cc128f24ca',
|
|
44
|
+
hubs: [
|
|
45
|
+
(0, exports.AAVE_V4_CORE_HUB)(types_1.NetworkNumber.Eth).address,
|
|
46
|
+
(0, exports.AAVE_V4_PLUS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
47
|
+
(0, exports.AAVE_V4_PRIME_HUB)(types_1.NetworkNumber.Eth).address,
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
exports.AAVE_V4_BLUECHIP_SPOKE = AAVE_V4_BLUECHIP_SPOKE;
|
|
51
|
+
const AAVE_V4_ETHENA_SPOKE = (networkId) => ({
|
|
52
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
53
|
+
label: 'Ethena Spoke',
|
|
54
|
+
value: types_1.AaveV4SpokesType.AaveV4EthenaSpoke,
|
|
55
|
+
url: 'ethena',
|
|
56
|
+
address: '0x57893f96d25f7125211d797bC39972b629572b2c',
|
|
57
|
+
hubs: [
|
|
58
|
+
(0, exports.AAVE_V4_CORE_HUB)(types_1.NetworkNumber.Eth).address,
|
|
59
|
+
(0, exports.AAVE_V4_PLUS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
60
|
+
(0, exports.AAVE_V4_PRIME_HUB)(types_1.NetworkNumber.Eth).address,
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
exports.AAVE_V4_ETHENA_SPOKE = AAVE_V4_ETHENA_SPOKE;
|
|
64
|
+
const AAVE_V4_ETHERFI_SPOKE = (networkId) => ({
|
|
65
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
66
|
+
label: 'Etherfi Spoke',
|
|
67
|
+
value: types_1.AaveV4SpokesType.AaveV4EtherfiSpoke,
|
|
68
|
+
url: 'etherfi',
|
|
69
|
+
address: '0xFC2685999D5a1d15AAEf0E73426673829A483cA6',
|
|
70
|
+
hubs: [
|
|
71
|
+
(0, exports.AAVE_V4_CORE_HUB)(types_1.NetworkNumber.Eth).address,
|
|
72
|
+
(0, exports.AAVE_V4_PLUS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
73
|
+
(0, exports.AAVE_V4_PRIME_HUB)(types_1.NetworkNumber.Eth).address,
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
exports.AAVE_V4_ETHERFI_SPOKE = AAVE_V4_ETHERFI_SPOKE;
|
|
77
|
+
const AAVE_V4_GOLD_SPOKE = (networkId) => ({
|
|
78
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
79
|
+
label: 'Gold Spoke',
|
|
80
|
+
value: types_1.AaveV4SpokesType.AaveV4GoldSpoke,
|
|
81
|
+
url: 'gold',
|
|
82
|
+
address: '0x4b8A81E96dcbD21Aaf6bd32E03Bd0c64b8a2E6Fa',
|
|
83
|
+
hubs: [
|
|
84
|
+
(0, exports.AAVE_V4_CORE_HUB)(types_1.NetworkNumber.Eth).address,
|
|
85
|
+
(0, exports.AAVE_V4_PLUS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
86
|
+
(0, exports.AAVE_V4_PRIME_HUB)(types_1.NetworkNumber.Eth).address,
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
exports.AAVE_V4_GOLD_SPOKE = AAVE_V4_GOLD_SPOKE;
|
|
90
|
+
const AAVE_V4_KELP_SPOKE = (networkId) => ({
|
|
91
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
92
|
+
label: 'Kelp Spoke',
|
|
93
|
+
value: types_1.AaveV4SpokesType.AaveV4KelpSpoke,
|
|
94
|
+
url: 'kelp',
|
|
95
|
+
address: '0x4a2A38377cC85BFd8548a4C9AC71DBb245dc9A9D',
|
|
96
|
+
hubs: [
|
|
97
|
+
(0, exports.AAVE_V4_CORE_HUB)(types_1.NetworkNumber.Eth).address,
|
|
98
|
+
(0, exports.AAVE_V4_PLUS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
99
|
+
(0, exports.AAVE_V4_PRIME_HUB)(types_1.NetworkNumber.Eth).address,
|
|
100
|
+
],
|
|
101
|
+
});
|
|
102
|
+
exports.AAVE_V4_KELP_SPOKE = AAVE_V4_KELP_SPOKE;
|
|
103
|
+
const AAVE_V4_LIDO_SPOKE = (networkId) => ({
|
|
104
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
105
|
+
label: 'Lido Spoke',
|
|
106
|
+
value: types_1.AaveV4SpokesType.AaveV4LidoSpoke,
|
|
107
|
+
url: 'lido',
|
|
108
|
+
address: '0x4f7202367f72ADae87393c3e49b3Fbc353a9110D',
|
|
109
|
+
hubs: [
|
|
110
|
+
(0, exports.AAVE_V4_CORE_HUB)(types_1.NetworkNumber.Eth).address,
|
|
111
|
+
(0, exports.AAVE_V4_PLUS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
112
|
+
(0, exports.AAVE_V4_PRIME_HUB)(types_1.NetworkNumber.Eth).address,
|
|
113
|
+
],
|
|
114
|
+
});
|
|
115
|
+
exports.AAVE_V4_LIDO_SPOKE = AAVE_V4_LIDO_SPOKE;
|
|
116
|
+
const AAVE_V4_MAIN_SPOKE = (networkId) => ({
|
|
117
|
+
chainIds: [types_1.NetworkNumber.Eth],
|
|
118
|
+
label: 'Main Spoke',
|
|
119
|
+
value: types_1.AaveV4SpokesType.AaveV4MainSpoke,
|
|
120
|
+
url: 'main',
|
|
121
|
+
address: '0x5738d9cB82d6a1617973C257D05A387bF5568F47',
|
|
122
|
+
hubs: [
|
|
123
|
+
(0, exports.AAVE_V4_CORE_HUB)(types_1.NetworkNumber.Eth).address,
|
|
124
|
+
(0, exports.AAVE_V4_PLUS_HUB)(types_1.NetworkNumber.Eth).address,
|
|
125
|
+
(0, exports.AAVE_V4_PRIME_HUB)(types_1.NetworkNumber.Eth).address,
|
|
126
|
+
],
|
|
127
|
+
});
|
|
128
|
+
exports.AAVE_V4_MAIN_SPOKE = AAVE_V4_MAIN_SPOKE;
|
|
129
|
+
const AaveV4Spokes = (networkId) => ({
|
|
130
|
+
[types_1.AaveV4SpokesType.AaveV4BluechipSpoke]: (0, exports.AAVE_V4_BLUECHIP_SPOKE)(networkId),
|
|
131
|
+
[types_1.AaveV4SpokesType.AaveV4EthenaSpoke]: (0, exports.AAVE_V4_ETHENA_SPOKE)(networkId),
|
|
132
|
+
[types_1.AaveV4SpokesType.AaveV4EtherfiSpoke]: (0, exports.AAVE_V4_ETHERFI_SPOKE)(networkId),
|
|
133
|
+
[types_1.AaveV4SpokesType.AaveV4GoldSpoke]: (0, exports.AAVE_V4_GOLD_SPOKE)(networkId),
|
|
134
|
+
[types_1.AaveV4SpokesType.AaveV4KelpSpoke]: (0, exports.AAVE_V4_KELP_SPOKE)(networkId),
|
|
135
|
+
[types_1.AaveV4SpokesType.AaveV4LidoSpoke]: (0, exports.AAVE_V4_LIDO_SPOKE)(networkId),
|
|
136
|
+
[types_1.AaveV4SpokesType.AaveV4MainSpoke]: (0, exports.AAVE_V4_MAIN_SPOKE)(networkId),
|
|
137
|
+
});
|
|
138
|
+
exports.AaveV4Spokes = AaveV4Spokes;
|
|
139
|
+
const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, (0, exports.AaveV4Spokes)(network !== null && network !== void 0 ? network : types_1.NetworkNumber.Eth))[type]);
|
|
140
|
+
exports.getAaveV4SpokeTypeInfo = getAaveV4SpokeTypeInfo;
|
package/cjs/markets/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { LlamaLendMarkets } from './llamaLend';
|
|
|
7
7
|
export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
|
|
8
8
|
export { EulerV2Markets } from './euler';
|
|
9
9
|
export { FluidMarkets, getFluidVersionsDataForNetwork, getFluidMarketInfoById, getFTokenAddress, getFluidMarketInfoByAddress, } from './fluid';
|
|
10
|
+
export { AaveV4Spokes } from './aaveV4';
|
package/cjs/markets/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFluidMarketInfoByAddress = exports.getFTokenAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.EulerV2Markets = exports.findLiquityV2MarketByAddress = exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = exports.AaveMarkets = void 0;
|
|
3
|
+
exports.AaveV4Spokes = exports.getFluidMarketInfoByAddress = exports.getFTokenAddress = exports.getFluidMarketInfoById = exports.getFluidVersionsDataForNetwork = exports.FluidMarkets = exports.EulerV2Markets = exports.findLiquityV2MarketByAddress = exports.LiquityV2Markets = exports.LlamaLendMarkets = exports.findMorphoBlueMarket = exports.MorphoBlueMarkets = exports.CrvUsdMarkets = exports.SparkMarkets = exports.v3USDTCollAssets = exports.v3USDCeCollAssets = exports.v3USDCCollAssets = exports.v3USDbCCollAssets = exports.v3ETHCollAssets = exports.compoundV2CollateralAssets = exports.CompoundMarkets = exports.getAaveV3MarketByMarketAddress = exports.aaveV3AssetsDefaultMarket = exports.aaveV2AssetsDefaultMarket = exports.aaveV1AssetsDefaultMarket = exports.AaveMarkets = void 0;
|
|
4
4
|
var aave_1 = require("./aave");
|
|
5
5
|
Object.defineProperty(exports, "AaveMarkets", { enumerable: true, get: function () { return aave_1.AaveMarkets; } });
|
|
6
6
|
Object.defineProperty(exports, "aaveV1AssetsDefaultMarket", { enumerable: true, get: function () { return aave_1.aaveV1AssetsDefaultMarket; } });
|
|
@@ -35,3 +35,5 @@ Object.defineProperty(exports, "getFluidVersionsDataForNetwork", { enumerable: t
|
|
|
35
35
|
Object.defineProperty(exports, "getFluidMarketInfoById", { enumerable: true, get: function () { return fluid_1.getFluidMarketInfoById; } });
|
|
36
36
|
Object.defineProperty(exports, "getFTokenAddress", { enumerable: true, get: function () { return fluid_1.getFTokenAddress; } });
|
|
37
37
|
Object.defineProperty(exports, "getFluidMarketInfoByAddress", { enumerable: true, get: function () { return fluid_1.getFluidMarketInfoByAddress; } });
|
|
38
|
+
var aaveV4_1 = require("./aaveV4");
|
|
39
|
+
Object.defineProperty(exports, "AaveV4Spokes", { enumerable: true, get: function () { return aaveV4_1.AaveV4Spokes; } });
|
|
@@ -580,7 +580,7 @@ const MORPHO_BLUE_SUSDE_DAI_777 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
580
580
|
oracle: '0x5D916980D5Ae1737a8330Bf24dF812b2911Aae25',
|
|
581
581
|
oracleType: types_1.MorphoBlueOracleType.MARKET_RATE,
|
|
582
582
|
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
583
|
-
lltv: 0.
|
|
583
|
+
lltv: 0.77,
|
|
584
584
|
marketId: '0x42dcfb38bb98767afb6e38ccf90d59d0d3f0aa216beb3a234f12850323d17536',
|
|
585
585
|
protocolName: 'morpho-blue',
|
|
586
586
|
});
|
|
@@ -645,7 +645,7 @@ const MORPHO_BLUE_USDE_DAI_777 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
645
645
|
oracle: '0xaE4750d0813B5E37A51f7629beedd72AF1f9cA35',
|
|
646
646
|
oracleType: types_1.MorphoBlueOracleType.MARKET_RATE,
|
|
647
647
|
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
648
|
-
lltv: 0.
|
|
648
|
+
lltv: 0.77,
|
|
649
649
|
marketId: '0xfd8493f09eb6203615221378d89f53fcd92ff4f7d62cca87eece9a2fff59e86f',
|
|
650
650
|
protocolName: 'morpho-blue',
|
|
651
651
|
});
|
|
@@ -1110,7 +1110,7 @@ const MORPHO_BLUE_WEETH_USDC_777_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
1110
1110
|
oracle: '0xaacbD2BbCA7927F772145f99EC942024Ddd0FAB0',
|
|
1111
1111
|
oracleType: types_1.MorphoBlueOracleType.MARKET_RATE,
|
|
1112
1112
|
irm: '0x46415998764C29aB2a25CbeA6254146D50D22687',
|
|
1113
|
-
lltv: 0.
|
|
1113
|
+
lltv: 0.77,
|
|
1114
1114
|
marketId: '0x6a331b22b56c9c0ee32a1a7d6f852d2c682ea8b27a1b0f99a9c484a37a951eb7',
|
|
1115
1115
|
protocolName: 'morpho-blue',
|
|
1116
1116
|
});
|
|
@@ -1142,7 +1142,7 @@ const MORPHO_BLUE_EZETH_USDC_777_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
1142
1142
|
oracle: '0x1BAaB21821c6468f8aee73ee60Fd8Fdc39c0C973',
|
|
1143
1143
|
oracleType: types_1.MorphoBlueOracleType.MARKET_RATE,
|
|
1144
1144
|
irm: '0x46415998764C29aB2a25CbeA6254146D50D22687',
|
|
1145
|
-
lltv: 0.
|
|
1145
|
+
lltv: 0.77,
|
|
1146
1146
|
marketId: '0xf24417ee06adc0b0836cf0dbec3ba56c1059f62f53a55990a38356d42fa75fa2',
|
|
1147
1147
|
protocolName: 'morpho-blue',
|
|
1148
1148
|
});
|
|
@@ -1158,7 +1158,7 @@ const MORPHO_BLUE_EZETH_ETH_777_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
1158
1158
|
oracle: '0x09ECeE1Ab6f37a3D8D01f93A622b7A3021A5D91F',
|
|
1159
1159
|
oracleType: types_1.MorphoBlueOracleType.MARKET_RATE,
|
|
1160
1160
|
irm: '0x46415998764C29aB2a25CbeA6254146D50D22687',
|
|
1161
|
-
lltv: 0.
|
|
1161
|
+
lltv: 0.77,
|
|
1162
1162
|
marketId: '0xdf13c46bf7bd41597f27e32ae9c306eb63859c134073cb81c796ff20b520c7cf',
|
|
1163
1163
|
protocolName: 'morpho-blue',
|
|
1164
1164
|
});
|
package/cjs/portfolio/index.js
CHANGED
|
@@ -40,6 +40,7 @@ const spark_2 = require("../claiming/spark");
|
|
|
40
40
|
const morphoBlue_2 = require("../claiming/morphoBlue");
|
|
41
41
|
const king_1 = require("../claiming/king");
|
|
42
42
|
const ethena_1 = require("../claiming/ethena");
|
|
43
|
+
const aaveV4_1 = require("../aaveV4");
|
|
43
44
|
function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1) {
|
|
44
45
|
return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
|
|
45
46
|
const isMainnet = network === common_1.NetworkNumber.Eth;
|
|
@@ -56,6 +57,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
56
57
|
const llamaLendMarkets = [common_1.NetworkNumber.Eth, common_1.NetworkNumber.Arb].includes(network) ? Object.values((0, markets_1.LlamaLendMarkets)(network)).filter((market) => market.chainIds.includes(network)) : [];
|
|
57
58
|
const liquityV2Markets = [common_1.NetworkNumber.Eth].includes(network) ? Object.values((0, markets_1.LiquityV2Markets)(network)) : [];
|
|
58
59
|
const liquityV2MarketsStaking = [common_1.NetworkNumber.Eth].includes(network) ? Object.values((0, markets_1.LiquityV2Markets)(network)).filter(market => !market.isLegacy) : [];
|
|
60
|
+
const aaveV4Spokes = Object.values((0, markets_1.AaveV4Spokes)(network)).filter((market) => market.chainIds.includes(network));
|
|
59
61
|
const args = [network, { batch: { multicall: { batchSize: isSim ? 500000 : 2500000 } } }];
|
|
60
62
|
const client = (0, viem_1.getViemProvider)(provider, ...args);
|
|
61
63
|
const defaultClient = (0, viem_1.getViemProvider)(defaultProvider, ...args);
|
|
@@ -70,6 +72,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
70
72
|
const crvUsdMarketsData = {};
|
|
71
73
|
const llamaLendMarketsData = {};
|
|
72
74
|
const liquityV2MarketsData = {};
|
|
75
|
+
const aaveV4SpokesData = {};
|
|
73
76
|
const markets = {
|
|
74
77
|
morphoMarketsData,
|
|
75
78
|
compoundV3MarketsData,
|
|
@@ -81,6 +84,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
81
84
|
crvUsdMarketsData,
|
|
82
85
|
llamaLendMarketsData,
|
|
83
86
|
liquityV2MarketsData,
|
|
87
|
+
aaveV4SpokesData,
|
|
84
88
|
};
|
|
85
89
|
const positions = {};
|
|
86
90
|
const stakingPositions = {};
|
|
@@ -89,6 +93,7 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
89
93
|
for (const address of allAddresses) {
|
|
90
94
|
positions[address.toLowerCase()] = {
|
|
91
95
|
aaveV3: {},
|
|
96
|
+
aaveV4: {},
|
|
92
97
|
morphoBlue: {},
|
|
93
98
|
compoundV3: {},
|
|
94
99
|
spark: {},
|
|
@@ -154,6 +159,10 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
154
159
|
const marketData = yield (0, aaveV3_1._getAaveV3MarketData)(client, network, market);
|
|
155
160
|
aaveV3MarketsData[market.value] = marketData;
|
|
156
161
|
})),
|
|
162
|
+
...aaveV4Spokes.map((spoke) => __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
const spokeData = yield (0, aaveV4_1._getAaveV4SpokeData)(client, network, spoke);
|
|
164
|
+
aaveV4SpokesData[spoke.value] = spokeData;
|
|
165
|
+
})),
|
|
157
166
|
...aaveV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
158
167
|
const marketData = yield (0, aaveV2_1._getAaveV2MarketsData)(client, network, market);
|
|
159
168
|
aaveV2MarketsData[market.value] = marketData;
|
|
@@ -423,6 +432,17 @@ function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1)
|
|
|
423
432
|
positions[address.toLowerCase()].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
424
433
|
}
|
|
425
434
|
}))).flat(),
|
|
435
|
+
...aaveV4Spokes.map((spoke) => allAddresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
436
|
+
try {
|
|
437
|
+
const accData = yield (0, aaveV4_1._getAaveV4AccountData)(client, network, aaveV4SpokesData[spoke.value], address);
|
|
438
|
+
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
439
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: '', data: accData };
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
|
|
443
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
|
|
444
|
+
}
|
|
445
|
+
}))).flat(),
|
|
426
446
|
...morphoMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
427
447
|
try {
|
|
428
448
|
const [accDataPromise, earnDataPromise] = yield Promise.allSettled([
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
|
|
2
|
+
export declare enum AaveV4HubsType {
|
|
3
|
+
AaveV4CoreHub = "aave_v4_core_hub",
|
|
4
|
+
AaveV4PlusHub = "aave_v4_plus_hub",
|
|
5
|
+
AaveV4PrimeHub = "aave_v4_prime_hub"
|
|
6
|
+
}
|
|
7
|
+
export declare enum AaveV4SpokesType {
|
|
8
|
+
AaveV4BluechipSpoke = "aave_v4_bluechip_spoke",
|
|
9
|
+
AaveV4EthenaSpoke = "aave_v4_ethena_spoke",
|
|
10
|
+
AaveV4EtherfiSpoke = "aave_v4_etherfi_spoke",
|
|
11
|
+
AaveV4GoldSpoke = "aave_v4_gold_spoke",
|
|
12
|
+
AaveV4KelpSpoke = "aave_v4_kelp_spoke",
|
|
13
|
+
AaveV4LidoSpoke = "aave_v4_lido_spoke",
|
|
14
|
+
AaveV4MainSpoke = "aave_v4_main_spoke"
|
|
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 AaveV4SpokeInfo {
|
|
30
|
+
chainIds: NetworkNumber[];
|
|
31
|
+
label: string;
|
|
32
|
+
value: AaveV4SpokesType;
|
|
33
|
+
url: string;
|
|
34
|
+
address: EthAddress;
|
|
35
|
+
hubs: EthAddress[];
|
|
36
|
+
}
|
|
37
|
+
export interface AaveV4SpokeData {
|
|
38
|
+
assetsData: AaveV4AssetsData;
|
|
39
|
+
oracle: EthAddress;
|
|
40
|
+
oracleDecimals: number;
|
|
41
|
+
address: EthAddress;
|
|
42
|
+
}
|
|
43
|
+
export interface AaveV4ReserveAssetOnChain {
|
|
44
|
+
underlying: EthAddress;
|
|
45
|
+
hub: EthAddress;
|
|
46
|
+
assetId: number;
|
|
47
|
+
decimals: number;
|
|
48
|
+
paused: boolean;
|
|
49
|
+
frozen: boolean;
|
|
50
|
+
borrowable: boolean;
|
|
51
|
+
collateralRisk: number;
|
|
52
|
+
collateralFactor: number;
|
|
53
|
+
maxLiquidationBonus: number;
|
|
54
|
+
liquidationFee: number;
|
|
55
|
+
price: bigint;
|
|
56
|
+
totalSupplied: bigint;
|
|
57
|
+
totalDrawn: bigint;
|
|
58
|
+
totalPremium: bigint;
|
|
59
|
+
totalDebt: bigint;
|
|
60
|
+
supplyCap: bigint;
|
|
61
|
+
borrowCap: bigint;
|
|
62
|
+
deficitRay: bigint;
|
|
63
|
+
spokeActive: boolean;
|
|
64
|
+
spokeHalted: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface AaveV4ReserveAssetData {
|
|
67
|
+
symbol: string;
|
|
68
|
+
underlying: EthAddress;
|
|
69
|
+
hub: EthAddress;
|
|
70
|
+
hubName: string;
|
|
71
|
+
assetId: number;
|
|
72
|
+
reserveId: number;
|
|
73
|
+
paused: boolean;
|
|
74
|
+
frozen: boolean;
|
|
75
|
+
borrowable: boolean;
|
|
76
|
+
collateralRisk: number;
|
|
77
|
+
collateralFactor: number;
|
|
78
|
+
liquidationFee: number;
|
|
79
|
+
price: string;
|
|
80
|
+
totalSupplied: string;
|
|
81
|
+
totalDrawn: string;
|
|
82
|
+
totalPremium: string;
|
|
83
|
+
totalDebt: string;
|
|
84
|
+
supplyCap: string;
|
|
85
|
+
borrowCap: string;
|
|
86
|
+
spokeActive: boolean;
|
|
87
|
+
spokeHalted: boolean;
|
|
88
|
+
drawnRate: string;
|
|
89
|
+
supplyRate: string;
|
|
90
|
+
supplyIncentives: IncentiveData[];
|
|
91
|
+
borrowIncentives: IncentiveData[];
|
|
92
|
+
canBeBorrowed: boolean;
|
|
93
|
+
canBeSupplied: boolean;
|
|
94
|
+
canBeWithdrawn: boolean;
|
|
95
|
+
canBePayBacked: boolean;
|
|
96
|
+
utilization: string;
|
|
97
|
+
}
|
|
98
|
+
export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
|
|
99
|
+
export interface AaveV4UsedReserveAsset {
|
|
100
|
+
symbol: string;
|
|
101
|
+
hubName: string;
|
|
102
|
+
assetId: number;
|
|
103
|
+
reserveId: number;
|
|
104
|
+
supplied: string;
|
|
105
|
+
suppliedUsd: string;
|
|
106
|
+
drawn: string;
|
|
107
|
+
drawnUsd: string;
|
|
108
|
+
premium: string;
|
|
109
|
+
premiumUsd: string;
|
|
110
|
+
borrowed: string;
|
|
111
|
+
borrowedUsd: string;
|
|
112
|
+
isSupplied: boolean;
|
|
113
|
+
isBorrowed: boolean;
|
|
114
|
+
collateral: boolean;
|
|
115
|
+
collateralFactor: number;
|
|
116
|
+
}
|
|
117
|
+
export interface AaveV4AggregatedPositionData {
|
|
118
|
+
suppliedUsd: string;
|
|
119
|
+
suppliedCollateralUsd: string;
|
|
120
|
+
borrowLimitUsd: string;
|
|
121
|
+
liquidationLimitUsd: string;
|
|
122
|
+
borrowedUsd: string;
|
|
123
|
+
drawnUsd: string;
|
|
124
|
+
premiumUsd: string;
|
|
125
|
+
leftToBorrowUsd: string;
|
|
126
|
+
ratio: string;
|
|
127
|
+
collRatio: string;
|
|
128
|
+
liqRatio: string;
|
|
129
|
+
liqPercent: string;
|
|
130
|
+
leveragedType: LeverageType;
|
|
131
|
+
leveragedAsset: string;
|
|
132
|
+
liquidationPrice: string;
|
|
133
|
+
minCollRatio: string;
|
|
134
|
+
collLiquidationRatio: string;
|
|
135
|
+
minHealthRatio: string;
|
|
136
|
+
netApy: string;
|
|
137
|
+
incentiveUsd: string;
|
|
138
|
+
totalInterestUsd: string;
|
|
139
|
+
currentVolatilePairRatio?: string;
|
|
140
|
+
}
|
|
141
|
+
export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
|
|
142
|
+
export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
|
|
143
|
+
usedAssets: AaveV4UsedReserveAssets;
|
|
144
|
+
healthFactor: string;
|
|
145
|
+
}
|