@defisaver/automation-sdk 3.3.21-instant-twap-close-dev → 3.3.21-npm-token-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.
@@ -2495,104 +2495,6 @@ describe('Feature: subDataService.ts', () => {
2495
2495
  });
2496
2496
  });
2497
2497
  });
2498
-
2499
- describe("When testing subDataService.aaveV3InstantCloseGenericSubData", () => {
2500
- const WETH = web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address);
2501
- const USDC = web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address);
2502
- const MARKET = web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39');
2503
- const USER = web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890');
2504
-
2505
- const examples: Array<
2506
- [
2507
- string[],
2508
- [
2509
- collAsset: EthereumAddress,
2510
- collAssetId: number,
2511
- debtAsset: EthereumAddress,
2512
- debtAssetId: number,
2513
- closeType: CloseStrategyType,
2514
- marketAddr: EthereumAddress,
2515
- user: EthereumAddress,
2516
- tsi: string,
2517
- slippage: string
2518
- ]
2519
- ]
2520
- > = [
2521
- // TAKE_PROFIT_IN_COLLATERAL, zero tsi and slippage
2522
- [
2523
- [
2524
- '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2525
- '0x0000000000000000000000000000000000000000000000000000000000000000',
2526
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
2527
- '0x0000000000000000000000000000000000000000000000000000000000000001',
2528
- '0x0000000000000000000000000000000000000000000000000000000000000000',
2529
- '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
2530
- '0x0000000000000000000000001234567890123456789012345678901234567890',
2531
- '0x0000000000000000000000000000000000000000000000000000000000000000',
2532
- '0x0000000000000000000000000000000000000000000000000000000000000000',
2533
- ],
2534
- [WETH, 0, USDC, 1, CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL, MARKET, USER, '0', '0'],
2535
- ],
2536
- // STOP_LOSS_IN_DEBT
2537
- [
2538
- [
2539
- '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2540
- '0x0000000000000000000000000000000000000000000000000000000000000000',
2541
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
2542
- '0x0000000000000000000000000000000000000000000000000000000000000001',
2543
- '0x0000000000000000000000000000000000000000000000000000000000000003',
2544
- '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
2545
- '0x0000000000000000000000001234567890123456789012345678901234567890',
2546
- '0x0000000000000000000000000000000000000000000000000de0b6b3a7640000',
2547
- '0x000000000000000000000000000000000000000000000000002386f26fc10000',
2548
- ],
2549
- [WETH, 0, USDC, 1, CloseStrategyType.STOP_LOSS_IN_DEBT, MARKET, USER, '1000000000000000000', '10000000000000000'],
2550
- ],
2551
- // TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL, asset ids above uint8 range
2552
- [
2553
- [
2554
- '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2555
- '0x000000000000000000000000000000000000000000000000000000000000012c',
2556
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
2557
- '0x0000000000000000000000000000000000000000000000000000000000000190',
2558
- '0x0000000000000000000000000000000000000000000000000000000000000007',
2559
- '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
2560
- '0x0000000000000000000000001234567890123456789012345678901234567890',
2561
- '0x00000000000000000000000000000000000000000000000000b1a2bc2ec50000',
2562
- '0x0000000000000000000000000000000000000000000000000011c37937e08000',
2563
- ],
2564
- [WETH, 300, USDC, 400, CloseStrategyType.TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL, MARKET, USER, '50000000000000000', '5000000000000000'],
2565
- ],
2566
- ];
2567
-
2568
- describe("encode()", () => {
2569
- examples.forEach(([expected, actual]) => {
2570
- it(`Given ${JSON.stringify(
2571
- actual
2572
- )} should return expected value: ${JSON.stringify(expected)}`, () => {
2573
- expect(
2574
- subDataService.aaveV3InstantCloseGenericSubData.encode(...actual)
2575
- ).to.eql(expected);
2576
- });
2577
- });
2578
- });
2579
-
2580
- describe("decode()", () => {
2581
- examples.forEach(([encoded, [collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, user, tsi, slippage]]) => {
2582
- const expected = {
2583
- collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, owner: user, tsi, slippage,
2584
- };
2585
-
2586
- it(`Given ${JSON.stringify(
2587
- encoded
2588
- )} should return expected value: ${JSON.stringify(expected)}`, () => {
2589
- expect(
2590
- subDataService.aaveV3InstantCloseGenericSubData.decode(encoded)
2591
- ).to.eql(expected);
2592
- });
2593
- });
2594
- });
2595
- });
2596
2498
  describe('When testing subDataService.sparkLeverageManagementOnPriceSubData', () => {
2597
2499
  describe('encode()', () => {
2598
2500
  const examples: Array<[SubData, [collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, marketAddr: EthereumAddress, targetRatio: number]] > =
@@ -687,67 +687,6 @@ export const aaveV3CloseGenericSubData = {
687
687
  };
688
688
  },
689
689
  };
690
- export const aaveV3InstantCloseGenericSubData = {
691
- encode(
692
- collAsset: EthereumAddress,
693
- collAssetId: number,
694
- debtAsset: EthereumAddress,
695
- debtAssetId: number,
696
- closeType: CloseStrategyType,
697
- marketAddr: EthereumAddress,
698
- user: EthereumAddress,
699
- tsi: string,
700
- slippage: string,
701
- ): SubData {
702
- const encodedColl = AbiCoder.encodeParameter('address', collAsset);
703
- const encodedCollId = AbiCoder.encodeParameter('uint16', collAssetId);
704
- const encodedDebt = AbiCoder.encodeParameter('address', debtAsset);
705
- const encodedDebtId = AbiCoder.encodeParameter('uint16', debtAssetId);
706
- const encodedCloseType = AbiCoder.encodeParameter('uint8', closeType);
707
- const encodedMarket = AbiCoder.encodeParameter('address', marketAddr);
708
- const encodedUser = AbiCoder.encodeParameter('address', user);
709
- const encodedTsi = AbiCoder.encodeParameter('uint256', tsi);
710
- const encodedSlippage = AbiCoder.encodeParameter('uint256', slippage);
711
-
712
- return [
713
- encodedColl,
714
- encodedCollId,
715
- encodedDebt,
716
- encodedDebtId,
717
- encodedCloseType,
718
- encodedMarket,
719
- encodedUser,
720
- encodedTsi,
721
- encodedSlippage,
722
- ];
723
- },
724
-
725
- decode(subData: SubData): {
726
- collAsset: EthereumAddress,
727
- collAssetId: number,
728
- debtAsset: EthereumAddress,
729
- debtAssetId: number,
730
- closeType: CloseStrategyType,
731
- marketAddr: EthereumAddress,
732
- owner: EthereumAddress,
733
- tsi: string,
734
- slippage: string,
735
- } {
736
- const collAsset = AbiCoder.decodeParameter('address', subData[0]) as unknown as EthereumAddress;
737
- const collAssetId = Number(AbiCoder.decodeParameter('uint16', subData[1]));
738
- const debtAsset = AbiCoder.decodeParameter('address', subData[2]) as unknown as EthereumAddress;
739
- const debtAssetId = Number(AbiCoder.decodeParameter('uint16', subData[3]));
740
- const closeType = Number(AbiCoder.decodeParameter('uint8', subData[4])) as CloseStrategyType;
741
- const marketAddr = AbiCoder.decodeParameter('address', subData[5]) as unknown as EthereumAddress;
742
- const owner = AbiCoder.decodeParameter('address', subData[6]) as unknown as EthereumAddress;
743
- const tsi = AbiCoder.decodeParameter('uint256', subData[7]) as unknown as string;
744
- const slippage = AbiCoder.decodeParameter('uint256', subData[8]) as unknown as string;
745
-
746
- return {
747
- collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, owner, tsi, slippage,
748
- };
749
- },
750
- };
751
690
  export const aaveV3CollateralSwitchSubData = {
752
691
  encode(
753
692
  fromAsset: EthereumAddress,
@@ -138,8 +138,6 @@ export namespace Strategies {
138
138
  CloseOnPriceToColl = 'close-on-price-to-collateral',
139
139
  CloseOnPrice = 'close-on-price',
140
140
  EoaCloseOnPrice = 'eoa-close-on-price',
141
- InstantCloseOnPrice = 'instant-close-on-price',
142
- EoaInstantCloseOnPrice = 'eoa-instant-close-on-price',
143
141
  TrailingStopToColl = 'trailing-stop-to-collateral',
144
142
  TrailingStopToDebt = 'trailing-stop-to-debt',
145
143
  Rebond = 'rebond',
@@ -268,8 +266,6 @@ export namespace Bundles {
268
266
  SPARK_EOA_BOOST_ON_PRICE = 91,
269
267
  SPARK_EOA_CLOSE = 92,
270
268
  SPARK_EOA_LIQUIDATION_PROTECTION = 93,
271
- AAVE_V3_SW_INSTANT_CLOSE = 94,
272
- AAVE_V3_EOA_INSTANT_CLOSE = 95,
273
269
  }
274
270
 
275
271
  export enum OptimismIds {