@defisaver/automation-sdk 3.3.21-coll-switch-generic-dev → 3.3.21-instant-twap-close-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.
@@ -511,78 +511,53 @@ export const aaveV3CloseGenericSubData = {
511
511
  };
512
512
  },
513
513
  };
514
- export const aaveV3CollateralSwitchSubData = {
515
- encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, useOnBehalf = false) {
516
- const encodedFromAsset = AbiCoder.encodeParameter('address', fromAsset);
517
- const encodedFromAssetId = AbiCoder.encodeParameter('uint8', fromAssetId);
518
- const encodedToAsset = AbiCoder.encodeParameter('address', toAsset);
519
- const encodedToAssetId = AbiCoder.encodeParameter('uint8', toAssetId);
520
- const encodedMarketAddr = AbiCoder.encodeParameter('address', marketAddr);
521
- const encodedAmountToSwitch = AbiCoder.encodeParameter('uint256', amountToSwitch);
522
- const encodedUseOnBehalf = AbiCoder.encodeParameter('bool', useOnBehalf);
523
- return [
524
- encodedFromAsset,
525
- encodedFromAssetId,
526
- encodedToAsset,
527
- encodedToAssetId,
528
- encodedMarketAddr,
529
- encodedAmountToSwitch,
530
- encodedUseOnBehalf,
531
- ];
532
- },
533
- decode(subData) {
534
- const fromAsset = AbiCoder.decodeParameter('address', subData[0]);
535
- const fromAssetId = Number(AbiCoder.decodeParameter('uint8', subData[1]));
536
- const toAsset = AbiCoder.decodeParameter('address', subData[2]);
537
- const toAssetId = Number(AbiCoder.decodeParameter('uint8', subData[3]));
538
- const marketAddr = AbiCoder.decodeParameter('address', subData[4]);
539
- const amountToSwitch = AbiCoder.decodeParameter('uint256', subData[5]);
540
- return {
541
- fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
542
- };
543
- },
544
- };
545
- export const aaveV3GenericFLCollateralSwitchSubData = {
546
- encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, user) {
547
- const encodedFromAsset = AbiCoder.encodeParameter('address', fromAsset);
548
- const encodedFromAssetId = AbiCoder.encodeParameter('uint16', fromAssetId);
549
- const encodedToAsset = AbiCoder.encodeParameter('address', toAsset);
550
- const encodedToAssetId = AbiCoder.encodeParameter('uint16', toAssetId);
551
- const encodedMarketAddr = AbiCoder.encodeParameter('address', marketAddr);
552
- const encodedAmountToSwitch = AbiCoder.encodeParameter('uint256', amountToSwitch);
514
+ export const aaveV3InstantCloseGenericSubData = {
515
+ encode(collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, user, tsi, slippage) {
516
+ const encodedColl = AbiCoder.encodeParameter('address', collAsset);
517
+ const encodedCollId = AbiCoder.encodeParameter('uint16', collAssetId);
518
+ const encodedDebt = AbiCoder.encodeParameter('address', debtAsset);
519
+ const encodedDebtId = AbiCoder.encodeParameter('uint16', debtAssetId);
520
+ const encodedCloseType = AbiCoder.encodeParameter('uint8', closeType);
521
+ const encodedMarket = AbiCoder.encodeParameter('address', marketAddr);
553
522
  const encodedUser = AbiCoder.encodeParameter('address', user);
523
+ const encodedTsi = AbiCoder.encodeParameter('uint256', tsi);
524
+ const encodedSlippage = AbiCoder.encodeParameter('uint256', slippage);
554
525
  return [
555
- encodedFromAsset,
556
- encodedFromAssetId,
557
- encodedToAsset,
558
- encodedToAssetId,
559
- encodedMarketAddr,
560
- encodedAmountToSwitch,
526
+ encodedColl,
527
+ encodedCollId,
528
+ encodedDebt,
529
+ encodedDebtId,
530
+ encodedCloseType,
531
+ encodedMarket,
561
532
  encodedUser,
533
+ encodedTsi,
534
+ encodedSlippage,
562
535
  ];
563
536
  },
564
537
  decode(subData) {
565
- const fromAsset = AbiCoder.decodeParameter('address', subData[0]);
566
- const fromAssetId = Number(AbiCoder.decodeParameter('uint16', subData[1]));
567
- const toAsset = AbiCoder.decodeParameter('address', subData[2]);
568
- const toAssetId = Number(AbiCoder.decodeParameter('uint16', subData[3]));
569
- const marketAddr = AbiCoder.decodeParameter('address', subData[4]);
570
- const amountToSwitch = AbiCoder.decodeParameter('uint256', subData[5]);
571
- const user = AbiCoder.decodeParameter('address', subData[6]);
538
+ const collAsset = AbiCoder.decodeParameter('address', subData[0]);
539
+ const collAssetId = Number(AbiCoder.decodeParameter('uint16', subData[1]));
540
+ const debtAsset = AbiCoder.decodeParameter('address', subData[2]);
541
+ const debtAssetId = Number(AbiCoder.decodeParameter('uint16', subData[3]));
542
+ const closeType = Number(AbiCoder.decodeParameter('uint8', subData[4]));
543
+ const marketAddr = AbiCoder.decodeParameter('address', subData[5]);
544
+ const owner = AbiCoder.decodeParameter('address', subData[6]);
545
+ const tsi = AbiCoder.decodeParameter('uint256', subData[7]);
546
+ const slippage = AbiCoder.decodeParameter('uint256', subData[8]);
572
547
  return {
573
- fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, user,
548
+ collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, owner, tsi, slippage,
574
549
  };
575
550
  },
576
551
  };
577
- export const aaveV3DebtSwitchSubData = {
578
- encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, user) {
552
+ export const aaveV3CollateralSwitchSubData = {
553
+ encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, useOnBehalf = false) {
579
554
  const encodedFromAsset = AbiCoder.encodeParameter('address', fromAsset);
580
555
  const encodedFromAssetId = AbiCoder.encodeParameter('uint8', fromAssetId);
581
556
  const encodedToAsset = AbiCoder.encodeParameter('address', toAsset);
582
557
  const encodedToAssetId = AbiCoder.encodeParameter('uint8', toAssetId);
583
558
  const encodedMarketAddr = AbiCoder.encodeParameter('address', marketAddr);
584
559
  const encodedAmountToSwitch = AbiCoder.encodeParameter('uint256', amountToSwitch);
585
- const encodedUser = AbiCoder.encodeParameter('address', user);
560
+ const encodedUseOnBehalf = AbiCoder.encodeParameter('bool', useOnBehalf);
586
561
  return [
587
562
  encodedFromAsset,
588
563
  encodedFromAssetId,
@@ -590,7 +565,7 @@ export const aaveV3DebtSwitchSubData = {
590
565
  encodedToAssetId,
591
566
  encodedMarketAddr,
592
567
  encodedAmountToSwitch,
593
- encodedUser,
568
+ encodedUseOnBehalf,
594
569
  ];
595
570
  },
596
571
  decode(subData) {
@@ -600,9 +575,8 @@ export const aaveV3DebtSwitchSubData = {
600
575
  const toAssetId = Number(AbiCoder.decodeParameter('uint8', subData[3]));
601
576
  const marketAddr = AbiCoder.decodeParameter('address', subData[4]);
602
577
  const amountToSwitch = AbiCoder.decodeParameter('uint256', subData[5]);
603
- const user = AbiCoder.decodeParameter('address', subData[6]);
604
578
  return {
605
- fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, user,
579
+ fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
606
580
  };
607
581
  },
608
582
  };
@@ -510,145 +510,6 @@ describe('Feature: subDataService.ts', () => {
510
510
  });
511
511
  });
512
512
  });
513
- describe('When testing subDataService.aaveV3DebtSwitchSubData', () => {
514
- describe('encode()', () => {
515
- const examples = [
516
- // USDC -> DAI
517
- [
518
- [
519
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
520
- '0x0000000000000000000000000000000000000000000000000000000000000001',
521
- '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
522
- '0x0000000000000000000000000000000000000000000000000000000000000003',
523
- '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
524
- '0x0000000000000000000000000000000000000000000000008ac7230489e80000',
525
- '0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
526
- ],
527
- [
528
- web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address),
529
- 1,
530
- web3Utils.toChecksumAddress(getAssetInfo('DAI', ChainId.Ethereum).address),
531
- 3,
532
- web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
533
- '10000000000000000000',
534
- web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
535
- ]
536
- ],
537
- // DAI -> USDC (MaxUint256)
538
- [
539
- [
540
- '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
541
- '0x0000000000000000000000000000000000000000000000000000000000000003',
542
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
543
- '0x0000000000000000000000000000000000000000000000000000000000000001',
544
- '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
545
- '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
546
- '0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
547
- ],
548
- [
549
- web3Utils.toChecksumAddress(getAssetInfo('DAI', ChainId.Ethereum).address),
550
- 3,
551
- web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address),
552
- 1,
553
- web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
554
- MAXUINT,
555
- web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
556
- ]
557
- ],
558
- ];
559
- examples.forEach(([expected, actual]) => {
560
- it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
561
- expect(subDataService.aaveV3DebtSwitchSubData.encode(...actual)).to.eql(expected);
562
- });
563
- });
564
- });
565
- describe('decode()', () => {
566
- const examples = [
567
- // USDC -> DAI
568
- [
569
- {
570
- fromAsset: web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address),
571
- fromAssetId: 1,
572
- toAsset: web3Utils.toChecksumAddress(getAssetInfo('DAI', ChainId.Ethereum).address),
573
- toAssetId: 3,
574
- marketAddr: web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
575
- amountToSwitch: '10000000000000000000',
576
- user: web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
577
- },
578
- [
579
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
580
- '0x0000000000000000000000000000000000000000000000000000000000000001',
581
- '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
582
- '0x0000000000000000000000000000000000000000000000000000000000000003',
583
- '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
584
- '0x0000000000000000000000000000000000000000000000008ac7230489e80000',
585
- '0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
586
- ],
587
- ],
588
- // DAI -> USDC (MaxUint256)
589
- [
590
- {
591
- fromAsset: web3Utils.toChecksumAddress(getAssetInfo('DAI', ChainId.Ethereum).address),
592
- fromAssetId: 3,
593
- toAsset: web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address),
594
- toAssetId: 1,
595
- marketAddr: web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
596
- amountToSwitch: MAXUINT,
597
- user: web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
598
- },
599
- [
600
- '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
601
- '0x0000000000000000000000000000000000000000000000000000000000000003',
602
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
603
- '0x0000000000000000000000000000000000000000000000000000000000000001',
604
- '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
605
- '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
606
- '0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
607
- ],
608
- ],
609
- ];
610
- examples.forEach(([expected, actual]) => {
611
- it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
612
- expect(subDataService.aaveV3DebtSwitchSubData.decode(actual)).to.eql(expected);
613
- });
614
- });
615
- });
616
- });
617
- describe('When testing subDataService.aaveV3GenericFLCollateralSwitchSubData', () => {
618
- const fromAsset = web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address);
619
- const toAsset = web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address);
620
- const marketAddr = web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39');
621
- const user = web3Utils.toChecksumAddress('0x1234567890abcdef1234567890abcdef12345678');
622
- const examples = [
623
- ['10000000000000000000', '0x0000000000000000000000000000000000000000000000008ac7230489e80000'],
624
- [MAXUINT, '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'],
625
- ];
626
- examples.forEach(([amountToSwitch, encodedAmount]) => {
627
- const subData = [
628
- '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
629
- '0x0000000000000000000000000000000000000000000000000000000000000100',
630
- '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
631
- '0x000000000000000000000000000000000000000000000000000000000000ffff',
632
- '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
633
- encodedAmount,
634
- '0x0000000000000000000000001234567890abcdef1234567890abcdef12345678',
635
- ];
636
- it(`encode() preserves uint16 asset IDs and user when switching ${amountToSwitch}`, () => {
637
- expect(subDataService.aaveV3GenericFLCollateralSwitchSubData.encode(fromAsset, 256, toAsset, 65535, marketAddr, amountToSwitch, user)).to.eql(subData);
638
- });
639
- it(`decode() preserves uint16 asset IDs and user when switching ${amountToSwitch}`, () => {
640
- expect(subDataService.aaveV3GenericFLCollateralSwitchSubData.decode(subData)).to.eql({
641
- fromAsset,
642
- fromAssetId: 256,
643
- toAsset,
644
- toAssetId: 65535,
645
- marketAddr,
646
- amountToSwitch,
647
- user,
648
- });
649
- });
650
- });
651
- });
652
513
  describe('When testing subDataService.sparkCollateralSwitchSubData', () => {
653
514
  describe('encode()', () => {
654
515
  const examples = [
@@ -2395,6 +2256,76 @@ describe('Feature: subDataService.ts', () => {
2395
2256
  });
2396
2257
  });
2397
2258
  });
2259
+ describe("When testing subDataService.aaveV3InstantCloseGenericSubData", () => {
2260
+ const WETH = web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address);
2261
+ const USDC = web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address);
2262
+ const MARKET = web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39');
2263
+ const USER = web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890');
2264
+ const examples = [
2265
+ // TAKE_PROFIT_IN_COLLATERAL, zero tsi and slippage
2266
+ [
2267
+ [
2268
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2269
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2270
+ '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
2271
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
2272
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2273
+ '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
2274
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2275
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2276
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2277
+ ],
2278
+ [WETH, 0, USDC, 1, CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL, MARKET, USER, '0', '0'],
2279
+ ],
2280
+ // STOP_LOSS_IN_DEBT
2281
+ [
2282
+ [
2283
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2284
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
2285
+ '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
2286
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
2287
+ '0x0000000000000000000000000000000000000000000000000000000000000003',
2288
+ '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
2289
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2290
+ '0x0000000000000000000000000000000000000000000000000de0b6b3a7640000',
2291
+ '0x000000000000000000000000000000000000000000000000002386f26fc10000',
2292
+ ],
2293
+ [WETH, 0, USDC, 1, CloseStrategyType.STOP_LOSS_IN_DEBT, MARKET, USER, '1000000000000000000', '10000000000000000'],
2294
+ ],
2295
+ // TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL, asset ids above uint8 range
2296
+ [
2297
+ [
2298
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
2299
+ '0x000000000000000000000000000000000000000000000000000000000000012c',
2300
+ '0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
2301
+ '0x0000000000000000000000000000000000000000000000000000000000000190',
2302
+ '0x0000000000000000000000000000000000000000000000000000000000000007',
2303
+ '0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
2304
+ '0x0000000000000000000000001234567890123456789012345678901234567890',
2305
+ '0x00000000000000000000000000000000000000000000000000b1a2bc2ec50000',
2306
+ '0x0000000000000000000000000000000000000000000000000011c37937e08000',
2307
+ ],
2308
+ [WETH, 300, USDC, 400, CloseStrategyType.TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL, MARKET, USER, '50000000000000000', '5000000000000000'],
2309
+ ],
2310
+ ];
2311
+ describe("encode()", () => {
2312
+ examples.forEach(([expected, actual]) => {
2313
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
2314
+ expect(subDataService.aaveV3InstantCloseGenericSubData.encode(...actual)).to.eql(expected);
2315
+ });
2316
+ });
2317
+ });
2318
+ describe("decode()", () => {
2319
+ examples.forEach(([encoded, [collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, user, tsi, slippage]]) => {
2320
+ const expected = {
2321
+ collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, owner: user, tsi, slippage,
2322
+ };
2323
+ it(`Given ${JSON.stringify(encoded)} should return expected value: ${JSON.stringify(expected)}`, () => {
2324
+ expect(subDataService.aaveV3InstantCloseGenericSubData.decode(encoded)).to.eql(expected);
2325
+ });
2326
+ });
2327
+ });
2328
+ });
2398
2329
  describe('When testing subDataService.sparkLeverageManagementOnPriceSubData', () => {
2399
2330
  describe('encode()', () => {
2400
2331
  const examples = [
@@ -91,30 +91,22 @@ export declare namespace Strategies {
91
91
  AAVE_V4_COLLATERAL_SWITCH = 154,
92
92
  AAVE_V4_COLLATERAL_SWITCH_EOA = 155,
93
93
  SPARK_COLLATERAL_SWITCH = 156,
94
- SPARK_GENERIC_FL_COLLATERAL_SWITCH = 167,
95
- AAVE_V3_DEBT_SWITCH = 168,
96
- AAVE_V3_DEBT_SWITCH_EOA = 169
94
+ SPARK_GENERIC_FL_COLLATERAL_SWITCH = 167
97
95
  }
98
96
  enum OptimismIds {
99
97
  EXCHANGE_DCA = 8,
100
98
  EXCHANGE_LIMIT_ORDER = 9,
101
- AAVE_V3_COLLATERAL_SWITCH = 24,
102
- AAVE_V3_DEBT_SWITCH = 25,
103
- AAVE_V3_DEBT_SWITCH_EOA = 26
99
+ AAVE_V3_COLLATERAL_SWITCH = 24
104
100
  }
105
101
  enum BaseIds {
106
102
  EXCHANGE_DCA = 8,
107
103
  EXCHANGE_LIMIT_ORDER = 9,
108
- AAVE_V3_COLLATERAL_SWITCH = 56,
109
- AAVE_V3_DEBT_SWITCH = 61,
110
- AAVE_V3_DEBT_SWITCH_EOA = 62
104
+ AAVE_V3_COLLATERAL_SWITCH = 56
111
105
  }
112
106
  enum ArbitrumIds {
113
107
  EXCHANGE_DCA = 8,
114
108
  EXCHANGE_LIMIT_ORDER = 9,
115
- AAVE_V3_COLLATERAL_SWITCH = 50,
116
- AAVE_V3_DEBT_SWITCH = 55,
117
- AAVE_V3_DEBT_SWITCH_EOA = 56
109
+ AAVE_V3_COLLATERAL_SWITCH = 50
118
110
  }
119
111
  enum Identifiers {
120
112
  SavingsLiqProtection = "smart-savings-liquidation-protection",
@@ -132,6 +124,8 @@ export declare namespace Strategies {
132
124
  CloseOnPriceToColl = "close-on-price-to-collateral",
133
125
  CloseOnPrice = "close-on-price",
134
126
  EoaCloseOnPrice = "eoa-close-on-price",
127
+ InstantCloseOnPrice = "instant-close-on-price",
128
+ EoaInstantCloseOnPrice = "eoa-instant-close-on-price",
135
129
  TrailingStopToColl = "trailing-stop-to-collateral",
136
130
  TrailingStopToDebt = "trailing-stop-to-debt",
137
131
  Rebond = "rebond",
@@ -148,8 +142,6 @@ export declare namespace Strategies {
148
142
  EoaRepayOnPrice = "eoa-repay-on-price",
149
143
  CollateralSwitch = "collateral-switch",
150
144
  EoaCollateralSwitch = "eoa-collateral-switch",
151
- DebtSwitch = "debt-switch",
152
- EoaDebtSwitch = "eoa-debt-switch",
153
145
  LiquidationProtection = "liquidation-protection",
154
146
  EoaLiquidationProtection = "liquidation-protection-eoa"
155
147
  }
@@ -260,7 +252,9 @@ export declare namespace Bundles {
260
252
  SPARK_EOA_REPAY_ON_PRICE = 90,
261
253
  SPARK_EOA_BOOST_ON_PRICE = 91,
262
254
  SPARK_EOA_CLOSE = 92,
263
- SPARK_EOA_LIQUIDATION_PROTECTION = 93
255
+ SPARK_EOA_LIQUIDATION_PROTECTION = 93,
256
+ AAVE_V3_SW_INSTANT_CLOSE = 94,
257
+ AAVE_V3_EOA_INSTANT_CLOSE = 95
264
258
  }
265
259
  enum OptimismIds {
266
260
  AAVE_V3_REPAY = 0,
@@ -105,32 +105,24 @@ export var Strategies;
105
105
  MainnetIds[MainnetIds["AAVE_V4_COLLATERAL_SWITCH_EOA"] = 155] = "AAVE_V4_COLLATERAL_SWITCH_EOA";
106
106
  MainnetIds[MainnetIds["SPARK_COLLATERAL_SWITCH"] = 156] = "SPARK_COLLATERAL_SWITCH";
107
107
  MainnetIds[MainnetIds["SPARK_GENERIC_FL_COLLATERAL_SWITCH"] = 167] = "SPARK_GENERIC_FL_COLLATERAL_SWITCH";
108
- MainnetIds[MainnetIds["AAVE_V3_DEBT_SWITCH"] = 168] = "AAVE_V3_DEBT_SWITCH";
109
- MainnetIds[MainnetIds["AAVE_V3_DEBT_SWITCH_EOA"] = 169] = "AAVE_V3_DEBT_SWITCH_EOA";
110
108
  })(MainnetIds = Strategies.MainnetIds || (Strategies.MainnetIds = {}));
111
109
  let OptimismIds;
112
110
  (function (OptimismIds) {
113
111
  OptimismIds[OptimismIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
114
112
  OptimismIds[OptimismIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
115
113
  OptimismIds[OptimismIds["AAVE_V3_COLLATERAL_SWITCH"] = 24] = "AAVE_V3_COLLATERAL_SWITCH";
116
- OptimismIds[OptimismIds["AAVE_V3_DEBT_SWITCH"] = 25] = "AAVE_V3_DEBT_SWITCH";
117
- OptimismIds[OptimismIds["AAVE_V3_DEBT_SWITCH_EOA"] = 26] = "AAVE_V3_DEBT_SWITCH_EOA";
118
114
  })(OptimismIds = Strategies.OptimismIds || (Strategies.OptimismIds = {}));
119
115
  let BaseIds;
120
116
  (function (BaseIds) {
121
117
  BaseIds[BaseIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
122
118
  BaseIds[BaseIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
123
119
  BaseIds[BaseIds["AAVE_V3_COLLATERAL_SWITCH"] = 56] = "AAVE_V3_COLLATERAL_SWITCH";
124
- BaseIds[BaseIds["AAVE_V3_DEBT_SWITCH"] = 61] = "AAVE_V3_DEBT_SWITCH";
125
- BaseIds[BaseIds["AAVE_V3_DEBT_SWITCH_EOA"] = 62] = "AAVE_V3_DEBT_SWITCH_EOA";
126
120
  })(BaseIds = Strategies.BaseIds || (Strategies.BaseIds = {}));
127
121
  let ArbitrumIds;
128
122
  (function (ArbitrumIds) {
129
123
  ArbitrumIds[ArbitrumIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
130
124
  ArbitrumIds[ArbitrumIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
131
125
  ArbitrumIds[ArbitrumIds["AAVE_V3_COLLATERAL_SWITCH"] = 50] = "AAVE_V3_COLLATERAL_SWITCH";
132
- ArbitrumIds[ArbitrumIds["AAVE_V3_DEBT_SWITCH"] = 55] = "AAVE_V3_DEBT_SWITCH";
133
- ArbitrumIds[ArbitrumIds["AAVE_V3_DEBT_SWITCH_EOA"] = 56] = "AAVE_V3_DEBT_SWITCH_EOA";
134
126
  })(ArbitrumIds = Strategies.ArbitrumIds || (Strategies.ArbitrumIds = {}));
135
127
  let Identifiers;
136
128
  (function (Identifiers) {
@@ -149,6 +141,8 @@ export var Strategies;
149
141
  Identifiers["CloseOnPriceToColl"] = "close-on-price-to-collateral";
150
142
  Identifiers["CloseOnPrice"] = "close-on-price";
151
143
  Identifiers["EoaCloseOnPrice"] = "eoa-close-on-price";
144
+ Identifiers["InstantCloseOnPrice"] = "instant-close-on-price";
145
+ Identifiers["EoaInstantCloseOnPrice"] = "eoa-instant-close-on-price";
152
146
  Identifiers["TrailingStopToColl"] = "trailing-stop-to-collateral";
153
147
  Identifiers["TrailingStopToDebt"] = "trailing-stop-to-debt";
154
148
  Identifiers["Rebond"] = "rebond";
@@ -165,8 +159,6 @@ export var Strategies;
165
159
  Identifiers["EoaRepayOnPrice"] = "eoa-repay-on-price";
166
160
  Identifiers["CollateralSwitch"] = "collateral-switch";
167
161
  Identifiers["EoaCollateralSwitch"] = "eoa-collateral-switch";
168
- Identifiers["DebtSwitch"] = "debt-switch";
169
- Identifiers["EoaDebtSwitch"] = "eoa-debt-switch";
170
162
  Identifiers["LiquidationProtection"] = "liquidation-protection";
171
163
  Identifiers["EoaLiquidationProtection"] = "liquidation-protection-eoa";
172
164
  })(Identifiers = Strategies.Identifiers || (Strategies.Identifiers = {}));
@@ -281,6 +273,8 @@ export var Bundles;
281
273
  MainnetIds[MainnetIds["SPARK_EOA_BOOST_ON_PRICE"] = 91] = "SPARK_EOA_BOOST_ON_PRICE";
282
274
  MainnetIds[MainnetIds["SPARK_EOA_CLOSE"] = 92] = "SPARK_EOA_CLOSE";
283
275
  MainnetIds[MainnetIds["SPARK_EOA_LIQUIDATION_PROTECTION"] = 93] = "SPARK_EOA_LIQUIDATION_PROTECTION";
276
+ MainnetIds[MainnetIds["AAVE_V3_SW_INSTANT_CLOSE"] = 94] = "AAVE_V3_SW_INSTANT_CLOSE";
277
+ MainnetIds[MainnetIds["AAVE_V3_EOA_INSTANT_CLOSE"] = 95] = "AAVE_V3_EOA_INSTANT_CLOSE";
284
278
  })(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
285
279
  let OptimismIds;
286
280
  (function (OptimismIds) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "3.3.21-coll-switch-generic-dev",
3
+ "version": "3.3.21-instant-twap-close-dev",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -145,16 +145,6 @@ export const MAINNET_STRATEGIES_INFO: MainnetStrategiesInfo = {
145
145
  strategyId: Strategies.Identifiers.EoaCollateralSwitch,
146
146
  protocol: PROTOCOLS.Spark,
147
147
  },
148
- [Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH]: {
149
- strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH,
150
- strategyId: Strategies.Identifiers.DebtSwitch,
151
- protocol: PROTOCOLS.AaveV3,
152
- },
153
- [Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH_EOA]: {
154
- strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH_EOA,
155
- strategyId: Strategies.Identifiers.EoaDebtSwitch,
156
- protocol: PROTOCOLS.AaveV3,
157
- },
158
148
  };
159
149
 
160
150
  export const OPTIMISM_STRATEGIES_INFO: OptimismStrategiesInfo = {
@@ -173,16 +163,6 @@ export const OPTIMISM_STRATEGIES_INFO: OptimismStrategiesInfo = {
173
163
  strategyId: Strategies.Identifiers.CollateralSwitch,
174
164
  protocol: PROTOCOLS.AaveV3,
175
165
  },
176
- [Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH]: {
177
- strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH,
178
- strategyId: Strategies.Identifiers.DebtSwitch,
179
- protocol: PROTOCOLS.AaveV3,
180
- },
181
- [Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH_EOA]: {
182
- strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH_EOA,
183
- strategyId: Strategies.Identifiers.EoaDebtSwitch,
184
- protocol: PROTOCOLS.AaveV3,
185
- },
186
166
  };
187
167
 
188
168
  export const BASE_STRATEGIES_INFO: BaseStrategiesInfo = {
@@ -201,16 +181,6 @@ export const BASE_STRATEGIES_INFO: BaseStrategiesInfo = {
201
181
  strategyId: Strategies.Identifiers.CollateralSwitch,
202
182
  protocol: PROTOCOLS.AaveV3,
203
183
  },
204
- [Strategies.BaseIds.AAVE_V3_DEBT_SWITCH]: {
205
- strategyOrBundleId: Strategies.BaseIds.AAVE_V3_DEBT_SWITCH,
206
- strategyId: Strategies.Identifiers.DebtSwitch,
207
- protocol: PROTOCOLS.AaveV3,
208
- },
209
- [Strategies.BaseIds.AAVE_V3_DEBT_SWITCH_EOA]: {
210
- strategyOrBundleId: Strategies.BaseIds.AAVE_V3_DEBT_SWITCH_EOA,
211
- strategyId: Strategies.Identifiers.EoaDebtSwitch,
212
- protocol: PROTOCOLS.AaveV3,
213
- },
214
184
  };
215
185
 
216
186
  export const ARBITRUM_STRATEGIES_INFO: ArbitrumStrategiesInfo = {
@@ -229,16 +199,6 @@ export const ARBITRUM_STRATEGIES_INFO: ArbitrumStrategiesInfo = {
229
199
  strategyId: Strategies.Identifiers.CollateralSwitch,
230
200
  protocol: PROTOCOLS.AaveV3,
231
201
  },
232
- [Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH]: {
233
- strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH,
234
- strategyId: Strategies.Identifiers.DebtSwitch,
235
- protocol: PROTOCOLS.AaveV3,
236
- },
237
- [Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH_EOA]: {
238
- strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH_EOA,
239
- strategyId: Strategies.Identifiers.EoaDebtSwitch,
240
- protocol: PROTOCOLS.AaveV3,
241
- },
242
202
  };
243
203
 
244
204
  export const STRATEGIES_INFO: StrategiesInfo = {
@@ -724,6 +684,16 @@ export const MAINNET_BUNDLES_INFO: MainnetBundleInfo = {
724
684
  strategyId: Strategies.Identifiers.EoaLiquidationProtection,
725
685
  protocol: PROTOCOLS.Spark,
726
686
  },
687
+ [Bundles.MainnetIds.AAVE_V3_SW_INSTANT_CLOSE]: {
688
+ strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_SW_INSTANT_CLOSE,
689
+ strategyId: Strategies.Identifiers.InstantCloseOnPrice,
690
+ protocol: PROTOCOLS.AaveV3,
691
+ },
692
+ [Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE]: {
693
+ strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE,
694
+ strategyId: Strategies.Identifiers.EoaInstantCloseOnPrice,
695
+ protocol: PROTOCOLS.AaveV3,
696
+ },
727
697
  };
728
698
 
729
699
  export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {