@defisaver/automation-sdk 3.3.22-coll-switch-generic-dev → 3.3.22-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.
@@ -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,34 +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,
97
- AAVE_V3_COLLATERAL_SWITCH_EOA = 170
94
+ SPARK_GENERIC_FL_COLLATERAL_SWITCH = 167
98
95
  }
99
96
  enum OptimismIds {
100
97
  EXCHANGE_DCA = 8,
101
98
  EXCHANGE_LIMIT_ORDER = 9,
102
- AAVE_V3_COLLATERAL_SWITCH = 24,
103
- AAVE_V3_DEBT_SWITCH = 25,
104
- AAVE_V3_DEBT_SWITCH_EOA = 26,
105
- AAVE_V3_COLLATERAL_SWITCH_EOA = 27
99
+ AAVE_V3_COLLATERAL_SWITCH = 24
106
100
  }
107
101
  enum BaseIds {
108
102
  EXCHANGE_DCA = 8,
109
103
  EXCHANGE_LIMIT_ORDER = 9,
110
- AAVE_V3_COLLATERAL_SWITCH = 56,
111
- AAVE_V3_DEBT_SWITCH = 61,
112
- AAVE_V3_DEBT_SWITCH_EOA = 62,
113
- AAVE_V3_COLLATERAL_SWITCH_EOA = 63
104
+ AAVE_V3_COLLATERAL_SWITCH = 56
114
105
  }
115
106
  enum ArbitrumIds {
116
107
  EXCHANGE_DCA = 8,
117
108
  EXCHANGE_LIMIT_ORDER = 9,
118
- AAVE_V3_COLLATERAL_SWITCH = 50,
119
- AAVE_V3_DEBT_SWITCH = 55,
120
- AAVE_V3_DEBT_SWITCH_EOA = 56,
121
- AAVE_V3_COLLATERAL_SWITCH_EOA = 57
109
+ AAVE_V3_COLLATERAL_SWITCH = 50
122
110
  }
123
111
  enum Identifiers {
124
112
  SavingsLiqProtection = "smart-savings-liquidation-protection",
@@ -136,6 +124,8 @@ export declare namespace Strategies {
136
124
  CloseOnPriceToColl = "close-on-price-to-collateral",
137
125
  CloseOnPrice = "close-on-price",
138
126
  EoaCloseOnPrice = "eoa-close-on-price",
127
+ InstantCloseOnPrice = "instant-close-on-price",
128
+ EoaInstantCloseOnPrice = "eoa-instant-close-on-price",
139
129
  TrailingStopToColl = "trailing-stop-to-collateral",
140
130
  TrailingStopToDebt = "trailing-stop-to-debt",
141
131
  Rebond = "rebond",
@@ -152,8 +142,6 @@ export declare namespace Strategies {
152
142
  EoaRepayOnPrice = "eoa-repay-on-price",
153
143
  CollateralSwitch = "collateral-switch",
154
144
  EoaCollateralSwitch = "eoa-collateral-switch",
155
- DebtSwitch = "debt-switch",
156
- EoaDebtSwitch = "eoa-debt-switch",
157
145
  LiquidationProtection = "liquidation-protection",
158
146
  EoaLiquidationProtection = "liquidation-protection-eoa"
159
147
  }
@@ -264,7 +252,9 @@ export declare namespace Bundles {
264
252
  SPARK_EOA_REPAY_ON_PRICE = 90,
265
253
  SPARK_EOA_BOOST_ON_PRICE = 91,
266
254
  SPARK_EOA_CLOSE = 92,
267
- 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
268
258
  }
269
259
  enum OptimismIds {
270
260
  AAVE_V3_REPAY = 0,
@@ -279,7 +269,9 @@ export declare namespace Bundles {
279
269
  AAVE_V3_EOA_BOOST_ON_PRICE = 9,
280
270
  AAVE_V3_EOA_CLOSE = 10,
281
271
  AAVE_V3_SW_LIQUIDATION_PROTECTION = 11,
282
- AAVE_V3_EOA_LIQUIDATION_PROTECTION = 12
272
+ AAVE_V3_EOA_LIQUIDATION_PROTECTION = 12,
273
+ AAVE_V3_SW_INSTANT_CLOSE = 13,
274
+ AAVE_V3_EOA_INSTANT_CLOSE = 14
283
275
  }
284
276
  enum BaseIds {
285
277
  AAVE_V3_REPAY = 0,
@@ -321,7 +313,9 @@ export declare namespace Bundles {
321
313
  MORPHO_BLUE_EOA_BOOST_ON_PRICE = 39,
322
314
  MORPHO_BLUE_EOA_REPAY_ON_PRICE = 40,
323
315
  MORPHO_BLUE_EOA_CLOSE = 41,
324
- MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 42
316
+ MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 42,
317
+ AAVE_V3_SW_INSTANT_CLOSE = 43,
318
+ AAVE_V3_EOA_INSTANT_CLOSE = 44
325
319
  }
326
320
  enum ArbitrumIds {
327
321
  AAVE_V3_REPAY = 0,
@@ -363,6 +357,8 @@ export declare namespace Bundles {
363
357
  MORPHO_BLUE_REPAY_ON_PRICE = 36,
364
358
  MORPHO_BLUE_EOA_BOOST_ON_PRICE = 37,
365
359
  MORPHO_BLUE_EOA_REPAY_ON_PRICE = 38,
366
- MORPHO_BLUE_EOA_CLOSE = 39
360
+ MORPHO_BLUE_EOA_CLOSE = 39,
361
+ AAVE_V3_SW_INSTANT_CLOSE = 40,
362
+ AAVE_V3_EOA_INSTANT_CLOSE = 41
367
363
  }
368
364
  }
@@ -105,36 +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
- MainnetIds[MainnetIds["AAVE_V3_COLLATERAL_SWITCH_EOA"] = 170] = "AAVE_V3_COLLATERAL_SWITCH_EOA";
111
108
  })(MainnetIds = Strategies.MainnetIds || (Strategies.MainnetIds = {}));
112
109
  let OptimismIds;
113
110
  (function (OptimismIds) {
114
111
  OptimismIds[OptimismIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
115
112
  OptimismIds[OptimismIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
116
113
  OptimismIds[OptimismIds["AAVE_V3_COLLATERAL_SWITCH"] = 24] = "AAVE_V3_COLLATERAL_SWITCH";
117
- OptimismIds[OptimismIds["AAVE_V3_DEBT_SWITCH"] = 25] = "AAVE_V3_DEBT_SWITCH";
118
- OptimismIds[OptimismIds["AAVE_V3_DEBT_SWITCH_EOA"] = 26] = "AAVE_V3_DEBT_SWITCH_EOA";
119
- OptimismIds[OptimismIds["AAVE_V3_COLLATERAL_SWITCH_EOA"] = 27] = "AAVE_V3_COLLATERAL_SWITCH_EOA";
120
114
  })(OptimismIds = Strategies.OptimismIds || (Strategies.OptimismIds = {}));
121
115
  let BaseIds;
122
116
  (function (BaseIds) {
123
117
  BaseIds[BaseIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
124
118
  BaseIds[BaseIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
125
119
  BaseIds[BaseIds["AAVE_V3_COLLATERAL_SWITCH"] = 56] = "AAVE_V3_COLLATERAL_SWITCH";
126
- BaseIds[BaseIds["AAVE_V3_DEBT_SWITCH"] = 61] = "AAVE_V3_DEBT_SWITCH";
127
- BaseIds[BaseIds["AAVE_V3_DEBT_SWITCH_EOA"] = 62] = "AAVE_V3_DEBT_SWITCH_EOA";
128
- BaseIds[BaseIds["AAVE_V3_COLLATERAL_SWITCH_EOA"] = 63] = "AAVE_V3_COLLATERAL_SWITCH_EOA";
129
120
  })(BaseIds = Strategies.BaseIds || (Strategies.BaseIds = {}));
130
121
  let ArbitrumIds;
131
122
  (function (ArbitrumIds) {
132
123
  ArbitrumIds[ArbitrumIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
133
124
  ArbitrumIds[ArbitrumIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
134
125
  ArbitrumIds[ArbitrumIds["AAVE_V3_COLLATERAL_SWITCH"] = 50] = "AAVE_V3_COLLATERAL_SWITCH";
135
- ArbitrumIds[ArbitrumIds["AAVE_V3_DEBT_SWITCH"] = 55] = "AAVE_V3_DEBT_SWITCH";
136
- ArbitrumIds[ArbitrumIds["AAVE_V3_DEBT_SWITCH_EOA"] = 56] = "AAVE_V3_DEBT_SWITCH_EOA";
137
- ArbitrumIds[ArbitrumIds["AAVE_V3_COLLATERAL_SWITCH_EOA"] = 57] = "AAVE_V3_COLLATERAL_SWITCH_EOA";
138
126
  })(ArbitrumIds = Strategies.ArbitrumIds || (Strategies.ArbitrumIds = {}));
139
127
  let Identifiers;
140
128
  (function (Identifiers) {
@@ -153,6 +141,8 @@ export var Strategies;
153
141
  Identifiers["CloseOnPriceToColl"] = "close-on-price-to-collateral";
154
142
  Identifiers["CloseOnPrice"] = "close-on-price";
155
143
  Identifiers["EoaCloseOnPrice"] = "eoa-close-on-price";
144
+ Identifiers["InstantCloseOnPrice"] = "instant-close-on-price";
145
+ Identifiers["EoaInstantCloseOnPrice"] = "eoa-instant-close-on-price";
156
146
  Identifiers["TrailingStopToColl"] = "trailing-stop-to-collateral";
157
147
  Identifiers["TrailingStopToDebt"] = "trailing-stop-to-debt";
158
148
  Identifiers["Rebond"] = "rebond";
@@ -169,8 +159,6 @@ export var Strategies;
169
159
  Identifiers["EoaRepayOnPrice"] = "eoa-repay-on-price";
170
160
  Identifiers["CollateralSwitch"] = "collateral-switch";
171
161
  Identifiers["EoaCollateralSwitch"] = "eoa-collateral-switch";
172
- Identifiers["DebtSwitch"] = "debt-switch";
173
- Identifiers["EoaDebtSwitch"] = "eoa-debt-switch";
174
162
  Identifiers["LiquidationProtection"] = "liquidation-protection";
175
163
  Identifiers["EoaLiquidationProtection"] = "liquidation-protection-eoa";
176
164
  })(Identifiers = Strategies.Identifiers || (Strategies.Identifiers = {}));
@@ -285,6 +273,8 @@ export var Bundles;
285
273
  MainnetIds[MainnetIds["SPARK_EOA_BOOST_ON_PRICE"] = 91] = "SPARK_EOA_BOOST_ON_PRICE";
286
274
  MainnetIds[MainnetIds["SPARK_EOA_CLOSE"] = 92] = "SPARK_EOA_CLOSE";
287
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";
288
278
  })(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
289
279
  let OptimismIds;
290
280
  (function (OptimismIds) {
@@ -301,6 +291,9 @@ export var Bundles;
301
291
  OptimismIds[OptimismIds["AAVE_V3_EOA_CLOSE"] = 10] = "AAVE_V3_EOA_CLOSE";
302
292
  OptimismIds[OptimismIds["AAVE_V3_SW_LIQUIDATION_PROTECTION"] = 11] = "AAVE_V3_SW_LIQUIDATION_PROTECTION";
303
293
  OptimismIds[OptimismIds["AAVE_V3_EOA_LIQUIDATION_PROTECTION"] = 12] = "AAVE_V3_EOA_LIQUIDATION_PROTECTION";
294
+ // TODO -> Fix ids
295
+ OptimismIds[OptimismIds["AAVE_V3_SW_INSTANT_CLOSE"] = 13] = "AAVE_V3_SW_INSTANT_CLOSE";
296
+ OptimismIds[OptimismIds["AAVE_V3_EOA_INSTANT_CLOSE"] = 14] = "AAVE_V3_EOA_INSTANT_CLOSE";
304
297
  })(OptimismIds = Bundles.OptimismIds || (Bundles.OptimismIds = {}));
305
298
  let BaseIds;
306
299
  (function (BaseIds) {
@@ -344,6 +337,8 @@ export var Bundles;
344
337
  BaseIds[BaseIds["MORPHO_BLUE_EOA_REPAY_ON_PRICE"] = 40] = "MORPHO_BLUE_EOA_REPAY_ON_PRICE";
345
338
  BaseIds[BaseIds["MORPHO_BLUE_EOA_CLOSE"] = 41] = "MORPHO_BLUE_EOA_CLOSE";
346
339
  BaseIds[BaseIds["MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION"] = 42] = "MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION";
340
+ BaseIds[BaseIds["AAVE_V3_SW_INSTANT_CLOSE"] = 43] = "AAVE_V3_SW_INSTANT_CLOSE";
341
+ BaseIds[BaseIds["AAVE_V3_EOA_INSTANT_CLOSE"] = 44] = "AAVE_V3_EOA_INSTANT_CLOSE";
347
342
  })(BaseIds = Bundles.BaseIds || (Bundles.BaseIds = {}));
348
343
  let ArbitrumIds;
349
344
  (function (ArbitrumIds) {
@@ -387,5 +382,7 @@ export var Bundles;
387
382
  ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_BOOST_ON_PRICE"] = 37] = "MORPHO_BLUE_EOA_BOOST_ON_PRICE";
388
383
  ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_REPAY_ON_PRICE"] = 38] = "MORPHO_BLUE_EOA_REPAY_ON_PRICE";
389
384
  ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_CLOSE"] = 39] = "MORPHO_BLUE_EOA_CLOSE";
385
+ ArbitrumIds[ArbitrumIds["AAVE_V3_SW_INSTANT_CLOSE"] = 40] = "AAVE_V3_SW_INSTANT_CLOSE";
386
+ ArbitrumIds[ArbitrumIds["AAVE_V3_EOA_INSTANT_CLOSE"] = 41] = "AAVE_V3_EOA_INSTANT_CLOSE";
390
387
  })(ArbitrumIds = Bundles.ArbitrumIds || (Bundles.ArbitrumIds = {}));
391
388
  })(Bundles || (Bundles = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "3.3.22-coll-switch-generic-dev",
3
+ "version": "3.3.22-instant-twap-close-dev",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -125,11 +125,6 @@ export const MAINNET_STRATEGIES_INFO: MainnetStrategiesInfo = {
125
125
  strategyId: Strategies.Identifiers.CollateralSwitch,
126
126
  protocol: PROTOCOLS.AaveV3,
127
127
  },
128
- [Strategies.MainnetIds.AAVE_V3_COLLATERAL_SWITCH_EOA]: {
129
- strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_COLLATERAL_SWITCH_EOA,
130
- strategyId: Strategies.Identifiers.EoaCollateralSwitch,
131
- protocol: PROTOCOLS.AaveV3,
132
- },
133
128
  [Strategies.MainnetIds.AAVE_V4_COLLATERAL_SWITCH]: {
134
129
  strategyOrBundleId: Strategies.MainnetIds.AAVE_V4_COLLATERAL_SWITCH,
135
130
  strategyId: Strategies.Identifiers.CollateralSwitch,
@@ -150,16 +145,6 @@ export const MAINNET_STRATEGIES_INFO: MainnetStrategiesInfo = {
150
145
  strategyId: Strategies.Identifiers.EoaCollateralSwitch,
151
146
  protocol: PROTOCOLS.Spark,
152
147
  },
153
- [Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH]: {
154
- strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH,
155
- strategyId: Strategies.Identifiers.DebtSwitch,
156
- protocol: PROTOCOLS.AaveV3,
157
- },
158
- [Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH_EOA]: {
159
- strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH_EOA,
160
- strategyId: Strategies.Identifiers.EoaDebtSwitch,
161
- protocol: PROTOCOLS.AaveV3,
162
- },
163
148
  };
164
149
 
165
150
  export const OPTIMISM_STRATEGIES_INFO: OptimismStrategiesInfo = {
@@ -178,21 +163,6 @@ export const OPTIMISM_STRATEGIES_INFO: OptimismStrategiesInfo = {
178
163
  strategyId: Strategies.Identifiers.CollateralSwitch,
179
164
  protocol: PROTOCOLS.AaveV3,
180
165
  },
181
- [Strategies.OptimismIds.AAVE_V3_COLLATERAL_SWITCH_EOA]: {
182
- strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_COLLATERAL_SWITCH_EOA,
183
- strategyId: Strategies.Identifiers.EoaCollateralSwitch,
184
- protocol: PROTOCOLS.AaveV3,
185
- },
186
- [Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH]: {
187
- strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH,
188
- strategyId: Strategies.Identifiers.DebtSwitch,
189
- protocol: PROTOCOLS.AaveV3,
190
- },
191
- [Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH_EOA]: {
192
- strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH_EOA,
193
- strategyId: Strategies.Identifiers.EoaDebtSwitch,
194
- protocol: PROTOCOLS.AaveV3,
195
- },
196
166
  };
197
167
 
198
168
  export const BASE_STRATEGIES_INFO: BaseStrategiesInfo = {
@@ -211,21 +181,6 @@ export const BASE_STRATEGIES_INFO: BaseStrategiesInfo = {
211
181
  strategyId: Strategies.Identifiers.CollateralSwitch,
212
182
  protocol: PROTOCOLS.AaveV3,
213
183
  },
214
- [Strategies.BaseIds.AAVE_V3_COLLATERAL_SWITCH_EOA]: {
215
- strategyOrBundleId: Strategies.BaseIds.AAVE_V3_COLLATERAL_SWITCH_EOA,
216
- strategyId: Strategies.Identifiers.EoaCollateralSwitch,
217
- protocol: PROTOCOLS.AaveV3,
218
- },
219
- [Strategies.BaseIds.AAVE_V3_DEBT_SWITCH]: {
220
- strategyOrBundleId: Strategies.BaseIds.AAVE_V3_DEBT_SWITCH,
221
- strategyId: Strategies.Identifiers.DebtSwitch,
222
- protocol: PROTOCOLS.AaveV3,
223
- },
224
- [Strategies.BaseIds.AAVE_V3_DEBT_SWITCH_EOA]: {
225
- strategyOrBundleId: Strategies.BaseIds.AAVE_V3_DEBT_SWITCH_EOA,
226
- strategyId: Strategies.Identifiers.EoaDebtSwitch,
227
- protocol: PROTOCOLS.AaveV3,
228
- },
229
184
  };
230
185
 
231
186
  export const ARBITRUM_STRATEGIES_INFO: ArbitrumStrategiesInfo = {
@@ -244,21 +199,6 @@ export const ARBITRUM_STRATEGIES_INFO: ArbitrumStrategiesInfo = {
244
199
  strategyId: Strategies.Identifiers.CollateralSwitch,
245
200
  protocol: PROTOCOLS.AaveV3,
246
201
  },
247
- [Strategies.ArbitrumIds.AAVE_V3_COLLATERAL_SWITCH_EOA]: {
248
- strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_COLLATERAL_SWITCH_EOA,
249
- strategyId: Strategies.Identifiers.EoaCollateralSwitch,
250
- protocol: PROTOCOLS.AaveV3,
251
- },
252
- [Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH]: {
253
- strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH,
254
- strategyId: Strategies.Identifiers.DebtSwitch,
255
- protocol: PROTOCOLS.AaveV3,
256
- },
257
- [Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH_EOA]: {
258
- strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH_EOA,
259
- strategyId: Strategies.Identifiers.EoaDebtSwitch,
260
- protocol: PROTOCOLS.AaveV3,
261
- },
262
202
  };
263
203
 
264
204
  export const STRATEGIES_INFO: StrategiesInfo = {
@@ -744,6 +684,16 @@ export const MAINNET_BUNDLES_INFO: MainnetBundleInfo = {
744
684
  strategyId: Strategies.Identifiers.EoaLiquidationProtection,
745
685
  protocol: PROTOCOLS.Spark,
746
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
+ },
747
697
  };
748
698
 
749
699
  export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {
@@ -812,6 +762,16 @@ export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {
812
762
  strategyId: Strategies.Identifiers.EoaLiquidationProtection,
813
763
  protocol: PROTOCOLS.AaveV3,
814
764
  },
765
+ [Bundles.OptimismIds.AAVE_V3_SW_INSTANT_CLOSE]: {
766
+ strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_SW_INSTANT_CLOSE,
767
+ strategyId: Strategies.Identifiers.InstantCloseOnPrice,
768
+ protocol: PROTOCOLS.AaveV3,
769
+ },
770
+ [Bundles.OptimismIds.AAVE_V3_EOA_INSTANT_CLOSE]: {
771
+ strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_INSTANT_CLOSE,
772
+ strategyId: Strategies.Identifiers.EoaInstantCloseOnPrice,
773
+ protocol: PROTOCOLS.AaveV3,
774
+ },
815
775
  };
816
776
 
817
777
  export const BASE_BUNDLES_INFO: BaseBundleInfo = {
@@ -1015,6 +975,16 @@ export const BASE_BUNDLES_INFO: BaseBundleInfo = {
1015
975
  strategyId: Strategies.Identifiers.EoaCloseOnPrice,
1016
976
  protocol: PROTOCOLS.MorphoBlue,
1017
977
  },
978
+ [Bundles.BaseIds.AAVE_V3_SW_INSTANT_CLOSE]: {
979
+ strategyOrBundleId: Bundles.BaseIds.AAVE_V3_SW_INSTANT_CLOSE,
980
+ strategyId: Strategies.Identifiers.InstantCloseOnPrice,
981
+ protocol: PROTOCOLS.AaveV3,
982
+ },
983
+ [Bundles.BaseIds.AAVE_V3_EOA_INSTANT_CLOSE]: {
984
+ strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_INSTANT_CLOSE,
985
+ strategyId: Strategies.Identifiers.EoaInstantCloseOnPrice,
986
+ protocol: PROTOCOLS.AaveV3,
987
+ },
1018
988
  };
1019
989
 
1020
990
  export const ARBITRUM_BUNDLES_INFO: ArbitrumBundleInfo = {
@@ -1219,6 +1189,16 @@ export const ARBITRUM_BUNDLES_INFO: ArbitrumBundleInfo = {
1219
1189
  strategyId: Strategies.Identifiers.EoaCloseOnPrice,
1220
1190
  protocol: PROTOCOLS.MorphoBlue,
1221
1191
  },
1192
+ [Bundles.ArbitrumIds.AAVE_V3_SW_INSTANT_CLOSE]: {
1193
+ strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_SW_INSTANT_CLOSE,
1194
+ strategyId: Strategies.Identifiers.InstantCloseOnPrice,
1195
+ protocol: PROTOCOLS.AaveV3,
1196
+ },
1197
+ [Bundles.ArbitrumIds.AAVE_V3_EOA_INSTANT_CLOSE]: {
1198
+ strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_INSTANT_CLOSE,
1199
+ strategyId: Strategies.Identifiers.EoaInstantCloseOnPrice,
1200
+ protocol: PROTOCOLS.AaveV3,
1201
+ },
1222
1202
  };
1223
1203
 
1224
1204
  export const BUNDLES_INFO: BundlesInfo = {