@defisaver/automation-sdk 3.3.14 → 3.3.15-liq-prot-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/constants/index.js +95 -0
- package/cjs/index.d.ts +4 -3
- package/cjs/index.js +6 -2
- package/cjs/services/strategiesService.js +181 -17
- package/cjs/services/strategySubService.d.ts +14 -13
- package/cjs/services/strategySubService.js +74 -63
- package/cjs/services/strategySubService.test.js +0 -234
- package/cjs/services/subDataService.d.ts +98 -1
- package/cjs/services/subDataService.js +264 -6
- package/cjs/services/subDataService.test.js +0 -42
- package/cjs/services/utils.d.ts +3 -1
- package/cjs/services/utils.js +34 -1
- package/cjs/services/utils.test.js +25 -0
- package/cjs/types/enums.d.ts +29 -6
- package/cjs/types/enums.js +23 -0
- package/esm/constants/index.js +95 -0
- package/esm/index.d.ts +4 -3
- package/esm/index.js +7 -3
- package/esm/services/strategiesService.js +181 -17
- package/esm/services/strategySubService.d.ts +14 -13
- package/esm/services/strategySubService.js +74 -60
- package/esm/services/strategySubService.test.js +2 -236
- package/esm/services/subDataService.d.ts +98 -1
- package/esm/services/subDataService.js +262 -5
- package/esm/services/subDataService.test.js +0 -42
- package/esm/services/utils.d.ts +3 -1
- package/esm/services/utils.js +32 -1
- package/esm/services/utils.test.js +27 -2
- package/esm/types/enums.d.ts +29 -6
- package/esm/types/enums.js +23 -0
- package/package.json +1 -1
- package/src/constants/index.ts +96 -0
- package/src/index.ts +24 -6
- package/src/services/strategiesService.ts +246 -17
- package/src/services/strategySubService.test.ts +0 -279
- package/src/services/strategySubService.ts +196 -110
- package/src/services/subDataService.test.ts +0 -48
- package/src/services/subDataService.ts +363 -4
- package/src/services/utils.test.ts +32 -1
- package/src/services/utils.ts +32 -1
- package/src/types/enums.ts +23 -0
|
@@ -63,7 +63,7 @@ function parseMakerTrailingStop(position, parseData) {
|
|
|
63
63
|
}
|
|
64
64
|
function parseMakerLeverageManagement(position, parseData) {
|
|
65
65
|
const _position = cloneDeep(position);
|
|
66
|
-
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
66
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
67
67
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
68
68
|
const triggerData = triggerService.makerRatioTrigger.decode(subStruct.triggerData);
|
|
69
69
|
const subData = subDataService.makerLeverageManagementSubData.decode(subStruct.subData);
|
|
@@ -75,9 +75,10 @@ function parseMakerLeverageManagement(position, parseData) {
|
|
|
75
75
|
_position.specific = {
|
|
76
76
|
triggerRepayRatio: triggerData.ratio,
|
|
77
77
|
targetRepayRatio: subData.targetRatio,
|
|
78
|
-
repayEnabled:
|
|
78
|
+
repayEnabled: isEnabled,
|
|
79
79
|
subId1: Number(subId),
|
|
80
80
|
mergeWithId: Strategies.Identifiers.Boost,
|
|
81
|
+
subHashRepay: subHash,
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
else {
|
|
@@ -87,11 +88,31 @@ function parseMakerLeverageManagement(position, parseData) {
|
|
|
87
88
|
boostEnabled: isEnabled,
|
|
88
89
|
subId2: Number(subId),
|
|
89
90
|
mergeId: Strategies.Identifiers.Boost,
|
|
91
|
+
subHashBoost: subHash,
|
|
90
92
|
};
|
|
91
93
|
}
|
|
92
94
|
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
93
95
|
return _position;
|
|
94
96
|
}
|
|
97
|
+
function parseMakerLiquidationProtection(position, parseData) {
|
|
98
|
+
const _position = cloneDeep(position);
|
|
99
|
+
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
100
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
101
|
+
const triggerData = triggerService.makerRatioTrigger.decode(subStruct.triggerData);
|
|
102
|
+
const subData = subDataService.makerLiquidationProtectionSubData.decode(subStruct.subData);
|
|
103
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
104
|
+
_position.strategyData.decoded.subData = subData;
|
|
105
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, subData.vaultId);
|
|
106
|
+
_position.specific = {
|
|
107
|
+
triggerRepayRatio: triggerData.ratio,
|
|
108
|
+
targetRepayRatio: subData.targetRatio,
|
|
109
|
+
repayEnabled: isEnabled,
|
|
110
|
+
subId1: Number(subId),
|
|
111
|
+
};
|
|
112
|
+
// TODO -> Is this ok?
|
|
113
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
114
|
+
return _position;
|
|
115
|
+
}
|
|
95
116
|
function parseLiquityCloseOnPrice(position, parseData) {
|
|
96
117
|
const _position = cloneDeep(position);
|
|
97
118
|
const { subStruct } = parseData.subscriptionEventData;
|
|
@@ -126,7 +147,7 @@ function parseLiquityTrailingStop(position, parseData) {
|
|
|
126
147
|
}
|
|
127
148
|
function parseAaveV2LeverageManagement(position, parseData) {
|
|
128
149
|
const _position = cloneDeep(position);
|
|
129
|
-
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
150
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
130
151
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
131
152
|
const triggerData = triggerService.aaveV2RatioTrigger.decode(subStruct.triggerData);
|
|
132
153
|
const subData = subDataService.aaveV2LeverageManagementSubData.decode(subStruct.subData);
|
|
@@ -138,9 +159,10 @@ function parseAaveV2LeverageManagement(position, parseData) {
|
|
|
138
159
|
_position.specific = {
|
|
139
160
|
triggerRepayRatio: triggerData.ratio,
|
|
140
161
|
targetRepayRatio: subData.targetRatio,
|
|
141
|
-
repayEnabled:
|
|
162
|
+
repayEnabled: isEnabled,
|
|
142
163
|
subId1: Number(subId),
|
|
143
164
|
mergeWithId: Strategies.Identifiers.Boost,
|
|
165
|
+
subHashRepay: subHash,
|
|
144
166
|
};
|
|
145
167
|
}
|
|
146
168
|
else {
|
|
@@ -150,6 +172,7 @@ function parseAaveV2LeverageManagement(position, parseData) {
|
|
|
150
172
|
boostEnabled: isEnabled,
|
|
151
173
|
subId2: Number(subId),
|
|
152
174
|
mergeId: Strategies.Identifiers.Boost,
|
|
175
|
+
subHashBoost: subHash,
|
|
153
176
|
};
|
|
154
177
|
}
|
|
155
178
|
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
@@ -200,6 +223,27 @@ function parseAaveV3LeverageManagement(position, parseData) {
|
|
|
200
223
|
}
|
|
201
224
|
return _position;
|
|
202
225
|
}
|
|
226
|
+
function parseAaveV3LiquidationProtection(position, parseData) {
|
|
227
|
+
const _position = cloneDeep(position);
|
|
228
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
229
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
230
|
+
const triggerData = triggerService.aaveV3RatioTrigger.decode(subStruct.triggerData);
|
|
231
|
+
// const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
232
|
+
const subData = subDataService.aaveV3LiquidationProtectionSubData.decode(subStruct.subData);
|
|
233
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
234
|
+
_position.strategyData.decoded.subData = subData;
|
|
235
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.market);
|
|
236
|
+
_position.specific = {
|
|
237
|
+
triggerRepayRatio: triggerData.ratio,
|
|
238
|
+
targetRepayRatio: subData.targetRatio,
|
|
239
|
+
repayEnabled: isEnabled,
|
|
240
|
+
subId1: Number(subId),
|
|
241
|
+
subHashRepay: subHash,
|
|
242
|
+
};
|
|
243
|
+
// TODO -> Should split for EOA or not? Prob not as they will use same encoding and decoding
|
|
244
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
245
|
+
return _position;
|
|
246
|
+
}
|
|
203
247
|
function parseAaveV3LeverageManagementOnPrice(position, parseData) {
|
|
204
248
|
const _position = cloneDeep(position);
|
|
205
249
|
const { subStruct } = parseData.subscriptionEventData;
|
|
@@ -329,6 +373,27 @@ function parseAaveV4LeverageManagement(position, parseData) {
|
|
|
329
373
|
}
|
|
330
374
|
return _position;
|
|
331
375
|
}
|
|
376
|
+
function parseAaveV4LiquidationProtection(position, parseData) {
|
|
377
|
+
const _position = cloneDeep(position);
|
|
378
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
379
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
380
|
+
const triggerData = triggerService.aaveV4RatioTrigger.decode(subStruct.triggerData);
|
|
381
|
+
const subData = subDataService.aaveV4LiquidationProtectionSubData.decode(subStruct.subData);
|
|
382
|
+
// const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
383
|
+
// const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId as Strategies.Identifiers);
|
|
384
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
385
|
+
_position.strategyData.decoded.subData = subData;
|
|
386
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.spoke);
|
|
387
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
388
|
+
_position.specific = {
|
|
389
|
+
triggerRepayRatio: triggerData.ratio,
|
|
390
|
+
targetRepayRatio: subData.targetRatio,
|
|
391
|
+
repayEnabled: isEnabled,
|
|
392
|
+
subId1: Number(subId),
|
|
393
|
+
subHashRepay: subHash,
|
|
394
|
+
};
|
|
395
|
+
return _position;
|
|
396
|
+
}
|
|
332
397
|
function parseAaveV4LeverageManagementOnPrice(position, parseData) {
|
|
333
398
|
const _position = cloneDeep(position);
|
|
334
399
|
const { subStruct } = parseData.subscriptionEventData;
|
|
@@ -387,7 +452,7 @@ function parseAaveV4CollateralSwitch(position, parseData) {
|
|
|
387
452
|
}
|
|
388
453
|
function parseMorphoAaveV2LeverageManagement(position, parseData) {
|
|
389
454
|
const _position = cloneDeep(position);
|
|
390
|
-
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
455
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
391
456
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
392
457
|
const triggerData = triggerService.morphoAaveV2RatioTrigger.decode(subStruct.triggerData);
|
|
393
458
|
const subData = subDataService.morphoAaveV2LeverageManagementSubData.decode(subStruct.subData);
|
|
@@ -399,9 +464,10 @@ function parseMorphoAaveV2LeverageManagement(position, parseData) {
|
|
|
399
464
|
_position.specific = {
|
|
400
465
|
triggerRepayRatio: triggerData.ratio,
|
|
401
466
|
targetRepayRatio: subData.targetRatio,
|
|
402
|
-
repayEnabled:
|
|
467
|
+
repayEnabled: isEnabled,
|
|
403
468
|
subId1: Number(subId),
|
|
404
469
|
mergeWithId: Strategies.Identifiers.Boost,
|
|
470
|
+
subHashRepay: subHash,
|
|
405
471
|
};
|
|
406
472
|
}
|
|
407
473
|
else {
|
|
@@ -411,6 +477,7 @@ function parseMorphoAaveV2LeverageManagement(position, parseData) {
|
|
|
411
477
|
boostEnabled: isEnabled,
|
|
412
478
|
subId2: Number(subId),
|
|
413
479
|
mergeId: Strategies.Identifiers.Boost,
|
|
480
|
+
subHashBoost: subHash,
|
|
414
481
|
};
|
|
415
482
|
}
|
|
416
483
|
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
@@ -443,7 +510,7 @@ function parseAaveV3CloseOnPriceWithMaximumGasPrice(position, parseData) {
|
|
|
443
510
|
}
|
|
444
511
|
function parseCompoundV2LeverageManagement(position, parseData) {
|
|
445
512
|
const _position = cloneDeep(position);
|
|
446
|
-
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
513
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
447
514
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
448
515
|
const triggerData = triggerService.compoundV2RatioTrigger.decode(subStruct.triggerData);
|
|
449
516
|
const subData = subDataService.compoundV2LeverageManagementSubData.decode(subStruct.subData);
|
|
@@ -456,9 +523,10 @@ function parseCompoundV2LeverageManagement(position, parseData) {
|
|
|
456
523
|
_position.specific = {
|
|
457
524
|
triggerRepayRatio: triggerData.ratio,
|
|
458
525
|
targetRepayRatio: subData.targetRatio,
|
|
459
|
-
repayEnabled:
|
|
526
|
+
repayEnabled: isEnabled,
|
|
460
527
|
subId1: Number(subId),
|
|
461
528
|
mergeWithId: Strategies.Identifiers.Boost,
|
|
529
|
+
subHashRepay: subHash,
|
|
462
530
|
};
|
|
463
531
|
}
|
|
464
532
|
else {
|
|
@@ -468,6 +536,7 @@ function parseCompoundV2LeverageManagement(position, parseData) {
|
|
|
468
536
|
boostEnabled: isEnabled,
|
|
469
537
|
subId2: Number(subId),
|
|
470
538
|
mergeId: Strategies.Identifiers.Boost,
|
|
539
|
+
subHashBoost: subHash,
|
|
471
540
|
};
|
|
472
541
|
}
|
|
473
542
|
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
@@ -476,11 +545,9 @@ function parseCompoundV2LeverageManagement(position, parseData) {
|
|
|
476
545
|
}
|
|
477
546
|
function parseCompoundV3LeverageManagement(position, parseData) {
|
|
478
547
|
const _position = cloneDeep(position);
|
|
479
|
-
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
548
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
480
549
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
481
|
-
const subDataDecoder =
|
|
482
|
-
? subDataService.compoundV3L2LeverageManagementSubData
|
|
483
|
-
: subDataService.compoundV3LeverageManagementSubData;
|
|
550
|
+
const subDataDecoder = subDataService.compoundV3LeverageManagementSubDataWithoutSubProxy;
|
|
484
551
|
const triggerData = triggerService.compoundV3RatioTrigger.decode(subStruct.triggerData);
|
|
485
552
|
const subData = subDataDecoder.decode(subStruct.subData);
|
|
486
553
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
@@ -492,9 +559,10 @@ function parseCompoundV3LeverageManagement(position, parseData) {
|
|
|
492
559
|
_position.specific = {
|
|
493
560
|
triggerRepayRatio: triggerData.ratio,
|
|
494
561
|
targetRepayRatio: subData.targetRatio,
|
|
495
|
-
repayEnabled:
|
|
562
|
+
repayEnabled: isEnabled,
|
|
496
563
|
subId1: Number(subId),
|
|
497
564
|
mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
|
|
565
|
+
subHashRepay: subHash,
|
|
498
566
|
};
|
|
499
567
|
}
|
|
500
568
|
else {
|
|
@@ -504,11 +572,34 @@ function parseCompoundV3LeverageManagement(position, parseData) {
|
|
|
504
572
|
boostEnabled: isEnabled,
|
|
505
573
|
subId2: Number(subId),
|
|
506
574
|
mergeId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
|
|
575
|
+
subHashBoost: subHash,
|
|
507
576
|
};
|
|
508
577
|
}
|
|
509
578
|
_position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLeverageManagement : Strategies.IdOverrides.LeverageManagement;
|
|
510
579
|
return _position;
|
|
511
580
|
}
|
|
581
|
+
function parseCompoundV3LiquidationProtection(position, parseData) {
|
|
582
|
+
const _position = cloneDeep(position);
|
|
583
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
584
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
585
|
+
const subDataDecoder = subDataService.compoundV3LiquidationProtectionSubData;
|
|
586
|
+
const triggerData = triggerService.compoundV3RatioTrigger.decode(subStruct.triggerData);
|
|
587
|
+
const subData = subDataDecoder.decode(subStruct.subData);
|
|
588
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
589
|
+
_position.strategyData.decoded.subData = subData;
|
|
590
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.market);
|
|
591
|
+
// const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId as Strategies.Identifiers);
|
|
592
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
593
|
+
_position.specific = {
|
|
594
|
+
triggerRepayRatio: triggerData.ratio,
|
|
595
|
+
targetRepayRatio: subData.targetRatio,
|
|
596
|
+
repayEnabled: isEnabled,
|
|
597
|
+
subId1: Number(subId),
|
|
598
|
+
subHashRepay: subHash,
|
|
599
|
+
};
|
|
600
|
+
_position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLiquidationProtection : Strategies.IdOverrides.LiquidationProtection;
|
|
601
|
+
return _position;
|
|
602
|
+
}
|
|
512
603
|
function parseCompoundV3LeverageManagementOnPrice(position, parseData) {
|
|
513
604
|
const _position = cloneDeep(position);
|
|
514
605
|
const { subStruct } = parseData.subscriptionEventData;
|
|
@@ -591,7 +682,7 @@ function parseExchangeLimitOrder(position, parseData, chainId) {
|
|
|
591
682
|
}
|
|
592
683
|
function parseLiquityLeverageManagement(position, parseData) {
|
|
593
684
|
const _position = cloneDeep(position);
|
|
594
|
-
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
685
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
595
686
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
596
687
|
const triggerData = triggerService.liquityRatioTrigger.decode(subStruct.triggerData);
|
|
597
688
|
const subData = subDataService.liquityLeverageManagementSubData.decode(subStruct.subData);
|
|
@@ -603,9 +694,10 @@ function parseLiquityLeverageManagement(position, parseData) {
|
|
|
603
694
|
_position.specific = {
|
|
604
695
|
triggerRepayRatio: triggerData.ratio,
|
|
605
696
|
targetRepayRatio: subData.targetRatio,
|
|
606
|
-
repayEnabled:
|
|
697
|
+
repayEnabled: isEnabled,
|
|
607
698
|
subId1: Number(subId),
|
|
608
699
|
mergeWithId: Strategies.Identifiers.Boost,
|
|
700
|
+
subHashRepay: subHash,
|
|
609
701
|
};
|
|
610
702
|
}
|
|
611
703
|
else {
|
|
@@ -615,6 +707,7 @@ function parseLiquityLeverageManagement(position, parseData) {
|
|
|
615
707
|
boostEnabled: isEnabled,
|
|
616
708
|
subId2: Number(subId),
|
|
617
709
|
mergeId: Strategies.Identifiers.Boost,
|
|
710
|
+
subHashBoost: subHash,
|
|
618
711
|
};
|
|
619
712
|
}
|
|
620
713
|
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
@@ -655,7 +748,7 @@ function parseLiquityV2LeverageManagement(position, parseData) {
|
|
|
655
748
|
}
|
|
656
749
|
function parseSparkLeverageManagement(position, parseData) {
|
|
657
750
|
const _position = cloneDeep(position);
|
|
658
|
-
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
751
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
659
752
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
660
753
|
const triggerData = triggerService.sparkRatioTrigger.decode(subStruct.triggerData);
|
|
661
754
|
const subData = subDataService.sparkLeverageManagementSubData.decode(subStruct.subData);
|
|
@@ -667,9 +760,10 @@ function parseSparkLeverageManagement(position, parseData) {
|
|
|
667
760
|
_position.specific = {
|
|
668
761
|
triggerRepayRatio: triggerData.ratio,
|
|
669
762
|
targetRepayRatio: subData.targetRatio,
|
|
670
|
-
repayEnabled:
|
|
763
|
+
repayEnabled: isEnabled,
|
|
671
764
|
subId1: Number(subId),
|
|
672
765
|
mergeWithId: Strategies.Identifiers.Boost,
|
|
766
|
+
subHashRepay: subHash,
|
|
673
767
|
};
|
|
674
768
|
}
|
|
675
769
|
else {
|
|
@@ -679,11 +773,31 @@ function parseSparkLeverageManagement(position, parseData) {
|
|
|
679
773
|
boostEnabled: isEnabled,
|
|
680
774
|
subId2: Number(subId),
|
|
681
775
|
mergeId: Strategies.Identifiers.Boost,
|
|
776
|
+
subHashBoost: subHash,
|
|
682
777
|
};
|
|
683
778
|
}
|
|
684
779
|
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
685
780
|
return _position;
|
|
686
781
|
}
|
|
782
|
+
function parseSparkLiquidationProtection(position, parseData) {
|
|
783
|
+
const _position = cloneDeep(position);
|
|
784
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
785
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
786
|
+
const triggerData = triggerService.sparkRatioTrigger.decode(subStruct.triggerData);
|
|
787
|
+
const subData = subDataService.sparkLiquidationProtectionSubData.decode(subStruct.subData);
|
|
788
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
789
|
+
_position.strategyData.decoded.subData = subData;
|
|
790
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.market);
|
|
791
|
+
_position.specific = {
|
|
792
|
+
triggerRepayRatio: triggerData.ratio,
|
|
793
|
+
targetRepayRatio: subData.targetRatio,
|
|
794
|
+
repayEnabled: isEnabled,
|
|
795
|
+
subId1: Number(subId),
|
|
796
|
+
subHashRepay: subHash,
|
|
797
|
+
};
|
|
798
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
799
|
+
return _position;
|
|
800
|
+
}
|
|
687
801
|
function parseSparkLeverageManagementOnPrice(position, parseData) {
|
|
688
802
|
const _position = cloneDeep(position);
|
|
689
803
|
const { subStruct } = parseData.subscriptionEventData;
|
|
@@ -838,6 +952,27 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
|
|
|
838
952
|
_position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLeverageManagement : Strategies.IdOverrides.LeverageManagement;
|
|
839
953
|
return _position;
|
|
840
954
|
}
|
|
955
|
+
function parseMorphoBlueLiquidationProtection(position, parseData) {
|
|
956
|
+
const _position = cloneDeep(position);
|
|
957
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
958
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
959
|
+
const triggerData = triggerService.morphoBlueRatioTrigger.decode(subStruct.triggerData);
|
|
960
|
+
const subData = subDataService.morphoBlueLiquidationProtectionSubData.decode(subStruct.subData);
|
|
961
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
962
|
+
_position.strategyData.decoded.subData = subData;
|
|
963
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.marketId);
|
|
964
|
+
_position.specific = {
|
|
965
|
+
triggerRepayRatio: triggerData.ratio,
|
|
966
|
+
targetRepayRatio: subData.targetRatio,
|
|
967
|
+
repayEnabled: isEnabled,
|
|
968
|
+
subId1: Number(subId),
|
|
969
|
+
subHashRepay: subHash,
|
|
970
|
+
};
|
|
971
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
972
|
+
// TODO -> Should be separate for EOA ?
|
|
973
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
974
|
+
return _position;
|
|
975
|
+
}
|
|
841
976
|
function parseMorphoBlueLeverageManagementOnPrice(position, parseData) {
|
|
842
977
|
const _position = cloneDeep(position);
|
|
843
978
|
const { subStruct } = parseData.subscriptionEventData;
|
|
@@ -861,6 +996,7 @@ function parseMorphoBlueLeverageManagementOnPrice(position, parseData) {
|
|
|
861
996
|
debtAsset: subData.loanToken,
|
|
862
997
|
price: triggerData.price,
|
|
863
998
|
ratio: subData.targetRatio,
|
|
999
|
+
ratioState: triggerData.priceState,
|
|
864
1000
|
};
|
|
865
1001
|
return _position;
|
|
866
1002
|
}
|
|
@@ -989,6 +1125,25 @@ function parseFluidT1LeverageManagement(position, parseData) {
|
|
|
989
1125
|
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
990
1126
|
return _position;
|
|
991
1127
|
}
|
|
1128
|
+
function parseFluidT1LiquidationProtection(position, parseData) {
|
|
1129
|
+
const _position = cloneDeep(position);
|
|
1130
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
1131
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
1132
|
+
const triggerData = triggerService.fluidRatioTrigger.decode(subStruct.triggerData);
|
|
1133
|
+
const subData = subDataService.fluidLiquidationProtectionSubData.decode(subStruct.subData);
|
|
1134
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
1135
|
+
_position.strategyData.decoded.subData = subData;
|
|
1136
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.nftId, subData.vault);
|
|
1137
|
+
_position.specific = {
|
|
1138
|
+
triggerRepayRatio: triggerData.ratio,
|
|
1139
|
+
targetRepayRatio: subData.targetRatio,
|
|
1140
|
+
repayEnabled: isEnabled,
|
|
1141
|
+
subId1: Number(subId),
|
|
1142
|
+
subHashRepay: subHash,
|
|
1143
|
+
};
|
|
1144
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
1145
|
+
return _position;
|
|
1146
|
+
}
|
|
992
1147
|
const parsingMethodsMapping = {
|
|
993
1148
|
[ProtocolIdentifiers.StrategiesAutomation.MakerDAO]: {
|
|
994
1149
|
[Strategies.Identifiers.SavingsLiqProtection]: parseMakerSavingsLiqProtection,
|
|
@@ -998,6 +1153,7 @@ const parsingMethodsMapping = {
|
|
|
998
1153
|
[Strategies.Identifiers.TrailingStopToDebt]: parseMakerTrailingStop,
|
|
999
1154
|
[Strategies.Identifiers.Repay]: parseMakerLeverageManagement,
|
|
1000
1155
|
[Strategies.Identifiers.Boost]: parseMakerLeverageManagement,
|
|
1156
|
+
[Strategies.Identifiers.LiquidationProtection]: parseMakerLiquidationProtection,
|
|
1001
1157
|
},
|
|
1002
1158
|
[ProtocolIdentifiers.StrategiesAutomation.Liquity]: {
|
|
1003
1159
|
[Strategies.Identifiers.CloseOnPriceToColl]: parseLiquityCloseOnPrice,
|
|
@@ -1036,6 +1192,7 @@ const parsingMethodsMapping = {
|
|
|
1036
1192
|
[Strategies.Identifiers.EoaBoostOnPrice]: parseAaveV3LeverageManagementOnPrice,
|
|
1037
1193
|
[Strategies.Identifiers.EoaCloseOnPrice]: parseAaveV3CloseOnPrice,
|
|
1038
1194
|
[Strategies.Identifiers.CollateralSwitch]: parseAaveV3CollateralSwitch,
|
|
1195
|
+
[Strategies.Identifiers.LiquidationProtection]: parseAaveV3LiquidationProtection,
|
|
1039
1196
|
},
|
|
1040
1197
|
[ProtocolIdentifiers.StrategiesAutomation.AaveV4]: {
|
|
1041
1198
|
[Strategies.Identifiers.Repay]: parseAaveV4LeverageManagement,
|
|
@@ -1050,6 +1207,7 @@ const parsingMethodsMapping = {
|
|
|
1050
1207
|
[Strategies.Identifiers.EoaCloseOnPrice]: parseAaveV4CloseOnPrice,
|
|
1051
1208
|
[Strategies.Identifiers.CollateralSwitch]: parseAaveV4CollateralSwitch,
|
|
1052
1209
|
[Strategies.Identifiers.EoaCollateralSwitch]: parseAaveV4CollateralSwitch,
|
|
1210
|
+
[Strategies.Identifiers.LiquidationProtection]: parseAaveV4LiquidationProtection,
|
|
1053
1211
|
},
|
|
1054
1212
|
[ProtocolIdentifiers.StrategiesAutomation.CompoundV2]: {
|
|
1055
1213
|
[Strategies.Identifiers.Repay]: parseCompoundV2LeverageManagement,
|
|
@@ -1066,6 +1224,9 @@ const parsingMethodsMapping = {
|
|
|
1066
1224
|
[Strategies.Identifiers.EoaBoostOnPrice]: parseCompoundV3LeverageManagementOnPrice,
|
|
1067
1225
|
[Strategies.Identifiers.CloseOnPrice]: parseCompoundV3CloseOnPrice,
|
|
1068
1226
|
[Strategies.Identifiers.EoaCloseOnPrice]: parseCompoundV3CloseOnPrice,
|
|
1227
|
+
// TODO -> here should prob separate EOA from SW
|
|
1228
|
+
[Strategies.Identifiers.LiquidationProtection]: parseCompoundV3LiquidationProtection,
|
|
1229
|
+
[Strategies.Identifiers.EoaLiquidationProtection]: parseCompoundV3LiquidationProtection,
|
|
1069
1230
|
},
|
|
1070
1231
|
[ProtocolIdentifiers.StrategiesAutomation.ChickenBonds]: {
|
|
1071
1232
|
[Strategies.Identifiers.Rebond]: parseChickenBondsRebond,
|
|
@@ -1085,6 +1246,7 @@ const parsingMethodsMapping = {
|
|
|
1085
1246
|
[Strategies.Identifiers.BoostOnPrice]: parseSparkLeverageManagementOnPrice,
|
|
1086
1247
|
[Strategies.Identifiers.CloseOnPrice]: parseSparkCloseOnPrice,
|
|
1087
1248
|
[Strategies.Identifiers.CollateralSwitch]: parseSparkCollateralSwitch,
|
|
1249
|
+
[Strategies.Identifiers.LiquidationProtection]: parseSparkLiquidationProtection,
|
|
1088
1250
|
},
|
|
1089
1251
|
[ProtocolIdentifiers.StrategiesAutomation.CrvUSD]: {
|
|
1090
1252
|
[Strategies.Identifiers.Repay]: parseCrvUSDLeverageManagement,
|
|
@@ -1098,10 +1260,12 @@ const parsingMethodsMapping = {
|
|
|
1098
1260
|
[Strategies.Identifiers.EoaBoost]: parseMorphoBlueLeverageManagement,
|
|
1099
1261
|
[Strategies.Identifiers.BoostOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
|
|
1100
1262
|
[Strategies.Identifiers.CloseOnPrice]: parseMorphoBlueCloseOnPrice,
|
|
1263
|
+
[Strategies.Identifiers.LiquidationProtection]: parseMorphoBlueLiquidationProtection,
|
|
1101
1264
|
},
|
|
1102
1265
|
[ProtocolIdentifiers.StrategiesAutomation.FluidT1]: {
|
|
1103
1266
|
[Strategies.Identifiers.Repay]: parseFluidT1LeverageManagement,
|
|
1104
1267
|
[Strategies.Identifiers.Boost]: parseFluidT1LeverageManagement,
|
|
1268
|
+
[Strategies.Identifiers.LiquidationProtection]: parseFluidT1LiquidationProtection,
|
|
1105
1269
|
},
|
|
1106
1270
|
};
|
|
1107
1271
|
function getParsingMethod(id, strategy) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CloseToAssetType, Bundles, ChainId, RatioState, Strategies } from '../types/enums';
|
|
1
|
+
import { Bundles, ChainId, CloseToAssetType, RatioState, Strategies } from '../types/enums';
|
|
3
2
|
import type { EthereumAddress, StrategyOrBundleIds } from '../types';
|
|
3
|
+
import type { OrderType } from '../types/enums';
|
|
4
4
|
export declare const makerEncode: {
|
|
5
5
|
repayFromSavings(bundleId: StrategyOrBundleIds, vaultId: number, triggerRepayRatio: number, targetRepayRatio: number, isBundle?: boolean, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds | Strategies.OptimismIds | Strategies.ArbitrumIds | Strategies.BaseIds | Bundles.MainnetIds | Bundles.OptimismIds | Bundles.ArbitrumIds | Bundles.BaseIds)[];
|
|
6
6
|
closeOnPrice(vaultId: number, ratioState: RatioState, price: string, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
7
7
|
trailingStop(vaultId: number, triggerPercentage: number, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, roundId: number, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
8
|
-
leverageManagement(vaultId: number, triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string, targetRepayRatio: string, boostEnabled: boolean): (string | number | boolean)[];
|
|
9
8
|
leverageManagementWithoutSubProxy(vaultId: number, triggerRatio: number, targetRatio: number, ratioState: RatioState, isBoost: boolean, daiAddr?: EthereumAddress): (boolean | string[] | Bundles.MainnetIds)[];
|
|
9
|
+
liquidationProtection(vaultId: number, triggerRatio: number, targetRatio: number, ratioState: RatioState, daiAddr?: EthereumAddress): (boolean | string[] | Bundles.MainnetIds)[];
|
|
10
10
|
};
|
|
11
11
|
export declare const liquityEncode: {
|
|
12
12
|
closeOnPrice(priceOverOrUnder: RatioState, price: string, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, chainId?: ChainId, collAddr?: EthereumAddress, debtAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
13
13
|
trailingStop(triggerPercentage: number, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, roundId: number, chainId?: ChainId, collAddr?: EthereumAddress, debtAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
14
14
|
paybackFromChickenBondStrategySub(proxyAddress: EthereumAddress, ratio: number, sourceId: string, sourceType: number, ratioState?: RatioState): (boolean | string[] | Bundles.MainnetIds)[];
|
|
15
|
-
|
|
15
|
+
leverageManagementWithoutSubProxy(strategyOrBundleId: number, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
16
16
|
dsrPayback(proxyAddress: EthereumAddress, triggerRatio: number, targetRatio: number): (boolean | string[] | Strategies.MainnetIds)[];
|
|
17
17
|
dsrSupply(proxyAddress: EthereumAddress, triggerRatio: number, targetRatio: number): (boolean | string[] | Strategies.MainnetIds)[];
|
|
18
18
|
debtInFrontRepay(proxyAddress: EthereumAddress, debtInFrontMin: string, targetRatioIncrease: number): (boolean | string[] | Strategies.MainnetIds)[];
|
|
@@ -21,10 +21,9 @@ export declare const chickenBondsEncode: {
|
|
|
21
21
|
rebond(bondId: number): string[];
|
|
22
22
|
};
|
|
23
23
|
export declare const aaveV2Encode: {
|
|
24
|
-
|
|
24
|
+
leverageManagementWithoutSubProxy(strategyOrBundleId: number, market: EthereumAddress, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
25
25
|
};
|
|
26
26
|
export declare const aaveV3Encode: {
|
|
27
|
-
leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string;
|
|
28
27
|
closeToAsset(strategyOrBundleId: number, isBundle: boolean | undefined, triggerData: {
|
|
29
28
|
baseTokenAddress: EthereumAddress;
|
|
30
29
|
quoteTokenAddress: EthereumAddress;
|
|
@@ -62,30 +61,28 @@ export declare const aaveV3Encode: {
|
|
|
62
61
|
targetRatio: number;
|
|
63
62
|
}): (number | boolean | string[])[];
|
|
64
63
|
leverageManagementWithoutSubProxy(strategyOrBundleId: number, market: EthereumAddress, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number, isGeneric?: boolean): (number | boolean | string[])[];
|
|
64
|
+
liquidationProtection(strategyOrBundleId: number, market: EthereumAddress, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
65
65
|
leverageManagementOnPriceGeneric(strategyOrBundleId: number, price: number, ratioState: RatioState, collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, marketAddr: EthereumAddress, targetRatio: number, user: EthereumAddress): (number | boolean | string[])[];
|
|
66
66
|
closeOnPriceGeneric(strategyOrBundleId: number, collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, marketAddr: EthereumAddress, user: EthereumAddress, stopLossPrice?: number, stopLossType?: CloseToAssetType, takeProfitPrice?: number, takeProfitType?: CloseToAssetType): (number | boolean | string[])[];
|
|
67
67
|
collateralSwitch(strategyOrBundleId: number, fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string, baseTokenAddress: EthereumAddress, quoteTokenAddress: EthereumAddress, price: number, state: RatioState): (number | boolean | string[])[];
|
|
68
68
|
};
|
|
69
69
|
export declare const compoundV2Encode: {
|
|
70
|
-
|
|
70
|
+
leverageManagementWithoutSubProxy(strategyOrBundleId: number, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
71
71
|
};
|
|
72
72
|
export declare const compoundV3Encode: {
|
|
73
|
-
|
|
73
|
+
leverageManagementWithoutSubProxy(strategyOrBundleId: number, market: EthereumAddress, baseToken: EthereumAddress, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
74
|
+
liquidationProtection(market: EthereumAddress, baseToken: EthereumAddress, triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean, isEOA: boolean): string[];
|
|
74
75
|
leverageManagementOnPrice(strategyOrBundleId: number, market: EthereumAddress, collToken: EthereumAddress, baseToken: EthereumAddress, targetRatio: number, price: number, priceState: RatioState, ratioState: RatioState, user: EthereumAddress): (number | boolean | string[])[];
|
|
75
76
|
closeOnPrice(strategyOrBundleId: number, market: EthereumAddress, collToken: EthereumAddress, baseToken: EthereumAddress, stopLossPrice: number | undefined, stopLossType: CloseToAssetType | undefined, takeProfitPrice: number | undefined, takeProfitType: CloseToAssetType | undefined, user: EthereumAddress): (number | boolean | string[])[];
|
|
76
77
|
};
|
|
77
|
-
export declare const compoundV3L2Encode: {
|
|
78
|
-
leverageManagement(market: EthereumAddress, baseToken: EthereumAddress, triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean, isEOA?: boolean): string;
|
|
79
|
-
};
|
|
80
78
|
export declare const morphoAaveV2Encode: {
|
|
81
79
|
leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string[];
|
|
82
80
|
};
|
|
83
81
|
export declare const exchangeEncode: {
|
|
84
82
|
dca(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, timestamp: number, interval: number, network: ChainId): (boolean | string[] | Strategies.MainnetIds | Strategies.OptimismIds | Strategies.ArbitrumIds | Strategies.BaseIds)[];
|
|
85
|
-
|
|
83
|
+
limitOrderWithoutSubProxy(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string | number, orderType: OrderType, fromTokenDecimals: number, toTokenDecimals: number, network: ChainId): (boolean | string[] | Strategies.MainnetIds | Strategies.OptimismIds | Strategies.ArbitrumIds | Strategies.BaseIds)[];
|
|
86
84
|
};
|
|
87
85
|
export declare const sparkEncode: {
|
|
88
|
-
leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string;
|
|
89
86
|
leverageManagementOnPrice(strategyOrBundleId: number, isBundle: boolean | undefined, triggerData: {
|
|
90
87
|
baseTokenAddr: EthereumAddress;
|
|
91
88
|
quoteTokenAddr: EthereumAddress;
|
|
@@ -101,6 +98,7 @@ export declare const sparkEncode: {
|
|
|
101
98
|
}): (number | boolean | string[])[];
|
|
102
99
|
closeOnPriceGeneric(strategyOrBundleId: number, collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, marketAddr: EthereumAddress, user: EthereumAddress, stopLossPrice?: number, stopLossType?: CloseToAssetType, takeProfitPrice?: number, takeProfitType?: CloseToAssetType): (number | boolean | string[])[];
|
|
103
100
|
leverageManagementWithoutSubProxy(strategyOrBundleId: number, market: EthereumAddress, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
101
|
+
liquidationProtection(strategyOrBundleId: number, market: EthereumAddress, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
104
102
|
collateralSwitch(strategyOrBundleId: number, fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string, baseTokenAddress: EthereumAddress, quoteTokenAddress: EthereumAddress, price: number, state: RatioState): (number | boolean | string[])[];
|
|
105
103
|
};
|
|
106
104
|
export declare const crvUSDEncode: {
|
|
@@ -109,6 +107,7 @@ export declare const crvUSDEncode: {
|
|
|
109
107
|
};
|
|
110
108
|
export declare const morphoBlueEncode: {
|
|
111
109
|
leverageManagement(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean, network: ChainId): (boolean | string[] | Bundles.BaseIds)[] | (boolean | string[] | Bundles.MainnetIds | Bundles.ArbitrumIds)[];
|
|
110
|
+
liquidationProtection(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean, network: ChainId): (boolean | string[] | Bundles.MainnetIds)[];
|
|
112
111
|
leverageManagementOnPrice(strategyOrBundleId: number, isBundle: boolean | undefined, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, user: EthereumAddress, targetRatio: number, price: number, priceState: RatioState): (number | boolean | string[])[];
|
|
113
112
|
closeOnPrice(strategyOrBundleId: number, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, user: EthereumAddress, stopLossPrice?: number, stopLossType?: CloseToAssetType, takeProfitPrice?: number, takeProfitType?: CloseToAssetType): (number | boolean | string[])[];
|
|
114
113
|
};
|
|
@@ -120,9 +119,11 @@ export declare const liquityV2Encode: {
|
|
|
120
119
|
};
|
|
121
120
|
export declare const fluidEncode: {
|
|
122
121
|
leverageManagement(nftId: string, vault: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number, strategyOrBundleId: number): (number | boolean | string[])[];
|
|
122
|
+
liquidationProtection(nftId: string, vault: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number, strategyOrBundleId: number): (number | boolean | string[])[];
|
|
123
123
|
};
|
|
124
124
|
export declare const aaveV4Encode: {
|
|
125
125
|
leverageManagement(strategyOrBundleId: number, owner: EthereumAddress, spoke: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
126
|
+
liquidationProtection(strategyOrBundleId: number, owner: EthereumAddress, spoke: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
|
|
126
127
|
leverageManagementOnPrice(strategyOrBundleId: number, owner: EthereumAddress, spoke: EthereumAddress, collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, targetRatio: number, price: string, priceState: RatioState, ratioState: RatioState): (number | boolean | string[])[];
|
|
127
128
|
closeOnPrice(strategyOrBundleId: number, owner: EthereumAddress, spoke: EthereumAddress, collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, stopLossPrice?: string, stopLossType?: CloseToAssetType, takeProfitPrice?: string, takeProfitType?: CloseToAssetType): (number | boolean | string[])[];
|
|
128
129
|
collateralSwitch(strategyOrBundleId: number, owner: EthereumAddress, spoke: EthereumAddress, fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, amountToSwitch: string, price: string, ratioState: RatioState): (number | boolean | string[])[];
|