@defisaver/positions-sdk 0.0.32 → 0.0.34

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 (86) hide show
  1. package/README.md +63 -63
  2. package/cjs/config/contracts.d.ts +908 -41
  3. package/cjs/config/contracts.js +171 -44
  4. package/cjs/contracts.js +4 -10
  5. package/cjs/curveUsd/index.js +1 -1
  6. package/cjs/helpers/curveUsdHelpers/index.d.ts +2 -1
  7. package/cjs/helpers/curveUsdHelpers/index.js +25 -17
  8. package/cjs/markets/morphoBlue/index.d.ts +2 -0
  9. package/cjs/markets/morphoBlue/index.js +17 -1
  10. package/cjs/moneymarket/moneymarketCommonService.js +1 -1
  11. package/cjs/morphoBlue/index.js +6 -3
  12. package/cjs/services/utils.d.ts +4 -0
  13. package/cjs/services/utils.js +13 -1
  14. package/cjs/types/contracts/generated/CrvUSDView.d.ts +30 -4
  15. package/cjs/types/curveUsd.d.ts +6 -0
  16. package/cjs/types/morphoBlue.d.ts +2 -1
  17. package/cjs/types/morphoBlue.js +1 -0
  18. package/esm/config/contracts.d.ts +908 -41
  19. package/esm/config/contracts.js +171 -44
  20. package/esm/contracts.js +4 -10
  21. package/esm/curveUsd/index.js +1 -1
  22. package/esm/helpers/curveUsdHelpers/index.d.ts +2 -1
  23. package/esm/helpers/curveUsdHelpers/index.js +26 -18
  24. package/esm/markets/morphoBlue/index.d.ts +2 -0
  25. package/esm/markets/morphoBlue/index.js +15 -0
  26. package/esm/moneymarket/moneymarketCommonService.js +1 -1
  27. package/esm/morphoBlue/index.js +6 -3
  28. package/esm/services/utils.d.ts +4 -0
  29. package/esm/services/utils.js +11 -0
  30. package/esm/types/contracts/generated/CrvUSDView.d.ts +30 -4
  31. package/esm/types/curveUsd.d.ts +6 -0
  32. package/esm/types/morphoBlue.d.ts +2 -1
  33. package/esm/types/morphoBlue.js +1 -0
  34. package/package.json +40 -40
  35. package/src/aaveV2/index.ts +226 -226
  36. package/src/aaveV3/index.ts +561 -561
  37. package/src/assets/index.ts +60 -60
  38. package/src/chickenBonds/index.ts +123 -123
  39. package/src/compoundV2/index.ts +219 -219
  40. package/src/compoundV3/index.ts +275 -275
  41. package/src/config/contracts.js +817 -690
  42. package/src/constants/index.ts +5 -5
  43. package/src/contracts.ts +124 -130
  44. package/src/curveUsd/index.ts +228 -228
  45. package/src/exchange/index.ts +17 -17
  46. package/src/helpers/aaveHelpers/index.ts +134 -134
  47. package/src/helpers/chickenBondsHelpers/index.ts +23 -23
  48. package/src/helpers/compoundHelpers/index.ts +181 -181
  49. package/src/helpers/curveUsdHelpers/index.ts +40 -32
  50. package/src/helpers/index.ts +6 -6
  51. package/src/helpers/makerHelpers/index.ts +94 -94
  52. package/src/helpers/morphoBlueHelpers/index.ts +46 -46
  53. package/src/helpers/sparkHelpers/index.ts +106 -106
  54. package/src/index.ts +42 -42
  55. package/src/liquity/index.ts +116 -116
  56. package/src/maker/index.ts +101 -101
  57. package/src/markets/aave/index.ts +80 -80
  58. package/src/markets/aave/marketAssets.ts +24 -24
  59. package/src/markets/compound/index.ts +141 -141
  60. package/src/markets/compound/marketsAssets.ts +48 -48
  61. package/src/markets/curveUsd/index.ts +69 -69
  62. package/src/markets/index.ts +4 -4
  63. package/src/markets/morphoBlue/index.ts +36 -20
  64. package/src/markets/spark/index.ts +29 -29
  65. package/src/markets/spark/marketAssets.ts +10 -10
  66. package/src/moneymarket/moneymarketCommonService.ts +75 -75
  67. package/src/morphoAaveV2/index.ts +255 -255
  68. package/src/morphoAaveV3/index.ts +619 -619
  69. package/src/morphoBlue/index.ts +170 -165
  70. package/src/multicall/index.ts +22 -22
  71. package/src/services/dsrService.ts +15 -15
  72. package/src/services/priceService.ts +21 -21
  73. package/src/services/utils.ts +48 -35
  74. package/src/spark/index.ts +422 -422
  75. package/src/staking/staking.ts +167 -167
  76. package/src/types/aave.ts +256 -256
  77. package/src/types/chickenBonds.ts +45 -45
  78. package/src/types/common.ts +83 -83
  79. package/src/types/compound.ts +128 -128
  80. package/src/types/contracts/generated/CrvUSDView.ts +43 -8
  81. package/src/types/curveUsd.ts +118 -112
  82. package/src/types/index.ts +7 -7
  83. package/src/types/liquity.ts +30 -30
  84. package/src/types/maker.ts +50 -50
  85. package/src/types/morphoBlue.ts +80 -79
  86. package/src/types/spark.ts +106 -106
@@ -1,113 +1,119 @@
1
- import { NetworkNumber } from './common';
2
-
3
- export enum CrvUSDVersions {
4
- 'wstETH' = 'wstETH',
5
- 'WBTC' = 'WBTC',
6
- 'ETH' = 'ETH',
7
- 'tBTC' = 'tBTC',
8
- 'sfrxETH' = 'sfrxETH',
9
- }
10
-
11
- export enum CrvUSDStatus {
12
- Nonexistant = 'Nonexistant',
13
- Safe = 'Safe',
14
- Risk = 'Risk',
15
- SoftLiquidating = 'SoftLiquidating',
16
- SoftLiquidated = 'SoftLiquidated',
17
- }
18
-
19
- export interface CrvUSDMarketData {
20
- chainIds: NetworkNumber[],
21
- label: string,
22
- shortLabel: string,
23
- value: CrvUSDVersions,
24
- collAsset: string,
25
- baseAsset: string,
26
- controllerAddress: string,
27
- ammAddress: string,
28
- createCollAssets: string[],
29
- }
30
-
31
- export interface BandData {
32
- id: string,
33
- collAmount: string,
34
- debtAmount: string,
35
- lowPrice: string,
36
- highPrice: string,
37
- }
38
-
39
- export interface UserBandData {
40
- id: string,
41
- collAmount: string,
42
- debtAmount: string,
43
- lowPrice: string,
44
- highPrice: string,
45
- userDebtAmount: string,
46
- userCollAmount: string,
47
- }
48
-
49
- export interface CrvUSDGlobalMarketData {
50
- collateral: string,
51
- decimals: string,
52
- activeBand: string,
53
- totalDebt: string,
54
- ammPrice: string,
55
- basePrice: string,
56
- oraclePrice: string,
57
- minted: string,
58
- redeemed: string,
59
- monetaryPolicyRate: string,
60
- ammRate: string,
61
- minBand: string,
62
- maxBand: string,
63
- debtCeiling: string,
64
- borrowRate: string,
65
- futureBorrowRate: string,
66
- leftToBorrow: string,
67
- bands: BandData[],
68
- }
69
-
70
- export interface CrvUSDAggregatedPositionData {
71
- ratio: string,
72
- supplied: string,
73
- suppliedUsd: string,
74
- borrowedUsd: string,
75
- borrowed: string,
76
- safetyRatio: string,
77
- }
78
-
79
- export interface CrvUSDUsedAsset {
80
- isSupplied: boolean,
81
- supplied: string,
82
- suppliedUsd: string,
83
- borrowed: string,
84
- borrowedUsd: string,
85
- isBorrowed: boolean,
86
- symbol: string,
87
- collateral: boolean,
88
- price: string,
89
- interestRate?: string,
90
- }
91
-
92
- export interface CrvUSDUsedAssets {
93
- [key: string]: CrvUSDUsedAsset,
94
- }
95
-
96
- export interface CrvUSDUserData {
97
- debtAmount: string,
98
- health: string,
99
- healthPercent: string,
100
- priceHigh: string,
101
- priceLow: string,
102
- liquidationDiscount: string,
103
- numOfBands: string,
104
- usedAssets: CrvUSDUsedAssets,
105
- status: CrvUSDStatus,
106
- ratio: string,
107
- supplied: string,
108
- suppliedUsd: string,
109
- borrowedUsd: string,
110
- borrowed: string,
111
- safetyRatio: string,
112
- userBands: UserBandData[],
1
+ import { NetworkNumber } from './common';
2
+
3
+ export enum CrvUSDVersions {
4
+ 'wstETH' = 'wstETH',
5
+ 'WBTC' = 'WBTC',
6
+ 'ETH' = 'ETH',
7
+ 'tBTC' = 'tBTC',
8
+ 'sfrxETH' = 'sfrxETH',
9
+ }
10
+
11
+ export enum CrvUSDStatus {
12
+ Nonexistant = 'Nonexistant',
13
+ Safe = 'Safe',
14
+ Risk = 'Risk',
15
+ SoftLiquidating = 'SoftLiquidating',
16
+ SoftLiquidated = 'SoftLiquidated',
17
+ }
18
+
19
+ export interface CrvUSDMarketData {
20
+ chainIds: NetworkNumber[],
21
+ label: string,
22
+ shortLabel: string,
23
+ value: CrvUSDVersions,
24
+ collAsset: string,
25
+ baseAsset: string,
26
+ controllerAddress: string,
27
+ ammAddress: string,
28
+ createCollAssets: string[],
29
+ }
30
+
31
+ export interface BandData {
32
+ id: string,
33
+ collAmount: string,
34
+ debtAmount: string,
35
+ lowPrice: string,
36
+ highPrice: string,
37
+ }
38
+
39
+ export interface UserBandData {
40
+ id: string,
41
+ collAmount: string,
42
+ debtAmount: string,
43
+ lowPrice: string,
44
+ highPrice: string,
45
+ userDebtAmount: string,
46
+ userCollAmount: string,
47
+ }
48
+
49
+ export interface CrvUSDGlobalMarketData {
50
+ collateral: string,
51
+ decimals: string,
52
+ activeBand: string,
53
+ totalDebt: string,
54
+ ammPrice: string,
55
+ basePrice: string,
56
+ oraclePrice: string,
57
+ minted: string,
58
+ redeemed: string,
59
+ monetaryPolicyRate: string,
60
+ ammRate: string,
61
+ minBand: string,
62
+ maxBand: string,
63
+ debtCeiling: string,
64
+ borrowRate: string,
65
+ futureBorrowRate: string,
66
+ leftToBorrow: string,
67
+ bands: BandData[],
68
+ }
69
+
70
+ export interface CrvUSDAggregatedPositionData {
71
+ ratio: string,
72
+ supplied: string,
73
+ suppliedUsd: string,
74
+ borrowedUsd: string,
75
+ borrowed: string,
76
+ safetyRatio: string,
77
+ borrowLimitUsd: string,
78
+ minAllowedRatio: number,
79
+ collFactor: string,
80
+ leveragedType: string,
81
+ leveragedAsset?: string,
82
+ liquidationPrice?: string,
83
+ }
84
+
85
+ export interface CrvUSDUsedAsset {
86
+ isSupplied: boolean,
87
+ supplied: string,
88
+ suppliedUsd: string,
89
+ borrowed: string,
90
+ borrowedUsd: string,
91
+ isBorrowed: boolean,
92
+ symbol: string,
93
+ collateral: boolean,
94
+ price: string,
95
+ interestRate?: string,
96
+ }
97
+
98
+ export interface CrvUSDUsedAssets {
99
+ [key: string]: CrvUSDUsedAsset,
100
+ }
101
+
102
+ export interface CrvUSDUserData {
103
+ debtAmount: string,
104
+ health: string,
105
+ healthPercent: string,
106
+ priceHigh: string,
107
+ priceLow: string,
108
+ liquidationDiscount: string,
109
+ numOfBands: string,
110
+ usedAssets: CrvUSDUsedAssets,
111
+ status: CrvUSDStatus,
112
+ ratio: string,
113
+ supplied: string,
114
+ suppliedUsd: string,
115
+ borrowedUsd: string,
116
+ borrowed: string,
117
+ safetyRatio: string,
118
+ userBands: UserBandData[],
113
119
  }
@@ -1,8 +1,8 @@
1
- export * from './aave';
2
- export * from './compound';
3
- export * from './spark';
4
- export * from './curveUsd';
5
- export * from './liquity';
6
- export * from './maker';
7
- export * from './chickenBonds';
1
+ export * from './aave';
2
+ export * from './compound';
3
+ export * from './spark';
4
+ export * from './curveUsd';
5
+ export * from './liquity';
6
+ export * from './maker';
7
+ export * from './chickenBonds';
8
8
  export * from './morphoBlue';
@@ -1,31 +1,31 @@
1
- export enum LIQUITY_TROVE_STATUS_ENUM {
2
- nonExistent,
3
- active,
4
- closedByOwner,
5
- closedByLiquidation,
6
- closedByRedemption,
7
- }
8
-
9
- export const LIQUITY_STATUS_MAPPING = {
10
- nonExistent: 'Non existent',
11
- active: 'Active',
12
- closedByOwner: 'Closed',
13
- closedByLiquidation: 'Liquidated',
14
- closedByRedemption: 'Redeemed',
15
- };
16
-
17
- export interface LiquityTroveInfo {
18
- troveStatus: string,
19
- collateral: string,
20
- debtInAsset: string,
21
- TCRatio: string,
22
- recoveryMode: boolean,
23
- claimableCollateral: string,
24
- borrowingRateWithDecay: string,
25
- assetPrice: string,
26
- totalETH: string,
27
- totalLUSD: string,
28
- minCollateralRatio: number,
29
- priceForRecovery: string,
30
- debtInFront: string,
1
+ export enum LIQUITY_TROVE_STATUS_ENUM {
2
+ nonExistent,
3
+ active,
4
+ closedByOwner,
5
+ closedByLiquidation,
6
+ closedByRedemption,
7
+ }
8
+
9
+ export const LIQUITY_STATUS_MAPPING = {
10
+ nonExistent: 'Non existent',
11
+ active: 'Active',
12
+ closedByOwner: 'Closed',
13
+ closedByLiquidation: 'Liquidated',
14
+ closedByRedemption: 'Redeemed',
15
+ };
16
+
17
+ export interface LiquityTroveInfo {
18
+ troveStatus: string,
19
+ collateral: string,
20
+ debtInAsset: string,
21
+ TCRatio: string,
22
+ recoveryMode: boolean,
23
+ claimableCollateral: string,
24
+ borrowingRateWithDecay: string,
25
+ assetPrice: string,
26
+ totalETH: string,
27
+ totalLUSD: string,
28
+ minCollateralRatio: number,
29
+ priceForRecovery: string,
30
+ debtInFront: string,
31
31
  }
@@ -1,51 +1,51 @@
1
- import { EthAddress } from './common';
2
-
3
- export interface IlkInfo {
4
- ilkLabel: string;
5
- currentRate: string;
6
- futureRate: string;
7
- minDebt: string;
8
- globalDebtCeiling: string;
9
- globalDebtCurrent: string;
10
- assetPrice: string;
11
- liqRatio: string;
12
- liqPercent: number;
13
- stabilityFee: number;
14
- liquidationFee: string;
15
- creatableDebt: string;
16
- }
17
-
18
- export interface CdpData {
19
- owner: EthAddress,
20
- userAddress: EthAddress,
21
- id: string,
22
- urn: EthAddress,
23
- type: string,
24
- ilk: string,
25
- ilkLabel: string,
26
- asset: string,
27
- collateral: string,
28
- collateralUsd: string,
29
- futureDebt: string,
30
- debtDai: string,
31
- debtUsd: string,
32
- debtInAsset: string,
33
- debtAssetPrice: string,
34
- debtAssetMarketPrice: string,
35
- liquidationPrice: string,
36
- ratio: string,
37
- liqRatio: string,
38
- liqPercent: number,
39
- assetPrice: string,
40
- daiLabel: string,
41
- debtAsset: string,
42
- unclaimedCollateral: string,
43
- debtTooLow: boolean,
44
- minDebt: string,
45
- stabilityFee: number,
46
- creatableDebt: string,
47
- globalDebtCeiling: string,
48
- globalDebtCurrent: string,
49
- liquidationFee: string,
50
- lastUpdated: number,
1
+ import { EthAddress } from './common';
2
+
3
+ export interface IlkInfo {
4
+ ilkLabel: string;
5
+ currentRate: string;
6
+ futureRate: string;
7
+ minDebt: string;
8
+ globalDebtCeiling: string;
9
+ globalDebtCurrent: string;
10
+ assetPrice: string;
11
+ liqRatio: string;
12
+ liqPercent: number;
13
+ stabilityFee: number;
14
+ liquidationFee: string;
15
+ creatableDebt: string;
16
+ }
17
+
18
+ export interface CdpData {
19
+ owner: EthAddress,
20
+ userAddress: EthAddress,
21
+ id: string,
22
+ urn: EthAddress,
23
+ type: string,
24
+ ilk: string,
25
+ ilkLabel: string,
26
+ asset: string,
27
+ collateral: string,
28
+ collateralUsd: string,
29
+ futureDebt: string,
30
+ debtDai: string,
31
+ debtUsd: string,
32
+ debtInAsset: string,
33
+ debtAssetPrice: string,
34
+ debtAssetMarketPrice: string,
35
+ liquidationPrice: string,
36
+ ratio: string,
37
+ liqRatio: string,
38
+ liqPercent: number,
39
+ assetPrice: string,
40
+ daiLabel: string,
41
+ debtAsset: string,
42
+ unclaimedCollateral: string,
43
+ debtTooLow: boolean,
44
+ minDebt: string,
45
+ stabilityFee: number,
46
+ creatableDebt: string,
47
+ globalDebtCeiling: string,
48
+ globalDebtCurrent: string,
49
+ liquidationFee: string,
50
+ lastUpdated: number,
51
51
  }
@@ -1,80 +1,81 @@
1
- import { MMUsedAssets, NetworkNumber } from './common';
2
-
3
- export enum MorphoBlueVersions {
4
- MorphoBlueWstEthEth = 'morphobluewstetheth',
5
- }
6
-
7
- export interface MorphoBlueMarketData {
8
- chainIds: NetworkNumber[],
9
- label: string,
10
- shortLabel: string,
11
- url: string,
12
- value: MorphoBlueVersions,
13
- loanToken: string,
14
- collateralToken: string,
15
- oracle: string,
16
- irm: string,
17
- lltv: number | string,
18
- // icon: Function,
19
- protocolName: string,
20
- }
21
-
22
- export interface MorphoBlueAssetData {
23
- symbol: string,
24
- address: string,
25
- price: string,
26
- supplyRate: string,
27
- borrowRate: string,
28
- incentiveSupplyApy?: string,
29
- incentiveSupplyToken?: string,
30
- totalSupply?: string,
31
- totalBorrow?: string,
32
- }
33
-
34
- export type MorphoBlueAssetsData = { [key: string]: MorphoBlueAssetData };
35
-
36
- export interface MorphoBlueMarketInfo {
37
- id: string,
38
- fee: string,
39
- loanToken: string,
40
- collateralToken: string,
41
- utillization: string,
42
- oracle: string,
43
- lltv: string,
44
- assetsData: MorphoBlueAssetsData,
45
- }
46
-
47
- export interface MorphoBlueAggregatedPositionData {
48
- suppliedUsd: string,
49
- suppliedCollateralUsd: string,
50
- borrowedUsd: string,
51
- borrowLimitUsd: string,
52
- liquidationLimitUsd: string,
53
- leftToBorrowUsd: string,
54
- netApy: string,
55
- incentiveUsd: string,
56
- totalInterestUsd: string,
57
- ltv: string,
58
- leveragedType: string,
59
- leveragedAsset?: string,
60
- leveragedLsdAssetRatio?: string,
61
- liquidationPrice?: string,
62
- }
63
-
64
- export interface MorphoBluePositionData {
65
- usedAssets: MMUsedAssets,
66
- suppliedUsd: string,
67
- suppliedCollateralUsd: string,
68
- borrowedUsd: string,
69
- borrowLimitUsd: string,
70
- liquidationLimitUsd: string,
71
- leftToBorrowUsd: string,
72
- netApy: string,
73
- incentiveUsd: string,
74
- totalInterestUsd: string,
75
- ltv: string,
76
- leveragedType: string,
77
- leveragedAsset?: string,
78
- leveragedLsdAssetRatio?: string,
79
- liquidationPrice?: string,
1
+ import { MMUsedAssets, NetworkNumber } from './common';
2
+
3
+ export enum MorphoBlueVersions {
4
+ MorphoBlueWstEthEth = 'morphobluewstetheth',
5
+ MorphoBlueWstEthUSDC = 'morphobluewstethusdc',
6
+ }
7
+
8
+ export interface MorphoBlueMarketData {
9
+ chainIds: NetworkNumber[],
10
+ label: string,
11
+ shortLabel: string,
12
+ url: string,
13
+ value: MorphoBlueVersions,
14
+ loanToken: string,
15
+ collateralToken: string,
16
+ oracle: string,
17
+ irm: string,
18
+ lltv: number | string,
19
+ // icon: Function,
20
+ protocolName: string,
21
+ }
22
+
23
+ export interface MorphoBlueAssetData {
24
+ symbol: string,
25
+ address: string,
26
+ price: string,
27
+ supplyRate: string,
28
+ borrowRate: string,
29
+ incentiveSupplyApy?: string,
30
+ incentiveSupplyToken?: string,
31
+ totalSupply?: string,
32
+ totalBorrow?: string,
33
+ }
34
+
35
+ export type MorphoBlueAssetsData = { [key: string]: MorphoBlueAssetData };
36
+
37
+ export interface MorphoBlueMarketInfo {
38
+ id: string,
39
+ fee: string,
40
+ loanToken: string,
41
+ collateralToken: string,
42
+ utillization: string,
43
+ oracle: string,
44
+ lltv: string,
45
+ assetsData: MorphoBlueAssetsData,
46
+ }
47
+
48
+ export interface MorphoBlueAggregatedPositionData {
49
+ suppliedUsd: string,
50
+ suppliedCollateralUsd: string,
51
+ borrowedUsd: string,
52
+ borrowLimitUsd: string,
53
+ liquidationLimitUsd: string,
54
+ leftToBorrowUsd: string,
55
+ netApy: string,
56
+ incentiveUsd: string,
57
+ totalInterestUsd: string,
58
+ ltv: string,
59
+ leveragedType: string,
60
+ leveragedAsset?: string,
61
+ leveragedLsdAssetRatio?: string,
62
+ liquidationPrice?: string,
63
+ }
64
+
65
+ export interface MorphoBluePositionData {
66
+ usedAssets: MMUsedAssets,
67
+ suppliedUsd: string,
68
+ suppliedCollateralUsd: string,
69
+ borrowedUsd: string,
70
+ borrowLimitUsd: string,
71
+ liquidationLimitUsd: string,
72
+ leftToBorrowUsd: string,
73
+ netApy: string,
74
+ incentiveUsd: string,
75
+ totalInterestUsd: string,
76
+ ltv: string,
77
+ leveragedType: string,
78
+ leveragedAsset?: string,
79
+ leveragedLsdAssetRatio?: string,
80
+ liquidationPrice?: string,
80
81
  }