@defisaver/positions-sdk 0.0.123 → 0.0.125
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/README.md +63 -63
- package/cjs/compoundV3/index.js +1 -1
- package/cjs/markets/morphoBlue/index.js +36 -36
- package/esm/compoundV3/index.js +2 -2
- package/esm/markets/morphoBlue/index.js +36 -36
- package/package.json +41 -41
- package/src/aaveV2/index.ts +227 -227
- package/src/aaveV3/index.ts +578 -578
- package/src/assets/index.ts +60 -60
- package/src/chickenBonds/index.ts +123 -123
- package/src/compoundV2/index.ts +219 -219
- package/src/compoundV3/index.ts +277 -277
- package/src/config/contracts.js +994 -994
- package/src/constants/index.ts +6 -6
- package/src/contracts.ts +128 -128
- package/src/curveUsd/index.ts +229 -229
- package/src/exchange/index.ts +17 -17
- package/src/helpers/aaveHelpers/index.ts +190 -190
- 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/index.ts +7 -7
- package/src/helpers/llamaLendHelpers/index.ts +53 -53
- package/src/helpers/makerHelpers/index.ts +94 -94
- package/src/helpers/morphoBlueHelpers/index.ts +115 -115
- package/src/helpers/sparkHelpers/index.ts +150 -150
- package/src/index.ts +46 -46
- 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 +132 -132
- package/src/markets/aave/marketAssets.ts +39 -39
- package/src/markets/compound/index.ts +173 -173
- package/src/markets/compound/marketsAssets.ts +64 -64
- package/src/markets/curveUsd/index.ts +69 -69
- package/src/markets/index.ts +21 -21
- package/src/markets/llamaLend/contractAddresses.ts +141 -141
- package/src/markets/llamaLend/index.ts +235 -235
- package/src/markets/morphoBlue/index.ts +611 -611
- package/src/markets/spark/index.ts +29 -29
- package/src/markets/spark/marketAssets.ts +10 -10
- package/src/moneymarket/moneymarketCommonService.ts +76 -76
- package/src/morphoAaveV2/index.ts +256 -256
- package/src/morphoAaveV3/index.ts +612 -612
- package/src/morphoBlue/index.ts +171 -171
- package/src/multicall/index.ts +22 -22
- package/src/services/dsrService.ts +15 -15
- package/src/services/priceService.ts +21 -21
- package/src/services/utils.ts +51 -51
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +424 -424
- package/src/staking/staking.ts +189 -189
- package/src/types/aave.ts +258 -258
- package/src/types/chickenBonds.ts +45 -45
- package/src/types/common.ts +84 -84
- package/src/types/compound.ts +129 -129
- package/src/types/curveUsd.ts +118 -118
- package/src/types/index.ts +8 -8
- 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 +139 -139
- package/src/types/spark.ts +106 -106
package/README.md
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
# DeFi Saver Positions SDK
|
|
2
|
-
|
|
3
|
-
Supported protocols:
|
|
4
|
-
- [Maker](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/maker)
|
|
5
|
-
- [Spark](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/spark)
|
|
6
|
-
- [CrvUSD](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/curveUsd)
|
|
7
|
-
- [Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV2)
|
|
8
|
-
- [Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV3)
|
|
9
|
-
- [Morpho Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV2)
|
|
10
|
-
- [Morpho Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV3)
|
|
11
|
-
- [Compound V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV2)
|
|
12
|
-
- [Compound V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV3)
|
|
13
|
-
- [Liquity](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/liquity)
|
|
14
|
-
- [Chicken Bonds](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/chickenBonds)
|
|
15
|
-
|
|
16
|
-
## Setup
|
|
17
|
-
Supported Node version is v10.
|
|
18
|
-
|
|
19
|
-
- run `npm install` (first time)
|
|
20
|
-
- run `npm run build`
|
|
21
|
-
|
|
22
|
-
`build` command will generate contracts and build ejs and esm folders
|
|
23
|
-
|
|
24
|
-
## How to use
|
|
25
|
-
[All available imports](https://github.com/defisaver/defisaver-positions-sdk/blob/main/src/index.ts)
|
|
26
|
-
|
|
27
|
-
This is a Compound V3 example, and every other protocol is similar
|
|
28
|
-
```js
|
|
29
|
-
import Web3 from 'web3';
|
|
30
|
-
import { compoundV3 } from '@defisaver/positions-sdk';
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// every protocol has market data and user data getters
|
|
34
|
-
const {
|
|
35
|
-
getCompoundV3MarketsData,
|
|
36
|
-
getCompoundV3AccountData,
|
|
37
|
-
} = compoundV3;
|
|
38
|
-
|
|
39
|
-
const provider = 'Your RPC provider';
|
|
40
|
-
const web3 = new Web3(provider);
|
|
41
|
-
|
|
42
|
-
const user = '0x123...';
|
|
43
|
-
|
|
44
|
-
const { assetsData } = await getCompoundV3MarketsData(
|
|
45
|
-
web3, // rpc for the network you are using (note: can be tenderly or any other testnet rpc)
|
|
46
|
-
1, // network
|
|
47
|
-
selectedMarket, // market object like in /src/markets/compound/index.ts
|
|
48
|
-
web3, // this must be mainnet rpc - used for getting prices onchain and calculating apys
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const userData = await getCompoundV3AccountData(
|
|
52
|
-
web3,
|
|
53
|
-
1, // network
|
|
54
|
-
userAddress, // EOA or DSProxy
|
|
55
|
-
'', // proxy address of the user, or just empty string if checking for EOA
|
|
56
|
-
{
|
|
57
|
-
selectedMarket, // market object as in /src/markets/compound/index.ts
|
|
58
|
-
assetsData,
|
|
59
|
-
}
|
|
60
|
-
);
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
More examples found [here](https://github.com/defisaver/defisaver-positions-sdk/tree/main/tests)
|
|
1
|
+
# DeFi Saver Positions SDK
|
|
2
|
+
|
|
3
|
+
Supported protocols:
|
|
4
|
+
- [Maker](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/maker)
|
|
5
|
+
- [Spark](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/spark)
|
|
6
|
+
- [CrvUSD](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/curveUsd)
|
|
7
|
+
- [Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV2)
|
|
8
|
+
- [Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/aaveV3)
|
|
9
|
+
- [Morpho Aave V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV2)
|
|
10
|
+
- [Morpho Aave V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/morphoAaveV3)
|
|
11
|
+
- [Compound V2](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV2)
|
|
12
|
+
- [Compound V3](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/compoundV3)
|
|
13
|
+
- [Liquity](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/liquity)
|
|
14
|
+
- [Chicken Bonds](https://github.com/defisaver/defisaver-positions-sdk/tree/main/src/chickenBonds)
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
Supported Node version is v10.
|
|
18
|
+
|
|
19
|
+
- run `npm install` (first time)
|
|
20
|
+
- run `npm run build`
|
|
21
|
+
|
|
22
|
+
`build` command will generate contracts and build ejs and esm folders
|
|
23
|
+
|
|
24
|
+
## How to use
|
|
25
|
+
[All available imports](https://github.com/defisaver/defisaver-positions-sdk/blob/main/src/index.ts)
|
|
26
|
+
|
|
27
|
+
This is a Compound V3 example, and every other protocol is similar
|
|
28
|
+
```js
|
|
29
|
+
import Web3 from 'web3';
|
|
30
|
+
import { compoundV3 } from '@defisaver/positions-sdk';
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// every protocol has market data and user data getters
|
|
34
|
+
const {
|
|
35
|
+
getCompoundV3MarketsData,
|
|
36
|
+
getCompoundV3AccountData,
|
|
37
|
+
} = compoundV3;
|
|
38
|
+
|
|
39
|
+
const provider = 'Your RPC provider';
|
|
40
|
+
const web3 = new Web3(provider);
|
|
41
|
+
|
|
42
|
+
const user = '0x123...';
|
|
43
|
+
|
|
44
|
+
const { assetsData } = await getCompoundV3MarketsData(
|
|
45
|
+
web3, // rpc for the network you are using (note: can be tenderly or any other testnet rpc)
|
|
46
|
+
1, // network
|
|
47
|
+
selectedMarket, // market object like in /src/markets/compound/index.ts
|
|
48
|
+
web3, // this must be mainnet rpc - used for getting prices onchain and calculating apys
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const userData = await getCompoundV3AccountData(
|
|
52
|
+
web3,
|
|
53
|
+
1, // network
|
|
54
|
+
userAddress, // EOA or DSProxy
|
|
55
|
+
'', // proxy address of the user, or just empty string if checking for EOA
|
|
56
|
+
{
|
|
57
|
+
selectedMarket, // market object as in /src/markets/compound/index.ts
|
|
58
|
+
assetsData,
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
More examples found [here](https://github.com/defisaver/defisaver-positions-sdk/tree/main/tests)
|
package/cjs/compoundV3/index.js
CHANGED
|
@@ -24,7 +24,7 @@ const moneymarket_1 = require("../moneymarket");
|
|
|
24
24
|
const compoundHelpers_1 = require("../helpers/compoundHelpers");
|
|
25
25
|
const compound_1 = require("../markets/compound");
|
|
26
26
|
const priceService_1 = require("../services/priceService");
|
|
27
|
-
const getSupportedAssetsAddressesForMarket = (selectedMarket, network) => selectedMarket.collAssets.map(asset => (0, tokens_1.getAssetInfo)(asset, network)).map(addr => addr.address.toLowerCase());
|
|
27
|
+
const getSupportedAssetsAddressesForMarket = (selectedMarket, network) => selectedMarket.collAssets.map(asset => (0, tokens_1.getAssetInfo)((0, utils_1.ethToWeth)(asset), network)).map(addr => addr.address.toLowerCase());
|
|
28
28
|
const getCompoundV3MarketsData = (web3, network, selectedMarket, defaultWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
29
|
const baseAssetPrice = selectedMarket.baseAsset === 'ETH' ? yield (0, priceService_1.getEthPrice)(defaultWeb3) : yield (0, priceService_1.getUSDCPrice)(defaultWeb3);
|
|
30
30
|
const compPrice = yield (0, priceService_1.getCompPrice)(defaultWeb3);
|
|
@@ -6,7 +6,7 @@ const types_1 = require("../../types");
|
|
|
6
6
|
const common_1 = require("../../types/common");
|
|
7
7
|
const MORPHO_BLUE_WSTETH_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
8
8
|
chainIds: [1],
|
|
9
|
-
label: 'Morpho
|
|
9
|
+
label: 'Morpho',
|
|
10
10
|
shortLabel: 'wstETH/USDC',
|
|
11
11
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthUSDC,
|
|
12
12
|
url: 'wstethusdc',
|
|
@@ -22,7 +22,7 @@ const MORPHO_BLUE_WSTETH_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
22
22
|
exports.MORPHO_BLUE_WSTETH_USDC = MORPHO_BLUE_WSTETH_USDC;
|
|
23
23
|
const MORPHO_BLUE_SDAI_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
24
24
|
chainIds: [1],
|
|
25
|
-
label: 'Morpho
|
|
25
|
+
label: 'Morpho',
|
|
26
26
|
shortLabel: 'sDAI/USDC',
|
|
27
27
|
value: types_1.MorphoBlueVersions.MorphoBlueSDAIUSDC,
|
|
28
28
|
url: 'sdaiusdc',
|
|
@@ -38,7 +38,7 @@ const MORPHO_BLUE_SDAI_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
38
38
|
exports.MORPHO_BLUE_SDAI_USDC = MORPHO_BLUE_SDAI_USDC;
|
|
39
39
|
const MORPHO_BLUE_WBTC_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
40
40
|
chainIds: [1],
|
|
41
|
-
label: 'Morpho
|
|
41
|
+
label: 'Morpho',
|
|
42
42
|
shortLabel: 'WBTC/USDC',
|
|
43
43
|
value: types_1.MorphoBlueVersions.MorphoBlueWBTCUSDC,
|
|
44
44
|
url: 'wbtcusdc',
|
|
@@ -54,7 +54,7 @@ const MORPHO_BLUE_WBTC_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
54
54
|
exports.MORPHO_BLUE_WBTC_USDC = MORPHO_BLUE_WBTC_USDC;
|
|
55
55
|
const MORPHO_BLUE_ETH_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
56
56
|
chainIds: [1],
|
|
57
|
-
label: 'Morpho
|
|
57
|
+
label: 'Morpho',
|
|
58
58
|
shortLabel: 'ETH/USDC',
|
|
59
59
|
value: types_1.MorphoBlueVersions.MorphoBlueEthUSDC,
|
|
60
60
|
url: 'ethusdc',
|
|
@@ -70,7 +70,7 @@ const MORPHO_BLUE_ETH_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
70
70
|
exports.MORPHO_BLUE_ETH_USDC = MORPHO_BLUE_ETH_USDC;
|
|
71
71
|
const MORPHO_BLUE_WBTC_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
72
72
|
chainIds: [1],
|
|
73
|
-
label: 'Morpho
|
|
73
|
+
label: 'Morpho',
|
|
74
74
|
shortLabel: 'WBTC/USDT',
|
|
75
75
|
value: types_1.MorphoBlueVersions.MorphoBlueWBTCUSDT,
|
|
76
76
|
url: 'wbtcusdt',
|
|
@@ -86,7 +86,7 @@ const MORPHO_BLUE_WBTC_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
86
86
|
exports.MORPHO_BLUE_WBTC_USDT = MORPHO_BLUE_WBTC_USDT;
|
|
87
87
|
const MORPHO_BLUE_WBTC_PYUSD = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
88
88
|
chainIds: [1],
|
|
89
|
-
label: 'Morpho
|
|
89
|
+
label: 'Morpho',
|
|
90
90
|
shortLabel: 'WBTC/PYUSD',
|
|
91
91
|
value: types_1.MorphoBlueVersions.MorphoBlueWBTCPYUSD,
|
|
92
92
|
url: 'wbtcpyusd',
|
|
@@ -102,7 +102,7 @@ const MORPHO_BLUE_WBTC_PYUSD = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
102
102
|
exports.MORPHO_BLUE_WBTC_PYUSD = MORPHO_BLUE_WBTC_PYUSD;
|
|
103
103
|
const MORPHO_BLUE_WBTC_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
104
104
|
chainIds: [1],
|
|
105
|
-
label: 'Morpho
|
|
105
|
+
label: 'Morpho',
|
|
106
106
|
shortLabel: 'WBTC/ETH',
|
|
107
107
|
value: types_1.MorphoBlueVersions.MorphoBlueWBTCEth,
|
|
108
108
|
url: 'wbtceth',
|
|
@@ -118,7 +118,7 @@ const MORPHO_BLUE_WBTC_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
118
118
|
exports.MORPHO_BLUE_WBTC_ETH = MORPHO_BLUE_WBTC_ETH;
|
|
119
119
|
const MORPHO_BLUE_WSTETH_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
120
120
|
chainIds: [1],
|
|
121
|
-
label: 'Morpho
|
|
121
|
+
label: 'Morpho',
|
|
122
122
|
shortLabel: 'wstETH/USDT',
|
|
123
123
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthUSDT,
|
|
124
124
|
url: 'wstethusdt',
|
|
@@ -134,7 +134,7 @@ const MORPHO_BLUE_WSTETH_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
134
134
|
exports.MORPHO_BLUE_WSTETH_USDT = MORPHO_BLUE_WSTETH_USDT;
|
|
135
135
|
const MORPHO_BLUE_WSTETH_USDA_EXCHANGE_RATE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
136
136
|
chainIds: [1],
|
|
137
|
-
label: 'Morpho
|
|
137
|
+
label: 'Morpho',
|
|
138
138
|
shortLabel: 'wstETH/USDA',
|
|
139
139
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthUSDA_Exchange_Rate,
|
|
140
140
|
url: 'wstethusda',
|
|
@@ -150,7 +150,7 @@ const MORPHO_BLUE_WSTETH_USDA_EXCHANGE_RATE = (networkId = common_1.NetworkNumbe
|
|
|
150
150
|
exports.MORPHO_BLUE_WSTETH_USDA_EXCHANGE_RATE = MORPHO_BLUE_WSTETH_USDA_EXCHANGE_RATE;
|
|
151
151
|
const MORPHO_BLUE_WSTETH_PYUSD = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
152
152
|
chainIds: [1],
|
|
153
|
-
label: 'Morpho
|
|
153
|
+
label: 'Morpho',
|
|
154
154
|
shortLabel: 'wstETH/PYUSD',
|
|
155
155
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthPYUSD,
|
|
156
156
|
url: 'wstethpyusd',
|
|
@@ -166,7 +166,7 @@ const MORPHO_BLUE_WSTETH_PYUSD = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
166
166
|
exports.MORPHO_BLUE_WSTETH_PYUSD = MORPHO_BLUE_WSTETH_PYUSD;
|
|
167
167
|
const MORPHO_BLUE_WEETH_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
168
168
|
chainIds: [1],
|
|
169
|
-
label: 'Morpho
|
|
169
|
+
label: 'Morpho',
|
|
170
170
|
shortLabel: 'weETH/ETH',
|
|
171
171
|
value: types_1.MorphoBlueVersions.MorphoBlueWeEthEth,
|
|
172
172
|
url: 'weetheth',
|
|
@@ -182,7 +182,7 @@ const MORPHO_BLUE_WEETH_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
182
182
|
exports.MORPHO_BLUE_WEETH_ETH = MORPHO_BLUE_WEETH_ETH;
|
|
183
183
|
const MORPHO_BLUE_USDE_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
184
184
|
chainIds: [1],
|
|
185
|
-
label: 'Morpho
|
|
185
|
+
label: 'Morpho',
|
|
186
186
|
shortLabel: 'USDe/USDT',
|
|
187
187
|
value: types_1.MorphoBlueVersions.MorphoBlueUSDeUSDT,
|
|
188
188
|
url: 'usdeusdt',
|
|
@@ -198,7 +198,7 @@ const MORPHO_BLUE_USDE_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
198
198
|
exports.MORPHO_BLUE_USDE_USDT = MORPHO_BLUE_USDE_USDT;
|
|
199
199
|
const MORPHO_BLUE_SUSDE_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
200
200
|
chainIds: [1],
|
|
201
|
-
label: 'Morpho
|
|
201
|
+
label: 'Morpho',
|
|
202
202
|
shortLabel: 'sUSDe/USDT',
|
|
203
203
|
value: types_1.MorphoBlueVersions.MorphoBlueSUSDeUSDT,
|
|
204
204
|
url: 'susdeusdt',
|
|
@@ -214,7 +214,7 @@ const MORPHO_BLUE_SUSDE_USDT = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
214
214
|
exports.MORPHO_BLUE_SUSDE_USDT = MORPHO_BLUE_SUSDE_USDT;
|
|
215
215
|
const MORPHO_BLUE_SDAI_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
216
216
|
chainIds: [1],
|
|
217
|
-
label: 'Morpho
|
|
217
|
+
label: 'Morpho',
|
|
218
218
|
shortLabel: 'sDAI/ETH',
|
|
219
219
|
value: types_1.MorphoBlueVersions.MorphoBlueSDAIEth,
|
|
220
220
|
url: 'sdaieth',
|
|
@@ -230,7 +230,7 @@ const MORPHO_BLUE_SDAI_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
230
230
|
exports.MORPHO_BLUE_SDAI_ETH = MORPHO_BLUE_SDAI_ETH;
|
|
231
231
|
const MORPHO_BLUE_EZETH_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
232
232
|
chainIds: [1],
|
|
233
|
-
label: 'Morpho
|
|
233
|
+
label: 'Morpho',
|
|
234
234
|
shortLabel: 'ezETH/ETH',
|
|
235
235
|
value: types_1.MorphoBlueVersions.MorphoBlueEzEthEth,
|
|
236
236
|
url: 'ezetheth',
|
|
@@ -246,7 +246,7 @@ const MORPHO_BLUE_EZETH_ETH = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
246
246
|
exports.MORPHO_BLUE_EZETH_ETH = MORPHO_BLUE_EZETH_ETH;
|
|
247
247
|
const MORPHO_BLUE_MKR_USDC = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
248
248
|
chainIds: [1],
|
|
249
|
-
label: 'Morpho
|
|
249
|
+
label: 'Morpho',
|
|
250
250
|
shortLabel: 'MKR/USDC',
|
|
251
251
|
value: types_1.MorphoBlueVersions.MorphoBlueMKRUSDC,
|
|
252
252
|
url: 'mkrusdc',
|
|
@@ -263,7 +263,7 @@ exports.MORPHO_BLUE_MKR_USDC = MORPHO_BLUE_MKR_USDC;
|
|
|
263
263
|
// wstETH/WETH
|
|
264
264
|
const MORPHO_BLUE_WSTETH_ETH_945 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
265
265
|
chainIds: [1],
|
|
266
|
-
label: 'Morpho
|
|
266
|
+
label: 'Morpho',
|
|
267
267
|
shortLabel: 'wstETH/ETH',
|
|
268
268
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthEth_945,
|
|
269
269
|
url: 'wstetheth-c54d7acf',
|
|
@@ -279,7 +279,7 @@ const MORPHO_BLUE_WSTETH_ETH_945 = (networkId = common_1.NetworkNumber.Eth) => (
|
|
|
279
279
|
exports.MORPHO_BLUE_WSTETH_ETH_945 = MORPHO_BLUE_WSTETH_ETH_945;
|
|
280
280
|
const MORPHO_BLUE_WSTETH_ETH_945_EXCHANGE_RATE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
281
281
|
chainIds: [1],
|
|
282
|
-
label: 'Morpho
|
|
282
|
+
label: 'Morpho',
|
|
283
283
|
shortLabel: 'wstETH/ETH',
|
|
284
284
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthEth_945_Exchange_Rate,
|
|
285
285
|
url: 'wstetheth-d0e50cda',
|
|
@@ -295,7 +295,7 @@ const MORPHO_BLUE_WSTETH_ETH_945_EXCHANGE_RATE = (networkId = common_1.NetworkNu
|
|
|
295
295
|
exports.MORPHO_BLUE_WSTETH_ETH_945_EXCHANGE_RATE = MORPHO_BLUE_WSTETH_ETH_945_EXCHANGE_RATE;
|
|
296
296
|
const MORPHO_BLUE_WSTETH_ETH_965_EXCHANGE_RATE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
297
297
|
chainIds: [1],
|
|
298
|
-
label: 'Morpho
|
|
298
|
+
label: 'Morpho',
|
|
299
299
|
shortLabel: 'wstETH/ETH',
|
|
300
300
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthEth_965_Exchange_Rate,
|
|
301
301
|
url: 'wstetheth-b8fc70e8',
|
|
@@ -312,7 +312,7 @@ exports.MORPHO_BLUE_WSTETH_ETH_965_EXCHANGE_RATE = MORPHO_BLUE_WSTETH_ETH_965_EX
|
|
|
312
312
|
// sUSDe/DAI
|
|
313
313
|
const MORPHO_BLUE_SUSDE_DAI_770 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
314
314
|
chainIds: [1],
|
|
315
|
-
label: 'Morpho
|
|
315
|
+
label: 'Morpho',
|
|
316
316
|
shortLabel: 'sUSDe/DAI',
|
|
317
317
|
value: types_1.MorphoBlueVersions.MorphoBlueSUSDeDAI_770,
|
|
318
318
|
url: 'susdedai-42dcfb38',
|
|
@@ -328,7 +328,7 @@ const MORPHO_BLUE_SUSDE_DAI_770 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
328
328
|
exports.MORPHO_BLUE_SUSDE_DAI_770 = MORPHO_BLUE_SUSDE_DAI_770;
|
|
329
329
|
const MORPHO_BLUE_SUSDE_DAI_860 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
330
330
|
chainIds: [1],
|
|
331
|
-
label: 'Morpho
|
|
331
|
+
label: 'Morpho',
|
|
332
332
|
shortLabel: 'sUSDe/DAI',
|
|
333
333
|
value: types_1.MorphoBlueVersions.MorphoBlueSUSDeDAI_860,
|
|
334
334
|
url: 'susdedai-39d11026',
|
|
@@ -344,7 +344,7 @@ const MORPHO_BLUE_SUSDE_DAI_860 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
344
344
|
exports.MORPHO_BLUE_SUSDE_DAI_860 = MORPHO_BLUE_SUSDE_DAI_860;
|
|
345
345
|
const MORPHO_BLUE_SUSDE_DAI_915 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
346
346
|
chainIds: [1],
|
|
347
|
-
label: 'Morpho
|
|
347
|
+
label: 'Morpho',
|
|
348
348
|
shortLabel: 'sUSDe/DAI',
|
|
349
349
|
value: types_1.MorphoBlueVersions.MorphoBlueSUSDeDAI_915,
|
|
350
350
|
url: 'susdedai-1247f1c2',
|
|
@@ -360,7 +360,7 @@ const MORPHO_BLUE_SUSDE_DAI_915 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
360
360
|
exports.MORPHO_BLUE_SUSDE_DAI_915 = MORPHO_BLUE_SUSDE_DAI_915;
|
|
361
361
|
const MORPHO_BLUE_SUSDE_DAI_945 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
362
362
|
chainIds: [1],
|
|
363
|
-
label: 'Morpho
|
|
363
|
+
label: 'Morpho',
|
|
364
364
|
shortLabel: 'sUSDe/DAI',
|
|
365
365
|
value: types_1.MorphoBlueVersions.MorphoBlueSUSDeDAI_945,
|
|
366
366
|
url: 'susdedai-0e475337',
|
|
@@ -377,7 +377,7 @@ exports.MORPHO_BLUE_SUSDE_DAI_945 = MORPHO_BLUE_SUSDE_DAI_945;
|
|
|
377
377
|
// USDe/DAI
|
|
378
378
|
const MORPHO_BLUE_USDE_DAI_770 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
379
379
|
chainIds: [1],
|
|
380
|
-
label: 'Morpho
|
|
380
|
+
label: 'Morpho',
|
|
381
381
|
shortLabel: 'USDe/DAI',
|
|
382
382
|
value: types_1.MorphoBlueVersions.MorphoBlueUSDeDAI_770,
|
|
383
383
|
url: 'usdedai-fd8493f0',
|
|
@@ -393,7 +393,7 @@ const MORPHO_BLUE_USDE_DAI_770 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
393
393
|
exports.MORPHO_BLUE_USDE_DAI_770 = MORPHO_BLUE_USDE_DAI_770;
|
|
394
394
|
const MORPHO_BLUE_USDE_DAI_860 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
395
395
|
chainIds: [1],
|
|
396
|
-
label: 'Morpho
|
|
396
|
+
label: 'Morpho',
|
|
397
397
|
shortLabel: 'USDe/DAI',
|
|
398
398
|
value: types_1.MorphoBlueVersions.MorphoBlueUSDeDAI_860,
|
|
399
399
|
url: 'usdedai-c581c5f7',
|
|
@@ -409,7 +409,7 @@ const MORPHO_BLUE_USDE_DAI_860 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
409
409
|
exports.MORPHO_BLUE_USDE_DAI_860 = MORPHO_BLUE_USDE_DAI_860;
|
|
410
410
|
const MORPHO_BLUE_USDE_DAI_915 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
411
411
|
chainIds: [1],
|
|
412
|
-
label: 'Morpho
|
|
412
|
+
label: 'Morpho',
|
|
413
413
|
shortLabel: 'USDe/DAI',
|
|
414
414
|
value: types_1.MorphoBlueVersions.MorphoBlueUSDeDAI_915,
|
|
415
415
|
url: 'usdedai-8e6aeb10',
|
|
@@ -425,7 +425,7 @@ const MORPHO_BLUE_USDE_DAI_915 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
|
425
425
|
exports.MORPHO_BLUE_USDE_DAI_915 = MORPHO_BLUE_USDE_DAI_915;
|
|
426
426
|
const MORPHO_BLUE_USDE_DAI_945 = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
427
427
|
chainIds: [1],
|
|
428
|
-
label: 'Morpho
|
|
428
|
+
label: 'Morpho',
|
|
429
429
|
shortLabel: 'USDe/DAI',
|
|
430
430
|
value: types_1.MorphoBlueVersions.MorphoBlueUSDeDAI_945,
|
|
431
431
|
url: 'usdedai-db760246',
|
|
@@ -442,7 +442,7 @@ exports.MORPHO_BLUE_USDE_DAI_945 = MORPHO_BLUE_USDE_DAI_945;
|
|
|
442
442
|
// BASE
|
|
443
443
|
const MORPHO_BLUE_CBETH_USDC_860_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
444
444
|
chainIds: [common_1.NetworkNumber.Base],
|
|
445
|
-
label: 'Morpho
|
|
445
|
+
label: 'Morpho',
|
|
446
446
|
shortLabel: 'cbETH/USDC',
|
|
447
447
|
value: types_1.MorphoBlueVersions.MorphoBlueCbEthUSDC_860_Base,
|
|
448
448
|
url: 'cbethusdc-dba352d9',
|
|
@@ -458,7 +458,7 @@ const MORPHO_BLUE_CBETH_USDC_860_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
458
458
|
exports.MORPHO_BLUE_CBETH_USDC_860_BASE = MORPHO_BLUE_CBETH_USDC_860_BASE;
|
|
459
459
|
const MORPHO_BLUE_WSTETH_ETH_945_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
460
460
|
chainIds: [common_1.NetworkNumber.Base],
|
|
461
|
-
label: 'Morpho
|
|
461
|
+
label: 'Morpho',
|
|
462
462
|
shortLabel: 'wstETH/ETH',
|
|
463
463
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthEth_945_Base,
|
|
464
464
|
url: 'wstetheth-3a4048c6',
|
|
@@ -474,7 +474,7 @@ const MORPHO_BLUE_WSTETH_ETH_945_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
474
474
|
exports.MORPHO_BLUE_WSTETH_ETH_945_BASE = MORPHO_BLUE_WSTETH_ETH_945_BASE;
|
|
475
475
|
const MORPHO_BLUE_WSTETH_ETH_965_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
476
476
|
chainIds: [common_1.NetworkNumber.Base],
|
|
477
|
-
label: 'Morpho
|
|
477
|
+
label: 'Morpho',
|
|
478
478
|
shortLabel: 'wstETH/ETH',
|
|
479
479
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthEth_965_Base,
|
|
480
480
|
url: 'wstetheth-6aa81f51',
|
|
@@ -490,7 +490,7 @@ const MORPHO_BLUE_WSTETH_ETH_965_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
490
490
|
exports.MORPHO_BLUE_WSTETH_ETH_965_BASE = MORPHO_BLUE_WSTETH_ETH_965_BASE;
|
|
491
491
|
const MORPHO_BLUE_WSTETH_USDC_860_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
492
492
|
chainIds: [common_1.NetworkNumber.Base],
|
|
493
|
-
label: 'Morpho
|
|
493
|
+
label: 'Morpho',
|
|
494
494
|
shortLabel: 'wstETH/USDC',
|
|
495
495
|
value: types_1.MorphoBlueVersions.MorphoBlueWstEthUSDC_860_Base,
|
|
496
496
|
url: 'wstethusdc-a066f389',
|
|
@@ -506,7 +506,7 @@ const MORPHO_BLUE_WSTETH_USDC_860_BASE = (networkId = common_1.NetworkNumber.Eth
|
|
|
506
506
|
exports.MORPHO_BLUE_WSTETH_USDC_860_BASE = MORPHO_BLUE_WSTETH_USDC_860_BASE;
|
|
507
507
|
const MORPHO_BLUE_CBETH_ETH_965_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
508
508
|
chainIds: [common_1.NetworkNumber.Base],
|
|
509
|
-
label: 'Morpho
|
|
509
|
+
label: 'Morpho',
|
|
510
510
|
shortLabel: 'cbETH/ETH',
|
|
511
511
|
value: types_1.MorphoBlueVersions.MorphoBlueCbEthEth_965_Base,
|
|
512
512
|
url: 'cbetheth-6600aae6',
|
|
@@ -522,7 +522,7 @@ const MORPHO_BLUE_CBETH_ETH_965_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
522
522
|
exports.MORPHO_BLUE_CBETH_ETH_965_BASE = MORPHO_BLUE_CBETH_ETH_965_BASE;
|
|
523
523
|
const MORPHO_BLUE_CBETH_ETH_945_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
524
524
|
chainIds: [common_1.NetworkNumber.Base],
|
|
525
|
-
label: 'Morpho
|
|
525
|
+
label: 'Morpho',
|
|
526
526
|
shortLabel: 'cbETH/ETH',
|
|
527
527
|
value: types_1.MorphoBlueVersions.MorphoBlueCbEthEth_945_Base,
|
|
528
528
|
url: 'cbetheth-84662b4f',
|
|
@@ -538,7 +538,7 @@ const MORPHO_BLUE_CBETH_ETH_945_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
538
538
|
exports.MORPHO_BLUE_CBETH_ETH_945_BASE = MORPHO_BLUE_CBETH_ETH_945_BASE;
|
|
539
539
|
const MORPHO_BLUE_ETH_USDC_860_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
540
540
|
chainIds: [common_1.NetworkNumber.Base],
|
|
541
|
-
label: 'Morpho
|
|
541
|
+
label: 'Morpho',
|
|
542
542
|
shortLabel: 'ETH/USDC',
|
|
543
543
|
value: types_1.MorphoBlueVersions.MorphoBlueEthUSDC_860_Base,
|
|
544
544
|
url: 'ethusdc-8793cf30',
|
|
@@ -554,7 +554,7 @@ const MORPHO_BLUE_ETH_USDC_860_BASE = (networkId = common_1.NetworkNumber.Eth) =
|
|
|
554
554
|
exports.MORPHO_BLUE_ETH_USDC_860_BASE = MORPHO_BLUE_ETH_USDC_860_BASE;
|
|
555
555
|
const MORPHO_BLUE_RETH_USDC_860_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
556
556
|
chainIds: [common_1.NetworkNumber.Base],
|
|
557
|
-
label: 'Morpho
|
|
557
|
+
label: 'Morpho',
|
|
558
558
|
shortLabel: 'rETH/USDC',
|
|
559
559
|
value: types_1.MorphoBlueVersions.MorphoBlueREthUSDC_860_Base,
|
|
560
560
|
url: 'rethusdc-db0bc9f1',
|
|
@@ -570,7 +570,7 @@ const MORPHO_BLUE_RETH_USDC_860_BASE = (networkId = common_1.NetworkNumber.Eth)
|
|
|
570
570
|
exports.MORPHO_BLUE_RETH_USDC_860_BASE = MORPHO_BLUE_RETH_USDC_860_BASE;
|
|
571
571
|
const MORPHO_BLUE_RETH_ETH_945_BASE = (networkId = common_1.NetworkNumber.Eth) => ({
|
|
572
572
|
chainIds: [common_1.NetworkNumber.Base],
|
|
573
|
-
label: 'Morpho
|
|
573
|
+
label: 'Morpho',
|
|
574
574
|
shortLabel: 'rETH/ETH',
|
|
575
575
|
value: types_1.MorphoBlueVersions.MorphoBlueREthEth_945_Base,
|
|
576
576
|
url: 'retheth-dc69cf2c',
|
package/esm/compoundV3/index.js
CHANGED
|
@@ -12,13 +12,13 @@ import { assetAmountInEth, assetAmountInWei, getAssetInfo, getAssetInfoByAddress
|
|
|
12
12
|
import { CompV3ViewContract } from '../contracts';
|
|
13
13
|
import { multicall } from '../multicall';
|
|
14
14
|
import { getStakingApy, getStETHByWstETHMultiple, getWstETHByStETH, STAKING_ASSETS, } from '../staking';
|
|
15
|
-
import { wethToEth } from '../services/utils';
|
|
15
|
+
import { ethToWeth, wethToEth } from '../services/utils';
|
|
16
16
|
import { ZERO_ADDRESS } from '../constants';
|
|
17
17
|
import { calculateBorrowingAssetLimit } from '../moneymarket';
|
|
18
18
|
import { formatBaseData, formatMarketData, getCompoundV3AggregatedData, getIncentiveApys, } from '../helpers/compoundHelpers';
|
|
19
19
|
import { COMPOUND_V3_ETH, COMPOUND_V3_USDBC, COMPOUND_V3_USDC } from '../markets/compound';
|
|
20
20
|
import { getEthPrice, getCompPrice, getUSDCPrice } from '../services/priceService';
|
|
21
|
-
const getSupportedAssetsAddressesForMarket = (selectedMarket, network) => selectedMarket.collAssets.map(asset => getAssetInfo(asset, network)).map(addr => addr.address.toLowerCase());
|
|
21
|
+
const getSupportedAssetsAddressesForMarket = (selectedMarket, network) => selectedMarket.collAssets.map(asset => getAssetInfo(ethToWeth(asset), network)).map(addr => addr.address.toLowerCase());
|
|
22
22
|
export const getCompoundV3MarketsData = (web3, network, selectedMarket, defaultWeb3) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
const baseAssetPrice = selectedMarket.baseAsset === 'ETH' ? yield getEthPrice(defaultWeb3) : yield getUSDCPrice(defaultWeb3);
|
|
24
24
|
const compPrice = yield getCompPrice(defaultWeb3);
|