@defisaver/automation-sdk 3.3.14 → 3.3.15

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.
@@ -102,7 +102,7 @@ function parseMakerTrailingStop(position: Position.Automated, parseData: ParseDa
102
102
  function parseMakerLeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
103
103
  const _position = cloneDeep(position);
104
104
 
105
- const { subStruct, subId } = parseData.subscriptionEventData;
105
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
106
106
  const { isEnabled } = parseData.strategiesSubsData;
107
107
 
108
108
  const triggerData = triggerService.makerRatioTrigger.decode(subStruct.triggerData);
@@ -119,9 +119,10 @@ function parseMakerLeverageManagement(position: Position.Automated, parseData: P
119
119
  _position.specific = {
120
120
  triggerRepayRatio: triggerData.ratio,
121
121
  targetRepayRatio: subData.targetRatio,
122
- repayEnabled: true,
122
+ repayEnabled: isEnabled,
123
123
  subId1: Number(subId),
124
124
  mergeWithId: Strategies.Identifiers.Boost,
125
+ subHashRepay: subHash,
125
126
  };
126
127
  } else {
127
128
  _position.specific = {
@@ -130,6 +131,7 @@ function parseMakerLeverageManagement(position: Position.Automated, parseData: P
130
131
  boostEnabled: isEnabled,
131
132
  subId2: Number(subId),
132
133
  mergeId: Strategies.Identifiers.Boost,
134
+ subHashBoost: subHash,
133
135
  };
134
136
  }
135
137
 
@@ -190,7 +192,7 @@ function parseLiquityTrailingStop(position: Position.Automated, parseData: Parse
190
192
  function parseAaveV2LeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
191
193
  const _position = cloneDeep(position);
192
194
 
193
- const { subStruct, subId } = parseData.subscriptionEventData;
195
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
194
196
  const { isEnabled } = parseData.strategiesSubsData;
195
197
 
196
198
  const triggerData = triggerService.aaveV2RatioTrigger.decode(subStruct.triggerData);
@@ -207,9 +209,10 @@ function parseAaveV2LeverageManagement(position: Position.Automated, parseData:
207
209
  _position.specific = {
208
210
  triggerRepayRatio: triggerData.ratio,
209
211
  targetRepayRatio: subData.targetRatio,
210
- repayEnabled: true,
212
+ repayEnabled: isEnabled,
211
213
  subId1: Number(subId),
212
214
  mergeWithId: Strategies.Identifiers.Boost,
215
+ subHashRepay: subHash,
213
216
  };
214
217
  } else {
215
218
  _position.specific = {
@@ -218,6 +221,7 @@ function parseAaveV2LeverageManagement(position: Position.Automated, parseData:
218
221
  boostEnabled: isEnabled,
219
222
  subId2: Number(subId),
220
223
  mergeId: Strategies.Identifiers.Boost,
224
+ subHashBoost: subHash,
221
225
  };
222
226
  }
223
227
 
@@ -501,7 +505,7 @@ function parseAaveV4CollateralSwitch(position: Position.Automated, parseData: Pa
501
505
  function parseMorphoAaveV2LeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
502
506
  const _position = cloneDeep(position);
503
507
 
504
- const { subStruct, subId } = parseData.subscriptionEventData;
508
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
505
509
  const { isEnabled } = parseData.strategiesSubsData;
506
510
 
507
511
  const triggerData = triggerService.morphoAaveV2RatioTrigger.decode(subStruct.triggerData);
@@ -518,9 +522,10 @@ function parseMorphoAaveV2LeverageManagement(position: Position.Automated, parse
518
522
  _position.specific = {
519
523
  triggerRepayRatio: triggerData.ratio,
520
524
  targetRepayRatio: subData.targetRatio,
521
- repayEnabled: true,
525
+ repayEnabled: isEnabled,
522
526
  subId1: Number(subId),
523
527
  mergeWithId: Strategies.Identifiers.Boost,
528
+ subHashRepay: subHash,
524
529
  };
525
530
  } else {
526
531
  _position.specific = {
@@ -529,6 +534,7 @@ function parseMorphoAaveV2LeverageManagement(position: Position.Automated, parse
529
534
  boostEnabled: isEnabled,
530
535
  subId2: Number(subId),
531
536
  mergeId: Strategies.Identifiers.Boost,
537
+ subHashBoost: subHash,
532
538
  };
533
539
  }
534
540
 
@@ -579,7 +585,7 @@ function parseAaveV3CloseOnPriceWithMaximumGasPrice(position: Position.Automated
579
585
  function parseCompoundV2LeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
580
586
  const _position = cloneDeep(position);
581
587
 
582
- const { subStruct, subId } = parseData.subscriptionEventData;
588
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
583
589
  const { isEnabled } = parseData.strategiesSubsData;
584
590
 
585
591
  const triggerData = triggerService.compoundV2RatioTrigger.decode(subStruct.triggerData);
@@ -597,9 +603,10 @@ function parseCompoundV2LeverageManagement(position: Position.Automated, parseDa
597
603
  _position.specific = {
598
604
  triggerRepayRatio: triggerData.ratio,
599
605
  targetRepayRatio: subData.targetRatio,
600
- repayEnabled: true,
606
+ repayEnabled: isEnabled,
601
607
  subId1: Number(subId),
602
608
  mergeWithId: Strategies.Identifiers.Boost,
609
+ subHashRepay: subHash,
603
610
  };
604
611
  } else {
605
612
  _position.specific = {
@@ -608,6 +615,7 @@ function parseCompoundV2LeverageManagement(position: Position.Automated, parseDa
608
615
  boostEnabled: isEnabled,
609
616
  subId2: Number(subId),
610
617
  mergeId: Strategies.Identifiers.Boost,
618
+ subHashBoost: subHash,
611
619
  };
612
620
  }
613
621
 
@@ -620,12 +628,10 @@ function parseCompoundV2LeverageManagement(position: Position.Automated, parseDa
620
628
  function parseCompoundV3LeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
621
629
  const _position = cloneDeep(position);
622
630
 
623
- const { subStruct, subId } = parseData.subscriptionEventData;
631
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
624
632
  const { isEnabled } = parseData.strategiesSubsData;
625
633
 
626
- const subDataDecoder = position.chainId !== 1
627
- ? subDataService.compoundV3L2LeverageManagementSubData
628
- : subDataService.compoundV3LeverageManagementSubData;
634
+ const subDataDecoder = subDataService.compoundV3LeverageManagementSubDataWithoutSubProxy;
629
635
 
630
636
  const triggerData = triggerService.compoundV3RatioTrigger.decode(subStruct.triggerData);
631
637
  const subData = subDataDecoder.decode(subStruct.subData);
@@ -643,9 +649,10 @@ function parseCompoundV3LeverageManagement(position: Position.Automated, parseDa
643
649
  _position.specific = {
644
650
  triggerRepayRatio: triggerData.ratio,
645
651
  targetRepayRatio: subData.targetRatio,
646
- repayEnabled: true,
652
+ repayEnabled: isEnabled,
647
653
  subId1: Number(subId),
648
654
  mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
655
+ subHashRepay: subHash,
649
656
  };
650
657
  } else {
651
658
  _position.specific = {
@@ -654,6 +661,7 @@ function parseCompoundV3LeverageManagement(position: Position.Automated, parseDa
654
661
  boostEnabled: isEnabled,
655
662
  subId2: Number(subId),
656
663
  mergeId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
664
+ subHashBoost: subHash,
657
665
  };
658
666
  }
659
667
 
@@ -779,7 +787,7 @@ function parseExchangeLimitOrder(position: Position.Automated, parseData: ParseD
779
787
  function parseLiquityLeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
780
788
  const _position = cloneDeep(position);
781
789
 
782
- const { subStruct, subId } = parseData.subscriptionEventData;
790
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
783
791
  const { isEnabled } = parseData.strategiesSubsData;
784
792
 
785
793
  const triggerData = triggerService.liquityRatioTrigger.decode(subStruct.triggerData);
@@ -796,9 +804,10 @@ function parseLiquityLeverageManagement(position: Position.Automated, parseData:
796
804
  _position.specific = {
797
805
  triggerRepayRatio: triggerData.ratio,
798
806
  targetRepayRatio: subData.targetRatio,
799
- repayEnabled: true,
807
+ repayEnabled: isEnabled,
800
808
  subId1: Number(subId),
801
809
  mergeWithId: Strategies.Identifiers.Boost,
810
+ subHashRepay: subHash,
802
811
  };
803
812
  } else {
804
813
  _position.specific = {
@@ -807,6 +816,7 @@ function parseLiquityLeverageManagement(position: Position.Automated, parseData:
807
816
  boostEnabled: isEnabled,
808
817
  subId2: Number(subId),
809
818
  mergeId: Strategies.Identifiers.Boost,
819
+ subHashBoost: subHash,
810
820
  };
811
821
  }
812
822
 
@@ -861,7 +871,7 @@ function parseLiquityV2LeverageManagement(position: Position.Automated, parseDat
861
871
  function parseSparkLeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
862
872
  const _position = cloneDeep(position);
863
873
 
864
- const { subStruct, subId } = parseData.subscriptionEventData;
874
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
865
875
  const { isEnabled } = parseData.strategiesSubsData;
866
876
 
867
877
  const triggerData = triggerService.sparkRatioTrigger.decode(subStruct.triggerData);
@@ -878,9 +888,10 @@ function parseSparkLeverageManagement(position: Position.Automated, parseData: P
878
888
  _position.specific = {
879
889
  triggerRepayRatio: triggerData.ratio,
880
890
  targetRepayRatio: subData.targetRatio,
881
- repayEnabled: true,
891
+ repayEnabled: isEnabled,
882
892
  subId1: Number(subId),
883
893
  mergeWithId: Strategies.Identifiers.Boost,
894
+ subHashRepay: subHash,
884
895
  };
885
896
  } else {
886
897
  _position.specific = {
@@ -889,6 +900,7 @@ function parseSparkLeverageManagement(position: Position.Automated, parseData: P
889
900
  boostEnabled: isEnabled,
890
901
  subId2: Number(subId),
891
902
  mergeId: Strategies.Identifiers.Boost,
903
+ subHashBoost: subHash,
892
904
  };
893
905
  }
894
906
 
@@ -1128,6 +1140,7 @@ function parseMorphoBlueLeverageManagementOnPrice(position: Position.Automated,
1128
1140
  debtAsset: subData.loanToken,
1129
1141
  price: triggerData.price,
1130
1142
  ratio: subData.targetRatio,
1143
+ ratioState: triggerData.priceState,
1131
1144
  };
1132
1145
 
1133
1146
  return _position;
@@ -9,17 +9,14 @@ import type { EthereumAddress, StrategyOrBundleIds, SubData, TriggerData } from
9
9
 
10
10
  import '../configuration';
11
11
  import {
12
- aaveV2Encode,
13
12
  chickenBondsEncode,
14
13
  liquityEncode,
15
14
  makerEncode,
16
15
  aaveV3Encode,
17
- compoundV2Encode,
18
16
  compoundV3Encode,
19
17
  morphoAaveV2Encode,
20
18
  exchangeEncode,
21
19
  crvUSDEncode,
22
- compoundV3L2Encode,
23
20
  morphoBlueEncode,
24
21
  sparkEncode,
25
22
  aaveV4Encode,
@@ -140,39 +137,6 @@ describe('Feature: strategySubService.ts', () => {
140
137
  });
141
138
  });
142
139
 
143
- describe('leverageManagement()', () => {
144
- const examples: Array<[
145
- [
146
- vaultId: number, triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string,
147
- targetRepayRatio: string, boostEnabled: boolean,
148
- ],
149
- [
150
- vaultId: number, triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string,
151
- targetRepayRatio: string, boostEnabled: boolean,
152
- ]
153
- ]> = [
154
- [
155
- [
156
- 5791,
157
- new Dec('210').mul(1e16).toString(),
158
- new Dec('290').mul(1e16).toString(),
159
- new Dec('240').mul(1e16).toString(),
160
- new Dec('240').mul(1e16).toString(),
161
- true,
162
- ],
163
- [
164
- 5791, '210', '290', '240', '240', true,
165
- ]
166
- ]
167
- ];
168
-
169
- examples.forEach(([expected, actual]) => {
170
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
171
- expect(makerEncode.leverageManagement(...actual)).to.eql(expected);
172
- });
173
- });
174
- });
175
-
176
140
  describe('leverageManagementWithoutSubProxy()', () => {
177
141
  const examples: Array<[
178
142
  [StrategyOrBundleIds, boolean, TriggerData, SubData],
@@ -296,38 +260,6 @@ describe('Feature: strategySubService.ts', () => {
296
260
  });
297
261
  });
298
262
 
299
- describe('leverageManagement()', () => {
300
- const examples: Array<[
301
- [
302
- triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string,
303
- targetRepayRatio: string, boostEnabled: boolean,
304
- ],
305
- [
306
- triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string,
307
- targetRepayRatio: string, boostEnabled: boolean,
308
- ]
309
- ]> = [
310
- [
311
- [
312
- new Dec('210').mul(1e16).toString(),
313
- new Dec('290').mul(1e16).toString(),
314
- new Dec('240').mul(1e16).toString(),
315
- new Dec('240').mul(1e16).toString(),
316
- false,
317
- ],
318
- [
319
- '210', '290', '240', '240', false,
320
- ]
321
- ]
322
- ];
323
-
324
- examples.forEach(([expected, actual]) => {
325
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
326
- expect(liquityEncode.leverageManagement(...actual)).to.eql(expected);
327
- });
328
- });
329
- });
330
-
331
263
  describe('paybackFromChickenBondStrategySub()', () => {
332
264
  const examples: Array<[
333
265
  [StrategyOrBundleIds, boolean, TriggerData, SubData],
@@ -436,53 +368,7 @@ describe('Feature: strategySubService.ts', () => {
436
368
  });
437
369
  });
438
370
 
439
- describe('When testing strategySubService.aaveV2Encode', () => {
440
- describe('leverageManagement()', () => {
441
- const examples: Array<[
442
- [string, string, string, string, boolean],
443
- [triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean],
444
- ]> = [
445
- [
446
- [new Dec(160).mul(1e16).toString(), new Dec(220).mul(1e16).toString(), new Dec(180).mul(1e16).toString(), new Dec(190).mul(1e16).toString(), true],
447
- [160, 220, 180, 190, true]
448
- ],
449
- [
450
- [new Dec(160).mul(1e16).toString(), new Dec(200).mul(1e16).toString(), new Dec(180).mul(1e16).toString(), new Dec(190).mul(1e16).toString(), false],
451
- [160, 200, 180, 190, false]
452
- ],
453
- ];
454
-
455
- examples.forEach(([expected, actual]) => {
456
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
457
- expect(aaveV2Encode.leverageManagement(...actual)).to.eql(expected);
458
- });
459
- });
460
- });
461
- });
462
-
463
371
  describe('When testing strategySubService.aaveV3Encode', () => {
464
- describe('leverageManagement()', () => {
465
- const examples: Array<[
466
- string,
467
- [triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean],
468
- ]> = [
469
- [
470
- '0x000000000000000016345785d8a0000000000000000000001e87f85809dc0000000000000000000018fae27693b4000000000000000000001a5e27eef13e000001',
471
- [160, 220, 180, 190, true]
472
- ],
473
- [
474
- '0x000000000000000016345785d8a0000000000000000000001bc16d674ec80000000000000000000018fae27693b4000000000000000000001a5e27eef13e000000',
475
- [160, 200, 180, 190, false]
476
- ],
477
- ];
478
-
479
- examples.forEach(([expected, actual]) => {
480
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
481
- expect(aaveV3Encode.leverageManagement(...actual)).to.eql(expected);
482
- });
483
- });
484
- });
485
-
486
372
  describe('closeToAsset()', () => {
487
373
  const examples: Array<[
488
374
  [StrategyOrBundleIds, boolean, TriggerData, SubData],
@@ -1141,74 +1027,7 @@ describe('Feature: strategySubService.ts', () => {
1141
1027
  });
1142
1028
  });
1143
1029
 
1144
- describe('When testing strategySubService.compoundV2Encode', () => {
1145
- describe('leverageManagement()', () => {
1146
- const examples: Array<[
1147
- [string, string, string, string, boolean],
1148
- [triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean],
1149
- ]> = [
1150
- [
1151
- [new Dec(160).mul(1e16).toString(), new Dec(220).mul(1e16).toString(), new Dec(180).mul(1e16).toString(), new Dec(190).mul(1e16).toString(), true],
1152
- [160, 220, 180, 190, true]
1153
- ],
1154
- [
1155
- [new Dec(160).mul(1e16).toString(), new Dec(200).mul(1e16).toString(), new Dec(180).mul(1e16).toString(), new Dec(190).mul(1e16).toString(), false],
1156
- [160, 200, 180, 190, false]
1157
- ],
1158
- ];
1159
-
1160
- examples.forEach(([expected, actual]) => {
1161
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1162
- expect(compoundV2Encode.leverageManagement(...actual)).to.eql(expected);
1163
- });
1164
- });
1165
- });
1166
- });
1167
-
1168
1030
  describe('When testing strategySubService.compoundV3Encode', () => {
1169
- describe('leverageManagement()', () => {
1170
- const examples: Array<[[EthereumAddress, EthereumAddress, string, string, string, string, boolean, boolean], [market: EthereumAddress, baseToken: EthereumAddress, triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean, isEOA: boolean]]> = [
1171
- [
1172
- [
1173
- web3Utils.toChecksumAddress('0x1C0F620155e85491f8D35440eb17538Ca5c55212'),
1174
- web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address),
1175
- new Dec(160).mul(1e16).toString(),
1176
- new Dec(220).mul(1e16).toString(),
1177
- new Dec(180).mul(1e16).toString(),
1178
- new Dec(190).mul(1e16).toString(),
1179
- true, false,
1180
- ],
1181
- [
1182
- web3Utils.toChecksumAddress('0x1C0F620155e85491f8D35440eb17538Ca5c55212'),
1183
- web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address),
1184
- 160, 220, 180, 190,
1185
- true, false,
1186
- ]
1187
- ],
1188
- [
1189
- [
1190
- web3Utils.toChecksumAddress('0xaC0F620155e85491f8D35440eb17538Ca5c55212'),
1191
- web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address),
1192
- new Dec(160).mul(1e16).toString(),
1193
- new Dec(210).mul(1e16).toString(),
1194
- new Dec(180).mul(1e16).toString(),
1195
- new Dec(190).mul(1e16).toString(),
1196
- false, true,
1197
- ],
1198
- [
1199
- web3Utils.toChecksumAddress('0xaC0F620155e85491f8D35440eb17538Ca5c55212'),
1200
- web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address),
1201
- 160, 210, 180, 190,
1202
- false, true,
1203
- ]
1204
- ],
1205
- ];
1206
- examples.forEach(([expected, actual]) => {
1207
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1208
- expect(compoundV3Encode.leverageManagement(...actual)).to.eql(expected);
1209
- });
1210
- });
1211
- });
1212
1031
  describe('leverageManagementOnPrice()', () => {
1213
1032
  const examples: Array<[
1214
1033
  [StrategyOrBundleIds, boolean, TriggerData, SubData],
@@ -1396,53 +1215,6 @@ describe('Feature: strategySubService.ts', () => {
1396
1215
  });
1397
1216
  });
1398
1217
  });
1399
-
1400
- describe('limitOrder()', () => {
1401
- const examples: Array<[[EthereumAddress, EthereumAddress, string, string, string, string], [fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string | number, orderType: OrderType]]> = [
1402
- [
1403
- [
1404
- web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address),
1405
- web3Utils.toChecksumAddress(getAssetInfo('DAI', ChainId.Ethereum).address),
1406
- '2131',
1407
- '0.53123',
1408
- '1696590921159',
1409
- `${OrderType.STOP_LOSS}`
1410
- ],
1411
- [
1412
- web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address),
1413
- web3Utils.toChecksumAddress(getAssetInfo('DAI', ChainId.Ethereum).address),
1414
- '2131',
1415
- '0.53123',
1416
- 1696590921159,
1417
- OrderType.STOP_LOSS
1418
- ]
1419
- ],
1420
- [
1421
- [
1422
- web3Utils.toChecksumAddress(getAssetInfo('LINK', ChainId.Arbitrum).address),
1423
- web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Arbitrum).address),
1424
- '2131',
1425
- '0.43123',
1426
- '1646590921159',
1427
- `${OrderType.TAKE_PROFIT}`
1428
- ],
1429
- [
1430
- web3Utils.toChecksumAddress(getAssetInfo('LINK', ChainId.Arbitrum).address),
1431
- web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Arbitrum).address),
1432
- '2131',
1433
- '0.43123',
1434
- 1646590921159,
1435
- OrderType.TAKE_PROFIT
1436
- ]
1437
- ],
1438
- ];
1439
-
1440
- examples.forEach(([expected, actual]) => {
1441
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1442
- expect(exchangeEncode.limitOrder(...actual)).to.eql(expected);
1443
- });
1444
- });
1445
- });
1446
1218
  });
1447
1219
 
1448
1220
  describe('When testing strategySubService.crvUSDEncode', () => {
@@ -1701,58 +1473,7 @@ describe('Feature: strategySubService.ts', () => {
1701
1473
  });
1702
1474
  });
1703
1475
 
1704
- describe('When testing strategySubService.compoundV3L2Encode', () => {
1705
- describe('leverageManagement()', () => {
1706
- const examples: Array<[string, [EthereumAddress, EthereumAddress, number, number, number, number, boolean, boolean]]> = [
1707
- [
1708
- '0x0313D212133AFab8F2b829B1066c7e43caD94e2c0213D212133AfaB8F2b829B1066C7E43cAD94E2c000000000000000016345785d8a0000000000000000000001e87f85809dc0000000000000000000018fae27693b4000000000000000000001a5e27eef13e00000100',
1709
- [
1710
- web3Utils.toChecksumAddress('0x0313d212133AFaB8F2B829B1066c7E43cAd94E2c'),
1711
- web3Utils.toChecksumAddress('0x0213d212133AFaB8F2B829B1066c7E43cAd94E2c'),
1712
- 160, 220, 180, 190,
1713
- true,
1714
- false,
1715
- ],
1716
- ],
1717
- [
1718
- '0x0313D212133AFab8F2b829B1066c7e43caD94e2c0413d212133afAb8F2B829b1066C7e43cAd94e2c000000000000000016345785d8a0000000000000000000001e87f85809dc0000000000000000000018fae27693b4000000000000000000000f43fc2c04ee00000000',
1719
- [
1720
- web3Utils.toChecksumAddress('0x0313d212133AFaB8F2B829B1066c7E43cAd94E2c'),
1721
- web3Utils.toChecksumAddress('0x0413d212133AFaB8F2B829B1066c7E43cAd94E2c'),
1722
- 160, 220, 180, 110,
1723
- false,
1724
- false,
1725
- ],
1726
- ],
1727
- ];
1728
- examples.forEach(([expected, actual]) => {
1729
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1730
- expect(compoundV3L2Encode.leverageManagement(...actual)).to.eql(expected);
1731
- });
1732
- });
1733
- });
1734
- });
1735
-
1736
1476
  describe('When testing strategySubService.sparkEncode', () => {
1737
- describe('leverageManagement()', () => {
1738
- const examples: Array<[string, [number, number, number, number, boolean]]> = [
1739
- [
1740
- '0x0000000000000000136dcc951d8c00000000000000000000214e8348c4f0000000000000000000001d24b2dfac52000000000000000000001a5e27eef13e000001',
1741
- [140,240,210,190,true]
1742
- ],
1743
- [
1744
- '0x0000000000000000130337bdce49000000000000000000001988fe4052b800000000000000000000281b57b028e1000000000000000000002223acf76376000000',
1745
- [137, 184, 289, 246, false]
1746
- ]
1747
- ];
1748
-
1749
- examples.forEach(([expected, actual]) => {
1750
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1751
- expect(sparkEncode.leverageManagement(...actual)).to.eql(expected);
1752
- });
1753
- });
1754
- });
1755
-
1756
1477
  describe('leverageManagementOnPrice()', () => {
1757
1478
  const examples: Array<[[StrategyOrBundleIds, boolean, TriggerData, SubData],
1758
1479
  [