@defisaver/positions-sdk 0.0.187 → 0.0.188-dev-markets
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/compoundV3/index.js +14 -9
- package/cjs/config/contracts.d.ts +572 -216
- package/cjs/config/contracts.js +34 -2
- package/cjs/contracts.d.ts +2 -0
- package/cjs/contracts.js +3 -1
- package/cjs/helpers/morphoBlueHelpers/index.js +49 -49
- package/cjs/markets/compound/index.d.ts +4 -0
- package/cjs/markets/compound/index.js +41 -1
- package/cjs/markets/compound/marketsAssets.d.ts +14 -0
- package/cjs/markets/compound/marketsAssets.js +17 -3
- package/cjs/markets/morphoBlue/index.d.ts +8 -0
- package/cjs/markets/morphoBlue/index.js +71 -2
- package/cjs/morphoBlue/index.js +27 -10
- package/cjs/services/priceService.d.ts +3 -0
- package/cjs/services/priceService.js +33 -1
- package/cjs/types/compound.d.ts +3 -1
- package/cjs/types/compound.js +2 -0
- package/cjs/types/contracts/generated/CUSDSv3.d.ts +441 -0
- package/cjs/types/contracts/generated/CUSDSv3.js +5 -0
- package/cjs/types/contracts/generated/CWstETHv3.d.ts +441 -0
- package/cjs/types/contracts/generated/CWstETHv3.js +5 -0
- package/cjs/types/contracts/generated/DFSFeedRegistry.d.ts +40 -0
- package/cjs/types/contracts/generated/DFSFeedRegistry.js +5 -0
- package/cjs/types/contracts/generated/WstETHPriceFeed.d.ts +39 -0
- package/cjs/types/contracts/generated/WstETHPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +4 -0
- package/cjs/types/morphoBlue.d.ts +5 -1
- package/cjs/types/morphoBlue.js +4 -0
- package/esm/compoundV3/index.js +15 -10
- package/esm/config/contracts.d.ts +572 -216
- package/esm/config/contracts.js +34 -2
- package/esm/contracts.d.ts +2 -0
- package/esm/contracts.js +2 -0
- package/esm/helpers/morphoBlueHelpers/index.js +49 -49
- package/esm/markets/compound/index.d.ts +4 -0
- package/esm/markets/compound/index.js +39 -1
- package/esm/markets/compound/marketsAssets.d.ts +14 -0
- package/esm/markets/compound/marketsAssets.js +16 -2
- package/esm/markets/morphoBlue/index.d.ts +8 -0
- package/esm/markets/morphoBlue/index.js +65 -1
- package/esm/morphoBlue/index.js +30 -13
- package/esm/services/priceService.d.ts +3 -0
- package/esm/services/priceService.js +31 -1
- package/esm/types/compound.d.ts +3 -1
- package/esm/types/compound.js +2 -0
- package/esm/types/contracts/generated/CUSDSv3.d.ts +441 -0
- package/esm/types/contracts/generated/CUSDSv3.js +4 -0
- package/esm/types/contracts/generated/CWstETHv3.d.ts +441 -0
- package/esm/types/contracts/generated/CWstETHv3.js +4 -0
- package/esm/types/contracts/generated/DFSFeedRegistry.d.ts +40 -0
- package/esm/types/contracts/generated/DFSFeedRegistry.js +4 -0
- package/esm/types/contracts/generated/WstETHPriceFeed.d.ts +39 -0
- package/esm/types/contracts/generated/WstETHPriceFeed.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +4 -0
- package/esm/types/morphoBlue.d.ts +5 -1
- package/esm/types/morphoBlue.js +4 -0
- package/package.json +49 -49
- 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 -282
- package/src/config/contracts.js +1079 -1047
- package/src/constants/index.ts +6 -6
- package/src/contracts.ts +132 -130
- package/src/curveUsd/index.ts +229 -229
- package/src/eulerV2/index.ts +303 -303
- package/src/exchange/index.ts +17 -17
- package/src/helpers/aaveHelpers/index.ts +198 -198
- package/src/helpers/chickenBondsHelpers/index.ts +23 -23
- package/src/helpers/compoundHelpers/index.ts +246 -246
- package/src/helpers/curveUsdHelpers/index.ts +40 -40
- package/src/helpers/eulerHelpers/index.ts +232 -232
- package/src/helpers/index.ts +8 -8
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +94 -94
- package/src/helpers/morphoBlueHelpers/index.ts +325 -325
- package/src/helpers/sparkHelpers/index.ts +150 -150
- package/src/index.ts +48 -48
- package/src/liquity/index.ts +116 -116
- 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 -46
- package/src/markets/compound/index.ts +213 -173
- package/src/markets/compound/marketsAssets.ts +82 -64
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/euler/index.ts +26 -26
- package/src/markets/index.ts +23 -23
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +878 -809
- 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 +188 -171
- package/src/multicall/index.ts +22 -22
- package/src/services/dsrService.ts +15 -15
- package/src/services/priceService.ts +61 -22
- package/src/services/utils.ts +56 -56
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +461 -461
- package/src/staking/staking.ts +220 -220
- package/src/types/aave.ts +270 -270
- package/src/types/chickenBonds.ts +45 -45
- package/src/types/common.ts +84 -84
- package/src/types/compound.ts +131 -129
- package/src/types/contracts/generated/CUSDSv3.ts +685 -0
- package/src/types/contracts/generated/CWstETHv3.ts +685 -0
- package/src/types/contracts/generated/DFSFeedRegistry.ts +77 -0
- package/src/types/contracts/generated/WstETHPriceFeed.ts +59 -0
- package/src/types/contracts/generated/index.ts +4 -0
- package/src/types/curveUsd.ts +118 -118
- package/src/types/euler.ts +171 -171
- package/src/types/index.ts +9 -9
- package/src/types/liquity.ts +30 -30
- package/src/types/llamaLend.ts +155 -155
- package/src/types/maker.ts +50 -50
- package/src/types/morphoBlue.ts +189 -185
- package/src/types/spark.ts +131 -131
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getConfigContractAddress } from '../../contracts';
|
|
2
2
|
import { CompoundVersions } from '../../types';
|
|
3
3
|
import { NetworkNumber } from '../../types/common';
|
|
4
|
-
import { compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCollAssets, v3USDCCollAssets, v3USDCeCollAssets, v3USDTCollAssets, } from './marketsAssets';
|
|
4
|
+
import { compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCollAssets, v3USDCCollAssets, v3USDCeCollAssets, v3USDSCollAssets, v3USDTCollAssets, v3wstETHCollAssets, } from './marketsAssets';
|
|
5
5
|
export { compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCollAssets, v3USDCCollAssets, v3USDCeCollAssets, v3USDTCollAssets, };
|
|
6
6
|
const EMPTY_BULKER_OPTIONS = { supply: '', withdraw: '' };
|
|
7
7
|
const STANDARD_BULKER_OPTIONS = {
|
|
@@ -13,6 +13,8 @@ const BULKER_OPTIONS = {
|
|
|
13
13
|
[CompoundVersions.CompoundV3USDC]: { supply: 2, withdraw: 5 },
|
|
14
14
|
[CompoundVersions.CompoundV3ETH]: STANDARD_BULKER_OPTIONS,
|
|
15
15
|
[CompoundVersions.CompoundV3USDT]: STANDARD_BULKER_OPTIONS,
|
|
16
|
+
[CompoundVersions.CompoundV3wstETH]: STANDARD_BULKER_OPTIONS,
|
|
17
|
+
[CompoundVersions.CompoundV3USDS]: STANDARD_BULKER_OPTIONS,
|
|
16
18
|
// Non-existing markets, keeping it because of typescript
|
|
17
19
|
[CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
18
20
|
[CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
@@ -26,6 +28,8 @@ const BULKER_OPTIONS = {
|
|
|
26
28
|
// Non-existing markets, keeping it because of typescript
|
|
27
29
|
[CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
28
30
|
[CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
|
|
31
|
+
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
32
|
+
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
29
33
|
},
|
|
30
34
|
[NetworkNumber.Base]: {
|
|
31
35
|
[CompoundVersions.CompoundV3ETH]: STANDARD_BULKER_OPTIONS,
|
|
@@ -35,6 +39,8 @@ const BULKER_OPTIONS = {
|
|
|
35
39
|
[CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
36
40
|
[CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
37
41
|
[CompoundVersions.CompoundV3USDT]: EMPTY_BULKER_OPTIONS,
|
|
42
|
+
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
43
|
+
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
38
44
|
},
|
|
39
45
|
[NetworkNumber.Opt]: {
|
|
40
46
|
[CompoundVersions.CompoundV3USDC]: STANDARD_BULKER_OPTIONS,
|
|
@@ -44,6 +50,8 @@ const BULKER_OPTIONS = {
|
|
|
44
50
|
[CompoundVersions.CompoundV3USDbC]: EMPTY_BULKER_OPTIONS,
|
|
45
51
|
[CompoundVersions.CompoundV2]: EMPTY_BULKER_OPTIONS,
|
|
46
52
|
[CompoundVersions.CompoundV3USDCe]: EMPTY_BULKER_OPTIONS,
|
|
53
|
+
[CompoundVersions.CompoundV3wstETH]: EMPTY_BULKER_OPTIONS,
|
|
54
|
+
[CompoundVersions.CompoundV3USDS]: EMPTY_BULKER_OPTIONS,
|
|
47
55
|
},
|
|
48
56
|
};
|
|
49
57
|
export const COMPOUND_V2 = {
|
|
@@ -136,6 +144,34 @@ export const COMPOUND_V3_USDT = (networkId) => ({
|
|
|
136
144
|
bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3USDT],
|
|
137
145
|
// icon: SvgAdapter(protocolIcons.compoundv3),
|
|
138
146
|
});
|
|
147
|
+
export const COMPOUND_V3_WSTETH = (networkId) => ({
|
|
148
|
+
chainIds: [NetworkNumber.Eth],
|
|
149
|
+
label: 'Compound V3 - wstETH',
|
|
150
|
+
shortLabel: 'v3',
|
|
151
|
+
value: CompoundVersions.CompoundV3wstETH,
|
|
152
|
+
baseAsset: 'wstETH',
|
|
153
|
+
collAssets: networkId ? v3wstETHCollAssets[networkId] : [],
|
|
154
|
+
baseMarket: 'cWstETHv3',
|
|
155
|
+
baseMarketAddress: getConfigContractAddress('cWstETHv3', networkId),
|
|
156
|
+
secondLabel: 'Market',
|
|
157
|
+
bulkerName: networkId === NetworkNumber.Eth ? 'CompV3BulkerMainnetETH' : 'CompV3BulkerL2',
|
|
158
|
+
bulkerAddress: getConfigContractAddress(networkId === NetworkNumber.Eth ? 'CompV3BulkerMainnetETH' : 'CompV3BulkerL2', networkId),
|
|
159
|
+
bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3wstETH],
|
|
160
|
+
});
|
|
161
|
+
export const COMPOUND_V3_USDS = (networkId) => ({
|
|
162
|
+
chainIds: [NetworkNumber.Eth],
|
|
163
|
+
label: 'Compound V3 - USDS',
|
|
164
|
+
shortLabel: 'v3',
|
|
165
|
+
value: CompoundVersions.CompoundV3USDS,
|
|
166
|
+
baseAsset: 'USDS',
|
|
167
|
+
collAssets: networkId ? v3USDSCollAssets[networkId] : [],
|
|
168
|
+
baseMarket: 'cUSDSv3',
|
|
169
|
+
baseMarketAddress: getConfigContractAddress('cUSDSv3', networkId),
|
|
170
|
+
secondLabel: 'Market',
|
|
171
|
+
bulkerName: networkId === NetworkNumber.Eth ? 'CompV3BulkerMainnetETH' : 'CompV3BulkerL2',
|
|
172
|
+
bulkerAddress: getConfigContractAddress(networkId === NetworkNumber.Eth ? 'CompV3BulkerMainnetETH' : 'CompV3BulkerL2', networkId),
|
|
173
|
+
bulkerOptions: BULKER_OPTIONS[networkId][CompoundVersions.CompoundV3USDS],
|
|
174
|
+
});
|
|
139
175
|
export const CompoundMarkets = (networkId) => ({
|
|
140
176
|
[CompoundVersions.CompoundV2]: COMPOUND_V2,
|
|
141
177
|
[CompoundVersions.CompoundV3ETH]: COMPOUND_V3_ETH(networkId),
|
|
@@ -143,4 +179,6 @@ export const CompoundMarkets = (networkId) => ({
|
|
|
143
179
|
[CompoundVersions.CompoundV3USDbC]: COMPOUND_V3_USDBC(networkId),
|
|
144
180
|
[CompoundVersions.CompoundV3USDCe]: COMPOUND_V3_USDCe(networkId),
|
|
145
181
|
[CompoundVersions.CompoundV3USDT]: COMPOUND_V3_USDT(networkId),
|
|
182
|
+
[CompoundVersions.CompoundV3wstETH]: COMPOUND_V3_WSTETH(networkId),
|
|
183
|
+
[CompoundVersions.CompoundV3USDS]: COMPOUND_V3_USDS(networkId),
|
|
146
184
|
});
|
|
@@ -42,3 +42,17 @@ export declare const v3USDTCollAssets: {
|
|
|
42
42
|
42161: string[];
|
|
43
43
|
8453: never[];
|
|
44
44
|
};
|
|
45
|
+
export declare const v3USDSCollAssetsEth: string[];
|
|
46
|
+
export declare const v3USDSCollAssets: {
|
|
47
|
+
1: string[];
|
|
48
|
+
10: never[];
|
|
49
|
+
42161: never[];
|
|
50
|
+
8453: never[];
|
|
51
|
+
};
|
|
52
|
+
export declare const v3wstETHCollAssetsEth: string[];
|
|
53
|
+
export declare const v3wstETHCollAssets: {
|
|
54
|
+
1: string[];
|
|
55
|
+
10: never[];
|
|
56
|
+
42161: never[];
|
|
57
|
+
8453: never[];
|
|
58
|
+
};
|
|
@@ -5,7 +5,7 @@ export const compoundV2CollateralAssets = [
|
|
|
5
5
|
'cTUSD', 'cLINK', 'cUSDP', 'cUNI', 'cCOMP', 'cMKR', 'cSUSHI', 'cAAVE', 'cYFI',
|
|
6
6
|
].map((symbol) => getAssetInfo(symbol));
|
|
7
7
|
export const v3USDCCollAssetsEth = ['COMP', 'WBTC', 'ETH', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC'];
|
|
8
|
-
export const v3USDCCollAssetsArb = ['ARB', 'ETH', 'GMX', 'WBTC', 'wstETH', 'ezETH'];
|
|
8
|
+
export const v3USDCCollAssetsArb = ['ARB', 'ETH', 'GMX', 'WBTC', 'wstETH', 'ezETH', 'wUSDM'];
|
|
9
9
|
export const v3USDCCollAssetsBase = ['ETH', 'cbETH', 'wstETH', 'cbBTC'];
|
|
10
10
|
export const v3USDCCollAssetsOpt = ['ETH', 'OP', 'WBTC', 'wstETH'];
|
|
11
11
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
@@ -42,7 +42,7 @@ export const v3USDbCCollAssets = {
|
|
|
42
42
|
[NetworkNumber.Arb]: [],
|
|
43
43
|
[NetworkNumber.Base]: v3USDbCCollAssetsBase,
|
|
44
44
|
};
|
|
45
|
-
export const v3USDTCollAssetsEth = ['COMP', 'ETH', 'WBTC', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC', 'wUSDM', 'sFRAX'];
|
|
45
|
+
export const v3USDTCollAssetsEth = ['COMP', 'ETH', 'WBTC', 'UNI', 'LINK', 'wstETH', 'cbBTC', 'tBTC', 'wUSDM', 'sFRAX', 'mETH'];
|
|
46
46
|
export const v3USDTCollAssetsArb = ['ETH', 'WBTC', 'wstETH', 'ARB', 'GMX'];
|
|
47
47
|
export const v3USDTCollAssetsOpt = ['ETH', 'WBTC', 'OP', 'wstETH'];
|
|
48
48
|
// @dev Keep assets in array, do not assign directly, so we can parse it and edit it programmatically with `scripts/updateMarkets`
|
|
@@ -52,3 +52,17 @@ export const v3USDTCollAssets = {
|
|
|
52
52
|
[NetworkNumber.Arb]: v3USDTCollAssetsArb,
|
|
53
53
|
[NetworkNumber.Base]: [],
|
|
54
54
|
};
|
|
55
|
+
export const v3USDSCollAssetsEth = ['wstETH', 'ETH', 'sUSDS', 'cbETH', 'tBTC', 'USDe'];
|
|
56
|
+
export const v3USDSCollAssets = {
|
|
57
|
+
[NetworkNumber.Eth]: v3USDSCollAssetsEth,
|
|
58
|
+
[NetworkNumber.Opt]: [],
|
|
59
|
+
[NetworkNumber.Arb]: [],
|
|
60
|
+
[NetworkNumber.Base]: [],
|
|
61
|
+
};
|
|
62
|
+
export const v3wstETHCollAssetsEth = ['rsETH', 'ezETH'];
|
|
63
|
+
export const v3wstETHCollAssets = {
|
|
64
|
+
[NetworkNumber.Eth]: v3wstETHCollAssetsEth,
|
|
65
|
+
[NetworkNumber.Opt]: [],
|
|
66
|
+
[NetworkNumber.Arb]: [],
|
|
67
|
+
[NetworkNumber.Base]: [],
|
|
68
|
+
};
|
|
@@ -48,6 +48,10 @@ export declare const MORPHO_BLUE_RETH_ETH_945_BASE: (networkId?: NetworkNumber)
|
|
|
48
48
|
export declare const MORPHO_BLUE_CBBTC_ETH_915_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
49
49
|
export declare const MORPHO_BLUE_CBBTC_USDC_860_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
50
50
|
export declare const MORPHO_BLUE_WSUPEROETHB_WETH_915_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
51
|
+
export declare const MORPHO_BLUE_LBTC_WBTC_945: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
52
|
+
export declare const MORPHO_BLUE_LBTC_CBBTC_945_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
53
|
+
export declare const MORPHO_BLUE_WSTETH_EURC_860_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
54
|
+
export declare const MORPHO_BLUE_CBBTC_EURC_860_BASE: (networkId?: NetworkNumber) => MorphoBlueMarketData;
|
|
51
55
|
export declare const MorphoBlueMarkets: (networkId: NetworkNumber) => {
|
|
52
56
|
readonly morphobluewstethusdc: MorphoBlueMarketData;
|
|
53
57
|
readonly morphobluesdaiusdc: MorphoBlueMarketData;
|
|
@@ -72,6 +76,7 @@ export declare const MorphoBlueMarkets: (networkId: NetworkNumber) => {
|
|
|
72
76
|
readonly morphobluecbbtcusdc: MorphoBlueMarketData;
|
|
73
77
|
readonly morphoblueretheth_945: MorphoBlueMarketData;
|
|
74
78
|
readonly morphobluesusdeusdc_915: MorphoBlueMarketData;
|
|
79
|
+
readonly morphobluelbtcwbtc_945: MorphoBlueMarketData;
|
|
75
80
|
readonly morphobluewstetheth_945: MorphoBlueMarketData;
|
|
76
81
|
readonly morphobluewstetheth_945_exchange_rate: MorphoBlueMarketData;
|
|
77
82
|
readonly morphobluewstetheth_965_exchange_rate: MorphoBlueMarketData;
|
|
@@ -92,6 +97,9 @@ export declare const MorphoBlueMarkets: (networkId: NetworkNumber) => {
|
|
|
92
97
|
readonly morphoblueretheth_945_base: MorphoBlueMarketData;
|
|
93
98
|
readonly morphobluecbbtceth_915_base: MorphoBlueMarketData;
|
|
94
99
|
readonly morphobluecbbtcusdc_860_base: MorphoBlueMarketData;
|
|
100
|
+
readonly morphobluecbbtceurc_860_base: MorphoBlueMarketData;
|
|
101
|
+
readonly morphobluewstetheurc_860_base: MorphoBlueMarketData;
|
|
102
|
+
readonly morphobluelbtccbbtc_945_base: MorphoBlueMarketData;
|
|
95
103
|
readonly morphobluewsuperoethbweth_915_base: MorphoBlueMarketData;
|
|
96
104
|
readonly morphobluecbetheth_945_base: MorphoBlueMarketData;
|
|
97
105
|
readonly morphobluecbetheth_965_base: MorphoBlueMarketData;
|
|
@@ -715,7 +715,7 @@ export const MORPHO_BLUE_CBBTC_USDC_860_BASE = (networkId = NetworkNumber.Eth) =
|
|
|
715
715
|
export const MORPHO_BLUE_WSUPEROETHB_WETH_915_BASE = (networkId = NetworkNumber.Eth) => ({
|
|
716
716
|
chainIds: [NetworkNumber.Base],
|
|
717
717
|
label: 'Morpho',
|
|
718
|
-
shortLabel: 'wsuperOETHb/
|
|
718
|
+
shortLabel: 'wsuperOETHb/ETH',
|
|
719
719
|
value: MorphoBlueVersions.MorphoBlueWsuperOETHbWETH_915_Base,
|
|
720
720
|
url: 'wsuperoethbweth-144bf18d',
|
|
721
721
|
loanToken: '0x4200000000000000000000000000000000000006',
|
|
@@ -727,6 +727,66 @@ export const MORPHO_BLUE_WSUPEROETHB_WETH_915_BASE = (networkId = NetworkNumber.
|
|
|
727
727
|
marketId: '0x144bf18d6bf4c59602548a825034f73bf1d20177fc5f975fc69d5a5eba929b45',
|
|
728
728
|
protocolName: 'morpho-blue',
|
|
729
729
|
});
|
|
730
|
+
export const MORPHO_BLUE_LBTC_WBTC_945 = (networkId = NetworkNumber.Eth) => ({
|
|
731
|
+
chainIds: [NetworkNumber.Eth],
|
|
732
|
+
label: 'Morpho',
|
|
733
|
+
shortLabel: 'LBTC/WBTC',
|
|
734
|
+
value: MorphoBlueVersions.MorphoBlueLBTCWBTC_945,
|
|
735
|
+
url: 'lbtcwbtc-f6a05662',
|
|
736
|
+
loanToken: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
737
|
+
collateralToken: '0x8236a87084f8B84306f72007F36F2618A5634494',
|
|
738
|
+
oracle: '0xa98105B8227E0f2157816Feb7A331364A9B74F80',
|
|
739
|
+
oracleType: MorphoBlueOracleType.MARKET_RATE,
|
|
740
|
+
irm: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
741
|
+
lltv: 0.945,
|
|
742
|
+
marketId: '0xf6a056627a51e511ec7f48332421432ea6971fc148d8f3c451e14ea108026549',
|
|
743
|
+
protocolName: 'morpho-blue',
|
|
744
|
+
});
|
|
745
|
+
export const MORPHO_BLUE_LBTC_CBBTC_945_BASE = (networkId = NetworkNumber.Eth) => ({
|
|
746
|
+
chainIds: [NetworkNumber.Base],
|
|
747
|
+
label: 'Morpho',
|
|
748
|
+
shortLabel: 'LBTC/cbBTC',
|
|
749
|
+
value: MorphoBlueVersions.MorphoBlueLBTCCbBTC_945_Base,
|
|
750
|
+
url: 'lbtccbbtc-30767836',
|
|
751
|
+
loanToken: '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf',
|
|
752
|
+
collateralToken: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
|
|
753
|
+
oracle: '0x9Ae0E86e88AEE94B700240eBE0BD17D969BAD0EA',
|
|
754
|
+
oracleType: MorphoBlueOracleType.MARKET_RATE,
|
|
755
|
+
irm: '0x46415998764C29aB2a25CbeA6254146D50D22687',
|
|
756
|
+
lltv: 0.945,
|
|
757
|
+
marketId: '0x30767836635facec1282e6ef4a5981406ed4e72727b3a63a3a72c74e8279a8d7',
|
|
758
|
+
protocolName: 'morpho-blue',
|
|
759
|
+
});
|
|
760
|
+
export const MORPHO_BLUE_WSTETH_EURC_860_BASE = (networkId = NetworkNumber.Eth) => ({
|
|
761
|
+
chainIds: [NetworkNumber.Base],
|
|
762
|
+
label: 'Morpho',
|
|
763
|
+
shortLabel: 'wstETH/EURC',
|
|
764
|
+
value: MorphoBlueVersions.MorphoBlueWstEthEURC_860_Base,
|
|
765
|
+
url: 'wstetheurc-f7e40290',
|
|
766
|
+
loanToken: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
767
|
+
collateralToken: '0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452',
|
|
768
|
+
oracle: '0xa54122f0E0766258377Ffe732e454A3248f454F4',
|
|
769
|
+
oracleType: MorphoBlueOracleType.MARKET_RATE,
|
|
770
|
+
irm: '0x46415998764C29aB2a25CbeA6254146D50D22687',
|
|
771
|
+
lltv: 0.86,
|
|
772
|
+
marketId: '0xf7e40290f8ca1d5848b3c129502599aa0f0602eb5f5235218797a34242719561',
|
|
773
|
+
protocolName: 'morpho-blue',
|
|
774
|
+
});
|
|
775
|
+
export const MORPHO_BLUE_CBBTC_EURC_860_BASE = (networkId = NetworkNumber.Eth) => ({
|
|
776
|
+
chainIds: [NetworkNumber.Base],
|
|
777
|
+
label: 'Morpho',
|
|
778
|
+
shortLabel: 'cbBTC/EURC',
|
|
779
|
+
value: MorphoBlueVersions.MorphoBlueCbBTCEURC_860_Base,
|
|
780
|
+
url: 'cbbtceurc-67ebd84b',
|
|
781
|
+
loanToken: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
782
|
+
collateralToken: '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf',
|
|
783
|
+
oracle: '0xA857411CB2231a6A87a3bEF987a4cED8A067d799',
|
|
784
|
+
oracleType: MorphoBlueOracleType.MARKET_RATE,
|
|
785
|
+
irm: '0x46415998764C29aB2a25CbeA6254146D50D22687',
|
|
786
|
+
lltv: 0.86,
|
|
787
|
+
marketId: '0x67ebd84b2fb39e3bc5a13d97e4c07abe1ea617e40654826e9abce252e95f049e',
|
|
788
|
+
protocolName: 'morpho-blue',
|
|
789
|
+
});
|
|
730
790
|
export const MorphoBlueMarkets = (networkId) => ({
|
|
731
791
|
[MorphoBlueVersions.MorphoBlueWstEthUSDC]: MORPHO_BLUE_WSTETH_USDC(networkId),
|
|
732
792
|
[MorphoBlueVersions.MorphoBlueSDAIUSDC]: MORPHO_BLUE_SDAI_USDC(networkId),
|
|
@@ -751,6 +811,7 @@ export const MorphoBlueMarkets = (networkId) => ({
|
|
|
751
811
|
[MorphoBlueVersions.MorphoBlueCbBTCUSDC_860]: MORPHO_BLUE_CBBTC_USDC_860(networkId),
|
|
752
812
|
[MorphoBlueVersions.MorphoBlueREthEth_945]: MORPHO_BLUE_RETH_ETH_945(networkId),
|
|
753
813
|
[MorphoBlueVersions.MorphoBlueSUSDeUSDC_915]: MORPHO_BLUE_SUSDE_USDC_915(networkId),
|
|
814
|
+
[MorphoBlueVersions.MorphoBlueLBTCWBTC_945]: MORPHO_BLUE_LBTC_WBTC_945(networkId),
|
|
754
815
|
// wstETH/WETH
|
|
755
816
|
[MorphoBlueVersions.MorphoBlueWstEthEth_945]: MORPHO_BLUE_WSTETH_ETH_945(networkId),
|
|
756
817
|
[MorphoBlueVersions.MorphoBlueWstEthEth_945_Exchange_Rate]: MORPHO_BLUE_WSTETH_ETH_945_EXCHANGE_RATE(networkId),
|
|
@@ -775,6 +836,9 @@ export const MorphoBlueMarkets = (networkId) => ({
|
|
|
775
836
|
[MorphoBlueVersions.MorphoBlueREthEth_945_Base]: MORPHO_BLUE_RETH_ETH_945_BASE(networkId),
|
|
776
837
|
[MorphoBlueVersions.MorphoBlueCbBTCEth_915_Base]: MORPHO_BLUE_CBBTC_ETH_915_BASE(networkId),
|
|
777
838
|
[MorphoBlueVersions.MorphoBlueCbBTCUSDC_860_Base]: MORPHO_BLUE_CBBTC_USDC_860_BASE(networkId),
|
|
839
|
+
[MorphoBlueVersions.MorphoBlueCbBTCEURC_860_Base]: MORPHO_BLUE_CBBTC_EURC_860_BASE(networkId),
|
|
840
|
+
[MorphoBlueVersions.MorphoBlueWstEthEURC_860_Base]: MORPHO_BLUE_WSTETH_EURC_860_BASE(networkId),
|
|
841
|
+
[MorphoBlueVersions.MorphoBlueLBTCCbBTC_945_Base]: MORPHO_BLUE_LBTC_CBBTC_945_BASE(networkId),
|
|
778
842
|
// wsuperOETHb/WETH Base
|
|
779
843
|
[MorphoBlueVersions.MorphoBlueWsuperOETHbWETH_915_Base]: MORPHO_BLUE_WSUPEROETHB_WETH_915_BASE(networkId),
|
|
780
844
|
// cbETH/WETH Base
|
package/esm/morphoBlue/index.js
CHANGED
|
@@ -8,30 +8,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
|
-
import { assetAmountInEth,
|
|
11
|
+
import { assetAmountInEth, getAssetInfoByAddress } from '@defisaver/tokens';
|
|
12
12
|
import { NetworkNumber, } from '../types/common';
|
|
13
|
-
import { FeedRegistryContract, MorphoBlueViewContract
|
|
14
|
-
import {
|
|
13
|
+
import { DFSFeedRegistryContract, FeedRegistryContract, MorphoBlueViewContract } from '../contracts';
|
|
14
|
+
import { USD_QUOTE, WAD } from '../constants';
|
|
15
15
|
import { getStakingApy, STAKING_ASSETS } from '../staking';
|
|
16
16
|
import { wethToEth } from '../services/utils';
|
|
17
17
|
import { getBorrowRate, getMorphoBlueAggregatedPositionData, getSupplyRate } from '../helpers/morphoBlueHelpers';
|
|
18
|
+
import { getChainlinkAssetAddress } from '../services/priceService';
|
|
19
|
+
const isMainnetNetwork = (network) => network === NetworkNumber.Eth;
|
|
18
20
|
export function getMorphoBlueMarketData(web3, network, selectedMarket, mainnetWeb3) {
|
|
19
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
22
|
const { loanToken, collateralToken, oracle, irm, lltv, oracleType, } = selectedMarket;
|
|
21
23
|
const lltvInWei = new Dec(lltv).mul(WAD).toString();
|
|
22
24
|
const loanTokenInfo = getAssetInfoByAddress(loanToken, network);
|
|
23
25
|
const collateralTokenInfo = getAssetInfoByAddress(collateralToken, network);
|
|
24
|
-
|
|
25
|
-
if (loanTokenInfo.symbol === 'WETH') {
|
|
26
|
-
const ethAddress = getAssetInfo('ETH').address;
|
|
27
|
-
loanTokenFeedAddress = ethAddress;
|
|
28
|
-
}
|
|
29
|
-
const feedRegistryContract = FeedRegistryContract(mainnetWeb3, NetworkNumber.Eth);
|
|
26
|
+
const loanTokenFeedAddress = getChainlinkAssetAddress(loanTokenInfo.symbol, network);
|
|
30
27
|
const morphoBlueViewContract = MorphoBlueViewContract(web3, network);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
let marketInfo;
|
|
29
|
+
let loanTokenPrice;
|
|
30
|
+
const isTokenUSDA = loanTokenInfo.symbol === 'USDA';
|
|
31
|
+
const isMainnet = isMainnetNetwork(network);
|
|
32
|
+
if (isMainnet) {
|
|
33
|
+
const feedRegistryContract = FeedRegistryContract(mainnetWeb3, NetworkNumber.Eth);
|
|
34
|
+
const [_loanTokenPrice, _marketInfo] = yield Promise.all([
|
|
35
|
+
isTokenUSDA ? Promise.resolve('100000000') : feedRegistryContract.methods.latestAnswer(loanTokenFeedAddress, USD_QUOTE).call(),
|
|
36
|
+
morphoBlueViewContract.methods.getMarketInfoNotTuple(loanToken, collateralToken, oracle, irm, lltvInWei).call(),
|
|
37
|
+
]);
|
|
38
|
+
marketInfo = _marketInfo;
|
|
39
|
+
loanTokenPrice = _loanTokenPrice;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Currently only base network is supported
|
|
43
|
+
const feedRegistryContract = DFSFeedRegistryContract(web3, network);
|
|
44
|
+
const [loanTokenPriceRound, _marketInfo] = yield Promise.all([
|
|
45
|
+
isTokenUSDA ? Promise.resolve({ answer: '100000000' }) // Normalize to match the expected object structure
|
|
46
|
+
: feedRegistryContract.methods.latestRoundData(loanTokenFeedAddress, USD_QUOTE).call(),
|
|
47
|
+
morphoBlueViewContract.methods.getMarketInfoNotTuple(loanToken, collateralToken, oracle, irm, lltvInWei).call(),
|
|
48
|
+
]);
|
|
49
|
+
marketInfo = _marketInfo;
|
|
50
|
+
loanTokenPrice = loanTokenPriceRound.answer;
|
|
51
|
+
}
|
|
35
52
|
const supplyRate = getSupplyRate(marketInfo.totalSupplyAssets, marketInfo.totalBorrowAssets, marketInfo.borrowRate, marketInfo.fee);
|
|
36
53
|
const compoundedBorrowRate = getBorrowRate(marketInfo.borrowRate, marketInfo.totalBorrowShares);
|
|
37
54
|
const utillization = new Dec(marketInfo.totalBorrowAssets).div(marketInfo.totalSupplyAssets).mul(100).toString();
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import Web3 from 'web3';
|
|
2
|
+
import { NetworkNumber } from '../types/common';
|
|
2
3
|
export declare const getEthPrice: (web3: Web3) => Promise<string>;
|
|
3
4
|
export declare const getUSDCPrice: (web3: Web3) => Promise<string>;
|
|
4
5
|
export declare const getCompPrice: (web3: Web3) => Promise<string>;
|
|
6
|
+
export declare const getWstETHPrice: (web3: Web3) => Promise<string>;
|
|
7
|
+
export declare const getChainlinkAssetAddress: (symbol: string, network: NetworkNumber) => string;
|
|
@@ -8,8 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import Dec from 'decimal.js';
|
|
11
|
-
import {
|
|
11
|
+
import { getAssetInfo } from '@defisaver/tokens';
|
|
12
|
+
import { COMPPriceFeedContract, ETHPriceFeedContract, USDCPriceFeedContract, WstETHPriceFeedContract, } from '../contracts';
|
|
12
13
|
import { NetworkNumber } from '../types/common';
|
|
14
|
+
import { multicall } from '../multicall';
|
|
13
15
|
export const getEthPrice = (web3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
16
|
const contract = ETHPriceFeedContract(web3, NetworkNumber.Eth);
|
|
15
17
|
const price = yield contract.methods.latestAnswer().call();
|
|
@@ -25,3 +27,31 @@ export const getCompPrice = (web3) => __awaiter(void 0, void 0, void 0, function
|
|
|
25
27
|
const price = yield contract.methods.latestAnswer().call();
|
|
26
28
|
return new Dec(price).div(1e8).toString();
|
|
27
29
|
});
|
|
30
|
+
export const getWstETHPrice = (web3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
+
const wstETHFeedContract = WstETHPriceFeedContract(web3, NetworkNumber.Eth);
|
|
32
|
+
const ethFeedContract = ETHPriceFeedContract(web3, NetworkNumber.Eth);
|
|
33
|
+
const calls = [
|
|
34
|
+
{
|
|
35
|
+
target: ethFeedContract.options.address,
|
|
36
|
+
abiItem: ethFeedContract.options.jsonInterface.find(({ name }) => name === 'latestAnswer'),
|
|
37
|
+
params: [],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
target: wstETHFeedContract.options.address,
|
|
41
|
+
abiItem: wstETHFeedContract.options.jsonInterface.find(({ name }) => name === 'latestRoundData'),
|
|
42
|
+
params: [],
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
const multicallRes = yield multicall(calls, web3);
|
|
46
|
+
const ethPrice = new Dec(multicallRes[0][0]).div(1e8);
|
|
47
|
+
const wstETHRate = new Dec(multicallRes[1].answer).div(1e8);
|
|
48
|
+
return new Dec(ethPrice).mul(wstETHRate).toString();
|
|
49
|
+
});
|
|
50
|
+
// chainlink price feed available only on mainnet
|
|
51
|
+
export const getChainlinkAssetAddress = (symbol, network) => {
|
|
52
|
+
if (['WBTC', 'RENBTC'].includes(symbol === null || symbol === void 0 ? void 0 : symbol.toUpperCase()))
|
|
53
|
+
return '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB';
|
|
54
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.toUpperCase()) === 'WETH')
|
|
55
|
+
return getAssetInfo('ETH').addresses[network];
|
|
56
|
+
return getAssetInfo(symbol).addresses[network];
|
|
57
|
+
};
|
package/esm/types/compound.d.ts
CHANGED
|
@@ -5,7 +5,9 @@ export declare enum CompoundVersions {
|
|
|
5
5
|
'CompoundV3USDCe' = "v3-USDC.e",
|
|
6
6
|
'CompoundV3ETH' = "v3-ETH",
|
|
7
7
|
'CompoundV3USDbC' = "v3-USDbC",
|
|
8
|
-
'CompoundV3USDT' = "v3-USDT"
|
|
8
|
+
'CompoundV3USDT' = "v3-USDT",
|
|
9
|
+
'CompoundV3USDS' = "v3-USDS",
|
|
10
|
+
'CompoundV3wstETH' = "v3-wstETH"
|
|
9
11
|
}
|
|
10
12
|
export interface CompoundBulkerOptions {
|
|
11
13
|
supply: number | string;
|
package/esm/types/compound.js
CHANGED
|
@@ -6,4 +6,6 @@ export var CompoundVersions;
|
|
|
6
6
|
CompoundVersions["CompoundV3ETH"] = "v3-ETH";
|
|
7
7
|
CompoundVersions["CompoundV3USDbC"] = "v3-USDbC";
|
|
8
8
|
CompoundVersions["CompoundV3USDT"] = "v3-USDT";
|
|
9
|
+
CompoundVersions["CompoundV3USDS"] = "v3-USDS";
|
|
10
|
+
CompoundVersions["CompoundV3wstETH"] = "v3-wstETH";
|
|
9
11
|
})(CompoundVersions || (CompoundVersions = {}));
|