@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.
- package/cjs/constants/index.js +40 -60
- package/cjs/services/strategiesService.js +21 -16
- package/cjs/services/strategiesService.test.js +62 -92
- package/cjs/services/strategySubService.d.ts +1 -2
- package/cjs/services/strategySubService.js +7 -12
- package/cjs/services/strategySubService.test.js +111 -107
- package/cjs/services/subDataService.d.ts +12 -22
- package/cjs/services/subDataService.js +35 -61
- package/cjs/services/subDataService.test.js +70 -139
- package/cjs/types/enums.d.ts +18 -22
- package/cjs/types/enums.js +11 -14
- package/esm/constants/index.js +40 -60
- package/esm/services/strategiesService.js +21 -16
- package/esm/services/strategiesService.test.js +63 -93
- package/esm/services/strategySubService.d.ts +1 -2
- package/esm/services/strategySubService.js +7 -12
- package/esm/services/strategySubService.test.js +111 -107
- package/esm/services/subDataService.d.ts +12 -22
- package/esm/services/subDataService.js +33 -59
- package/esm/services/subDataService.test.js +70 -139
- package/esm/types/enums.d.ts +18 -22
- package/esm/types/enums.js +11 -14
- package/package.json +1 -1
- package/src/constants/index.ts +40 -60
- package/src/services/strategiesService.test.ts +78 -102
- package/src/services/strategiesService.ts +27 -16
- package/src/services/strategySubService.test.ts +125 -126
- package/src/services/strategySubService.ts +18 -38
- package/src/services/subDataService.test.ts +98 -149
- package/src/services/subDataService.ts +48 -88
- package/src/types/enums.ts +11 -14
|
@@ -535,145 +535,6 @@ describe('Feature: subDataService.ts', () => {
|
|
|
535
535
|
});
|
|
536
536
|
});
|
|
537
537
|
});
|
|
538
|
-
describe('When testing subDataService.aaveV3DebtSwitchSubData', () => {
|
|
539
|
-
describe('encode()', () => {
|
|
540
|
-
const examples = [
|
|
541
|
-
// USDC -> DAI
|
|
542
|
-
[
|
|
543
|
-
[
|
|
544
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
545
|
-
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
546
|
-
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
547
|
-
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
548
|
-
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
549
|
-
'0x0000000000000000000000000000000000000000000000008ac7230489e80000',
|
|
550
|
-
'0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
|
|
551
|
-
],
|
|
552
|
-
[
|
|
553
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
554
|
-
1,
|
|
555
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
556
|
-
3,
|
|
557
|
-
web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
|
|
558
|
-
'10000000000000000000',
|
|
559
|
-
web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
|
|
560
|
-
]
|
|
561
|
-
],
|
|
562
|
-
// DAI -> USDC (MaxUint256)
|
|
563
|
-
[
|
|
564
|
-
[
|
|
565
|
-
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
566
|
-
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
567
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
568
|
-
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
569
|
-
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
570
|
-
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
|
|
571
|
-
'0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
|
|
572
|
-
],
|
|
573
|
-
[
|
|
574
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
575
|
-
3,
|
|
576
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
577
|
-
1,
|
|
578
|
-
web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
|
|
579
|
-
tokens_2.MAXUINT,
|
|
580
|
-
web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
|
|
581
|
-
]
|
|
582
|
-
],
|
|
583
|
-
];
|
|
584
|
-
examples.forEach(([expected, actual]) => {
|
|
585
|
-
it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
586
|
-
(0, chai_1.expect)(subDataService.aaveV3DebtSwitchSubData.encode(...actual)).to.eql(expected);
|
|
587
|
-
});
|
|
588
|
-
});
|
|
589
|
-
});
|
|
590
|
-
describe('decode()', () => {
|
|
591
|
-
const examples = [
|
|
592
|
-
// USDC -> DAI
|
|
593
|
-
[
|
|
594
|
-
{
|
|
595
|
-
fromAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
596
|
-
fromAssetId: 1,
|
|
597
|
-
toAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
598
|
-
toAssetId: 3,
|
|
599
|
-
marketAddr: web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
|
|
600
|
-
amountToSwitch: '10000000000000000000',
|
|
601
|
-
user: web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
|
|
602
|
-
},
|
|
603
|
-
[
|
|
604
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
605
|
-
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
606
|
-
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
607
|
-
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
608
|
-
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
609
|
-
'0x0000000000000000000000000000000000000000000000008ac7230489e80000',
|
|
610
|
-
'0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
|
|
611
|
-
],
|
|
612
|
-
],
|
|
613
|
-
// DAI -> USDC (MaxUint256)
|
|
614
|
-
[
|
|
615
|
-
{
|
|
616
|
-
fromAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
617
|
-
fromAssetId: 3,
|
|
618
|
-
toAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
619
|
-
toAssetId: 1,
|
|
620
|
-
marketAddr: web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
|
|
621
|
-
amountToSwitch: tokens_2.MAXUINT,
|
|
622
|
-
user: web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
|
|
623
|
-
},
|
|
624
|
-
[
|
|
625
|
-
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
626
|
-
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
627
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
628
|
-
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
629
|
-
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
630
|
-
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
|
|
631
|
-
'0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
|
|
632
|
-
],
|
|
633
|
-
],
|
|
634
|
-
];
|
|
635
|
-
examples.forEach(([expected, actual]) => {
|
|
636
|
-
it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
637
|
-
(0, chai_1.expect)(subDataService.aaveV3DebtSwitchSubData.decode(actual)).to.eql(expected);
|
|
638
|
-
});
|
|
639
|
-
});
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
describe('When testing subDataService.aaveV3GenericFLCollateralSwitchSubData', () => {
|
|
643
|
-
const fromAsset = web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address);
|
|
644
|
-
const toAsset = web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address);
|
|
645
|
-
const marketAddr = web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39');
|
|
646
|
-
const user = web3Utils.toChecksumAddress('0x1234567890abcdef1234567890abcdef12345678');
|
|
647
|
-
const examples = [
|
|
648
|
-
['10000000000000000000', '0x0000000000000000000000000000000000000000000000008ac7230489e80000'],
|
|
649
|
-
[tokens_2.MAXUINT, '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'],
|
|
650
|
-
];
|
|
651
|
-
examples.forEach(([amountToSwitch, encodedAmount]) => {
|
|
652
|
-
const subData = [
|
|
653
|
-
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
654
|
-
'0x0000000000000000000000000000000000000000000000000000000000000100',
|
|
655
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
656
|
-
'0x000000000000000000000000000000000000000000000000000000000000ffff',
|
|
657
|
-
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
658
|
-
encodedAmount,
|
|
659
|
-
'0x0000000000000000000000001234567890abcdef1234567890abcdef12345678',
|
|
660
|
-
];
|
|
661
|
-
it(`encode() preserves uint16 asset IDs and user when switching ${amountToSwitch}`, () => {
|
|
662
|
-
(0, chai_1.expect)(subDataService.aaveV3GenericFLCollateralSwitchSubData.encode(fromAsset, 256, toAsset, 65535, marketAddr, amountToSwitch, user)).to.eql(subData);
|
|
663
|
-
});
|
|
664
|
-
it(`decode() preserves uint16 asset IDs and user when switching ${amountToSwitch}`, () => {
|
|
665
|
-
(0, chai_1.expect)(subDataService.aaveV3GenericFLCollateralSwitchSubData.decode(subData)).to.eql({
|
|
666
|
-
fromAsset,
|
|
667
|
-
fromAssetId: 256,
|
|
668
|
-
toAsset,
|
|
669
|
-
toAssetId: 65535,
|
|
670
|
-
marketAddr,
|
|
671
|
-
amountToSwitch,
|
|
672
|
-
user,
|
|
673
|
-
});
|
|
674
|
-
});
|
|
675
|
-
});
|
|
676
|
-
});
|
|
677
538
|
describe('When testing subDataService.sparkCollateralSwitchSubData', () => {
|
|
678
539
|
describe('encode()', () => {
|
|
679
540
|
const examples = [
|
|
@@ -2420,6 +2281,76 @@ describe('Feature: subDataService.ts', () => {
|
|
|
2420
2281
|
});
|
|
2421
2282
|
});
|
|
2422
2283
|
});
|
|
2284
|
+
describe("When testing subDataService.aaveV3InstantCloseGenericSubData", () => {
|
|
2285
|
+
const WETH = web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address);
|
|
2286
|
+
const USDC = web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address);
|
|
2287
|
+
const MARKET = web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39');
|
|
2288
|
+
const USER = web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890');
|
|
2289
|
+
const examples = [
|
|
2290
|
+
// TAKE_PROFIT_IN_COLLATERAL, zero tsi and slippage
|
|
2291
|
+
[
|
|
2292
|
+
[
|
|
2293
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
2294
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
2295
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
2296
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
2297
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
2298
|
+
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
2299
|
+
'0x0000000000000000000000001234567890123456789012345678901234567890',
|
|
2300
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
2301
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
2302
|
+
],
|
|
2303
|
+
[WETH, 0, USDC, 1, enums_1.CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL, MARKET, USER, '0', '0'],
|
|
2304
|
+
],
|
|
2305
|
+
// STOP_LOSS_IN_DEBT
|
|
2306
|
+
[
|
|
2307
|
+
[
|
|
2308
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
2309
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
2310
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
2311
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
2312
|
+
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
2313
|
+
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
2314
|
+
'0x0000000000000000000000001234567890123456789012345678901234567890',
|
|
2315
|
+
'0x0000000000000000000000000000000000000000000000000de0b6b3a7640000',
|
|
2316
|
+
'0x000000000000000000000000000000000000000000000000002386f26fc10000',
|
|
2317
|
+
],
|
|
2318
|
+
[WETH, 0, USDC, 1, enums_1.CloseStrategyType.STOP_LOSS_IN_DEBT, MARKET, USER, '1000000000000000000', '10000000000000000'],
|
|
2319
|
+
],
|
|
2320
|
+
// TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL, asset ids above uint8 range
|
|
2321
|
+
[
|
|
2322
|
+
[
|
|
2323
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
2324
|
+
'0x000000000000000000000000000000000000000000000000000000000000012c',
|
|
2325
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
2326
|
+
'0x0000000000000000000000000000000000000000000000000000000000000190',
|
|
2327
|
+
'0x0000000000000000000000000000000000000000000000000000000000000007',
|
|
2328
|
+
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
2329
|
+
'0x0000000000000000000000001234567890123456789012345678901234567890',
|
|
2330
|
+
'0x00000000000000000000000000000000000000000000000000b1a2bc2ec50000',
|
|
2331
|
+
'0x0000000000000000000000000000000000000000000000000011c37937e08000',
|
|
2332
|
+
],
|
|
2333
|
+
[WETH, 300, USDC, 400, enums_1.CloseStrategyType.TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL, MARKET, USER, '50000000000000000', '5000000000000000'],
|
|
2334
|
+
],
|
|
2335
|
+
];
|
|
2336
|
+
describe("encode()", () => {
|
|
2337
|
+
examples.forEach(([expected, actual]) => {
|
|
2338
|
+
it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
2339
|
+
(0, chai_1.expect)(subDataService.aaveV3InstantCloseGenericSubData.encode(...actual)).to.eql(expected);
|
|
2340
|
+
});
|
|
2341
|
+
});
|
|
2342
|
+
});
|
|
2343
|
+
describe("decode()", () => {
|
|
2344
|
+
examples.forEach(([encoded, [collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, user, tsi, slippage]]) => {
|
|
2345
|
+
const expected = {
|
|
2346
|
+
collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, owner: user, tsi, slippage,
|
|
2347
|
+
};
|
|
2348
|
+
it(`Given ${JSON.stringify(encoded)} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
2349
|
+
(0, chai_1.expect)(subDataService.aaveV3InstantCloseGenericSubData.decode(encoded)).to.eql(expected);
|
|
2350
|
+
});
|
|
2351
|
+
});
|
|
2352
|
+
});
|
|
2353
|
+
});
|
|
2423
2354
|
describe('When testing subDataService.sparkLeverageManagementOnPriceSubData', () => {
|
|
2424
2355
|
describe('encode()', () => {
|
|
2425
2356
|
const examples = [
|
package/cjs/types/enums.d.ts
CHANGED
|
@@ -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
|
}
|
package/cjs/types/enums.js
CHANGED
|
@@ -108,36 +108,24 @@ var Strategies;
|
|
|
108
108
|
MainnetIds[MainnetIds["AAVE_V4_COLLATERAL_SWITCH_EOA"] = 155] = "AAVE_V4_COLLATERAL_SWITCH_EOA";
|
|
109
109
|
MainnetIds[MainnetIds["SPARK_COLLATERAL_SWITCH"] = 156] = "SPARK_COLLATERAL_SWITCH";
|
|
110
110
|
MainnetIds[MainnetIds["SPARK_GENERIC_FL_COLLATERAL_SWITCH"] = 167] = "SPARK_GENERIC_FL_COLLATERAL_SWITCH";
|
|
111
|
-
MainnetIds[MainnetIds["AAVE_V3_DEBT_SWITCH"] = 168] = "AAVE_V3_DEBT_SWITCH";
|
|
112
|
-
MainnetIds[MainnetIds["AAVE_V3_DEBT_SWITCH_EOA"] = 169] = "AAVE_V3_DEBT_SWITCH_EOA";
|
|
113
|
-
MainnetIds[MainnetIds["AAVE_V3_COLLATERAL_SWITCH_EOA"] = 170] = "AAVE_V3_COLLATERAL_SWITCH_EOA";
|
|
114
111
|
})(MainnetIds = Strategies.MainnetIds || (Strategies.MainnetIds = {}));
|
|
115
112
|
let OptimismIds;
|
|
116
113
|
(function (OptimismIds) {
|
|
117
114
|
OptimismIds[OptimismIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
|
|
118
115
|
OptimismIds[OptimismIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
|
|
119
116
|
OptimismIds[OptimismIds["AAVE_V3_COLLATERAL_SWITCH"] = 24] = "AAVE_V3_COLLATERAL_SWITCH";
|
|
120
|
-
OptimismIds[OptimismIds["AAVE_V3_DEBT_SWITCH"] = 25] = "AAVE_V3_DEBT_SWITCH";
|
|
121
|
-
OptimismIds[OptimismIds["AAVE_V3_DEBT_SWITCH_EOA"] = 26] = "AAVE_V3_DEBT_SWITCH_EOA";
|
|
122
|
-
OptimismIds[OptimismIds["AAVE_V3_COLLATERAL_SWITCH_EOA"] = 27] = "AAVE_V3_COLLATERAL_SWITCH_EOA";
|
|
123
117
|
})(OptimismIds = Strategies.OptimismIds || (Strategies.OptimismIds = {}));
|
|
124
118
|
let BaseIds;
|
|
125
119
|
(function (BaseIds) {
|
|
126
120
|
BaseIds[BaseIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
|
|
127
121
|
BaseIds[BaseIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
|
|
128
122
|
BaseIds[BaseIds["AAVE_V3_COLLATERAL_SWITCH"] = 56] = "AAVE_V3_COLLATERAL_SWITCH";
|
|
129
|
-
BaseIds[BaseIds["AAVE_V3_DEBT_SWITCH"] = 61] = "AAVE_V3_DEBT_SWITCH";
|
|
130
|
-
BaseIds[BaseIds["AAVE_V3_DEBT_SWITCH_EOA"] = 62] = "AAVE_V3_DEBT_SWITCH_EOA";
|
|
131
|
-
BaseIds[BaseIds["AAVE_V3_COLLATERAL_SWITCH_EOA"] = 63] = "AAVE_V3_COLLATERAL_SWITCH_EOA";
|
|
132
123
|
})(BaseIds = Strategies.BaseIds || (Strategies.BaseIds = {}));
|
|
133
124
|
let ArbitrumIds;
|
|
134
125
|
(function (ArbitrumIds) {
|
|
135
126
|
ArbitrumIds[ArbitrumIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
|
|
136
127
|
ArbitrumIds[ArbitrumIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
|
|
137
128
|
ArbitrumIds[ArbitrumIds["AAVE_V3_COLLATERAL_SWITCH"] = 50] = "AAVE_V3_COLLATERAL_SWITCH";
|
|
138
|
-
ArbitrumIds[ArbitrumIds["AAVE_V3_DEBT_SWITCH"] = 55] = "AAVE_V3_DEBT_SWITCH";
|
|
139
|
-
ArbitrumIds[ArbitrumIds["AAVE_V3_DEBT_SWITCH_EOA"] = 56] = "AAVE_V3_DEBT_SWITCH_EOA";
|
|
140
|
-
ArbitrumIds[ArbitrumIds["AAVE_V3_COLLATERAL_SWITCH_EOA"] = 57] = "AAVE_V3_COLLATERAL_SWITCH_EOA";
|
|
141
129
|
})(ArbitrumIds = Strategies.ArbitrumIds || (Strategies.ArbitrumIds = {}));
|
|
142
130
|
let Identifiers;
|
|
143
131
|
(function (Identifiers) {
|
|
@@ -156,6 +144,8 @@ var Strategies;
|
|
|
156
144
|
Identifiers["CloseOnPriceToColl"] = "close-on-price-to-collateral";
|
|
157
145
|
Identifiers["CloseOnPrice"] = "close-on-price";
|
|
158
146
|
Identifiers["EoaCloseOnPrice"] = "eoa-close-on-price";
|
|
147
|
+
Identifiers["InstantCloseOnPrice"] = "instant-close-on-price";
|
|
148
|
+
Identifiers["EoaInstantCloseOnPrice"] = "eoa-instant-close-on-price";
|
|
159
149
|
Identifiers["TrailingStopToColl"] = "trailing-stop-to-collateral";
|
|
160
150
|
Identifiers["TrailingStopToDebt"] = "trailing-stop-to-debt";
|
|
161
151
|
Identifiers["Rebond"] = "rebond";
|
|
@@ -172,8 +162,6 @@ var Strategies;
|
|
|
172
162
|
Identifiers["EoaRepayOnPrice"] = "eoa-repay-on-price";
|
|
173
163
|
Identifiers["CollateralSwitch"] = "collateral-switch";
|
|
174
164
|
Identifiers["EoaCollateralSwitch"] = "eoa-collateral-switch";
|
|
175
|
-
Identifiers["DebtSwitch"] = "debt-switch";
|
|
176
|
-
Identifiers["EoaDebtSwitch"] = "eoa-debt-switch";
|
|
177
165
|
Identifiers["LiquidationProtection"] = "liquidation-protection";
|
|
178
166
|
Identifiers["EoaLiquidationProtection"] = "liquidation-protection-eoa";
|
|
179
167
|
})(Identifiers = Strategies.Identifiers || (Strategies.Identifiers = {}));
|
|
@@ -288,6 +276,8 @@ var Bundles;
|
|
|
288
276
|
MainnetIds[MainnetIds["SPARK_EOA_BOOST_ON_PRICE"] = 91] = "SPARK_EOA_BOOST_ON_PRICE";
|
|
289
277
|
MainnetIds[MainnetIds["SPARK_EOA_CLOSE"] = 92] = "SPARK_EOA_CLOSE";
|
|
290
278
|
MainnetIds[MainnetIds["SPARK_EOA_LIQUIDATION_PROTECTION"] = 93] = "SPARK_EOA_LIQUIDATION_PROTECTION";
|
|
279
|
+
MainnetIds[MainnetIds["AAVE_V3_SW_INSTANT_CLOSE"] = 94] = "AAVE_V3_SW_INSTANT_CLOSE";
|
|
280
|
+
MainnetIds[MainnetIds["AAVE_V3_EOA_INSTANT_CLOSE"] = 95] = "AAVE_V3_EOA_INSTANT_CLOSE";
|
|
291
281
|
})(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
|
|
292
282
|
let OptimismIds;
|
|
293
283
|
(function (OptimismIds) {
|
|
@@ -304,6 +294,9 @@ var Bundles;
|
|
|
304
294
|
OptimismIds[OptimismIds["AAVE_V3_EOA_CLOSE"] = 10] = "AAVE_V3_EOA_CLOSE";
|
|
305
295
|
OptimismIds[OptimismIds["AAVE_V3_SW_LIQUIDATION_PROTECTION"] = 11] = "AAVE_V3_SW_LIQUIDATION_PROTECTION";
|
|
306
296
|
OptimismIds[OptimismIds["AAVE_V3_EOA_LIQUIDATION_PROTECTION"] = 12] = "AAVE_V3_EOA_LIQUIDATION_PROTECTION";
|
|
297
|
+
// TODO -> Fix ids
|
|
298
|
+
OptimismIds[OptimismIds["AAVE_V3_SW_INSTANT_CLOSE"] = 13] = "AAVE_V3_SW_INSTANT_CLOSE";
|
|
299
|
+
OptimismIds[OptimismIds["AAVE_V3_EOA_INSTANT_CLOSE"] = 14] = "AAVE_V3_EOA_INSTANT_CLOSE";
|
|
307
300
|
})(OptimismIds = Bundles.OptimismIds || (Bundles.OptimismIds = {}));
|
|
308
301
|
let BaseIds;
|
|
309
302
|
(function (BaseIds) {
|
|
@@ -347,6 +340,8 @@ var Bundles;
|
|
|
347
340
|
BaseIds[BaseIds["MORPHO_BLUE_EOA_REPAY_ON_PRICE"] = 40] = "MORPHO_BLUE_EOA_REPAY_ON_PRICE";
|
|
348
341
|
BaseIds[BaseIds["MORPHO_BLUE_EOA_CLOSE"] = 41] = "MORPHO_BLUE_EOA_CLOSE";
|
|
349
342
|
BaseIds[BaseIds["MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION"] = 42] = "MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION";
|
|
343
|
+
BaseIds[BaseIds["AAVE_V3_SW_INSTANT_CLOSE"] = 43] = "AAVE_V3_SW_INSTANT_CLOSE";
|
|
344
|
+
BaseIds[BaseIds["AAVE_V3_EOA_INSTANT_CLOSE"] = 44] = "AAVE_V3_EOA_INSTANT_CLOSE";
|
|
350
345
|
})(BaseIds = Bundles.BaseIds || (Bundles.BaseIds = {}));
|
|
351
346
|
let ArbitrumIds;
|
|
352
347
|
(function (ArbitrumIds) {
|
|
@@ -390,5 +385,7 @@ var Bundles;
|
|
|
390
385
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_BOOST_ON_PRICE"] = 37] = "MORPHO_BLUE_EOA_BOOST_ON_PRICE";
|
|
391
386
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_REPAY_ON_PRICE"] = 38] = "MORPHO_BLUE_EOA_REPAY_ON_PRICE";
|
|
392
387
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_CLOSE"] = 39] = "MORPHO_BLUE_EOA_CLOSE";
|
|
388
|
+
ArbitrumIds[ArbitrumIds["AAVE_V3_SW_INSTANT_CLOSE"] = 40] = "AAVE_V3_SW_INSTANT_CLOSE";
|
|
389
|
+
ArbitrumIds[ArbitrumIds["AAVE_V3_EOA_INSTANT_CLOSE"] = 41] = "AAVE_V3_EOA_INSTANT_CLOSE";
|
|
393
390
|
})(ArbitrumIds = Bundles.ArbitrumIds || (Bundles.ArbitrumIds = {}));
|
|
394
391
|
})(Bundles = exports.Bundles || (exports.Bundles = {}));
|
package/esm/constants/index.js
CHANGED
|
@@ -101,11 +101,6 @@ export const MAINNET_STRATEGIES_INFO = {
|
|
|
101
101
|
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
102
102
|
protocol: PROTOCOLS.AaveV3,
|
|
103
103
|
},
|
|
104
|
-
[Strategies.MainnetIds.AAVE_V3_COLLATERAL_SWITCH_EOA]: {
|
|
105
|
-
strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_COLLATERAL_SWITCH_EOA,
|
|
106
|
-
strategyId: Strategies.Identifiers.EoaCollateralSwitch,
|
|
107
|
-
protocol: PROTOCOLS.AaveV3,
|
|
108
|
-
},
|
|
109
104
|
[Strategies.MainnetIds.AAVE_V4_COLLATERAL_SWITCH]: {
|
|
110
105
|
strategyOrBundleId: Strategies.MainnetIds.AAVE_V4_COLLATERAL_SWITCH,
|
|
111
106
|
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
@@ -126,16 +121,6 @@ export const MAINNET_STRATEGIES_INFO = {
|
|
|
126
121
|
strategyId: Strategies.Identifiers.EoaCollateralSwitch,
|
|
127
122
|
protocol: PROTOCOLS.Spark,
|
|
128
123
|
},
|
|
129
|
-
[Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH]: {
|
|
130
|
-
strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH,
|
|
131
|
-
strategyId: Strategies.Identifiers.DebtSwitch,
|
|
132
|
-
protocol: PROTOCOLS.AaveV3,
|
|
133
|
-
},
|
|
134
|
-
[Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH_EOA]: {
|
|
135
|
-
strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH_EOA,
|
|
136
|
-
strategyId: Strategies.Identifiers.EoaDebtSwitch,
|
|
137
|
-
protocol: PROTOCOLS.AaveV3,
|
|
138
|
-
},
|
|
139
124
|
};
|
|
140
125
|
export const OPTIMISM_STRATEGIES_INFO = {
|
|
141
126
|
[Strategies.OptimismIds.EXCHANGE_DCA]: {
|
|
@@ -153,21 +138,6 @@ export const OPTIMISM_STRATEGIES_INFO = {
|
|
|
153
138
|
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
154
139
|
protocol: PROTOCOLS.AaveV3,
|
|
155
140
|
},
|
|
156
|
-
[Strategies.OptimismIds.AAVE_V3_COLLATERAL_SWITCH_EOA]: {
|
|
157
|
-
strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_COLLATERAL_SWITCH_EOA,
|
|
158
|
-
strategyId: Strategies.Identifiers.EoaCollateralSwitch,
|
|
159
|
-
protocol: PROTOCOLS.AaveV3,
|
|
160
|
-
},
|
|
161
|
-
[Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH]: {
|
|
162
|
-
strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH,
|
|
163
|
-
strategyId: Strategies.Identifiers.DebtSwitch,
|
|
164
|
-
protocol: PROTOCOLS.AaveV3,
|
|
165
|
-
},
|
|
166
|
-
[Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH_EOA]: {
|
|
167
|
-
strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH_EOA,
|
|
168
|
-
strategyId: Strategies.Identifiers.EoaDebtSwitch,
|
|
169
|
-
protocol: PROTOCOLS.AaveV3,
|
|
170
|
-
},
|
|
171
141
|
};
|
|
172
142
|
export const BASE_STRATEGIES_INFO = {
|
|
173
143
|
[Strategies.BaseIds.EXCHANGE_DCA]: {
|
|
@@ -185,21 +155,6 @@ export const BASE_STRATEGIES_INFO = {
|
|
|
185
155
|
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
186
156
|
protocol: PROTOCOLS.AaveV3,
|
|
187
157
|
},
|
|
188
|
-
[Strategies.BaseIds.AAVE_V3_COLLATERAL_SWITCH_EOA]: {
|
|
189
|
-
strategyOrBundleId: Strategies.BaseIds.AAVE_V3_COLLATERAL_SWITCH_EOA,
|
|
190
|
-
strategyId: Strategies.Identifiers.EoaCollateralSwitch,
|
|
191
|
-
protocol: PROTOCOLS.AaveV3,
|
|
192
|
-
},
|
|
193
|
-
[Strategies.BaseIds.AAVE_V3_DEBT_SWITCH]: {
|
|
194
|
-
strategyOrBundleId: Strategies.BaseIds.AAVE_V3_DEBT_SWITCH,
|
|
195
|
-
strategyId: Strategies.Identifiers.DebtSwitch,
|
|
196
|
-
protocol: PROTOCOLS.AaveV3,
|
|
197
|
-
},
|
|
198
|
-
[Strategies.BaseIds.AAVE_V3_DEBT_SWITCH_EOA]: {
|
|
199
|
-
strategyOrBundleId: Strategies.BaseIds.AAVE_V3_DEBT_SWITCH_EOA,
|
|
200
|
-
strategyId: Strategies.Identifiers.EoaDebtSwitch,
|
|
201
|
-
protocol: PROTOCOLS.AaveV3,
|
|
202
|
-
},
|
|
203
158
|
};
|
|
204
159
|
export const ARBITRUM_STRATEGIES_INFO = {
|
|
205
160
|
[Strategies.ArbitrumIds.EXCHANGE_DCA]: {
|
|
@@ -217,21 +172,6 @@ export const ARBITRUM_STRATEGIES_INFO = {
|
|
|
217
172
|
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
218
173
|
protocol: PROTOCOLS.AaveV3,
|
|
219
174
|
},
|
|
220
|
-
[Strategies.ArbitrumIds.AAVE_V3_COLLATERAL_SWITCH_EOA]: {
|
|
221
|
-
strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_COLLATERAL_SWITCH_EOA,
|
|
222
|
-
strategyId: Strategies.Identifiers.EoaCollateralSwitch,
|
|
223
|
-
protocol: PROTOCOLS.AaveV3,
|
|
224
|
-
},
|
|
225
|
-
[Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH]: {
|
|
226
|
-
strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH,
|
|
227
|
-
strategyId: Strategies.Identifiers.DebtSwitch,
|
|
228
|
-
protocol: PROTOCOLS.AaveV3,
|
|
229
|
-
},
|
|
230
|
-
[Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH_EOA]: {
|
|
231
|
-
strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH_EOA,
|
|
232
|
-
strategyId: Strategies.Identifiers.EoaDebtSwitch,
|
|
233
|
-
protocol: PROTOCOLS.AaveV3,
|
|
234
|
-
},
|
|
235
175
|
};
|
|
236
176
|
export const STRATEGIES_INFO = {
|
|
237
177
|
[ChainId.Ethereum]: MAINNET_STRATEGIES_INFO,
|
|
@@ -713,6 +653,16 @@ export const MAINNET_BUNDLES_INFO = {
|
|
|
713
653
|
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
714
654
|
protocol: PROTOCOLS.Spark,
|
|
715
655
|
},
|
|
656
|
+
[Bundles.MainnetIds.AAVE_V3_SW_INSTANT_CLOSE]: {
|
|
657
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_SW_INSTANT_CLOSE,
|
|
658
|
+
strategyId: Strategies.Identifiers.InstantCloseOnPrice,
|
|
659
|
+
protocol: PROTOCOLS.AaveV3,
|
|
660
|
+
},
|
|
661
|
+
[Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE]: {
|
|
662
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
663
|
+
strategyId: Strategies.Identifiers.EoaInstantCloseOnPrice,
|
|
664
|
+
protocol: PROTOCOLS.AaveV3,
|
|
665
|
+
},
|
|
716
666
|
};
|
|
717
667
|
export const OPTIMISM_BUNDLES_INFO = {
|
|
718
668
|
[Bundles.OptimismIds.AAVE_V3_REPAY]: {
|
|
@@ -780,6 +730,16 @@ export const OPTIMISM_BUNDLES_INFO = {
|
|
|
780
730
|
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
781
731
|
protocol: PROTOCOLS.AaveV3,
|
|
782
732
|
},
|
|
733
|
+
[Bundles.OptimismIds.AAVE_V3_SW_INSTANT_CLOSE]: {
|
|
734
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_SW_INSTANT_CLOSE,
|
|
735
|
+
strategyId: Strategies.Identifiers.InstantCloseOnPrice,
|
|
736
|
+
protocol: PROTOCOLS.AaveV3,
|
|
737
|
+
},
|
|
738
|
+
[Bundles.OptimismIds.AAVE_V3_EOA_INSTANT_CLOSE]: {
|
|
739
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
740
|
+
strategyId: Strategies.Identifiers.EoaInstantCloseOnPrice,
|
|
741
|
+
protocol: PROTOCOLS.AaveV3,
|
|
742
|
+
},
|
|
783
743
|
};
|
|
784
744
|
export const BASE_BUNDLES_INFO = {
|
|
785
745
|
[Bundles.BaseIds.AAVE_V3_REPAY]: {
|
|
@@ -982,6 +942,16 @@ export const BASE_BUNDLES_INFO = {
|
|
|
982
942
|
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
983
943
|
protocol: PROTOCOLS.MorphoBlue,
|
|
984
944
|
},
|
|
945
|
+
[Bundles.BaseIds.AAVE_V3_SW_INSTANT_CLOSE]: {
|
|
946
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_SW_INSTANT_CLOSE,
|
|
947
|
+
strategyId: Strategies.Identifiers.InstantCloseOnPrice,
|
|
948
|
+
protocol: PROTOCOLS.AaveV3,
|
|
949
|
+
},
|
|
950
|
+
[Bundles.BaseIds.AAVE_V3_EOA_INSTANT_CLOSE]: {
|
|
951
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
952
|
+
strategyId: Strategies.Identifiers.EoaInstantCloseOnPrice,
|
|
953
|
+
protocol: PROTOCOLS.AaveV3,
|
|
954
|
+
},
|
|
985
955
|
};
|
|
986
956
|
export const ARBITRUM_BUNDLES_INFO = {
|
|
987
957
|
[Bundles.ArbitrumIds.AAVE_V3_REPAY]: {
|
|
@@ -1184,6 +1154,16 @@ export const ARBITRUM_BUNDLES_INFO = {
|
|
|
1184
1154
|
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
1185
1155
|
protocol: PROTOCOLS.MorphoBlue,
|
|
1186
1156
|
},
|
|
1157
|
+
[Bundles.ArbitrumIds.AAVE_V3_SW_INSTANT_CLOSE]: {
|
|
1158
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_SW_INSTANT_CLOSE,
|
|
1159
|
+
strategyId: Strategies.Identifiers.InstantCloseOnPrice,
|
|
1160
|
+
protocol: PROTOCOLS.AaveV3,
|
|
1161
|
+
},
|
|
1162
|
+
[Bundles.ArbitrumIds.AAVE_V3_EOA_INSTANT_CLOSE]: {
|
|
1163
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
1164
|
+
strategyId: Strategies.Identifiers.EoaInstantCloseOnPrice,
|
|
1165
|
+
protocol: PROTOCOLS.AaveV3,
|
|
1166
|
+
},
|
|
1187
1167
|
};
|
|
1188
1168
|
export const BUNDLES_INFO = {
|
|
1189
1169
|
[ChainId.Ethereum]: MAINNET_BUNDLES_INFO,
|
|
@@ -317,30 +317,36 @@ function parseAaveV3CloseOnPrice(position, parseData) {
|
|
|
317
317
|
}
|
|
318
318
|
return _position;
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function parseAaveV3InstantCloseOnPrice(position, parseData) {
|
|
321
321
|
const _position = cloneDeep(position);
|
|
322
322
|
const { subStruct } = parseData.subscriptionEventData;
|
|
323
|
-
const
|
|
324
|
-
const
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
: subDataService.aaveV3CollateralSwitchSubData.decode(subStruct.subData);
|
|
323
|
+
const triggerData = triggerService.aaveV3QuotePriceRangeTrigger.decode(subStruct.triggerData);
|
|
324
|
+
const subData = subDataService.aaveV3InstantCloseGenericSubData.decode(subStruct.subData);
|
|
325
|
+
const { takeProfitType, stopLossType } = getStopLossAndTakeProfitTypeByCloseStrategyType(+subData.closeType);
|
|
326
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, AAVE_V3_MARKET_ADDRESSES[_position.chainId]);
|
|
328
327
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
329
328
|
_position.strategyData.decoded.subData = subData;
|
|
330
|
-
_position.
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
:
|
|
329
|
+
_position.specific = {
|
|
330
|
+
collAsset: subData.collAsset,
|
|
331
|
+
collAssetId: subData.collAssetId,
|
|
332
|
+
debtAsset: subData.debtAsset,
|
|
333
|
+
debtAssetId: subData.debtAssetId,
|
|
334
|
+
baseToken: triggerData.collToken,
|
|
335
|
+
quoteToken: triggerData.debtToken,
|
|
336
|
+
stopLossPrice: triggerData.lowerPrice,
|
|
337
|
+
takeProfitPrice: triggerData.upperPrice,
|
|
338
|
+
stopLossType,
|
|
339
|
+
takeProfitType,
|
|
340
|
+
};
|
|
334
341
|
return _position;
|
|
335
342
|
}
|
|
336
|
-
function
|
|
343
|
+
function parseAaveV3CollateralSwitch(position, parseData) {
|
|
337
344
|
const _position = cloneDeep(position);
|
|
338
345
|
const { subStruct } = parseData.subscriptionEventData;
|
|
339
346
|
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
340
|
-
const subData = subDataService.
|
|
347
|
+
const subData = subDataService.aaveV3CollateralSwitchSubData.decode(subStruct.subData);
|
|
341
348
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
342
349
|
_position.strategyData.decoded.subData = subData;
|
|
343
|
-
// TODO -> This isn't enough for ID
|
|
344
350
|
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, subData.marketAddr);
|
|
345
351
|
return _position;
|
|
346
352
|
}
|
|
@@ -1233,10 +1239,9 @@ const parsingMethodsMapping = {
|
|
|
1233
1239
|
[Strategies.Identifiers.EoaRepayOnPrice]: parseAaveV3LeverageManagementOnPrice,
|
|
1234
1240
|
[Strategies.Identifiers.EoaBoostOnPrice]: parseAaveV3LeverageManagementOnPrice,
|
|
1235
1241
|
[Strategies.Identifiers.EoaCloseOnPrice]: parseAaveV3CloseOnPrice,
|
|
1242
|
+
[Strategies.Identifiers.InstantCloseOnPrice]: parseAaveV3InstantCloseOnPrice,
|
|
1243
|
+
[Strategies.Identifiers.EoaInstantCloseOnPrice]: parseAaveV3InstantCloseOnPrice,
|
|
1236
1244
|
[Strategies.Identifiers.CollateralSwitch]: parseAaveV3CollateralSwitch,
|
|
1237
|
-
[Strategies.Identifiers.EoaCollateralSwitch]: parseAaveV3CollateralSwitch,
|
|
1238
|
-
[Strategies.Identifiers.DebtSwitch]: parseAaveV3DebtSwitch,
|
|
1239
|
-
[Strategies.Identifiers.EoaDebtSwitch]: parseAaveV3DebtSwitch,
|
|
1240
1245
|
[Strategies.Identifiers.LiquidationProtection]: parseAaveV3LiquidationProtection,
|
|
1241
1246
|
[Strategies.Identifiers.EoaLiquidationProtection]: parseAaveV3LiquidationProtection,
|
|
1242
1247
|
},
|