@defisaver/positions-sdk 2.1.78-aave-v4-dev → 2.1.79

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.
Files changed (65) hide show
  1. package/cjs/claiming/spark.js +1 -1
  2. package/cjs/config/contracts.d.ts +0 -1551
  3. package/cjs/config/contracts.js +0 -9
  4. package/cjs/contracts.d.ts +0 -32741
  5. package/cjs/contracts.js +1 -2
  6. package/cjs/helpers/index.d.ts +0 -1
  7. package/cjs/helpers/index.js +1 -2
  8. package/cjs/index.d.ts +1 -2
  9. package/cjs/index.js +1 -3
  10. package/cjs/markets/index.d.ts +0 -1
  11. package/cjs/markets/index.js +1 -3
  12. package/cjs/portfolio/index.js +0 -20
  13. package/cjs/types/index.d.ts +0 -1
  14. package/cjs/types/index.js +0 -1
  15. package/cjs/types/portfolio.d.ts +0 -4
  16. package/esm/claiming/spark.js +1 -1
  17. package/esm/config/contracts.d.ts +0 -1551
  18. package/esm/config/contracts.js +0 -8
  19. package/esm/contracts.d.ts +0 -32741
  20. package/esm/contracts.js +0 -1
  21. package/esm/helpers/index.d.ts +0 -1
  22. package/esm/helpers/index.js +0 -1
  23. package/esm/index.d.ts +1 -2
  24. package/esm/index.js +1 -2
  25. package/esm/markets/index.d.ts +0 -1
  26. package/esm/markets/index.js +0 -1
  27. package/esm/portfolio/index.js +1 -21
  28. package/esm/types/index.d.ts +0 -1
  29. package/esm/types/index.js +0 -1
  30. package/esm/types/portfolio.d.ts +0 -4
  31. package/package.json +2 -2
  32. package/src/claiming/spark.ts +1 -1
  33. package/src/config/contracts.ts +0 -8
  34. package/src/contracts.ts +0 -2
  35. package/src/helpers/index.ts +0 -1
  36. package/src/index.ts +0 -2
  37. package/src/markets/index.ts +1 -6
  38. package/src/portfolio/index.ts +0 -20
  39. package/src/types/index.ts +1 -2
  40. package/src/types/portfolio.ts +0 -4
  41. package/cjs/aaveV4/index.d.ts +0 -7
  42. package/cjs/aaveV4/index.js +0 -298
  43. package/cjs/aaveV4/lend.d.ts +0 -45
  44. package/cjs/aaveV4/lend.js +0 -141
  45. package/cjs/helpers/aaveV4Helpers/index.d.ts +0 -12
  46. package/cjs/helpers/aaveV4Helpers/index.js +0 -117
  47. package/cjs/markets/aaveV4/index.d.ts +0 -28
  48. package/cjs/markets/aaveV4/index.js +0 -140
  49. package/cjs/types/aaveV4.d.ts +0 -153
  50. package/cjs/types/aaveV4.js +0 -19
  51. package/esm/aaveV4/index.d.ts +0 -7
  52. package/esm/aaveV4/index.js +0 -255
  53. package/esm/aaveV4/lend.d.ts +0 -45
  54. package/esm/aaveV4/lend.js +0 -134
  55. package/esm/helpers/aaveV4Helpers/index.d.ts +0 -12
  56. package/esm/helpers/aaveV4Helpers/index.js +0 -108
  57. package/esm/markets/aaveV4/index.d.ts +0 -28
  58. package/esm/markets/aaveV4/index.js +0 -122
  59. package/esm/types/aaveV4.d.ts +0 -153
  60. package/esm/types/aaveV4.js +0 -16
  61. package/src/aaveV4/index.ts +0 -291
  62. package/src/aaveV4/lend.ts +0 -180
  63. package/src/helpers/aaveV4Helpers/index.ts +0 -133
  64. package/src/markets/aaveV4/index.ts +0 -149
  65. package/src/types/aaveV4.ts +0 -169
@@ -1,134 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { assetAmountInEth, getAssetInfoByAddress } from '@defisaver/tokens';
11
- import { AaveV4ViewContractViem } from '../contracts';
12
- import { getViemProvider } from '../services/viem';
13
- import { wethToEth } from '../services/utils';
14
- import { NetworkNumber, } from '../types/common';
15
- export const AAVE_V4_TOKENIZED_SPOKES = {
16
- AAVE_CORE: '0x08309234884cF7E015b07Bf22569017Aa035cdeF',
17
- EURC_CORE: '0x73596dED4B2Eb0aC85e477b3c8dB56FC427E6774',
18
- GHO_CORE: '0xf7E1f1b43922527e5054bD77E7f863Cf182b194D',
19
- GHO_PRIME: '0xeF1cAd5c6a2C9cb83c952b4B96bbD35b3F61F18f',
20
- LBTC_CORE: '0x8f4D423590F22833131e3493bf67A27213398f8e',
21
- LINK_CORE: '0xBE1197750b423e30137E97d9183065d33E903BE6',
22
- PT_USDe_PLUS: '0x8cA27Ab284F2aA2BcF33D9129e11c101aD2d16de',
23
- PT_sUSDe_PLUS: '0xb8A464EC56071a98c854f30fE19CfeCc41FA6233',
24
- PYUSD_CORE: '0x203FB463087005698d50768FcA837047f738632d',
25
- RLUSD_CORE: '0xa9afdd0c54fb153CaE39cE86E49626B5e9d15513',
26
- USDC_CORE: '0xa2e476f4cbB06C7bFA8Ad51bCcbF198cd32CfD35',
27
- USDC_PLUS: '0x320Bec4fB7a25e64c003A007D0AeF7AB3D6C30d7',
28
- USDC_PRIME: '0x0A0507F7A1129892b5cf74b8B4e911442c466b87',
29
- USDG_CORE: '0x87c224256f09a014C1BC3e9FbB094C3AdD8fBaCC',
30
- USDT_CORE: '0x3f12BD5999b9172550893FF52691c980676f9E73',
31
- USDT_PLUS: '0xa4E74a78bED2d3ab8971e8AB26fb39f26DD8eEd9',
32
- USDT_PRIME: '0xF565fB55bc96d65561887898bfeb25C1dE7e06d2',
33
- USDe_PLUS: '0xA0d346ab2699B689AC67aba5174164A84206BB73',
34
- WBTC_CORE: '0x837Ab872A665e0CF467d41cF56a054031b4A38bc',
35
- WBTC_PRIME: '0xeae98b8a1798738182B2123DF1eB93d97BD29F34',
36
- WETH_CORE: '0x3961a75099E986F59a1a31c6f945061641dFD2b2',
37
- WETH_PRIME: '0xa411826a6ef5d289c0FAa7d5B45FE8aAB52257F6',
38
- XAUt_CORE: '0x470341bC0e2B833C54D0120642713BdF762A494F',
39
- cbBTC_CORE: '0xe8D5E595d5b6b5EFf84B7064765fd0e8DfD214C9',
40
- cbBTC_PRIME: '0x0E986545150DcDDe46Ea9df355D0fD2af33bd75D',
41
- frxUSD_CORE: '0x00C8A6a42947Cc4E7B6f27963Cab0143ccaaD2B5',
42
- frxUSD_PLUS: '0xCAB288d37CAb5a9db7b503F086455276Dcde61F1',
43
- rsETH_CORE: '0x6eEce89caE2163584bA7Ff9743861B9633c245E0',
44
- sUSDe_PLUS: '0xdf47fc43c88B06edC47753b7d647ff18037D2F3d',
45
- weETH_CORE: '0xB67F20bFF413C8E5d633B54BD28899c4c9e33ed0',
46
- wstETH_CORE: '0x474602394d0B02F43AC3D7C8c5cFc0814b03fd40',
47
- wstETH_PRIME: '0xAcCdAb49ECB9A801CfF62a92fc80D52339b33770',
48
- };
49
- export const AAVE_V4_TOKENIZED_SPOKE_ADDRESSES = {
50
- [NetworkNumber.Eth]: Object.values(AAVE_V4_TOKENIZED_SPOKES),
51
- };
52
- export const aaveV4GetTokenizedHubKey = (hubNameOrKey) => {
53
- if (!hubNameOrKey)
54
- return null;
55
- const normalized = hubNameOrKey.trim().toUpperCase();
56
- // TODO AaveV4 Maybe turn into constants
57
- if (normalized === 'CORE' || normalized === 'CORE HUB')
58
- return 'CORE';
59
- if (normalized === 'PLUS' || normalized === 'PLUS HUB')
60
- return 'PLUS';
61
- if (normalized === 'PRIME' || normalized === 'PRIME HUB')
62
- return 'PRIME';
63
- if (normalized.includes('CORE'))
64
- return 'CORE';
65
- if (normalized.includes('PLUS'))
66
- return 'PLUS';
67
- if (normalized.includes('PRIME'))
68
- return 'PRIME';
69
- return null;
70
- };
71
- export const aaveV4GetTokenizedVaultKey = (symbol, hubNameOrKey) => {
72
- if (!symbol)
73
- return null;
74
- const hubKey = aaveV4GetTokenizedHubKey(hubNameOrKey);
75
- if (!hubKey)
76
- return null;
77
- const normalizedSymbol = symbol.trim().replace(/-/g, '_');
78
- return `${normalizedSymbol}_${hubKey}`;
79
- };
80
- export const aaveV4GetTokenizedVaultAddress = (network, symbol, hubNameOrKey) => {
81
- if (network !== NetworkNumber.Eth)
82
- return undefined;
83
- const key = aaveV4GetTokenizedVaultKey(symbol, hubNameOrKey);
84
- if (!key)
85
- return undefined;
86
- return AAVE_V4_TOKENIZED_SPOKES[key];
87
- };
88
- const AAVE_V4_TOKENIZED_SPOKE_ADDRESS_TO_KEY = Object.entries(AAVE_V4_TOKENIZED_SPOKES).reduce((acc, [k, v]) => {
89
- acc[v.toLowerCase()] = k;
90
- return acc;
91
- }, {});
92
- /**
93
- * Fetches tokenization vault data for the given user via getTokenizationSpokesData.
94
- * Returns parsed data including userSuppliedAssets in human-readable form for each vault.
95
- */
96
- export function getAaveV4TokenizationSpokesData(provider, network, userAddress) {
97
- return __awaiter(this, void 0, void 0, function* () {
98
- var _a;
99
- const spokes = (_a = AAVE_V4_TOKENIZED_SPOKE_ADDRESSES[network]) !== null && _a !== void 0 ? _a : [];
100
- if (spokes.length === 0)
101
- return [];
102
- const client = getViemProvider(provider, network);
103
- const viewContract = AaveV4ViewContractViem(client, network);
104
- const raw = yield viewContract.read.getTokenizationSpokesData([spokes, userAddress]);
105
- return raw.map((r, i) => {
106
- var _a, _b, _c, _d, _e;
107
- const vaultAddress = spokes[i];
108
- const key = (_a = AAVE_V4_TOKENIZED_SPOKE_ADDRESS_TO_KEY[vaultAddress.toLowerCase()]) !== null && _a !== void 0 ? _a : null;
109
- const symbol = wethToEth(getAssetInfoByAddress(r.underlyingAsset, network).symbol);
110
- if (symbol === '?') { // unsupported asset
111
- return null;
112
- }
113
- const hubKey = key ? (_b = key.split('_').pop()) !== null && _b !== void 0 ? _b : '' : '';
114
- const decimals = Number((_c = r.decimals) !== null && _c !== void 0 ? _c : 18);
115
- const userSuppliedAssetsRaw = (_d = r.userSuppliedAssets) !== null && _d !== void 0 ? _d : 0;
116
- const userSuppliedSharesRaw = (_e = r.userSuppliedShares) !== null && _e !== void 0 ? _e : 0;
117
- const userSuppliedAssetsEth = assetAmountInEth(userSuppliedAssetsRaw.toString(), symbol);
118
- const userSuppliedSharesEth = assetAmountInEth(userSuppliedSharesRaw.toString(), symbol);
119
- return {
120
- vaultAddress,
121
- key,
122
- symbol,
123
- hubKey,
124
- userSuppliedAssetsEth,
125
- userSuppliedSharesEth,
126
- userSuppliedAssets: userSuppliedAssetsRaw.toString(),
127
- userSuppliedShares: userSuppliedSharesRaw.toString(),
128
- underlyingAsset: r.underlyingAsset,
129
- spoke: r.spoke,
130
- decimals,
131
- };
132
- }).filter(item => item != null);
133
- });
134
- }
@@ -1,12 +0,0 @@
1
- import { AaveV4AggregatedPositionData, AaveV4AssetsData, AaveV4ReserveAssetData, AaveV4UsedReserveAsset, AaveV4UsedReserveAssets, LeverageType, NetworkNumber } from '../../types';
2
- export declare const aaveV4GetCollateralFactor: (assetData: AaveV4ReserveAssetData, usedAssetData: AaveV4UsedReserveAsset, useUserCollateralFactor?: boolean) => number;
3
- export declare const isLeveragedPosAaveV4: (usedAssets: AaveV4UsedReserveAssets, dustLimit?: number) => {
4
- leveragedType: LeverageType;
5
- leveragedAsset: string;
6
- };
7
- export declare const aaveV4GetAggregatedPositionData: ({ usedAssets, assetsData, network, useUserCollateralFactor, }: {
8
- usedAssets: AaveV4UsedReserveAssets;
9
- assetsData: AaveV4AssetsData;
10
- network: NetworkNumber;
11
- useUserCollateralFactor?: boolean;
12
- }) => AaveV4AggregatedPositionData;
@@ -1,108 +0,0 @@
1
- import Dec from 'decimal.js';
2
- import { calcLeverageLiqPrice, getAssetsTotal, STABLE_ASSETS } from '../../moneymarket';
3
- import { LeverageType, } from '../../types';
4
- export const aaveV4GetCollateralFactor = (assetData, usedAssetData, useUserCollateralFactor = false) => (useUserCollateralFactor ? usedAssetData.collateralFactor : assetData.collateralFactor);
5
- export const isLeveragedPosAaveV4 = (usedAssets, dustLimit = 5) => {
6
- let borrowUnstable = 0;
7
- let supplyStable = 0;
8
- let borrowStable = 0;
9
- let supplyUnstable = 0;
10
- let longAsset = '';
11
- let shortAsset = '';
12
- Object.values(usedAssets).forEach(({ symbol, suppliedUsd, borrowedUsd, collateral, reserveId, }) => {
13
- const spokeAsset = `${symbol}-${reserveId}`;
14
- const isSupplied = (+suppliedUsd) > dustLimit; // ignore dust like <limit leftover supply
15
- const isBorrowed = (+borrowedUsd) > dustLimit; // ignore dust like <limit leftover supply
16
- if (isSupplied && STABLE_ASSETS.includes(symbol) && collateral)
17
- supplyStable += 1;
18
- if (isBorrowed && STABLE_ASSETS.includes(symbol))
19
- borrowStable += 1;
20
- if (isBorrowed && !STABLE_ASSETS.includes(symbol)) {
21
- borrowUnstable += 1;
22
- shortAsset = spokeAsset;
23
- }
24
- if (isSupplied && !STABLE_ASSETS.includes(symbol) && collateral) {
25
- supplyUnstable += 1;
26
- longAsset = spokeAsset;
27
- }
28
- });
29
- const isLong = borrowStable > 0 && borrowUnstable === 0 && supplyUnstable === 1 && supplyStable === 0;
30
- const isShort = supplyStable > 0 && supplyUnstable === 0 && borrowUnstable === 1 && borrowStable === 0;
31
- const isVolatilePair = supplyUnstable === 1 && borrowUnstable === 1 && supplyStable === 0 && borrowStable === 0;
32
- if (isLong) {
33
- return {
34
- leveragedType: LeverageType.Long,
35
- leveragedAsset: longAsset,
36
- };
37
- }
38
- if (isShort) {
39
- return {
40
- leveragedType: LeverageType.Short,
41
- leveragedAsset: shortAsset,
42
- };
43
- }
44
- if (isVolatilePair) {
45
- return {
46
- leveragedType: LeverageType.VolatilePair,
47
- leveragedAsset: longAsset,
48
- };
49
- }
50
- return {
51
- leveragedType: LeverageType.None,
52
- leveragedAsset: '',
53
- };
54
- };
55
- export const aaveV4GetAggregatedPositionData = ({ usedAssets, assetsData, network, useUserCollateralFactor = false, }) => {
56
- const payload = {};
57
- payload.suppliedUsd = getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd);
58
- payload.suppliedCollateralUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ suppliedUsd }) => suppliedUsd);
59
- payload.borrowLimitUsd = getAssetsTotal(usedAssets, ({ isSupplied, collateral }) => isSupplied && collateral, ({ symbol, suppliedUsd, reserveId }) => new Dec(suppliedUsd).mul(aaveV4GetCollateralFactor(assetsData[`${symbol}-${reserveId}`], usedAssets[`${symbol}-${reserveId}`], useUserCollateralFactor)));
60
- payload.liquidationLimitUsd = payload.borrowLimitUsd;
61
- payload.borrowedUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd);
62
- payload.drawnUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ drawnUsd }) => drawnUsd);
63
- payload.premiumUsd = getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ premiumUsd }) => premiumUsd);
64
- const leftToBorrowUsd = new Dec(payload.borrowLimitUsd).sub(payload.borrowedUsd);
65
- payload.leftToBorrowUsd = leftToBorrowUsd.lte('0') ? '0' : leftToBorrowUsd.toString();
66
- payload.ratio = +payload.suppliedUsd ? new Dec(payload.borrowLimitUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
67
- payload.collRatio = +payload.suppliedUsd ? new Dec(payload.suppliedCollateralUsd).div(payload.borrowedUsd).mul(100).toString() : '0';
68
- payload.liqRatio = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).toString();
69
- payload.liqPercent = new Dec(payload.borrowLimitUsd).div(payload.liquidationLimitUsd).mul(100).toString();
70
- const { leveragedType, leveragedAsset } = isLeveragedPosAaveV4(usedAssets);
71
- payload.leveragedType = leveragedType;
72
- payload.leveragedAsset = leveragedAsset;
73
- payload.liquidationPrice = '';
74
- if (leveragedType !== '') {
75
- const leveragedAssetData = assetsData[leveragedAsset];
76
- let assetPrice = (leveragedAssetData === null || leveragedAssetData === void 0 ? void 0 : leveragedAssetData.price) || '0';
77
- if (leveragedType === LeverageType.VolatilePair) {
78
- const borrowedAsset = Object.values(usedAssets).find(({ borrowedUsd }) => +borrowedUsd > 0);
79
- const borrowedAssetPrice = assetsData[`${borrowedAsset.symbol}-${borrowedAsset.reserveId}`].price;
80
- const leveragedAssetPrice = assetsData[leveragedAsset].price;
81
- const isReverse = new Dec(leveragedAssetPrice).lt(borrowedAssetPrice);
82
- if (isReverse) {
83
- payload.leveragedType = LeverageType.VolatilePairReverse;
84
- payload.currentVolatilePairRatio = new Dec(borrowedAssetPrice).div(leveragedAssetPrice).toDP(18).toString();
85
- assetPrice = new Dec(borrowedAssetPrice).div(assetPrice).toString();
86
- }
87
- else {
88
- assetPrice = new Dec(assetPrice).div(borrowedAssetPrice).toString();
89
- payload.currentVolatilePairRatio = new Dec(leveragedAssetPrice).div(borrowedAssetPrice).toDP(18).toString();
90
- }
91
- }
92
- payload.liquidationPrice = calcLeverageLiqPrice(payload.leveragedType, assetPrice, payload.borrowedUsd, payload.liquidationLimitUsd);
93
- }
94
- payload.minCollRatio = new Dec(payload.suppliedCollateralUsd).div(payload.borrowLimitUsd).mul(100).toString();
95
- payload.collLiquidationRatio = new Dec(payload.suppliedCollateralUsd).div(payload.liquidationLimitUsd).mul(100).toString();
96
- // payload.healthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowedUsd).toDP(4).toString();
97
- payload.minHealthRatio = new Dec(payload.liquidationLimitUsd).div(payload.borrowLimitUsd).toDP(4).toString();
98
- // TODO: Re-implement netApy calculation
99
- // const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({
100
- // usedAssets,
101
- // assetsData,
102
- // optionalData: { healthRatio: payload.healthRatio },
103
- // });
104
- payload.netApy = '0';
105
- payload.incentiveUsd = '0';
106
- payload.totalInterestUsd = '0';
107
- return payload;
108
- };
@@ -1,28 +0,0 @@
1
- import { AaveV4HubInfo, AaveV4HubsType, AaveV4SpokeInfo, AaveV4SpokesType, NetworkNumber } from '../../types';
2
- export declare const AAVE_V4_CORE_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
3
- export declare const AAVE_V4_PLUS_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
4
- export declare const AAVE_V4_PRIME_HUB: (networkId: NetworkNumber) => AaveV4HubInfo;
5
- export declare const AaveV4Hubs: (networkId: NetworkNumber) => {
6
- readonly aave_v4_core_hub: AaveV4HubInfo;
7
- readonly aave_v4_plus_hub: AaveV4HubInfo;
8
- readonly aave_v4_prime_hub: AaveV4HubInfo;
9
- };
10
- export declare const getAaveV4HubTypeInfo: (type: AaveV4HubsType, network?: NetworkNumber) => AaveV4HubInfo;
11
- export declare const getAaveV4HubByAddress: (networkId: NetworkNumber, address: string) => AaveV4HubInfo | undefined;
12
- export declare const AAVE_V4_BLUECHIP_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
13
- export declare const AAVE_V4_ETHENA_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
14
- export declare const AAVE_V4_ETHERFI_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
15
- export declare const AAVE_V4_GOLD_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
16
- export declare const AAVE_V4_KELP_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
17
- export declare const AAVE_V4_LIDO_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
18
- export declare const AAVE_V4_MAIN_SPOKE: (networkId: NetworkNumber) => AaveV4SpokeInfo;
19
- export declare const AaveV4Spokes: (networkId: NetworkNumber) => {
20
- readonly aave_v4_bluechip_spoke: AaveV4SpokeInfo;
21
- readonly aave_v4_ethena_spoke: AaveV4SpokeInfo;
22
- readonly aave_v4_etherfi_spoke: AaveV4SpokeInfo;
23
- readonly aave_v4_gold_spoke: AaveV4SpokeInfo;
24
- readonly aave_v4_kelp_spoke: AaveV4SpokeInfo;
25
- readonly aave_v4_lido_spoke: AaveV4SpokeInfo;
26
- readonly aave_v4_main_spoke: AaveV4SpokeInfo;
27
- };
28
- export declare const getAaveV4SpokeTypeInfo: (type: AaveV4SpokesType, network?: NetworkNumber) => AaveV4SpokeInfo;
@@ -1,122 +0,0 @@
1
- import { AaveV4HubsType, AaveV4SpokesType, NetworkNumber, } from '../../types';
2
- // HUBS
3
- export const AAVE_V4_CORE_HUB = (networkId) => ({
4
- chainIds: [NetworkNumber.Eth],
5
- label: 'Core Hub',
6
- value: AaveV4HubsType.AaveV4CoreHub,
7
- address: '0x3Ed2C9829FBCab6015E331a0352F8ae148217D70',
8
- });
9
- export const AAVE_V4_PLUS_HUB = (networkId) => ({
10
- chainIds: [NetworkNumber.Eth],
11
- label: 'Plus Hub',
12
- value: AaveV4HubsType.AaveV4PlusHub,
13
- address: '0xcb8C80026248f92c6DE735264c23c8e22922C562',
14
- });
15
- export const AAVE_V4_PRIME_HUB = (networkId) => ({
16
- chainIds: [NetworkNumber.Eth],
17
- label: 'Prime Hub',
18
- value: AaveV4HubsType.AaveV4PrimeHub,
19
- address: '0xea40581231Ca775e6A3d7c129cF231D292B85f20',
20
- });
21
- export const AaveV4Hubs = (networkId) => ({
22
- [AaveV4HubsType.AaveV4CoreHub]: AAVE_V4_CORE_HUB(networkId),
23
- [AaveV4HubsType.AaveV4PlusHub]: AAVE_V4_PLUS_HUB(networkId),
24
- [AaveV4HubsType.AaveV4PrimeHub]: AAVE_V4_PRIME_HUB(networkId),
25
- });
26
- export const getAaveV4HubTypeInfo = (type, network) => (Object.assign({}, AaveV4Hubs(network !== null && network !== void 0 ? network : NetworkNumber.Eth))[type]);
27
- export const getAaveV4HubByAddress = (networkId, address) => Object.values(AaveV4Hubs(networkId)).find(hub => hub.address.toLowerCase() === address.toLowerCase());
28
- // SPOKES
29
- export const AAVE_V4_BLUECHIP_SPOKE = (networkId) => ({
30
- chainIds: [NetworkNumber.Eth],
31
- label: 'Bluechip Spoke',
32
- value: AaveV4SpokesType.AaveV4BluechipSpoke,
33
- url: 'bluechip',
34
- address: '0x637F9E189332a2821e5B046E2d7EEFae2405d6c5',
35
- hubs: [
36
- AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
37
- AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
38
- AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
39
- ],
40
- });
41
- export const AAVE_V4_ETHENA_SPOKE = (networkId) => ({
42
- chainIds: [NetworkNumber.Eth],
43
- label: 'Ethena Spoke',
44
- value: AaveV4SpokesType.AaveV4EthenaSpoke,
45
- url: 'ethena',
46
- address: '0xf3b207c235f6154120F41eB63D5ACCBAfD4086D1',
47
- hubs: [
48
- AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
49
- AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
50
- AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
51
- ],
52
- });
53
- export const AAVE_V4_ETHERFI_SPOKE = (networkId) => ({
54
- chainIds: [NetworkNumber.Eth],
55
- label: 'Etherfi Spoke',
56
- value: AaveV4SpokesType.AaveV4EtherfiSpoke,
57
- url: 'etherfi',
58
- address: '0x4054a9EbfcdB692599a8dF61eb0b3484F2d279D4',
59
- hubs: [
60
- AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
61
- AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
62
- AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
63
- ],
64
- });
65
- export const AAVE_V4_GOLD_SPOKE = (networkId) => ({
66
- chainIds: [NetworkNumber.Eth],
67
- label: 'Gold Spoke',
68
- value: AaveV4SpokesType.AaveV4GoldSpoke,
69
- url: 'gold',
70
- address: '0x0DC7ccE912Afab8B49031A0A95DB74531741C2c4',
71
- hubs: [
72
- AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
73
- AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
74
- AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
75
- ],
76
- });
77
- export const AAVE_V4_KELP_SPOKE = (networkId) => ({
78
- chainIds: [NetworkNumber.Eth],
79
- label: 'Kelp Spoke',
80
- value: AaveV4SpokesType.AaveV4KelpSpoke,
81
- url: 'kelp',
82
- address: '0x8aC76d950a3D03F9E1d857b5AAFFdA3f86C1e9AA',
83
- hubs: [
84
- AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
85
- AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
86
- AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
87
- ],
88
- });
89
- export const AAVE_V4_LIDO_SPOKE = (networkId) => ({
90
- chainIds: [NetworkNumber.Eth],
91
- label: 'Lido Spoke',
92
- value: AaveV4SpokesType.AaveV4LidoSpoke,
93
- url: 'lido',
94
- address: '0x4D4a7b3Ce709b4362D7095a4A0105bDFDb5dA2a7',
95
- hubs: [
96
- AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
97
- AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
98
- AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
99
- ],
100
- });
101
- export const AAVE_V4_MAIN_SPOKE = (networkId) => ({
102
- chainIds: [NetworkNumber.Eth],
103
- label: 'Main Spoke',
104
- value: AaveV4SpokesType.AaveV4MainSpoke,
105
- url: 'main',
106
- address: '0x46539e9123A18c427e6b4DFF114c28CF405Cb023',
107
- hubs: [
108
- AAVE_V4_CORE_HUB(NetworkNumber.Eth).address,
109
- AAVE_V4_PLUS_HUB(NetworkNumber.Eth).address,
110
- AAVE_V4_PRIME_HUB(NetworkNumber.Eth).address,
111
- ],
112
- });
113
- export const AaveV4Spokes = (networkId) => ({
114
- [AaveV4SpokesType.AaveV4BluechipSpoke]: AAVE_V4_BLUECHIP_SPOKE(networkId),
115
- [AaveV4SpokesType.AaveV4EthenaSpoke]: AAVE_V4_ETHENA_SPOKE(networkId),
116
- [AaveV4SpokesType.AaveV4EtherfiSpoke]: AAVE_V4_ETHERFI_SPOKE(networkId),
117
- [AaveV4SpokesType.AaveV4GoldSpoke]: AAVE_V4_GOLD_SPOKE(networkId),
118
- [AaveV4SpokesType.AaveV4KelpSpoke]: AAVE_V4_KELP_SPOKE(networkId),
119
- [AaveV4SpokesType.AaveV4LidoSpoke]: AAVE_V4_LIDO_SPOKE(networkId),
120
- [AaveV4SpokesType.AaveV4MainSpoke]: AAVE_V4_MAIN_SPOKE(networkId),
121
- });
122
- export const getAaveV4SpokeTypeInfo = (type, network) => (Object.assign({}, AaveV4Spokes(network !== null && network !== void 0 ? network : NetworkNumber.Eth))[type]);
@@ -1,153 +0,0 @@
1
- import { EthAddress, IncentiveData, LeverageType, NetworkNumber } from './common';
2
- export declare enum AaveV4HubsType {
3
- AaveV4CoreHub = "aave_v4_core_hub",
4
- AaveV4PlusHub = "aave_v4_plus_hub",
5
- AaveV4PrimeHub = "aave_v4_prime_hub"
6
- }
7
- export declare enum AaveV4SpokesType {
8
- AaveV4BluechipSpoke = "aave_v4_bluechip_spoke",
9
- AaveV4EthenaSpoke = "aave_v4_ethena_spoke",
10
- AaveV4EtherfiSpoke = "aave_v4_etherfi_spoke",
11
- AaveV4GoldSpoke = "aave_v4_gold_spoke",
12
- AaveV4KelpSpoke = "aave_v4_kelp_spoke",
13
- AaveV4LidoSpoke = "aave_v4_lido_spoke",
14
- AaveV4MainSpoke = "aave_v4_main_spoke"
15
- }
16
- export interface AaveV4HubInfo {
17
- chainIds: NetworkNumber[];
18
- label: string;
19
- value: AaveV4HubsType;
20
- address: EthAddress;
21
- }
22
- export interface AaveV4HubAssetOnChainData {
23
- assetId: number;
24
- drawnRate: bigint;
25
- liquidity: bigint;
26
- liquidityFee: number;
27
- swept: bigint;
28
- totalDrawn: bigint;
29
- totalDrawnShares: bigint;
30
- totalPremiumShares: bigint;
31
- }
32
- export interface AaveV4HubOnChainData {
33
- assets: Record<number, AaveV4HubAssetOnChainData>;
34
- }
35
- export interface AaveV4SpokeInfo {
36
- chainIds: NetworkNumber[];
37
- label: string;
38
- value: AaveV4SpokesType;
39
- url: string;
40
- address: EthAddress;
41
- hubs: EthAddress[];
42
- }
43
- export interface AaveV4SpokeData {
44
- assetsData: AaveV4AssetsData;
45
- oracle: EthAddress;
46
- oracleDecimals: number;
47
- address: EthAddress;
48
- }
49
- export interface AaveV4ReserveAssetOnChain {
50
- underlying: EthAddress;
51
- hub: EthAddress;
52
- assetId: number;
53
- decimals: number;
54
- paused: boolean;
55
- frozen: boolean;
56
- borrowable: boolean;
57
- collateralRisk: number;
58
- collateralFactor: number;
59
- maxLiquidationBonus: number;
60
- liquidationFee: number;
61
- price: bigint;
62
- totalSupplied: bigint;
63
- totalDrawn: bigint;
64
- totalPremium: bigint;
65
- totalDebt: bigint;
66
- supplyCap: bigint;
67
- borrowCap: bigint;
68
- deficitRay: bigint;
69
- spokeActive: boolean;
70
- spokeHalted: boolean;
71
- }
72
- export interface AaveV4ReserveAssetData {
73
- symbol: string;
74
- underlying: EthAddress;
75
- hub: EthAddress;
76
- hubName: string;
77
- assetId: number;
78
- reserveId: number;
79
- paused: boolean;
80
- frozen: boolean;
81
- borrowable: boolean;
82
- collateralRisk: number;
83
- collateralFactor: number;
84
- liquidationFee: number;
85
- price: string;
86
- totalSupplied: string;
87
- totalDrawn: string;
88
- totalPremium: string;
89
- totalDebt: string;
90
- supplyCap: string;
91
- borrowCap: string;
92
- spokeActive: boolean;
93
- spokeHalted: boolean;
94
- drawnRate: string;
95
- supplyRate: string;
96
- borrowRate: string;
97
- supplyIncentives: IncentiveData[];
98
- borrowIncentives: IncentiveData[];
99
- canBeBorrowed: boolean;
100
- canBeSupplied: boolean;
101
- canBeWithdrawn: boolean;
102
- canBePayBacked: boolean;
103
- utilization: string;
104
- }
105
- export type AaveV4AssetsData = Record<string, AaveV4ReserveAssetData>;
106
- export interface AaveV4UsedReserveAsset {
107
- symbol: string;
108
- hubName: string;
109
- assetId: number;
110
- reserveId: number;
111
- supplied: string;
112
- suppliedUsd: string;
113
- drawn: string;
114
- drawnUsd: string;
115
- premium: string;
116
- premiumUsd: string;
117
- borrowed: string;
118
- borrowedUsd: string;
119
- isSupplied: boolean;
120
- isBorrowed: boolean;
121
- collateral: boolean;
122
- collateralFactor: number;
123
- }
124
- export interface AaveV4AggregatedPositionData {
125
- suppliedUsd: string;
126
- suppliedCollateralUsd: string;
127
- borrowLimitUsd: string;
128
- liquidationLimitUsd: string;
129
- borrowedUsd: string;
130
- drawnUsd: string;
131
- premiumUsd: string;
132
- leftToBorrowUsd: string;
133
- ratio: string;
134
- collRatio: string;
135
- liqRatio: string;
136
- liqPercent: string;
137
- leveragedType: LeverageType;
138
- leveragedAsset: string;
139
- liquidationPrice: string;
140
- minCollRatio: string;
141
- collLiquidationRatio: string;
142
- minHealthRatio: string;
143
- netApy: string;
144
- incentiveUsd: string;
145
- totalInterestUsd: string;
146
- currentVolatilePairRatio?: string;
147
- }
148
- export type AaveV4UsedReserveAssets = Record<string, AaveV4UsedReserveAsset>;
149
- export interface AaveV4AccountData extends AaveV4AggregatedPositionData {
150
- usedAssets: AaveV4UsedReserveAssets;
151
- healthFactor: string;
152
- riskPremiumBps: number;
153
- }
@@ -1,16 +0,0 @@
1
- export var AaveV4HubsType;
2
- (function (AaveV4HubsType) {
3
- AaveV4HubsType["AaveV4CoreHub"] = "aave_v4_core_hub";
4
- AaveV4HubsType["AaveV4PlusHub"] = "aave_v4_plus_hub";
5
- AaveV4HubsType["AaveV4PrimeHub"] = "aave_v4_prime_hub";
6
- })(AaveV4HubsType || (AaveV4HubsType = {}));
7
- export var AaveV4SpokesType;
8
- (function (AaveV4SpokesType) {
9
- AaveV4SpokesType["AaveV4BluechipSpoke"] = "aave_v4_bluechip_spoke";
10
- AaveV4SpokesType["AaveV4EthenaSpoke"] = "aave_v4_ethena_spoke";
11
- AaveV4SpokesType["AaveV4EtherfiSpoke"] = "aave_v4_etherfi_spoke";
12
- AaveV4SpokesType["AaveV4GoldSpoke"] = "aave_v4_gold_spoke";
13
- AaveV4SpokesType["AaveV4KelpSpoke"] = "aave_v4_kelp_spoke";
14
- AaveV4SpokesType["AaveV4LidoSpoke"] = "aave_v4_lido_spoke";
15
- AaveV4SpokesType["AaveV4MainSpoke"] = "aave_v4_main_spoke";
16
- })(AaveV4SpokesType || (AaveV4SpokesType = {}));