@defisaver/automation-sdk 1.2.33 → 2.0.0
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/esm/abis/legacy_AaveV2Subscriptions.json +1 -1
- package/esm/abis/legacy_CompoundV2Subscriptions.json +1 -1
- package/esm/abis/legacy_MakerSubscriptions.json +1 -1
- package/esm/services/strategiesService.js +36 -36
- package/esm/services/strategySubService.d.ts +9 -9
- package/esm/services/strategySubService.js +31 -31
- package/esm/services/subDataService.d.ts +4 -4
- package/esm/services/subDataService.js +20 -20
- package/esm/types/index.d.ts +4 -4
- package/package.json +1 -1
- package/src/abis/legacy_AaveV2Subscriptions.json +1 -1
- package/src/abis/legacy_CompoundV2Subscriptions.json +1 -1
- package/src/abis/legacy_MakerSubscriptions.json +1 -1
- package/src/services/strategiesService.ts +36 -36
- package/src/services/strategySubService.ts +56 -56
- package/src/services/subDataService.ts +32 -32
- package/src/types/contracts/generated/Legacy_AaveV2Subscriptions.ts +8 -8
- package/src/types/contracts/generated/Legacy_CompoundV2Subscriptions.ts +8 -8
- package/src/types/contracts/generated/Legacy_MakerSubscriptions.ts +11 -11
- package/src/types/index.ts +4 -4
- package/umd/index.js +73 -73
- package/yarn-error.log +7233 -0
|
@@ -24,8 +24,8 @@ function parseMakerSavingsLiqProtection(position: Position.Automated, parseData:
|
|
|
24
24
|
_position.strategyData.decoded.subData = subData;
|
|
25
25
|
|
|
26
26
|
_position.specific = {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
triggerRepayRatio: Number(triggerData.ratio),
|
|
28
|
+
targetRepayRatio: Number(subData.targetRatio),
|
|
29
29
|
repayEnabled: true,
|
|
30
30
|
boostEnabled: false,
|
|
31
31
|
};
|
|
@@ -93,15 +93,15 @@ function parseMakerLeverageManagement(position: Position.Automated, parseData: P
|
|
|
93
93
|
|
|
94
94
|
if (isRepay) {
|
|
95
95
|
_position.specific = {
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
triggerRepayRatio: triggerData.ratio,
|
|
97
|
+
targetRepayRatio: subData.targetRatio,
|
|
98
98
|
repayEnabled: true,
|
|
99
99
|
subId1: Number(subId),
|
|
100
100
|
};
|
|
101
101
|
} else {
|
|
102
102
|
_position.specific = {
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
triggerBoostRatio: triggerData.ratio,
|
|
104
|
+
targetBoostRatio: subData.targetRatio,
|
|
105
105
|
boostEnabled: isEnabled,
|
|
106
106
|
subId2: Number(subId),
|
|
107
107
|
};
|
|
@@ -173,15 +173,15 @@ function parseAaveV2LeverageManagement(position: Position.Automated, parseData:
|
|
|
173
173
|
|
|
174
174
|
if (isRepay) {
|
|
175
175
|
_position.specific = {
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
triggerRepayRatio: triggerData.ratio,
|
|
177
|
+
targetRepayRatio: subData.targetRatio,
|
|
178
178
|
repayEnabled: true,
|
|
179
179
|
subId1: Number(subId),
|
|
180
180
|
};
|
|
181
181
|
} else {
|
|
182
182
|
_position.specific = {
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
triggerBoostRatio: triggerData.ratio,
|
|
184
|
+
targetBoostRatio: subData.targetRatio,
|
|
185
185
|
boostEnabled: isEnabled,
|
|
186
186
|
subId2: Number(subId),
|
|
187
187
|
};
|
|
@@ -209,15 +209,15 @@ function parseAaveV3LeverageManagement(position: Position.Automated, parseData:
|
|
|
209
209
|
|
|
210
210
|
if (isRepay) {
|
|
211
211
|
_position.specific = {
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
triggerRepayRatio: triggerData.ratio,
|
|
213
|
+
targetRepayRatio: subData.targetRatio,
|
|
214
214
|
repayEnabled: true,
|
|
215
215
|
subId1: Number(subId),
|
|
216
216
|
};
|
|
217
217
|
} else {
|
|
218
218
|
_position.specific = {
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
triggerBoostRatio: triggerData.ratio,
|
|
220
|
+
targetBoostRatio: subData.targetRatio,
|
|
221
221
|
boostEnabled: isEnabled,
|
|
222
222
|
subId2: Number(subId),
|
|
223
223
|
};
|
|
@@ -245,15 +245,15 @@ function parseMorphoAaveV2LeverageManagement(position: Position.Automated, parse
|
|
|
245
245
|
|
|
246
246
|
if (isRepay) {
|
|
247
247
|
_position.specific = {
|
|
248
|
-
|
|
249
|
-
|
|
248
|
+
triggerRepayRatio: triggerData.ratio,
|
|
249
|
+
targetRepayRatio: subData.targetRatio,
|
|
250
250
|
repayEnabled: true,
|
|
251
251
|
subId1: Number(subId),
|
|
252
252
|
};
|
|
253
253
|
} else {
|
|
254
254
|
_position.specific = {
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
triggerBoostRatio: triggerData.ratio,
|
|
256
|
+
targetBoostRatio: subData.targetRatio,
|
|
257
257
|
boostEnabled: isEnabled,
|
|
258
258
|
subId2: Number(subId),
|
|
259
259
|
};
|
|
@@ -315,15 +315,15 @@ function parseCompoundV2LeverageManagement(position: Position.Automated, parseDa
|
|
|
315
315
|
|
|
316
316
|
if (isRepay) {
|
|
317
317
|
_position.specific = {
|
|
318
|
-
|
|
319
|
-
|
|
318
|
+
triggerRepayRatio: triggerData.ratio,
|
|
319
|
+
targetRepayRatio: subData.targetRatio,
|
|
320
320
|
repayEnabled: true,
|
|
321
321
|
subId1: Number(subId),
|
|
322
322
|
};
|
|
323
323
|
} else {
|
|
324
324
|
_position.specific = {
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
triggerBoostRatio: triggerData.ratio,
|
|
326
|
+
targetBoostRatio: subData.targetRatio,
|
|
327
327
|
boostEnabled: isEnabled,
|
|
328
328
|
subId2: Number(subId),
|
|
329
329
|
};
|
|
@@ -351,15 +351,15 @@ function parseCompoundV3LeverageManagement(position: Position.Automated, parseDa
|
|
|
351
351
|
|
|
352
352
|
if (isRepay) {
|
|
353
353
|
_position.specific = {
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
triggerRepayRatio: triggerData.ratio,
|
|
355
|
+
targetRepayRatio: subData.targetRatio,
|
|
356
356
|
repayEnabled: true,
|
|
357
357
|
subId1: Number(subId),
|
|
358
358
|
};
|
|
359
359
|
} else {
|
|
360
360
|
_position.specific = {
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
triggerBoostRatio: triggerData.ratio,
|
|
362
|
+
targetBoostRatio: subData.targetRatio,
|
|
363
363
|
boostEnabled: isEnabled,
|
|
364
364
|
subId2: Number(subId),
|
|
365
365
|
};
|
|
@@ -395,8 +395,8 @@ function parseLiquityBondProtection(position: Position.Automated, parseData: Par
|
|
|
395
395
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
396
396
|
|
|
397
397
|
_position.specific = {
|
|
398
|
-
|
|
399
|
-
|
|
398
|
+
triggerRepayRatio: Number(triggerData.ratio),
|
|
399
|
+
targetRepayRatio: Infinity, // Unknown targetRepayRatio, uses all assets from chicken bond until trove min debt (2000LUSD)
|
|
400
400
|
repayEnabled: true,
|
|
401
401
|
};
|
|
402
402
|
return _position;
|
|
@@ -440,15 +440,15 @@ function parseLiquityLeverageManagement(position: Position.Automated, parseData:
|
|
|
440
440
|
|
|
441
441
|
if (isRepay) {
|
|
442
442
|
_position.specific = {
|
|
443
|
-
|
|
444
|
-
|
|
443
|
+
triggerRepayRatio: triggerData.ratio,
|
|
444
|
+
targetRepayRatio: subData.targetRatio,
|
|
445
445
|
repayEnabled: true,
|
|
446
446
|
subId1: Number(subId),
|
|
447
447
|
};
|
|
448
448
|
} else {
|
|
449
449
|
_position.specific = {
|
|
450
|
-
|
|
451
|
-
|
|
450
|
+
triggerBoostRatio: triggerData.ratio,
|
|
451
|
+
targetBoostRatio: subData.targetRatio,
|
|
452
452
|
boostEnabled: isEnabled,
|
|
453
453
|
subId2: Number(subId),
|
|
454
454
|
};
|
|
@@ -476,15 +476,15 @@ function parseSparkLeverageManagement(position: Position.Automated, parseData: P
|
|
|
476
476
|
|
|
477
477
|
if (isRepay) {
|
|
478
478
|
_position.specific = {
|
|
479
|
-
|
|
480
|
-
|
|
479
|
+
triggerRepayRatio: triggerData.ratio,
|
|
480
|
+
targetRepayRatio: subData.targetRatio,
|
|
481
481
|
repayEnabled: true,
|
|
482
482
|
subId1: Number(subId),
|
|
483
483
|
};
|
|
484
484
|
} else {
|
|
485
485
|
_position.specific = {
|
|
486
|
-
|
|
487
|
-
|
|
486
|
+
triggerBoostRatio: triggerData.ratio,
|
|
487
|
+
targetBoostRatio: subData.targetRatio,
|
|
488
488
|
boostEnabled: isEnabled,
|
|
489
489
|
subId2: Number(subId),
|
|
490
490
|
};
|
|
@@ -14,15 +14,15 @@ export const makerEncode = {
|
|
|
14
14
|
repayFromSavings(
|
|
15
15
|
bundleId: StrategyOrBundleIds,
|
|
16
16
|
vaultId: number,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
triggerRepayRatio: number,
|
|
18
|
+
targetRepayRatio: number,
|
|
19
19
|
isBundle: boolean = true,
|
|
20
20
|
chainId: ChainId = ChainId.Ethereum,
|
|
21
21
|
daiAddr?: EthereumAddress,
|
|
22
22
|
mcdCdpManagerAddr?: EthereumAddress,
|
|
23
23
|
) {
|
|
24
|
-
const subData = subDataService.makerRepayFromSavingsSubData.encode(vaultId,
|
|
25
|
-
const triggerData = triggerService.makerRatioTrigger.encode(vaultId,
|
|
24
|
+
const subData = subDataService.makerRepayFromSavingsSubData.encode(vaultId, targetRepayRatio, chainId, daiAddr, mcdCdpManagerAddr);
|
|
25
|
+
const triggerData = triggerService.makerRatioTrigger.encode(vaultId, triggerRepayRatio, RatioState.UNDER);
|
|
26
26
|
|
|
27
27
|
return [bundleId, isBundle, triggerData, subData];
|
|
28
28
|
},
|
|
@@ -74,18 +74,18 @@ export const makerEncode = {
|
|
|
74
74
|
},
|
|
75
75
|
leverageManagement(
|
|
76
76
|
vaultId:number,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
triggerRepayRatio:string,
|
|
78
|
+
triggerBoostRatio:string,
|
|
79
|
+
targetBoostRatio:string,
|
|
80
|
+
targetRepayRatio:string,
|
|
81
81
|
boostEnabled:boolean,
|
|
82
82
|
) {
|
|
83
83
|
return [
|
|
84
84
|
vaultId,
|
|
85
|
-
new Dec(
|
|
86
|
-
new Dec(
|
|
87
|
-
new Dec(
|
|
88
|
-
new Dec(
|
|
85
|
+
new Dec(triggerRepayRatio).mul(1e16).toString(),
|
|
86
|
+
new Dec(triggerBoostRatio).mul(1e16).toString(),
|
|
87
|
+
new Dec(targetBoostRatio).mul(1e16).toString(),
|
|
88
|
+
new Dec(targetRepayRatio).mul(1e16).toString(),
|
|
89
89
|
boostEnabled,
|
|
90
90
|
];
|
|
91
91
|
},
|
|
@@ -150,17 +150,17 @@ export const liquityEncode = {
|
|
|
150
150
|
return [strategyId, isBundle, triggerData, subData];
|
|
151
151
|
},
|
|
152
152
|
leverageManagement(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
triggerRepayRatio:string,
|
|
154
|
+
triggerBoostRatio:string,
|
|
155
|
+
targetBoostRatio:string,
|
|
156
|
+
targetRepayRatio:string,
|
|
157
157
|
boostEnabled:boolean,
|
|
158
158
|
) {
|
|
159
159
|
return [
|
|
160
|
-
new Dec(
|
|
161
|
-
new Dec(
|
|
162
|
-
new Dec(
|
|
163
|
-
new Dec(
|
|
160
|
+
new Dec(triggerRepayRatio).mul(1e16).toString(),
|
|
161
|
+
new Dec(triggerBoostRatio).mul(1e16).toString(),
|
|
162
|
+
new Dec(targetBoostRatio).mul(1e16).toString(),
|
|
163
|
+
new Dec(targetRepayRatio).mul(1e16).toString(),
|
|
164
164
|
boostEnabled,
|
|
165
165
|
];
|
|
166
166
|
},
|
|
@@ -174,33 +174,33 @@ export const chickenBondsEncode = {
|
|
|
174
174
|
|
|
175
175
|
export const aaveV2Encode = {
|
|
176
176
|
leverageManagement(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
triggerRepayRatio: number,
|
|
178
|
+
triggerBoostRatio: number,
|
|
179
|
+
targetBoostRatio: number,
|
|
180
|
+
targetRepayRatio: number,
|
|
181
181
|
boostEnabled: boolean,
|
|
182
182
|
) {
|
|
183
|
-
return subDataService.aaveV2LeverageManagementSubData.encode(
|
|
183
|
+
return subDataService.aaveV2LeverageManagementSubData.encode(triggerRepayRatio, triggerBoostRatio, targetBoostRatio, targetRepayRatio, boostEnabled);
|
|
184
184
|
},
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
export const aaveV3Encode = {
|
|
188
188
|
leverageManagement(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
triggerRepayRatio: number,
|
|
190
|
+
triggerBoostRatio: number,
|
|
191
|
+
targetBoostRatio: number,
|
|
192
|
+
targetRepayRatio: number,
|
|
193
193
|
boostEnabled: boolean,
|
|
194
194
|
) {
|
|
195
195
|
let subInput = '0x';
|
|
196
196
|
|
|
197
|
-
subInput = subInput.concat(new Dec(
|
|
197
|
+
subInput = subInput.concat(new Dec(triggerRepayRatio).mul(1e16).toHex().slice(2)
|
|
198
198
|
.padStart(32, '0'));
|
|
199
|
-
subInput = subInput.concat(new Dec(
|
|
199
|
+
subInput = subInput.concat(new Dec(triggerBoostRatio).mul(1e16).toHex().slice(2)
|
|
200
200
|
.padStart(32, '0'));
|
|
201
|
-
subInput = subInput.concat(new Dec(
|
|
201
|
+
subInput = subInput.concat(new Dec(targetBoostRatio).mul(1e16).toHex().slice(2)
|
|
202
202
|
.padStart(32, '0'));
|
|
203
|
-
subInput = subInput.concat(new Dec(
|
|
203
|
+
subInput = subInput.concat(new Dec(targetRepayRatio).mul(1e16).toHex().slice(2)
|
|
204
204
|
.padStart(32, '0'));
|
|
205
205
|
subInput = subInput.concat(boostEnabled ? '01' : '00');
|
|
206
206
|
|
|
@@ -232,13 +232,13 @@ export const aaveV3Encode = {
|
|
|
232
232
|
|
|
233
233
|
export const compoundV2Encode = {
|
|
234
234
|
leverageManagement(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
triggerRepayRatio: number,
|
|
236
|
+
triggerBoostRatio: number,
|
|
237
|
+
targetBoostRatio: number,
|
|
238
|
+
targetRepayRatio: number,
|
|
239
239
|
boostEnabled: boolean,
|
|
240
240
|
) {
|
|
241
|
-
return subDataService.compoundV2LeverageManagementSubData.encode(
|
|
241
|
+
return subDataService.compoundV2LeverageManagementSubData.encode(triggerRepayRatio, triggerBoostRatio, targetBoostRatio, targetRepayRatio, boostEnabled);
|
|
242
242
|
},
|
|
243
243
|
};
|
|
244
244
|
|
|
@@ -246,26 +246,26 @@ export const compoundV3Encode = {
|
|
|
246
246
|
leverageManagement(
|
|
247
247
|
market: EthereumAddress,
|
|
248
248
|
baseToken: EthereumAddress,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
triggerRepayRatio: number,
|
|
250
|
+
triggerBoostRatio: number,
|
|
251
|
+
targetBoostRatio: number,
|
|
252
|
+
targetRepayRatio: number,
|
|
253
253
|
boostEnabled: boolean,
|
|
254
254
|
isEOA: boolean,
|
|
255
255
|
) {
|
|
256
|
-
return subDataService.compoundV3LeverageManagementSubData.encode(market, baseToken,
|
|
256
|
+
return subDataService.compoundV3LeverageManagementSubData.encode(market, baseToken, triggerRepayRatio, triggerBoostRatio, targetBoostRatio, targetRepayRatio, boostEnabled, isEOA);
|
|
257
257
|
},
|
|
258
258
|
};
|
|
259
259
|
|
|
260
260
|
export const morphoAaveV2Encode = {
|
|
261
261
|
leverageManagement(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
triggerRepayRatio: number,
|
|
263
|
+
triggerBoostRatio: number,
|
|
264
|
+
targetBoostRatio: number,
|
|
265
|
+
targetRepayRatio: number,
|
|
266
266
|
boostEnabled: boolean,
|
|
267
267
|
) {
|
|
268
|
-
return subDataService.morphoAaveV2LeverageManagementSubData.encode(
|
|
268
|
+
return subDataService.morphoAaveV2LeverageManagementSubData.encode(triggerRepayRatio, triggerBoostRatio, targetBoostRatio, targetRepayRatio, boostEnabled);
|
|
269
269
|
},
|
|
270
270
|
};
|
|
271
271
|
|
|
@@ -305,21 +305,21 @@ export const exchangeEncode = {
|
|
|
305
305
|
|
|
306
306
|
export const sparkEncode = {
|
|
307
307
|
leverageManagement(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
triggerRepayRatio: number,
|
|
309
|
+
triggerBoostRatio: number,
|
|
310
|
+
targetBoostRatio: number,
|
|
311
|
+
targetRepayRatio: number,
|
|
312
312
|
boostEnabled: boolean,
|
|
313
313
|
) {
|
|
314
314
|
let subInput = '0x';
|
|
315
315
|
|
|
316
|
-
subInput = subInput.concat(new Dec(
|
|
316
|
+
subInput = subInput.concat(new Dec(triggerRepayRatio).mul(1e16).toHex().slice(2)
|
|
317
317
|
.padStart(32, '0'));
|
|
318
|
-
subInput = subInput.concat(new Dec(
|
|
318
|
+
subInput = subInput.concat(new Dec(triggerBoostRatio).mul(1e16).toHex().slice(2)
|
|
319
319
|
.padStart(32, '0'));
|
|
320
|
-
subInput = subInput.concat(new Dec(
|
|
320
|
+
subInput = subInput.concat(new Dec(targetBoostRatio).mul(1e16).toHex().slice(2)
|
|
321
321
|
.padStart(32, '0'));
|
|
322
|
-
subInput = subInput.concat(new Dec(
|
|
322
|
+
subInput = subInput.concat(new Dec(targetRepayRatio).mul(1e16).toHex().slice(2)
|
|
323
323
|
.padStart(32, '0'));
|
|
324
324
|
subInput = subInput.concat(boostEnabled ? '01' : '00');
|
|
325
325
|
|
|
@@ -134,17 +134,17 @@ export const liquityCloseSubData = {
|
|
|
134
134
|
|
|
135
135
|
export const aaveV2LeverageManagementSubData = {
|
|
136
136
|
encode(
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
triggerRepayRatio: number,
|
|
138
|
+
triggerBoostRatio: number,
|
|
139
|
+
targetBoostRatio: number,
|
|
140
|
+
targetRepayRatio: number,
|
|
141
141
|
boostEnabled: boolean,
|
|
142
142
|
): SubData {
|
|
143
143
|
return [
|
|
144
|
-
new Dec(
|
|
145
|
-
new Dec(
|
|
146
|
-
new Dec(
|
|
147
|
-
new Dec(
|
|
144
|
+
new Dec(triggerRepayRatio).mul(1e16).toString(),
|
|
145
|
+
new Dec(triggerBoostRatio).mul(1e16).toString(),
|
|
146
|
+
new Dec(targetBoostRatio).mul(1e16).toString(),
|
|
147
|
+
new Dec(targetRepayRatio).mul(1e16).toString(),
|
|
148
148
|
// @ts-ignore // TODO
|
|
149
149
|
boostEnabled,
|
|
150
150
|
];
|
|
@@ -199,17 +199,17 @@ export const aaveV3QuotePriceSubData = {
|
|
|
199
199
|
|
|
200
200
|
export const compoundV2LeverageManagementSubData = {
|
|
201
201
|
encode(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
triggerRepayRatio: number,
|
|
203
|
+
triggerBoostRatio: number,
|
|
204
|
+
targetBoostRatio: number,
|
|
205
|
+
targetRepayRatio: number,
|
|
206
206
|
boostEnabled: boolean,
|
|
207
207
|
): SubData {
|
|
208
208
|
return [
|
|
209
|
-
new Dec(
|
|
210
|
-
new Dec(
|
|
211
|
-
new Dec(
|
|
212
|
-
new Dec(
|
|
209
|
+
new Dec(triggerRepayRatio).mul(1e16).toString(),
|
|
210
|
+
new Dec(triggerBoostRatio).mul(1e16).toString(),
|
|
211
|
+
new Dec(targetBoostRatio).mul(1e16).toString(),
|
|
212
|
+
new Dec(targetRepayRatio).mul(1e16).toString(),
|
|
213
213
|
// @ts-ignore // TODO
|
|
214
214
|
boostEnabled,
|
|
215
215
|
];
|
|
@@ -226,20 +226,20 @@ export const compoundV3LeverageManagementSubData = {
|
|
|
226
226
|
encode(
|
|
227
227
|
market: EthereumAddress,
|
|
228
228
|
baseToken: EthereumAddress,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
229
|
+
triggerRepayRatio: number,
|
|
230
|
+
triggerBoostRatio: number,
|
|
231
|
+
targetBoostRatio: number,
|
|
232
|
+
targetRepayRatio: number,
|
|
233
233
|
boostEnabled: boolean,
|
|
234
234
|
isEOA: boolean,
|
|
235
235
|
): SubData {
|
|
236
236
|
return [
|
|
237
237
|
market,
|
|
238
238
|
baseToken,
|
|
239
|
-
new Dec(
|
|
240
|
-
new Dec(
|
|
241
|
-
new Dec(
|
|
242
|
-
new Dec(
|
|
239
|
+
new Dec(triggerRepayRatio).mul(1e16).toString(),
|
|
240
|
+
new Dec(triggerBoostRatio).mul(1e16).toString(),
|
|
241
|
+
new Dec(targetBoostRatio).mul(1e16).toString(),
|
|
242
|
+
new Dec(targetRepayRatio).mul(1e16).toString(),
|
|
243
243
|
// @ts-ignore // TODO
|
|
244
244
|
boostEnabled, isEOA,
|
|
245
245
|
];
|
|
@@ -254,17 +254,17 @@ export const compoundV3LeverageManagementSubData = {
|
|
|
254
254
|
|
|
255
255
|
export const morphoAaveV2LeverageManagementSubData = {
|
|
256
256
|
encode(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
triggerRepayRatio: number,
|
|
258
|
+
triggerBoostRatio: number,
|
|
259
|
+
targetBoostRatio: number,
|
|
260
|
+
targetRepayRatio: number,
|
|
261
261
|
boostEnabled: boolean,
|
|
262
262
|
): SubData {
|
|
263
263
|
return [
|
|
264
|
-
ratioPercentageToWei(
|
|
265
|
-
ratioPercentageToWei(
|
|
266
|
-
ratioPercentageToWei(
|
|
267
|
-
ratioPercentageToWei(
|
|
264
|
+
ratioPercentageToWei(triggerRepayRatio),
|
|
265
|
+
ratioPercentageToWei(triggerBoostRatio),
|
|
266
|
+
ratioPercentageToWei(targetBoostRatio),
|
|
267
|
+
ratioPercentageToWei(targetRepayRatio),
|
|
268
268
|
// @ts-ignore
|
|
269
269
|
boostEnabled,
|
|
270
270
|
];
|
|
@@ -33,8 +33,8 @@ export declare namespace AaveSubscriptionsV2 {
|
|
|
33
33
|
]
|
|
34
34
|
| {
|
|
35
35
|
user: string;
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
triggerRepayRatio: number | string | BN;
|
|
37
|
+
triggerBoostRatio: number | string | BN;
|
|
38
38
|
optimalRatioBoost: number | string | BN;
|
|
39
39
|
optimalRatioRepay: number | string | BN;
|
|
40
40
|
boostEnabled: boolean;
|
|
@@ -50,8 +50,8 @@ export declare namespace AaveSubscriptionsV2 {
|
|
|
50
50
|
];
|
|
51
51
|
export type AaveHolderStructOutputStruct = {
|
|
52
52
|
user: string;
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
triggerRepayRatio: string;
|
|
54
|
+
triggerBoostRatio: string;
|
|
55
55
|
optimalRatioBoost: string;
|
|
56
56
|
optimalRatioRepay: string;
|
|
57
57
|
boostEnabled: boolean;
|
|
@@ -124,8 +124,8 @@ export interface Legacy_AaveV2Subscriptions extends BaseContract {
|
|
|
124
124
|
setOwnerByAdmin(_owner: string): NonPayableTransactionObject<void>;
|
|
125
125
|
|
|
126
126
|
subscribe(
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
_triggerRepayRatio: number | string | BN,
|
|
128
|
+
_triggerBoostRatio: number | string | BN,
|
|
129
129
|
_optimalBoost: number | string | BN,
|
|
130
130
|
_optimalRepay: number | string | BN,
|
|
131
131
|
_boostEnabled: boolean
|
|
@@ -136,8 +136,8 @@ export interface Legacy_AaveV2Subscriptions extends BaseContract {
|
|
|
136
136
|
): NonPayableTransactionObject<
|
|
137
137
|
[string, string, string, string, string, boolean] & {
|
|
138
138
|
user: string;
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
triggerRepayRatio: string;
|
|
140
|
+
triggerBoostRatio: string;
|
|
141
141
|
optimalRatioBoost: string;
|
|
142
142
|
optimalRatioRepay: string;
|
|
143
143
|
boostEnabled: boolean;
|
|
@@ -33,8 +33,8 @@ export declare namespace CompoundSubscriptions {
|
|
|
33
33
|
]
|
|
34
34
|
| {
|
|
35
35
|
user: string;
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
triggerRepayRatio: number | string | BN;
|
|
37
|
+
triggerBoostRatio: number | string | BN;
|
|
38
38
|
optimalRatioBoost: number | string | BN;
|
|
39
39
|
optimalRatioRepay: number | string | BN;
|
|
40
40
|
boostEnabled: boolean;
|
|
@@ -50,8 +50,8 @@ export declare namespace CompoundSubscriptions {
|
|
|
50
50
|
];
|
|
51
51
|
export type CompoundHolderStructOutputStruct = {
|
|
52
52
|
user: string;
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
triggerRepayRatio: string;
|
|
54
|
+
triggerBoostRatio: string;
|
|
55
55
|
optimalRatioBoost: string;
|
|
56
56
|
optimalRatioRepay: string;
|
|
57
57
|
boostEnabled: boolean;
|
|
@@ -122,8 +122,8 @@ export interface Legacy_CompoundV2Subscriptions extends BaseContract {
|
|
|
122
122
|
setOwnerByAdmin(_owner: string): NonPayableTransactionObject<void>;
|
|
123
123
|
|
|
124
124
|
subscribe(
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
_triggerRepayRatio: number | string | BN,
|
|
126
|
+
_triggerBoostRatio: number | string | BN,
|
|
127
127
|
_optimalBoost: number | string | BN,
|
|
128
128
|
_optimalRepay: number | string | BN,
|
|
129
129
|
_boostEnabled: boolean
|
|
@@ -134,8 +134,8 @@ export interface Legacy_CompoundV2Subscriptions extends BaseContract {
|
|
|
134
134
|
): NonPayableTransactionObject<
|
|
135
135
|
[string, string, string, string, string, boolean] & {
|
|
136
136
|
user: string;
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
triggerRepayRatio: string;
|
|
138
|
+
triggerBoostRatio: string;
|
|
139
139
|
optimalRatioBoost: string;
|
|
140
140
|
optimalRatioRepay: string;
|
|
141
141
|
boostEnabled: boolean;
|
|
@@ -67,8 +67,8 @@ export interface Legacy_MakerSubscriptions extends BaseContract {
|
|
|
67
67
|
getSubscribers(): NonPayableTransactionObject<
|
|
68
68
|
[string, string, string, string, string, string, boolean, boolean] &
|
|
69
69
|
{
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
triggerRepayRatio: string;
|
|
71
|
+
triggerBoostRatio: string;
|
|
72
72
|
optimalRatioBoost: string;
|
|
73
73
|
optimalRatioRepay: string;
|
|
74
74
|
owner: string;
|
|
@@ -90,8 +90,8 @@ export interface Legacy_MakerSubscriptions extends BaseContract {
|
|
|
90
90
|
[
|
|
91
91
|
boolean,
|
|
92
92
|
[string, string, string, string, string, string, boolean, boolean] & {
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
triggerRepayRatio: string;
|
|
94
|
+
triggerBoostRatio: string;
|
|
95
95
|
optimalRatioBoost: string;
|
|
96
96
|
optimalRatioRepay: string;
|
|
97
97
|
owner: string;
|
|
@@ -152,8 +152,8 @@ export interface Legacy_MakerSubscriptions extends BaseContract {
|
|
|
152
152
|
arg0: number | string | BN
|
|
153
153
|
): NonPayableTransactionObject<
|
|
154
154
|
[string, string, string, string, string, string, boolean, boolean] & {
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
triggerRepayRatio: string;
|
|
156
|
+
triggerBoostRatio: string;
|
|
157
157
|
optimalRatioBoost: string;
|
|
158
158
|
optimalRatioRepay: string;
|
|
159
159
|
owner: string;
|
|
@@ -165,8 +165,8 @@ export interface Legacy_MakerSubscriptions extends BaseContract {
|
|
|
165
165
|
|
|
166
166
|
subscribe(
|
|
167
167
|
_cdpId: number | string | BN,
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
_triggerRepayRatio: number | string | BN,
|
|
169
|
+
_triggerBoostRatio: number | string | BN,
|
|
170
170
|
_optimalBoost: number | string | BN,
|
|
171
171
|
_optimalRepay: number | string | BN,
|
|
172
172
|
_boostEnabled: boolean,
|
|
@@ -199,8 +199,8 @@ export interface Legacy_MakerSubscriptions extends BaseContract {
|
|
|
199
199
|
): NonPayableTransactionObject<
|
|
200
200
|
[string, string, string, string, string, string, boolean, boolean] &
|
|
201
201
|
{
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
triggerRepayRatio: string;
|
|
203
|
+
triggerBoostRatio: string;
|
|
204
204
|
optimalRatioBoost: string;
|
|
205
205
|
optimalRatioRepay: string;
|
|
206
206
|
owner: string;
|
|
@@ -277,7 +277,7 @@ export interface Legacy_MakerSubscriptions extends BaseContract {
|
|
|
277
277
|
|
|
278
278
|
saverProxy(): NonPayableTransactionObject<string>;
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
changetriggerRepayRatios(
|
|
281
281
|
_ilk: string | number[],
|
|
282
282
|
_newRatio: number | string | BN
|
|
283
283
|
): NonPayableTransactionObject<void>;
|
package/src/types/index.ts
CHANGED
|
@@ -119,11 +119,11 @@ export declare namespace Position {
|
|
|
119
119
|
mergeWithSameId?: boolean
|
|
120
120
|
}
|
|
121
121
|
interface RatioProtection extends Base {
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
triggerRepayRatio?: number,
|
|
123
|
+
targetRepayRatio?: number,
|
|
124
124
|
repayEnabled?: boolean,
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
triggerBoostRatio?: number,
|
|
126
|
+
targetBoostRatio?: number,
|
|
127
127
|
boostEnabled?: boolean,
|
|
128
128
|
}
|
|
129
129
|
interface CloseOnPrice extends Base {
|