@defisaver/automation-sdk 3.2.4-dev-1 → 3.2.5
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 +0 -90
- package/cjs/services/strategiesService.js +1 -48
- package/cjs/services/strategySubService.d.ts +1 -2
- package/cjs/services/strategySubService.js +6 -13
- package/cjs/services/strategySubService.test.js +0 -108
- package/cjs/services/subDataService.d.ts +7 -18
- package/cjs/services/subDataService.js +15 -48
- package/cjs/services/subDataService.test.js +48 -124
- package/cjs/services/triggerService.d.ts +0 -18
- package/cjs/services/triggerService.js +1 -36
- package/cjs/services/triggerService.test.js +0 -92
- package/cjs/types/enums.d.ts +5 -28
- package/cjs/types/enums.js +0 -23
- package/cjs/types/index.d.ts +1 -17
- package/esm/constants/index.js +0 -90
- package/esm/services/strategiesService.js +1 -48
- package/esm/services/strategySubService.d.ts +1 -2
- package/esm/services/strategySubService.js +6 -13
- package/esm/services/strategySubService.test.js +1 -109
- package/esm/services/subDataService.d.ts +7 -18
- package/esm/services/subDataService.js +14 -47
- package/esm/services/subDataService.test.js +48 -124
- package/esm/services/triggerService.d.ts +0 -18
- package/esm/services/triggerService.js +0 -35
- package/esm/services/triggerService.test.js +1 -93
- package/esm/types/enums.d.ts +5 -28
- package/esm/types/enums.js +0 -23
- package/esm/types/index.d.ts +1 -17
- package/package.json +2 -2
- package/src/constants/index.ts +1 -90
- package/src/services/strategiesService.ts +1 -62
- package/src/services/strategySubService.test.ts +1 -115
- package/src/services/strategySubService.ts +14 -33
- package/src/services/subDataService.test.ts +73 -128
- package/src/services/subDataService.ts +20 -73
- package/src/services/triggerService.test.ts +0 -102
- package/src/services/triggerService.ts +0 -55
- package/src/types/enums.ts +0 -23
- package/src/types/index.ts +1 -22
|
@@ -32,7 +32,7 @@ const tokens_1 = require("@defisaver/tokens");
|
|
|
32
32
|
const web3Utils = __importStar(require("web3-utils"));
|
|
33
33
|
const enums_1 = require("../types/enums");
|
|
34
34
|
require("../configuration");
|
|
35
|
-
const
|
|
35
|
+
const subDataService_1 = require("./subDataService");
|
|
36
36
|
describe('Feature: subDataService.ts', () => {
|
|
37
37
|
describe('When testing subDataService.makerRepayFromSavingsSubData', () => {
|
|
38
38
|
describe('encode()', () => {
|
|
@@ -47,7 +47,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
47
47
|
];
|
|
48
48
|
examples.forEach(([expected, actual]) => {
|
|
49
49
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
50
|
-
(0, chai_1.expect)(
|
|
50
|
+
(0, chai_1.expect)(subDataService_1.makerRepayFromSavingsSubData.encode(...actual)).to.eql(expected);
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
});
|
|
@@ -68,7 +68,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
68
68
|
];
|
|
69
69
|
examples.forEach(([expected, actual]) => {
|
|
70
70
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
71
|
-
(0, chai_1.expect)(
|
|
71
|
+
(0, chai_1.expect)(subDataService_1.makerRepayFromSavingsSubData.decode(actual)).to.eql(expected);
|
|
72
72
|
});
|
|
73
73
|
});
|
|
74
74
|
});
|
|
@@ -86,7 +86,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
86
86
|
];
|
|
87
87
|
examples.forEach(([expected, actual]) => {
|
|
88
88
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
89
|
-
(0, chai_1.expect)(
|
|
89
|
+
(0, chai_1.expect)(subDataService_1.liquityRepayFromSavingsSubData.decode(actual)).to.eql(expected);
|
|
90
90
|
});
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -111,7 +111,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
111
111
|
];
|
|
112
112
|
examples.forEach(([expected, actual]) => {
|
|
113
113
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
114
|
-
(0, chai_1.expect)(
|
|
114
|
+
(0, chai_1.expect)(subDataService_1.makerCloseSubData.encode(...actual)).to.eql(expected);
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
});
|
|
@@ -140,7 +140,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
140
140
|
];
|
|
141
141
|
examples.forEach(([expected, actual]) => {
|
|
142
142
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
143
|
-
(0, chai_1.expect)(
|
|
143
|
+
(0, chai_1.expect)(subDataService_1.makerCloseSubData.decode(actual)).to.eql(expected);
|
|
144
144
|
});
|
|
145
145
|
});
|
|
146
146
|
});
|
|
@@ -158,7 +158,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
158
158
|
];
|
|
159
159
|
examples.forEach(([expected, actual]) => {
|
|
160
160
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
161
|
-
(0, chai_1.expect)(
|
|
161
|
+
(0, chai_1.expect)(subDataService_1.makerLeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
162
162
|
});
|
|
163
163
|
});
|
|
164
164
|
});
|
|
@@ -176,7 +176,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
176
176
|
];
|
|
177
177
|
examples.forEach(([expected, actual]) => {
|
|
178
178
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
179
|
-
(0, chai_1.expect)(
|
|
179
|
+
(0, chai_1.expect)(subDataService_1.liquityLeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
});
|
|
@@ -199,7 +199,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
199
199
|
];
|
|
200
200
|
examples.forEach(([expected, actual]) => {
|
|
201
201
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
202
|
-
(0, chai_1.expect)(
|
|
202
|
+
(0, chai_1.expect)(subDataService_1.liquityCloseSubData.encode(...actual)).to.eql(expected);
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
205
|
});
|
|
@@ -226,7 +226,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
226
226
|
];
|
|
227
227
|
examples.forEach(([expected, actual]) => {
|
|
228
228
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
229
|
-
(0, chai_1.expect)(
|
|
229
|
+
(0, chai_1.expect)(subDataService_1.liquityCloseSubData.decode(actual)).to.eql(expected);
|
|
230
230
|
});
|
|
231
231
|
});
|
|
232
232
|
});
|
|
@@ -245,7 +245,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
245
245
|
];
|
|
246
246
|
examples.forEach(([expected, actual]) => {
|
|
247
247
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
248
|
-
(0, chai_1.expect)(
|
|
248
|
+
(0, chai_1.expect)(subDataService_1.aaveV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
249
249
|
});
|
|
250
250
|
});
|
|
251
251
|
});
|
|
@@ -262,7 +262,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
262
262
|
];
|
|
263
263
|
examples.forEach(([expected, actual]) => {
|
|
264
264
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
265
|
-
(0, chai_1.expect)(
|
|
265
|
+
(0, chai_1.expect)(subDataService_1.aaveV2LeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
266
266
|
});
|
|
267
267
|
});
|
|
268
268
|
});
|
|
@@ -281,7 +281,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
281
281
|
];
|
|
282
282
|
examples.forEach(([expected, actual]) => {
|
|
283
283
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
284
|
-
(0, chai_1.expect)(
|
|
284
|
+
(0, chai_1.expect)(subDataService_1.aaveV3LeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
285
285
|
});
|
|
286
286
|
});
|
|
287
287
|
});
|
|
@@ -318,7 +318,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
318
318
|
];
|
|
319
319
|
examples.forEach(([expected, actual]) => {
|
|
320
320
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
321
|
-
(0, chai_1.expect)(
|
|
321
|
+
(0, chai_1.expect)(subDataService_1.aaveV3QuotePriceSubData.encode(...actual)).to.eql(expected);
|
|
322
322
|
});
|
|
323
323
|
});
|
|
324
324
|
});
|
|
@@ -353,7 +353,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
353
353
|
];
|
|
354
354
|
examples.forEach(([expected, actual]) => {
|
|
355
355
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
356
|
-
(0, chai_1.expect)(
|
|
356
|
+
(0, chai_1.expect)(subDataService_1.aaveV3QuotePriceSubData.decode(actual)).to.eql(expected);
|
|
357
357
|
});
|
|
358
358
|
});
|
|
359
359
|
});
|
|
@@ -372,7 +372,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
372
372
|
];
|
|
373
373
|
examples.forEach(([expected, actual]) => {
|
|
374
374
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
375
|
-
(0, chai_1.expect)(
|
|
375
|
+
(0, chai_1.expect)(subDataService_1.compoundV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
376
376
|
});
|
|
377
377
|
});
|
|
378
378
|
});
|
|
@@ -389,7 +389,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
389
389
|
];
|
|
390
390
|
examples.forEach(([expected, actual]) => {
|
|
391
391
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
392
|
-
(0, chai_1.expect)(
|
|
392
|
+
(0, chai_1.expect)(subDataService_1.compoundV2LeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
393
393
|
});
|
|
394
394
|
});
|
|
395
395
|
});
|
|
@@ -434,7 +434,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
434
434
|
];
|
|
435
435
|
examples.forEach(([expected, actual]) => {
|
|
436
436
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
437
|
-
(0, chai_1.expect)(
|
|
437
|
+
(0, chai_1.expect)(subDataService_1.compoundV3LeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
438
438
|
});
|
|
439
439
|
});
|
|
440
440
|
});
|
|
@@ -457,7 +457,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
457
457
|
];
|
|
458
458
|
examples.forEach(([expected, actual]) => {
|
|
459
459
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
460
|
-
(0, chai_1.expect)(
|
|
460
|
+
(0, chai_1.expect)(subDataService_1.compoundV3LeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
461
461
|
});
|
|
462
462
|
});
|
|
463
463
|
});
|
|
@@ -476,7 +476,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
476
476
|
];
|
|
477
477
|
examples.forEach(([expected, actual]) => {
|
|
478
478
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
479
|
-
(0, chai_1.expect)(
|
|
479
|
+
(0, chai_1.expect)(subDataService_1.morphoAaveV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
480
480
|
});
|
|
481
481
|
});
|
|
482
482
|
});
|
|
@@ -493,7 +493,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
493
493
|
];
|
|
494
494
|
examples.forEach(([expected, actual]) => {
|
|
495
495
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
496
|
-
(0, chai_1.expect)(
|
|
496
|
+
(0, chai_1.expect)(subDataService_1.morphoAaveV2LeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
497
497
|
});
|
|
498
498
|
});
|
|
499
499
|
});
|
|
@@ -512,7 +512,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
512
512
|
];
|
|
513
513
|
examples.forEach(([expected, actual]) => {
|
|
514
514
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
515
|
-
(0, chai_1.expect)(
|
|
515
|
+
(0, chai_1.expect)(subDataService_1.cBondsRebondSubData.encode(...actual)).to.eql(expected);
|
|
516
516
|
});
|
|
517
517
|
});
|
|
518
518
|
});
|
|
@@ -529,7 +529,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
529
529
|
];
|
|
530
530
|
examples.forEach(([expected, actual]) => {
|
|
531
531
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
532
|
-
(0, chai_1.expect)(
|
|
532
|
+
(0, chai_1.expect)(subDataService_1.cBondsRebondSubData.decode(actual)).to.eql(expected);
|
|
533
533
|
});
|
|
534
534
|
});
|
|
535
535
|
});
|
|
@@ -554,7 +554,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
554
554
|
];
|
|
555
555
|
examples.forEach(([expected, actual]) => {
|
|
556
556
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
557
|
-
(0, chai_1.expect)(
|
|
557
|
+
(0, chai_1.expect)(subDataService_1.liquityPaybackUsingChickenBondSubData.encode(...actual)).to.eql(expected);
|
|
558
558
|
});
|
|
559
559
|
});
|
|
560
560
|
});
|
|
@@ -577,7 +577,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
577
577
|
];
|
|
578
578
|
examples.forEach(([expected, actual]) => {
|
|
579
579
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
580
|
-
(0, chai_1.expect)(
|
|
580
|
+
(0, chai_1.expect)(subDataService_1.liquityPaybackUsingChickenBondSubData.decode(actual)).to.eql(expected);
|
|
581
581
|
});
|
|
582
582
|
});
|
|
583
583
|
});
|
|
@@ -612,7 +612,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
612
612
|
];
|
|
613
613
|
examples.forEach(([expected, actual]) => {
|
|
614
614
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
615
|
-
(0, chai_1.expect)(
|
|
615
|
+
(0, chai_1.expect)(subDataService_1.exchangeDcaSubData.encode(...actual)).to.eql(expected);
|
|
616
616
|
});
|
|
617
617
|
});
|
|
618
618
|
});
|
|
@@ -651,7 +651,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
651
651
|
];
|
|
652
652
|
examples.forEach(([expected, actual]) => {
|
|
653
653
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
654
|
-
(0, chai_1.expect)(
|
|
654
|
+
(0, chai_1.expect)(subDataService_1.exchangeDcaSubData.decode(...actual)).to.eql(expected);
|
|
655
655
|
});
|
|
656
656
|
});
|
|
657
657
|
});
|
|
@@ -698,7 +698,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
698
698
|
];
|
|
699
699
|
examples.forEach(([expected, actual]) => {
|
|
700
700
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
701
|
-
(0, chai_1.expect)(
|
|
701
|
+
(0, chai_1.expect)(subDataService_1.exchangeLimitOrderSubData.encode(...actual)).to.eql(expected);
|
|
702
702
|
});
|
|
703
703
|
});
|
|
704
704
|
});
|
|
@@ -735,7 +735,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
735
735
|
];
|
|
736
736
|
examples.forEach(([expected, actual]) => {
|
|
737
737
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
738
|
-
(0, chai_1.expect)(
|
|
738
|
+
(0, chai_1.expect)(subDataService_1.exchangeLimitOrderSubData.decode(...actual)).to.eql(expected);
|
|
739
739
|
});
|
|
740
740
|
});
|
|
741
741
|
});
|
|
@@ -754,7 +754,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
754
754
|
];
|
|
755
755
|
examples.forEach(([expected, actual]) => {
|
|
756
756
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
757
|
-
(0, chai_1.expect)(
|
|
757
|
+
(0, chai_1.expect)(subDataService_1.sparkLeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
758
758
|
});
|
|
759
759
|
});
|
|
760
760
|
});
|
|
@@ -791,7 +791,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
791
791
|
];
|
|
792
792
|
examples.forEach(([expected, actual]) => {
|
|
793
793
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
794
|
-
(0, chai_1.expect)(
|
|
794
|
+
(0, chai_1.expect)(subDataService_1.sparkQuotePriceSubData.encode(...actual)).to.eql(expected);
|
|
795
795
|
});
|
|
796
796
|
});
|
|
797
797
|
});
|
|
@@ -826,7 +826,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
826
826
|
];
|
|
827
827
|
examples.forEach(([expected, actual]) => {
|
|
828
828
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
829
|
-
(0, chai_1.expect)(
|
|
829
|
+
(0, chai_1.expect)(subDataService_1.sparkQuotePriceSubData.decode(actual)).to.eql(expected);
|
|
830
830
|
});
|
|
831
831
|
});
|
|
832
832
|
});
|
|
@@ -851,7 +851,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
851
851
|
];
|
|
852
852
|
examples.forEach(([expected, actual]) => {
|
|
853
853
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
854
|
-
(0, chai_1.expect)(
|
|
854
|
+
(0, chai_1.expect)(subDataService_1.liquityDsrPaybackSubData.encode(...actual)).to.eql(expected);
|
|
855
855
|
});
|
|
856
856
|
});
|
|
857
857
|
});
|
|
@@ -878,7 +878,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
878
878
|
];
|
|
879
879
|
examples.forEach(([expected, actual]) => {
|
|
880
880
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
881
|
-
(0, chai_1.expect)(
|
|
881
|
+
(0, chai_1.expect)(subDataService_1.liquityDsrPaybackSubData.decode(actual)).to.eql(expected);
|
|
882
882
|
});
|
|
883
883
|
});
|
|
884
884
|
});
|
|
@@ -903,7 +903,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
903
903
|
];
|
|
904
904
|
examples.forEach(([expected, actual]) => {
|
|
905
905
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
906
|
-
(0, chai_1.expect)(
|
|
906
|
+
(0, chai_1.expect)(subDataService_1.liquityDsrSupplySubData.encode(...actual)).to.eql(expected);
|
|
907
907
|
});
|
|
908
908
|
});
|
|
909
909
|
});
|
|
@@ -930,7 +930,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
930
930
|
];
|
|
931
931
|
examples.forEach(([expected, actual]) => {
|
|
932
932
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
933
|
-
(0, chai_1.expect)(
|
|
933
|
+
(0, chai_1.expect)(subDataService_1.liquityDsrSupplySubData.decode(actual)).to.eql(expected);
|
|
934
934
|
});
|
|
935
935
|
});
|
|
936
936
|
});
|
|
@@ -957,7 +957,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
957
957
|
];
|
|
958
958
|
examples.forEach(([expected, actual]) => {
|
|
959
959
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
960
|
-
(0, chai_1.expect)(
|
|
960
|
+
(0, chai_1.expect)(subDataService_1.liquityDebtInFrontRepaySubData.encode(...actual)).to.eql(expected);
|
|
961
961
|
});
|
|
962
962
|
});
|
|
963
963
|
});
|
|
@@ -986,7 +986,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
986
986
|
];
|
|
987
987
|
examples.forEach(([expected, actual]) => {
|
|
988
988
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
989
|
-
(0, chai_1.expect)(
|
|
989
|
+
(0, chai_1.expect)(subDataService_1.liquityDebtInFrontRepaySubData.decode(actual)).to.eql(expected);
|
|
990
990
|
});
|
|
991
991
|
});
|
|
992
992
|
});
|
|
@@ -1017,7 +1017,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1017
1017
|
];
|
|
1018
1018
|
examples.forEach(([expected, actual]) => {
|
|
1019
1019
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1020
|
-
(0, chai_1.expect)(
|
|
1020
|
+
(0, chai_1.expect)(subDataService_1.crvUSDLeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
1021
1021
|
});
|
|
1022
1022
|
});
|
|
1023
1023
|
});
|
|
@@ -1040,7 +1040,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1040
1040
|
];
|
|
1041
1041
|
examples.forEach(([expected, actual]) => {
|
|
1042
1042
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1043
|
-
(0, chai_1.expect)(
|
|
1043
|
+
(0, chai_1.expect)(subDataService_1.crvUSDLeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
1044
1044
|
});
|
|
1045
1045
|
});
|
|
1046
1046
|
});
|
|
@@ -1061,7 +1061,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1061
1061
|
];
|
|
1062
1062
|
examples.forEach(([expected, actual]) => {
|
|
1063
1063
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1064
|
-
(0, chai_1.expect)(
|
|
1064
|
+
(0, chai_1.expect)(subDataService_1.crvUSDPaybackSubData.encode(...actual)).to.eql(expected);
|
|
1065
1065
|
});
|
|
1066
1066
|
});
|
|
1067
1067
|
});
|
|
@@ -1085,7 +1085,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1085
1085
|
];
|
|
1086
1086
|
examples.forEach(([expected, actual]) => {
|
|
1087
1087
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1088
|
-
(0, chai_1.expect)(
|
|
1088
|
+
(0, chai_1.expect)(subDataService_1.crvUSDPaybackSubData.decode(actual)).to.eql(expected);
|
|
1089
1089
|
});
|
|
1090
1090
|
});
|
|
1091
1091
|
});
|
|
@@ -1104,7 +1104,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1104
1104
|
];
|
|
1105
1105
|
examples.forEach(([expected, actual]) => {
|
|
1106
1106
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1107
|
-
(0, chai_1.expect)(
|
|
1107
|
+
(0, chai_1.expect)(subDataService_1.compoundV3L2LeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
1108
1108
|
});
|
|
1109
1109
|
});
|
|
1110
1110
|
});
|
|
@@ -1127,7 +1127,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1127
1127
|
];
|
|
1128
1128
|
examples.forEach(([expected, actual]) => {
|
|
1129
1129
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1130
|
-
(0, chai_1.expect)(
|
|
1130
|
+
(0, chai_1.expect)(subDataService_1.compoundV3L2LeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
1131
1131
|
});
|
|
1132
1132
|
});
|
|
1133
1133
|
});
|
|
@@ -1166,7 +1166,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1166
1166
|
];
|
|
1167
1167
|
examples.forEach(([expected, actual]) => {
|
|
1168
1168
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1169
|
-
(0, chai_1.expect)(
|
|
1169
|
+
(0, chai_1.expect)(subDataService_1.morphoBlueLeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
1170
1170
|
});
|
|
1171
1171
|
});
|
|
1172
1172
|
});
|
|
@@ -1217,7 +1217,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1217
1217
|
];
|
|
1218
1218
|
examples.forEach(([expected, actual]) => {
|
|
1219
1219
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1220
|
-
(0, chai_1.expect)(
|
|
1220
|
+
(0, chai_1.expect)(subDataService_1.morphoBlueLeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
1221
1221
|
});
|
|
1222
1222
|
});
|
|
1223
1223
|
});
|
|
@@ -1247,7 +1247,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1247
1247
|
];
|
|
1248
1248
|
examples.forEach(([expected, actual]) => {
|
|
1249
1249
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1250
|
-
(0, chai_1.expect)(
|
|
1250
|
+
(0, chai_1.expect)(subDataService_1.aaveV3LeverageManagementOnPriceSubData.encode(...actual)).to.eql(expected);
|
|
1251
1251
|
});
|
|
1252
1252
|
});
|
|
1253
1253
|
});
|
|
@@ -1274,83 +1274,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1274
1274
|
];
|
|
1275
1275
|
examples.forEach(([expected, actual]) => {
|
|
1276
1276
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1277
|
-
(0, chai_1.expect)(
|
|
1278
|
-
});
|
|
1279
|
-
});
|
|
1280
|
-
});
|
|
1281
|
-
});
|
|
1282
|
-
describe('When testing subDataService.compoundV3LeverageManagementOnPriceSubData', () => {
|
|
1283
|
-
describe('encode()', () => {
|
|
1284
|
-
const examples = [
|
|
1285
|
-
[
|
|
1286
|
-
[
|
|
1287
|
-
'0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3',
|
|
1288
|
-
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1289
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
1290
|
-
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000'
|
|
1291
|
-
],
|
|
1292
|
-
[
|
|
1293
|
-
web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
|
|
1294
|
-
web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
|
|
1295
|
-
web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
|
|
1296
|
-
200
|
|
1297
|
-
]
|
|
1298
|
-
],
|
|
1299
|
-
[
|
|
1300
|
-
[
|
|
1301
|
-
'0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3',
|
|
1302
|
-
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1303
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
1304
|
-
'0x0000000000000000000000000000000000000000000000001a5e27eef13e0000'
|
|
1305
|
-
],
|
|
1306
|
-
[
|
|
1307
|
-
web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
|
|
1308
|
-
web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
|
|
1309
|
-
web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
|
|
1310
|
-
190
|
|
1311
|
-
]
|
|
1312
|
-
],
|
|
1313
|
-
];
|
|
1314
|
-
examples.forEach(([expected, actual]) => {
|
|
1315
|
-
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1316
|
-
(0, chai_1.expect)(subDataService.compoundV3LeverageManagementOnPriceSubData.encode(...actual)).to.eql(expected);
|
|
1317
|
-
});
|
|
1318
|
-
});
|
|
1319
|
-
});
|
|
1320
|
-
describe('decode()', () => {
|
|
1321
|
-
const examples = [
|
|
1322
|
-
[
|
|
1323
|
-
{
|
|
1324
|
-
market: web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
|
|
1325
|
-
collToken: web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
|
|
1326
|
-
baseToken: web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
|
|
1327
|
-
targetRatio: 200,
|
|
1328
|
-
},
|
|
1329
|
-
[
|
|
1330
|
-
'0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3',
|
|
1331
|
-
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1332
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
1333
|
-
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000'
|
|
1334
|
-
]
|
|
1335
|
-
],
|
|
1336
|
-
[
|
|
1337
|
-
{
|
|
1338
|
-
market: web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
|
|
1339
|
-
collToken: web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
|
|
1340
|
-
baseToken: web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
|
|
1341
|
-
targetRatio: 190,
|
|
1342
|
-
},
|
|
1343
|
-
[
|
|
1344
|
-
'0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3',
|
|
1345
|
-
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1346
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
1347
|
-
'0x0000000000000000000000000000000000000000000000001a5e27eef13e0000'
|
|
1348
|
-
]
|
|
1349
|
-
],
|
|
1350
|
-
];
|
|
1351
|
-
examples.forEach(([expected, actual]) => {
|
|
1352
|
-
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1353
|
-
(0, chai_1.expect)(subDataService.compoundV3LeverageManagementOnPriceSubData.decode(actual)).to.eql(expected);
|
|
1277
|
+
(0, chai_1.expect)(subDataService_1.aaveV3LeverageManagementOnPriceSubData.decode(actual)).to.eql(expected);
|
|
1354
1278
|
});
|
|
1355
1279
|
});
|
|
1356
1280
|
});
|
|
@@ -247,21 +247,3 @@ export declare const fluidRatioTrigger: {
|
|
|
247
247
|
ratioState: number;
|
|
248
248
|
};
|
|
249
249
|
};
|
|
250
|
-
export declare const compoundV3PriceTrigger: {
|
|
251
|
-
encode(market: EthereumAddress, collToken: EthereumAddress, price: number, priceState: RatioState): string[];
|
|
252
|
-
decode(triggerData: string[]): {
|
|
253
|
-
market: string;
|
|
254
|
-
collToken: string;
|
|
255
|
-
price: string;
|
|
256
|
-
priceState: number;
|
|
257
|
-
};
|
|
258
|
-
};
|
|
259
|
-
export declare const compoundV3PriceRangeTrigger: {
|
|
260
|
-
encode(market: EthereumAddress, collToken: EthereumAddress, lowerPrice: number, upperPrice: number): string[];
|
|
261
|
-
decode(triggerData: string[]): {
|
|
262
|
-
market: string;
|
|
263
|
-
collToken: string;
|
|
264
|
-
lowerPrice: string;
|
|
265
|
-
upperPrice: string;
|
|
266
|
-
};
|
|
267
|
-
};
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.fluidRatioTrigger = exports.morphoBluePriceTrigger = exports.closePriceTrigger = exports.liquityV2QuotePriceTrigger = exports.liquityV2RatioTrigger = exports.morphoBlueRatioTrigger = exports.crvUsdHealthRatioTrigger = exports.crvUSDRatioTrigger = exports.curveUsdSoftLiquidationTrigger = exports.curveUsdBorrowRateTrigger = exports.sparkQuotePriceTrigger = exports.sparkRatioTrigger = exports.exchangeOffchainPriceTrigger = exports.exchangeTimestampTrigger = exports.compoundV3RatioTrigger = exports.cBondsRebondTrigger = exports.aaveV2RatioTrigger = exports.liquityV2AdjustTimeTrigger = exports.liquityV2DebtInFrontTrigger = exports.liquityDebtInFrontWithLimitTrigger = exports.liquityDebtInFrontTrigger = exports.liquityRatioTrigger = exports.compoundV2RatioTrigger = exports.aaveV3QuotePriceWithMaximumGasPriceTrigger = exports.aaveV3QuotePriceTrigger = exports.morphoAaveV2RatioTrigger = exports.aaveV3RatioTrigger = exports.makerRatioTrigger = exports.trailingStopTrigger = exports.chainlinkPriceTrigger = void 0;
|
|
30
30
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
31
31
|
const tokens_1 = require("@defisaver/tokens");
|
|
32
32
|
const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
|
|
@@ -471,38 +471,3 @@ exports.fluidRatioTrigger = {
|
|
|
471
471
|
};
|
|
472
472
|
},
|
|
473
473
|
};
|
|
474
|
-
exports.compoundV3PriceTrigger = {
|
|
475
|
-
encode(market, collToken, price, priceState) {
|
|
476
|
-
const _price = new decimal_js_1.default(price.toString()).mul(1e8).floor().toString();
|
|
477
|
-
return [
|
|
478
|
-
web3_eth_abi_1.default.encodeParameters(['address', 'address', 'uint256', 'uint8'], [market, collToken, _price, priceState]),
|
|
479
|
-
];
|
|
480
|
-
},
|
|
481
|
-
decode(triggerData) {
|
|
482
|
-
const decodedData = web3_eth_abi_1.default.decodeParameters(['address', 'address', 'uint256', 'uint8'], triggerData[0]);
|
|
483
|
-
return {
|
|
484
|
-
market: decodedData[0],
|
|
485
|
-
collToken: decodedData[1],
|
|
486
|
-
price: new decimal_js_1.default(decodedData[2]).div(1e8).toString(),
|
|
487
|
-
priceState: Number(decodedData[3]),
|
|
488
|
-
};
|
|
489
|
-
},
|
|
490
|
-
};
|
|
491
|
-
exports.compoundV3PriceRangeTrigger = {
|
|
492
|
-
encode(market, collToken, lowerPrice, upperPrice) {
|
|
493
|
-
const lowerPriceFormatted = new decimal_js_1.default(lowerPrice).mul(1e8).floor().toString();
|
|
494
|
-
const upperPriceFormatted = new decimal_js_1.default(upperPrice).mul(1e8).floor().toString();
|
|
495
|
-
return [
|
|
496
|
-
web3_eth_abi_1.default.encodeParameters(['address', 'address', 'uint256', 'uint256'], [market, collToken, lowerPriceFormatted, upperPriceFormatted]),
|
|
497
|
-
];
|
|
498
|
-
},
|
|
499
|
-
decode(triggerData) {
|
|
500
|
-
const decodedData = web3_eth_abi_1.default.decodeParameters(['address', 'address', 'uint256', 'uint256'], triggerData[0]);
|
|
501
|
-
return {
|
|
502
|
-
market: decodedData[0],
|
|
503
|
-
collToken: decodedData[1],
|
|
504
|
-
lowerPrice: new decimal_js_1.default(decodedData[2]).div(1e8).toString(),
|
|
505
|
-
upperPrice: new decimal_js_1.default(decodedData[3]).div(1e8).toString(),
|
|
506
|
-
};
|
|
507
|
-
},
|
|
508
|
-
};
|