@defisaver/automation-sdk 3.1.10 → 3.1.14-spark-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.
- package/cjs/automation/private/StrategiesAutomation.d.ts +5 -3
- package/cjs/automation/private/StrategiesAutomation.js +27 -10
- package/cjs/automation/private/StrategiesAutomation.test.js +25 -0
- package/cjs/constants/index.d.ts +1 -0
- package/cjs/constants/index.js +352 -11
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +1 -1
- package/cjs/services/ethereumService.js +21 -14
- package/cjs/services/ethereumService.test.js +3 -0
- package/cjs/services/strategiesService.js +329 -54
- package/cjs/services/strategiesService.test.js +1 -0
- package/cjs/services/strategySubService.d.ts +24 -5
- package/cjs/services/strategySubService.js +116 -10
- package/cjs/services/strategySubService.test.js +1049 -173
- package/cjs/services/subDataService.d.ts +361 -88
- package/cjs/services/subDataService.js +799 -249
- package/cjs/services/subDataService.test.js +1287 -142
- package/cjs/services/triggerService.d.ts +100 -9
- package/cjs/services/triggerService.js +188 -19
- package/cjs/services/triggerService.test.js +437 -46
- package/cjs/services/utils.d.ts +1 -1
- package/cjs/services/utils.js +10 -2
- package/cjs/services/utils.test.js +0 -77
- package/cjs/types/enums.d.ts +88 -12
- package/cjs/types/enums.js +78 -2
- package/cjs/types/index.d.ts +59 -1
- package/esm/automation/private/StrategiesAutomation.d.ts +5 -3
- package/esm/automation/private/StrategiesAutomation.js +27 -10
- package/esm/automation/private/StrategiesAutomation.test.js +25 -0
- package/esm/constants/index.d.ts +1 -0
- package/esm/constants/index.js +351 -10
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -2
- package/esm/services/ethereumService.js +21 -14
- package/esm/services/ethereumService.test.js +3 -0
- package/esm/services/strategiesService.js +330 -55
- package/esm/services/strategiesService.test.js +1 -0
- package/esm/services/strategySubService.d.ts +24 -5
- package/esm/services/strategySubService.js +115 -9
- package/esm/services/strategySubService.test.js +1052 -176
- package/esm/services/subDataService.d.ts +361 -88
- package/esm/services/subDataService.js +799 -249
- package/esm/services/subDataService.test.js +1288 -143
- package/esm/services/triggerService.d.ts +100 -9
- package/esm/services/triggerService.js +187 -18
- package/esm/services/triggerService.test.js +438 -47
- package/esm/services/utils.d.ts +1 -1
- package/esm/services/utils.js +10 -2
- package/esm/services/utils.test.js +1 -52
- package/esm/types/enums.d.ts +88 -12
- package/esm/types/enums.js +78 -2
- package/esm/types/index.d.ts +59 -1
- package/package.json +4 -5
- package/src/automation/private/StrategiesAutomation.test.ts +40 -0
- package/src/automation/private/StrategiesAutomation.ts +38 -15
- package/src/constants/index.ts +353 -11
- package/src/index.ts +4 -2
- package/src/services/ethereumService.test.ts +3 -0
- package/src/services/ethereumService.ts +23 -16
- package/src/services/strategiesService.test.ts +1 -0
- package/src/services/strategiesService.ts +387 -72
- package/src/services/strategySubService.test.ts +1330 -316
- package/src/services/strategySubService.ts +365 -12
- package/src/services/subDataService.test.ts +1413 -170
- package/src/services/subDataService.ts +1148 -431
- package/src/services/triggerService.test.ts +482 -52
- package/src/services/triggerService.ts +272 -27
- package/src/services/utils.test.ts +0 -59
- package/src/services/utils.ts +15 -4
- package/src/types/enums.ts +78 -2
- package/src/types/index.ts +74 -1
- package/umd/index.js +0 -34219
package/esm/constants/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import Protocol from '../automation/private/Protocol';
|
|
|
3
3
|
import LegacyProtocol from '../automation/private/LegacyProtocol';
|
|
4
4
|
// General
|
|
5
5
|
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
6
|
+
export const EMPTY_SLOT = '0x0000000000000000000000000000000000000000000000000000000000000000';
|
|
6
7
|
export const AAVE_V3_VARIABLE_BORROW_RATE = 2;
|
|
7
8
|
export const PROTOCOLS = (() => {
|
|
8
9
|
const protocolsMapping = {};
|
|
@@ -95,6 +96,26 @@ export const MAINNET_STRATEGIES_INFO = {
|
|
|
95
96
|
strategyId: Strategies.Identifiers.Payback,
|
|
96
97
|
protocol: PROTOCOLS.LiquityV2,
|
|
97
98
|
},
|
|
99
|
+
[Strategies.MainnetIds.AAVE_V3_COLLATERAL_SWITCH]: {
|
|
100
|
+
strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_COLLATERAL_SWITCH,
|
|
101
|
+
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
102
|
+
protocol: PROTOCOLS.AaveV3,
|
|
103
|
+
},
|
|
104
|
+
[Strategies.MainnetIds.AAVE_V4_COLLATERAL_SWITCH]: {
|
|
105
|
+
strategyOrBundleId: Strategies.MainnetIds.AAVE_V4_COLLATERAL_SWITCH,
|
|
106
|
+
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
107
|
+
protocol: PROTOCOLS.AaveV4,
|
|
108
|
+
},
|
|
109
|
+
[Strategies.MainnetIds.AAVE_V4_COLLATERAL_SWITCH_EOA]: {
|
|
110
|
+
strategyOrBundleId: Strategies.MainnetIds.AAVE_V4_COLLATERAL_SWITCH_EOA,
|
|
111
|
+
strategyId: Strategies.Identifiers.EoaCollateralSwitch,
|
|
112
|
+
protocol: PROTOCOLS.AaveV4,
|
|
113
|
+
},
|
|
114
|
+
[Strategies.MainnetIds.SPARK_COLLATERAL_SWITCH]: {
|
|
115
|
+
strategyOrBundleId: Strategies.MainnetIds.SPARK_COLLATERAL_SWITCH,
|
|
116
|
+
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
117
|
+
protocol: PROTOCOLS.Spark,
|
|
118
|
+
},
|
|
98
119
|
};
|
|
99
120
|
export const OPTIMISM_STRATEGIES_INFO = {
|
|
100
121
|
[Strategies.OptimismIds.EXCHANGE_DCA]: {
|
|
@@ -107,6 +128,11 @@ export const OPTIMISM_STRATEGIES_INFO = {
|
|
|
107
128
|
strategyId: Strategies.Identifiers.LimitOrder,
|
|
108
129
|
protocol: PROTOCOLS.Exchange,
|
|
109
130
|
},
|
|
131
|
+
[Strategies.OptimismIds.AAVE_V3_COLLATERAL_SWITCH]: {
|
|
132
|
+
strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_COLLATERAL_SWITCH,
|
|
133
|
+
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
134
|
+
protocol: PROTOCOLS.AaveV3,
|
|
135
|
+
},
|
|
110
136
|
};
|
|
111
137
|
export const BASE_STRATEGIES_INFO = {
|
|
112
138
|
[Strategies.BaseIds.EXCHANGE_DCA]: {
|
|
@@ -119,6 +145,11 @@ export const BASE_STRATEGIES_INFO = {
|
|
|
119
145
|
strategyId: Strategies.Identifiers.LimitOrder,
|
|
120
146
|
protocol: PROTOCOLS.Exchange,
|
|
121
147
|
},
|
|
148
|
+
[Strategies.BaseIds.AAVE_V3_COLLATERAL_SWITCH]: {
|
|
149
|
+
strategyOrBundleId: Strategies.BaseIds.AAVE_V3_COLLATERAL_SWITCH,
|
|
150
|
+
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
151
|
+
protocol: PROTOCOLS.AaveV3,
|
|
152
|
+
},
|
|
122
153
|
};
|
|
123
154
|
export const ARBITRUM_STRATEGIES_INFO = {
|
|
124
155
|
[Strategies.ArbitrumIds.EXCHANGE_DCA]: {
|
|
@@ -131,6 +162,11 @@ export const ARBITRUM_STRATEGIES_INFO = {
|
|
|
131
162
|
strategyId: Strategies.Identifiers.LimitOrder,
|
|
132
163
|
protocol: PROTOCOLS.Exchange,
|
|
133
164
|
},
|
|
165
|
+
[Strategies.ArbitrumIds.AAVE_V3_COLLATERAL_SWITCH]: {
|
|
166
|
+
strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_COLLATERAL_SWITCH,
|
|
167
|
+
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
168
|
+
protocol: PROTOCOLS.AaveV3,
|
|
169
|
+
},
|
|
134
170
|
};
|
|
135
171
|
export const STRATEGIES_INFO = {
|
|
136
172
|
[ChainId.Ethereum]: MAINNET_STRATEGIES_INFO,
|
|
@@ -282,16 +318,6 @@ export const MAINNET_BUNDLES_INFO = {
|
|
|
282
318
|
strategyId: Strategies.Identifiers.Boost,
|
|
283
319
|
protocol: PROTOCOLS.Spark,
|
|
284
320
|
},
|
|
285
|
-
[Bundles.MainnetIds.SPARK_CLOSE_TO_DEBT]: {
|
|
286
|
-
strategyOrBundleId: Bundles.MainnetIds.SPARK_CLOSE_TO_DEBT,
|
|
287
|
-
strategyId: Strategies.Identifiers.CloseToDebt,
|
|
288
|
-
protocol: PROTOCOLS.Spark,
|
|
289
|
-
},
|
|
290
|
-
[Bundles.MainnetIds.SPARK_CLOSE_TO_COLLATERAL]: {
|
|
291
|
-
strategyOrBundleId: Bundles.MainnetIds.SPARK_CLOSE_TO_COLLATERAL,
|
|
292
|
-
strategyId: Strategies.Identifiers.CloseToCollateral,
|
|
293
|
-
protocol: PROTOCOLS.Spark,
|
|
294
|
-
},
|
|
295
321
|
[Bundles.MainnetIds.AAVE_V2_REPAY]: {
|
|
296
322
|
strategyOrBundleId: Bundles.MainnetIds.AAVE_V2_REPAY,
|
|
297
323
|
strategyId: Strategies.Identifiers.Repay,
|
|
@@ -392,6 +418,131 @@ export const MAINNET_BUNDLES_INFO = {
|
|
|
392
418
|
strategyId: Strategies.Identifiers.Boost,
|
|
393
419
|
protocol: PROTOCOLS.FluidT1,
|
|
394
420
|
},
|
|
421
|
+
[Bundles.MainnetIds.COMP_V3_SW_REPAY_ON_PRICE]: {
|
|
422
|
+
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_SW_REPAY_ON_PRICE,
|
|
423
|
+
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
424
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
425
|
+
},
|
|
426
|
+
[Bundles.MainnetIds.COMP_V3_SW_BOOST_ON_PRICE]: {
|
|
427
|
+
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_SW_BOOST_ON_PRICE,
|
|
428
|
+
strategyId: Strategies.Identifiers.BoostOnPrice,
|
|
429
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
430
|
+
},
|
|
431
|
+
[Bundles.MainnetIds.COMP_V3_SW_CLOSE]: {
|
|
432
|
+
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_SW_CLOSE,
|
|
433
|
+
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
434
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
435
|
+
},
|
|
436
|
+
[Bundles.MainnetIds.COMP_V3_EOA_REPAY_ON_PRICE]: {
|
|
437
|
+
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_EOA_REPAY_ON_PRICE,
|
|
438
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
439
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
440
|
+
},
|
|
441
|
+
[Bundles.MainnetIds.COMP_V3_EOA_BOOST_ON_PRICE]: {
|
|
442
|
+
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_EOA_BOOST_ON_PRICE,
|
|
443
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
444
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
445
|
+
},
|
|
446
|
+
[Bundles.MainnetIds.COMP_V3_EOA_CLOSE]: {
|
|
447
|
+
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_EOA_CLOSE,
|
|
448
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
449
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
450
|
+
},
|
|
451
|
+
[Bundles.MainnetIds.AAVE_V3_EOA_REPAY]: {
|
|
452
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_REPAY,
|
|
453
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
454
|
+
protocol: PROTOCOLS.AaveV3,
|
|
455
|
+
},
|
|
456
|
+
[Bundles.MainnetIds.AAVE_V3_EOA_BOOST]: {
|
|
457
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_BOOST,
|
|
458
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
459
|
+
protocol: PROTOCOLS.AaveV3,
|
|
460
|
+
},
|
|
461
|
+
[Bundles.MainnetIds.AAVE_V3_EOA_REPAY_ON_PRICE]: {
|
|
462
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_REPAY_ON_PRICE,
|
|
463
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
464
|
+
protocol: PROTOCOLS.AaveV3,
|
|
465
|
+
},
|
|
466
|
+
[Bundles.MainnetIds.AAVE_V3_EOA_BOOST_ON_PRICE]: {
|
|
467
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_BOOST_ON_PRICE,
|
|
468
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
469
|
+
protocol: PROTOCOLS.AaveV3,
|
|
470
|
+
},
|
|
471
|
+
[Bundles.MainnetIds.AAVE_V3_EOA_CLOSE]: {
|
|
472
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_CLOSE,
|
|
473
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
474
|
+
protocol: PROTOCOLS.AaveV3,
|
|
475
|
+
},
|
|
476
|
+
[Bundles.MainnetIds.SPARK_CLOSE]: {
|
|
477
|
+
strategyOrBundleId: Bundles.MainnetIds.SPARK_CLOSE,
|
|
478
|
+
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
479
|
+
protocol: PROTOCOLS.Spark,
|
|
480
|
+
},
|
|
481
|
+
[Bundles.MainnetIds.MORPHO_BLUE_CLOSE]: {
|
|
482
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_CLOSE,
|
|
483
|
+
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
484
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
485
|
+
},
|
|
486
|
+
[Bundles.MainnetIds.SPARK_REPAY_ON_PRICE]: {
|
|
487
|
+
strategyOrBundleId: Bundles.MainnetIds.SPARK_REPAY_ON_PRICE,
|
|
488
|
+
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
489
|
+
protocol: PROTOCOLS.Spark,
|
|
490
|
+
},
|
|
491
|
+
[Bundles.MainnetIds.SPARK_BOOST_ON_PRICE]: {
|
|
492
|
+
strategyOrBundleId: Bundles.MainnetIds.SPARK_BOOST_ON_PRICE,
|
|
493
|
+
strategyId: Strategies.Identifiers.BoostOnPrice,
|
|
494
|
+
protocol: PROTOCOLS.Spark,
|
|
495
|
+
},
|
|
496
|
+
[Bundles.MainnetIds.AAVE_V4_REPAY]: {
|
|
497
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_REPAY,
|
|
498
|
+
strategyId: Strategies.Identifiers.Repay,
|
|
499
|
+
protocol: PROTOCOLS.AaveV4,
|
|
500
|
+
},
|
|
501
|
+
[Bundles.MainnetIds.AAVE_V4_BOOST]: {
|
|
502
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_BOOST,
|
|
503
|
+
strategyId: Strategies.Identifiers.Boost,
|
|
504
|
+
protocol: PROTOCOLS.AaveV4,
|
|
505
|
+
},
|
|
506
|
+
[Bundles.MainnetIds.AAVE_V4_REPAY_ON_PRICE]: {
|
|
507
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_REPAY_ON_PRICE,
|
|
508
|
+
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
509
|
+
protocol: PROTOCOLS.AaveV4,
|
|
510
|
+
},
|
|
511
|
+
[Bundles.MainnetIds.AAVE_V4_BOOST_ON_PRICE]: {
|
|
512
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_BOOST_ON_PRICE,
|
|
513
|
+
strategyId: Strategies.Identifiers.BoostOnPrice,
|
|
514
|
+
protocol: PROTOCOLS.AaveV4,
|
|
515
|
+
},
|
|
516
|
+
[Bundles.MainnetIds.AAVE_V4_CLOSE]: {
|
|
517
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_CLOSE,
|
|
518
|
+
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
519
|
+
protocol: PROTOCOLS.AaveV4,
|
|
520
|
+
},
|
|
521
|
+
[Bundles.MainnetIds.AAVE_V4_EOA_REPAY]: {
|
|
522
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_EOA_REPAY,
|
|
523
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
524
|
+
protocol: PROTOCOLS.AaveV4,
|
|
525
|
+
},
|
|
526
|
+
[Bundles.MainnetIds.AAVE_V4_EOA_BOOST]: {
|
|
527
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_EOA_BOOST,
|
|
528
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
529
|
+
protocol: PROTOCOLS.AaveV4,
|
|
530
|
+
},
|
|
531
|
+
[Bundles.MainnetIds.AAVE_V4_EOA_REPAY_ON_PRICE]: {
|
|
532
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_EOA_REPAY_ON_PRICE,
|
|
533
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
534
|
+
protocol: PROTOCOLS.AaveV4,
|
|
535
|
+
},
|
|
536
|
+
[Bundles.MainnetIds.AAVE_V4_EOA_BOOST_ON_PRICE]: {
|
|
537
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_EOA_BOOST_ON_PRICE,
|
|
538
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
539
|
+
protocol: PROTOCOLS.AaveV4,
|
|
540
|
+
},
|
|
541
|
+
[Bundles.MainnetIds.AAVE_V4_EOA_CLOSE]: {
|
|
542
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_EOA_CLOSE,
|
|
543
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
544
|
+
protocol: PROTOCOLS.AaveV4,
|
|
545
|
+
},
|
|
395
546
|
};
|
|
396
547
|
export const OPTIMISM_BUNDLES_INFO = {
|
|
397
548
|
[Bundles.OptimismIds.AAVE_V3_REPAY]: {
|
|
@@ -424,6 +575,31 @@ export const OPTIMISM_BUNDLES_INFO = {
|
|
|
424
575
|
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
425
576
|
protocol: PROTOCOLS.AaveV3,
|
|
426
577
|
},
|
|
578
|
+
[Bundles.OptimismIds.AAVE_V3_EOA_REPAY]: {
|
|
579
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_REPAY,
|
|
580
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
581
|
+
protocol: PROTOCOLS.AaveV3,
|
|
582
|
+
},
|
|
583
|
+
[Bundles.OptimismIds.AAVE_V3_EOA_BOOST]: {
|
|
584
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_BOOST,
|
|
585
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
586
|
+
protocol: PROTOCOLS.AaveV3,
|
|
587
|
+
},
|
|
588
|
+
[Bundles.OptimismIds.AAVE_V3_EOA_REPAY_ON_PRICE]: {
|
|
589
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_REPAY_ON_PRICE,
|
|
590
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
591
|
+
protocol: PROTOCOLS.AaveV3,
|
|
592
|
+
},
|
|
593
|
+
[Bundles.OptimismIds.AAVE_V3_EOA_BOOST_ON_PRICE]: {
|
|
594
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_BOOST_ON_PRICE,
|
|
595
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
596
|
+
protocol: PROTOCOLS.AaveV3,
|
|
597
|
+
},
|
|
598
|
+
[Bundles.OptimismIds.AAVE_V3_EOA_CLOSE]: {
|
|
599
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_CLOSE,
|
|
600
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
601
|
+
protocol: PROTOCOLS.AaveV3,
|
|
602
|
+
},
|
|
427
603
|
};
|
|
428
604
|
export const BASE_BUNDLES_INFO = {
|
|
429
605
|
[Bundles.BaseIds.AAVE_V3_REPAY]: {
|
|
@@ -491,6 +667,76 @@ export const BASE_BUNDLES_INFO = {
|
|
|
491
667
|
strategyId: Strategies.Identifiers.Boost,
|
|
492
668
|
protocol: PROTOCOLS.FluidT1,
|
|
493
669
|
},
|
|
670
|
+
[Bundles.BaseIds.COMP_V3_SW_REPAY_ON_PRICE]: {
|
|
671
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_SW_REPAY_ON_PRICE,
|
|
672
|
+
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
673
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
674
|
+
},
|
|
675
|
+
[Bundles.BaseIds.COMP_V3_SW_BOOST_ON_PRICE]: {
|
|
676
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_SW_BOOST_ON_PRICE,
|
|
677
|
+
strategyId: Strategies.Identifiers.BoostOnPrice,
|
|
678
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
679
|
+
},
|
|
680
|
+
[Bundles.BaseIds.COMP_V3_SW_CLOSE]: {
|
|
681
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_SW_CLOSE,
|
|
682
|
+
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
683
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
684
|
+
},
|
|
685
|
+
[Bundles.BaseIds.COMP_V3_EOA_REPAY_ON_PRICE]: {
|
|
686
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_EOA_REPAY_ON_PRICE,
|
|
687
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
688
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
689
|
+
},
|
|
690
|
+
[Bundles.BaseIds.COMP_V3_EOA_BOOST_ON_PRICE]: {
|
|
691
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_EOA_BOOST_ON_PRICE,
|
|
692
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
693
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
694
|
+
},
|
|
695
|
+
[Bundles.BaseIds.COMP_V3_EOA_CLOSE]: {
|
|
696
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_EOA_CLOSE,
|
|
697
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
698
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
699
|
+
},
|
|
700
|
+
[Bundles.BaseIds.COMP_V3_EOA_REPAY]: {
|
|
701
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_EOA_REPAY,
|
|
702
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
703
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
704
|
+
},
|
|
705
|
+
[Bundles.BaseIds.COMP_V3_EOA_BOOST]: {
|
|
706
|
+
strategyOrBundleId: Bundles.BaseIds.COMP_V3_EOA_BOOST,
|
|
707
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
708
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
709
|
+
},
|
|
710
|
+
[Bundles.BaseIds.AAVE_V3_EOA_REPAY]: {
|
|
711
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_REPAY,
|
|
712
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
713
|
+
protocol: PROTOCOLS.AaveV3,
|
|
714
|
+
},
|
|
715
|
+
[Bundles.BaseIds.AAVE_V3_EOA_BOOST]: {
|
|
716
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_BOOST,
|
|
717
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
718
|
+
protocol: PROTOCOLS.AaveV3,
|
|
719
|
+
},
|
|
720
|
+
[Bundles.BaseIds.AAVE_V3_EOA_REPAY_ON_PRICE]: {
|
|
721
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_REPAY_ON_PRICE,
|
|
722
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
723
|
+
protocol: PROTOCOLS.AaveV3,
|
|
724
|
+
},
|
|
725
|
+
[Bundles.BaseIds.AAVE_V3_EOA_BOOST_ON_PRICE]: {
|
|
726
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_BOOST_ON_PRICE,
|
|
727
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
728
|
+
protocol: PROTOCOLS.AaveV3,
|
|
729
|
+
},
|
|
730
|
+
[Bundles.BaseIds.AAVE_V3_EOA_CLOSE]: {
|
|
731
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_CLOSE,
|
|
732
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
733
|
+
protocol: PROTOCOLS.AaveV3,
|
|
734
|
+
},
|
|
735
|
+
[Bundles.BaseIds.MORPHO_BLUE_CLOSE]: {
|
|
736
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_CLOSE,
|
|
737
|
+
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
738
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
739
|
+
},
|
|
494
740
|
};
|
|
495
741
|
export const ARBITRUM_BUNDLES_INFO = {
|
|
496
742
|
[Bundles.ArbitrumIds.AAVE_V3_REPAY]: {
|
|
@@ -543,6 +789,101 @@ export const ARBITRUM_BUNDLES_INFO = {
|
|
|
543
789
|
strategyId: Strategies.Identifiers.Boost,
|
|
544
790
|
protocol: PROTOCOLS.FluidT1,
|
|
545
791
|
},
|
|
792
|
+
[Bundles.ArbitrumIds.COMP_V3_SW_REPAY_ON_PRICE]: {
|
|
793
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_SW_REPAY_ON_PRICE,
|
|
794
|
+
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
795
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
796
|
+
},
|
|
797
|
+
[Bundles.ArbitrumIds.COMP_V3_SW_BOOST_ON_PRICE]: {
|
|
798
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_SW_BOOST_ON_PRICE,
|
|
799
|
+
strategyId: Strategies.Identifiers.BoostOnPrice,
|
|
800
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
801
|
+
},
|
|
802
|
+
[Bundles.ArbitrumIds.COMP_V3_SW_CLOSE]: {
|
|
803
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_SW_CLOSE,
|
|
804
|
+
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
805
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
806
|
+
},
|
|
807
|
+
[Bundles.ArbitrumIds.COMP_V3_EOA_REPAY_ON_PRICE]: {
|
|
808
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_EOA_REPAY_ON_PRICE,
|
|
809
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
810
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
811
|
+
},
|
|
812
|
+
[Bundles.ArbitrumIds.COMP_V3_EOA_BOOST_ON_PRICE]: {
|
|
813
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_EOA_BOOST_ON_PRICE,
|
|
814
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
815
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
816
|
+
},
|
|
817
|
+
[Bundles.ArbitrumIds.COMP_V3_EOA_CLOSE]: {
|
|
818
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_EOA_CLOSE,
|
|
819
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
820
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
821
|
+
},
|
|
822
|
+
[Bundles.ArbitrumIds.COMP_V3_EOA_REPAY]: {
|
|
823
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_EOA_REPAY,
|
|
824
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
825
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
826
|
+
},
|
|
827
|
+
[Bundles.ArbitrumIds.COMP_V3_EOA_BOOST]: {
|
|
828
|
+
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_EOA_BOOST,
|
|
829
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
830
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
831
|
+
},
|
|
832
|
+
[Bundles.ArbitrumIds.AAVE_V3_EOA_REPAY]: {
|
|
833
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_REPAY,
|
|
834
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
835
|
+
protocol: PROTOCOLS.AaveV3,
|
|
836
|
+
},
|
|
837
|
+
[Bundles.ArbitrumIds.AAVE_V3_EOA_BOOST]: {
|
|
838
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_BOOST,
|
|
839
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
840
|
+
protocol: PROTOCOLS.AaveV3,
|
|
841
|
+
},
|
|
842
|
+
[Bundles.ArbitrumIds.AAVE_V3_EOA_REPAY_ON_PRICE]: {
|
|
843
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_REPAY_ON_PRICE,
|
|
844
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
845
|
+
protocol: PROTOCOLS.AaveV3,
|
|
846
|
+
},
|
|
847
|
+
[Bundles.ArbitrumIds.AAVE_V3_EOA_BOOST_ON_PRICE]: {
|
|
848
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_BOOST_ON_PRICE,
|
|
849
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
850
|
+
protocol: PROTOCOLS.AaveV3,
|
|
851
|
+
},
|
|
852
|
+
[Bundles.ArbitrumIds.AAVE_V3_EOA_CLOSE]: {
|
|
853
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_CLOSE,
|
|
854
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
855
|
+
protocol: PROTOCOLS.AaveV3,
|
|
856
|
+
},
|
|
857
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_REPAY]: {
|
|
858
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_REPAY,
|
|
859
|
+
strategyId: Strategies.Identifiers.Repay,
|
|
860
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
861
|
+
},
|
|
862
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_BOOST]: {
|
|
863
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_BOOST,
|
|
864
|
+
strategyId: Strategies.Identifiers.Boost,
|
|
865
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
866
|
+
},
|
|
867
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_BOOST_ON_PRICE]: {
|
|
868
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_BOOST_ON_PRICE,
|
|
869
|
+
strategyId: Strategies.Identifiers.BoostOnPrice,
|
|
870
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
871
|
+
},
|
|
872
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_REPAY]: {
|
|
873
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_REPAY,
|
|
874
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
875
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
876
|
+
},
|
|
877
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_BOOST]: {
|
|
878
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_BOOST,
|
|
879
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
880
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
881
|
+
},
|
|
882
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_CLOSE]: {
|
|
883
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_CLOSE,
|
|
884
|
+
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
885
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
886
|
+
},
|
|
546
887
|
};
|
|
547
888
|
export const BUNDLES_INFO = {
|
|
548
889
|
[ChainId.Ethereum]: MAINNET_BUNDLES_INFO,
|
package/esm/index.d.ts
CHANGED
|
@@ -13,11 +13,12 @@ import * as strategiesService from './services/strategiesService';
|
|
|
13
13
|
import * as constants from './constants';
|
|
14
14
|
import * as enums from './types/enums';
|
|
15
15
|
import type * as types from './types';
|
|
16
|
-
import { getRatioStateInfoForAaveCloseStrategy, compareSubHashes, encodeSubId } from './services/utils';
|
|
16
|
+
import { getRatioStateInfoForAaveCloseStrategy, compareSubHashes, encodeSubId, getCloseStrategyType } from './services/utils';
|
|
17
17
|
declare const utils: {
|
|
18
18
|
getRatioStateInfoForAaveCloseStrategy: typeof getRatioStateInfoForAaveCloseStrategy;
|
|
19
19
|
compareSubHashes: typeof compareSubHashes;
|
|
20
20
|
encodeSubId: typeof encodeSubId;
|
|
21
|
+
getCloseStrategyType: typeof getCloseStrategyType;
|
|
21
22
|
};
|
|
22
23
|
export { LegacyMakerAutomation, LegacyAaveAutomation, LegacyCompoundAutomation, EthereumStrategies, OptimismStrategies, ArbitrumStrategies, BaseStrategies, triggerService, subDataService, strategySubService, utils, enums, constants, strategiesService, };
|
|
23
24
|
export type { types };
|
package/esm/index.js
CHANGED
|
@@ -16,8 +16,8 @@ import * as strategySubService from './services/strategySubService';
|
|
|
16
16
|
import * as strategiesService from './services/strategiesService';
|
|
17
17
|
import * as constants from './constants';
|
|
18
18
|
import * as enums from './types/enums';
|
|
19
|
-
import { getRatioStateInfoForAaveCloseStrategy, compareSubHashes, encodeSubId } from './services/utils';
|
|
19
|
+
import { getRatioStateInfoForAaveCloseStrategy, compareSubHashes, encodeSubId, getCloseStrategyType, } from './services/utils';
|
|
20
20
|
const utils = {
|
|
21
|
-
getRatioStateInfoForAaveCloseStrategy, compareSubHashes, encodeSubId,
|
|
21
|
+
getRatioStateInfoForAaveCloseStrategy, compareSubHashes, encodeSubId, getCloseStrategyType,
|
|
22
22
|
};
|
|
23
23
|
export { LegacyMakerAutomation, LegacyAaveAutomation, LegacyCompoundAutomation, EthereumStrategies, OptimismStrategies, ArbitrumStrategies, BaseStrategies, triggerService, subDataService, strategySubService, utils, enums, constants, strategiesService, };
|
|
@@ -13,20 +13,27 @@ import { addToObjectIf, isDefined } from './utils';
|
|
|
13
13
|
export function multicall(web3, chainId, calls, block = 'latest') {
|
|
14
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
15
|
const multicallContract = makeUniMulticallContract(web3, chainId).contract;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
formattedResult = [
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
const MAX_CALLS_PER_BATCH = 1000;
|
|
17
|
+
const allResults = [];
|
|
18
|
+
// Process each chunk
|
|
19
|
+
for (let i = 0; i < calls.length; i += MAX_CALLS_PER_BATCH) {
|
|
20
|
+
const chunk = calls.slice(i, i + MAX_CALLS_PER_BATCH);
|
|
21
|
+
const formattedCalls = chunk.map((call) => ({
|
|
22
|
+
callData: AbiCoder.encodeFunctionCall(call.abiItem, call.params),
|
|
23
|
+
target: call.target || '0x0',
|
|
24
|
+
gasLimit: call.gasLimit || 1e6,
|
|
25
|
+
}));
|
|
26
|
+
const callResult = yield multicallContract.methods.multicall(formattedCalls).call({}, block);
|
|
27
|
+
let formattedResult = [];
|
|
28
|
+
callResult.returnData.forEach(([success, , result], j) => {
|
|
29
|
+
const formattedRes = (success && result !== '0x'
|
|
30
|
+
? AbiCoder.decodeParameters(chunk[j].abiItem.outputs, result)
|
|
31
|
+
: undefined);
|
|
32
|
+
formattedResult = [...formattedResult, formattedRes];
|
|
33
|
+
});
|
|
34
|
+
allResults.push(...formattedResult);
|
|
35
|
+
}
|
|
36
|
+
return allResults;
|
|
30
37
|
});
|
|
31
38
|
}
|
|
32
39
|
export function getEventsFromContract(contractWithMeta, contractWithMetaFork, event, options) {
|
|
@@ -96,6 +96,7 @@ describe('Feature: ethereumService.ts', () => {
|
|
|
96
96
|
'address': '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0',
|
|
97
97
|
'blockHash': '0xb92cab2569456dbfbdb853d2c67d72c9a7580543dbcb55d483a77322b40755a4',
|
|
98
98
|
'blockNumber': 15166163,
|
|
99
|
+
'blockTimestamp': '0x62d53ad8',
|
|
99
100
|
'event': 'Transfer',
|
|
100
101
|
'id': 'log_e2258e3a',
|
|
101
102
|
'logIndex': 385,
|
|
@@ -141,6 +142,7 @@ describe('Feature: ethereumService.ts', () => {
|
|
|
141
142
|
'address': '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
142
143
|
'blockHash': '0xacb0213af63b4c17c436f084a96d1ac385641a59a9a4cf014ae3337cbe545aa7',
|
|
143
144
|
'blockNumber': 5353002,
|
|
145
|
+
'blockTimestamp': '0x624c1a5b',
|
|
144
146
|
'event': 'Transfer',
|
|
145
147
|
'id': 'log_f49645b8',
|
|
146
148
|
'logIndex': 1,
|
|
@@ -186,6 +188,7 @@ describe('Feature: ethereumService.ts', () => {
|
|
|
186
188
|
'address': '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
187
189
|
'blockHash': '0xacb0213af63b4c17c436f084a96d1ac385641a59a9a4cf014ae3337cbe545aa7',
|
|
188
190
|
'blockNumber': 5353002,
|
|
191
|
+
'blockTimestamp': '0x624c1a5b',
|
|
189
192
|
'event': 'Transfer',
|
|
190
193
|
'id': 'log_f49645b8',
|
|
191
194
|
'logIndex': 1,
|