@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.
Files changed (39) hide show
  1. package/cjs/constants/index.js +0 -90
  2. package/cjs/services/strategiesService.js +1 -48
  3. package/cjs/services/strategySubService.d.ts +1 -2
  4. package/cjs/services/strategySubService.js +6 -13
  5. package/cjs/services/strategySubService.test.js +0 -108
  6. package/cjs/services/subDataService.d.ts +7 -18
  7. package/cjs/services/subDataService.js +15 -48
  8. package/cjs/services/subDataService.test.js +48 -124
  9. package/cjs/services/triggerService.d.ts +0 -18
  10. package/cjs/services/triggerService.js +1 -36
  11. package/cjs/services/triggerService.test.js +0 -92
  12. package/cjs/types/enums.d.ts +5 -28
  13. package/cjs/types/enums.js +0 -23
  14. package/cjs/types/index.d.ts +1 -17
  15. package/esm/constants/index.js +0 -90
  16. package/esm/services/strategiesService.js +1 -48
  17. package/esm/services/strategySubService.d.ts +1 -2
  18. package/esm/services/strategySubService.js +6 -13
  19. package/esm/services/strategySubService.test.js +1 -109
  20. package/esm/services/subDataService.d.ts +7 -18
  21. package/esm/services/subDataService.js +14 -47
  22. package/esm/services/subDataService.test.js +48 -124
  23. package/esm/services/triggerService.d.ts +0 -18
  24. package/esm/services/triggerService.js +0 -35
  25. package/esm/services/triggerService.test.js +1 -93
  26. package/esm/types/enums.d.ts +5 -28
  27. package/esm/types/enums.js +0 -23
  28. package/esm/types/index.d.ts +1 -17
  29. package/package.json +2 -2
  30. package/src/constants/index.ts +1 -90
  31. package/src/services/strategiesService.ts +1 -62
  32. package/src/services/strategySubService.test.ts +1 -115
  33. package/src/services/strategySubService.ts +14 -33
  34. package/src/services/subDataService.test.ts +73 -128
  35. package/src/services/subDataService.ts +20 -73
  36. package/src/services/triggerService.test.ts +0 -102
  37. package/src/services/triggerService.ts +0 -55
  38. package/src/types/enums.ts +0 -23
  39. package/src/types/index.ts +1 -22
@@ -120,6 +120,20 @@ export const aaveV3LeverageManagementSubData = {
120
120
  return { targetRatio };
121
121
  },
122
122
  };
123
+ export const aaveV3LeverageManagementSubDataWithoutSubProxy = {
124
+ encode(targetRatio, ratioState) {
125
+ const encodedTargetRatio = AbiCoder.encodeParameter('uint256', ratioPercentageToWei(targetRatio));
126
+ const encodedRatioState = AbiCoder.encodeParameter('uint8', ratioState);
127
+ const encodedUseDefaultMarket = AbiCoder.encodeParameter('bool', true);
128
+ const encodedUseOnBehalf = AbiCoder.encodeParameter('bool', false);
129
+ return [encodedTargetRatio, encodedRatioState, encodedUseDefaultMarket, encodedUseOnBehalf];
130
+ },
131
+ decode(subData) {
132
+ const targetRatio = weiToRatioPercentage(AbiCoder.decodeParameter('uint256', subData[0]));
133
+ const ratioState = AbiCoder.decodeParameter('uint8', subData[1]);
134
+ return { targetRatio, ratioState };
135
+ },
136
+ };
123
137
  export const aaveV3QuotePriceSubData = {
124
138
  encode(collAsset, collAssetId, debtAsset, debtAssetId, nullAddress = ZERO_ADDRESS) {
125
139
  const encodedColl = AbiCoder.encodeParameter('address', collAsset);
@@ -661,50 +675,3 @@ export const fluidLeverageManagementSubData = {
661
675
  };
662
676
  },
663
677
  };
664
- export const compoundV3LeverageManagementOnPriceSubData = {
665
- encode(market, collToken, baseToken, targetRatio) {
666
- const marketEncoded = AbiCoder.encodeParameter('address', market);
667
- const collTokenEncoded = AbiCoder.encodeParameter('address', collToken);
668
- const baseTokenEncoded = AbiCoder.encodeParameter('address', baseToken);
669
- const targetRatioEncoded = AbiCoder.encodeParameter('uint256', ratioPercentageToWei(targetRatio));
670
- return [
671
- marketEncoded,
672
- collTokenEncoded,
673
- baseTokenEncoded,
674
- targetRatioEncoded,
675
- ];
676
- },
677
- decode(subData) {
678
- const market = AbiCoder.decodeParameter('address', subData[0]);
679
- const collToken = AbiCoder.decodeParameter('address', subData[1]);
680
- const baseToken = AbiCoder.decodeParameter('address', subData[2]);
681
- const weiRatio = AbiCoder.decodeParameter('uint256', subData[3]);
682
- const targetRatio = weiToRatioPercentage(weiRatio);
683
- return {
684
- market, collToken, baseToken, targetRatio,
685
- };
686
- },
687
- };
688
- export const compoundV3CloseSubData = {
689
- encode(market, collToken, baseToken, closeType) {
690
- const marketEncoded = AbiCoder.encodeParameter('address', market);
691
- const collTokenEncoded = AbiCoder.encodeParameter('address', collToken);
692
- const baseTokenEncoded = AbiCoder.encodeParameter('address', baseToken);
693
- const closeTypeEncoded = AbiCoder.encodeParameter('uint8', closeType);
694
- return [
695
- marketEncoded,
696
- collTokenEncoded,
697
- baseTokenEncoded,
698
- closeTypeEncoded,
699
- ];
700
- },
701
- decode(subData) {
702
- const market = AbiCoder.decodeParameter('address', subData[0]);
703
- const collToken = AbiCoder.decodeParameter('address', subData[1]);
704
- const baseToken = AbiCoder.decodeParameter('address', subData[2]);
705
- const closeType = AbiCoder.decodeParameter('uint8', subData[3]);
706
- return {
707
- market, collToken, baseToken, closeType,
708
- };
709
- },
710
- };
@@ -4,7 +4,7 @@ import { getAssetInfo } from '@defisaver/tokens';
4
4
  import * as web3Utils from 'web3-utils';
5
5
  import { ChainId, OrderType, RatioState } from '../types/enums';
6
6
  import '../configuration';
7
- import * as subDataService from './subDataService';
7
+ import { aaveV2LeverageManagementSubData, aaveV3LeverageManagementSubData, aaveV3QuotePriceSubData, cBondsRebondSubData, compoundV2LeverageManagementSubData, compoundV3LeverageManagementSubData, exchangeDcaSubData, exchangeLimitOrderSubData, liquityCloseSubData, liquityDebtInFrontRepaySubData, liquityDsrPaybackSubData, liquityDsrSupplySubData, liquityLeverageManagementSubData, liquityPaybackUsingChickenBondSubData, liquityRepayFromSavingsSubData, makerCloseSubData, makerLeverageManagementSubData, makerRepayFromSavingsSubData, morphoAaveV2LeverageManagementSubData, sparkLeverageManagementSubData, sparkQuotePriceSubData, crvUSDLeverageManagementSubData, compoundV3L2LeverageManagementSubData, morphoBlueLeverageManagementSubData, crvUSDPaybackSubData, aaveV3LeverageManagementOnPriceSubData, } from './subDataService';
8
8
  describe('Feature: subDataService.ts', () => {
9
9
  describe('When testing subDataService.makerRepayFromSavingsSubData', () => {
10
10
  describe('encode()', () => {
@@ -19,7 +19,7 @@ describe('Feature: subDataService.ts', () => {
19
19
  ];
20
20
  examples.forEach(([expected, actual]) => {
21
21
  it(`Given ${actual} should return expected value: ${expected}`, () => {
22
- expect(subDataService.makerRepayFromSavingsSubData.encode(...actual)).to.eql(expected);
22
+ expect(makerRepayFromSavingsSubData.encode(...actual)).to.eql(expected);
23
23
  });
24
24
  });
25
25
  });
@@ -40,7 +40,7 @@ describe('Feature: subDataService.ts', () => {
40
40
  ];
41
41
  examples.forEach(([expected, actual]) => {
42
42
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
43
- expect(subDataService.makerRepayFromSavingsSubData.decode(actual)).to.eql(expected);
43
+ expect(makerRepayFromSavingsSubData.decode(actual)).to.eql(expected);
44
44
  });
45
45
  });
46
46
  });
@@ -58,7 +58,7 @@ describe('Feature: subDataService.ts', () => {
58
58
  ];
59
59
  examples.forEach(([expected, actual]) => {
60
60
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
61
- expect(subDataService.liquityRepayFromSavingsSubData.decode(actual)).to.eql(expected);
61
+ expect(liquityRepayFromSavingsSubData.decode(actual)).to.eql(expected);
62
62
  });
63
63
  });
64
64
  });
@@ -83,7 +83,7 @@ describe('Feature: subDataService.ts', () => {
83
83
  ];
84
84
  examples.forEach(([expected, actual]) => {
85
85
  it(`Given ${actual} should return expected value: ${expected}`, () => {
86
- expect(subDataService.makerCloseSubData.encode(...actual)).to.eql(expected);
86
+ expect(makerCloseSubData.encode(...actual)).to.eql(expected);
87
87
  });
88
88
  });
89
89
  });
@@ -112,7 +112,7 @@ describe('Feature: subDataService.ts', () => {
112
112
  ];
113
113
  examples.forEach(([expected, actual]) => {
114
114
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
115
- expect(subDataService.makerCloseSubData.decode(actual)).to.eql(expected);
115
+ expect(makerCloseSubData.decode(actual)).to.eql(expected);
116
116
  });
117
117
  });
118
118
  });
@@ -130,7 +130,7 @@ describe('Feature: subDataService.ts', () => {
130
130
  ];
131
131
  examples.forEach(([expected, actual]) => {
132
132
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
133
- expect(subDataService.makerLeverageManagementSubData.decode(actual)).to.eql(expected);
133
+ expect(makerLeverageManagementSubData.decode(actual)).to.eql(expected);
134
134
  });
135
135
  });
136
136
  });
@@ -148,7 +148,7 @@ describe('Feature: subDataService.ts', () => {
148
148
  ];
149
149
  examples.forEach(([expected, actual]) => {
150
150
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
151
- expect(subDataService.liquityLeverageManagementSubData.decode(actual)).to.eql(expected);
151
+ expect(liquityLeverageManagementSubData.decode(actual)).to.eql(expected);
152
152
  });
153
153
  });
154
154
  });
@@ -171,7 +171,7 @@ describe('Feature: subDataService.ts', () => {
171
171
  ];
172
172
  examples.forEach(([expected, actual]) => {
173
173
  it(`Given ${actual} should return expected value: ${expected}`, () => {
174
- expect(subDataService.liquityCloseSubData.encode(...actual)).to.eql(expected);
174
+ expect(liquityCloseSubData.encode(...actual)).to.eql(expected);
175
175
  });
176
176
  });
177
177
  });
@@ -198,7 +198,7 @@ describe('Feature: subDataService.ts', () => {
198
198
  ];
199
199
  examples.forEach(([expected, actual]) => {
200
200
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
201
- expect(subDataService.liquityCloseSubData.decode(actual)).to.eql(expected);
201
+ expect(liquityCloseSubData.decode(actual)).to.eql(expected);
202
202
  });
203
203
  });
204
204
  });
@@ -217,7 +217,7 @@ describe('Feature: subDataService.ts', () => {
217
217
  ];
218
218
  examples.forEach(([expected, actual]) => {
219
219
  it(`Given ${actual} should return expected value: ${expected}`, () => {
220
- expect(subDataService.aaveV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
220
+ expect(aaveV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
221
221
  });
222
222
  });
223
223
  });
@@ -234,7 +234,7 @@ describe('Feature: subDataService.ts', () => {
234
234
  ];
235
235
  examples.forEach(([expected, actual]) => {
236
236
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
237
- expect(subDataService.aaveV2LeverageManagementSubData.decode(actual)).to.eql(expected);
237
+ expect(aaveV2LeverageManagementSubData.decode(actual)).to.eql(expected);
238
238
  });
239
239
  });
240
240
  });
@@ -253,7 +253,7 @@ describe('Feature: subDataService.ts', () => {
253
253
  ];
254
254
  examples.forEach(([expected, actual]) => {
255
255
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
256
- expect(subDataService.aaveV3LeverageManagementSubData.decode(actual)).to.eql(expected);
256
+ expect(aaveV3LeverageManagementSubData.decode(actual)).to.eql(expected);
257
257
  });
258
258
  });
259
259
  });
@@ -290,7 +290,7 @@ describe('Feature: subDataService.ts', () => {
290
290
  ];
291
291
  examples.forEach(([expected, actual]) => {
292
292
  it(`Given ${actual} should return expected value: ${expected}`, () => {
293
- expect(subDataService.aaveV3QuotePriceSubData.encode(...actual)).to.eql(expected);
293
+ expect(aaveV3QuotePriceSubData.encode(...actual)).to.eql(expected);
294
294
  });
295
295
  });
296
296
  });
@@ -325,7 +325,7 @@ describe('Feature: subDataService.ts', () => {
325
325
  ];
326
326
  examples.forEach(([expected, actual]) => {
327
327
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
328
- expect(subDataService.aaveV3QuotePriceSubData.decode(actual)).to.eql(expected);
328
+ expect(aaveV3QuotePriceSubData.decode(actual)).to.eql(expected);
329
329
  });
330
330
  });
331
331
  });
@@ -344,7 +344,7 @@ describe('Feature: subDataService.ts', () => {
344
344
  ];
345
345
  examples.forEach(([expected, actual]) => {
346
346
  it(`Given ${actual} should return expected value: ${expected}`, () => {
347
- expect(subDataService.compoundV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
347
+ expect(compoundV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
348
348
  });
349
349
  });
350
350
  });
@@ -361,7 +361,7 @@ describe('Feature: subDataService.ts', () => {
361
361
  ];
362
362
  examples.forEach(([expected, actual]) => {
363
363
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
364
- expect(subDataService.compoundV2LeverageManagementSubData.decode(actual)).to.eql(expected);
364
+ expect(compoundV2LeverageManagementSubData.decode(actual)).to.eql(expected);
365
365
  });
366
366
  });
367
367
  });
@@ -406,7 +406,7 @@ describe('Feature: subDataService.ts', () => {
406
406
  ];
407
407
  examples.forEach(([expected, actual]) => {
408
408
  it(`Given ${actual} should return expected value: ${expected}`, () => {
409
- expect(subDataService.compoundV3LeverageManagementSubData.encode(...actual)).to.eql(expected);
409
+ expect(compoundV3LeverageManagementSubData.encode(...actual)).to.eql(expected);
410
410
  });
411
411
  });
412
412
  });
@@ -429,7 +429,7 @@ describe('Feature: subDataService.ts', () => {
429
429
  ];
430
430
  examples.forEach(([expected, actual]) => {
431
431
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
432
- expect(subDataService.compoundV3LeverageManagementSubData.decode(actual)).to.eql(expected);
432
+ expect(compoundV3LeverageManagementSubData.decode(actual)).to.eql(expected);
433
433
  });
434
434
  });
435
435
  });
@@ -448,7 +448,7 @@ describe('Feature: subDataService.ts', () => {
448
448
  ];
449
449
  examples.forEach(([expected, actual]) => {
450
450
  it(`Given ${actual} should return expected value: ${expected}`, () => {
451
- expect(subDataService.morphoAaveV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
451
+ expect(morphoAaveV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
452
452
  });
453
453
  });
454
454
  });
@@ -465,7 +465,7 @@ describe('Feature: subDataService.ts', () => {
465
465
  ];
466
466
  examples.forEach(([expected, actual]) => {
467
467
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
468
- expect(subDataService.morphoAaveV2LeverageManagementSubData.decode(actual)).to.eql(expected);
468
+ expect(morphoAaveV2LeverageManagementSubData.decode(actual)).to.eql(expected);
469
469
  });
470
470
  });
471
471
  });
@@ -484,7 +484,7 @@ describe('Feature: subDataService.ts', () => {
484
484
  ];
485
485
  examples.forEach(([expected, actual]) => {
486
486
  it(`Given ${actual} should return expected value: ${expected}`, () => {
487
- expect(subDataService.cBondsRebondSubData.encode(...actual)).to.eql(expected);
487
+ expect(cBondsRebondSubData.encode(...actual)).to.eql(expected);
488
488
  });
489
489
  });
490
490
  });
@@ -501,7 +501,7 @@ describe('Feature: subDataService.ts', () => {
501
501
  ];
502
502
  examples.forEach(([expected, actual]) => {
503
503
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
504
- expect(subDataService.cBondsRebondSubData.decode(actual)).to.eql(expected);
504
+ expect(cBondsRebondSubData.decode(actual)).to.eql(expected);
505
505
  });
506
506
  });
507
507
  });
@@ -526,7 +526,7 @@ describe('Feature: subDataService.ts', () => {
526
526
  ];
527
527
  examples.forEach(([expected, actual]) => {
528
528
  it(`Given ${actual} should return expected value: ${expected}`, () => {
529
- expect(subDataService.liquityPaybackUsingChickenBondSubData.encode(...actual)).to.eql(expected);
529
+ expect(liquityPaybackUsingChickenBondSubData.encode(...actual)).to.eql(expected);
530
530
  });
531
531
  });
532
532
  });
@@ -549,7 +549,7 @@ describe('Feature: subDataService.ts', () => {
549
549
  ];
550
550
  examples.forEach(([expected, actual]) => {
551
551
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
552
- expect(subDataService.liquityPaybackUsingChickenBondSubData.decode(actual)).to.eql(expected);
552
+ expect(liquityPaybackUsingChickenBondSubData.decode(actual)).to.eql(expected);
553
553
  });
554
554
  });
555
555
  });
@@ -584,7 +584,7 @@ describe('Feature: subDataService.ts', () => {
584
584
  ];
585
585
  examples.forEach(([expected, actual]) => {
586
586
  it(`Given ${actual} should return expected value: ${expected}`, () => {
587
- expect(subDataService.exchangeDcaSubData.encode(...actual)).to.eql(expected);
587
+ expect(exchangeDcaSubData.encode(...actual)).to.eql(expected);
588
588
  });
589
589
  });
590
590
  });
@@ -623,7 +623,7 @@ describe('Feature: subDataService.ts', () => {
623
623
  ];
624
624
  examples.forEach(([expected, actual]) => {
625
625
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
626
- expect(subDataService.exchangeDcaSubData.decode(...actual)).to.eql(expected);
626
+ expect(exchangeDcaSubData.decode(...actual)).to.eql(expected);
627
627
  });
628
628
  });
629
629
  });
@@ -670,7 +670,7 @@ describe('Feature: subDataService.ts', () => {
670
670
  ];
671
671
  examples.forEach(([expected, actual]) => {
672
672
  it(`Given ${actual} should return expected value: ${expected}`, () => {
673
- expect(subDataService.exchangeLimitOrderSubData.encode(...actual)).to.eql(expected);
673
+ expect(exchangeLimitOrderSubData.encode(...actual)).to.eql(expected);
674
674
  });
675
675
  });
676
676
  });
@@ -707,7 +707,7 @@ describe('Feature: subDataService.ts', () => {
707
707
  ];
708
708
  examples.forEach(([expected, actual]) => {
709
709
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
710
- expect(subDataService.exchangeLimitOrderSubData.decode(...actual)).to.eql(expected);
710
+ expect(exchangeLimitOrderSubData.decode(...actual)).to.eql(expected);
711
711
  });
712
712
  });
713
713
  });
@@ -726,7 +726,7 @@ describe('Feature: subDataService.ts', () => {
726
726
  ];
727
727
  examples.forEach(([expected, actual]) => {
728
728
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
729
- expect(subDataService.sparkLeverageManagementSubData.decode(actual)).to.eql(expected);
729
+ expect(sparkLeverageManagementSubData.decode(actual)).to.eql(expected);
730
730
  });
731
731
  });
732
732
  });
@@ -763,7 +763,7 @@ describe('Feature: subDataService.ts', () => {
763
763
  ];
764
764
  examples.forEach(([expected, actual]) => {
765
765
  it(`Given ${actual} should return expected value: ${expected}`, () => {
766
- expect(subDataService.sparkQuotePriceSubData.encode(...actual)).to.eql(expected);
766
+ expect(sparkQuotePriceSubData.encode(...actual)).to.eql(expected);
767
767
  });
768
768
  });
769
769
  });
@@ -798,7 +798,7 @@ describe('Feature: subDataService.ts', () => {
798
798
  ];
799
799
  examples.forEach(([expected, actual]) => {
800
800
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
801
- expect(subDataService.sparkQuotePriceSubData.decode(actual)).to.eql(expected);
801
+ expect(sparkQuotePriceSubData.decode(actual)).to.eql(expected);
802
802
  });
803
803
  });
804
804
  });
@@ -823,7 +823,7 @@ describe('Feature: subDataService.ts', () => {
823
823
  ];
824
824
  examples.forEach(([expected, actual]) => {
825
825
  it(`Given ${actual} should return expected value: ${expected}`, () => {
826
- expect(subDataService.liquityDsrPaybackSubData.encode(...actual)).to.eql(expected);
826
+ expect(liquityDsrPaybackSubData.encode(...actual)).to.eql(expected);
827
827
  });
828
828
  });
829
829
  });
@@ -850,7 +850,7 @@ describe('Feature: subDataService.ts', () => {
850
850
  ];
851
851
  examples.forEach(([expected, actual]) => {
852
852
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
853
- expect(subDataService.liquityDsrPaybackSubData.decode(actual)).to.eql(expected);
853
+ expect(liquityDsrPaybackSubData.decode(actual)).to.eql(expected);
854
854
  });
855
855
  });
856
856
  });
@@ -875,7 +875,7 @@ describe('Feature: subDataService.ts', () => {
875
875
  ];
876
876
  examples.forEach(([expected, actual]) => {
877
877
  it(`Given ${actual} should return expected value: ${expected}`, () => {
878
- expect(subDataService.liquityDsrSupplySubData.encode(...actual)).to.eql(expected);
878
+ expect(liquityDsrSupplySubData.encode(...actual)).to.eql(expected);
879
879
  });
880
880
  });
881
881
  });
@@ -902,7 +902,7 @@ describe('Feature: subDataService.ts', () => {
902
902
  ];
903
903
  examples.forEach(([expected, actual]) => {
904
904
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
905
- expect(subDataService.liquityDsrSupplySubData.decode(actual)).to.eql(expected);
905
+ expect(liquityDsrSupplySubData.decode(actual)).to.eql(expected);
906
906
  });
907
907
  });
908
908
  });
@@ -929,7 +929,7 @@ describe('Feature: subDataService.ts', () => {
929
929
  ];
930
930
  examples.forEach(([expected, actual]) => {
931
931
  it(`Given ${actual} should return expected value: ${expected}`, () => {
932
- expect(subDataService.liquityDebtInFrontRepaySubData.encode(...actual)).to.eql(expected);
932
+ expect(liquityDebtInFrontRepaySubData.encode(...actual)).to.eql(expected);
933
933
  });
934
934
  });
935
935
  });
@@ -958,7 +958,7 @@ describe('Feature: subDataService.ts', () => {
958
958
  ];
959
959
  examples.forEach(([expected, actual]) => {
960
960
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
961
- expect(subDataService.liquityDebtInFrontRepaySubData.decode(actual)).to.eql(expected);
961
+ expect(liquityDebtInFrontRepaySubData.decode(actual)).to.eql(expected);
962
962
  });
963
963
  });
964
964
  });
@@ -989,7 +989,7 @@ describe('Feature: subDataService.ts', () => {
989
989
  ];
990
990
  examples.forEach(([expected, actual]) => {
991
991
  it(`Given ${actual} should return expected value: ${expected}`, () => {
992
- expect(subDataService.crvUSDLeverageManagementSubData.encode(...actual)).to.eql(expected);
992
+ expect(crvUSDLeverageManagementSubData.encode(...actual)).to.eql(expected);
993
993
  });
994
994
  });
995
995
  });
@@ -1012,7 +1012,7 @@ describe('Feature: subDataService.ts', () => {
1012
1012
  ];
1013
1013
  examples.forEach(([expected, actual]) => {
1014
1014
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1015
- expect(subDataService.crvUSDLeverageManagementSubData.decode(actual)).to.eql(expected);
1015
+ expect(crvUSDLeverageManagementSubData.decode(actual)).to.eql(expected);
1016
1016
  });
1017
1017
  });
1018
1018
  });
@@ -1033,7 +1033,7 @@ describe('Feature: subDataService.ts', () => {
1033
1033
  ];
1034
1034
  examples.forEach(([expected, actual]) => {
1035
1035
  it(`Given ${actual} should return expected value: ${expected}`, () => {
1036
- expect(subDataService.crvUSDPaybackSubData.encode(...actual)).to.eql(expected);
1036
+ expect(crvUSDPaybackSubData.encode(...actual)).to.eql(expected);
1037
1037
  });
1038
1038
  });
1039
1039
  });
@@ -1057,7 +1057,7 @@ describe('Feature: subDataService.ts', () => {
1057
1057
  ];
1058
1058
  examples.forEach(([expected, actual]) => {
1059
1059
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1060
- expect(subDataService.crvUSDPaybackSubData.decode(actual)).to.eql(expected);
1060
+ expect(crvUSDPaybackSubData.decode(actual)).to.eql(expected);
1061
1061
  });
1062
1062
  });
1063
1063
  });
@@ -1076,7 +1076,7 @@ describe('Feature: subDataService.ts', () => {
1076
1076
  ];
1077
1077
  examples.forEach(([expected, actual]) => {
1078
1078
  it(`Given ${actual} should return expected value: ${expected}`, () => {
1079
- expect(subDataService.compoundV3L2LeverageManagementSubData.encode(...actual)).to.eql(expected);
1079
+ expect(compoundV3L2LeverageManagementSubData.encode(...actual)).to.eql(expected);
1080
1080
  });
1081
1081
  });
1082
1082
  });
@@ -1099,7 +1099,7 @@ describe('Feature: subDataService.ts', () => {
1099
1099
  ];
1100
1100
  examples.forEach(([expected, actual]) => {
1101
1101
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1102
- expect(subDataService.compoundV3L2LeverageManagementSubData.decode(actual)).to.eql(expected);
1102
+ expect(compoundV3L2LeverageManagementSubData.decode(actual)).to.eql(expected);
1103
1103
  });
1104
1104
  });
1105
1105
  });
@@ -1138,7 +1138,7 @@ describe('Feature: subDataService.ts', () => {
1138
1138
  ];
1139
1139
  examples.forEach(([expected, actual]) => {
1140
1140
  it(`Given ${actual} should return expected value: ${expected}`, () => {
1141
- expect(subDataService.morphoBlueLeverageManagementSubData.encode(...actual)).to.eql(expected);
1141
+ expect(morphoBlueLeverageManagementSubData.encode(...actual)).to.eql(expected);
1142
1142
  });
1143
1143
  });
1144
1144
  });
@@ -1189,7 +1189,7 @@ describe('Feature: subDataService.ts', () => {
1189
1189
  ];
1190
1190
  examples.forEach(([expected, actual]) => {
1191
1191
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1192
- expect(subDataService.morphoBlueLeverageManagementSubData.decode(actual)).to.eql(expected);
1192
+ expect(morphoBlueLeverageManagementSubData.decode(actual)).to.eql(expected);
1193
1193
  });
1194
1194
  });
1195
1195
  });
@@ -1219,7 +1219,7 @@ describe('Feature: subDataService.ts', () => {
1219
1219
  ];
1220
1220
  examples.forEach(([expected, actual]) => {
1221
1221
  it(`Given ${actual} should return expected value: ${expected}`, () => {
1222
- expect(subDataService.aaveV3LeverageManagementOnPriceSubData.encode(...actual)).to.eql(expected);
1222
+ expect(aaveV3LeverageManagementOnPriceSubData.encode(...actual)).to.eql(expected);
1223
1223
  });
1224
1224
  });
1225
1225
  });
@@ -1246,83 +1246,7 @@ describe('Feature: subDataService.ts', () => {
1246
1246
  ];
1247
1247
  examples.forEach(([expected, actual]) => {
1248
1248
  it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1249
- expect(subDataService.aaveV3LeverageManagementOnPriceSubData.decode(actual)).to.eql(expected);
1250
- });
1251
- });
1252
- });
1253
- });
1254
- describe('When testing subDataService.compoundV3LeverageManagementOnPriceSubData', () => {
1255
- describe('encode()', () => {
1256
- const examples = [
1257
- [
1258
- [
1259
- '0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3',
1260
- '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1261
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
1262
- '0x0000000000000000000000000000000000000000000000001bc16d674ec80000'
1263
- ],
1264
- [
1265
- web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
1266
- web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
1267
- web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
1268
- 200
1269
- ]
1270
- ],
1271
- [
1272
- [
1273
- '0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3',
1274
- '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1275
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
1276
- '0x0000000000000000000000000000000000000000000000001a5e27eef13e0000'
1277
- ],
1278
- [
1279
- web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
1280
- web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
1281
- web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
1282
- 190
1283
- ]
1284
- ],
1285
- ];
1286
- examples.forEach(([expected, actual]) => {
1287
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1288
- expect(subDataService.compoundV3LeverageManagementOnPriceSubData.encode(...actual)).to.eql(expected);
1289
- });
1290
- });
1291
- });
1292
- describe('decode()', () => {
1293
- const examples = [
1294
- [
1295
- {
1296
- market: web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
1297
- collToken: web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
1298
- baseToken: web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
1299
- targetRatio: 200,
1300
- },
1301
- [
1302
- '0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3',
1303
- '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1304
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
1305
- '0x0000000000000000000000000000000000000000000000001bc16d674ec80000'
1306
- ]
1307
- ],
1308
- [
1309
- {
1310
- market: web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
1311
- collToken: web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
1312
- baseToken: web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
1313
- targetRatio: 190,
1314
- },
1315
- [
1316
- '0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3',
1317
- '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1318
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
1319
- '0x0000000000000000000000000000000000000000000000001a5e27eef13e0000'
1320
- ]
1321
- ],
1322
- ];
1323
- examples.forEach(([expected, actual]) => {
1324
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1325
- expect(subDataService.compoundV3LeverageManagementOnPriceSubData.decode(actual)).to.eql(expected);
1249
+ expect(aaveV3LeverageManagementOnPriceSubData.decode(actual)).to.eql(expected);
1326
1250
  });
1327
1251
  });
1328
1252
  });
@@ -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
- };
@@ -442,38 +442,3 @@ export const fluidRatioTrigger = {
442
442
  };
443
443
  },
444
444
  };
445
- export const compoundV3PriceTrigger = {
446
- encode(market, collToken, price, priceState) {
447
- const _price = new Dec(price.toString()).mul(1e8).floor().toString();
448
- return [
449
- AbiCoder.encodeParameters(['address', 'address', 'uint256', 'uint8'], [market, collToken, _price, priceState]),
450
- ];
451
- },
452
- decode(triggerData) {
453
- const decodedData = AbiCoder.decodeParameters(['address', 'address', 'uint256', 'uint8'], triggerData[0]);
454
- return {
455
- market: decodedData[0],
456
- collToken: decodedData[1],
457
- price: new Dec(decodedData[2]).div(1e8).toString(),
458
- priceState: Number(decodedData[3]),
459
- };
460
- },
461
- };
462
- export const compoundV3PriceRangeTrigger = {
463
- encode(market, collToken, lowerPrice, upperPrice) {
464
- const lowerPriceFormatted = new Dec(lowerPrice).mul(1e8).floor().toString();
465
- const upperPriceFormatted = new Dec(upperPrice).mul(1e8).floor().toString();
466
- return [
467
- AbiCoder.encodeParameters(['address', 'address', 'uint256', 'uint256'], [market, collToken, lowerPriceFormatted, upperPriceFormatted]),
468
- ];
469
- },
470
- decode(triggerData) {
471
- const decodedData = AbiCoder.decodeParameters(['address', 'address', 'uint256', 'uint256'], triggerData[0]);
472
- return {
473
- market: decodedData[0],
474
- collToken: decodedData[1],
475
- lowerPrice: new Dec(decodedData[2]).div(1e8).toString(),
476
- upperPrice: new Dec(decodedData[3]).div(1e8).toString(),
477
- };
478
- },
479
- };