@defisaver/automation-sdk 3.3.18-audit-dev → 3.3.18-spark-eoa-v2-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.
@@ -656,6 +656,92 @@ describe('Feature: subDataService.ts', () => {
656
656
  });
657
657
  });
658
658
  });
659
+ describe('When testing subDataService.sparkGenericFLCollateralSwitchSubData', () => {
660
+ describe('encode()', () => {
661
+ const examples = [
662
+ [
663
+ [
664
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
665
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
666
+ '0x000000000000000000000000cbb7c0000ab88b473b1f5afd9ef808440eed33bf',
667
+ '0x0000000000000000000000000000000000000000000000000000000000000007',
668
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
669
+ '0x0000000000000000000000000000000000000000000000008ac7230489e80000',
670
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
671
+ ],
672
+ [
673
+ web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
674
+ 0,
675
+ web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('cbBTC', enums_1.ChainId.Ethereum).address),
676
+ 7,
677
+ web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
678
+ '10000000000000000000',
679
+ web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
680
+ ],
681
+ ],
682
+ ];
683
+ examples.forEach(([expected, actual]) => {
684
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
685
+ (0, chai_1.expect)(subDataService.sparkGenericFLCollateralSwitchSubData.encode(...actual)).to.eql(expected);
686
+ });
687
+ });
688
+ });
689
+ describe('decode()', () => {
690
+ const examples = [
691
+ [
692
+ {
693
+ fromAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
694
+ fromAssetId: 0,
695
+ toAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('cbBTC', enums_1.ChainId.Ethereum).address),
696
+ toAssetId: 7,
697
+ marketAddr: web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
698
+ amountToSwitch: '10000000000000000000',
699
+ user: web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
700
+ },
701
+ [
702
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
703
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
704
+ '0x000000000000000000000000cbb7c0000ab88b473b1f5afd9ef808440eed33bf',
705
+ '0x0000000000000000000000000000000000000000000000000000000000000007',
706
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
707
+ '0x0000000000000000000000000000000000000000000000008ac7230489e80000',
708
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
709
+ ],
710
+ ],
711
+ ];
712
+ examples.forEach(([expected, actual]) => {
713
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
714
+ (0, chai_1.expect)(subDataService.sparkGenericFLCollateralSwitchSubData.decode(actual)).to.eql(expected);
715
+ });
716
+ });
717
+ });
718
+ });
719
+ describe('When testing subDataService.compoundV2LeverageManagementSubData', () => {
720
+ describe('encode()', () => {
721
+ const examples = [
722
+ [
723
+ [
724
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
725
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
726
+ ],
727
+ [180, enums_1.RatioState.UNDER],
728
+ ],
729
+ [
730
+ [
731
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
732
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
733
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
734
+ ],
735
+ [160, enums_1.RatioState.OVER],
736
+ ],
737
+ ];
738
+ examples.forEach(([expected, actual]) => {
739
+ it(`Given ${actual} should return expected value: ${expected}`, () => {
740
+ (0, chai_1.expect)(subDataService.compoundV2LeverageManagementSubData.encode(...actual)).to.eql(expected);
741
+ });
742
+ });
743
+ });
744
+ });
659
745
  describe('When testing subDataService.legacyCompoundV2LeverageManagementSubData', () => {
660
746
  describe('decode()', () => {
661
747
  const examples = [
@@ -874,16 +960,72 @@ describe('Feature: subDataService.ts', () => {
874
960
  });
875
961
  });
876
962
  });
963
+ describe('When testing subDataService.sparkLeverageManagementSubData', () => {
964
+ describe('encode()', () => {
965
+ const examples = [
966
+ [
967
+ [
968
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
969
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
970
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
971
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
972
+ ],
973
+ [180, enums_1.RatioState.UNDER],
974
+ ],
975
+ [
976
+ [
977
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
978
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
979
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
980
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
981
+ ],
982
+ [160, enums_1.RatioState.OVER],
983
+ ],
984
+ ];
985
+ examples.forEach(([expected, actual]) => {
986
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
987
+ (0, chai_1.expect)(subDataService.sparkLeverageManagementSubData.encode(...actual)).to.eql(expected);
988
+ });
989
+ });
990
+ });
991
+ describe('decode()', () => {
992
+ const examples = [
993
+ [
994
+ { targetRatio: 180, ratioState: '1' },
995
+ [
996
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
997
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
998
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
999
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1000
+ ],
1001
+ ],
1002
+ [
1003
+ { targetRatio: 160, ratioState: '0' },
1004
+ [
1005
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
1006
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1007
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
1008
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1009
+ ],
1010
+ ],
1011
+ ];
1012
+ examples.forEach(([expected, actual]) => {
1013
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
1014
+ (0, chai_1.expect)(subDataService.sparkLeverageManagementSubData.decode(actual)).to.eql(expected);
1015
+ });
1016
+ });
1017
+ });
1018
+ });
877
1019
  describe('When testing subDataService.legacySparkLeverageManagementSubData', () => {
878
1020
  describe('decode()', () => {
879
1021
  const examples = [
880
1022
  [
881
- { targetRatio: 200 },
882
- ['0x0000000000000000000000000000000000000000000000001bc16d674ec80000'],
1023
+ { targetRatio: 180 },
1024
+ ['0x00000000000000000000000000000000000000000000000018fae27693b40000'],
883
1025
  ],
884
1026
  [
885
- { targetRatio: 123 },
886
- ['0x0000000000000000000000000000000000000000000000001111d67bb1bb0000'],
1027
+ { targetRatio: 160 },
1028
+ ['0x00000000000000000000000000000000000000000000000016345785d8a00000'],
887
1029
  ],
888
1030
  ];
889
1031
  examples.forEach(([expected, actual]) => {
@@ -893,6 +1035,62 @@ describe('Feature: subDataService.ts', () => {
893
1035
  });
894
1036
  });
895
1037
  });
1038
+ describe('When testing subDataService.sparkLiquidationProtectionSubData', () => {
1039
+ describe('encode()', () => {
1040
+ const examples = [
1041
+ [
1042
+ [
1043
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
1044
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
1045
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
1046
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1047
+ ],
1048
+ [180, enums_1.RatioState.UNDER],
1049
+ ],
1050
+ [
1051
+ [
1052
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
1053
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1054
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
1055
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1056
+ ],
1057
+ [160, enums_1.RatioState.OVER],
1058
+ ],
1059
+ ];
1060
+ examples.forEach(([expected, actual]) => {
1061
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
1062
+ (0, chai_1.expect)(subDataService.sparkLiquidationProtectionSubData.encode(...actual)).to.eql(expected);
1063
+ });
1064
+ });
1065
+ });
1066
+ describe('decode()', () => {
1067
+ const examples = [
1068
+ [
1069
+ { targetRatio: 180, ratioState: '1' },
1070
+ [
1071
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
1072
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
1073
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
1074
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1075
+ ],
1076
+ ],
1077
+ [
1078
+ { targetRatio: 160, ratioState: '0' },
1079
+ [
1080
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
1081
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1082
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
1083
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1084
+ ],
1085
+ ],
1086
+ ];
1087
+ examples.forEach(([expected, actual]) => {
1088
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
1089
+ (0, chai_1.expect)(subDataService.sparkLiquidationProtectionSubData.decode(actual)).to.eql(expected);
1090
+ });
1091
+ });
1092
+ });
1093
+ });
896
1094
  describe('When testing subDataService.liquityDsrPaybackSubData', () => {
897
1095
  describe('encode()', () => {
898
1096
  const examples = [
@@ -2140,6 +2338,298 @@ describe('Feature: subDataService.ts', () => {
2140
2338
  });
2141
2339
  });
2142
2340
  });
2341
+ describe('When testing subDataService.sparkCloseGenericSubData', () => {
2342
+ describe('encode()', () => {
2343
+ const examples = [
2344
+ [
2345
+ [
2346
+ '0x0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599',
2347
+ '0x0000000000000000000000000000000000000000000000000000000000000002',
2348
+ '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
2349
+ '0x0000000000000000000000000000000000000000000000000000000000000004',
2350
+ '0x0000000000000000000000000000000000000000000000000000000000000005',
2351
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2352
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2353
+ ],
2354
+ [
2355
+ web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WBTC', enums_1.ChainId.Ethereum).address),
2356
+ 2,
2357
+ web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
2358
+ 4,
2359
+ enums_1.CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL_AND_STOP_LOSS_IN_DEBT,
2360
+ web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2361
+ web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2362
+ ],
2363
+ ],
2364
+ ];
2365
+ examples.forEach(([expected, actual]) => {
2366
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2367
+ (0, chai_1.expect)(subDataService.sparkCloseGenericSubData.encode(...actual)).to.eql(expected);
2368
+ });
2369
+ });
2370
+ });
2371
+ describe('decode()', () => {
2372
+ const examples = [
2373
+ [
2374
+ {
2375
+ collAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WBTC', enums_1.ChainId.Ethereum).address),
2376
+ collAssetId: 2,
2377
+ debtAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
2378
+ debtAssetId: 4,
2379
+ closeType: enums_1.CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL_AND_STOP_LOSS_IN_DEBT,
2380
+ marketAddr: web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2381
+ owner: web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2382
+ },
2383
+ [
2384
+ '0x0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599',
2385
+ '0x0000000000000000000000000000000000000000000000000000000000000002',
2386
+ '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
2387
+ '0x0000000000000000000000000000000000000000000000000000000000000004',
2388
+ '0x0000000000000000000000000000000000000000000000000000000000000005',
2389
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2390
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2391
+ ],
2392
+ ],
2393
+ ];
2394
+ examples.forEach(([expected, actual]) => {
2395
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2396
+ (0, chai_1.expect)(subDataService.sparkCloseGenericSubData.decode(actual)).to.eql(expected);
2397
+ });
2398
+ });
2399
+ });
2400
+ });
2401
+ describe('When testing subDataService.sparkGenericLeverageManagementSubData', () => {
2402
+ describe('encode()', () => {
2403
+ const examples = [
2404
+ [
2405
+ [
2406
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
2407
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
2408
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2409
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2410
+ ],
2411
+ [
2412
+ 180,
2413
+ enums_1.RatioState.UNDER,
2414
+ web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2415
+ web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2416
+ ],
2417
+ ],
2418
+ [
2419
+ [
2420
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
2421
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2422
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2423
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2424
+ ],
2425
+ [
2426
+ 160,
2427
+ enums_1.RatioState.OVER,
2428
+ web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2429
+ web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2430
+ ],
2431
+ ],
2432
+ ];
2433
+ examples.forEach(([expected, actual]) => {
2434
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2435
+ (0, chai_1.expect)(subDataService.sparkGenericLeverageManagementSubData.encode(...actual)).to.eql(expected);
2436
+ });
2437
+ });
2438
+ });
2439
+ describe('decode()', () => {
2440
+ const examples = [
2441
+ [
2442
+ { targetRatio: 180, ratioState: enums_1.RatioState.UNDER },
2443
+ [
2444
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
2445
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
2446
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2447
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2448
+ ],
2449
+ ],
2450
+ [
2451
+ { targetRatio: 160, ratioState: enums_1.RatioState.OVER },
2452
+ [
2453
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
2454
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2455
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2456
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2457
+ ],
2458
+ ],
2459
+ ];
2460
+ examples.forEach(([expected, actual]) => {
2461
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2462
+ (0, chai_1.expect)(subDataService.sparkGenericLeverageManagementSubData.decode(actual)).to.eql(expected);
2463
+ });
2464
+ });
2465
+ });
2466
+ });
2467
+ describe('When testing subDataService.sparkGenericLiquidationProtectionSubData', () => {
2468
+ describe('encode()', () => {
2469
+ const examples = [
2470
+ [
2471
+ [
2472
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
2473
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
2474
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2475
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2476
+ ],
2477
+ [
2478
+ 180,
2479
+ enums_1.RatioState.UNDER,
2480
+ web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2481
+ web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2482
+ ],
2483
+ ],
2484
+ [
2485
+ [
2486
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
2487
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2488
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2489
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2490
+ ],
2491
+ [
2492
+ 160,
2493
+ enums_1.RatioState.OVER,
2494
+ web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2495
+ web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2496
+ ],
2497
+ ],
2498
+ ];
2499
+ examples.forEach(([expected, actual]) => {
2500
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2501
+ (0, chai_1.expect)(subDataService.sparkGenericLiquidationProtectionSubData.encode(...actual)).to.eql(expected);
2502
+ });
2503
+ });
2504
+ });
2505
+ describe('decode()', () => {
2506
+ const examples = [
2507
+ [
2508
+ { targetRatio: 180, ratioState: enums_1.RatioState.UNDER },
2509
+ [
2510
+ '0x00000000000000000000000000000000000000000000000018fae27693b40000',
2511
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
2512
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2513
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2514
+ ],
2515
+ ],
2516
+ [
2517
+ { targetRatio: 160, ratioState: enums_1.RatioState.OVER },
2518
+ [
2519
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
2520
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2521
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2522
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2523
+ ],
2524
+ ],
2525
+ ];
2526
+ examples.forEach(([expected, actual]) => {
2527
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2528
+ (0, chai_1.expect)(subDataService.sparkGenericLiquidationProtectionSubData.decode(actual)).to.eql(expected);
2529
+ });
2530
+ });
2531
+ });
2532
+ });
2533
+ describe('When testing subDataService.sparkLeverageManagementOnPriceGenericSubData', () => {
2534
+ describe('encode()', () => {
2535
+ const examples = [
2536
+ [
2537
+ [
2538
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2539
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2540
+ '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
2541
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
2542
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2543
+ '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
2544
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2545
+ ],
2546
+ [
2547
+ web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
2548
+ 0,
2549
+ web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
2550
+ 1,
2551
+ web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2552
+ 200,
2553
+ web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2554
+ ],
2555
+ ],
2556
+ [
2557
+ [
2558
+ '0x0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599',
2559
+ '0x0000000000000000000000000000000000000000000000000000000000000002',
2560
+ '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
2561
+ '0x0000000000000000000000000000000000000000000000000000000000000004',
2562
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2563
+ '0x00000000000000000000000000000000000000000000000022b1c8c1227a0000',
2564
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2565
+ ],
2566
+ [
2567
+ web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WBTC', enums_1.ChainId.Ethereum).address),
2568
+ 2,
2569
+ web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
2570
+ 4,
2571
+ web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2572
+ 250,
2573
+ web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2574
+ ],
2575
+ ],
2576
+ ];
2577
+ examples.forEach(([expected, actual]) => {
2578
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2579
+ (0, chai_1.expect)(subDataService.sparkLeverageManagementOnPriceGenericSubData.encode(...actual)).to.eql(expected);
2580
+ });
2581
+ });
2582
+ });
2583
+ describe('decode()', () => {
2584
+ const examples = [
2585
+ [
2586
+ {
2587
+ collAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
2588
+ collAssetId: 0,
2589
+ debtAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
2590
+ debtAssetId: 1,
2591
+ marketAddr: web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2592
+ targetRatio: 200,
2593
+ user: web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2594
+ },
2595
+ [
2596
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2597
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2598
+ '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
2599
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
2600
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2601
+ '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
2602
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2603
+ ],
2604
+ ],
2605
+ [
2606
+ {
2607
+ collAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WBTC', enums_1.ChainId.Ethereum).address),
2608
+ collAssetId: 2,
2609
+ debtAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
2610
+ debtAssetId: 4,
2611
+ marketAddr: web3Utils.toChecksumAddress('0x02C3eA4e34C0cBd694D2adFa2c690EECbC1793eE'),
2612
+ targetRatio: 250,
2613
+ user: web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
2614
+ },
2615
+ [
2616
+ '0x0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599',
2617
+ '0x0000000000000000000000000000000000000000000000000000000000000002',
2618
+ '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
2619
+ '0x0000000000000000000000000000000000000000000000000000000000000004',
2620
+ '0x00000000000000000000000002c3ea4e34c0cbd694d2adfa2c690eecbc1793ee',
2621
+ '0x00000000000000000000000000000000000000000000000022b1c8c1227a0000',
2622
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2623
+ ],
2624
+ ],
2625
+ ];
2626
+ examples.forEach(([expected, actual]) => {
2627
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2628
+ (0, chai_1.expect)(subDataService.sparkLeverageManagementOnPriceGenericSubData.decode(actual)).to.eql(expected);
2629
+ });
2630
+ });
2631
+ });
2632
+ });
2143
2633
  describe('When testing subDataService.aaveV4LeverageManagementSubData', () => {
2144
2634
  describe('encode()', () => {
2145
2635
  const examples = [
@@ -90,7 +90,8 @@ export declare namespace Strategies {
90
90
  AAVE_V3_COLLATERAL_SWITCH = 135,
91
91
  AAVE_V4_COLLATERAL_SWITCH = 154,
92
92
  AAVE_V4_COLLATERAL_SWITCH_EOA = 155,
93
- SPARK_COLLATERAL_SWITCH = 156
93
+ SPARK_COLLATERAL_SWITCH = 156,
94
+ SPARK_GENERIC_FL_COLLATERAL_SWITCH = 167
94
95
  }
95
96
  enum OptimismIds {
96
97
  EXCHANGE_DCA = 8,
@@ -243,7 +244,13 @@ export declare namespace Bundles {
243
244
  MORPHO_BLUE_REPAY_ON_PRICE = 84,
244
245
  MORPHO_BLUE_EOA_BOOST_ON_PRICE = 85,
245
246
  MORPHO_BLUE_EOA_REPAY_ON_PRICE = 86,
246
- MORPHO_BLUE_EOA_CLOSE = 87
247
+ MORPHO_BLUE_EOA_CLOSE = 87,
248
+ SPARK_EOA_REPAY = 88,
249
+ SPARK_EOA_BOOST = 89,
250
+ SPARK_EOA_REPAY_ON_PRICE = 90,
251
+ SPARK_EOA_BOOST_ON_PRICE = 91,
252
+ SPARK_EOA_CLOSE = 92,
253
+ SPARK_EOA_LIQUIDATION_PROTECTION = 93
247
254
  }
248
255
  enum OptimismIds {
249
256
  AAVE_V3_REPAY = 0,
@@ -107,6 +107,7 @@ var Strategies;
107
107
  MainnetIds[MainnetIds["AAVE_V4_COLLATERAL_SWITCH"] = 154] = "AAVE_V4_COLLATERAL_SWITCH";
108
108
  MainnetIds[MainnetIds["AAVE_V4_COLLATERAL_SWITCH_EOA"] = 155] = "AAVE_V4_COLLATERAL_SWITCH_EOA";
109
109
  MainnetIds[MainnetIds["SPARK_COLLATERAL_SWITCH"] = 156] = "SPARK_COLLATERAL_SWITCH";
110
+ MainnetIds[MainnetIds["SPARK_GENERIC_FL_COLLATERAL_SWITCH"] = 167] = "SPARK_GENERIC_FL_COLLATERAL_SWITCH";
110
111
  })(MainnetIds = Strategies.MainnetIds || (Strategies.MainnetIds = {}));
111
112
  let OptimismIds;
112
113
  (function (OptimismIds) {
@@ -267,6 +268,12 @@ var Bundles;
267
268
  MainnetIds[MainnetIds["MORPHO_BLUE_EOA_BOOST_ON_PRICE"] = 85] = "MORPHO_BLUE_EOA_BOOST_ON_PRICE";
268
269
  MainnetIds[MainnetIds["MORPHO_BLUE_EOA_REPAY_ON_PRICE"] = 86] = "MORPHO_BLUE_EOA_REPAY_ON_PRICE";
269
270
  MainnetIds[MainnetIds["MORPHO_BLUE_EOA_CLOSE"] = 87] = "MORPHO_BLUE_EOA_CLOSE";
271
+ MainnetIds[MainnetIds["SPARK_EOA_REPAY"] = 88] = "SPARK_EOA_REPAY";
272
+ MainnetIds[MainnetIds["SPARK_EOA_BOOST"] = 89] = "SPARK_EOA_BOOST";
273
+ MainnetIds[MainnetIds["SPARK_EOA_REPAY_ON_PRICE"] = 90] = "SPARK_EOA_REPAY_ON_PRICE";
274
+ MainnetIds[MainnetIds["SPARK_EOA_BOOST_ON_PRICE"] = 91] = "SPARK_EOA_BOOST_ON_PRICE";
275
+ MainnetIds[MainnetIds["SPARK_EOA_CLOSE"] = 92] = "SPARK_EOA_CLOSE";
276
+ MainnetIds[MainnetIds["SPARK_EOA_LIQUIDATION_PROTECTION"] = 93] = "SPARK_EOA_LIQUIDATION_PROTECTION";
270
277
  })(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
271
278
  let OptimismIds;
272
279
  (function (OptimismIds) {
@@ -116,6 +116,11 @@ export const MAINNET_STRATEGIES_INFO = {
116
116
  strategyId: Strategies.Identifiers.CollateralSwitch,
117
117
  protocol: PROTOCOLS.Spark,
118
118
  },
119
+ [Strategies.MainnetIds.SPARK_GENERIC_FL_COLLATERAL_SWITCH]: {
120
+ strategyOrBundleId: Strategies.MainnetIds.SPARK_GENERIC_FL_COLLATERAL_SWITCH,
121
+ strategyId: Strategies.Identifiers.EoaCollateralSwitch,
122
+ protocol: PROTOCOLS.Spark,
123
+ },
119
124
  };
120
125
  export const OPTIMISM_STRATEGIES_INFO = {
121
126
  [Strategies.OptimismIds.EXCHANGE_DCA]: {
@@ -543,6 +548,31 @@ export const MAINNET_BUNDLES_INFO = {
543
548
  strategyId: Strategies.Identifiers.EoaCloseOnPrice,
544
549
  protocol: PROTOCOLS.AaveV4,
545
550
  },
551
+ [Bundles.MainnetIds.SPARK_EOA_REPAY]: {
552
+ strategyOrBundleId: Bundles.MainnetIds.SPARK_EOA_REPAY,
553
+ strategyId: Strategies.Identifiers.EoaRepay,
554
+ protocol: PROTOCOLS.Spark,
555
+ },
556
+ [Bundles.MainnetIds.SPARK_EOA_BOOST]: {
557
+ strategyOrBundleId: Bundles.MainnetIds.SPARK_EOA_BOOST,
558
+ strategyId: Strategies.Identifiers.EoaBoost,
559
+ protocol: PROTOCOLS.Spark,
560
+ },
561
+ [Bundles.MainnetIds.SPARK_EOA_CLOSE]: {
562
+ strategyOrBundleId: Bundles.MainnetIds.SPARK_EOA_CLOSE,
563
+ strategyId: Strategies.Identifiers.EoaCloseOnPrice,
564
+ protocol: PROTOCOLS.Spark,
565
+ },
566
+ [Bundles.MainnetIds.SPARK_EOA_REPAY_ON_PRICE]: {
567
+ strategyOrBundleId: Bundles.MainnetIds.SPARK_EOA_REPAY_ON_PRICE,
568
+ strategyId: Strategies.Identifiers.EoaRepayOnPrice,
569
+ protocol: PROTOCOLS.Spark,
570
+ },
571
+ [Bundles.MainnetIds.SPARK_EOA_BOOST_ON_PRICE]: {
572
+ strategyOrBundleId: Bundles.MainnetIds.SPARK_EOA_BOOST_ON_PRICE,
573
+ strategyId: Strategies.Identifiers.EoaBoostOnPrice,
574
+ protocol: PROTOCOLS.Spark,
575
+ },
546
576
  [Bundles.MainnetIds.MAKER_SW_LIQUIDATION_PROTECTION]: {
547
577
  strategyOrBundleId: Bundles.MainnetIds.MAKER_SW_LIQUIDATION_PROTECTION,
548
578
  strategyId: Strategies.Identifiers.LiquidationProtection,
@@ -618,6 +648,11 @@ export const MAINNET_BUNDLES_INFO = {
618
648
  strategyId: Strategies.Identifiers.EoaCloseOnPrice,
619
649
  protocol: PROTOCOLS.MorphoBlue,
620
650
  },
651
+ [Bundles.MainnetIds.SPARK_EOA_LIQUIDATION_PROTECTION]: {
652
+ strategyOrBundleId: Bundles.MainnetIds.SPARK_EOA_LIQUIDATION_PROTECTION,
653
+ strategyId: Strategies.Identifiers.EoaLiquidationProtection,
654
+ protocol: PROTOCOLS.Spark,
655
+ },
621
656
  };
622
657
  export const OPTIMISM_BUNDLES_INFO = {
623
658
  [Bundles.OptimismIds.AAVE_V3_REPAY]: {