@defisaver/positions-sdk 0.0.9 → 0.0.11

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 (54) hide show
  1. package/cjs/compoundV3/index.js +1 -1
  2. package/cjs/helpers/compoundHelpers/index.js +2 -1
  3. package/esm/compoundV3/index.js +1 -1
  4. package/esm/helpers/compoundHelpers/index.js +2 -1
  5. package/package.json +40 -40
  6. package/src/aaveV2/index.ts +220 -220
  7. package/src/aaveV3/index.ts +550 -550
  8. package/src/assets/index.ts +60 -60
  9. package/src/chickenBonds/index.ts +123 -123
  10. package/src/compoundV2/index.ts +206 -206
  11. package/src/compoundV3/index.ts +269 -269
  12. package/src/config/contracts.js +619 -619
  13. package/src/constants/index.ts +3 -3
  14. package/src/contracts.ts +100 -100
  15. package/src/curveUsd/index.ts +228 -228
  16. package/src/exchange/index.ts +17 -17
  17. package/src/helpers/aaveHelpers/index.ts +134 -134
  18. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  19. package/src/helpers/compoundHelpers/index.ts +181 -180
  20. package/src/helpers/curveUsdHelpers/index.ts +32 -32
  21. package/src/helpers/index.ts +5 -5
  22. package/src/helpers/makerHelpers/index.ts +94 -94
  23. package/src/helpers/sparkHelpers/index.ts +106 -106
  24. package/src/index.ts +40 -40
  25. package/src/liquity/index.ts +103 -103
  26. package/src/maker/index.ts +101 -101
  27. package/src/markets/aave/index.ts +80 -80
  28. package/src/markets/aave/marketAssets.ts +32 -32
  29. package/src/markets/compound/index.ts +85 -85
  30. package/src/markets/compound/marketsAssets.ts +35 -35
  31. package/src/markets/curveUsd/index.ts +42 -42
  32. package/src/markets/index.ts +3 -3
  33. package/src/markets/spark/index.ts +29 -29
  34. package/src/markets/spark/marketAssets.ts +9 -9
  35. package/src/moneymarket/moneymarketCommonService.ts +75 -75
  36. package/src/morpho/markets.ts +39 -39
  37. package/src/morphoAaveV2/index.ts +254 -254
  38. package/src/morphoAaveV3/index.ts +614 -614
  39. package/src/multicall/index.ts +22 -22
  40. package/src/services/dsrService.ts +15 -15
  41. package/src/services/priceService.ts +21 -21
  42. package/src/services/utils.ts +34 -34
  43. package/src/spark/index.ts +413 -413
  44. package/src/staking/staking.ts +167 -167
  45. package/src/types/aave.ts +256 -256
  46. package/src/types/chickenBonds.ts +45 -45
  47. package/src/types/common.ts +83 -83
  48. package/src/types/compound.ts +121 -121
  49. package/src/types/curveUsd.ts +110 -110
  50. package/src/types/index.ts +6 -6
  51. package/src/types/liquity.ts +29 -29
  52. package/src/types/maker.ts +50 -50
  53. package/src/types/spark.ts +106 -106
  54. package/yarn-error.log +0 -64
@@ -1,102 +1,102 @@
1
- import Web3 from 'web3';
2
- import Dec from 'decimal.js';
3
- import { assetAmountInEth, getAssetInfo, ilkToAsset } from '@defisaver/tokens';
4
- import { Blockish, NetworkNumber, PositionBalances } from '../types/common';
5
- import { McdViewContract } from '../contracts';
6
- import { makerHelpers } from '../helpers';
7
- import { CdpData } from '../types';
8
- import { wethToEth } from '../services/utils';
9
-
10
- export const getMakerAccountBalances = async (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string): Promise<PositionBalances> => {
11
- let balances: PositionBalances = {
12
- collateral: {},
13
- debt: {},
14
- };
15
-
16
- if (!cdpId) {
17
- return balances;
18
- }
19
-
20
- const viewContract = McdViewContract(web3, network, block);
21
- // @ts-ignore
22
- const cdpInfo = await viewContract.methods.getCdpInfo(cdpId).call({}, block);
23
- const ilkInfo = await makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network, block);
24
-
25
- const asset = wethToEth(ilkToAsset(cdpInfo.ilk));
26
-
27
- balances = {
28
- collateral: {
29
- [addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new Dec(cdpInfo.collateral).div(1e10).floor().toString() : cdpInfo.collateral,
30
- },
31
- debt: {
32
- [addressMapping ? getAssetInfo('DAI', network).address.toLowerCase() : 'DAI']: new Dec(cdpInfo.debt).times(ilkInfo.currentRate).div(1e27).floor()
33
- .toString(),
34
- },
35
- };
36
-
37
- return balances;
38
- };
39
-
40
- export const getMakerCdpData = async (web3: Web3, network: NetworkNumber, cdpId: string): Promise<CdpData> => {
41
- const viewContract = McdViewContract(web3, network);
42
-
43
- // @ts-ignore
44
- const cdpInfo = await viewContract.methods.getCdpInfo(cdpId).call();
45
-
46
- const [ilkInfo, coll] = await Promise.all([
47
- makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network),
48
- makerHelpers.getUnclaimedCollateral(web3, network, cdpInfo.urn, cdpInfo.ilk),
49
- ]);
50
-
51
- const asset = ilkToAsset(cdpInfo.ilk);
52
-
53
- const collateralUsd = new Dec(cdpInfo.collateral).mul(ilkInfo.assetPrice).floor().toString();
54
- const debt = new Dec(cdpInfo.debt).times(ilkInfo.currentRate).div(1e27).floor()
55
- .toString();
56
- const futureDebt = new Dec(cdpInfo.debt).times(ilkInfo.futureRate).div(1e27).floor()
57
- .toString(); // after drip
58
- const debtDripDelta = assetAmountInEth(new Dec(futureDebt).sub(debt).toString(), 'DAI');
59
- const liquidationPrice = new Dec(debt).times(ilkInfo.liqRatio).div(cdpInfo.collateral).toString();
60
-
61
- let ratio = new Dec(cdpInfo.collateral).times(ilkInfo.assetPrice).div(debt).times(100)
62
- .toString();
63
- if (new Dec(debt).eq(0)) ratio = '0';
64
-
65
- const debtTooLow = new Dec(debt).gt(0) && new Dec(assetAmountInEth(debt, 'DAI')).lt(ilkInfo.minDebt);
66
-
67
- const par = '1';
68
- return {
69
- owner: cdpInfo.owner,
70
- userAddress: cdpInfo.userAddr,
71
- id: cdpId,
72
- urn: cdpInfo.urn,
73
- type: 'mcd',
74
- ilk: cdpInfo.ilk,
75
- ilkLabel: ilkInfo.ilkLabel,
76
- asset,
77
- collateral: assetAmountInEth(cdpInfo.collateral, `MCD-${asset}`),
78
- collateralUsd: assetAmountInEth(collateralUsd, `MCD-${asset}`),
79
- futureDebt: assetAmountInEth(futureDebt, 'DAI'),
80
- debtDai: assetAmountInEth(debt, 'DAI'),
81
- debtUsd: assetAmountInEth(debt, 'DAI'),
82
- debtInAsset: assetAmountInEth(debt, 'DAI'),
83
- debtAssetPrice: par,
84
- debtAssetMarketPrice: par,
85
- liquidationPrice,
86
- ratio,
87
- liqRatio: ilkInfo.liqRatio.toString(),
88
- liqPercent: parseFloat(ilkInfo.liqPercent.toString()),
89
- assetPrice: ilkInfo.assetPrice,
90
- daiLabel: 'DAI',
91
- debtAsset: 'DAI',
92
- unclaimedCollateral: assetAmountInEth(coll, asset),
93
- debtTooLow,
94
- minDebt: ilkInfo.minDebt,
95
- stabilityFee: ilkInfo.stabilityFee,
96
- creatableDebt: ilkInfo.creatableDebt,
97
- globalDebtCeiling: ilkInfo.globalDebtCeiling,
98
- globalDebtCurrent: ilkInfo.globalDebtCurrent,
99
- liquidationFee: ilkInfo.liquidationFee,
100
- lastUpdated: Date.now(),
101
- };
1
+ import Web3 from 'web3';
2
+ import Dec from 'decimal.js';
3
+ import { assetAmountInEth, getAssetInfo, ilkToAsset } from '@defisaver/tokens';
4
+ import { Blockish, NetworkNumber, PositionBalances } from '../types/common';
5
+ import { McdViewContract } from '../contracts';
6
+ import { makerHelpers } from '../helpers';
7
+ import { CdpData } from '../types';
8
+ import { wethToEth } from '../services/utils';
9
+
10
+ export const getMakerAccountBalances = async (web3: Web3, network: NetworkNumber, block: Blockish, addressMapping: boolean, cdpId: string): Promise<PositionBalances> => {
11
+ let balances: PositionBalances = {
12
+ collateral: {},
13
+ debt: {},
14
+ };
15
+
16
+ if (!cdpId) {
17
+ return balances;
18
+ }
19
+
20
+ const viewContract = McdViewContract(web3, network, block);
21
+ // @ts-ignore
22
+ const cdpInfo = await viewContract.methods.getCdpInfo(cdpId).call({}, block);
23
+ const ilkInfo = await makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network, block);
24
+
25
+ const asset = wethToEth(ilkToAsset(cdpInfo.ilk));
26
+
27
+ balances = {
28
+ collateral: {
29
+ [addressMapping ? getAssetInfo(asset, network).address.toLowerCase() : asset]: asset === 'WBTC' ? new Dec(cdpInfo.collateral).div(1e10).floor().toString() : cdpInfo.collateral,
30
+ },
31
+ debt: {
32
+ [addressMapping ? getAssetInfo('DAI', network).address.toLowerCase() : 'DAI']: new Dec(cdpInfo.debt).times(ilkInfo.currentRate).div(1e27).floor()
33
+ .toString(),
34
+ },
35
+ };
36
+
37
+ return balances;
38
+ };
39
+
40
+ export const getMakerCdpData = async (web3: Web3, network: NetworkNumber, cdpId: string): Promise<CdpData> => {
41
+ const viewContract = McdViewContract(web3, network);
42
+
43
+ // @ts-ignore
44
+ const cdpInfo = await viewContract.methods.getCdpInfo(cdpId).call();
45
+
46
+ const [ilkInfo, coll] = await Promise.all([
47
+ makerHelpers.getCollateralInfo(cdpInfo.ilk, web3, network),
48
+ makerHelpers.getUnclaimedCollateral(web3, network, cdpInfo.urn, cdpInfo.ilk),
49
+ ]);
50
+
51
+ const asset = ilkToAsset(cdpInfo.ilk);
52
+
53
+ const collateralUsd = new Dec(cdpInfo.collateral).mul(ilkInfo.assetPrice).floor().toString();
54
+ const debt = new Dec(cdpInfo.debt).times(ilkInfo.currentRate).div(1e27).floor()
55
+ .toString();
56
+ const futureDebt = new Dec(cdpInfo.debt).times(ilkInfo.futureRate).div(1e27).floor()
57
+ .toString(); // after drip
58
+ const debtDripDelta = assetAmountInEth(new Dec(futureDebt).sub(debt).toString(), 'DAI');
59
+ const liquidationPrice = new Dec(debt).times(ilkInfo.liqRatio).div(cdpInfo.collateral).toString();
60
+
61
+ let ratio = new Dec(cdpInfo.collateral).times(ilkInfo.assetPrice).div(debt).times(100)
62
+ .toString();
63
+ if (new Dec(debt).eq(0)) ratio = '0';
64
+
65
+ const debtTooLow = new Dec(debt).gt(0) && new Dec(assetAmountInEth(debt, 'DAI')).lt(ilkInfo.minDebt);
66
+
67
+ const par = '1';
68
+ return {
69
+ owner: cdpInfo.owner,
70
+ userAddress: cdpInfo.userAddr,
71
+ id: cdpId,
72
+ urn: cdpInfo.urn,
73
+ type: 'mcd',
74
+ ilk: cdpInfo.ilk,
75
+ ilkLabel: ilkInfo.ilkLabel,
76
+ asset,
77
+ collateral: assetAmountInEth(cdpInfo.collateral, `MCD-${asset}`),
78
+ collateralUsd: assetAmountInEth(collateralUsd, `MCD-${asset}`),
79
+ futureDebt: assetAmountInEth(futureDebt, 'DAI'),
80
+ debtDai: assetAmountInEth(debt, 'DAI'),
81
+ debtUsd: assetAmountInEth(debt, 'DAI'),
82
+ debtInAsset: assetAmountInEth(debt, 'DAI'),
83
+ debtAssetPrice: par,
84
+ debtAssetMarketPrice: par,
85
+ liquidationPrice,
86
+ ratio,
87
+ liqRatio: ilkInfo.liqRatio.toString(),
88
+ liqPercent: parseFloat(ilkInfo.liqPercent.toString()),
89
+ assetPrice: ilkInfo.assetPrice,
90
+ daiLabel: 'DAI',
91
+ debtAsset: 'DAI',
92
+ unclaimedCollateral: assetAmountInEth(coll, asset),
93
+ debtTooLow,
94
+ minDebt: ilkInfo.minDebt,
95
+ stabilityFee: ilkInfo.stabilityFee,
96
+ creatableDebt: ilkInfo.creatableDebt,
97
+ globalDebtCeiling: ilkInfo.globalDebtCeiling,
98
+ globalDebtCurrent: ilkInfo.globalDebtCurrent,
99
+ liquidationFee: ilkInfo.liquidationFee,
100
+ lastUpdated: Date.now(),
101
+ };
102
102
  };
@@ -1,80 +1,80 @@
1
- import { getConfigContractAddress } from '../../contracts';
2
- import {
3
- AaveMarketInfo, AaveVersions, MorphoAaveV2MarketInfo, MorphoAaveV3MarketInfo,
4
- } from '../../types';
5
- import { NetworkNumber } from '../../types/common';
6
- import {
7
- aaveV2AssetsDefaultMarket, aaveV3AssetsDefaultMarket, morphoAaveV2AssetDefaultMarket, morphoAaveV3AssetEthMarket,
8
- } from './marketAssets';
9
-
10
- export const AAVE_V2: AaveMarketInfo = {
11
- chainIds: [1],
12
- label: 'Aave v2',
13
- shortLabel: 'v2',
14
- value: AaveVersions.AaveV2,
15
- url: 'default',
16
- assets: aaveV2AssetsDefaultMarket,
17
- provider: 'LendingPoolAddressesProvider',
18
- providerAddress: getConfigContractAddress('LendingPoolAddressesProvider', 1), // rename
19
- lendingPool: 'AaveLendingPoolV2',
20
- lendingPoolAddress: getConfigContractAddress('AaveLendingPoolV2', 1),
21
- protocolData: 'AaveProtocolDataProvider',
22
- protocolDataAddress: getConfigContractAddress('AaveProtocolDataProvider', 1),
23
- // icon: SvgAdapter(protocolIcons.aave),
24
- protocolName: 'aave',
25
- };
26
-
27
- export const AAVE_V3 = (networkId: NetworkNumber): AaveMarketInfo => ({
28
- chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base],
29
- label: 'Aave v3',
30
- shortLabel: 'v3',
31
- value: AaveVersions.AaveV3,
32
- url: 'default',
33
- assets: networkId ? aaveV3AssetsDefaultMarket[networkId] : [],
34
- provider: 'AaveV3PoolAddressesProvider',
35
- providerAddress: getConfigContractAddress('AaveV3PoolAddressesProvider', networkId),
36
- lendingPool: 'AaveV3LendingPool',
37
- lendingPoolAddress: getConfigContractAddress('AaveV3LendingPool', networkId),
38
- protocolData: 'AaveV3ProtocolDataProvider',
39
- protocolDataAddress: getConfigContractAddress('AaveV3ProtocolDataProvider', networkId),
40
- // icon: SvgAdapter(protocolIcons.aave),
41
- protocolName: 'aave',
42
- });
43
-
44
- export const MORPHO_AAVE_V2: MorphoAaveV2MarketInfo = {
45
- chainIds: [1],
46
- label: 'Morpho-Aave V2',
47
- shortLabel: 'morpho-aave-v2',
48
- value: AaveVersions.MorphoAaveV2,
49
- url: '',
50
- assets: morphoAaveV2AssetDefaultMarket,
51
- providerAddress: getConfigContractAddress('LendingPoolAddressesProvider', 1),
52
- lendingPoolAddress: getConfigContractAddress('MorphoAaveV2Proxy', 1),
53
- // icon: SvgAdapter(protocolIcons.morpho),
54
- protocolName: 'morpho',
55
- };
56
-
57
- export const MORPHO_AAVE_V3_ETH = (networkId: NetworkNumber = NetworkNumber.Eth): MorphoAaveV3MarketInfo => ({
58
- chainIds: [1],
59
- label: 'Morpho-Aave V3',
60
- shortLabel: 'morpho-aave-v3',
61
- subVersionLabel: 'ETH Optimizer',
62
- value: AaveVersions.MorphoAaveV3Eth,
63
- url: 'eth-optimizer',
64
- assets: morphoAaveV3AssetEthMarket,
65
- providerAddress: getConfigContractAddress('AaveV3PoolAddressesProvider', networkId), // TODO - check if used and if value is good?
66
- protocolData: 'AaveV3ProtocolDataProvider',
67
- protocolDataAddress: getConfigContractAddress('AaveV3ProtocolDataProvider', networkId),
68
- lendingPool: 'MorphoAaveV3ProxyEthMarket',
69
- lendingPoolAddress: getConfigContractAddress('MorphoAaveV3ProxyEthMarket', 1),
70
- // icon: SvgAdapter(protocolIcons.morpho),
71
- protocolName: 'morpho',
72
- });
73
-
74
-
75
- export const AaveMarkets = (networkId: NetworkNumber) => ({
76
- [AaveVersions.AaveV2]: AAVE_V2,
77
- [AaveVersions.AaveV3]: AAVE_V3(networkId),
78
- [AaveVersions.MorphoAaveV3Eth]: MORPHO_AAVE_V3_ETH(networkId),
79
- [AaveVersions.MorphoAaveV2]: MORPHO_AAVE_V2,
80
- }) as const;
1
+ import { getConfigContractAddress } from '../../contracts';
2
+ import {
3
+ AaveMarketInfo, AaveVersions, MorphoAaveV2MarketInfo, MorphoAaveV3MarketInfo,
4
+ } from '../../types';
5
+ import { NetworkNumber } from '../../types/common';
6
+ import {
7
+ aaveV2AssetsDefaultMarket, aaveV3AssetsDefaultMarket, morphoAaveV2AssetDefaultMarket, morphoAaveV3AssetEthMarket,
8
+ } from './marketAssets';
9
+
10
+ export const AAVE_V2: AaveMarketInfo = {
11
+ chainIds: [1],
12
+ label: 'Aave v2',
13
+ shortLabel: 'v2',
14
+ value: AaveVersions.AaveV2,
15
+ url: 'default',
16
+ assets: aaveV2AssetsDefaultMarket,
17
+ provider: 'LendingPoolAddressesProvider',
18
+ providerAddress: getConfigContractAddress('LendingPoolAddressesProvider', 1), // rename
19
+ lendingPool: 'AaveLendingPoolV2',
20
+ lendingPoolAddress: getConfigContractAddress('AaveLendingPoolV2', 1),
21
+ protocolData: 'AaveProtocolDataProvider',
22
+ protocolDataAddress: getConfigContractAddress('AaveProtocolDataProvider', 1),
23
+ // icon: SvgAdapter(protocolIcons.aave),
24
+ protocolName: 'aave',
25
+ };
26
+
27
+ export const AAVE_V3 = (networkId: NetworkNumber): AaveMarketInfo => ({
28
+ chainIds: [NetworkNumber.Eth, NetworkNumber.Opt, NetworkNumber.Arb, NetworkNumber.Base],
29
+ label: 'Aave v3',
30
+ shortLabel: 'v3',
31
+ value: AaveVersions.AaveV3,
32
+ url: 'default',
33
+ assets: networkId ? aaveV3AssetsDefaultMarket[networkId] : [],
34
+ provider: 'AaveV3PoolAddressesProvider',
35
+ providerAddress: getConfigContractAddress('AaveV3PoolAddressesProvider', networkId),
36
+ lendingPool: 'AaveV3LendingPool',
37
+ lendingPoolAddress: getConfigContractAddress('AaveV3LendingPool', networkId),
38
+ protocolData: 'AaveV3ProtocolDataProvider',
39
+ protocolDataAddress: getConfigContractAddress('AaveV3ProtocolDataProvider', networkId),
40
+ // icon: SvgAdapter(protocolIcons.aave),
41
+ protocolName: 'aave',
42
+ });
43
+
44
+ export const MORPHO_AAVE_V2: MorphoAaveV2MarketInfo = {
45
+ chainIds: [1],
46
+ label: 'Morpho-Aave V2',
47
+ shortLabel: 'morpho-aave-v2',
48
+ value: AaveVersions.MorphoAaveV2,
49
+ url: '',
50
+ assets: morphoAaveV2AssetDefaultMarket,
51
+ providerAddress: getConfigContractAddress('LendingPoolAddressesProvider', 1),
52
+ lendingPoolAddress: getConfigContractAddress('MorphoAaveV2Proxy', 1),
53
+ // icon: SvgAdapter(protocolIcons.morpho),
54
+ protocolName: 'morpho',
55
+ };
56
+
57
+ export const MORPHO_AAVE_V3_ETH = (networkId: NetworkNumber = NetworkNumber.Eth): MorphoAaveV3MarketInfo => ({
58
+ chainIds: [1],
59
+ label: 'Morpho-Aave V3',
60
+ shortLabel: 'morpho-aave-v3',
61
+ subVersionLabel: 'ETH Optimizer',
62
+ value: AaveVersions.MorphoAaveV3Eth,
63
+ url: 'eth-optimizer',
64
+ assets: morphoAaveV3AssetEthMarket,
65
+ providerAddress: getConfigContractAddress('AaveV3PoolAddressesProvider', networkId), // TODO - check if used and if value is good?
66
+ protocolData: 'AaveV3ProtocolDataProvider',
67
+ protocolDataAddress: getConfigContractAddress('AaveV3ProtocolDataProvider', networkId),
68
+ lendingPool: 'MorphoAaveV3ProxyEthMarket',
69
+ lendingPoolAddress: getConfigContractAddress('MorphoAaveV3ProxyEthMarket', 1),
70
+ // icon: SvgAdapter(protocolIcons.morpho),
71
+ protocolName: 'morpho',
72
+ });
73
+
74
+
75
+ export const AaveMarkets = (networkId: NetworkNumber) => ({
76
+ [AaveVersions.AaveV2]: AAVE_V2,
77
+ [AaveVersions.AaveV3]: AAVE_V3(networkId),
78
+ [AaveVersions.MorphoAaveV3Eth]: MORPHO_AAVE_V3_ETH(networkId),
79
+ [AaveVersions.MorphoAaveV2]: MORPHO_AAVE_V2,
80
+ }) as const;
@@ -1,33 +1,33 @@
1
- // TODO generate this file automatically
2
-
3
- import { NetworkNumber } from '../../types/common';
4
-
5
- export const aaveV2AssetsDefaultMarket = [
6
- 'AAVE', 'BAL', 'BAT', 'BUSD', 'CRV', 'DAI', 'ENJ', 'ETH', 'GUSD', 'LINK', 'MANA', 'MKR',
7
- 'REN', 'SNX', 'SUSD', 'TUSD', 'UNI', 'USDC', 'USDT', 'WBTC', 'YFI', 'xSUSHI', 'ZRX', 'RAI',
8
- 'AMPL', 'DPI', 'USDP', 'RENFIL', 'FRAX', 'FEI', 'stETH', 'ENS', 'UST', 'CVX', '1INCH', 'LUSD',
9
- ] as const;
10
-
11
- export const morphoAaveV2AssetDefaultMarket = [
12
- 'ETH', 'stETH', 'USDC', 'WBTC', 'USDT', 'DAI', 'CRV',
13
- ];
14
-
15
- export const morphoAaveV3AssetEthMarket = [
16
- 'ETH', 'wstETH', 'DAI', 'USDC', 'WBTC', 'rETH', 'cbETH',
17
- ];
18
-
19
- export const aaveV3AssetsDefaultMarket = {
20
- [NetworkNumber.Eth]: [
21
- 'WBTC', 'ETH', 'wstETH', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'UNI', 'MKR', 'SNX', 'BAL',
22
- 'LDO', 'CRV', 'ENS', '1INCH', 'GHO', 'FRAX', 'RPL', 'sDAI',
23
- ],
24
- [NetworkNumber.Opt]: [
25
- 'DAI', 'USDC.e', 'USDT', 'SUSD', 'AAVE', 'LINK', 'WBTC', 'ETH', 'OP', 'wstETH', 'LUSD', 'MAI', 'rETH',
26
- ],
27
- [NetworkNumber.Arb]: [
28
- 'ETH', 'DAI', 'EURS', 'USDC', 'USDT', 'AAVE', 'LINK', 'WBTC', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC.e', 'FRAX', 'ARB',
29
- ],
30
- [NetworkNumber.Base]: [
31
- 'ETH', 'USDbC', 'cbETH',
32
- ],
1
+ // TODO generate this file automatically
2
+
3
+ import { NetworkNumber } from '../../types/common';
4
+
5
+ export const aaveV2AssetsDefaultMarket = [
6
+ 'AAVE', 'BAL', 'BAT', 'BUSD', 'CRV', 'DAI', 'ENJ', 'ETH', 'GUSD', 'LINK', 'MANA', 'MKR',
7
+ 'REN', 'SNX', 'SUSD', 'TUSD', 'UNI', 'USDC', 'USDT', 'WBTC', 'YFI', 'xSUSHI', 'ZRX', 'RAI',
8
+ 'AMPL', 'DPI', 'USDP', 'RENFIL', 'FRAX', 'FEI', 'stETH', 'ENS', 'UST', 'CVX', '1INCH', 'LUSD',
9
+ ] as const;
10
+
11
+ export const morphoAaveV2AssetDefaultMarket = [
12
+ 'ETH', 'stETH', 'USDC', 'WBTC', 'USDT', 'DAI', 'CRV',
13
+ ];
14
+
15
+ export const morphoAaveV3AssetEthMarket = [
16
+ 'ETH', 'wstETH', 'DAI', 'USDC', 'WBTC', 'rETH', 'cbETH',
17
+ ];
18
+
19
+ export const aaveV3AssetsDefaultMarket = {
20
+ [NetworkNumber.Eth]: [
21
+ 'WBTC', 'ETH', 'wstETH', 'USDC', 'DAI', 'LINK', 'AAVE', 'cbETH', 'USDT', 'rETH', 'LUSD', 'UNI', 'MKR', 'SNX', 'BAL',
22
+ 'LDO', 'CRV', 'ENS', '1INCH', 'GHO', 'FRAX', 'RPL', 'sDAI',
23
+ ],
24
+ [NetworkNumber.Opt]: [
25
+ 'DAI', 'USDC.e', 'USDT', 'SUSD', 'AAVE', 'LINK', 'WBTC', 'ETH', 'OP', 'wstETH', 'LUSD', 'MAI', 'rETH',
26
+ ],
27
+ [NetworkNumber.Arb]: [
28
+ 'ETH', 'DAI', 'EURS', 'USDC', 'USDT', 'AAVE', 'LINK', 'WBTC', 'wstETH', 'MAI', 'rETH', 'LUSD', 'USDC.e', 'FRAX', 'ARB',
29
+ ],
30
+ [NetworkNumber.Base]: [
31
+ 'ETH', 'USDbC', 'cbETH',
32
+ ],
33
33
  } as const;
@@ -1,86 +1,86 @@
1
- import { getConfigContractAddress } from '../../contracts';
2
- import { CompoundMarketData, CompoundVersions } from '../../types';
3
- import { NetworkNumber } from '../../types/common';
4
- import {
5
- compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCollAssets, v3USDCCollAssets,
6
- } from './marketsAssets';
7
-
8
- const USDC_BULKER_OPTIONS = {
9
- supply: 2,
10
- withdraw: 5,
11
- };
12
-
13
- const STANDARD_BULKER_OPTIONS = {
14
- supply: '0x414354494f4e5f535550504c595f4e41544956455f544f4b454e000000000000',
15
- withdraw: '0x414354494f4e5f57495448445241575f4e41544956455f544f4b454e00000000',
16
- };
17
-
18
- export const COMPOUND_V2: CompoundMarketData = {
19
- chainIds: [1],
20
- label: 'Compound V2',
21
- shortLabel: 'v2',
22
- value: CompoundVersions.CompoundV2,
23
- baseAsset: '',
24
- collAssets: compoundV2CollateralAssets.map(a => a.underlyingAsset),
25
- baseMarket: '',
26
- baseMarketAddress: '',
27
- secondLabel: '',
28
- bulkerName: '',
29
- bulkerAddress: '',
30
- bulkerOptions: { supply: '', withdraw: '' },
31
- // icon: SvgAdapter(protocolIcons.compound),
32
- };
33
-
34
- export const COMPOUND_V3_USDC = (networkId: NetworkNumber): CompoundMarketData => ({
35
- chainIds: [NetworkNumber.Eth],
36
- label: 'Compound V3 - USDC',
37
- shortLabel: 'v3',
38
- value: CompoundVersions.CompoundV3USDC,
39
- baseAsset: 'USDC',
40
- collAssets: networkId ? v3USDCCollAssets[networkId] : [],
41
- baseMarket: 'cUSDCv3',
42
- baseMarketAddress: getConfigContractAddress('cUSDCv3', networkId),
43
- secondLabel: 'Market',
44
- bulkerName: 'CompV3USDCBulker',
45
- bulkerAddress: getConfigContractAddress('CompV3USDCBulker', networkId),
46
- bulkerOptions: USDC_BULKER_OPTIONS,
47
- // icon: SvgAdapter(protocolIcons.compoundv3),
48
- });
49
- export const COMPOUND_V3_ETH = (networkId: NetworkNumber): CompoundMarketData => ({
50
- chainIds: [NetworkNumber.Eth, NetworkNumber.Base],
51
- label: 'Compound V3 - ETH',
52
- shortLabel: 'v3',
53
- value: CompoundVersions.CompoundV3ETH,
54
- baseAsset: 'ETH',
55
- collAssets: networkId ? v3ETHCollAssets[networkId] : [],
56
- baseMarket: 'cETHv3',
57
- baseMarketAddress: getConfigContractAddress('cETHv3', networkId),
58
- secondLabel: 'Market',
59
- bulkerName: 'CompV3ETHBulker',
60
- bulkerAddress: getConfigContractAddress('CompV3ETHBulker', networkId),
61
- bulkerOptions: STANDARD_BULKER_OPTIONS,
62
- // icon: SvgAdapter(protocolIcons.compoundv3),
63
- });
64
-
65
- export const COMPOUND_V3_USDBC = (networkId: NetworkNumber): CompoundMarketData => ({
66
- chainIds: [NetworkNumber.Base],
67
- label: 'Compound V3 - USDbC',
68
- shortLabel: 'v3',
69
- value: CompoundVersions.CompoundV3USDbC,
70
- baseAsset: 'USDbC',
71
- collAssets: networkId ? v3USDbCCollAssets[networkId] : [],
72
- baseMarket: 'cUSDbCv3',
73
- baseMarketAddress: getConfigContractAddress('cUSDbCv3', networkId),
74
- secondLabel: 'Market',
75
- bulkerName: 'CompV3USDbCBulker',
76
- bulkerAddress: getConfigContractAddress('CompV3USDbCBulker', networkId),
77
- bulkerOptions: STANDARD_BULKER_OPTIONS,
78
- // icon: SvgAdapter(protocolIcons.compoundv3),
79
- });
80
-
81
- export const CompoundMarkets = (networkId: NetworkNumber) => ({
82
- [CompoundVersions.CompoundV2]: COMPOUND_V2,
83
- [CompoundVersions.CompoundV3ETH]: COMPOUND_V3_ETH(networkId),
84
- [CompoundVersions.CompoundV3USDC]: COMPOUND_V3_USDC(networkId),
85
- [CompoundVersions.CompoundV3USDbC]: COMPOUND_V3_USDBC(networkId),
1
+ import { getConfigContractAddress } from '../../contracts';
2
+ import { CompoundMarketData, CompoundVersions } from '../../types';
3
+ import { NetworkNumber } from '../../types/common';
4
+ import {
5
+ compoundV2CollateralAssets, v3ETHCollAssets, v3USDbCCollAssets, v3USDCCollAssets,
6
+ } from './marketsAssets';
7
+
8
+ const USDC_BULKER_OPTIONS = {
9
+ supply: 2,
10
+ withdraw: 5,
11
+ };
12
+
13
+ const STANDARD_BULKER_OPTIONS = {
14
+ supply: '0x414354494f4e5f535550504c595f4e41544956455f544f4b454e000000000000',
15
+ withdraw: '0x414354494f4e5f57495448445241575f4e41544956455f544f4b454e00000000',
16
+ };
17
+
18
+ export const COMPOUND_V2: CompoundMarketData = {
19
+ chainIds: [1],
20
+ label: 'Compound V2',
21
+ shortLabel: 'v2',
22
+ value: CompoundVersions.CompoundV2,
23
+ baseAsset: '',
24
+ collAssets: compoundV2CollateralAssets.map(a => a.underlyingAsset),
25
+ baseMarket: '',
26
+ baseMarketAddress: '',
27
+ secondLabel: '',
28
+ bulkerName: '',
29
+ bulkerAddress: '',
30
+ bulkerOptions: { supply: '', withdraw: '' },
31
+ // icon: SvgAdapter(protocolIcons.compound),
32
+ };
33
+
34
+ export const COMPOUND_V3_USDC = (networkId: NetworkNumber): CompoundMarketData => ({
35
+ chainIds: [NetworkNumber.Eth],
36
+ label: 'Compound V3 - USDC',
37
+ shortLabel: 'v3',
38
+ value: CompoundVersions.CompoundV3USDC,
39
+ baseAsset: 'USDC',
40
+ collAssets: networkId ? v3USDCCollAssets[networkId] : [],
41
+ baseMarket: 'cUSDCv3',
42
+ baseMarketAddress: getConfigContractAddress('cUSDCv3', networkId),
43
+ secondLabel: 'Market',
44
+ bulkerName: 'CompV3USDCBulker',
45
+ bulkerAddress: getConfigContractAddress('CompV3USDCBulker', networkId),
46
+ bulkerOptions: USDC_BULKER_OPTIONS,
47
+ // icon: SvgAdapter(protocolIcons.compoundv3),
48
+ });
49
+ export const COMPOUND_V3_ETH = (networkId: NetworkNumber): CompoundMarketData => ({
50
+ chainIds: [NetworkNumber.Eth, NetworkNumber.Base],
51
+ label: 'Compound V3 - ETH',
52
+ shortLabel: 'v3',
53
+ value: CompoundVersions.CompoundV3ETH,
54
+ baseAsset: 'ETH',
55
+ collAssets: networkId ? v3ETHCollAssets[networkId] : [],
56
+ baseMarket: 'cETHv3',
57
+ baseMarketAddress: getConfigContractAddress('cETHv3', networkId),
58
+ secondLabel: 'Market',
59
+ bulkerName: 'CompV3ETHBulker',
60
+ bulkerAddress: getConfigContractAddress('CompV3ETHBulker', networkId),
61
+ bulkerOptions: STANDARD_BULKER_OPTIONS,
62
+ // icon: SvgAdapter(protocolIcons.compoundv3),
63
+ });
64
+
65
+ export const COMPOUND_V3_USDBC = (networkId: NetworkNumber): CompoundMarketData => ({
66
+ chainIds: [NetworkNumber.Base],
67
+ label: 'Compound V3 - USDbC',
68
+ shortLabel: 'v3',
69
+ value: CompoundVersions.CompoundV3USDbC,
70
+ baseAsset: 'USDbC',
71
+ collAssets: networkId ? v3USDbCCollAssets[networkId] : [],
72
+ baseMarket: 'cUSDbCv3',
73
+ baseMarketAddress: getConfigContractAddress('cUSDbCv3', networkId),
74
+ secondLabel: 'Market',
75
+ bulkerName: 'CompV3USDbCBulker',
76
+ bulkerAddress: getConfigContractAddress('CompV3USDbCBulker', networkId),
77
+ bulkerOptions: STANDARD_BULKER_OPTIONS,
78
+ // icon: SvgAdapter(protocolIcons.compoundv3),
79
+ });
80
+
81
+ export const CompoundMarkets = (networkId: NetworkNumber) => ({
82
+ [CompoundVersions.CompoundV2]: COMPOUND_V2,
83
+ [CompoundVersions.CompoundV3ETH]: COMPOUND_V3_ETH(networkId),
84
+ [CompoundVersions.CompoundV3USDC]: COMPOUND_V3_USDC(networkId),
85
+ [CompoundVersions.CompoundV3USDbC]: COMPOUND_V3_USDBC(networkId),
86
86
  }) as const;