@defisaver/positions-sdk 2.1.48 → 2.1.49-aave-v4-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/aaveV4/index.d.ts +7 -0
- package/cjs/aaveV4/index.js +167 -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/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/cjs/helpers/aaveV4Helpers/index.js +109 -0
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/markets/aave/marketAssets.js +1 -1
- package/cjs/markets/aaveV4/index.d.ts +7 -0
- package/cjs/markets/aaveV4/index.js +22 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/moneymarket/moneymarketCommonService.js +1 -1
- package/cjs/portfolio/index.js +20 -0
- package/cjs/savings/morphoVaults/index.js +17 -17
- package/cjs/staking/staking.js +5 -1
- package/cjs/types/aaveV4.d.ts +129 -0
- package/cjs/types/aaveV4.js +11 -0
- 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 +158 -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/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/esm/helpers/aaveV4Helpers/index.js +100 -0
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/markets/aave/marketAssets.js +1 -1
- package/esm/markets/aaveV4/index.d.ts +7 -0
- package/esm/markets/aaveV4/index.js +16 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/moneymarket/moneymarketCommonService.js +1 -1
- package/esm/portfolio/index.js +21 -1
- package/esm/savings/morphoVaults/index.js +17 -17
- package/esm/staking/staking.js +5 -1
- package/esm/types/aaveV4.d.ts +129 -0
- package/esm/types/aaveV4.js +8 -0
- 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 +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/aaveV4/index.ts +169 -0
- 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 +1328 -1320
- package/src/constants/index.ts +10 -10
- package/src/contracts.ts +174 -172
- 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 +191 -191
- package/src/helpers/aaveV4Helpers/index.ts +121 -0
- 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 +11 -10
- 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 +158 -158
- package/src/index.ts +51 -49
- 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/aaveV4/index.ts +19 -0
- 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 +26 -25
- 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 +971 -971
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +12 -12
- package/src/moneymarket/moneymarketCommonService.ts +85 -85
- package/src/morphoBlue/index.ts +274 -274
- package/src/portfolio/index.ts +618 -598
- 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 +34 -34
- 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 -190
- package/src/types/aave.ts +198 -198
- package/src/types/aaveV4.ts +142 -0
- package/src/types/claiming.ts +114 -114
- package/src/types/common.ts +107 -107
- package/src/types/compound.ts +144 -144
- package/src/types/curveUsd.ts +123 -123
- package/src/types/euler.ts +175 -175
- package/src/types/fluid.ts +483 -483
- package/src/types/index.ts +16 -15
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +126 -126
- package/src/types/llamaLend.ts +159 -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 +200 -200
- package/src/types/portfolio.ts +64 -60
- 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 +134 -134
- package/src/umbrella/index.ts +69 -69
- package/src/umbrella/umbrellaUtils.ts +29 -29
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 { 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;
|
|
@@ -0,0 +1,109 @@
|
|
|
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 = Object.values(assetsData).find((asset) => asset.symbol === 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;
|
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"));
|
|
@@ -128,73 +128,73 @@ const getApyAfterValuesEstimation = (selectedMarket, actions, provider, network)
|
|
|
128
128
|
});
|
|
129
129
|
exports.getApyAfterValuesEstimation = getApyAfterValuesEstimation;
|
|
130
130
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
131
|
-
const MARKET_QUERY = `
|
|
132
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
133
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
134
|
-
reallocatableLiquidityAssets
|
|
135
|
-
targetBorrowUtilization
|
|
136
|
-
loanAsset {
|
|
137
|
-
address
|
|
138
|
-
decimals
|
|
139
|
-
priceUsd
|
|
140
|
-
}
|
|
141
|
-
state {
|
|
142
|
-
liquidityAssets
|
|
143
|
-
borrowAssets
|
|
144
|
-
supplyAssets
|
|
145
|
-
}
|
|
146
|
-
publicAllocatorSharedLiquidity {
|
|
147
|
-
assets
|
|
148
|
-
vault {
|
|
149
|
-
address
|
|
150
|
-
name
|
|
151
|
-
}
|
|
152
|
-
allocationMarket {
|
|
153
|
-
uniqueKey
|
|
154
|
-
loanAsset {
|
|
155
|
-
address
|
|
156
|
-
}
|
|
157
|
-
collateralAsset {
|
|
158
|
-
address
|
|
159
|
-
}
|
|
160
|
-
irmAddress
|
|
161
|
-
oracle {
|
|
162
|
-
address
|
|
163
|
-
}
|
|
164
|
-
lltv
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
loanAsset {
|
|
168
|
-
address
|
|
169
|
-
}
|
|
170
|
-
collateralAsset {
|
|
171
|
-
address
|
|
172
|
-
}
|
|
173
|
-
oracle {
|
|
174
|
-
address
|
|
175
|
-
}
|
|
176
|
-
irmAddress
|
|
177
|
-
lltv
|
|
178
|
-
}
|
|
179
|
-
}
|
|
131
|
+
const MARKET_QUERY = `
|
|
132
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
133
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
134
|
+
reallocatableLiquidityAssets
|
|
135
|
+
targetBorrowUtilization
|
|
136
|
+
loanAsset {
|
|
137
|
+
address
|
|
138
|
+
decimals
|
|
139
|
+
priceUsd
|
|
140
|
+
}
|
|
141
|
+
state {
|
|
142
|
+
liquidityAssets
|
|
143
|
+
borrowAssets
|
|
144
|
+
supplyAssets
|
|
145
|
+
}
|
|
146
|
+
publicAllocatorSharedLiquidity {
|
|
147
|
+
assets
|
|
148
|
+
vault {
|
|
149
|
+
address
|
|
150
|
+
name
|
|
151
|
+
}
|
|
152
|
+
allocationMarket {
|
|
153
|
+
uniqueKey
|
|
154
|
+
loanAsset {
|
|
155
|
+
address
|
|
156
|
+
}
|
|
157
|
+
collateralAsset {
|
|
158
|
+
address
|
|
159
|
+
}
|
|
160
|
+
irmAddress
|
|
161
|
+
oracle {
|
|
162
|
+
address
|
|
163
|
+
}
|
|
164
|
+
lltv
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
loanAsset {
|
|
168
|
+
address
|
|
169
|
+
}
|
|
170
|
+
collateralAsset {
|
|
171
|
+
address
|
|
172
|
+
}
|
|
173
|
+
oracle {
|
|
174
|
+
address
|
|
175
|
+
}
|
|
176
|
+
irmAddress
|
|
177
|
+
lltv
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
180
|
`;
|
|
181
|
-
const REWARDS_QUERY = `
|
|
182
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
183
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
184
|
-
uniqueKey
|
|
185
|
-
state {
|
|
186
|
-
rewards {
|
|
187
|
-
amountPerSuppliedToken
|
|
188
|
-
supplyApr
|
|
189
|
-
amountPerBorrowedToken
|
|
190
|
-
borrowApr
|
|
191
|
-
asset {
|
|
192
|
-
address
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
181
|
+
const REWARDS_QUERY = `
|
|
182
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
183
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
184
|
+
uniqueKey
|
|
185
|
+
state {
|
|
186
|
+
rewards {
|
|
187
|
+
amountPerSuppliedToken
|
|
188
|
+
supplyApr
|
|
189
|
+
amountPerBorrowedToken
|
|
190
|
+
borrowApr
|
|
191
|
+
asset {
|
|
192
|
+
address
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
198
|
`;
|
|
199
199
|
/**
|
|
200
200
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
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"));
|
|
@@ -18,7 +18,7 @@ exports.aaveV3AssetsDefaultMarketOpt = [
|
|
|
18
18
|
exports.aaveV3AssetsDefaultMarketArb = ['DAI', 'LINK', 'USDC.e', 'WBTC', 'ETH', 'USDT', 'AAVE', 'EURS', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC', 'FRAX', 'ARB', 'weETH', 'GHO', 'ezETH', 'rsETH', 'tBTC'];
|
|
19
19
|
exports.aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC', 'ezETH', 'GHO', 'wrsETH', 'LBTC', 'EURC', 'AAVE', 'tBTC'];
|
|
20
20
|
exports.aaveV3AssetsDefaultMarketLinea = ['ETH', 'USDC', 'weETH', 'ezETH', 'USDT', 'wstETH', 'wrsETH', 'WBTC', 'mUSD'];
|
|
21
|
-
exports.aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'XPL'];
|
|
21
|
+
exports.aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'XPL', 'PT USDe Apr', 'PT sUSDe Apr'];
|
|
22
22
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
23
23
|
exports.aaveV3AssetsDefaultMarket = {
|
|
24
24
|
[common_1.NetworkNumber.Eth]: exports.aaveV3AssetsDefaultMarketEth,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { 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;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
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
|
+
const AAVE_V4_CORE_SPOKE = (networkId) => ({
|
|
7
|
+
chainIds: [common_1.NetworkNumber.Eth],
|
|
8
|
+
label: 'Core Spoke',
|
|
9
|
+
value: types_1.AaveV4SpokesType.AaveV4CoreSpoke,
|
|
10
|
+
url: 'core',
|
|
11
|
+
address: '0xBa97c5E52cd5BC3D7950Ae70779F8FfE92d40CdC',
|
|
12
|
+
hubs: [
|
|
13
|
+
'0xaD905aD5EA5B98cD50AE40Cfe368344686a21366',
|
|
14
|
+
],
|
|
15
|
+
});
|
|
16
|
+
exports.AAVE_V4_CORE_SPOKE = AAVE_V4_CORE_SPOKE;
|
|
17
|
+
const AaveV4Spokes = (networkId) => ({
|
|
18
|
+
[types_1.AaveV4SpokesType.AaveV4CoreSpoke]: (0, exports.AAVE_V4_CORE_SPOKE)(networkId),
|
|
19
|
+
});
|
|
20
|
+
exports.AaveV4Spokes = AaveV4Spokes;
|
|
21
|
+
const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, (0, exports.AaveV4Spokes)(network !== null && network !== void 0 ? network : common_1.NetworkNumber.Eth))[type]);
|
|
22
|
+
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; } });
|
|
@@ -31,7 +31,7 @@ exports.STABLE_ASSETS = [
|
|
|
31
31
|
'DAI', 'USDC', 'USDT', 'TUSD', 'USDP', 'GUSD', 'BUSD', 'SUSD', 'FRAX', 'LUSD', 'USDC.e', 'GHO', 'sDAI', 'USDA',
|
|
32
32
|
'USDe', 'sUSDe', 'USDS', 'sUSDS', 'USR', 'EURC', 'BOLD', 'BOLD Legacy', 'RLUSD', 'PT sUSDe July', 'PT eUSDe May',
|
|
33
33
|
'USDtb', 'eUSDe', 'PT USDe July', 'PT eUSDe Aug', 'PT sUSDe Sep', 'PT USDe Sep', 'PT sUSDe Nov', 'PT USDe Nov', 'PT sUSDe Jan', 'PT USDe Jan',
|
|
34
|
-
'PT sUSDe Feb', 'PT USDe Feb',
|
|
34
|
+
'PT sUSDe Feb', 'PT USDe Feb', 'PT USDe Apr', 'PT sUSDe Apr',
|
|
35
35
|
];
|
|
36
36
|
const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
37
37
|
let borrowUnstable = 0;
|
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, network, defaultProvider, addresses, summerFiAddresses) {
|
|
44
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
46
|
const isMainnet = network === common_1.NetworkNumber.Eth;
|
|
@@ -56,6 +57,7 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
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 client = (0, viem_1.getViemProvider)(provider, network, {
|
|
60
62
|
batch: {
|
|
61
63
|
multicall: {
|
|
@@ -81,6 +83,7 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
81
83
|
const crvUsdMarketsData = {};
|
|
82
84
|
const llamaLendMarketsData = {};
|
|
83
85
|
const liquityV2MarketsData = {};
|
|
86
|
+
const aaveV4SpokesData = {};
|
|
84
87
|
const markets = {
|
|
85
88
|
morphoMarketsData,
|
|
86
89
|
compoundV3MarketsData,
|
|
@@ -92,6 +95,7 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
92
95
|
crvUsdMarketsData,
|
|
93
96
|
llamaLendMarketsData,
|
|
94
97
|
liquityV2MarketsData,
|
|
98
|
+
aaveV4SpokesData,
|
|
95
99
|
};
|
|
96
100
|
const positions = {};
|
|
97
101
|
const stakingPositions = {};
|
|
@@ -100,6 +104,7 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
100
104
|
for (const address of allAddresses) {
|
|
101
105
|
positions[address.toLowerCase()] = {
|
|
102
106
|
aaveV3: {},
|
|
107
|
+
aaveV4: {},
|
|
103
108
|
morphoBlue: {},
|
|
104
109
|
compoundV3: {},
|
|
105
110
|
spark: {},
|
|
@@ -165,6 +170,10 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
165
170
|
const marketData = yield (0, aaveV3_1._getAaveV3MarketData)(client, network, market);
|
|
166
171
|
aaveV3MarketsData[market.value] = marketData;
|
|
167
172
|
})),
|
|
173
|
+
...aaveV4Spokes.map((spoke) => __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
const spokeData = yield (0, aaveV4_1._getAaveV4SpokeData)(client, network, spoke);
|
|
175
|
+
aaveV4SpokesData[spoke.value] = spokeData;
|
|
176
|
+
})),
|
|
168
177
|
...aaveV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
169
178
|
const marketData = yield (0, aaveV2_1._getAaveV2MarketsData)(client, network, market);
|
|
170
179
|
aaveV2MarketsData[market.value] = marketData;
|
|
@@ -434,6 +443,17 @@ function getPortfolioData(provider, network, defaultProvider, addresses, summerF
|
|
|
434
443
|
positions[address.toLowerCase()].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
435
444
|
}
|
|
436
445
|
}))).flat(),
|
|
446
|
+
...aaveV4Spokes.map((spoke) => allAddresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
447
|
+
try {
|
|
448
|
+
const accData = yield (0, aaveV4_1._getAaveV4AccountData)(client, network, aaveV4SpokesData[spoke.value], address);
|
|
449
|
+
if (new decimal_js_1.default(accData.suppliedUsd).gt(0))
|
|
450
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: '', data: accData };
|
|
451
|
+
}
|
|
452
|
+
catch (error) {
|
|
453
|
+
console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
|
|
454
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
|
|
455
|
+
}
|
|
456
|
+
}))).flat(),
|
|
437
457
|
...morphoMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
438
458
|
try {
|
|
439
459
|
const [accDataPromise, earnDataPromise] = yield Promise.allSettled([
|
|
@@ -54,23 +54,23 @@ const morphoVaultsOptions = __importStar(require("./options"));
|
|
|
54
54
|
exports.morphoVaultsOptions = morphoVaultsOptions;
|
|
55
55
|
const viem_1 = require("../../services/viem");
|
|
56
56
|
const contracts_1 = require("../../contracts");
|
|
57
|
-
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
58
|
-
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
59
|
-
id,
|
|
60
|
-
dailyApy,
|
|
61
|
-
dailyApys {
|
|
62
|
-
apy, netApy
|
|
63
|
-
},
|
|
64
|
-
monthlyApys {
|
|
65
|
-
apy, netApy
|
|
66
|
-
},
|
|
67
|
-
liquidity {
|
|
68
|
-
underlying, usd,
|
|
69
|
-
},
|
|
70
|
-
asset {
|
|
71
|
-
priceUsd
|
|
72
|
-
}
|
|
73
|
-
}
|
|
57
|
+
const vaultDataQuery = (vaultAddress) => `query vaultByAddress {
|
|
58
|
+
vaultByAddress(chainId: 1, address: "${vaultAddress}") {
|
|
59
|
+
id,
|
|
60
|
+
dailyApy,
|
|
61
|
+
dailyApys {
|
|
62
|
+
apy, netApy
|
|
63
|
+
},
|
|
64
|
+
monthlyApys {
|
|
65
|
+
apy, netApy
|
|
66
|
+
},
|
|
67
|
+
liquidity {
|
|
68
|
+
underlying, usd,
|
|
69
|
+
},
|
|
70
|
+
asset {
|
|
71
|
+
priceUsd
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
74
|
}`;
|
|
75
75
|
const MORPHO_BLUE_API = 'https://blue-api.morpho.org/graphql';
|
|
76
76
|
const _getMorphoVaultData = (provider, network, morphoVault, accounts) => __awaiter(void 0, void 0, void 0, function* () {
|
package/cjs/staking/staking.js
CHANGED
|
@@ -72,7 +72,7 @@ exports.STAKING_ASSETS = [
|
|
|
72
72
|
'cbETH', 'wstETH', 'cbETH', 'rETH', 'sDAI', 'weETH', 'sUSDe', 'osETH',
|
|
73
73
|
'ezETH', 'ETHx', 'rsETH', 'pufETH', 'wrsETH', 'wsuperOETHb', 'sUSDS', 'tETH', 'PT sUSDe Sep', 'PT USDe Sep',
|
|
74
74
|
'PT sUSDe Nov', 'PT USDe Nov', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'syrupUSDC', 'wstUSR',
|
|
75
|
-
'PT sUSDe Feb', 'PT USDe Feb',
|
|
75
|
+
'PT sUSDe Feb', 'PT USDe Feb', 'PT USDe Apr', 'PT sUSDe Apr',
|
|
76
76
|
];
|
|
77
77
|
exports.getStakingApy = (0, memoizee_1.default)((asset_1, ...args_1) => __awaiter(void 0, [asset_1, ...args_1], void 0, function* (asset, network = common_1.NetworkNumber.Eth) {
|
|
78
78
|
try {
|
|
@@ -136,6 +136,10 @@ exports.getStakingApy = (0, memoizee_1.default)((asset_1, ...args_1) => __awaite
|
|
|
136
136
|
return yield getApyFromDfsApi('PT sUSDe Feb', network);
|
|
137
137
|
if (asset === 'PT USDe Feb')
|
|
138
138
|
return yield getApyFromDfsApi('PT USDe Feb', network);
|
|
139
|
+
if (asset === 'PT sUSDe Apr')
|
|
140
|
+
return yield getApyFromDfsApi('PT sUSDe Apr', network);
|
|
141
|
+
if (asset === 'PT USDe Apr')
|
|
142
|
+
return yield getApyFromDfsApi('PT USDe Apr', network);
|
|
139
143
|
}
|
|
140
144
|
catch (e) {
|
|
141
145
|
console.error(`Failed to fetch APY for ${asset}`);
|