@defisaver/automation-sdk 3.3.21-coll-switch-generic-dev → 3.3.21-instant-twap-close-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/constants/index.js +10 -40
- package/cjs/services/strategiesService.js +21 -16
- package/cjs/services/strategiesService.test.js +62 -94
- 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 +9 -15
- package/cjs/types/enums.js +4 -10
- package/esm/constants/index.js +10 -40
- package/esm/services/strategiesService.js +21 -16
- package/esm/services/strategiesService.test.js +63 -95
- 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 +9 -15
- package/esm/types/enums.js +4 -10
- package/package.json +1 -1
- package/src/constants/index.ts +10 -40
- package/src/services/strategiesService.test.ts +78 -106
- 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 +4 -10
|
@@ -248,31 +248,22 @@ export declare const aaveV3CloseGenericSubData: {
|
|
|
248
248
|
owner: EthereumAddress;
|
|
249
249
|
};
|
|
250
250
|
};
|
|
251
|
-
export declare const
|
|
252
|
-
encode(
|
|
253
|
-
decode(subData: string[]): {
|
|
254
|
-
fromAsset: EthereumAddress;
|
|
255
|
-
fromAssetId: number;
|
|
256
|
-
toAsset: EthereumAddress;
|
|
257
|
-
toAssetId: number;
|
|
258
|
-
marketAddr: EthereumAddress;
|
|
259
|
-
amountToSwitch: string;
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
|
-
export declare const aaveV3GenericFLCollateralSwitchSubData: {
|
|
263
|
-
encode(fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string, user: EthereumAddress): string[];
|
|
251
|
+
export declare const aaveV3InstantCloseGenericSubData: {
|
|
252
|
+
encode(collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, closeType: CloseStrategyType, marketAddr: EthereumAddress, user: EthereumAddress, tsi: string, slippage: string): string[];
|
|
264
253
|
decode(subData: string[]): {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
254
|
+
collAsset: EthereumAddress;
|
|
255
|
+
collAssetId: number;
|
|
256
|
+
debtAsset: EthereumAddress;
|
|
257
|
+
debtAssetId: number;
|
|
258
|
+
closeType: CloseStrategyType;
|
|
269
259
|
marketAddr: EthereumAddress;
|
|
270
|
-
|
|
271
|
-
|
|
260
|
+
owner: EthereumAddress;
|
|
261
|
+
tsi: string;
|
|
262
|
+
slippage: string;
|
|
272
263
|
};
|
|
273
264
|
};
|
|
274
|
-
export declare const
|
|
275
|
-
encode(fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string,
|
|
265
|
+
export declare const aaveV3CollateralSwitchSubData: {
|
|
266
|
+
encode(fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string, useOnBehalf?: boolean): string[];
|
|
276
267
|
decode(subData: string[]): {
|
|
277
268
|
fromAsset: EthereumAddress;
|
|
278
269
|
fromAssetId: number;
|
|
@@ -280,7 +271,6 @@ export declare const aaveV3DebtSwitchSubData: {
|
|
|
280
271
|
toAssetId: number;
|
|
281
272
|
marketAddr: EthereumAddress;
|
|
282
273
|
amountToSwitch: string;
|
|
283
|
-
user: EthereumAddress;
|
|
284
274
|
};
|
|
285
275
|
};
|
|
286
276
|
export declare const aaveV3QuotePriceSubData: {
|
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.sparkGenericLiquidationProtectionSubData = exports.sparkGenericLeverageManagementSubData = exports.sparkLiquidationProtectionSubData = exports.sparkLeverageManagementSubData = exports.legacySparkLeverageManagementSubData = exports.exchangeLimitOrderSubData = exports.legacyExchangeLimitOrderSubData = exports.exchangeDcaSubData = exports.compoundV3CloseSubData = exports.compoundV3LeverageManagementOnPriceSubData = exports.compoundV3LiquidationProtectionSubData = exports.compoundV3LeverageManagementSubData = exports.compoundV2LeverageManagementSubData = exports.legacyCompoundV2LeverageManagementSubData = exports.aaveV4CollateralSwitchSubData = exports.aaveV4CloseSubData = exports.aaveV4LeverageManagementOnPriceSubData = exports.aaveV4LiquidationProtectionSubData = exports.aaveV4LeverageManagementSubData = exports.aaveV3LeverageManagementOnPriceSubData = exports.aaveV3QuotePriceSubData = exports.
|
|
7
|
-
exports.fluidLiquidationProtectionSubData = exports.fluidLeverageManagementSubData = exports.morphoBlueCloseOnPriceSubData = exports.morphoBlueLeverageManagementOnPriceSubData = exports.morphoBlueLiquidationProtectionSubData = exports.morphoBlueLeverageManagementSubData = exports.crvUSDPaybackSubData = exports.crvUSDLeverageManagementSubData = exports.sparkGenericFLCollateralSwitchSubData = exports.sparkCollateralSwitchSubData = exports.sparkLeverageManagementOnPriceGenericSubData = exports.sparkLeverageManagementOnPriceSubData =
|
|
6
|
+
exports.sparkCloseGenericSubData = exports.sparkGenericLiquidationProtectionSubData = exports.sparkGenericLeverageManagementSubData = exports.sparkLiquidationProtectionSubData = exports.sparkLeverageManagementSubData = exports.legacySparkLeverageManagementSubData = exports.exchangeLimitOrderSubData = exports.legacyExchangeLimitOrderSubData = exports.exchangeDcaSubData = exports.compoundV3CloseSubData = exports.compoundV3LeverageManagementOnPriceSubData = exports.compoundV3LiquidationProtectionSubData = exports.compoundV3LeverageManagementSubData = exports.compoundV2LeverageManagementSubData = exports.legacyCompoundV2LeverageManagementSubData = exports.aaveV4CollateralSwitchSubData = exports.aaveV4CloseSubData = exports.aaveV4LeverageManagementOnPriceSubData = exports.aaveV4LiquidationProtectionSubData = exports.aaveV4LeverageManagementSubData = exports.aaveV3LeverageManagementOnPriceSubData = exports.aaveV3QuotePriceSubData = exports.aaveV3CollateralSwitchSubData = exports.aaveV3InstantCloseGenericSubData = exports.aaveV3CloseGenericSubData = exports.aaveV3LeverageManagementOnPriceGeneric = exports.aaveV3LiquidationProtectionSubData = exports.aaveV3LeverageManagementSubData = exports.legacyAaveV3LeverageManagementSubData = exports.aaveV2LeverageManagementSubData = exports.legacyAaveV2LeverageManagementSubData = exports.liquityV2PaybackSubData = exports.liquityV2LeverageManagementOnPriceSubData = exports.liquityV2CloseSubData = exports.liquityV2LeverageManagementSubData = exports.liquityDebtInFrontRepaySubData = exports.liquityDsrSupplySubData = exports.liquityDsrPaybackSubData = exports.liquityCloseSubData = exports.liquityLeverageManagementSubData = exports.legacyLiquityLeverageManagementSubData = exports.liquityRepayFromSavingsSubData = exports.makerLiquidationProtectionSubData = exports.makerLeverageManagementSubData = exports.legacyMakerLeverageManagementSubData = exports.makerCloseSubData = exports.makerRepayFromSavingsSubData = exports.liquityPaybackUsingChickenBondSubData = exports.cBondsRebondSubData = exports.morphoAaveV2LeverageManagementSubData = void 0;
|
|
7
|
+
exports.fluidLiquidationProtectionSubData = exports.fluidLeverageManagementSubData = exports.morphoBlueCloseOnPriceSubData = exports.morphoBlueLeverageManagementOnPriceSubData = exports.morphoBlueLiquidationProtectionSubData = exports.morphoBlueLeverageManagementSubData = exports.crvUSDPaybackSubData = exports.crvUSDLeverageManagementSubData = exports.sparkGenericFLCollateralSwitchSubData = exports.sparkCollateralSwitchSubData = exports.sparkLeverageManagementOnPriceGenericSubData = exports.sparkLeverageManagementOnPriceSubData = void 0;
|
|
8
8
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
9
9
|
const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
|
|
10
10
|
const web3_utils_1 = require("web3-utils");
|
|
@@ -518,78 +518,53 @@ exports.aaveV3CloseGenericSubData = {
|
|
|
518
518
|
};
|
|
519
519
|
},
|
|
520
520
|
};
|
|
521
|
-
exports.
|
|
522
|
-
encode(
|
|
523
|
-
const
|
|
524
|
-
const
|
|
525
|
-
const
|
|
526
|
-
const
|
|
527
|
-
const
|
|
528
|
-
const
|
|
529
|
-
const encodedUseOnBehalf = web3_eth_abi_1.default.encodeParameter('bool', useOnBehalf);
|
|
530
|
-
return [
|
|
531
|
-
encodedFromAsset,
|
|
532
|
-
encodedFromAssetId,
|
|
533
|
-
encodedToAsset,
|
|
534
|
-
encodedToAssetId,
|
|
535
|
-
encodedMarketAddr,
|
|
536
|
-
encodedAmountToSwitch,
|
|
537
|
-
encodedUseOnBehalf,
|
|
538
|
-
];
|
|
539
|
-
},
|
|
540
|
-
decode(subData) {
|
|
541
|
-
const fromAsset = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
|
|
542
|
-
const fromAssetId = Number(web3_eth_abi_1.default.decodeParameter('uint8', subData[1]));
|
|
543
|
-
const toAsset = web3_eth_abi_1.default.decodeParameter('address', subData[2]);
|
|
544
|
-
const toAssetId = Number(web3_eth_abi_1.default.decodeParameter('uint8', subData[3]));
|
|
545
|
-
const marketAddr = web3_eth_abi_1.default.decodeParameter('address', subData[4]);
|
|
546
|
-
const amountToSwitch = web3_eth_abi_1.default.decodeParameter('uint256', subData[5]);
|
|
547
|
-
return {
|
|
548
|
-
fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
|
|
549
|
-
};
|
|
550
|
-
},
|
|
551
|
-
};
|
|
552
|
-
exports.aaveV3GenericFLCollateralSwitchSubData = {
|
|
553
|
-
encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, user) {
|
|
554
|
-
const encodedFromAsset = web3_eth_abi_1.default.encodeParameter('address', fromAsset);
|
|
555
|
-
const encodedFromAssetId = web3_eth_abi_1.default.encodeParameter('uint16', fromAssetId);
|
|
556
|
-
const encodedToAsset = web3_eth_abi_1.default.encodeParameter('address', toAsset);
|
|
557
|
-
const encodedToAssetId = web3_eth_abi_1.default.encodeParameter('uint16', toAssetId);
|
|
558
|
-
const encodedMarketAddr = web3_eth_abi_1.default.encodeParameter('address', marketAddr);
|
|
559
|
-
const encodedAmountToSwitch = web3_eth_abi_1.default.encodeParameter('uint256', amountToSwitch);
|
|
521
|
+
exports.aaveV3InstantCloseGenericSubData = {
|
|
522
|
+
encode(collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, user, tsi, slippage) {
|
|
523
|
+
const encodedColl = web3_eth_abi_1.default.encodeParameter('address', collAsset);
|
|
524
|
+
const encodedCollId = web3_eth_abi_1.default.encodeParameter('uint16', collAssetId);
|
|
525
|
+
const encodedDebt = web3_eth_abi_1.default.encodeParameter('address', debtAsset);
|
|
526
|
+
const encodedDebtId = web3_eth_abi_1.default.encodeParameter('uint16', debtAssetId);
|
|
527
|
+
const encodedCloseType = web3_eth_abi_1.default.encodeParameter('uint8', closeType);
|
|
528
|
+
const encodedMarket = web3_eth_abi_1.default.encodeParameter('address', marketAddr);
|
|
560
529
|
const encodedUser = web3_eth_abi_1.default.encodeParameter('address', user);
|
|
530
|
+
const encodedTsi = web3_eth_abi_1.default.encodeParameter('uint256', tsi);
|
|
531
|
+
const encodedSlippage = web3_eth_abi_1.default.encodeParameter('uint256', slippage);
|
|
561
532
|
return [
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
533
|
+
encodedColl,
|
|
534
|
+
encodedCollId,
|
|
535
|
+
encodedDebt,
|
|
536
|
+
encodedDebtId,
|
|
537
|
+
encodedCloseType,
|
|
538
|
+
encodedMarket,
|
|
568
539
|
encodedUser,
|
|
540
|
+
encodedTsi,
|
|
541
|
+
encodedSlippage,
|
|
569
542
|
];
|
|
570
543
|
},
|
|
571
544
|
decode(subData) {
|
|
572
|
-
const
|
|
573
|
-
const
|
|
574
|
-
const
|
|
575
|
-
const
|
|
576
|
-
const
|
|
577
|
-
const
|
|
578
|
-
const
|
|
545
|
+
const collAsset = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
|
|
546
|
+
const collAssetId = Number(web3_eth_abi_1.default.decodeParameter('uint16', subData[1]));
|
|
547
|
+
const debtAsset = web3_eth_abi_1.default.decodeParameter('address', subData[2]);
|
|
548
|
+
const debtAssetId = Number(web3_eth_abi_1.default.decodeParameter('uint16', subData[3]));
|
|
549
|
+
const closeType = Number(web3_eth_abi_1.default.decodeParameter('uint8', subData[4]));
|
|
550
|
+
const marketAddr = web3_eth_abi_1.default.decodeParameter('address', subData[5]);
|
|
551
|
+
const owner = web3_eth_abi_1.default.decodeParameter('address', subData[6]);
|
|
552
|
+
const tsi = web3_eth_abi_1.default.decodeParameter('uint256', subData[7]);
|
|
553
|
+
const slippage = web3_eth_abi_1.default.decodeParameter('uint256', subData[8]);
|
|
579
554
|
return {
|
|
580
|
-
|
|
555
|
+
collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, owner, tsi, slippage,
|
|
581
556
|
};
|
|
582
557
|
},
|
|
583
558
|
};
|
|
584
|
-
exports.
|
|
585
|
-
encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
|
|
559
|
+
exports.aaveV3CollateralSwitchSubData = {
|
|
560
|
+
encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, useOnBehalf = false) {
|
|
586
561
|
const encodedFromAsset = web3_eth_abi_1.default.encodeParameter('address', fromAsset);
|
|
587
562
|
const encodedFromAssetId = web3_eth_abi_1.default.encodeParameter('uint8', fromAssetId);
|
|
588
563
|
const encodedToAsset = web3_eth_abi_1.default.encodeParameter('address', toAsset);
|
|
589
564
|
const encodedToAssetId = web3_eth_abi_1.default.encodeParameter('uint8', toAssetId);
|
|
590
565
|
const encodedMarketAddr = web3_eth_abi_1.default.encodeParameter('address', marketAddr);
|
|
591
566
|
const encodedAmountToSwitch = web3_eth_abi_1.default.encodeParameter('uint256', amountToSwitch);
|
|
592
|
-
const
|
|
567
|
+
const encodedUseOnBehalf = web3_eth_abi_1.default.encodeParameter('bool', useOnBehalf);
|
|
593
568
|
return [
|
|
594
569
|
encodedFromAsset,
|
|
595
570
|
encodedFromAssetId,
|
|
@@ -597,7 +572,7 @@ exports.aaveV3DebtSwitchSubData = {
|
|
|
597
572
|
encodedToAssetId,
|
|
598
573
|
encodedMarketAddr,
|
|
599
574
|
encodedAmountToSwitch,
|
|
600
|
-
|
|
575
|
+
encodedUseOnBehalf,
|
|
601
576
|
];
|
|
602
577
|
},
|
|
603
578
|
decode(subData) {
|
|
@@ -607,9 +582,8 @@ exports.aaveV3DebtSwitchSubData = {
|
|
|
607
582
|
const toAssetId = Number(web3_eth_abi_1.default.decodeParameter('uint8', subData[3]));
|
|
608
583
|
const marketAddr = web3_eth_abi_1.default.decodeParameter('address', subData[4]);
|
|
609
584
|
const amountToSwitch = web3_eth_abi_1.default.decodeParameter('uint256', subData[5]);
|
|
610
|
-
const user = web3_eth_abi_1.default.decodeParameter('address', subData[6]);
|
|
611
585
|
return {
|
|
612
|
-
fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
|
|
586
|
+
fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
|
|
613
587
|
};
|
|
614
588
|
},
|
|
615
589
|
};
|
|
@@ -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,30 +91,22 @@ export declare namespace Strategies {
|
|
|
91
91
|
AAVE_V4_COLLATERAL_SWITCH = 154,
|
|
92
92
|
AAVE_V4_COLLATERAL_SWITCH_EOA = 155,
|
|
93
93
|
SPARK_COLLATERAL_SWITCH = 156,
|
|
94
|
-
SPARK_GENERIC_FL_COLLATERAL_SWITCH = 167
|
|
95
|
-
AAVE_V3_DEBT_SWITCH = 168,
|
|
96
|
-
AAVE_V3_DEBT_SWITCH_EOA = 169
|
|
94
|
+
SPARK_GENERIC_FL_COLLATERAL_SWITCH = 167
|
|
97
95
|
}
|
|
98
96
|
enum OptimismIds {
|
|
99
97
|
EXCHANGE_DCA = 8,
|
|
100
98
|
EXCHANGE_LIMIT_ORDER = 9,
|
|
101
|
-
AAVE_V3_COLLATERAL_SWITCH = 24
|
|
102
|
-
AAVE_V3_DEBT_SWITCH = 25,
|
|
103
|
-
AAVE_V3_DEBT_SWITCH_EOA = 26
|
|
99
|
+
AAVE_V3_COLLATERAL_SWITCH = 24
|
|
104
100
|
}
|
|
105
101
|
enum BaseIds {
|
|
106
102
|
EXCHANGE_DCA = 8,
|
|
107
103
|
EXCHANGE_LIMIT_ORDER = 9,
|
|
108
|
-
AAVE_V3_COLLATERAL_SWITCH = 56
|
|
109
|
-
AAVE_V3_DEBT_SWITCH = 61,
|
|
110
|
-
AAVE_V3_DEBT_SWITCH_EOA = 62
|
|
104
|
+
AAVE_V3_COLLATERAL_SWITCH = 56
|
|
111
105
|
}
|
|
112
106
|
enum ArbitrumIds {
|
|
113
107
|
EXCHANGE_DCA = 8,
|
|
114
108
|
EXCHANGE_LIMIT_ORDER = 9,
|
|
115
|
-
AAVE_V3_COLLATERAL_SWITCH = 50
|
|
116
|
-
AAVE_V3_DEBT_SWITCH = 55,
|
|
117
|
-
AAVE_V3_DEBT_SWITCH_EOA = 56
|
|
109
|
+
AAVE_V3_COLLATERAL_SWITCH = 50
|
|
118
110
|
}
|
|
119
111
|
enum Identifiers {
|
|
120
112
|
SavingsLiqProtection = "smart-savings-liquidation-protection",
|
|
@@ -132,6 +124,8 @@ export declare namespace Strategies {
|
|
|
132
124
|
CloseOnPriceToColl = "close-on-price-to-collateral",
|
|
133
125
|
CloseOnPrice = "close-on-price",
|
|
134
126
|
EoaCloseOnPrice = "eoa-close-on-price",
|
|
127
|
+
InstantCloseOnPrice = "instant-close-on-price",
|
|
128
|
+
EoaInstantCloseOnPrice = "eoa-instant-close-on-price",
|
|
135
129
|
TrailingStopToColl = "trailing-stop-to-collateral",
|
|
136
130
|
TrailingStopToDebt = "trailing-stop-to-debt",
|
|
137
131
|
Rebond = "rebond",
|
|
@@ -148,8 +142,6 @@ export declare namespace Strategies {
|
|
|
148
142
|
EoaRepayOnPrice = "eoa-repay-on-price",
|
|
149
143
|
CollateralSwitch = "collateral-switch",
|
|
150
144
|
EoaCollateralSwitch = "eoa-collateral-switch",
|
|
151
|
-
DebtSwitch = "debt-switch",
|
|
152
|
-
EoaDebtSwitch = "eoa-debt-switch",
|
|
153
145
|
LiquidationProtection = "liquidation-protection",
|
|
154
146
|
EoaLiquidationProtection = "liquidation-protection-eoa"
|
|
155
147
|
}
|
|
@@ -260,7 +252,9 @@ export declare namespace Bundles {
|
|
|
260
252
|
SPARK_EOA_REPAY_ON_PRICE = 90,
|
|
261
253
|
SPARK_EOA_BOOST_ON_PRICE = 91,
|
|
262
254
|
SPARK_EOA_CLOSE = 92,
|
|
263
|
-
SPARK_EOA_LIQUIDATION_PROTECTION = 93
|
|
255
|
+
SPARK_EOA_LIQUIDATION_PROTECTION = 93,
|
|
256
|
+
AAVE_V3_SW_INSTANT_CLOSE = 94,
|
|
257
|
+
AAVE_V3_EOA_INSTANT_CLOSE = 95
|
|
264
258
|
}
|
|
265
259
|
enum OptimismIds {
|
|
266
260
|
AAVE_V3_REPAY = 0,
|
package/cjs/types/enums.js
CHANGED
|
@@ -108,32 +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
111
|
})(MainnetIds = Strategies.MainnetIds || (Strategies.MainnetIds = {}));
|
|
114
112
|
let OptimismIds;
|
|
115
113
|
(function (OptimismIds) {
|
|
116
114
|
OptimismIds[OptimismIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
|
|
117
115
|
OptimismIds[OptimismIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
|
|
118
116
|
OptimismIds[OptimismIds["AAVE_V3_COLLATERAL_SWITCH"] = 24] = "AAVE_V3_COLLATERAL_SWITCH";
|
|
119
|
-
OptimismIds[OptimismIds["AAVE_V3_DEBT_SWITCH"] = 25] = "AAVE_V3_DEBT_SWITCH";
|
|
120
|
-
OptimismIds[OptimismIds["AAVE_V3_DEBT_SWITCH_EOA"] = 26] = "AAVE_V3_DEBT_SWITCH_EOA";
|
|
121
117
|
})(OptimismIds = Strategies.OptimismIds || (Strategies.OptimismIds = {}));
|
|
122
118
|
let BaseIds;
|
|
123
119
|
(function (BaseIds) {
|
|
124
120
|
BaseIds[BaseIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
|
|
125
121
|
BaseIds[BaseIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
|
|
126
122
|
BaseIds[BaseIds["AAVE_V3_COLLATERAL_SWITCH"] = 56] = "AAVE_V3_COLLATERAL_SWITCH";
|
|
127
|
-
BaseIds[BaseIds["AAVE_V3_DEBT_SWITCH"] = 61] = "AAVE_V3_DEBT_SWITCH";
|
|
128
|
-
BaseIds[BaseIds["AAVE_V3_DEBT_SWITCH_EOA"] = 62] = "AAVE_V3_DEBT_SWITCH_EOA";
|
|
129
123
|
})(BaseIds = Strategies.BaseIds || (Strategies.BaseIds = {}));
|
|
130
124
|
let ArbitrumIds;
|
|
131
125
|
(function (ArbitrumIds) {
|
|
132
126
|
ArbitrumIds[ArbitrumIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
|
|
133
127
|
ArbitrumIds[ArbitrumIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
|
|
134
128
|
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
129
|
})(ArbitrumIds = Strategies.ArbitrumIds || (Strategies.ArbitrumIds = {}));
|
|
138
130
|
let Identifiers;
|
|
139
131
|
(function (Identifiers) {
|
|
@@ -152,6 +144,8 @@ var Strategies;
|
|
|
152
144
|
Identifiers["CloseOnPriceToColl"] = "close-on-price-to-collateral";
|
|
153
145
|
Identifiers["CloseOnPrice"] = "close-on-price";
|
|
154
146
|
Identifiers["EoaCloseOnPrice"] = "eoa-close-on-price";
|
|
147
|
+
Identifiers["InstantCloseOnPrice"] = "instant-close-on-price";
|
|
148
|
+
Identifiers["EoaInstantCloseOnPrice"] = "eoa-instant-close-on-price";
|
|
155
149
|
Identifiers["TrailingStopToColl"] = "trailing-stop-to-collateral";
|
|
156
150
|
Identifiers["TrailingStopToDebt"] = "trailing-stop-to-debt";
|
|
157
151
|
Identifiers["Rebond"] = "rebond";
|
|
@@ -168,8 +162,6 @@ var Strategies;
|
|
|
168
162
|
Identifiers["EoaRepayOnPrice"] = "eoa-repay-on-price";
|
|
169
163
|
Identifiers["CollateralSwitch"] = "collateral-switch";
|
|
170
164
|
Identifiers["EoaCollateralSwitch"] = "eoa-collateral-switch";
|
|
171
|
-
Identifiers["DebtSwitch"] = "debt-switch";
|
|
172
|
-
Identifiers["EoaDebtSwitch"] = "eoa-debt-switch";
|
|
173
165
|
Identifiers["LiquidationProtection"] = "liquidation-protection";
|
|
174
166
|
Identifiers["EoaLiquidationProtection"] = "liquidation-protection-eoa";
|
|
175
167
|
})(Identifiers = Strategies.Identifiers || (Strategies.Identifiers = {}));
|
|
@@ -284,6 +276,8 @@ var Bundles;
|
|
|
284
276
|
MainnetIds[MainnetIds["SPARK_EOA_BOOST_ON_PRICE"] = 91] = "SPARK_EOA_BOOST_ON_PRICE";
|
|
285
277
|
MainnetIds[MainnetIds["SPARK_EOA_CLOSE"] = 92] = "SPARK_EOA_CLOSE";
|
|
286
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";
|
|
287
281
|
})(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
|
|
288
282
|
let OptimismIds;
|
|
289
283
|
(function (OptimismIds) {
|
package/esm/constants/index.js
CHANGED
|
@@ -121,16 +121,6 @@ export const MAINNET_STRATEGIES_INFO = {
|
|
|
121
121
|
strategyId: Strategies.Identifiers.EoaCollateralSwitch,
|
|
122
122
|
protocol: PROTOCOLS.Spark,
|
|
123
123
|
},
|
|
124
|
-
[Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH]: {
|
|
125
|
-
strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH,
|
|
126
|
-
strategyId: Strategies.Identifiers.DebtSwitch,
|
|
127
|
-
protocol: PROTOCOLS.AaveV3,
|
|
128
|
-
},
|
|
129
|
-
[Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH_EOA]: {
|
|
130
|
-
strategyOrBundleId: Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH_EOA,
|
|
131
|
-
strategyId: Strategies.Identifiers.EoaDebtSwitch,
|
|
132
|
-
protocol: PROTOCOLS.AaveV3,
|
|
133
|
-
},
|
|
134
124
|
};
|
|
135
125
|
export const OPTIMISM_STRATEGIES_INFO = {
|
|
136
126
|
[Strategies.OptimismIds.EXCHANGE_DCA]: {
|
|
@@ -148,16 +138,6 @@ export const OPTIMISM_STRATEGIES_INFO = {
|
|
|
148
138
|
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
149
139
|
protocol: PROTOCOLS.AaveV3,
|
|
150
140
|
},
|
|
151
|
-
[Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH]: {
|
|
152
|
-
strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH,
|
|
153
|
-
strategyId: Strategies.Identifiers.DebtSwitch,
|
|
154
|
-
protocol: PROTOCOLS.AaveV3,
|
|
155
|
-
},
|
|
156
|
-
[Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH_EOA]: {
|
|
157
|
-
strategyOrBundleId: Strategies.OptimismIds.AAVE_V3_DEBT_SWITCH_EOA,
|
|
158
|
-
strategyId: Strategies.Identifiers.EoaDebtSwitch,
|
|
159
|
-
protocol: PROTOCOLS.AaveV3,
|
|
160
|
-
},
|
|
161
141
|
};
|
|
162
142
|
export const BASE_STRATEGIES_INFO = {
|
|
163
143
|
[Strategies.BaseIds.EXCHANGE_DCA]: {
|
|
@@ -175,16 +155,6 @@ export const BASE_STRATEGIES_INFO = {
|
|
|
175
155
|
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
176
156
|
protocol: PROTOCOLS.AaveV3,
|
|
177
157
|
},
|
|
178
|
-
[Strategies.BaseIds.AAVE_V3_DEBT_SWITCH]: {
|
|
179
|
-
strategyOrBundleId: Strategies.BaseIds.AAVE_V3_DEBT_SWITCH,
|
|
180
|
-
strategyId: Strategies.Identifiers.DebtSwitch,
|
|
181
|
-
protocol: PROTOCOLS.AaveV3,
|
|
182
|
-
},
|
|
183
|
-
[Strategies.BaseIds.AAVE_V3_DEBT_SWITCH_EOA]: {
|
|
184
|
-
strategyOrBundleId: Strategies.BaseIds.AAVE_V3_DEBT_SWITCH_EOA,
|
|
185
|
-
strategyId: Strategies.Identifiers.EoaDebtSwitch,
|
|
186
|
-
protocol: PROTOCOLS.AaveV3,
|
|
187
|
-
},
|
|
188
158
|
};
|
|
189
159
|
export const ARBITRUM_STRATEGIES_INFO = {
|
|
190
160
|
[Strategies.ArbitrumIds.EXCHANGE_DCA]: {
|
|
@@ -202,16 +172,6 @@ export const ARBITRUM_STRATEGIES_INFO = {
|
|
|
202
172
|
strategyId: Strategies.Identifiers.CollateralSwitch,
|
|
203
173
|
protocol: PROTOCOLS.AaveV3,
|
|
204
174
|
},
|
|
205
|
-
[Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH]: {
|
|
206
|
-
strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH,
|
|
207
|
-
strategyId: Strategies.Identifiers.DebtSwitch,
|
|
208
|
-
protocol: PROTOCOLS.AaveV3,
|
|
209
|
-
},
|
|
210
|
-
[Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH_EOA]: {
|
|
211
|
-
strategyOrBundleId: Strategies.ArbitrumIds.AAVE_V3_DEBT_SWITCH_EOA,
|
|
212
|
-
strategyId: Strategies.Identifiers.EoaDebtSwitch,
|
|
213
|
-
protocol: PROTOCOLS.AaveV3,
|
|
214
|
-
},
|
|
215
175
|
};
|
|
216
176
|
export const STRATEGIES_INFO = {
|
|
217
177
|
[ChainId.Ethereum]: MAINNET_STRATEGIES_INFO,
|
|
@@ -693,6 +653,16 @@ export const MAINNET_BUNDLES_INFO = {
|
|
|
693
653
|
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
694
654
|
protocol: PROTOCOLS.Spark,
|
|
695
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
|
+
},
|
|
696
666
|
};
|
|
697
667
|
export const OPTIMISM_BUNDLES_INFO = {
|
|
698
668
|
[Bundles.OptimismIds.AAVE_V3_REPAY]: {
|