@defisaver/positions-sdk 1.0.10 → 1.0.11-fluid-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/.mocharc.json +4 -4
- package/.nvmrc +1 -1
- package/README.md +69 -69
- package/cjs/config/contracts.d.ts +113 -49
- package/cjs/config/contracts.js +10 -2
- package/cjs/contracts.d.ts +1 -0
- package/cjs/contracts.js +2 -1
- package/cjs/fluid/index.d.ts +2 -0
- package/cjs/fluid/index.js +636 -13
- package/cjs/helpers/fluidHelpers/index.d.ts +59 -2
- package/cjs/helpers/fluidHelpers/index.js +142 -4
- package/cjs/helpers/morphoBlueHelpers/index.js +66 -66
- package/cjs/markets/aave/marketAssets.js +3 -1
- package/cjs/markets/fluid/index.js +276 -245
- package/cjs/services/priceService.d.ts +23 -0
- package/cjs/services/priceService.js +44 -5
- package/cjs/types/contracts/generated/FluidView.d.ts +220 -3
- package/cjs/types/contracts/generated/WeETHPriceFeed.d.ts +135 -0
- package/cjs/types/contracts/generated/WeETHPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +1 -0
- package/cjs/types/fluid.d.ts +39 -10
- package/esm/config/contracts.d.ts +113 -49
- package/esm/config/contracts.js +10 -2
- package/esm/contracts.d.ts +1 -0
- package/esm/contracts.js +1 -0
- package/esm/fluid/index.d.ts +2 -0
- package/esm/fluid/index.js +639 -16
- package/esm/helpers/fluidHelpers/index.d.ts +59 -2
- package/esm/helpers/fluidHelpers/index.js +137 -3
- package/esm/helpers/morphoBlueHelpers/index.js +66 -66
- package/esm/markets/aave/marketAssets.js +3 -1
- package/esm/markets/fluid/index.js +276 -245
- package/esm/services/priceService.d.ts +23 -0
- package/esm/services/priceService.js +40 -5
- package/esm/types/contracts/generated/FluidView.d.ts +220 -3
- package/esm/types/contracts/generated/WeETHPriceFeed.d.ts +135 -0
- package/esm/types/contracts/generated/WeETHPriceFeed.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +1 -0
- package/esm/types/fluid.d.ts +39 -10
- package/package.json +54 -54
- package/src/aaveV2/index.ts +227 -227
- package/src/aaveV3/index.ts +624 -624
- package/src/assets/index.ts +60 -60
- package/src/chickenBonds/index.ts +123 -123
- package/src/compoundV2/index.ts +220 -220
- package/src/compoundV3/index.ts +291 -291
- package/src/config/contracts.js +1155 -1147
- package/src/constants/index.ts +6 -6
- package/src/contracts.ts +135 -134
- package/src/curveUsd/index.ts +239 -239
- package/src/eulerV2/index.ts +303 -303
- package/src/exchange/index.ts +17 -17
- package/src/fluid/index.ts +1216 -354
- package/src/helpers/aaveHelpers/index.ts +203 -203
- package/src/helpers/chickenBondsHelpers/index.ts +23 -23
- package/src/helpers/compoundHelpers/index.ts +248 -248
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +234 -234
- package/src/helpers/fluidHelpers/index.ts +295 -57
- package/src/helpers/index.ts +11 -11
- package/src/helpers/liquityV2Helpers/index.ts +80 -80
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +94 -94
- package/src/helpers/morphoBlueHelpers/index.ts +367 -367
- package/src/helpers/sparkHelpers/index.ts +154 -154
- package/src/index.ts +52 -52
- package/src/liquity/index.ts +116 -116
- package/src/liquityV2/index.ts +295 -295
- package/src/llamaLend/index.ts +275 -275
- package/src/maker/index.ts +117 -117
- package/src/markets/aave/index.ts +152 -152
- package/src/markets/aave/marketAssets.ts +46 -44
- package/src/markets/compound/index.ts +213 -213
- package/src/markets/compound/marketsAssets.ts +82 -82
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/fluid/index.ts +2043 -2012
- package/src/markets/index.ts +27 -27
- package/src/markets/liquityV2/index.ts +54 -54
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +895 -895
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +10 -10
- package/src/moneymarket/moneymarketCommonService.ts +80 -80
- package/src/morphoAaveV2/index.ts +256 -256
- package/src/morphoAaveV3/index.ts +630 -630
- package/src/morphoBlue/index.ts +202 -202
- package/src/multicall/index.ts +33 -33
- package/src/services/priceService.ts +130 -91
- package/src/services/utils.ts +59 -59
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +460 -460
- package/src/staking/staking.ts +217 -217
- package/src/types/aave.ts +275 -275
- package/src/types/chickenBonds.ts +45 -45
- package/src/types/common.ts +84 -84
- package/src/types/compound.ts +133 -133
- package/src/types/contracts/generated/FluidView.ts +263 -2
- package/src/types/contracts/generated/WeETHPriceFeed.ts +202 -0
- package/src/types/contracts/generated/index.ts +1 -0
- package/src/types/curveUsd.ts +119 -119
- package/src/types/euler.ts +173 -173
- package/src/types/fluid.ts +299 -268
- package/src/types/index.ts +11 -11
- package/src/types/liquity.ts +30 -30
- package/src/types/liquityV2.ts +119 -119
- package/src/types/llamaLend.ts +155 -155
- package/src/types/maker.ts +50 -50
- package/src/types/morphoBlue.ts +194 -194
- package/src/types/spark.ts +135 -135
|
@@ -1,6 +1,63 @@
|
|
|
1
|
-
import { FluidAggregatedVaultData, FluidAssetsData, FluidUsedAssets, InnerFluidMarketData } from '../../types';
|
|
1
|
+
import { FluidAggregatedVaultData, FluidAssetData, FluidAssetsData, FluidUsedAsset, FluidUsedAssets, InnerFluidMarketData } from '../../types';
|
|
2
|
+
import { FluidView } from '../../types/contracts/generated';
|
|
2
3
|
export declare const getFluidAggregatedData: ({ usedAssets, assetsData, marketData, }: {
|
|
3
4
|
usedAssets: FluidUsedAssets;
|
|
4
5
|
marketData: InnerFluidMarketData;
|
|
5
6
|
assetsData: FluidAssetsData;
|
|
6
|
-
}) => FluidAggregatedVaultData;
|
|
7
|
+
}, supplyShares?: string, borrowShares?: string) => FluidAggregatedVaultData;
|
|
8
|
+
interface DexSupplyData {
|
|
9
|
+
maxSupplyShares: string;
|
|
10
|
+
supplyDexFee: string;
|
|
11
|
+
token0PerSupplyShare: string;
|
|
12
|
+
token1PerSupplyShare: string;
|
|
13
|
+
withdrawable0: string;
|
|
14
|
+
withdrawable1: string;
|
|
15
|
+
withdrawableShares: string;
|
|
16
|
+
utilizationSupply0: string;
|
|
17
|
+
utilizationSupply1: string;
|
|
18
|
+
supplyRate0: string;
|
|
19
|
+
supplyRate1: string;
|
|
20
|
+
totalSupplyShares: string;
|
|
21
|
+
withdrawableToken0: string;
|
|
22
|
+
withdrawableToken1: string;
|
|
23
|
+
totalSupplyToken0: string;
|
|
24
|
+
totalSupplyToken1: string;
|
|
25
|
+
reservesSupplyToken0: string;
|
|
26
|
+
reservesSupplyToken1: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const parseDexSupplyData: (dexSupplyData: FluidView.DexSupplyDataStructOutput, collAsset0: string, collAsset1: string) => DexSupplyData;
|
|
29
|
+
interface DexBorrowData {
|
|
30
|
+
maxBorrowShares: string;
|
|
31
|
+
borrowDexFee: string;
|
|
32
|
+
token0PerBorrowShare: string;
|
|
33
|
+
token1PerBorrowShare: string;
|
|
34
|
+
borrowable0: string;
|
|
35
|
+
borrowable1: string;
|
|
36
|
+
utilizationBorrow0: string;
|
|
37
|
+
utilizationBorrow1: string;
|
|
38
|
+
borrowRate0: string;
|
|
39
|
+
borrowRate1: string;
|
|
40
|
+
totalBorrowShares: string;
|
|
41
|
+
borrowableToken0: string;
|
|
42
|
+
borrowableToken1: string;
|
|
43
|
+
totalBorrowToken0: string;
|
|
44
|
+
totalBorrowToken1: string;
|
|
45
|
+
borrowableShares: string;
|
|
46
|
+
quoteTokensPerShare: string;
|
|
47
|
+
reservesBorrowToken0: string;
|
|
48
|
+
reservesBorrowToken1: string;
|
|
49
|
+
}
|
|
50
|
+
export declare const parseDexBorrowData: (dexBorrowData: FluidView.DexBorrowDataStructOutput, debtAsset0: string, debtAsset1: string) => DexBorrowData;
|
|
51
|
+
export declare const mergeAssetData: (existing: Partial<FluidAssetData> | undefined, additional: Partial<FluidAssetData>) => FluidAssetData;
|
|
52
|
+
export declare const EMPTY_USED_ASSET: {
|
|
53
|
+
isSupplied: boolean;
|
|
54
|
+
isBorrowed: boolean;
|
|
55
|
+
supplied: string;
|
|
56
|
+
suppliedUsd: string;
|
|
57
|
+
borrowed: string;
|
|
58
|
+
borrowedUsd: string;
|
|
59
|
+
symbol: string;
|
|
60
|
+
collateral: boolean;
|
|
61
|
+
};
|
|
62
|
+
export declare const mergeUsedAssets: (existing: Partial<FluidUsedAsset> | undefined, additional: Partial<FluidUsedAsset>) => FluidUsedAsset;
|
|
63
|
+
export {};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import Dec from 'decimal.js';
|
|
2
|
+
import { assetAmountInEth } from '@defisaver/tokens';
|
|
3
|
+
import { FluidVaultType, } from '../../types';
|
|
2
4
|
import { calcLeverageLiqPrice, getAssetsTotal, isLeveragedPos } from '../../moneymarket';
|
|
3
5
|
import { calculateNetApy } from '../../staking';
|
|
4
|
-
|
|
6
|
+
import { getEthAmountForDecimals } from '../../services/utils';
|
|
7
|
+
export const getFluidAggregatedData = ({ usedAssets, assetsData, marketData, }, supplyShares, borrowShares) => {
|
|
5
8
|
const payload = {};
|
|
6
|
-
payload.suppliedUsd =
|
|
7
|
-
|
|
9
|
+
payload.suppliedUsd = [FluidVaultType.T1, FluidVaultType.T3].includes(marketData.vaultType)
|
|
10
|
+
? getAssetsTotal(usedAssets, ({ isSupplied }) => isSupplied, ({ suppliedUsd }) => suppliedUsd)
|
|
11
|
+
: new Dec(marketData.collSharePrice).mul(supplyShares).toString();
|
|
12
|
+
payload.borrowedUsd = [FluidVaultType.T1, FluidVaultType.T2].includes(marketData.vaultType)
|
|
13
|
+
? getAssetsTotal(usedAssets, ({ isBorrowed }) => isBorrowed, ({ borrowedUsd }) => borrowedUsd)
|
|
14
|
+
: new Dec(marketData.debtSharePrice).mul(borrowShares).toString();
|
|
8
15
|
const { netApy, incentiveUsd, totalInterestUsd } = calculateNetApy({ usedAssets, assetsData: assetsData });
|
|
9
16
|
payload.netApy = netApy;
|
|
10
17
|
payload.incentiveUsd = incentiveUsd;
|
|
@@ -34,3 +41,130 @@ export const getFluidAggregatedData = ({ usedAssets, assetsData, marketData, })
|
|
|
34
41
|
payload.collLiquidationRatio = new Dec(payload.suppliedUsd).div(payload.liquidationLimitUsd).mul(100).toString();
|
|
35
42
|
return payload;
|
|
36
43
|
};
|
|
44
|
+
export const parseDexSupplyData = (dexSupplyData, collAsset0, collAsset1) => {
|
|
45
|
+
const { dexPool, // address of the dex pool
|
|
46
|
+
dexId, // id of the dex pool
|
|
47
|
+
fee: _fee, // fee of the dex pool TODO videti sa Rajkom
|
|
48
|
+
lastStoredPrice, // last stored price of the dex pool
|
|
49
|
+
centerPrice, // center price of the dex pool
|
|
50
|
+
token0Utilization, // token0 utilization
|
|
51
|
+
token1Utilization, // token1 utilization
|
|
52
|
+
// ONLY FOR SUPPLY
|
|
53
|
+
totalSupplyShares: totalSupplySharesWei, // total supply shares, in 1e18
|
|
54
|
+
maxSupplyShares: maxSupplySharesWei, // max supply shares, in 1e18
|
|
55
|
+
token0Supplied, // token0 supplied, in token0 decimals
|
|
56
|
+
token1Supplied, // token1 supplied, in token1 decimals
|
|
57
|
+
sharesWithdrawable, // shares withdrawable, in 1e18
|
|
58
|
+
token0Withdrawable, // token0 withdrawable, in token0 decimals
|
|
59
|
+
token1Withdrawable, // token1 withdrawable, in token1 decimals
|
|
60
|
+
token0PerSupplyShare: token0PerSupplyShareWei, // token0 amount per 1e18 supply shares
|
|
61
|
+
token1PerSupplyShare: token1PerSupplyShareWei, // token1 amount per 1e18 supply shares
|
|
62
|
+
token0SupplyRate, // token0 supply rate. E.g 320 = 3.2% APR
|
|
63
|
+
token1SupplyRate, // token1 supply rate. E.g 320 = 3.2% APR
|
|
64
|
+
supplyToken0Reserves, // token0 reserves in the dex pool
|
|
65
|
+
supplyToken1Reserves, // token1 reserves in the dex pool
|
|
66
|
+
} = dexSupplyData;
|
|
67
|
+
const maxSupplyShares = getEthAmountForDecimals(maxSupplySharesWei, 18);
|
|
68
|
+
const fee = new Dec(_fee).div(100).toString();
|
|
69
|
+
const token0PerSupplyShare = assetAmountInEth(token0PerSupplyShareWei, collAsset0);
|
|
70
|
+
const token1PerSupplyShare = assetAmountInEth(token1PerSupplyShareWei, collAsset1);
|
|
71
|
+
const withdrawable0 = assetAmountInEth(token0Withdrawable, collAsset0);
|
|
72
|
+
const withdrawable1 = assetAmountInEth(token1Withdrawable, collAsset1);
|
|
73
|
+
const utilizationSupply0 = assetAmountInEth(token0Utilization, collAsset0);
|
|
74
|
+
const utilizationSupply1 = assetAmountInEth(token1Utilization, collAsset1);
|
|
75
|
+
const supplyRate0 = new Dec(token0SupplyRate).div(100).toString();
|
|
76
|
+
const supplyRate1 = new Dec(token1SupplyRate).div(100).toString();
|
|
77
|
+
const totalSupplyShares = getEthAmountForDecimals(totalSupplySharesWei, 18); // in shares
|
|
78
|
+
const withdrawableShares = getEthAmountForDecimals(sharesWithdrawable, 18);
|
|
79
|
+
const withdrawableToken0 = new Dec(withdrawableShares).mul(token0PerSupplyShare).div(1e18).toString();
|
|
80
|
+
const withdrawableToken1 = new Dec(withdrawableShares).mul(token1PerSupplyShare).div(1e18).toString();
|
|
81
|
+
const totalSupplyToken0 = assetAmountInEth(token0Supplied, collAsset0);
|
|
82
|
+
const totalSupplyToken1 = assetAmountInEth(token1Supplied, collAsset1);
|
|
83
|
+
const reservesSupplyToken0 = assetAmountInEth(supplyToken0Reserves, collAsset0);
|
|
84
|
+
const reservesSupplyToken1 = assetAmountInEth(supplyToken1Reserves, collAsset1);
|
|
85
|
+
return {
|
|
86
|
+
maxSupplyShares,
|
|
87
|
+
withdrawableShares,
|
|
88
|
+
supplyDexFee: fee,
|
|
89
|
+
token0PerSupplyShare,
|
|
90
|
+
token1PerSupplyShare,
|
|
91
|
+
withdrawable0,
|
|
92
|
+
withdrawable1,
|
|
93
|
+
utilizationSupply0,
|
|
94
|
+
utilizationSupply1,
|
|
95
|
+
supplyRate0,
|
|
96
|
+
supplyRate1,
|
|
97
|
+
totalSupplyShares,
|
|
98
|
+
withdrawableToken0,
|
|
99
|
+
withdrawableToken1,
|
|
100
|
+
totalSupplyToken0,
|
|
101
|
+
totalSupplyToken1,
|
|
102
|
+
reservesSupplyToken0,
|
|
103
|
+
reservesSupplyToken1,
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export const parseDexBorrowData = (dexBorrowData, debtAsset0, debtAsset1) => {
|
|
107
|
+
const { dexPool, dexId, fee: _fee, lastStoredPrice, centerPrice, token0Utilization, token1Utilization, totalBorrowShares: totalBorrowSharesWei, maxBorrowShares: maxBorrowSharesWei, token0Borrowed, token1Borrowed, sharesBorrowable, token0Borrowable, token1Borrowable, token0PerBorrowShare: token0PerBorrowShareWei, token1PerBorrowShare: token1PerBorrowShareWei, token0BorrowRate, token1BorrowRate, quoteTokensPerShare, borrowToken0Reserves, borrowToken1Reserves, } = dexBorrowData;
|
|
108
|
+
const maxBorrowShares = getEthAmountForDecimals(maxBorrowSharesWei, 18);
|
|
109
|
+
const fee = new Dec(_fee).div(100).toString();
|
|
110
|
+
const token0PerBorrowShare = assetAmountInEth(token0PerBorrowShareWei, debtAsset0);
|
|
111
|
+
const token1PerBorrowShare = assetAmountInEth(token1PerBorrowShareWei, debtAsset1);
|
|
112
|
+
const borrowable0 = assetAmountInEth(token0Borrowable, debtAsset0);
|
|
113
|
+
const borrowable1 = assetAmountInEth(token1Borrowable, debtAsset1);
|
|
114
|
+
const utilizationBorrow0 = assetAmountInEth(token0Utilization, debtAsset0);
|
|
115
|
+
const utilizationBorrow1 = assetAmountInEth(token1Utilization, debtAsset1);
|
|
116
|
+
const borrowRate0 = new Dec(token0BorrowRate).div(100).toString();
|
|
117
|
+
const borrowRate1 = new Dec(token1BorrowRate).div(100).toString();
|
|
118
|
+
const totalBorrowShares = getEthAmountForDecimals(totalBorrowSharesWei, 18); // in shares
|
|
119
|
+
const borrowableShares = getEthAmountForDecimals(sharesBorrowable, 18);
|
|
120
|
+
const borrowableToken0 = new Dec(borrowableShares).mul(token0PerBorrowShare).div(1e18).toString();
|
|
121
|
+
const borrowableToken1 = new Dec(borrowableShares).mul(token1PerBorrowShare).div(1e18).toString();
|
|
122
|
+
const totalBorrowToken0 = assetAmountInEth(token0Borrowed, debtAsset0);
|
|
123
|
+
const totalBorrowToken1 = assetAmountInEth(token1Borrowed, debtAsset1);
|
|
124
|
+
const reservesBorrowToken0 = assetAmountInEth(borrowToken0Reserves, debtAsset0);
|
|
125
|
+
const reservesBorrowToken1 = assetAmountInEth(borrowToken1Reserves, debtAsset1);
|
|
126
|
+
return {
|
|
127
|
+
borrowableShares,
|
|
128
|
+
maxBorrowShares,
|
|
129
|
+
borrowDexFee: fee,
|
|
130
|
+
token0PerBorrowShare,
|
|
131
|
+
token1PerBorrowShare,
|
|
132
|
+
borrowable0,
|
|
133
|
+
borrowable1,
|
|
134
|
+
utilizationBorrow0,
|
|
135
|
+
utilizationBorrow1,
|
|
136
|
+
borrowRate0,
|
|
137
|
+
borrowRate1,
|
|
138
|
+
totalBorrowShares,
|
|
139
|
+
borrowableToken0,
|
|
140
|
+
borrowableToken1,
|
|
141
|
+
totalBorrowToken0,
|
|
142
|
+
totalBorrowToken1,
|
|
143
|
+
quoteTokensPerShare: getEthAmountForDecimals(quoteTokensPerShare, 27),
|
|
144
|
+
reservesBorrowToken0,
|
|
145
|
+
reservesBorrowToken1,
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
const EMPTY_ASSET_DATA = {
|
|
149
|
+
symbol: '',
|
|
150
|
+
address: '',
|
|
151
|
+
price: '0',
|
|
152
|
+
totalSupply: '',
|
|
153
|
+
totalBorrow: '0',
|
|
154
|
+
canBeSupplied: false,
|
|
155
|
+
canBeBorrowed: false,
|
|
156
|
+
supplyRate: '0',
|
|
157
|
+
borrowRate: '0',
|
|
158
|
+
};
|
|
159
|
+
export const mergeAssetData = (existing = {}, additional) => (Object.assign(Object.assign(Object.assign({}, EMPTY_ASSET_DATA), existing), additional));
|
|
160
|
+
export const EMPTY_USED_ASSET = {
|
|
161
|
+
isSupplied: false,
|
|
162
|
+
isBorrowed: false,
|
|
163
|
+
supplied: '0',
|
|
164
|
+
suppliedUsd: '0',
|
|
165
|
+
borrowed: '0',
|
|
166
|
+
borrowedUsd: '0',
|
|
167
|
+
symbol: '',
|
|
168
|
+
collateral: false,
|
|
169
|
+
};
|
|
170
|
+
export const mergeUsedAssets = (existing = {}, additional) => (Object.assign(Object.assign(Object.assign({}, EMPTY_USED_ASSET), existing), additional));
|
|
@@ -107,73 +107,73 @@ export const getApyAfterValuesEstimation = (selectedMarket, actions, web3, netwo
|
|
|
107
107
|
return { borrowRate, supplyRate };
|
|
108
108
|
});
|
|
109
109
|
const API_URL = 'https://blue-api.morpho.org/graphql';
|
|
110
|
-
const MARKET_QUERY = `
|
|
111
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
112
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
113
|
-
reallocatableLiquidityAssets
|
|
114
|
-
targetBorrowUtilization
|
|
115
|
-
loanAsset {
|
|
116
|
-
address
|
|
117
|
-
decimals
|
|
118
|
-
priceUsd
|
|
119
|
-
}
|
|
120
|
-
state {
|
|
121
|
-
liquidityAssets
|
|
122
|
-
borrowAssets
|
|
123
|
-
supplyAssets
|
|
124
|
-
}
|
|
125
|
-
publicAllocatorSharedLiquidity {
|
|
126
|
-
assets
|
|
127
|
-
vault {
|
|
128
|
-
address
|
|
129
|
-
name
|
|
130
|
-
}
|
|
131
|
-
allocationMarket {
|
|
132
|
-
uniqueKey
|
|
133
|
-
loanAsset {
|
|
134
|
-
address
|
|
135
|
-
}
|
|
136
|
-
collateralAsset {
|
|
137
|
-
address
|
|
138
|
-
}
|
|
139
|
-
irmAddress
|
|
140
|
-
oracle {
|
|
141
|
-
address
|
|
142
|
-
}
|
|
143
|
-
lltv
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
loanAsset {
|
|
147
|
-
address
|
|
148
|
-
}
|
|
149
|
-
collateralAsset {
|
|
150
|
-
address
|
|
151
|
-
}
|
|
152
|
-
oracle {
|
|
153
|
-
address
|
|
154
|
-
}
|
|
155
|
-
irmAddress
|
|
156
|
-
lltv
|
|
157
|
-
}
|
|
158
|
-
}
|
|
110
|
+
const MARKET_QUERY = `
|
|
111
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
112
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
113
|
+
reallocatableLiquidityAssets
|
|
114
|
+
targetBorrowUtilization
|
|
115
|
+
loanAsset {
|
|
116
|
+
address
|
|
117
|
+
decimals
|
|
118
|
+
priceUsd
|
|
119
|
+
}
|
|
120
|
+
state {
|
|
121
|
+
liquidityAssets
|
|
122
|
+
borrowAssets
|
|
123
|
+
supplyAssets
|
|
124
|
+
}
|
|
125
|
+
publicAllocatorSharedLiquidity {
|
|
126
|
+
assets
|
|
127
|
+
vault {
|
|
128
|
+
address
|
|
129
|
+
name
|
|
130
|
+
}
|
|
131
|
+
allocationMarket {
|
|
132
|
+
uniqueKey
|
|
133
|
+
loanAsset {
|
|
134
|
+
address
|
|
135
|
+
}
|
|
136
|
+
collateralAsset {
|
|
137
|
+
address
|
|
138
|
+
}
|
|
139
|
+
irmAddress
|
|
140
|
+
oracle {
|
|
141
|
+
address
|
|
142
|
+
}
|
|
143
|
+
lltv
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
loanAsset {
|
|
147
|
+
address
|
|
148
|
+
}
|
|
149
|
+
collateralAsset {
|
|
150
|
+
address
|
|
151
|
+
}
|
|
152
|
+
oracle {
|
|
153
|
+
address
|
|
154
|
+
}
|
|
155
|
+
irmAddress
|
|
156
|
+
lltv
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
159
|
`;
|
|
160
|
-
const REWARDS_QUERY = `
|
|
161
|
-
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
162
|
-
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
163
|
-
uniqueKey
|
|
164
|
-
state {
|
|
165
|
-
rewards {
|
|
166
|
-
amountPerSuppliedToken
|
|
167
|
-
supplyApr
|
|
168
|
-
amountPerBorrowedToken
|
|
169
|
-
borrowApr
|
|
170
|
-
asset {
|
|
171
|
-
address
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
160
|
+
const REWARDS_QUERY = `
|
|
161
|
+
query MarketByUniqueKey($uniqueKey: String!, $chainId: Int!) {
|
|
162
|
+
marketByUniqueKey(uniqueKey: $uniqueKey, chainId: $chainId) {
|
|
163
|
+
uniqueKey
|
|
164
|
+
state {
|
|
165
|
+
rewards {
|
|
166
|
+
amountPerSuppliedToken
|
|
167
|
+
supplyApr
|
|
168
|
+
amountPerBorrowedToken
|
|
169
|
+
borrowApr
|
|
170
|
+
asset {
|
|
171
|
+
address
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
177
|
`;
|
|
178
178
|
/**
|
|
179
179
|
* Get reallocatable liquidity to a given market and target borrow utilization
|
|
@@ -7,7 +7,9 @@ export const aaveV1AssetsDefaultMarket = [
|
|
|
7
7
|
export const aaveV2AssetsDefaultMarket = ['USDT', 'WBTC', 'ETH', 'YFI', 'ZRX', 'UNI', 'AAVE', 'BAT', 'BUSD', 'DAI', 'ENJ', 'KNCL', 'LINK', 'MANA', 'MKR', 'REN', 'SNX', 'SUSD', 'TUSD', 'USDC', 'CRV', 'GUSD', 'BAL', 'xSUSHI', 'RENFIL', 'RAI', 'AMPL', 'USDP', 'DPI', 'FRAX', 'FEI', 'stETH', 'ENS', 'UST', 'CVX', '1INCH', 'LUSD'];
|
|
8
8
|
export const morphoAaveV2AssetDefaultMarket = ['DAI', 'ETH', 'USDC', 'USDT', 'WBTC', 'stETH', 'CRV'];
|
|
9
9
|
export const morphoAaveV3AssetEthMarket = ['ETH', 'wstETH', 'DAI', 'USDC', 'WBTC', 'rETH', 'cbETH', 'sDAI', 'USDT'];
|
|
10
|
-
export const aaveV3AssetsDefaultMarketEth = [
|
|
10
|
+
export const aaveV3AssetsDefaultMarketEth = [
|
|
11
|
+
'ETH', 'wstETH', 'WBTC', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'CRV', 'MKR', 'SNX', 'BAL', 'UNI', 'LDO', 'ENS', '1INCH', 'FRAX', 'GHO', 'RPL', 'sDAI', 'STG', 'KNC', 'FXS', 'crvUSD', 'PYUSD', 'weETH', 'osETH', 'USDe', 'ETHx', 'sUSDe', 'tBTC', 'cbBTC', 'USDS', 'rsETH', 'LBTC', 'eBTC', 'RLUSD', 'PT eUSDe May', 'PT sUSDe July',
|
|
12
|
+
];
|
|
11
13
|
export const aaveV3AssetsDefaultMarketOpt = [
|
|
12
14
|
'DAI', 'USDC.e', 'USDT', 'SUSD', 'AAVE', 'LINK', 'WBTC', 'ETH', 'OP', 'wstETH', 'LUSD', 'MAI', 'rETH', 'USDC',
|
|
13
15
|
];
|