@defisaver/positions-sdk 0.0.183 → 0.0.185-dev
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/cjs/aaveV3/index.js +1 -1
- package/cjs/compoundV3/index.js +11 -1
- package/cjs/config/contracts.d.ts +446 -216
- package/cjs/config/contracts.js +22 -0
- package/cjs/contracts.d.ts +1 -0
- package/cjs/contracts.js +2 -1
- package/cjs/markets/aave/marketAssets.js +1 -1
- package/cjs/markets/compound/index.d.ts +4 -0
- package/cjs/markets/compound/index.js +41 -1
- package/cjs/markets/compound/marketsAssets.d.ts +14 -0
- package/cjs/markets/compound/marketsAssets.js +17 -3
- package/cjs/markets/morphoBlue/index.d.ts +8 -0
- package/cjs/markets/morphoBlue/index.js +70 -1
- package/cjs/services/priceService.d.ts +1 -0
- package/cjs/services/priceService.js +23 -1
- package/cjs/staking/staking.js +2 -2
- package/cjs/types/compound.d.ts +3 -1
- package/cjs/types/compound.js +2 -0
- package/cjs/types/contracts/generated/CUSDSv3.d.ts +441 -0
- package/cjs/types/contracts/generated/CUSDSv3.js +5 -0
- package/cjs/types/contracts/generated/CWstETHv3.d.ts +441 -0
- package/cjs/types/contracts/generated/CWstETHv3.js +5 -0
- package/cjs/types/contracts/generated/WstETHPriceFeed.d.ts +39 -0
- package/cjs/types/contracts/generated/WstETHPriceFeed.js +5 -0
- package/cjs/types/contracts/generated/index.d.ts +3 -0
- package/cjs/types/morphoBlue.d.ts +5 -1
- package/cjs/types/morphoBlue.js +4 -0
- package/esm/aaveV3/index.js +1 -1
- package/esm/compoundV3/index.js +12 -2
- package/esm/config/contracts.d.ts +446 -216
- package/esm/config/contracts.js +22 -0
- package/esm/contracts.d.ts +1 -0
- package/esm/contracts.js +1 -0
- package/esm/markets/aave/marketAssets.js +1 -1
- package/esm/markets/compound/index.d.ts +4 -0
- package/esm/markets/compound/index.js +39 -1
- package/esm/markets/compound/marketsAssets.d.ts +14 -0
- package/esm/markets/compound/marketsAssets.js +16 -2
- package/esm/markets/morphoBlue/index.d.ts +8 -0
- package/esm/markets/morphoBlue/index.js +64 -0
- package/esm/services/priceService.d.ts +1 -0
- package/esm/services/priceService.js +22 -1
- package/esm/staking/staking.js +2 -2
- package/esm/types/compound.d.ts +3 -1
- package/esm/types/compound.js +2 -0
- package/esm/types/contracts/generated/CUSDSv3.d.ts +441 -0
- package/esm/types/contracts/generated/CUSDSv3.js +4 -0
- package/esm/types/contracts/generated/CWstETHv3.d.ts +441 -0
- package/esm/types/contracts/generated/CWstETHv3.js +4 -0
- package/esm/types/contracts/generated/WstETHPriceFeed.d.ts +39 -0
- package/esm/types/contracts/generated/WstETHPriceFeed.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +3 -0
- package/esm/types/morphoBlue.d.ts +5 -1
- package/esm/types/morphoBlue.js +4 -0
- package/package.json +2 -2
- package/src/aaveV3/index.ts +1 -1
- package/src/compoundV3/index.ts +15 -2
- package/src/config/contracts.js +22 -0
- package/src/contracts.ts +1 -0
- package/src/markets/aave/marketAssets.ts +1 -1
- package/src/markets/compound/index.ts +42 -2
- package/src/markets/compound/marketsAssets.ts +20 -2
- package/src/markets/morphoBlue/index.ts +69 -0
- package/src/services/priceService.ts +32 -1
- package/src/staking/staking.ts +2 -2
- package/src/types/compound.ts +2 -0
- package/src/types/contracts/generated/CUSDSv3.ts +685 -0
- package/src/types/contracts/generated/CWstETHv3.ts +685 -0
- package/src/types/contracts/generated/WstETHPriceFeed.ts +59 -0
- package/src/types/contracts/generated/index.ts +3 -0
- package/src/types/morphoBlue.ts +4 -0
- package/.vscode/launch.json +0 -17
- package/.vscode/settings.json +0 -37
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type BN from "bn.js";
|
|
3
|
+
import type { ContractOptions } from "web3-eth-contract";
|
|
4
|
+
import type { EventLog } from "web3-core";
|
|
5
|
+
import type { EventEmitter } from "events";
|
|
6
|
+
import type { Callback, NonPayableTransactionObject, BlockType, ContractEventLog, BaseContract } from "./types";
|
|
7
|
+
export interface EventOptions {
|
|
8
|
+
filter?: object;
|
|
9
|
+
fromBlock?: BlockType;
|
|
10
|
+
topics?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare namespace CometConfiguration {
|
|
13
|
+
type AssetConfigStruct = [
|
|
14
|
+
string,
|
|
15
|
+
string,
|
|
16
|
+
number | string | BN,
|
|
17
|
+
number | string | BN,
|
|
18
|
+
number | string | BN,
|
|
19
|
+
number | string | BN,
|
|
20
|
+
number | string | BN
|
|
21
|
+
] | {
|
|
22
|
+
asset: string;
|
|
23
|
+
priceFeed: string;
|
|
24
|
+
decimals: number | string | BN;
|
|
25
|
+
borrowCollateralFactor: number | string | BN;
|
|
26
|
+
liquidateCollateralFactor: number | string | BN;
|
|
27
|
+
liquidationFactor: number | string | BN;
|
|
28
|
+
supplyCap: number | string | BN;
|
|
29
|
+
};
|
|
30
|
+
type AssetConfigStructOutputArray = [
|
|
31
|
+
string,
|
|
32
|
+
string,
|
|
33
|
+
string,
|
|
34
|
+
string,
|
|
35
|
+
string,
|
|
36
|
+
string,
|
|
37
|
+
string
|
|
38
|
+
];
|
|
39
|
+
type AssetConfigStructOutputStruct = {
|
|
40
|
+
asset: string;
|
|
41
|
+
priceFeed: string;
|
|
42
|
+
decimals: string;
|
|
43
|
+
borrowCollateralFactor: string;
|
|
44
|
+
liquidateCollateralFactor: string;
|
|
45
|
+
liquidationFactor: string;
|
|
46
|
+
supplyCap: string;
|
|
47
|
+
};
|
|
48
|
+
type AssetConfigStructOutput = AssetConfigStructOutputArray & AssetConfigStructOutputStruct;
|
|
49
|
+
type ConfigurationStruct = [
|
|
50
|
+
string,
|
|
51
|
+
string,
|
|
52
|
+
string,
|
|
53
|
+
string,
|
|
54
|
+
string,
|
|
55
|
+
number | string | BN,
|
|
56
|
+
number | string | BN,
|
|
57
|
+
number | string | BN,
|
|
58
|
+
number | string | BN,
|
|
59
|
+
number | string | BN,
|
|
60
|
+
number | string | BN,
|
|
61
|
+
number | string | BN,
|
|
62
|
+
number | string | BN,
|
|
63
|
+
number | string | BN,
|
|
64
|
+
number | string | BN,
|
|
65
|
+
number | string | BN,
|
|
66
|
+
number | string | BN,
|
|
67
|
+
number | string | BN,
|
|
68
|
+
number | string | BN,
|
|
69
|
+
number | string | BN,
|
|
70
|
+
CometConfiguration.AssetConfigStruct[]
|
|
71
|
+
] | {
|
|
72
|
+
governor: string;
|
|
73
|
+
pauseGuardian: string;
|
|
74
|
+
baseToken: string;
|
|
75
|
+
baseTokenPriceFeed: string;
|
|
76
|
+
extensionDelegate: string;
|
|
77
|
+
supplyKink: number | string | BN;
|
|
78
|
+
supplyPerYearInterestRateSlopeLow: number | string | BN;
|
|
79
|
+
supplyPerYearInterestRateSlopeHigh: number | string | BN;
|
|
80
|
+
supplyPerYearInterestRateBase: number | string | BN;
|
|
81
|
+
borrowKink: number | string | BN;
|
|
82
|
+
borrowPerYearInterestRateSlopeLow: number | string | BN;
|
|
83
|
+
borrowPerYearInterestRateSlopeHigh: number | string | BN;
|
|
84
|
+
borrowPerYearInterestRateBase: number | string | BN;
|
|
85
|
+
storeFrontPriceFactor: number | string | BN;
|
|
86
|
+
trackingIndexScale: number | string | BN;
|
|
87
|
+
baseTrackingSupplySpeed: number | string | BN;
|
|
88
|
+
baseTrackingBorrowSpeed: number | string | BN;
|
|
89
|
+
baseMinForRewards: number | string | BN;
|
|
90
|
+
baseBorrowMin: number | string | BN;
|
|
91
|
+
targetReserves: number | string | BN;
|
|
92
|
+
assetConfigs: CometConfiguration.AssetConfigStruct[];
|
|
93
|
+
};
|
|
94
|
+
type ConfigurationStructOutputArray = [
|
|
95
|
+
string,
|
|
96
|
+
string,
|
|
97
|
+
string,
|
|
98
|
+
string,
|
|
99
|
+
string,
|
|
100
|
+
string,
|
|
101
|
+
string,
|
|
102
|
+
string,
|
|
103
|
+
string,
|
|
104
|
+
string,
|
|
105
|
+
string,
|
|
106
|
+
string,
|
|
107
|
+
string,
|
|
108
|
+
string,
|
|
109
|
+
string,
|
|
110
|
+
string,
|
|
111
|
+
string,
|
|
112
|
+
string,
|
|
113
|
+
string,
|
|
114
|
+
string,
|
|
115
|
+
CometConfiguration.AssetConfigStructOutput[]
|
|
116
|
+
];
|
|
117
|
+
type ConfigurationStructOutputStruct = {
|
|
118
|
+
governor: string;
|
|
119
|
+
pauseGuardian: string;
|
|
120
|
+
baseToken: string;
|
|
121
|
+
baseTokenPriceFeed: string;
|
|
122
|
+
extensionDelegate: string;
|
|
123
|
+
supplyKink: string;
|
|
124
|
+
supplyPerYearInterestRateSlopeLow: string;
|
|
125
|
+
supplyPerYearInterestRateSlopeHigh: string;
|
|
126
|
+
supplyPerYearInterestRateBase: string;
|
|
127
|
+
borrowKink: string;
|
|
128
|
+
borrowPerYearInterestRateSlopeLow: string;
|
|
129
|
+
borrowPerYearInterestRateSlopeHigh: string;
|
|
130
|
+
borrowPerYearInterestRateBase: string;
|
|
131
|
+
storeFrontPriceFactor: string;
|
|
132
|
+
trackingIndexScale: string;
|
|
133
|
+
baseTrackingSupplySpeed: string;
|
|
134
|
+
baseTrackingBorrowSpeed: string;
|
|
135
|
+
baseMinForRewards: string;
|
|
136
|
+
baseBorrowMin: string;
|
|
137
|
+
targetReserves: string;
|
|
138
|
+
assetConfigs: CometConfiguration.AssetConfigStructOutput[];
|
|
139
|
+
};
|
|
140
|
+
type ConfigurationStructOutput = ConfigurationStructOutputArray & ConfigurationStructOutputStruct;
|
|
141
|
+
}
|
|
142
|
+
export declare namespace CometCore {
|
|
143
|
+
type AssetInfoStruct = [
|
|
144
|
+
number | string | BN,
|
|
145
|
+
string,
|
|
146
|
+
string,
|
|
147
|
+
number | string | BN,
|
|
148
|
+
number | string | BN,
|
|
149
|
+
number | string | BN,
|
|
150
|
+
number | string | BN,
|
|
151
|
+
number | string | BN
|
|
152
|
+
] | {
|
|
153
|
+
offset: number | string | BN;
|
|
154
|
+
asset: string;
|
|
155
|
+
priceFeed: string;
|
|
156
|
+
scale: number | string | BN;
|
|
157
|
+
borrowCollateralFactor: number | string | BN;
|
|
158
|
+
liquidateCollateralFactor: number | string | BN;
|
|
159
|
+
liquidationFactor: number | string | BN;
|
|
160
|
+
supplyCap: number | string | BN;
|
|
161
|
+
};
|
|
162
|
+
type AssetInfoStructOutputArray = [
|
|
163
|
+
string,
|
|
164
|
+
string,
|
|
165
|
+
string,
|
|
166
|
+
string,
|
|
167
|
+
string,
|
|
168
|
+
string,
|
|
169
|
+
string,
|
|
170
|
+
string
|
|
171
|
+
];
|
|
172
|
+
type AssetInfoStructOutputStruct = {
|
|
173
|
+
offset: string;
|
|
174
|
+
asset: string;
|
|
175
|
+
priceFeed: string;
|
|
176
|
+
scale: string;
|
|
177
|
+
borrowCollateralFactor: string;
|
|
178
|
+
liquidateCollateralFactor: string;
|
|
179
|
+
liquidationFactor: string;
|
|
180
|
+
supplyCap: string;
|
|
181
|
+
};
|
|
182
|
+
type AssetInfoStructOutput = AssetInfoStructOutputArray & AssetInfoStructOutputStruct;
|
|
183
|
+
}
|
|
184
|
+
export type AbsorbCollateral = ContractEventLog<{
|
|
185
|
+
absorber: string;
|
|
186
|
+
borrower: string;
|
|
187
|
+
asset: string;
|
|
188
|
+
collateralAbsorbed: string;
|
|
189
|
+
usdValue: string;
|
|
190
|
+
0: string;
|
|
191
|
+
1: string;
|
|
192
|
+
2: string;
|
|
193
|
+
3: string;
|
|
194
|
+
4: string;
|
|
195
|
+
}>;
|
|
196
|
+
export type AbsorbDebt = ContractEventLog<{
|
|
197
|
+
absorber: string;
|
|
198
|
+
borrower: string;
|
|
199
|
+
basePaidOut: string;
|
|
200
|
+
usdValue: string;
|
|
201
|
+
0: string;
|
|
202
|
+
1: string;
|
|
203
|
+
2: string;
|
|
204
|
+
3: string;
|
|
205
|
+
}>;
|
|
206
|
+
export type BuyCollateral = ContractEventLog<{
|
|
207
|
+
buyer: string;
|
|
208
|
+
asset: string;
|
|
209
|
+
baseAmount: string;
|
|
210
|
+
collateralAmount: string;
|
|
211
|
+
0: string;
|
|
212
|
+
1: string;
|
|
213
|
+
2: string;
|
|
214
|
+
3: string;
|
|
215
|
+
}>;
|
|
216
|
+
export type PauseAction = ContractEventLog<{
|
|
217
|
+
supplyPaused: boolean;
|
|
218
|
+
transferPaused: boolean;
|
|
219
|
+
withdrawPaused: boolean;
|
|
220
|
+
absorbPaused: boolean;
|
|
221
|
+
buyPaused: boolean;
|
|
222
|
+
0: boolean;
|
|
223
|
+
1: boolean;
|
|
224
|
+
2: boolean;
|
|
225
|
+
3: boolean;
|
|
226
|
+
4: boolean;
|
|
227
|
+
}>;
|
|
228
|
+
export type Supply = ContractEventLog<{
|
|
229
|
+
from: string;
|
|
230
|
+
dst: string;
|
|
231
|
+
amount: string;
|
|
232
|
+
0: string;
|
|
233
|
+
1: string;
|
|
234
|
+
2: string;
|
|
235
|
+
}>;
|
|
236
|
+
export type SupplyCollateral = ContractEventLog<{
|
|
237
|
+
from: string;
|
|
238
|
+
dst: string;
|
|
239
|
+
asset: string;
|
|
240
|
+
amount: string;
|
|
241
|
+
0: string;
|
|
242
|
+
1: string;
|
|
243
|
+
2: string;
|
|
244
|
+
3: string;
|
|
245
|
+
}>;
|
|
246
|
+
export type Transfer = ContractEventLog<{
|
|
247
|
+
from: string;
|
|
248
|
+
to: string;
|
|
249
|
+
amount: string;
|
|
250
|
+
0: string;
|
|
251
|
+
1: string;
|
|
252
|
+
2: string;
|
|
253
|
+
}>;
|
|
254
|
+
export type TransferCollateral = ContractEventLog<{
|
|
255
|
+
from: string;
|
|
256
|
+
to: string;
|
|
257
|
+
asset: string;
|
|
258
|
+
amount: string;
|
|
259
|
+
0: string;
|
|
260
|
+
1: string;
|
|
261
|
+
2: string;
|
|
262
|
+
3: string;
|
|
263
|
+
}>;
|
|
264
|
+
export type Withdraw = ContractEventLog<{
|
|
265
|
+
src: string;
|
|
266
|
+
to: string;
|
|
267
|
+
amount: string;
|
|
268
|
+
0: string;
|
|
269
|
+
1: string;
|
|
270
|
+
2: string;
|
|
271
|
+
}>;
|
|
272
|
+
export type WithdrawCollateral = ContractEventLog<{
|
|
273
|
+
src: string;
|
|
274
|
+
to: string;
|
|
275
|
+
asset: string;
|
|
276
|
+
amount: string;
|
|
277
|
+
0: string;
|
|
278
|
+
1: string;
|
|
279
|
+
2: string;
|
|
280
|
+
3: string;
|
|
281
|
+
}>;
|
|
282
|
+
export type WithdrawReserves = ContractEventLog<{
|
|
283
|
+
to: string;
|
|
284
|
+
amount: string;
|
|
285
|
+
0: string;
|
|
286
|
+
1: string;
|
|
287
|
+
}>;
|
|
288
|
+
export interface CWstETHv3 extends BaseContract {
|
|
289
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): CWstETHv3;
|
|
290
|
+
clone(): CWstETHv3;
|
|
291
|
+
methods: {
|
|
292
|
+
absorb(absorber: string, accounts: string[]): NonPayableTransactionObject<void>;
|
|
293
|
+
accrueAccount(account: string): NonPayableTransactionObject<void>;
|
|
294
|
+
approveThis(manager: string, asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
295
|
+
balanceOf(account: string): NonPayableTransactionObject<string>;
|
|
296
|
+
baseBorrowMin(): NonPayableTransactionObject<string>;
|
|
297
|
+
baseMinForRewards(): NonPayableTransactionObject<string>;
|
|
298
|
+
baseScale(): NonPayableTransactionObject<string>;
|
|
299
|
+
baseToken(): NonPayableTransactionObject<string>;
|
|
300
|
+
baseTokenPriceFeed(): NonPayableTransactionObject<string>;
|
|
301
|
+
baseTrackingBorrowSpeed(): NonPayableTransactionObject<string>;
|
|
302
|
+
baseTrackingSupplySpeed(): NonPayableTransactionObject<string>;
|
|
303
|
+
borrowBalanceOf(account: string): NonPayableTransactionObject<string>;
|
|
304
|
+
borrowKink(): NonPayableTransactionObject<string>;
|
|
305
|
+
borrowPerSecondInterestRateBase(): NonPayableTransactionObject<string>;
|
|
306
|
+
borrowPerSecondInterestRateSlopeHigh(): NonPayableTransactionObject<string>;
|
|
307
|
+
borrowPerSecondInterestRateSlopeLow(): NonPayableTransactionObject<string>;
|
|
308
|
+
buyCollateral(asset: string, minAmount: number | string | BN, baseAmount: number | string | BN, recipient: string): NonPayableTransactionObject<void>;
|
|
309
|
+
decimals(): NonPayableTransactionObject<string>;
|
|
310
|
+
extensionDelegate(): NonPayableTransactionObject<string>;
|
|
311
|
+
getAssetInfo(i: number | string | BN): NonPayableTransactionObject<CometCore.AssetInfoStructOutput>;
|
|
312
|
+
getAssetInfoByAddress(asset: string): NonPayableTransactionObject<CometCore.AssetInfoStructOutput>;
|
|
313
|
+
getBorrowRate(utilization: number | string | BN): NonPayableTransactionObject<string>;
|
|
314
|
+
getCollateralReserves(asset: string): NonPayableTransactionObject<string>;
|
|
315
|
+
getPrice(priceFeed: string): NonPayableTransactionObject<string>;
|
|
316
|
+
getReserves(): NonPayableTransactionObject<string>;
|
|
317
|
+
getSupplyRate(utilization: number | string | BN): NonPayableTransactionObject<string>;
|
|
318
|
+
getUtilization(): NonPayableTransactionObject<string>;
|
|
319
|
+
governor(): NonPayableTransactionObject<string>;
|
|
320
|
+
hasPermission(owner: string, manager: string): NonPayableTransactionObject<boolean>;
|
|
321
|
+
initializeStorage(): NonPayableTransactionObject<void>;
|
|
322
|
+
isAbsorbPaused(): NonPayableTransactionObject<boolean>;
|
|
323
|
+
isAllowed(arg0: string, arg1: string): NonPayableTransactionObject<boolean>;
|
|
324
|
+
isBorrowCollateralized(account: string): NonPayableTransactionObject<boolean>;
|
|
325
|
+
isBuyPaused(): NonPayableTransactionObject<boolean>;
|
|
326
|
+
isLiquidatable(account: string): NonPayableTransactionObject<boolean>;
|
|
327
|
+
isSupplyPaused(): NonPayableTransactionObject<boolean>;
|
|
328
|
+
isTransferPaused(): NonPayableTransactionObject<boolean>;
|
|
329
|
+
isWithdrawPaused(): NonPayableTransactionObject<boolean>;
|
|
330
|
+
liquidatorPoints(arg0: string): NonPayableTransactionObject<[
|
|
331
|
+
string,
|
|
332
|
+
string,
|
|
333
|
+
string,
|
|
334
|
+
string
|
|
335
|
+
] & {
|
|
336
|
+
numAbsorbs: string;
|
|
337
|
+
numAbsorbed: string;
|
|
338
|
+
approxSpend: string;
|
|
339
|
+
_reserved: string;
|
|
340
|
+
}>;
|
|
341
|
+
numAssets(): NonPayableTransactionObject<string>;
|
|
342
|
+
pause(supplyPaused: boolean, transferPaused: boolean, withdrawPaused: boolean, absorbPaused: boolean, buyPaused: boolean): NonPayableTransactionObject<void>;
|
|
343
|
+
pauseGuardian(): NonPayableTransactionObject<string>;
|
|
344
|
+
quoteCollateral(asset: string, baseAmount: number | string | BN): NonPayableTransactionObject<string>;
|
|
345
|
+
storeFrontPriceFactor(): NonPayableTransactionObject<string>;
|
|
346
|
+
supply(asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
347
|
+
supplyFrom(from: string, dst: string, asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
348
|
+
supplyKink(): NonPayableTransactionObject<string>;
|
|
349
|
+
supplyPerSecondInterestRateBase(): NonPayableTransactionObject<string>;
|
|
350
|
+
supplyPerSecondInterestRateSlopeHigh(): NonPayableTransactionObject<string>;
|
|
351
|
+
supplyPerSecondInterestRateSlopeLow(): NonPayableTransactionObject<string>;
|
|
352
|
+
supplyTo(dst: string, asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
353
|
+
targetReserves(): NonPayableTransactionObject<string>;
|
|
354
|
+
totalBorrow(): NonPayableTransactionObject<string>;
|
|
355
|
+
totalSupply(): NonPayableTransactionObject<string>;
|
|
356
|
+
totalsCollateral(arg0: string): NonPayableTransactionObject<[
|
|
357
|
+
string,
|
|
358
|
+
string
|
|
359
|
+
] & {
|
|
360
|
+
totalSupplyAsset: string;
|
|
361
|
+
_reserved: string;
|
|
362
|
+
}>;
|
|
363
|
+
trackingIndexScale(): NonPayableTransactionObject<string>;
|
|
364
|
+
transfer(dst: string, amount: number | string | BN): NonPayableTransactionObject<boolean>;
|
|
365
|
+
transferAsset(dst: string, asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
366
|
+
transferAssetFrom(src: string, dst: string, asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
367
|
+
transferFrom(src: string, dst: string, amount: number | string | BN): NonPayableTransactionObject<boolean>;
|
|
368
|
+
userBasic(arg0: string): NonPayableTransactionObject<[
|
|
369
|
+
string,
|
|
370
|
+
string,
|
|
371
|
+
string,
|
|
372
|
+
string,
|
|
373
|
+
string
|
|
374
|
+
] & {
|
|
375
|
+
principal: string;
|
|
376
|
+
baseTrackingIndex: string;
|
|
377
|
+
baseTrackingAccrued: string;
|
|
378
|
+
assetsIn: string;
|
|
379
|
+
_reserved: string;
|
|
380
|
+
}>;
|
|
381
|
+
userCollateral(arg0: string, arg1: string): NonPayableTransactionObject<[
|
|
382
|
+
string,
|
|
383
|
+
string
|
|
384
|
+
] & {
|
|
385
|
+
balance: string;
|
|
386
|
+
_reserved: string;
|
|
387
|
+
}>;
|
|
388
|
+
userNonce(arg0: string): NonPayableTransactionObject<string>;
|
|
389
|
+
withdraw(asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
390
|
+
withdrawFrom(src: string, to: string, asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
391
|
+
withdrawReserves(to: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
392
|
+
withdrawTo(to: string, asset: string, amount: number | string | BN): NonPayableTransactionObject<void>;
|
|
393
|
+
};
|
|
394
|
+
events: {
|
|
395
|
+
AbsorbCollateral(cb?: Callback<AbsorbCollateral>): EventEmitter;
|
|
396
|
+
AbsorbCollateral(options?: EventOptions, cb?: Callback<AbsorbCollateral>): EventEmitter;
|
|
397
|
+
AbsorbDebt(cb?: Callback<AbsorbDebt>): EventEmitter;
|
|
398
|
+
AbsorbDebt(options?: EventOptions, cb?: Callback<AbsorbDebt>): EventEmitter;
|
|
399
|
+
BuyCollateral(cb?: Callback<BuyCollateral>): EventEmitter;
|
|
400
|
+
BuyCollateral(options?: EventOptions, cb?: Callback<BuyCollateral>): EventEmitter;
|
|
401
|
+
PauseAction(cb?: Callback<PauseAction>): EventEmitter;
|
|
402
|
+
PauseAction(options?: EventOptions, cb?: Callback<PauseAction>): EventEmitter;
|
|
403
|
+
Supply(cb?: Callback<Supply>): EventEmitter;
|
|
404
|
+
Supply(options?: EventOptions, cb?: Callback<Supply>): EventEmitter;
|
|
405
|
+
SupplyCollateral(cb?: Callback<SupplyCollateral>): EventEmitter;
|
|
406
|
+
SupplyCollateral(options?: EventOptions, cb?: Callback<SupplyCollateral>): EventEmitter;
|
|
407
|
+
Transfer(cb?: Callback<Transfer>): EventEmitter;
|
|
408
|
+
Transfer(options?: EventOptions, cb?: Callback<Transfer>): EventEmitter;
|
|
409
|
+
TransferCollateral(cb?: Callback<TransferCollateral>): EventEmitter;
|
|
410
|
+
TransferCollateral(options?: EventOptions, cb?: Callback<TransferCollateral>): EventEmitter;
|
|
411
|
+
Withdraw(cb?: Callback<Withdraw>): EventEmitter;
|
|
412
|
+
Withdraw(options?: EventOptions, cb?: Callback<Withdraw>): EventEmitter;
|
|
413
|
+
WithdrawCollateral(cb?: Callback<WithdrawCollateral>): EventEmitter;
|
|
414
|
+
WithdrawCollateral(options?: EventOptions, cb?: Callback<WithdrawCollateral>): EventEmitter;
|
|
415
|
+
WithdrawReserves(cb?: Callback<WithdrawReserves>): EventEmitter;
|
|
416
|
+
WithdrawReserves(options?: EventOptions, cb?: Callback<WithdrawReserves>): EventEmitter;
|
|
417
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
418
|
+
};
|
|
419
|
+
once(event: "AbsorbCollateral", cb: Callback<AbsorbCollateral>): void;
|
|
420
|
+
once(event: "AbsorbCollateral", options: EventOptions, cb: Callback<AbsorbCollateral>): void;
|
|
421
|
+
once(event: "AbsorbDebt", cb: Callback<AbsorbDebt>): void;
|
|
422
|
+
once(event: "AbsorbDebt", options: EventOptions, cb: Callback<AbsorbDebt>): void;
|
|
423
|
+
once(event: "BuyCollateral", cb: Callback<BuyCollateral>): void;
|
|
424
|
+
once(event: "BuyCollateral", options: EventOptions, cb: Callback<BuyCollateral>): void;
|
|
425
|
+
once(event: "PauseAction", cb: Callback<PauseAction>): void;
|
|
426
|
+
once(event: "PauseAction", options: EventOptions, cb: Callback<PauseAction>): void;
|
|
427
|
+
once(event: "Supply", cb: Callback<Supply>): void;
|
|
428
|
+
once(event: "Supply", options: EventOptions, cb: Callback<Supply>): void;
|
|
429
|
+
once(event: "SupplyCollateral", cb: Callback<SupplyCollateral>): void;
|
|
430
|
+
once(event: "SupplyCollateral", options: EventOptions, cb: Callback<SupplyCollateral>): void;
|
|
431
|
+
once(event: "Transfer", cb: Callback<Transfer>): void;
|
|
432
|
+
once(event: "Transfer", options: EventOptions, cb: Callback<Transfer>): void;
|
|
433
|
+
once(event: "TransferCollateral", cb: Callback<TransferCollateral>): void;
|
|
434
|
+
once(event: "TransferCollateral", options: EventOptions, cb: Callback<TransferCollateral>): void;
|
|
435
|
+
once(event: "Withdraw", cb: Callback<Withdraw>): void;
|
|
436
|
+
once(event: "Withdraw", options: EventOptions, cb: Callback<Withdraw>): void;
|
|
437
|
+
once(event: "WithdrawCollateral", cb: Callback<WithdrawCollateral>): void;
|
|
438
|
+
once(event: "WithdrawCollateral", options: EventOptions, cb: Callback<WithdrawCollateral>): void;
|
|
439
|
+
once(event: "WithdrawReserves", cb: Callback<WithdrawReserves>): void;
|
|
440
|
+
once(event: "WithdrawReserves", options: EventOptions, cb: Callback<WithdrawReserves>): void;
|
|
441
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { ContractOptions } from "web3-eth-contract";
|
|
3
|
+
import type { EventLog } from "web3-core";
|
|
4
|
+
import type { EventEmitter } from "events";
|
|
5
|
+
import type { Callback, NonPayableTransactionObject, BlockType, BaseContract } from "./types";
|
|
6
|
+
export interface EventOptions {
|
|
7
|
+
filter?: object;
|
|
8
|
+
fromBlock?: BlockType;
|
|
9
|
+
topics?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface WstETHPriceFeed extends BaseContract {
|
|
12
|
+
constructor(jsonInterface: any[], address?: string, options?: ContractOptions): WstETHPriceFeed;
|
|
13
|
+
clone(): WstETHPriceFeed;
|
|
14
|
+
methods: {
|
|
15
|
+
decimals(): NonPayableTransactionObject<string>;
|
|
16
|
+
description(): NonPayableTransactionObject<string>;
|
|
17
|
+
latestRoundData(): NonPayableTransactionObject<[
|
|
18
|
+
string,
|
|
19
|
+
string,
|
|
20
|
+
string,
|
|
21
|
+
string,
|
|
22
|
+
string
|
|
23
|
+
] & {
|
|
24
|
+
roundId: string;
|
|
25
|
+
answer: string;
|
|
26
|
+
startedAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
answeredInRound: string;
|
|
29
|
+
}>;
|
|
30
|
+
stETHToETHPriceFeedDecimals(): NonPayableTransactionObject<string>;
|
|
31
|
+
stETHtoETHPriceFeed(): NonPayableTransactionObject<string>;
|
|
32
|
+
version(): NonPayableTransactionObject<string>;
|
|
33
|
+
wstETH(): NonPayableTransactionObject<string>;
|
|
34
|
+
wstETHScale(): NonPayableTransactionObject<string>;
|
|
35
|
+
};
|
|
36
|
+
events: {
|
|
37
|
+
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -58,11 +58,14 @@ export type { SparkView } from "./SparkView";
|
|
|
58
58
|
export type { TroveManager } from "./TroveManager";
|
|
59
59
|
export type { USDCPriceFeed } from "./USDCPriceFeed";
|
|
60
60
|
export type { UniMulticall } from "./UniMulticall";
|
|
61
|
+
export type { WstETHPriceFeed } from "./WstETHPriceFeed";
|
|
61
62
|
export type { CETHv3 } from "./CETHv3";
|
|
62
63
|
export type { CUSDCev3 } from "./CUSDCev3";
|
|
63
64
|
export type { CUSDCv3 } from "./CUSDCv3";
|
|
65
|
+
export type { CUSDSv3 } from "./CUSDSv3";
|
|
64
66
|
export type { CUSDTv3 } from "./CUSDTv3";
|
|
65
67
|
export type { CUSDbCv3 } from "./CUSDbCv3";
|
|
68
|
+
export type { CWstETHv3 } from "./CWstETHv3";
|
|
66
69
|
export type { CrvUSDETHAmm } from "./CrvUSDETHAmm";
|
|
67
70
|
export type { CrvUSDETHController } from "./CrvUSDETHController";
|
|
68
71
|
export type { CrvUSDFactory } from "./CrvUSDFactory";
|
|
@@ -19,6 +19,7 @@ export declare enum MorphoBlueVersions {
|
|
|
19
19
|
MorphoBlueCbBTCEth_915 = "morphobluecbbtceth",
|
|
20
20
|
MorphoBlueCbBTCUSDC_860 = "morphobluecbbtcusdc",
|
|
21
21
|
MorphoBlueSUSDeUSDC_915 = "morphobluesusdeusdc_915",
|
|
22
|
+
MorphoBlueLBTVWBTC_945 = "morphobluelbtcwbtc_945",
|
|
22
23
|
MorphoBlueEzEthEth_860 = "morphoblueezetheth_860",
|
|
23
24
|
MorphoBlueEzEthEth_945 = "morphoblueezetheth_945",
|
|
24
25
|
MorphoBlueWeEthEth_860 = "morphoblueweetheth_860",
|
|
@@ -47,7 +48,10 @@ export declare enum MorphoBlueVersions {
|
|
|
47
48
|
MorphoBlueREthEth_945_Base = "morphoblueretheth_945_base",
|
|
48
49
|
MorphoBlueCbBTCEth_915_Base = "morphobluecbbtceth_915_base",
|
|
49
50
|
MorphoBlueCbBTCUSDC_860_Base = "morphobluecbbtcusdc_860_base",
|
|
50
|
-
MorphoBlueWsuperOETHbWETH_915_Base = "morphobluewsuperoethbweth_915_base"
|
|
51
|
+
MorphoBlueWsuperOETHbWETH_915_Base = "morphobluewsuperoethbweth_915_base",
|
|
52
|
+
MorphoBlueLBTCCbBTC_945_Base = "morphobluelbtccbbtc_945_base",
|
|
53
|
+
MorphoBlueWstEthEURC_860_Base = "morphobluewstetheurc_860_base",
|
|
54
|
+
MorphoBlueCbBTCEURC_860_Base = "morphobluecbbtceurc_860_base"
|
|
51
55
|
}
|
|
52
56
|
export declare enum MorphoBlueOracleType {
|
|
53
57
|
MARKET_RATE = "Market rate",
|
package/esm/types/morphoBlue.js
CHANGED
|
@@ -20,6 +20,7 @@ export var MorphoBlueVersions;
|
|
|
20
20
|
MorphoBlueVersions["MorphoBlueCbBTCEth_915"] = "morphobluecbbtceth";
|
|
21
21
|
MorphoBlueVersions["MorphoBlueCbBTCUSDC_860"] = "morphobluecbbtcusdc";
|
|
22
22
|
MorphoBlueVersions["MorphoBlueSUSDeUSDC_915"] = "morphobluesusdeusdc_915";
|
|
23
|
+
MorphoBlueVersions["MorphoBlueLBTVWBTC_945"] = "morphobluelbtcwbtc_945";
|
|
23
24
|
// ezETH/ETH
|
|
24
25
|
MorphoBlueVersions["MorphoBlueEzEthEth_860"] = "morphoblueezetheth_860";
|
|
25
26
|
MorphoBlueVersions["MorphoBlueEzEthEth_945"] = "morphoblueezetheth_945";
|
|
@@ -55,6 +56,9 @@ export var MorphoBlueVersions;
|
|
|
55
56
|
MorphoBlueVersions["MorphoBlueCbBTCEth_915_Base"] = "morphobluecbbtceth_915_base";
|
|
56
57
|
MorphoBlueVersions["MorphoBlueCbBTCUSDC_860_Base"] = "morphobluecbbtcusdc_860_base";
|
|
57
58
|
MorphoBlueVersions["MorphoBlueWsuperOETHbWETH_915_Base"] = "morphobluewsuperoethbweth_915_base";
|
|
59
|
+
MorphoBlueVersions["MorphoBlueLBTCCbBTC_945_Base"] = "morphobluelbtccbbtc_945_base";
|
|
60
|
+
MorphoBlueVersions["MorphoBlueWstEthEURC_860_Base"] = "morphobluewstetheurc_860_base";
|
|
61
|
+
MorphoBlueVersions["MorphoBlueCbBTCEURC_860_Base"] = "morphobluecbbtceurc_860_base";
|
|
58
62
|
})(MorphoBlueVersions || (MorphoBlueVersions = {}));
|
|
59
63
|
export var MorphoBlueOracleType;
|
|
60
64
|
(function (MorphoBlueOracleType) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/positions-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.185-dev",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"author": "",
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@defisaver/tokens": "^1.5.
|
|
26
|
+
"@defisaver/tokens": "^1.5.51",
|
|
27
27
|
"@ethersproject/bignumber": "^5.7.0",
|
|
28
28
|
"@morpho-org/morpho-aave-v3-sdk": "^1.5.3",
|
|
29
29
|
"decimal.js": "^10.4.3"
|
package/src/aaveV3/index.ts
CHANGED
|
@@ -187,7 +187,7 @@ export async function getAaveV3MarketData(web3: Web3, network: NetworkNumber, ma
|
|
|
187
187
|
const assetsData: AaveV3AssetData[] = await Promise.all(loanInfo
|
|
188
188
|
.map(async (tokenMarket, i) => {
|
|
189
189
|
const symbol = market.assets[i];
|
|
190
|
-
const nativeAsset = symbol === 'GHO' && network === NetworkNumber.Eth;
|
|
190
|
+
const nativeAsset = symbol === 'GHO' && network === NetworkNumber.Eth && market.shortLabel === 'v3default';
|
|
191
191
|
|
|
192
192
|
// eslint-disable-next-line guard-for-in
|
|
193
193
|
for (const eModeIndex in eModeCategoriesData) {
|
package/src/compoundV3/index.ts
CHANGED
|
@@ -23,12 +23,25 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
COMPOUND_V3_ETH, COMPOUND_V3_USDBC, COMPOUND_V3_USDC, COMPOUND_V3_USDCe, COMPOUND_V3_USDT,
|
|
25
25
|
} from '../markets/compound';
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
getEthPrice, getCompPrice, getUSDCPrice, getWstETHPrice,
|
|
28
|
+
} from '../services/priceService';
|
|
27
29
|
|
|
28
30
|
const getSupportedAssetsAddressesForMarket = (selectedMarket: CompoundMarketData, network: NetworkNumber) => selectedMarket.collAssets.map(asset => getAssetInfo(ethToWeth(asset), network)).map(addr => addr.address.toLowerCase());
|
|
29
31
|
|
|
32
|
+
const getBaseAssetPriceFunction = (asset: string) => {
|
|
33
|
+
switch (asset) {
|
|
34
|
+
case 'wstETH':
|
|
35
|
+
return getWstETHPrice;
|
|
36
|
+
case 'ETH':
|
|
37
|
+
return getEthPrice;
|
|
38
|
+
default:
|
|
39
|
+
return getUSDCPrice;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
30
43
|
export const getCompoundV3MarketsData = async (web3: Web3, network: NetworkNumber, selectedMarket: CompoundMarketData, defaultWeb3: Web3): Promise<CompoundV3MarketsData> => {
|
|
31
|
-
const baseAssetPrice = selectedMarket.baseAsset
|
|
44
|
+
const baseAssetPrice = await getBaseAssetPriceFunction(selectedMarket.baseAsset)(defaultWeb3);
|
|
32
45
|
const compPrice = await getCompPrice(defaultWeb3);
|
|
33
46
|
const contract = CompV3ViewContract(web3, network);
|
|
34
47
|
const CompV3ViewAddress = contract.options.address;
|