@defisaver/positions-sdk 0.0.182 → 0.0.183-dev-allocator
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/aaveV3/index.js +3 -3
- package/cjs/config/contracts.d.ts +3 -0
- package/cjs/config/contracts.js +3 -0
- package/cjs/helpers/aaveHelpers/index.js +0 -1
- package/cjs/helpers/morphoBlueHelpers/index.d.ts +5 -0
- package/cjs/helpers/morphoBlueHelpers/index.js +127 -1
- package/cjs/staking/staking.d.ts +2 -3
- package/cjs/staking/staking.js +2 -2
- package/cjs/types/morphoBlue.d.ts +25 -0
- package/esm/aaveV3/index.js +4 -4
- package/esm/config/contracts.d.ts +3 -0
- package/esm/config/contracts.js +3 -0
- package/esm/helpers/aaveHelpers/index.js +0 -1
- package/esm/helpers/morphoBlueHelpers/index.d.ts +5 -0
- package/esm/helpers/morphoBlueHelpers/index.js +124 -0
- package/esm/staking/staking.d.ts +2 -3
- package/esm/staking/staking.js +2 -2
- package/esm/types/morphoBlue.d.ts +25 -0
- package/package.json +49 -49
- package/src/aaveV2/index.ts +227 -227
- package/src/aaveV3/index.ts +624 -628
- 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 +282 -282
- package/src/config/contracts.js +1043 -1040
- package/src/constants/index.ts +6 -6
- package/src/contracts.ts +130 -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 -199
- 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 +256 -115
- 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 +173 -173
- package/src/markets/compound/marketsAssets.ts +64 -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 +809 -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 +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 +56 -56
- package/src/setup.ts +8 -8
- package/src/spark/index.ts +461 -461
- package/src/staking/staking.ts +220 -222
- 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 +129 -129
- 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 +177 -154
- package/src/types/spark.ts +131 -131
- package/.vscode/launch.json +0 -17
- package/.vscode/settings.json +0 -37
package/src/types/euler.ts
CHANGED
|
@@ -1,172 +1,172 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MMPositionData, NetworkNumber,
|
|
3
|
-
} from './common';
|
|
4
|
-
|
|
5
|
-
export enum EulerV2Versions {
|
|
6
|
-
eUSDC2 = 'eUSDC-2',
|
|
7
|
-
eWETH2 = 'eWETH-2',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export enum EulerV2VaultType {
|
|
11
|
-
Escrow = 'Escrow',
|
|
12
|
-
Governed = 'Governed',
|
|
13
|
-
Ungoverned = 'Ungoverned',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface EulerV2Market {
|
|
17
|
-
chainIds: NetworkNumber[],
|
|
18
|
-
label: string,
|
|
19
|
-
shortLabel: string,
|
|
20
|
-
asset: string,
|
|
21
|
-
value: EulerV2Versions,
|
|
22
|
-
secondLabel: string,
|
|
23
|
-
marketAddress: string,
|
|
24
|
-
// icon: Function,
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface EulerV2PositionData extends MMPositionData {
|
|
28
|
-
ratio: string,
|
|
29
|
-
minRatio: string,
|
|
30
|
-
borrowedUsd: string,
|
|
31
|
-
borrowLimitUsd: string,
|
|
32
|
-
incentiveUsd: string,
|
|
33
|
-
totalInterestUsd: string,
|
|
34
|
-
isSubscribedToAutomation?: boolean,
|
|
35
|
-
automationResubscribeRequired?: boolean,
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface EulerV2AssetData {
|
|
39
|
-
vaultAddress: string,
|
|
40
|
-
vaultSymbol: string
|
|
41
|
-
sortIndex?: number
|
|
42
|
-
liquidationRatio: string
|
|
43
|
-
cash: string
|
|
44
|
-
supplyCap: string
|
|
45
|
-
assetAddress: string
|
|
46
|
-
decimals: string
|
|
47
|
-
symbol: string
|
|
48
|
-
price: string
|
|
49
|
-
borrowCap: string
|
|
50
|
-
canBeBorrowed: boolean
|
|
51
|
-
canBeSupplied: boolean
|
|
52
|
-
incentiveSupplyApy?: string
|
|
53
|
-
incentiveSupplyToken?: string
|
|
54
|
-
totalBorrow: string
|
|
55
|
-
collateralFactor: string
|
|
56
|
-
borrowRate: string
|
|
57
|
-
supplyRate: string
|
|
58
|
-
utilization: string
|
|
59
|
-
governorAdmin: string
|
|
60
|
-
vaultType: EulerV2VaultType
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface EulerV2UsedAsset {
|
|
64
|
-
isSupplied: boolean
|
|
65
|
-
isBorrowed: boolean
|
|
66
|
-
supplied: string
|
|
67
|
-
suppliedUsd: string
|
|
68
|
-
borrowed: string
|
|
69
|
-
borrowedUsd: string
|
|
70
|
-
symbol: string
|
|
71
|
-
collateral: boolean
|
|
72
|
-
vaultAddress: string
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface EulerV2MarketInfoData {
|
|
76
|
-
name: string,
|
|
77
|
-
symbol: string,
|
|
78
|
-
decimals: string,
|
|
79
|
-
vaultAddress: string,
|
|
80
|
-
irm: string,
|
|
81
|
-
creator: string,
|
|
82
|
-
governorAdmin: string,
|
|
83
|
-
unitOfAccount: string,
|
|
84
|
-
unitOfAccountUsdPrice: string,
|
|
85
|
-
isInUSD: boolean,
|
|
86
|
-
oracle: string,
|
|
87
|
-
collaterals: string[],
|
|
88
|
-
isEscrow: boolean,
|
|
89
|
-
isGoverned: boolean,
|
|
90
|
-
vaultType: EulerV2VaultType,
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export type EulerV2AssetsData = { [key: string]: EulerV2AssetData };
|
|
94
|
-
export type EulerV2UsedAssets = { [key: string]: EulerV2UsedAsset };
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
export interface EulerV2CollateralInfo {
|
|
98
|
-
lltv: string
|
|
99
|
-
borrowLtv: string
|
|
100
|
-
totalBorrows: string
|
|
101
|
-
cash: string
|
|
102
|
-
supplyCap: string
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface EulerV2MarketData {
|
|
106
|
-
name: string
|
|
107
|
-
symbol: string
|
|
108
|
-
decimals: number
|
|
109
|
-
|
|
110
|
-
totalSupplyShares: string
|
|
111
|
-
cash: string
|
|
112
|
-
totalBorrows: string
|
|
113
|
-
totalAssets: string
|
|
114
|
-
supplyCap: string
|
|
115
|
-
borrowCap: string
|
|
116
|
-
|
|
117
|
-
collaterals: string[]
|
|
118
|
-
|
|
119
|
-
badDebtSocializationEnabled: boolean
|
|
120
|
-
|
|
121
|
-
unitOfAccount: string
|
|
122
|
-
oracle: string
|
|
123
|
-
assetPrice: string
|
|
124
|
-
|
|
125
|
-
interestRate: string
|
|
126
|
-
irm: string
|
|
127
|
-
|
|
128
|
-
creator: string
|
|
129
|
-
|
|
130
|
-
governorAdmin: string
|
|
131
|
-
|
|
132
|
-
interestFee: string
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface EulerV2FullMarketData {
|
|
136
|
-
marketData: EulerV2MarketInfoData
|
|
137
|
-
assetsData: EulerV2AssetsData
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface EulerV2AccountData {
|
|
141
|
-
owner: string
|
|
142
|
-
inLockDownMode: boolean
|
|
143
|
-
inPermitDisabledMode: boolean
|
|
144
|
-
|
|
145
|
-
borrowVault: string
|
|
146
|
-
borrowAmountInUnit: string
|
|
147
|
-
|
|
148
|
-
collaterals: string[] // all collaterals user has enabled on main evc contract (globally - not only collaterals for his borrow market)
|
|
149
|
-
collateralAmountsInUnit: string[] // only amounts used as collateral for his debt (empty array if no debt)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface EulerV2AggregatedPositionData {
|
|
153
|
-
suppliedUsd: string,
|
|
154
|
-
suppliedCollateralUsd: string,
|
|
155
|
-
borrowedUsd: string,
|
|
156
|
-
borrowLimitUsd: string,
|
|
157
|
-
liquidationLimitUsd: string,
|
|
158
|
-
leftToBorrowUsd: string,
|
|
159
|
-
ratio: string,
|
|
160
|
-
collRatio: string,
|
|
161
|
-
netApy: string,
|
|
162
|
-
incentiveUsd: string,
|
|
163
|
-
totalInterestUsd: string,
|
|
164
|
-
liqRatio: string,
|
|
165
|
-
liqPercent: string,
|
|
166
|
-
leveragedType: string,
|
|
167
|
-
leveragedAsset?: string,
|
|
168
|
-
leveragedLsdAssetRatio?: string,
|
|
169
|
-
liquidationPrice?: string,
|
|
170
|
-
minRatio: string,
|
|
171
|
-
minDebt: string,
|
|
1
|
+
import {
|
|
2
|
+
MMPositionData, NetworkNumber,
|
|
3
|
+
} from './common';
|
|
4
|
+
|
|
5
|
+
export enum EulerV2Versions {
|
|
6
|
+
eUSDC2 = 'eUSDC-2',
|
|
7
|
+
eWETH2 = 'eWETH-2',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum EulerV2VaultType {
|
|
11
|
+
Escrow = 'Escrow',
|
|
12
|
+
Governed = 'Governed',
|
|
13
|
+
Ungoverned = 'Ungoverned',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface EulerV2Market {
|
|
17
|
+
chainIds: NetworkNumber[],
|
|
18
|
+
label: string,
|
|
19
|
+
shortLabel: string,
|
|
20
|
+
asset: string,
|
|
21
|
+
value: EulerV2Versions,
|
|
22
|
+
secondLabel: string,
|
|
23
|
+
marketAddress: string,
|
|
24
|
+
// icon: Function,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface EulerV2PositionData extends MMPositionData {
|
|
28
|
+
ratio: string,
|
|
29
|
+
minRatio: string,
|
|
30
|
+
borrowedUsd: string,
|
|
31
|
+
borrowLimitUsd: string,
|
|
32
|
+
incentiveUsd: string,
|
|
33
|
+
totalInterestUsd: string,
|
|
34
|
+
isSubscribedToAutomation?: boolean,
|
|
35
|
+
automationResubscribeRequired?: boolean,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface EulerV2AssetData {
|
|
39
|
+
vaultAddress: string,
|
|
40
|
+
vaultSymbol: string
|
|
41
|
+
sortIndex?: number
|
|
42
|
+
liquidationRatio: string
|
|
43
|
+
cash: string
|
|
44
|
+
supplyCap: string
|
|
45
|
+
assetAddress: string
|
|
46
|
+
decimals: string
|
|
47
|
+
symbol: string
|
|
48
|
+
price: string
|
|
49
|
+
borrowCap: string
|
|
50
|
+
canBeBorrowed: boolean
|
|
51
|
+
canBeSupplied: boolean
|
|
52
|
+
incentiveSupplyApy?: string
|
|
53
|
+
incentiveSupplyToken?: string
|
|
54
|
+
totalBorrow: string
|
|
55
|
+
collateralFactor: string
|
|
56
|
+
borrowRate: string
|
|
57
|
+
supplyRate: string
|
|
58
|
+
utilization: string
|
|
59
|
+
governorAdmin: string
|
|
60
|
+
vaultType: EulerV2VaultType
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface EulerV2UsedAsset {
|
|
64
|
+
isSupplied: boolean
|
|
65
|
+
isBorrowed: boolean
|
|
66
|
+
supplied: string
|
|
67
|
+
suppliedUsd: string
|
|
68
|
+
borrowed: string
|
|
69
|
+
borrowedUsd: string
|
|
70
|
+
symbol: string
|
|
71
|
+
collateral: boolean
|
|
72
|
+
vaultAddress: string
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface EulerV2MarketInfoData {
|
|
76
|
+
name: string,
|
|
77
|
+
symbol: string,
|
|
78
|
+
decimals: string,
|
|
79
|
+
vaultAddress: string,
|
|
80
|
+
irm: string,
|
|
81
|
+
creator: string,
|
|
82
|
+
governorAdmin: string,
|
|
83
|
+
unitOfAccount: string,
|
|
84
|
+
unitOfAccountUsdPrice: string,
|
|
85
|
+
isInUSD: boolean,
|
|
86
|
+
oracle: string,
|
|
87
|
+
collaterals: string[],
|
|
88
|
+
isEscrow: boolean,
|
|
89
|
+
isGoverned: boolean,
|
|
90
|
+
vaultType: EulerV2VaultType,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type EulerV2AssetsData = { [key: string]: EulerV2AssetData };
|
|
94
|
+
export type EulerV2UsedAssets = { [key: string]: EulerV2UsedAsset };
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
export interface EulerV2CollateralInfo {
|
|
98
|
+
lltv: string
|
|
99
|
+
borrowLtv: string
|
|
100
|
+
totalBorrows: string
|
|
101
|
+
cash: string
|
|
102
|
+
supplyCap: string
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface EulerV2MarketData {
|
|
106
|
+
name: string
|
|
107
|
+
symbol: string
|
|
108
|
+
decimals: number
|
|
109
|
+
|
|
110
|
+
totalSupplyShares: string
|
|
111
|
+
cash: string
|
|
112
|
+
totalBorrows: string
|
|
113
|
+
totalAssets: string
|
|
114
|
+
supplyCap: string
|
|
115
|
+
borrowCap: string
|
|
116
|
+
|
|
117
|
+
collaterals: string[]
|
|
118
|
+
|
|
119
|
+
badDebtSocializationEnabled: boolean
|
|
120
|
+
|
|
121
|
+
unitOfAccount: string
|
|
122
|
+
oracle: string
|
|
123
|
+
assetPrice: string
|
|
124
|
+
|
|
125
|
+
interestRate: string
|
|
126
|
+
irm: string
|
|
127
|
+
|
|
128
|
+
creator: string
|
|
129
|
+
|
|
130
|
+
governorAdmin: string
|
|
131
|
+
|
|
132
|
+
interestFee: string
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface EulerV2FullMarketData {
|
|
136
|
+
marketData: EulerV2MarketInfoData
|
|
137
|
+
assetsData: EulerV2AssetsData
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface EulerV2AccountData {
|
|
141
|
+
owner: string
|
|
142
|
+
inLockDownMode: boolean
|
|
143
|
+
inPermitDisabledMode: boolean
|
|
144
|
+
|
|
145
|
+
borrowVault: string
|
|
146
|
+
borrowAmountInUnit: string
|
|
147
|
+
|
|
148
|
+
collaterals: string[] // all collaterals user has enabled on main evc contract (globally - not only collaterals for his borrow market)
|
|
149
|
+
collateralAmountsInUnit: string[] // only amounts used as collateral for his debt (empty array if no debt)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface EulerV2AggregatedPositionData {
|
|
153
|
+
suppliedUsd: string,
|
|
154
|
+
suppliedCollateralUsd: string,
|
|
155
|
+
borrowedUsd: string,
|
|
156
|
+
borrowLimitUsd: string,
|
|
157
|
+
liquidationLimitUsd: string,
|
|
158
|
+
leftToBorrowUsd: string,
|
|
159
|
+
ratio: string,
|
|
160
|
+
collRatio: string,
|
|
161
|
+
netApy: string,
|
|
162
|
+
incentiveUsd: string,
|
|
163
|
+
totalInterestUsd: string,
|
|
164
|
+
liqRatio: string,
|
|
165
|
+
liqPercent: string,
|
|
166
|
+
leveragedType: string,
|
|
167
|
+
leveragedAsset?: string,
|
|
168
|
+
leveragedLsdAssetRatio?: string,
|
|
169
|
+
liquidationPrice?: string,
|
|
170
|
+
minRatio: string,
|
|
171
|
+
minDebt: string,
|
|
172
172
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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
|
-
export * from './morphoBlue';
|
|
9
|
-
export * from './llamaLend';
|
|
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
|
+
export * from './morphoBlue';
|
|
9
|
+
export * from './llamaLend';
|
|
10
10
|
export * from './euler';
|
package/src/types/liquity.ts
CHANGED
|
@@ -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
|
}
|