@defisaver/positions-sdk 2.1.71-aave-v4-2-dev → 2.1.72-gho-plasma-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/config/contracts.d.ts +0 -1535
- package/cjs/config/contracts.js +0 -9
- package/cjs/contracts.d.ts +0 -32401
- package/cjs/contracts.js +1 -2
- package/cjs/helpers/index.d.ts +0 -1
- package/cjs/helpers/index.js +1 -2
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +1 -3
- package/cjs/markets/aave/marketAssets.js +1 -1
- package/cjs/markets/index.d.ts +0 -1
- package/cjs/markets/index.js +1 -3
- package/cjs/portfolio/index.js +0 -20
- package/cjs/staking/eligibility.d.ts +6 -0
- package/cjs/staking/eligibility.js +37 -19
- package/cjs/types/common.d.ts +2 -1
- package/cjs/types/common.js +1 -0
- package/cjs/types/index.d.ts +0 -1
- package/cjs/types/index.js +0 -1
- package/cjs/types/portfolio.d.ts +0 -4
- package/esm/config/contracts.d.ts +0 -1535
- package/esm/config/contracts.js +0 -8
- package/esm/contracts.d.ts +0 -32401
- package/esm/contracts.js +0 -1
- package/esm/helpers/index.d.ts +0 -1
- package/esm/helpers/index.js +0 -1
- package/esm/index.d.ts +1 -2
- package/esm/index.js +1 -2
- package/esm/markets/aave/marketAssets.js +1 -1
- package/esm/markets/index.d.ts +0 -1
- package/esm/markets/index.js +0 -1
- package/esm/portfolio/index.js +1 -21
- package/esm/staking/eligibility.d.ts +6 -0
- package/esm/staking/eligibility.js +35 -18
- package/esm/types/common.d.ts +2 -1
- package/esm/types/common.js +1 -0
- package/esm/types/index.d.ts +0 -1
- package/esm/types/index.js +0 -1
- package/esm/types/portfolio.d.ts +0 -4
- package/package.json +2 -2
- package/src/config/contracts.ts +1 -9
- package/src/contracts.ts +1 -3
- package/src/helpers/index.ts +0 -1
- package/src/index.ts +0 -2
- package/src/markets/aave/marketAssets.ts +1 -1
- package/src/markets/index.ts +1 -6
- package/src/portfolio/index.ts +0 -20
- package/src/staking/eligibility.ts +69 -15
- package/src/types/common.ts +1 -0
- package/src/types/index.ts +1 -2
- package/src/types/portfolio.ts +0 -4
- package/cjs/aaveV4/index.d.ts +0 -7
- package/cjs/aaveV4/index.js +0 -174
- package/cjs/helpers/aaveV4Helpers/index.d.ts +0 -13
- package/cjs/helpers/aaveV4Helpers/index.js +0 -117
- package/cjs/markets/aaveV4/index.d.ts +0 -28
- package/cjs/markets/aaveV4/index.js +0 -140
- package/cjs/types/aaveV4.d.ts +0 -145
- package/cjs/types/aaveV4.js +0 -19
- package/esm/aaveV4/index.d.ts +0 -7
- package/esm/aaveV4/index.js +0 -165
- package/esm/helpers/aaveV4Helpers/index.d.ts +0 -13
- package/esm/helpers/aaveV4Helpers/index.js +0 -108
- package/esm/markets/aaveV4/index.d.ts +0 -28
- package/esm/markets/aaveV4/index.js +0 -122
- package/esm/types/aaveV4.d.ts +0 -145
- package/esm/types/aaveV4.js +0 -16
- package/src/aaveV4/index.ts +0 -176
- package/src/helpers/aaveV4Helpers/index.ts +0 -128
- package/src/markets/aaveV4/index.ts +0 -149
- package/src/types/aaveV4.ts +0 -161
package/esm/contracts.js
CHANGED
|
@@ -132,4 +132,3 @@ export const StkAAVEViem = createViemContractFromConfigFunc('StkAAVE');
|
|
|
132
132
|
export const YearnViewContractViem = createViemContractFromConfigFunc('YearnView');
|
|
133
133
|
export const MakerDsrContractViem = createViemContractFromConfigFunc('MakerDsr');
|
|
134
134
|
export const SkySavingsContractView = createViemContractFromConfigFunc('SkySavings');
|
|
135
|
-
export const AaveV4ViewContractViem = createViemContractFromConfigFunc('AaveV4View');
|
package/esm/helpers/index.d.ts
CHANGED
package/esm/helpers/index.js
CHANGED
package/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import './setup';
|
|
2
2
|
import * as fluid from './fluid';
|
|
3
|
-
import * as aaveV4 from './aaveV4';
|
|
4
3
|
import * as aaveV3 from './aaveV3';
|
|
5
4
|
import * as aaveV2 from './aaveV2';
|
|
6
5
|
import * as compoundV3 from './compoundV3';
|
|
@@ -22,4 +21,4 @@ import * as portfolio from './portfolio';
|
|
|
22
21
|
import * as claiming from './claiming';
|
|
23
22
|
import * as savings from './savings';
|
|
24
23
|
export * from './types';
|
|
25
|
-
export { aaveV2, aaveV3,
|
|
24
|
+
export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
package/esm/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import './setup';
|
|
2
2
|
import * as fluid from './fluid';
|
|
3
|
-
import * as aaveV4 from './aaveV4';
|
|
4
3
|
import * as aaveV3 from './aaveV3';
|
|
5
4
|
import * as aaveV2 from './aaveV2';
|
|
6
5
|
import * as compoundV3 from './compoundV3';
|
|
@@ -22,4 +21,4 @@ import * as portfolio from './portfolio';
|
|
|
22
21
|
import * as claiming from './claiming';
|
|
23
22
|
import * as savings from './savings';
|
|
24
23
|
export * from './types';
|
|
25
|
-
export { aaveV2, aaveV3,
|
|
24
|
+
export { aaveV2, aaveV3, compoundV2, compoundV3, spark, curveUsd, liquity, liquityV2, maker, exchange, staking, moneymarket, markets, helpers, morphoBlue, llamaLend, eulerV2, fluid, portfolio, claiming, savings, };
|
|
@@ -15,7 +15,7 @@ export const aaveV3AssetsDefaultMarketOpt = [
|
|
|
15
15
|
export const aaveV3AssetsDefaultMarketArb = ['DAI', 'LINK', 'USDC.e', 'WBTC', 'ETH', 'USDT', 'AAVE', 'EURS', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC', 'FRAX', 'ARB', 'weETH', 'GHO', 'ezETH', 'rsETH', 'tBTC'];
|
|
16
16
|
export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH', 'USDC', 'weETH', 'cbBTC', 'ezETH', 'GHO', 'wrsETH', 'LBTC', 'EURC', 'AAVE', 'tBTC', 'syrupUSDC'];
|
|
17
17
|
export const aaveV3AssetsDefaultMarketLinea = ['ETH', 'USDC', 'weETH', 'ezETH', 'USDT', 'wstETH', 'wrsETH', 'WBTC', 'mUSD'];
|
|
18
|
-
export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'XPL', 'PT USDe Apr', 'PT sUSDe Apr'];
|
|
18
|
+
export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'XPL', 'PT USDe Apr', 'PT sUSDe Apr', 'GHO'];
|
|
19
19
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
20
20
|
export const aaveV3AssetsDefaultMarket = {
|
|
21
21
|
[NetworkNumber.Eth]: aaveV3AssetsDefaultMarketEth,
|
package/esm/markets/index.d.ts
CHANGED
|
@@ -7,4 +7,3 @@ 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/esm/markets/index.js
CHANGED
|
@@ -7,4 +7,3 @@ 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/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,
|
|
12
|
+
import { AaveMarkets, 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,7 +34,6 @@ 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';
|
|
38
37
|
export function getPortfolioData(provider_1, network_1, defaultProvider_1, addresses_1) {
|
|
39
38
|
return __awaiter(this, arguments, void 0, function* (provider, network, defaultProvider, addresses, isSim = false) {
|
|
40
39
|
const isMainnet = network === NetworkNumber.Eth;
|
|
@@ -51,7 +50,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
51
50
|
const llamaLendMarkets = [NetworkNumber.Eth, NetworkNumber.Arb].includes(network) ? Object.values(LlamaLendMarkets(network)).filter((market) => market.chainIds.includes(network)) : [];
|
|
52
51
|
const liquityV2Markets = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)) : [];
|
|
53
52
|
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));
|
|
55
53
|
const args = [network, { batch: { multicall: { batchSize: isSim ? 500000 : 2500000 } } }];
|
|
56
54
|
const client = getViemProvider(provider, ...args);
|
|
57
55
|
const defaultClient = getViemProvider(defaultProvider, ...args);
|
|
@@ -66,7 +64,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
66
64
|
const crvUsdMarketsData = {};
|
|
67
65
|
const llamaLendMarketsData = {};
|
|
68
66
|
const liquityV2MarketsData = {};
|
|
69
|
-
const aaveV4SpokesData = {};
|
|
70
67
|
const markets = {
|
|
71
68
|
morphoMarketsData,
|
|
72
69
|
compoundV3MarketsData,
|
|
@@ -78,7 +75,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
78
75
|
crvUsdMarketsData,
|
|
79
76
|
llamaLendMarketsData,
|
|
80
77
|
liquityV2MarketsData,
|
|
81
|
-
aaveV4SpokesData,
|
|
82
78
|
};
|
|
83
79
|
const positions = {};
|
|
84
80
|
const stakingPositions = {};
|
|
@@ -87,7 +83,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
87
83
|
for (const address of allAddresses) {
|
|
88
84
|
positions[address.toLowerCase()] = {
|
|
89
85
|
aaveV3: {},
|
|
90
|
-
aaveV4: {},
|
|
91
86
|
morphoBlue: {},
|
|
92
87
|
compoundV3: {},
|
|
93
88
|
spark: {},
|
|
@@ -153,10 +148,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
153
148
|
const marketData = yield _getAaveV3MarketData(client, network, market);
|
|
154
149
|
aaveV3MarketsData[market.value] = marketData;
|
|
155
150
|
})),
|
|
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
|
-
})),
|
|
160
151
|
...aaveV2Markets.map((market) => __awaiter(this, void 0, void 0, function* () {
|
|
161
152
|
const marketData = yield _getAaveV2MarketsData(client, network, market);
|
|
162
153
|
aaveV2MarketsData[market.value] = marketData;
|
|
@@ -426,17 +417,6 @@ export function getPortfolioData(provider_1, network_1, defaultProvider_1, addre
|
|
|
426
417
|
positions[address.toLowerCase()].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
427
418
|
}
|
|
428
419
|
}))).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(),
|
|
440
420
|
...morphoMarkets.map((market) => addresses.map((address) => __awaiter(this, void 0, void 0, function* () {
|
|
441
421
|
try {
|
|
442
422
|
const [accDataPromise, earnDataPromise] = yield Promise.allSettled([
|
|
@@ -5,6 +5,12 @@ export declare const isEligibleForEthenaUSDeRewards: (usedAssets: MMUsedAssets,
|
|
|
5
5
|
isEligible: boolean;
|
|
6
6
|
eligibleUSDAmount: string;
|
|
7
7
|
};
|
|
8
|
+
export declare const isEligibleForEthenaGHORewards: (usedAssets: MMUsedAssets, { healthRatio }: {
|
|
9
|
+
healthRatio: string;
|
|
10
|
+
}) => {
|
|
11
|
+
isEligible: boolean;
|
|
12
|
+
eligibleUSDAmount: string;
|
|
13
|
+
};
|
|
8
14
|
export declare const isEligibleForAaveV3ArbitrumEthSupply: (usedAssets: MMUsedAssets) => {
|
|
9
15
|
isEligible: boolean;
|
|
10
16
|
eligibleUSDAmount: string;
|
|
@@ -1,29 +1,45 @@
|
|
|
1
1
|
import Dec from 'decimal.js';
|
|
2
2
|
import { IncentiveEligibilityId } from '../types/common';
|
|
3
|
-
|
|
4
|
-
var _a, _b;
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const anythingElseSupplied = Object.values(usedAssets).some((asset) => asset.
|
|
3
|
+
const isEligibleForEthenaPairRewards = (usedAssets, { healthRatio }, { baseSymbol, pairSymbol, allowedBorrowAssets, maxHealthRatio, rewardSymbol, requirePositiveBorrowSymbol, }) => {
|
|
4
|
+
var _a, _b, _c;
|
|
5
|
+
const baseSuppliedUsd = ((_a = usedAssets[baseSymbol]) === null || _a === void 0 ? void 0 : _a.suppliedUsd) || '0';
|
|
6
|
+
const pairSuppliedUsd = ((_b = usedAssets[pairSymbol]) === null || _b === void 0 ? void 0 : _b.suppliedUsd) || '0';
|
|
7
|
+
const anythingElseSupplied = Object.values(usedAssets).some((asset) => asset.isSupplied && asset.symbol !== baseSymbol && asset.symbol !== pairSymbol);
|
|
8
8
|
if (anythingElseSupplied)
|
|
9
9
|
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
10
|
-
const totalAmountSupplied = new Dec(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const totalAmountSupplied = new Dec(baseSuppliedUsd).add(pairSuppliedUsd);
|
|
11
|
+
if (totalAmountSupplied.eq(0))
|
|
12
|
+
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
13
|
+
const percentageInBase = new Dec(baseSuppliedUsd).div(totalAmountSupplied).toNumber();
|
|
14
|
+
if (percentageInBase < 0.45 || percentageInBase > 0.55)
|
|
15
|
+
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
16
|
+
const percentageInPair = new Dec(pairSuppliedUsd).div(totalAmountSupplied).toNumber();
|
|
17
|
+
if (percentageInPair < 0.45 || percentageInPair > 0.55)
|
|
18
|
+
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
18
19
|
const anythingBorrowedNotAllowed = Object.values(usedAssets).some((asset) => asset.isBorrowed && !allowedBorrowAssets.includes(asset.symbol));
|
|
19
20
|
if (anythingBorrowedNotAllowed)
|
|
20
21
|
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
21
|
-
if (new Dec(healthRatio).gte(
|
|
22
|
-
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
23
|
-
const halfAmountSupplied =
|
|
24
|
-
const
|
|
25
|
-
|
|
22
|
+
if (new Dec(healthRatio).gte(maxHealthRatio))
|
|
23
|
+
return { isEligible: false, eligibleUSDAmount: '0' };
|
|
24
|
+
const halfAmountSupplied = totalAmountSupplied.div(2);
|
|
25
|
+
const rewardSuppliedUsd = ((_c = usedAssets[rewardSymbol]) === null || _c === void 0 ? void 0 : _c.suppliedUsd) || '0';
|
|
26
|
+
const eligibleUSDAmount = Dec.min(rewardSuppliedUsd, halfAmountSupplied).toString();
|
|
27
|
+
return { isEligible: true, eligibleUSDAmount };
|
|
26
28
|
};
|
|
29
|
+
export const isEligibleForEthenaUSDeRewards = (usedAssets, { healthRatio }) => isEligibleForEthenaPairRewards(usedAssets, { healthRatio }, {
|
|
30
|
+
baseSymbol: 'USDe',
|
|
31
|
+
pairSymbol: 'sUSDe',
|
|
32
|
+
allowedBorrowAssets: ['USDC', 'USDT', 'USDS'],
|
|
33
|
+
maxHealthRatio: '2.5',
|
|
34
|
+
rewardSymbol: 'USDe',
|
|
35
|
+
});
|
|
36
|
+
export const isEligibleForEthenaGHORewards = (usedAssets, { healthRatio }) => isEligibleForEthenaPairRewards(usedAssets, { healthRatio }, {
|
|
37
|
+
baseSymbol: 'syrupUSDT',
|
|
38
|
+
pairSymbol: 'GHO',
|
|
39
|
+
allowedBorrowAssets: ['USDT'],
|
|
40
|
+
maxHealthRatio: '2',
|
|
41
|
+
rewardSymbol: 'GHO',
|
|
42
|
+
});
|
|
27
43
|
export const isEligibleForAaveV3ArbitrumEthSupply = (usedAssets) => {
|
|
28
44
|
var _a, _b;
|
|
29
45
|
const ETHAmountSupplied = ((_a = usedAssets.ETH) === null || _a === void 0 ? void 0 : _a.suppliedUsd) || '0';
|
|
@@ -49,4 +65,5 @@ export const EligibilityMapping = {
|
|
|
49
65
|
[IncentiveEligibilityId.AaveV3ArbitrumEthSupply]: isEligibleForAaveV3ArbitrumEthSupply,
|
|
50
66
|
[IncentiveEligibilityId.AaveV3ArbitrumETHLSBorrow]: isEligibleForAaveV3ArbitrumETHLSBorrow,
|
|
51
67
|
[IncentiveEligibilityId.AaveV3EthenaLiquidLeveragePlasma]: isEligibleForEthenaUSDeRewards,
|
|
68
|
+
[IncentiveEligibilityId.AaveV3EthenaLiquidLeveragePlasmaGHO]: isEligibleForEthenaGHORewards,
|
|
52
69
|
};
|
package/esm/types/common.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ export declare enum IncentiveEligibilityId {
|
|
|
6
6
|
AaveV3EthenaLiquidLeverage = "0x8014e0076e5393e62c49a7134070d8fccc922e46BORROW_BL",
|
|
7
7
|
AaveV3ArbitrumEthSupply = "0x5d16261c6715a653248269861bbacf68a9774cde",
|
|
8
8
|
AaveV3ArbitrumETHLSBorrow = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351",
|
|
9
|
-
AaveV3EthenaLiquidLeveragePlasma = "0xeefac321069fbecc9d6b2aed2948f6d5503d8633BORROW_BL"
|
|
9
|
+
AaveV3EthenaLiquidLeveragePlasma = "0xeefac321069fbecc9d6b2aed2948f6d5503d8633BORROW_BL",
|
|
10
|
+
AaveV3EthenaLiquidLeveragePlasmaGHO = "replace_when_known"
|
|
10
11
|
}
|
|
11
12
|
export declare enum LeverageType {
|
|
12
13
|
Long = "long",
|
package/esm/types/common.js
CHANGED
|
@@ -9,6 +9,7 @@ export var IncentiveEligibilityId;
|
|
|
9
9
|
IncentiveEligibilityId["AaveV3ArbitrumEthSupply"] = "0x5d16261c6715a653248269861bbacf68a9774cde";
|
|
10
10
|
IncentiveEligibilityId["AaveV3ArbitrumETHLSBorrow"] = "0x0c84331e39d6658Cd6e6b9ba04736cC4c4734351";
|
|
11
11
|
IncentiveEligibilityId["AaveV3EthenaLiquidLeveragePlasma"] = "0xeefac321069fbecc9d6b2aed2948f6d5503d8633BORROW_BL";
|
|
12
|
+
IncentiveEligibilityId["AaveV3EthenaLiquidLeveragePlasmaGHO"] = "replace_when_known";
|
|
12
13
|
})(IncentiveEligibilityId || (IncentiveEligibilityId = {}));
|
|
13
14
|
export var LeverageType;
|
|
14
15
|
(function (LeverageType) {
|
package/esm/types/index.d.ts
CHANGED
package/esm/types/index.js
CHANGED
package/esm/types/portfolio.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AaveV2PositionData, AaveV3PositionData, AaveVersions } from './aave';
|
|
2
|
-
import { AaveV4AccountData, AaveV4SpokesType } from './aaveV4';
|
|
3
2
|
import { EthAddress } from './common';
|
|
4
3
|
import { CompoundV2PositionData, CompoundV3PositionData, CompoundVersions } from './compound';
|
|
5
4
|
import { CrvUSDUserData, CrvUSDVersions } from './curveUsd';
|
|
@@ -52,9 +51,6 @@ export interface PortfolioPositionsDataForAddress {
|
|
|
52
51
|
[key: string]: FluidVaultData;
|
|
53
52
|
};
|
|
54
53
|
};
|
|
55
|
-
aaveV4: {
|
|
56
|
-
[key in AaveV4SpokesType]?: PortfolioProtocolData<AaveV4AccountData>;
|
|
57
|
-
};
|
|
58
54
|
}
|
|
59
55
|
export interface PortfolioPositionsData {
|
|
60
56
|
[key: EthAddress]: PortfolioPositionsDataForAddress;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/positions-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.72-gho-plasma-dev",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"author": "",
|
|
22
22
|
"license": "ISC",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@defisaver/tokens": "
|
|
24
|
+
"@defisaver/tokens": "1.7.26-gho-plasma-dev",
|
|
25
25
|
"@types/lodash": "^4.17.15",
|
|
26
26
|
"@types/memoizee": "^0.4.12",
|
|
27
27
|
"decimal.js": "^10.6.0",
|
package/src/config/contracts.ts
CHANGED
|
@@ -620,7 +620,7 @@ export const AaveLoanInfoV2 = {
|
|
|
620
620
|
"address": "0xEDf1087544a01596b70Da746F861B878F245B08f"
|
|
621
621
|
},
|
|
622
622
|
}
|
|
623
|
-
},
|
|
623
|
+
},
|
|
624
624
|
}
|
|
625
625
|
} as const;
|
|
626
626
|
export const LendingPoolAddressesProvider = {
|
|
@@ -1322,12 +1322,4 @@ export const SkySavings = {
|
|
|
1322
1322
|
} as const;
|
|
1323
1323
|
export const YearnV3Vault = {
|
|
1324
1324
|
"abi": [{"stateMutability":"view","type":"function","name":"balanceOf","inputs":[{"name":"addr","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalAssets","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalDebt","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalSupply","inputs":[],"outputs":[{"name":"","type":"uint256"}]}]
|
|
1325
|
-
} as const;
|
|
1326
|
-
export const AaveV4View = {
|
|
1327
|
-
"abi": [{"inputs":[{"internalType":"address","name":"_eoa","type":"address"},{"internalType":"address","name":"_proxy","type":"address"},{"internalType":"address","name":"_spoke","type":"address"}],"name":"getEOAApprovalsAndBalances","outputs":[{"components":[{"internalType":"address","name":"eoa","type":"address"},{"internalType":"address","name":"proxy","type":"address"},{"internalType":"address","name":"spoke","type":"address"},{"internalType":"bool","name":"giverPositionManagerEnabled","type":"bool"},{"internalType":"bool","name":"takerPositionManagerEnabled","type":"bool"},{"internalType":"bool","name":"configPositionManagerEnabled","type":"bool"},{"internalType":"bool","name":"canSetUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"canUpdateUserRiskPremium","type":"bool"},{"internalType":"bool","name":"canUpdateUserDynamicConfig","type":"bool"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"delegateeBorrowApproval","type":"uint256"},{"internalType":"uint256","name":"delegateeWithdrawApproval","type":"uint256"},{"internalType":"uint256","name":"eoaReserveBalance","type":"uint256"}],"internalType":"struct AaveV4View.EOAReserveApprovalData[]","name":"reserveApprovals","type":"tuple[]"}],"internalType":"struct AaveV4View.EOAApprovalData","name":"data","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getHealthFactor","outputs":[{"internalType":"uint256","name":"healthFactor","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_hub","type":"address"}],"name":"getHubAllAssetsData","outputs":[{"components":[{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"swept","type":"uint256"},{"internalType":"uint16","name":"liquidityFee","type":"uint16"},{"internalType":"uint120","name":"drawnIndex","type":"uint120"},{"internalType":"uint96","name":"drawnRate","type":"uint96"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"address","name":"irStrategy","type":"address"},{"internalType":"address","name":"reinvestmentController","type":"address"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint256","name":"deficitRay","type":"uint256"}],"internalType":"struct AaveV4View.HubAssetData[]","name":"hubAssetData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_hub","type":"address"},{"internalType":"uint256","name":"_assetId","type":"uint256"}],"name":"getHubAssetData","outputs":[{"components":[{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"swept","type":"uint256"},{"internalType":"uint16","name":"liquidityFee","type":"uint16"},{"internalType":"uint120","name":"drawnIndex","type":"uint120"},{"internalType":"uint96","name":"drawnRate","type":"uint96"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"address","name":"irStrategy","type":"address"},{"internalType":"address","name":"reinvestmentController","type":"address"},{"internalType":"address","name":"feeReceiver","type":"address"},{"internalType":"uint256","name":"deficitRay","type":"uint256"}],"internalType":"struct AaveV4View.HubAssetData","name":"hubAssetData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getLoanData","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"riskPremium","type":"uint256"},{"internalType":"uint256","name":"avgCollateralFactor","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"},{"internalType":"uint256","name":"totalCollateralInUsd","type":"uint256"},{"internalType":"uint256","name":"totalDebtInUsdRay","type":"uint256"},{"internalType":"uint256","name":"activeCollateralCount","type":"uint256"},{"internalType":"uint256","name":"borrowCount","type":"uint256"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"supplied","type":"uint256"},{"internalType":"uint256","name":"drawn","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"}],"internalType":"struct AaveV4View.UserReserveData[]","name":"reserves","type":"tuple[]"}],"internalType":"struct AaveV4View.LoanData","name":"loanData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address[]","name":"_spokes","type":"address[]"}],"name":"getLoanDataForMultipleSpokes","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"riskPremium","type":"uint256"},{"internalType":"uint256","name":"avgCollateralFactor","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"},{"internalType":"uint256","name":"totalCollateralInUsd","type":"uint256"},{"internalType":"uint256","name":"totalDebtInUsdRay","type":"uint256"},{"internalType":"uint256","name":"activeCollateralCount","type":"uint256"},{"internalType":"uint256","name":"borrowCount","type":"uint256"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"supplied","type":"uint256"},{"internalType":"uint256","name":"drawn","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"}],"internalType":"struct AaveV4View.UserReserveData[]","name":"reserves","type":"tuple[]"}],"internalType":"struct AaveV4View.LoanData[]","name":"loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"getLoanDataForMultipleUsers","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"riskPremium","type":"uint256"},{"internalType":"uint256","name":"avgCollateralFactor","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"},{"internalType":"uint256","name":"totalCollateralInUsd","type":"uint256"},{"internalType":"uint256","name":"totalDebtInUsdRay","type":"uint256"},{"internalType":"uint256","name":"activeCollateralCount","type":"uint256"},{"internalType":"uint256","name":"borrowCount","type":"uint256"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"supplied","type":"uint256"},{"internalType":"uint256","name":"drawn","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"}],"internalType":"struct AaveV4View.UserReserveData[]","name":"reserves","type":"tuple[]"}],"internalType":"struct AaveV4View.LoanData[]","name":"loans","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getLoanDataFull","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"riskPremium","type":"uint256"},{"internalType":"uint256","name":"avgCollateralFactor","type":"uint256"},{"internalType":"uint256","name":"healthFactor","type":"uint256"},{"internalType":"uint256","name":"totalCollateralInUsd","type":"uint256"},{"internalType":"uint256","name":"totalDebtInUsdRay","type":"uint256"},{"internalType":"uint256","name":"activeCollateralCount","type":"uint256"},{"internalType":"uint256","name":"borrowCount","type":"uint256"},{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"},{"internalType":"bool","name":"reservePaused","type":"bool"},{"internalType":"bool","name":"reserveFrozen","type":"bool"},{"internalType":"bool","name":"borrowable","type":"bool"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokeHalted","type":"bool"},{"internalType":"uint256","name":"userSupplied","type":"uint256"},{"internalType":"uint256","name":"userDrawn","type":"uint256"},{"internalType":"uint256","name":"userPremium","type":"uint256"},{"internalType":"uint256","name":"userTotalDebt","type":"uint256"},{"internalType":"uint24","name":"collateralRisk","type":"uint24"},{"internalType":"uint16","name":"userCollateralFactor","type":"uint16"},{"internalType":"uint32","name":"userMaxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"userLiquidationFee","type":"uint16"},{"internalType":"uint16","name":"latestCollateralFactor","type":"uint16"},{"internalType":"uint32","name":"latestMaxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"latestLiquidationFee","type":"uint16"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint16","name":"hubAssetId","type":"uint16"},{"internalType":"uint256","name":"hubLiquidity","type":"uint256"},{"internalType":"uint96","name":"drawnRate","type":"uint96"},{"internalType":"uint120","name":"drawnIndex","type":"uint120"},{"internalType":"uint256","name":"spokeTotalSupplied","type":"uint256"},{"internalType":"uint256","name":"spokeTotalDrawn","type":"uint256"},{"internalType":"uint256","name":"spokeTotalPremium","type":"uint256"},{"internalType":"uint256","name":"spokeTotalDebt","type":"uint256"},{"internalType":"uint256","name":"spokeSupplyCap","type":"uint256"},{"internalType":"uint256","name":"spokeBorrowCap","type":"uint256"},{"internalType":"uint256","name":"spokeDeficitRay","type":"uint256"}],"internalType":"struct AaveV4View.UserReserveDataFull[]","name":"reserves","type":"tuple[]"}],"internalType":"struct AaveV4View.LoanDataWithFullReserves","name":"loanData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256","name":"_reserveId","type":"uint256"}],"name":"getReserveData","outputs":[{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct AaveV4View.ReserveData","name":"reserveData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256","name":"_reserveId","type":"uint256"}],"name":"getReserveDataFull","outputs":[{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"frozen","type":"bool"},{"internalType":"bool","name":"borrowable","type":"bool"},{"internalType":"uint24","name":"collateralRisk","type":"uint24"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"deficitRay","type":"uint256"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokeHalted","type":"bool"}],"internalType":"struct AaveV4View.ReserveDataFull","name":"reserveData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256","name":"_reserveId","type":"uint256"}],"name":"getReservePrice","outputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256[]","name":"_reserveIds","type":"uint256[]"}],"name":"getReservePrices","outputs":[{"internalType":"uint256[]","name":"prices","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256[]","name":"_reserveIds","type":"uint256[]"}],"name":"getReservesData","outputs":[{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct AaveV4View.ReserveData[]","name":"reserveData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"uint256[]","name":"_reserveIds","type":"uint256[]"}],"name":"getReservesDataFull","outputs":[{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"frozen","type":"bool"},{"internalType":"bool","name":"borrowable","type":"bool"},{"internalType":"uint24","name":"collateralRisk","type":"uint24"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"deficitRay","type":"uint256"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokeHalted","type":"bool"}],"internalType":"struct AaveV4View.ReserveDataFull[]","name":"reserveData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"}],"name":"getSpokeData","outputs":[{"components":[{"internalType":"uint128","name":"targetHealthFactor","type":"uint128"},{"internalType":"uint64","name":"healthFactorForMaxBonus","type":"uint64"},{"internalType":"uint16","name":"liquidationBonusFactor","type":"uint16"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"uint256","name":"oracleDecimals","type":"uint256"},{"internalType":"uint256","name":"reserveCount","type":"uint256"}],"internalType":"struct AaveV4View.SpokeData","name":"spokeData","type":"tuple"},{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"}],"internalType":"struct AaveV4View.ReserveData[]","name":"reserves","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"}],"name":"getSpokeDataFull","outputs":[{"components":[{"internalType":"uint128","name":"targetHealthFactor","type":"uint128"},{"internalType":"uint64","name":"healthFactorForMaxBonus","type":"uint64"},{"internalType":"uint16","name":"liquidationBonusFactor","type":"uint16"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"uint256","name":"oracleDecimals","type":"uint256"},{"internalType":"uint256","name":"reserveCount","type":"uint256"}],"internalType":"struct AaveV4View.SpokeData","name":"spokeData","type":"tuple"},{"components":[{"internalType":"address","name":"underlying","type":"address"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"frozen","type":"bool"},{"internalType":"bool","name":"borrowable","type":"bool"},{"internalType":"uint24","name":"collateralRisk","type":"uint24"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"totalSupplied","type":"uint256"},{"internalType":"uint256","name":"totalDrawn","type":"uint256"},{"internalType":"uint256","name":"totalPremium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint256","name":"supplyCap","type":"uint256"},{"internalType":"uint256","name":"borrowCap","type":"uint256"},{"internalType":"uint256","name":"deficitRay","type":"uint256"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokeHalted","type":"bool"}],"internalType":"struct AaveV4View.ReserveDataFull[]","name":"reserves","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_hub","type":"address"},{"internalType":"uint256","name":"_assetId","type":"uint256"}],"name":"getSpokesForAsset","outputs":[{"internalType":"address[]","name":"spokes","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"}],"name":"getTokenizationSpokeData","outputs":[{"components":[{"internalType":"address","name":"underlyingAsset","type":"address"},{"internalType":"uint256","name":"assetId","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"spoke","type":"address"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokeHalted","type":"bool"},{"internalType":"uint256","name":"spokeDepositCap","type":"uint256"},{"internalType":"uint256","name":"spokeTotalAssets","type":"uint256"},{"internalType":"uint256","name":"spokeTotalShares","type":"uint256"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint256","name":"hubLiquidity","type":"uint256"},{"internalType":"uint96","name":"hubDrawnRate","type":"uint96"},{"internalType":"uint256","name":"convertToShares","type":"uint256"},{"internalType":"uint256","name":"convertToAssets","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"userSuppliedAssets","type":"uint256"},{"internalType":"uint256","name":"userSuppliedShares","type":"uint256"}],"internalType":"struct AaveV4View.TokenizationSpokeData","name":"spokeData","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_spokes","type":"address[]"},{"internalType":"address","name":"_user","type":"address"}],"name":"getTokenizationSpokesData","outputs":[{"components":[{"internalType":"address","name":"underlyingAsset","type":"address"},{"internalType":"uint256","name":"assetId","type":"uint256"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"spoke","type":"address"},{"internalType":"bool","name":"spokeActive","type":"bool"},{"internalType":"bool","name":"spokeHalted","type":"bool"},{"internalType":"uint256","name":"spokeDepositCap","type":"uint256"},{"internalType":"uint256","name":"spokeTotalAssets","type":"uint256"},{"internalType":"uint256","name":"spokeTotalShares","type":"uint256"},{"internalType":"address","name":"hub","type":"address"},{"internalType":"uint256","name":"hubLiquidity","type":"uint256"},{"internalType":"uint96","name":"hubDrawnRate","type":"uint96"},{"internalType":"uint256","name":"convertToShares","type":"uint256"},{"internalType":"uint256","name":"convertToAssets","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"userSuppliedAssets","type":"uint256"},{"internalType":"uint256","name":"userSuppliedShares","type":"uint256"}],"internalType":"struct AaveV4View.TokenizationSpokeData[]","name":"spokeData","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_spoke","type":"address"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256[]","name":"_reserveIds","type":"uint256[]"}],"name":"getUserReserveData","outputs":[{"components":[{"internalType":"uint256","name":"reserveId","type":"uint256"},{"internalType":"uint16","name":"assetId","type":"uint16"},{"internalType":"address","name":"underlying","type":"address"},{"internalType":"uint256","name":"supplied","type":"uint256"},{"internalType":"uint256","name":"drawn","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"totalDebt","type":"uint256"},{"internalType":"uint16","name":"collateralFactor","type":"uint16"},{"internalType":"uint32","name":"maxLiquidationBonus","type":"uint32"},{"internalType":"uint16","name":"liquidationFee","type":"uint16"},{"internalType":"bool","name":"isUsingAsCollateral","type":"bool"},{"internalType":"bool","name":"isBorrowing","type":"bool"}],"internalType":"struct AaveV4View.UserReserveData[]","name":"_userReserves","type":"tuple[]"}],"stateMutability":"view","type":"function"}],
|
|
1328
|
-
"networks": {
|
|
1329
|
-
"1": {
|
|
1330
|
-
"address": "0x10B748Dc504C2515Bb6A9e23CB2F686090b6c584",
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
1325
|
} as const;
|
package/src/contracts.ts
CHANGED
|
@@ -169,6 +169,4 @@ export const YearnViewContractViem = createViemContractFromConfigFunc('YearnView
|
|
|
169
169
|
|
|
170
170
|
export const MakerDsrContractViem = createViemContractFromConfigFunc('MakerDsr');
|
|
171
171
|
|
|
172
|
-
export const SkySavingsContractView = createViemContractFromConfigFunc('SkySavings');
|
|
173
|
-
|
|
174
|
-
export const AaveV4ViewContractViem = createViemContractFromConfigFunc('AaveV4View');
|
|
172
|
+
export const SkySavingsContractView = createViemContractFromConfigFunc('SkySavings');
|
package/src/helpers/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import './setup';
|
|
2
2
|
|
|
3
3
|
import * as fluid from './fluid';
|
|
4
|
-
import * as aaveV4 from './aaveV4';
|
|
5
4
|
import * as aaveV3 from './aaveV3';
|
|
6
5
|
import * as aaveV2 from './aaveV2';
|
|
7
6
|
import * as compoundV3 from './compoundV3';
|
|
@@ -28,7 +27,6 @@ export * from './types';
|
|
|
28
27
|
export {
|
|
29
28
|
aaveV2,
|
|
30
29
|
aaveV3,
|
|
31
|
-
aaveV4,
|
|
32
30
|
compoundV2,
|
|
33
31
|
compoundV3,
|
|
34
32
|
spark,
|
|
@@ -20,7 +20,7 @@ export const aaveV3AssetsDefaultMarketBase = ['ETH', 'cbETH', 'USDbC', 'wstETH',
|
|
|
20
20
|
|
|
21
21
|
export const aaveV3AssetsDefaultMarketLinea = ['ETH', 'USDC', 'weETH', 'ezETH', 'USDT', 'wstETH', 'wrsETH', 'WBTC', 'mUSD'];
|
|
22
22
|
|
|
23
|
-
export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'XPL', 'PT USDe Apr', 'PT sUSDe Apr'];
|
|
23
|
+
export const aaveV3AssetsDefaultMarketPlasma = ['ETH', 'USDT', 'sUSDe', 'USDe', 'weETH', 'XAUt', 'PT USDe Jan', 'PT sUSDe Jan', 'wrsETH', 'wstETH', 'syrupUSDT', 'XPL', 'PT USDe Apr', 'PT sUSDe Apr', 'GHO'];
|
|
24
24
|
|
|
25
25
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
26
26
|
export const aaveV3AssetsDefaultMarket = {
|
package/src/markets/index.ts
CHANGED
|
@@ -21,10 +21,5 @@ export { LlamaLendMarkets } from './llamaLend';
|
|
|
21
21
|
export { LiquityV2Markets, findLiquityV2MarketByAddress } from './liquityV2';
|
|
22
22
|
export { EulerV2Markets } from './euler';
|
|
23
23
|
export {
|
|
24
|
-
FluidMarkets,
|
|
25
|
-
getFluidVersionsDataForNetwork,
|
|
26
|
-
getFluidMarketInfoById,
|
|
27
|
-
getFTokenAddress,
|
|
28
|
-
getFluidMarketInfoByAddress,
|
|
24
|
+
FluidMarkets, getFluidVersionsDataForNetwork, getFluidMarketInfoById, getFTokenAddress, getFluidMarketInfoByAddress,
|
|
29
25
|
} from './fluid';
|
|
30
|
-
export { AaveV4Spokes } from './aaveV4';
|
package/src/portfolio/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ import Dec from 'decimal.js';
|
|
|
2
2
|
import { EthAddress, EthereumProvider, NetworkNumber } from '../types/common';
|
|
3
3
|
import {
|
|
4
4
|
AaveMarkets,
|
|
5
|
-
AaveV4Spokes,
|
|
6
5
|
CompoundMarkets,
|
|
7
6
|
CrvUsdMarkets,
|
|
8
7
|
EulerV2Markets,
|
|
@@ -15,7 +14,6 @@ import { _getMorphoBlueAccountData, _getMorphoBlueMarketData, getMorphoEarn } fr
|
|
|
15
14
|
import {
|
|
16
15
|
AaveV2MarketData,
|
|
17
16
|
AaveV3MarketData,
|
|
18
|
-
AaveV4SpokeData,
|
|
19
17
|
AaveVersions,
|
|
20
18
|
CdpInfo,
|
|
21
19
|
CompoundV2MarketsData,
|
|
@@ -51,7 +49,6 @@ import { fetchSparkAirdropRewards, fetchSparkRewards } from '../claiming/spark';
|
|
|
51
49
|
import { fetchMorphoBlueRewards } from '../claiming/morphoBlue';
|
|
52
50
|
import { getKingRewards } from '../claiming/king';
|
|
53
51
|
import { fetchEthenaAirdropRewards } from '../claiming/ethena';
|
|
54
|
-
import { _getAaveV4AccountData, _getAaveV4SpokeData } from '../aaveV4';
|
|
55
52
|
|
|
56
53
|
export async function getPortfolioData(provider: EthereumProvider, network: NetworkNumber, defaultProvider: EthereumProvider, addresses: EthAddress[], isSim = false): Promise<{
|
|
57
54
|
positions: PortfolioPositionsData;
|
|
@@ -74,7 +71,6 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
74
71
|
const llamaLendMarkets = [NetworkNumber.Eth, NetworkNumber.Arb].includes(network) ? Object.values(LlamaLendMarkets(network)).filter((market) => market.chainIds.includes(network)) : [];
|
|
75
72
|
const liquityV2Markets = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)) : [];
|
|
76
73
|
const liquityV2MarketsStaking = [NetworkNumber.Eth].includes(network) ? Object.values(LiquityV2Markets(network)).filter(market => !market.isLegacy) : [];
|
|
77
|
-
const aaveV4Spokes = Object.values(AaveV4Spokes(network)).filter((market) => market.chainIds.includes(network));
|
|
78
74
|
|
|
79
75
|
const args: [NetworkNumber, any?] = [network, { batch: { multicall: { batchSize: isSim ? 500_000 : 2_500_000 } } }];
|
|
80
76
|
const client = getViemProvider(provider, ...args);
|
|
@@ -91,7 +87,6 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
91
87
|
const crvUsdMarketsData: Record<string, CrvUSDGlobalMarketData> = {};
|
|
92
88
|
const llamaLendMarketsData: Record<string, LlamaLendGlobalMarketData> = {};
|
|
93
89
|
const liquityV2MarketsData: Record<string, LiquityV2MarketData> = {};
|
|
94
|
-
const aaveV4SpokesData: Record<string, AaveV4SpokeData> = {};
|
|
95
90
|
|
|
96
91
|
const markets = {
|
|
97
92
|
morphoMarketsData,
|
|
@@ -104,7 +99,6 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
104
99
|
crvUsdMarketsData,
|
|
105
100
|
llamaLendMarketsData,
|
|
106
101
|
liquityV2MarketsData,
|
|
107
|
-
aaveV4SpokesData,
|
|
108
102
|
};
|
|
109
103
|
|
|
110
104
|
const positions: PortfolioPositionsData = {};
|
|
@@ -115,7 +109,6 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
115
109
|
for (const address of allAddresses) {
|
|
116
110
|
positions[address.toLowerCase() as EthAddress] = {
|
|
117
111
|
aaveV3: {},
|
|
118
|
-
aaveV4: {},
|
|
119
112
|
morphoBlue: {},
|
|
120
113
|
compoundV3: {},
|
|
121
114
|
spark: {},
|
|
@@ -184,10 +177,6 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
184
177
|
const marketData = await _getAaveV3MarketData(client, network, market);
|
|
185
178
|
aaveV3MarketsData[market.value] = marketData;
|
|
186
179
|
}),
|
|
187
|
-
...aaveV4Spokes.map(async (spoke) => {
|
|
188
|
-
const spokeData = await _getAaveV4SpokeData(client, network, spoke);
|
|
189
|
-
aaveV4SpokesData[spoke.value] = spokeData;
|
|
190
|
-
}),
|
|
191
180
|
...aaveV2Markets.map(async (market) => {
|
|
192
181
|
const marketData = await _getAaveV2MarketsData(client, network, market);
|
|
193
182
|
aaveV2MarketsData[market.value] = marketData;
|
|
@@ -440,15 +429,6 @@ export async function getPortfolioData(provider: EthereumProvider, network: Netw
|
|
|
440
429
|
positions[address.toLowerCase() as EthAddress].aaveV3[market.value] = { error: `Error fetching AaveV3 account data for address ${address} on market ${market.value}`, data: null };
|
|
441
430
|
}
|
|
442
431
|
})).flat(),
|
|
443
|
-
...aaveV4Spokes.map((spoke) => allAddresses.map(async (address) => {
|
|
444
|
-
try {
|
|
445
|
-
const accData = await _getAaveV4AccountData(client, network, aaveV4SpokesData[spoke.value], address);
|
|
446
|
-
if (new Dec(accData.suppliedUsd).gt(0)) positions[address.toLowerCase() as EthAddress].aaveV4[spoke.value] = { error: '', data: accData };
|
|
447
|
-
} catch (error) {
|
|
448
|
-
console.error(`Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}:`, error);
|
|
449
|
-
positions[address.toLowerCase() as EthAddress].aaveV4[spoke.value] = { error: `Error fetching AaveV4 account data for address ${address} on spoke ${spoke.value}`, data: null };
|
|
450
|
-
}
|
|
451
|
-
})).flat(),
|
|
452
432
|
...morphoMarkets.map((market) => addresses.map(async (address) => {
|
|
453
433
|
try {
|
|
454
434
|
const [accDataPromise, earnDataPromise] = await Promise.allSettled([
|