@defisaver/positions-sdk 2.1.51 → 2.1.52-aave-v4-1-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 +1277 -0
- package/cjs/config/contracts.js +9 -0
- package/cjs/contracts.d.ts +23120 -0
- package/cjs/contracts.js +2 -1
- package/cjs/fluid/index.d.ts +6 -6
- package/cjs/helpers/aaveHelpers/index.d.ts +2 -2
- package/cjs/helpers/aaveHelpers/index.js +16 -5
- package/cjs/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/cjs/helpers/aaveV4Helpers/index.js +117 -0
- package/cjs/helpers/compoundHelpers/index.js +15 -18
- package/cjs/helpers/eulerHelpers/index.d.ts +2 -2
- package/cjs/helpers/eulerHelpers/index.js +21 -13
- package/cjs/helpers/fluidHelpers/index.js +16 -5
- package/cjs/helpers/index.d.ts +1 -0
- package/cjs/helpers/index.js +2 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +15 -5
- package/cjs/helpers/sparkHelpers/index.d.ts +2 -2
- package/cjs/helpers/sparkHelpers/index.js +15 -5
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -1
- package/cjs/markets/aaveV4/index.d.ts +16 -0
- package/cjs/markets/aaveV4/index.js +59 -0
- package/cjs/markets/index.d.ts +1 -0
- package/cjs/markets/index.js +3 -1
- package/cjs/moneymarket/moneymarketCommonService.d.ts +3 -3
- package/cjs/moneymarket/moneymarketCommonService.js +9 -9
- package/cjs/portfolio/index.js +20 -0
- package/cjs/types/aave.d.ts +3 -3
- package/cjs/types/aaveV4.d.ts +139 -0
- package/cjs/types/aaveV4.js +13 -0
- package/cjs/types/common.d.ts +8 -1
- package/cjs/types/common.js +10 -2
- package/cjs/types/compound.d.ts +3 -3
- package/cjs/types/curveUsd.d.ts +2 -2
- package/cjs/types/euler.d.ts +3 -3
- package/cjs/types/fluid.d.ts +3 -3
- package/cjs/types/index.d.ts +2 -0
- package/cjs/types/index.js +2 -0
- package/cjs/types/liquityV2.d.ts +3 -3
- package/cjs/types/llamaLend.d.ts +2 -2
- package/cjs/types/morphoBlue.d.ts +5 -5
- package/cjs/types/portfolio.d.ts +4 -0
- package/cjs/types/spark.d.ts +3 -3
- package/esm/aaveV4/index.d.ts +7 -0
- package/esm/aaveV4/index.js +165 -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/fluid/index.d.ts +6 -6
- package/esm/helpers/aaveHelpers/index.d.ts +2 -2
- package/esm/helpers/aaveHelpers/index.js +16 -5
- package/esm/helpers/aaveV4Helpers/index.d.ts +13 -0
- package/esm/helpers/aaveV4Helpers/index.js +108 -0
- package/esm/helpers/compoundHelpers/index.js +16 -19
- package/esm/helpers/eulerHelpers/index.d.ts +2 -2
- package/esm/helpers/eulerHelpers/index.js +21 -13
- package/esm/helpers/fluidHelpers/index.js +16 -5
- package/esm/helpers/index.d.ts +1 -0
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/morphoBlueHelpers/index.js +16 -6
- package/esm/helpers/sparkHelpers/index.d.ts +2 -2
- package/esm/helpers/sparkHelpers/index.js +16 -6
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/markets/aaveV4/index.d.ts +16 -0
- package/esm/markets/aaveV4/index.js +47 -0
- package/esm/markets/index.d.ts +1 -0
- package/esm/markets/index.js +1 -0
- package/esm/moneymarket/moneymarketCommonService.d.ts +3 -3
- package/esm/moneymarket/moneymarketCommonService.js +9 -9
- package/esm/portfolio/index.js +21 -1
- package/esm/types/aave.d.ts +3 -3
- package/esm/types/aaveV4.d.ts +139 -0
- package/esm/types/aaveV4.js +10 -0
- package/esm/types/common.d.ts +8 -1
- package/esm/types/common.js +9 -1
- package/esm/types/compound.d.ts +3 -3
- package/esm/types/curveUsd.d.ts +2 -2
- package/esm/types/euler.d.ts +3 -3
- package/esm/types/fluid.d.ts +3 -3
- package/esm/types/fluid.js +1 -1
- package/esm/types/index.d.ts +2 -0
- package/esm/types/index.js +2 -0
- package/esm/types/liquityV2.d.ts +3 -3
- package/esm/types/llamaLend.d.ts +2 -2
- package/esm/types/morphoBlue.d.ts +5 -5
- package/esm/types/portfolio.d.ts +4 -0
- package/esm/types/spark.d.ts +3 -3
- package/package.json +1 -1
- package/src/aaveV4/index.ts +176 -0
- package/src/config/contracts.ts +8 -0
- package/src/contracts.ts +3 -1
- package/src/helpers/aaveHelpers/index.ts +18 -7
- package/src/helpers/aaveV4Helpers/index.ts +128 -0
- package/src/helpers/compoundHelpers/index.ts +16 -23
- package/src/helpers/eulerHelpers/index.ts +21 -14
- package/src/helpers/fluidHelpers/index.ts +15 -6
- package/src/helpers/index.ts +1 -0
- package/src/helpers/morphoBlueHelpers/index.ts +15 -6
- package/src/helpers/sparkHelpers/index.ts +18 -7
- package/src/index.ts +2 -0
- package/src/markets/aaveV4/index.ts +68 -0
- package/src/markets/index.ts +6 -1
- package/src/moneymarket/moneymarketCommonService.ts +10 -11
- package/src/portfolio/index.ts +20 -0
- package/src/types/aave.ts +3 -2
- package/src/types/aaveV4.ts +155 -0
- package/src/types/common.ts +9 -1
- package/src/types/compound.ts +3 -2
- package/src/types/curveUsd.ts +2 -2
- package/src/types/euler.ts +3 -2
- package/src/types/fluid.ts +5 -3
- package/src/types/index.ts +3 -1
- package/src/types/liquityV2.ts +5 -3
- package/src/types/llamaLend.ts +4 -2
- package/src/types/morphoBlue.ts +5 -5
- package/src/types/portfolio.ts +4 -0
- package/src/types/spark.ts +3 -2
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; } });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { MMUsedAssets } from '../types/common';
|
|
1
|
+
import { LeverageType, MMUsedAssets } from '../types/common';
|
|
2
2
|
export declare const getAssetsTotal: (assets: object, filter: any, transform: any) => any;
|
|
3
3
|
export declare const calcLongLiqPrice: (assetPrice: string, borrowedUsd: string, borrowLimitUsd: string) => string;
|
|
4
4
|
export declare const calcShortLiqPrice: (assetPrice: string, borrowedUsd: string, borrowLimitUsd: string) => string;
|
|
5
|
-
export declare const calcLeverageLiqPrice: (leverageType:
|
|
5
|
+
export declare const calcLeverageLiqPrice: (leverageType: LeverageType, assetPrice: string, borrowedUsd: string, borrowLimitUsd: string) => string;
|
|
6
6
|
export declare const calculateBorrowingAssetLimit: (assetBorrowedUsd: string, borrowLimitUsd: string) => string;
|
|
7
7
|
export declare const STABLE_ASSETS: string[];
|
|
8
8
|
export declare const isLeveragedPos: (usedAssets: MMUsedAssets, dustLimit?: number) => {
|
|
9
|
-
leveragedType:
|
|
9
|
+
leveragedType: LeverageType;
|
|
10
10
|
leveragedAsset: string;
|
|
11
11
|
};
|
|
12
12
|
export declare const aprToApy: (interest: string | number, frequency?: number) => string;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.aprToApy = exports.isLeveragedPos = exports.STABLE_ASSETS = exports.calculateBorrowingAssetLimit = exports.calcLeverageLiqPrice = exports.calcShortLiqPrice = exports.calcLongLiqPrice = exports.getAssetsTotal = void 0;
|
|
7
7
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
|
+
const common_1 = require("../types/common");
|
|
9
10
|
const getAssetsTotal = (assets, filter, transform) => Object.values(assets)
|
|
10
11
|
.filter(filter)
|
|
11
12
|
.map(transform)
|
|
@@ -17,9 +18,9 @@ exports.calcLongLiqPrice = calcLongLiqPrice;
|
|
|
17
18
|
const calcShortLiqPrice = (assetPrice, borrowedUsd, borrowLimitUsd) => new decimal_js_1.default(assetPrice).div(borrowedUsd).mul(borrowLimitUsd).toString();
|
|
18
19
|
exports.calcShortLiqPrice = calcShortLiqPrice;
|
|
19
20
|
const calcLeverageLiqPrice = (leverageType, assetPrice, borrowedUsd, borrowLimitUsd) => {
|
|
20
|
-
if (leverageType ===
|
|
21
|
+
if (leverageType === common_1.LeverageType.Short || leverageType === common_1.LeverageType.VolatilePairReverse)
|
|
21
22
|
return (0, exports.calcShortLiqPrice)(assetPrice, borrowedUsd, borrowLimitUsd);
|
|
22
|
-
if (leverageType ===
|
|
23
|
+
if (leverageType === common_1.LeverageType.Long || leverageType === common_1.LeverageType.VolatilePair)
|
|
23
24
|
return (0, exports.calcLongLiqPrice)(assetPrice, borrowedUsd, borrowLimitUsd);
|
|
24
25
|
console.error('invalid leverageType', leverageType);
|
|
25
26
|
return '0';
|
|
@@ -58,28 +59,27 @@ const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
|
58
59
|
});
|
|
59
60
|
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
60
61
|
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
61
|
-
|
|
62
|
-
const isLsdLeveraged = supplyUnstable === 1 && borrowUnstable === 1 && shortAsset === 'ETH' && ['stETH', 'wstETH', 'cbETH', 'rETH', 'ezETH', 'weETH'].includes(longAsset);
|
|
62
|
+
const isVolatilePair = supplyUnstable === 1 && borrowUnstable === 1 && supplyStable === 0 && borrowStable === 0;
|
|
63
63
|
if (isLong) {
|
|
64
64
|
return {
|
|
65
|
-
leveragedType:
|
|
65
|
+
leveragedType: common_1.LeverageType.Long,
|
|
66
66
|
leveragedAsset: longAsset,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
if (isShort) {
|
|
70
70
|
return {
|
|
71
|
-
leveragedType:
|
|
71
|
+
leveragedType: common_1.LeverageType.Short,
|
|
72
72
|
leveragedAsset: shortAsset,
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
if (
|
|
75
|
+
if (isVolatilePair) {
|
|
76
76
|
return {
|
|
77
|
-
leveragedType:
|
|
77
|
+
leveragedType: common_1.LeverageType.VolatilePair,
|
|
78
78
|
leveragedAsset: longAsset,
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
return {
|
|
82
|
-
leveragedType:
|
|
82
|
+
leveragedType: common_1.LeverageType.None,
|
|
83
83
|
leveragedAsset: '',
|
|
84
84
|
};
|
|
85
85
|
};
|
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([
|
package/cjs/types/aave.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IncentiveData, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
1
|
+
import { IncentiveData, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
2
2
|
export declare enum AaveVersions {
|
|
3
3
|
AaveV1 = "v1",
|
|
4
4
|
AaveV2 = "v2default",
|
|
@@ -161,14 +161,14 @@ export interface AaveV3AggregatedPositionData {
|
|
|
161
161
|
totalInterestUsd: string;
|
|
162
162
|
liqRatio: string;
|
|
163
163
|
liqPercent: string;
|
|
164
|
-
leveragedType:
|
|
164
|
+
leveragedType: LeverageType;
|
|
165
165
|
leveragedAsset?: string;
|
|
166
|
-
leveragedLsdAssetRatio?: string;
|
|
167
166
|
liquidationPrice?: string;
|
|
168
167
|
minCollRatio?: string;
|
|
169
168
|
collLiquidationRatio?: string;
|
|
170
169
|
healthRatio?: string;
|
|
171
170
|
minHealthRatio?: string;
|
|
171
|
+
currentVolatilePairRatio?: string;
|
|
172
172
|
}
|
|
173
173
|
export interface AaveHelperCommon {
|
|
174
174
|
usedAssets: any;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
|
|
2
|
+
export declare enum AaveV4SpokesType {
|
|
3
|
+
AaveV4CoreSpoke = "aave_v4_core_spoke",
|
|
4
|
+
AaveV4YieldSeekingSpoke = "aave_v4_yield_seeking_spoke"
|
|
5
|
+
}
|
|
6
|
+
export declare enum AaveV4HubsType {
|
|
7
|
+
AaveV4CoreHub = "aave_v4_core_hub",
|
|
8
|
+
AaveV4YieldSeekingHub = "aave_v4_yield_seeking_hub"
|
|
9
|
+
}
|
|
10
|
+
export interface AaveV4SpokeInfo {
|
|
11
|
+
chainIds: NetworkNumber[];
|
|
12
|
+
label: string;
|
|
13
|
+
value: AaveV4SpokesType;
|
|
14
|
+
url: string;
|
|
15
|
+
address: EthAddress;
|
|
16
|
+
hubs: EthAddress[];
|
|
17
|
+
}
|
|
18
|
+
export interface AaveV4HubInfo {
|
|
19
|
+
chainIds: NetworkNumber[];
|
|
20
|
+
label: string;
|
|
21
|
+
value: AaveV4HubsType;
|
|
22
|
+
address: EthAddress;
|
|
23
|
+
}
|
|
24
|
+
export interface AaveV4HubAssetOnChainData {
|
|
25
|
+
assetId: number;
|
|
26
|
+
drawnRate: bigint;
|
|
27
|
+
}
|
|
28
|
+
export interface AaveV4HubOnChainData {
|
|
29
|
+
assets: Record<number, AaveV4HubAssetOnChainData>;
|
|
30
|
+
}
|
|
31
|
+
export interface AaveV4ReserveAssetOnChain {
|
|
32
|
+
underlying: EthAddress;
|
|
33
|
+
hub: EthAddress;
|
|
34
|
+
assetId: number;
|
|
35
|
+
decimals: number;
|
|
36
|
+
paused: boolean;
|
|
37
|
+
frozen: boolean;
|
|
38
|
+
borrowable: boolean;
|
|
39
|
+
collateralRisk: number;
|
|
40
|
+
collateralFactor: number;
|
|
41
|
+
maxLiquidationBonus: number;
|
|
42
|
+
liquidationFee: number;
|
|
43
|
+
price: bigint;
|
|
44
|
+
totalSupplied: bigint;
|
|
45
|
+
totalDrawn: bigint;
|
|
46
|
+
totalPremium: bigint;
|
|
47
|
+
totalDebt: bigint;
|
|
48
|
+
supplyCap: bigint;
|
|
49
|
+
borrowCap: bigint;
|
|
50
|
+
deficitRay: bigint;
|
|
51
|
+
spokeActive: boolean;
|
|
52
|
+
spokePaused: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface AaveV4ReserveAssetData {
|
|
55
|
+
symbol: string;
|
|
56
|
+
underlying: EthAddress;
|
|
57
|
+
hub: EthAddress;
|
|
58
|
+
hubName: string;
|
|
59
|
+
assetId: number;
|
|
60
|
+
reserveId: number;
|
|
61
|
+
paused: boolean;
|
|
62
|
+
frozen: boolean;
|
|
63
|
+
borrowable: boolean;
|
|
64
|
+
collateralRisk: number;
|
|
65
|
+
collateralFactor: number;
|
|
66
|
+
liquidationFee: number;
|
|
67
|
+
price: string;
|
|
68
|
+
totalSupplied: string;
|
|
69
|
+
totalDrawn: string;
|
|
70
|
+
totalPremium: string;
|
|
71
|
+
totalDebt: string;
|
|
72
|
+
supplyCap: string;
|
|
73
|
+
borrowCap: string;
|
|
74
|
+
spokeActive: boolean;
|
|
75
|
+
spokePaused: boolean;
|
|
76
|
+
drawnRate: string;
|
|
77
|
+
supplyRate: string;
|
|
78
|
+
supplyIncentives: IncentiveData[];
|
|
79
|
+
borrowIncentives: IncentiveData[];
|
|
80
|
+
canBeBorrowed: boolean;
|
|
81
|
+
canBeSupplied: boolean;
|
|
82
|
+
canBeWithdrawn: boolean;
|
|
83
|
+
canBePayBacked: boolean;
|
|
84
|
+
utilization: string;
|
|
85
|
+
}
|
|
86
|
+
export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
|
|
87
|
+
export interface AaveV4SpokeData {
|
|
88
|
+
assetsData: AaveV4AssetsData;
|
|
89
|
+
oracle: EthAddress;
|
|
90
|
+
oracleDecimals: number;
|
|
91
|
+
address: EthAddress;
|
|
92
|
+
}
|
|
93
|
+
export interface AaveV4UsedReserveAsset {
|
|
94
|
+
symbol: string;
|
|
95
|
+
hubName: string;
|
|
96
|
+
assetId: number;
|
|
97
|
+
reserveId: number;
|
|
98
|
+
supplied: string;
|
|
99
|
+
suppliedUsd: string;
|
|
100
|
+
drawn: string;
|
|
101
|
+
drawnUsd: string;
|
|
102
|
+
premium: string;
|
|
103
|
+
premiumUsd: string;
|
|
104
|
+
borrowed: string;
|
|
105
|
+
borrowedUsd: string;
|
|
106
|
+
isSupplied: boolean;
|
|
107
|
+
isBorrowed: boolean;
|
|
108
|
+
collateral: boolean;
|
|
109
|
+
collateralFactor: number;
|
|
110
|
+
}
|
|
111
|
+
export interface AaveV4AggregatedPositionData {
|
|
112
|
+
suppliedUsd: string;
|
|
113
|
+
suppliedCollateralUsd: string;
|
|
114
|
+
borrowLimitUsd: string;
|
|
115
|
+
liquidationLimitUsd: string;
|
|
116
|
+
borrowedUsd: string;
|
|
117
|
+
drawnUsd: string;
|
|
118
|
+
premiumUsd: string;
|
|
119
|
+
leftToBorrowUsd: string;
|
|
120
|
+
ratio: string;
|
|
121
|
+
collRatio: string;
|
|
122
|
+
liqRatio: string;
|
|
123
|
+
liqPercent: string;
|
|
124
|
+
leveragedType: LeverageType;
|
|
125
|
+
leveragedAsset: string;
|
|
126
|
+
liquidationPrice: string;
|
|
127
|
+
minCollRatio: string;
|
|
128
|
+
collLiquidationRatio: string;
|
|
129
|
+
minHealthRatio: string;
|
|
130
|
+
netApy: string;
|
|
131
|
+
incentiveUsd: string;
|
|
132
|
+
totalInterestUsd: string;
|
|
133
|
+
currentVolatilePairRatio?: string;
|
|
134
|
+
}
|
|
135
|
+
export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
|
|
136
|
+
export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
|
|
137
|
+
usedAssets: AaveV4UsedReserveAssets;
|
|
138
|
+
healthFactor: string;
|
|
139
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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["AaveV4YieldSeekingSpoke"] = "aave_v4_yield_seeking_spoke";
|
|
8
|
+
})(AaveV4SpokesType || (exports.AaveV4SpokesType = AaveV4SpokesType = {}));
|
|
9
|
+
var AaveV4HubsType;
|
|
10
|
+
(function (AaveV4HubsType) {
|
|
11
|
+
AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
|
|
12
|
+
AaveV4HubsType["AaveV4YieldSeekingHub"] = "aave_v4_yield_seeking_hub";
|
|
13
|
+
})(AaveV4HubsType || (exports.AaveV4HubsType = AaveV4HubsType = {}));
|
package/cjs/types/common.d.ts
CHANGED
|
@@ -3,11 +3,18 @@ export declare enum IncentiveKind {
|
|
|
3
3
|
Reward = "reward"
|
|
4
4
|
}
|
|
5
5
|
export declare enum IncentiveEligibilityId {
|
|
6
|
-
AaveV3EthenaLiquidLeverage = "
|
|
6
|
+
AaveV3EthenaLiquidLeverage = "0x8014e0076e5393e62c49a7134070d8fccc922e46BORROW_BL",
|
|
7
7
|
AaveV3ArbitrumEthSupply = "0x5d16261c6715a653248269861bbacf68a9774cde",
|
|
8
8
|
AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351",
|
|
9
9
|
AaveV3EthenaLiquidLeveragePlasma = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL"
|
|
10
10
|
}
|
|
11
|
+
export declare enum LeverageType {
|
|
12
|
+
Long = "long",
|
|
13
|
+
Short = "short",
|
|
14
|
+
VolatilePair = "volatile-pair",
|
|
15
|
+
VolatilePairReverse = "volatile-pair-reverse",
|
|
16
|
+
None = ""
|
|
17
|
+
}
|
|
11
18
|
export interface IncentiveData {
|
|
12
19
|
token: string;
|
|
13
20
|
apy: string;
|
package/cjs/types/common.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NetworkNumber = exports.IncentiveEligibilityId = exports.IncentiveKind = void 0;
|
|
3
|
+
exports.NetworkNumber = exports.LeverageType = exports.IncentiveEligibilityId = exports.IncentiveKind = void 0;
|
|
4
4
|
var IncentiveKind;
|
|
5
5
|
(function (IncentiveKind) {
|
|
6
6
|
IncentiveKind["Staking"] = "staking";
|
|
@@ -8,11 +8,19 @@ var IncentiveKind;
|
|
|
8
8
|
})(IncentiveKind || (exports.IncentiveKind = IncentiveKind = {}));
|
|
9
9
|
var IncentiveEligibilityId;
|
|
10
10
|
(function (IncentiveEligibilityId) {
|
|
11
|
-
IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "
|
|
11
|
+
IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "0x8014e0076e5393e62c49a7134070d8fccc922e46BORROW_BL";
|
|
12
12
|
IncentiveEligibilityId["AaveV3ArbitrumEthSupply"] = "0x5d16261c6715a653248269861bbacf68a9774cde";
|
|
13
13
|
IncentiveEligibilityId["AaveV3ArbitrumETHLSBorrow"] = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351";
|
|
14
14
|
IncentiveEligibilityId["AaveV3EthenaLiquidLeveragePlasma"] = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL";
|
|
15
15
|
})(IncentiveEligibilityId || (exports.IncentiveEligibilityId = IncentiveEligibilityId = {}));
|
|
16
|
+
var LeverageType;
|
|
17
|
+
(function (LeverageType) {
|
|
18
|
+
LeverageType["Long"] = "long";
|
|
19
|
+
LeverageType["Short"] = "short";
|
|
20
|
+
LeverageType["VolatilePair"] = "volatile-pair";
|
|
21
|
+
LeverageType["VolatilePairReverse"] = "volatile-pair-reverse";
|
|
22
|
+
LeverageType["None"] = "";
|
|
23
|
+
})(LeverageType || (exports.LeverageType = LeverageType = {}));
|
|
16
24
|
var NetworkNumber;
|
|
17
25
|
(function (NetworkNumber) {
|
|
18
26
|
NetworkNumber[NetworkNumber["Eth"] = 1] = "Eth";
|
package/cjs/types/compound.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
1
|
+
import { EthAddress, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
2
2
|
export declare enum CompoundVersions {
|
|
3
3
|
'CompoundV2' = "v2",
|
|
4
4
|
'CompoundV3USDC' = "v3-USDC",
|
|
@@ -94,9 +94,9 @@ export interface CompoundAggregatedPositionData {
|
|
|
94
94
|
totalInterestUsd: string;
|
|
95
95
|
liqRatio: string;
|
|
96
96
|
liqPercent: string;
|
|
97
|
-
leveragedType:
|
|
97
|
+
leveragedType: LeverageType;
|
|
98
98
|
leveragedAsset?: string;
|
|
99
|
-
|
|
99
|
+
currentVolatilePairRatio?: string;
|
|
100
100
|
liquidationPrice?: string;
|
|
101
101
|
minRatio: string;
|
|
102
102
|
debtTooLow: boolean;
|
package/cjs/types/curveUsd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress, NetworkNumber } from './common';
|
|
1
|
+
import { EthAddress, LeverageType, NetworkNumber } from './common';
|
|
2
2
|
export declare enum CrvUSDVersions {
|
|
3
3
|
'crvUSDwstETH' = "wstETH",
|
|
4
4
|
'crvUSDWBTC' = "WBTC",
|
|
@@ -71,7 +71,7 @@ export interface CrvUSDAggregatedPositionData {
|
|
|
71
71
|
borrowLimitUsd: string;
|
|
72
72
|
minAllowedRatio: number;
|
|
73
73
|
collFactor: string;
|
|
74
|
-
leveragedType:
|
|
74
|
+
leveragedType: LeverageType;
|
|
75
75
|
leveragedAsset?: string;
|
|
76
76
|
liquidationPrice?: string;
|
|
77
77
|
}
|
package/cjs/types/euler.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress, IncentiveData, MMPositionData, NetworkNumber } from './common';
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, MMPositionData, NetworkNumber } from './common';
|
|
2
2
|
export declare enum EulerV2Versions {
|
|
3
3
|
eUSDC2 = "eUSDC-2",
|
|
4
4
|
eWETH2 = "eWETH-2"
|
|
@@ -141,9 +141,9 @@ export interface EulerV2AggregatedPositionData {
|
|
|
141
141
|
totalInterestUsd: string;
|
|
142
142
|
liqRatio: string;
|
|
143
143
|
liqPercent: string;
|
|
144
|
-
leveragedType:
|
|
144
|
+
leveragedType: LeverageType;
|
|
145
145
|
leveragedAsset?: string;
|
|
146
|
-
|
|
146
|
+
currentVolatilePairRatio?: string;
|
|
147
147
|
liquidationPrice?: string;
|
|
148
148
|
minRatio: string;
|
|
149
149
|
minDebt: string;
|
package/cjs/types/fluid.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress, IncentiveData, NetworkNumber } from './common';
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
|
|
2
2
|
export interface FluidMarketInfo {
|
|
3
3
|
chainIds: number[];
|
|
4
4
|
label: string;
|
|
@@ -323,10 +323,10 @@ export interface FluidAggregatedVaultData {
|
|
|
323
323
|
collRatio: string;
|
|
324
324
|
minRatio: string;
|
|
325
325
|
totalInterestUsd: string;
|
|
326
|
-
leveragedType?:
|
|
326
|
+
leveragedType?: LeverageType;
|
|
327
327
|
leveragedAsset?: string;
|
|
328
328
|
liquidationPrice?: string;
|
|
329
|
-
|
|
329
|
+
currentVolatilePairRatio?: string;
|
|
330
330
|
minCollRatio?: string;
|
|
331
331
|
collLiquidationRatio?: string;
|
|
332
332
|
}
|
package/cjs/types/index.d.ts
CHANGED
package/cjs/types/index.js
CHANGED
|
@@ -29,3 +29,5 @@ __exportStar(require("./portfolio"), exports);
|
|
|
29
29
|
__exportStar(require("./merit"), exports);
|
|
30
30
|
__exportStar(require("./merkl"), exports);
|
|
31
31
|
__exportStar(require("./savings"), exports);
|
|
32
|
+
__exportStar(require("./common"), exports);
|
|
33
|
+
__exportStar(require("./aaveV4"), exports);
|
package/cjs/types/liquityV2.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress, IncentiveData, NetworkNumber } from './common';
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
|
|
2
2
|
export declare enum LiquityV2Versions {
|
|
3
3
|
LiquityV2Eth = "liquityv2eth",
|
|
4
4
|
LiquityV2WstEth = "liquityv2wsteth",
|
|
@@ -88,7 +88,7 @@ export interface LiquityV2AggregatedTroveData {
|
|
|
88
88
|
netApy: string;
|
|
89
89
|
incentiveUsd: string;
|
|
90
90
|
totalInterestUsd: string;
|
|
91
|
-
leveragedType:
|
|
91
|
+
leveragedType: LeverageType;
|
|
92
92
|
leveragedAsset: string;
|
|
93
93
|
liquidationPrice: string;
|
|
94
94
|
ratio: string;
|
|
@@ -110,7 +110,7 @@ export interface LiquityV2TroveData {
|
|
|
110
110
|
totalInterestUsd: string;
|
|
111
111
|
interestBatchManager: EthAddress;
|
|
112
112
|
troveStatus: string;
|
|
113
|
-
leveragedType:
|
|
113
|
+
leveragedType: LeverageType;
|
|
114
114
|
leveragedAsset: string;
|
|
115
115
|
liquidationPrice: string;
|
|
116
116
|
debtInFront: string;
|
package/cjs/types/llamaLend.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress, IncentiveData, NetworkNumber } from './common';
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
|
|
2
2
|
import { BandData, UserBandData } from './curveUsd';
|
|
3
3
|
export declare enum LLVersionsEth {
|
|
4
4
|
LLWstethCrvusd = "llamaLendwstETHcrvUSD",
|
|
@@ -112,7 +112,7 @@ export interface LlamaLendAggregatedPositionData {
|
|
|
112
112
|
borrowLimitUsd: string;
|
|
113
113
|
minAllowedRatio: number;
|
|
114
114
|
collFactor: string;
|
|
115
|
-
leveragedType:
|
|
115
|
+
leveragedType: LeverageType;
|
|
116
116
|
leveragedAsset?: string;
|
|
117
117
|
liquidationPrice?: string;
|
|
118
118
|
netApy: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EthAddress, IncentiveData, MMUsedAssets, NetworkNumber } from './common';
|
|
1
|
+
import { EthAddress, IncentiveData, LeverageType, MMUsedAssets, NetworkNumber } from './common';
|
|
2
2
|
export declare enum MorphoBlueVersions {
|
|
3
3
|
MorphoBlueWstEthUSDC = "morphobluewstethusdc",// wstETH/USDC
|
|
4
4
|
MorphoBlueSDAIUSDC = "morphobluesdaiusdc",// sDAI/USDC
|
|
@@ -121,9 +121,9 @@ export interface MorphoBlueAggregatedPositionData {
|
|
|
121
121
|
totalInterestUsd: string;
|
|
122
122
|
ltv: string;
|
|
123
123
|
ratio: string;
|
|
124
|
-
leveragedType:
|
|
124
|
+
leveragedType: LeverageType;
|
|
125
125
|
leveragedAsset?: string;
|
|
126
|
-
|
|
126
|
+
currentVolatilePairRatio?: string;
|
|
127
127
|
liquidationPrice?: string;
|
|
128
128
|
minCollRatio?: string;
|
|
129
129
|
collLiquidationRatio?: string;
|
|
@@ -142,9 +142,9 @@ export interface MorphoBluePositionData {
|
|
|
142
142
|
totalInterestUsd: string;
|
|
143
143
|
ltv: string;
|
|
144
144
|
ratio: string;
|
|
145
|
-
leveragedType:
|
|
145
|
+
leveragedType: LeverageType;
|
|
146
146
|
leveragedAsset?: string;
|
|
147
|
-
|
|
147
|
+
currentVolatilePairRatio?: string;
|
|
148
148
|
liquidationPrice?: string;
|
|
149
149
|
supplyShares: string;
|
|
150
150
|
borrowShares: string;
|
package/cjs/types/portfolio.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AaveV2PositionData, AaveV3PositionData, AaveVersions } from './aave';
|
|
2
|
+
import { AaveV4AccountData, AaveV4SpokesType } from './aaveV4';
|
|
2
3
|
import { EthAddress } from './common';
|
|
3
4
|
import { CompoundV2PositionData, CompoundV3PositionData, CompoundVersions } from './compound';
|
|
4
5
|
import { CrvUSDUserData, CrvUSDVersions } from './curveUsd';
|
|
@@ -51,6 +52,9 @@ export interface PortfolioPositionsDataForAddress {
|
|
|
51
52
|
[key: string]: FluidVaultData;
|
|
52
53
|
};
|
|
53
54
|
};
|
|
55
|
+
aaveV4: {
|
|
56
|
+
[key in AaveV4SpokesType]?: PortfolioProtocolData<AaveV4AccountData>;
|
|
57
|
+
};
|
|
54
58
|
}
|
|
55
59
|
export interface PortfolioPositionsData {
|
|
56
60
|
[key: EthAddress]: PortfolioPositionsDataForAddress;
|
package/cjs/types/spark.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EModeCategoriesData } from './aave';
|
|
2
|
-
import { EthAddress, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
2
|
+
import { EthAddress, LeverageType, MMAssetData, MMPositionData, MMUsedAsset, NetworkNumber } from './common';
|
|
3
3
|
export declare enum SparkVersions {
|
|
4
4
|
SparkV1 = "v1default"
|
|
5
5
|
}
|
|
@@ -90,9 +90,9 @@ export interface SparkAggregatedPositionData {
|
|
|
90
90
|
totalInterestUsd: string;
|
|
91
91
|
liqRatio: string;
|
|
92
92
|
liqPercent: string;
|
|
93
|
-
leveragedType:
|
|
93
|
+
leveragedType: LeverageType;
|
|
94
94
|
leveragedAsset?: string;
|
|
95
|
-
|
|
95
|
+
currentVolatilePairRatio?: string;
|
|
96
96
|
liquidationPrice?: string;
|
|
97
97
|
minCollRatio: string;
|
|
98
98
|
collLiquidationRatio: string;
|
|
@@ -0,0 +1,7 @@
|
|
|
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>;
|