@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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Dec from 'decimal.js';
|
|
2
2
|
import { BLOCKS_IN_A_YEAR } from '../constants';
|
|
3
|
+
import { LeverageType } from '../types/common';
|
|
3
4
|
export const getAssetsTotal = (assets, filter, transform) => Object.values(assets)
|
|
4
5
|
.filter(filter)
|
|
5
6
|
.map(transform)
|
|
@@ -8,9 +9,9 @@ export const getAssetsTotal = (assets, filter, transform) => Object.values(asset
|
|
|
8
9
|
export const calcLongLiqPrice = (assetPrice, borrowedUsd, borrowLimitUsd) => new Dec(assetPrice).mul(borrowedUsd).div(borrowLimitUsd).toString();
|
|
9
10
|
export const calcShortLiqPrice = (assetPrice, borrowedUsd, borrowLimitUsd) => new Dec(assetPrice).div(borrowedUsd).mul(borrowLimitUsd).toString();
|
|
10
11
|
export const calcLeverageLiqPrice = (leverageType, assetPrice, borrowedUsd, borrowLimitUsd) => {
|
|
11
|
-
if (leverageType ===
|
|
12
|
+
if (leverageType === LeverageType.Short || leverageType === LeverageType.VolatilePairReverse)
|
|
12
13
|
return calcShortLiqPrice(assetPrice, borrowedUsd, borrowLimitUsd);
|
|
13
|
-
if (leverageType ===
|
|
14
|
+
if (leverageType === LeverageType.Long || leverageType === LeverageType.VolatilePair)
|
|
14
15
|
return calcLongLiqPrice(assetPrice, borrowedUsd, borrowLimitUsd);
|
|
15
16
|
console.error('invalid leverageType', leverageType);
|
|
16
17
|
return '0';
|
|
@@ -47,28 +48,27 @@ export const isLeveragedPos = (usedAssets, dustLimit = 5) => {
|
|
|
47
48
|
});
|
|
48
49
|
const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
|
|
49
50
|
const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
|
|
50
|
-
|
|
51
|
-
const isLsdLeveraged = supplyUnstable === 1 && borrowUnstable === 1 && shortAsset === 'ETH' && ['stETH', 'wstETH', 'cbETH', 'rETH', 'ezETH', 'weETH'].includes(longAsset);
|
|
51
|
+
const isVolatilePair = supplyUnstable === 1 && borrowUnstable === 1 && supplyStable === 0 && borrowStable === 0;
|
|
52
52
|
if (isLong) {
|
|
53
53
|
return {
|
|
54
|
-
leveragedType:
|
|
54
|
+
leveragedType: LeverageType.Long,
|
|
55
55
|
leveragedAsset: longAsset,
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
if (isShort) {
|
|
59
59
|
return {
|
|
60
|
-
leveragedType:
|
|
60
|
+
leveragedType: LeverageType.Short,
|
|
61
61
|
leveragedAsset: shortAsset,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
64
|
+
if (isVolatilePair) {
|
|
65
65
|
return {
|
|
66
|
-
leveragedType:
|
|
66
|
+
leveragedType: LeverageType.VolatilePair,
|
|
67
67
|
leveragedAsset: longAsset,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
return {
|
|
71
|
-
leveragedType:
|
|
71
|
+
leveragedType: LeverageType.None,
|
|
72
72
|
leveragedAsset: '',
|
|
73
73
|
};
|
|
74
74
|
};
|
package/esm/portfolio/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
11
|
import { NetworkNumber } from '../types/common';
|
|
12
|
-
import { AaveMarkets, CompoundMarkets, CrvUsdMarkets, EulerV2Markets, LiquityV2Markets, LlamaLendMarkets, MorphoBlueMarkets, SparkMarkets, } from '../markets';
|
|
12
|
+
import { AaveMarkets, AaveV4Spokes, CompoundMarkets, CrvUsdMarkets, EulerV2Markets, LiquityV2Markets, LlamaLendMarkets, MorphoBlueMarkets, SparkMarkets, } from '../markets';
|
|
13
13
|
import { _getMorphoBlueAccountData, _getMorphoBlueMarketData, getMorphoEarn } from '../morphoBlue';
|
|
14
14
|
import { AaveVersions, CompoundVersions, } from '../types';
|
|
15
15
|
import { _getCompoundV3AccountData, _getCompoundV3MarketsData } from '../compoundV3';
|
|
@@ -34,6 +34,7 @@ import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
|
|
|
34
34
|
import { fetchMorphoBlueRewards } from '../claiming/morphoBlue';
|
|
35
35
|
import { getKingRewards } from '../claiming/king';
|
|
36
36
|
import { fetchEthenaAirdropRewards } from '../claiming/ethena';
|
|
37
|
+
import { _getAaveV4AccountData, _getAaveV4SpokeData } from '../aaveV4';
|
|
37
38
|
export function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1) {
|
|
38
39
|
return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
|
|
39
40
|
const isMainnet = network === NetworkNumber.Eth;
|
|
@@ -50,6 +51,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
50
51
|
const llamaLendMarkets = [NetworkNumber.Eth, NetworkNumber.Arb].includes(network) ? Object.values(LlamaLendMarkets(network)).filter((market) => market.chainIds.includes(network)) : [];
|
|
51
52
|
const liquityV2Markets = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)) : [];
|
|
52
53
|
const liquityV2MarketsStaking = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)).filter(market => !market.isLegacy) : [];
|
|
54
|
+
const aaveV4Spokes = Object.values(AaveV4Spokes(network)).filter((market) => market.chainIds.includes(network));
|
|
53
55
|
const args = [network, { batch: { multicall: { batchSize: isSim ? 500000 : 2500000 } } }];
|
|
54
56
|
const client = getViemProvider(provider, ...args);
|
|
55
57
|
const defaultClient = getViemProvider(defaultProvider, ...args);
|
|
@@ -64,6 +66,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
64
66
|
const crvUsdMarketsData = {};
|
|
65
67
|
const llamaLendMarketsData = {};
|
|
66
68
|
const liquityV2MarketsData = {};
|
|
69
|
+
const aaveV4SpokesData = {};
|
|
67
70
|
const markets = {
|
|
68
71
|
morphoMarketsData,
|
|
69
72
|
compoundV3MarketsData,
|
|
@@ -75,6 +78,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
75
78
|
crvUsdMarketsData,
|
|
76
79
|
llamaLendMarketsData,
|
|
77
80
|
liquityV2MarketsData,
|
|
81
|
+
aaveV4SpokesData,
|
|
78
82
|
};
|
|
79
83
|
const positions = {};
|
|
80
84
|
const stakingPositions = {};
|
|
@@ -83,6 +87,7 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
83
87
|
for (const address of allAddresses) {
|
|
84
88
|
positions[address.toLowerCase()] = {
|
|
85
89
|
aaveV3: {},
|
|
90
|
+
aaveV4: {},
|
|
86
91
|
morphoBlue: {},
|
|
87
92
|
compoundV3: {},
|
|
88
93
|
spark: {},
|
|
@@ -148,6 +153,10 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
148
153
|
const marketData = yield _getAaveV3MarketData(client, network, market);
|
|
149
154
|
aaveV3MarketsData[market.value] = marketData;
|
|
150
155
|
})),
|
|
156
|
+
...aaveV4Spokes.map((spoke) => __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
const spokeData = yield _getAaveV4SpokeData(client, network, spoke);
|
|
158
|
+
aaveV4SpokesData[spoke.value] = spokeData;
|
|
159
|
+
})),
|
|
151
160
|
...aaveV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
152
161
|
const marketData = yield _getAaveV2MarketsData(client, network, market);
|
|
153
162
|
aaveV2MarketsData[market.value] = marketData;
|
|
@@ -417,6 +426,17 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
417
426
|
positions[address.toLowerCase()].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
418
427
|
}
|
|
419
428
|
}))).flat(),
|
|
429
|
+
...aaveV4Spokes.map((spoke) => allAddresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
430
|
+
try {
|
|
431
|
+
const accData = yield _getAaveV4AccountData(client, network, aaveV4SpokesData[spoke.value], address);
|
|
432
|
+
if (new Dec(accData.suppliedUsd).gt(0))
|
|
433
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: '', data: accData };
|
|
434
|
+
}
|
|
435
|
+
catch (error) {
|
|
436
|
+
console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
|
|
437
|
+
positions[address.toLowerCase()].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
|
|
438
|
+
}
|
|
439
|
+
}))).flat(),
|
|
420
440
|
...morphoMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
421
441
|
try {
|
|
422
442
|
const [accDataPromise, earnDataPromise] = yield Promise.allSettled([
|
package/esm/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,10 @@
|
|
|
1
|
+
export var AaveV4SpokesType;
|
|
2
|
+
(function (AaveV4SpokesType) {
|
|
3
|
+
AaveV4SpokesType["AaveV4CoreSpoke"] = "aave_v4_core_spoke";
|
|
4
|
+
AaveV4SpokesType["AaveV4YieldSeekingSpoke"] = "aave_v4_yield_seeking_spoke";
|
|
5
|
+
})(AaveV4SpokesType || (AaveV4SpokesType = {}));
|
|
6
|
+
export var AaveV4HubsType;
|
|
7
|
+
(function (AaveV4HubsType) {
|
|
8
|
+
AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
|
|
9
|
+
AaveV4HubsType["AaveV4YieldSeekingHub"] = "aave_v4_yield_seeking_hub";
|
|
10
|
+
})(AaveV4HubsType || (AaveV4HubsType = {}));
|
package/esm/types/common.d.ts
CHANGED
|
@@ -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/esm/types/common.js
CHANGED
|
@@ -5,11 +5,19 @@ export var IncentiveKind;
|
|
|
5
5
|
})(IncentiveKind || (IncentiveKind = {}));
|
|
6
6
|
export var IncentiveEligibilityId;
|
|
7
7
|
(function (IncentiveEligibilityId) {
|
|
8
|
-
IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "
|
|
8
|
+
IncentiveEligibilityId["AaveV3EthenaLiquidLeverage"] = "0x8014e0076e5393e62c49a7134070d8fccc922e46BORROW_BL";
|
|
9
9
|
IncentiveEligibilityId["AaveV3ArbitrumEthSupply"] = "0x5d16261c6715a653248269861bbacf68a9774cde";
|
|
10
10
|
IncentiveEligibilityId["AaveV3ArbitrumETHLSBorrow"] = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351";
|
|
11
11
|
IncentiveEligibilityId["AaveV3EthenaLiquidLeveragePlasma"] = "0x67264783f1e9a2af8627a235853057a6fc975bd2BORROW_BL";
|
|
12
12
|
})(IncentiveEligibilityId || (IncentiveEligibilityId = {}));
|
|
13
|
+
export var LeverageType;
|
|
14
|
+
(function (LeverageType) {
|
|
15
|
+
LeverageType["Long"] = "long";
|
|
16
|
+
LeverageType["Short"] = "short";
|
|
17
|
+
LeverageType["VolatilePair"] = "volatile-pair";
|
|
18
|
+
LeverageType["VolatilePairReverse"] = "volatile-pair-reverse";
|
|
19
|
+
LeverageType["None"] = "";
|
|
20
|
+
})(LeverageType || (LeverageType = {}));
|
|
13
21
|
export var NetworkNumber;
|
|
14
22
|
(function (NetworkNumber) {
|
|
15
23
|
NetworkNumber[NetworkNumber["Eth"] = 1] = "Eth";
|
package/esm/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/esm/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/esm/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/esm/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/esm/types/fluid.js
CHANGED
package/esm/types/index.d.ts
CHANGED
package/esm/types/index.js
CHANGED
package/esm/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/esm/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/esm/types/portfolio.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AaveV2PositionData, AaveV3PositionData, AaveVersions } from './aave';
|
|
2
|
+
import { AaveV4AccountData, AaveV4SpokesType } from './aaveV4';
|
|
2
3
|
import { EthAddress } from './common';
|
|
3
4
|
import { CompoundV2PositionData, CompoundV3PositionData, CompoundVersions } from './compound';
|
|
4
5
|
import { CrvUSDUserData, CrvUSDVersions } from './curveUsd';
|
|
@@ -51,6 +52,9 @@ export interface PortfolioPositionsDataForAddress {
|
|
|
51
52
|
[key: string]: FluidVaultData;
|
|
52
53
|
};
|
|
53
54
|
};
|
|
55
|
+
aaveV4: {
|
|
56
|
+
[key in AaveV4SpokesType]?: PortfolioProtocolData<AaveV4AccountData>;
|
|
57
|
+
};
|
|
54
58
|
}
|
|
55
59
|
export interface PortfolioPositionsData {
|
|
56
60
|
[key: EthAddress]: PortfolioPositionsDataForAddress;
|
package/esm/types/spark.d.ts
CHANGED
|
@@ -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;
|