@defisaver/automation-sdk 3.3.22-instant-twap-close-dev → 3.3.23
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 -1
- package/cjs/automation/private/StrategiesAutomation.js +12 -0
- package/cjs/automation/private/StrategiesAutomation.test.js +51 -0
- package/cjs/constants/index.js +40 -40
- package/cjs/services/apiSubscriptionsService.d.ts +7 -0
- package/cjs/services/apiSubscriptionsService.js +33 -0
- package/cjs/services/apiSubscriptionsService.test.d.ts +1 -0
- package/cjs/services/apiSubscriptionsService.test.js +67 -0
- package/cjs/services/strategiesService.js +8 -21
- package/cjs/services/strategiesService.test.js +0 -63
- package/cjs/services/strategySubService.d.ts +1 -1
- package/cjs/services/strategySubService.js +6 -7
- package/cjs/services/strategySubService.test.js +71 -111
- package/cjs/services/subDataService.d.ts +10 -12
- package/cjs/services/subDataService.js +30 -36
- package/cjs/services/subDataService.test.js +104 -70
- package/cjs/types/enums.d.ts +18 -18
- package/cjs/types/enums.js +10 -11
- package/cjs/types/index.d.ts +24 -2
- package/esm/automation/private/StrategiesAutomation.d.ts +5 -1
- package/esm/automation/private/StrategiesAutomation.js +12 -0
- package/esm/automation/private/StrategiesAutomation.test.js +51 -0
- package/esm/constants/index.js +40 -40
- package/esm/services/apiSubscriptionsService.d.ts +7 -0
- package/esm/services/apiSubscriptionsService.js +29 -0
- package/esm/services/apiSubscriptionsService.test.d.ts +1 -0
- package/esm/services/apiSubscriptionsService.test.js +65 -0
- package/esm/services/strategiesService.js +8 -21
- package/esm/services/strategiesService.test.js +1 -64
- package/esm/services/strategySubService.d.ts +1 -1
- package/esm/services/strategySubService.js +6 -7
- package/esm/services/strategySubService.test.js +71 -111
- package/esm/services/subDataService.d.ts +10 -12
- package/esm/services/subDataService.js +29 -35
- package/esm/services/subDataService.test.js +104 -70
- package/esm/types/enums.d.ts +18 -18
- package/esm/types/enums.js +10 -11
- package/esm/types/index.d.ts +24 -2
- package/package.json +1 -1
- package/src/automation/private/StrategiesAutomation.test.ts +65 -1
- package/src/automation/private/StrategiesAutomation.ts +17 -0
- package/src/constants/index.ts +40 -40
- package/src/services/apiSubscriptionsService.test.ts +73 -0
- package/src/services/apiSubscriptionsService.ts +33 -0
- package/src/services/strategiesService.test.ts +1 -79
- package/src/services/strategiesService.ts +8 -27
- package/src/services/strategySubService.test.ts +84 -125
- package/src/services/strategySubService.ts +16 -20
- package/src/services/subDataService.test.ts +108 -98
- package/src/services/subDataService.ts +40 -51
- package/src/types/enums.ts +10 -11
- package/src/types/index.ts +26 -2
|
@@ -757,117 +757,6 @@ describe('Feature: strategySubService.ts', () => {
|
|
|
757
757
|
});
|
|
758
758
|
});
|
|
759
759
|
});
|
|
760
|
-
describe('instantCloseOnPriceGeneric()', () => {
|
|
761
|
-
const examples = [
|
|
762
|
-
// Stop loss only (to debt)
|
|
763
|
-
[
|
|
764
|
-
[
|
|
765
|
-
enums_1.Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
766
|
-
true,
|
|
767
|
-
['0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000022ecb25c000000000000000000000000000000000000000000000000000000000000000000'],
|
|
768
|
-
[
|
|
769
|
-
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
770
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
771
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
772
|
-
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
773
|
-
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
774
|
-
'0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
775
|
-
'0x0000000000000000000000001234567890123456789012345678901234567890',
|
|
776
|
-
'0x0000000000000000000000000000000000000000000000000de0b6b3a7640000',
|
|
777
|
-
'0x000000000000000000000000000000000000000000000000002386f26fc10000',
|
|
778
|
-
],
|
|
779
|
-
],
|
|
780
|
-
[
|
|
781
|
-
enums_1.Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
782
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
783
|
-
0,
|
|
784
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
785
|
-
1,
|
|
786
|
-
web3Utils.toChecksumAddress('0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e'),
|
|
787
|
-
web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
|
|
788
|
-
'1000000000000000000',
|
|
789
|
-
'10000000000000000',
|
|
790
|
-
1500,
|
|
791
|
-
enums_1.CloseToAssetType.DEBT,
|
|
792
|
-
0,
|
|
793
|
-
enums_1.CloseToAssetType.COLLATERAL, // takeProfitType (not used since price is 0)
|
|
794
|
-
]
|
|
795
|
-
],
|
|
796
|
-
// Take profit only (to collateral), zero tsi and slippage
|
|
797
|
-
[
|
|
798
|
-
[
|
|
799
|
-
enums_1.Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
800
|
-
true,
|
|
801
|
-
['0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000746a528800'],
|
|
802
|
-
[
|
|
803
|
-
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
804
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
805
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
806
|
-
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
807
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
808
|
-
'0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
809
|
-
'0x0000000000000000000000001234567890123456789012345678901234567890',
|
|
810
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
811
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
812
|
-
],
|
|
813
|
-
],
|
|
814
|
-
[
|
|
815
|
-
enums_1.Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
816
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
817
|
-
0,
|
|
818
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
819
|
-
1,
|
|
820
|
-
web3Utils.toChecksumAddress('0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e'),
|
|
821
|
-
web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
|
|
822
|
-
'0',
|
|
823
|
-
'0',
|
|
824
|
-
0,
|
|
825
|
-
enums_1.CloseToAssetType.DEBT,
|
|
826
|
-
5000,
|
|
827
|
-
enums_1.CloseToAssetType.COLLATERAL, // takeProfitType
|
|
828
|
-
]
|
|
829
|
-
],
|
|
830
|
-
// Take profit (to debt) and stop loss (to collateral)
|
|
831
|
-
[
|
|
832
|
-
[
|
|
833
|
-
enums_1.Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
834
|
-
true,
|
|
835
|
-
['0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000022ecb25c000000000000000000000000000000000000000000000000000000005d21dba000'],
|
|
836
|
-
[
|
|
837
|
-
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
838
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
839
|
-
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
840
|
-
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
841
|
-
'0x0000000000000000000000000000000000000000000000000000000000000007',
|
|
842
|
-
'0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
843
|
-
'0x0000000000000000000000001234567890123456789012345678901234567890',
|
|
844
|
-
'0x00000000000000000000000000000000000000000000000000b1a2bc2ec50000',
|
|
845
|
-
'0x0000000000000000000000000000000000000000000000000011c37937e08000',
|
|
846
|
-
],
|
|
847
|
-
],
|
|
848
|
-
[
|
|
849
|
-
enums_1.Bundles.MainnetIds.AAVE_V3_EOA_INSTANT_CLOSE,
|
|
850
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
851
|
-
0,
|
|
852
|
-
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
853
|
-
1,
|
|
854
|
-
web3Utils.toChecksumAddress('0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e'),
|
|
855
|
-
web3Utils.toChecksumAddress('0x1234567890123456789012345678901234567890'),
|
|
856
|
-
'50000000000000000',
|
|
857
|
-
'5000000000000000',
|
|
858
|
-
1500,
|
|
859
|
-
enums_1.CloseToAssetType.COLLATERAL,
|
|
860
|
-
4000,
|
|
861
|
-
enums_1.CloseToAssetType.DEBT, // takeProfitType
|
|
862
|
-
]
|
|
863
|
-
],
|
|
864
|
-
];
|
|
865
|
-
examples.forEach(([expected, actual]) => {
|
|
866
|
-
it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
867
|
-
(0, chai_1.expect)(strategySubService_1.aaveV3Encode.instantCloseOnPriceGeneric(...actual)).to.eql(expected);
|
|
868
|
-
});
|
|
869
|
-
});
|
|
870
|
-
});
|
|
871
760
|
describe('collateralSwitch()', () => {
|
|
872
761
|
const examples = [
|
|
873
762
|
// WETH -> USDC, price 100000, state UNDER
|
|
@@ -967,6 +856,77 @@ describe('Feature: strategySubService.ts', () => {
|
|
|
967
856
|
});
|
|
968
857
|
});
|
|
969
858
|
});
|
|
859
|
+
describe('debtSwitch()', () => {
|
|
860
|
+
const examples = [
|
|
861
|
+
// USDC -> DAI, price 100000, state UNDER
|
|
862
|
+
[
|
|
863
|
+
[
|
|
864
|
+
enums_1.Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH,
|
|
865
|
+
false,
|
|
866
|
+
['0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000000000000000000000000000000009184e72a0000000000000000000000000000000000000000000000000000000000000000001'],
|
|
867
|
+
[
|
|
868
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
869
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
870
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
871
|
+
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
872
|
+
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
873
|
+
'0x0000000000000000000000000000000000000000000000008ac7230489e80000',
|
|
874
|
+
'0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
|
|
875
|
+
],
|
|
876
|
+
],
|
|
877
|
+
[
|
|
878
|
+
enums_1.Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH,
|
|
879
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
880
|
+
1,
|
|
881
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
882
|
+
3,
|
|
883
|
+
web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
|
|
884
|
+
'10000000000000000000',
|
|
885
|
+
web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
|
|
886
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
887
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
888
|
+
100000,
|
|
889
|
+
enums_1.RatioState.UNDER,
|
|
890
|
+
]
|
|
891
|
+
],
|
|
892
|
+
// DAI -> USDC (MaxUint256), price 1, state OVER
|
|
893
|
+
[
|
|
894
|
+
[
|
|
895
|
+
enums_1.Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH,
|
|
896
|
+
false,
|
|
897
|
+
['0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000000000000000000000000000000000'],
|
|
898
|
+
[
|
|
899
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
900
|
+
'0x0000000000000000000000000000000000000000000000000000000000000003',
|
|
901
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
902
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
903
|
+
'0x00000000000000000000000087870bca3f3fd6335c3f4ce8392d69d0b4161d39',
|
|
904
|
+
'0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
|
|
905
|
+
'0x000000000000000000000000dd6ecd6c9b9f7e29e0f14bb9d5f0d0a3c6cb6c6a',
|
|
906
|
+
],
|
|
907
|
+
],
|
|
908
|
+
[
|
|
909
|
+
enums_1.Strategies.MainnetIds.AAVE_V3_DEBT_SWITCH,
|
|
910
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
911
|
+
3,
|
|
912
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
913
|
+
1,
|
|
914
|
+
web3Utils.toChecksumAddress('0x87870Bca3F3fD6335C3F4ce8392D69d0B4161d39'),
|
|
915
|
+
tokens_1.MAXUINT,
|
|
916
|
+
web3Utils.toChecksumAddress('0xDd6ecD6c9b9F7e29E0f14bb9D5F0D0A3C6cB6c6A'),
|
|
917
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
918
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('USDC', enums_1.ChainId.Ethereum).address),
|
|
919
|
+
1,
|
|
920
|
+
enums_1.RatioState.OVER,
|
|
921
|
+
]
|
|
922
|
+
],
|
|
923
|
+
];
|
|
924
|
+
examples.forEach(([expected, actual]) => {
|
|
925
|
+
it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
926
|
+
(0, chai_1.expect)(strategySubService_1.aaveV3Encode.debtSwitch(...actual)).to.eql(expected);
|
|
927
|
+
});
|
|
928
|
+
});
|
|
929
|
+
});
|
|
970
930
|
});
|
|
971
931
|
describe('When testing strategySubService.compoundV3Encode', () => {
|
|
972
932
|
describe('leverageManagementOnPrice()', () => {
|
|
@@ -248,22 +248,19 @@ export declare const aaveV3CloseGenericSubData: {
|
|
|
248
248
|
owner: EthereumAddress;
|
|
249
249
|
};
|
|
250
250
|
};
|
|
251
|
-
export declare const
|
|
252
|
-
encode(
|
|
251
|
+
export declare const aaveV3CollateralSwitchSubData: {
|
|
252
|
+
encode(fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string, useOnBehalf?: boolean): string[];
|
|
253
253
|
decode(subData: string[]): {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
closeType: CloseStrategyType;
|
|
254
|
+
fromAsset: EthereumAddress;
|
|
255
|
+
fromAssetId: number;
|
|
256
|
+
toAsset: EthereumAddress;
|
|
257
|
+
toAssetId: number;
|
|
259
258
|
marketAddr: EthereumAddress;
|
|
260
|
-
|
|
261
|
-
tsi: string;
|
|
262
|
-
slippage: string;
|
|
259
|
+
amountToSwitch: string;
|
|
263
260
|
};
|
|
264
261
|
};
|
|
265
|
-
export declare const
|
|
266
|
-
encode(fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string,
|
|
262
|
+
export declare const aaveV3DebtSwitchSubData: {
|
|
263
|
+
encode(fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string, user: EthereumAddress): string[];
|
|
267
264
|
decode(subData: string[]): {
|
|
268
265
|
fromAsset: EthereumAddress;
|
|
269
266
|
fromAssetId: number;
|
|
@@ -271,6 +268,7 @@ export declare const aaveV3CollateralSwitchSubData: {
|
|
|
271
268
|
toAssetId: number;
|
|
272
269
|
marketAddr: EthereumAddress;
|
|
273
270
|
amountToSwitch: string;
|
|
271
|
+
user: EthereumAddress;
|
|
274
272
|
};
|
|
275
273
|
};
|
|
276
274
|
export declare const aaveV3QuotePriceSubData: {
|
|
@@ -3,7 +3,7 @@ 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.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.
|
|
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.aaveV3DebtSwitchSubData = exports.aaveV3CollateralSwitchSubData = 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
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"));
|
|
@@ -518,53 +518,46 @@ 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
|
|
530
|
-
const encodedTsi = web3_eth_abi_1.default.encodeParameter('uint256', tsi);
|
|
531
|
-
const encodedSlippage = web3_eth_abi_1.default.encodeParameter('uint256', slippage);
|
|
521
|
+
exports.aaveV3CollateralSwitchSubData = {
|
|
522
|
+
encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, useOnBehalf = false) {
|
|
523
|
+
const encodedFromAsset = web3_eth_abi_1.default.encodeParameter('address', fromAsset);
|
|
524
|
+
const encodedFromAssetId = web3_eth_abi_1.default.encodeParameter('uint8', fromAssetId);
|
|
525
|
+
const encodedToAsset = web3_eth_abi_1.default.encodeParameter('address', toAsset);
|
|
526
|
+
const encodedToAssetId = web3_eth_abi_1.default.encodeParameter('uint8', toAssetId);
|
|
527
|
+
const encodedMarketAddr = web3_eth_abi_1.default.encodeParameter('address', marketAddr);
|
|
528
|
+
const encodedAmountToSwitch = web3_eth_abi_1.default.encodeParameter('uint256', amountToSwitch);
|
|
529
|
+
const encodedUseOnBehalf = web3_eth_abi_1.default.encodeParameter('bool', useOnBehalf);
|
|
532
530
|
return [
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
encodedTsi,
|
|
541
|
-
encodedSlippage,
|
|
531
|
+
encodedFromAsset,
|
|
532
|
+
encodedFromAssetId,
|
|
533
|
+
encodedToAsset,
|
|
534
|
+
encodedToAssetId,
|
|
535
|
+
encodedMarketAddr,
|
|
536
|
+
encodedAmountToSwitch,
|
|
537
|
+
encodedUseOnBehalf,
|
|
542
538
|
];
|
|
543
539
|
},
|
|
544
540
|
decode(subData) {
|
|
545
|
-
const
|
|
546
|
-
const
|
|
547
|
-
const
|
|
548
|
-
const
|
|
549
|
-
const
|
|
550
|
-
const
|
|
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]);
|
|
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]);
|
|
554
547
|
return {
|
|
555
|
-
|
|
548
|
+
fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
|
|
556
549
|
};
|
|
557
550
|
},
|
|
558
551
|
};
|
|
559
|
-
exports.
|
|
560
|
-
encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
|
|
552
|
+
exports.aaveV3DebtSwitchSubData = {
|
|
553
|
+
encode(fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, user) {
|
|
561
554
|
const encodedFromAsset = web3_eth_abi_1.default.encodeParameter('address', fromAsset);
|
|
562
555
|
const encodedFromAssetId = web3_eth_abi_1.default.encodeParameter('uint8', fromAssetId);
|
|
563
556
|
const encodedToAsset = web3_eth_abi_1.default.encodeParameter('address', toAsset);
|
|
564
557
|
const encodedToAssetId = web3_eth_abi_1.default.encodeParameter('uint8', toAssetId);
|
|
565
558
|
const encodedMarketAddr = web3_eth_abi_1.default.encodeParameter('address', marketAddr);
|
|
566
559
|
const encodedAmountToSwitch = web3_eth_abi_1.default.encodeParameter('uint256', amountToSwitch);
|
|
567
|
-
const
|
|
560
|
+
const encodedUser = web3_eth_abi_1.default.encodeParameter('address', user);
|
|
568
561
|
return [
|
|
569
562
|
encodedFromAsset,
|
|
570
563
|
encodedFromAssetId,
|
|
@@ -572,7 +565,7 @@ exports.aaveV3CollateralSwitchSubData = {
|
|
|
572
565
|
encodedToAssetId,
|
|
573
566
|
encodedMarketAddr,
|
|
574
567
|
encodedAmountToSwitch,
|
|
575
|
-
|
|
568
|
+
encodedUser,
|
|
576
569
|
];
|
|
577
570
|
},
|
|
578
571
|
decode(subData) {
|
|
@@ -582,8 +575,9 @@ exports.aaveV3CollateralSwitchSubData = {
|
|
|
582
575
|
const toAssetId = Number(web3_eth_abi_1.default.decodeParameter('uint8', subData[3]));
|
|
583
576
|
const marketAddr = web3_eth_abi_1.default.decodeParameter('address', subData[4]);
|
|
584
577
|
const amountToSwitch = web3_eth_abi_1.default.decodeParameter('uint256', subData[5]);
|
|
578
|
+
const user = web3_eth_abi_1.default.decodeParameter('address', subData[6]);
|
|
585
579
|
return {
|
|
586
|
-
fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch,
|
|
580
|
+
fromAsset, fromAssetId, toAsset, toAssetId, marketAddr, amountToSwitch, user,
|
|
587
581
|
};
|
|
588
582
|
},
|
|
589
583
|
};
|
|
@@ -535,6 +535,110 @@ 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
|
+
});
|
|
538
642
|
describe('When testing subDataService.sparkCollateralSwitchSubData', () => {
|
|
539
643
|
describe('encode()', () => {
|
|
540
644
|
const examples = [
|
|
@@ -2281,76 +2385,6 @@ describe('Feature: subDataService.ts', () => {
|
|
|
2281
2385
|
});
|
|
2282
2386
|
});
|
|
2283
2387
|
});
|
|
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
|
-
});
|
|
2354
2388
|
describe('When testing subDataService.sparkLeverageManagementOnPriceSubData', () => {
|
|
2355
2389
|
describe('encode()', () => {
|
|
2356
2390
|
const examples = [
|
package/cjs/types/enums.d.ts
CHANGED
|
@@ -91,22 +91,30 @@ 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
|
|
94
|
+
SPARK_GENERIC_FL_COLLATERAL_SWITCH = 167,
|
|
95
|
+
AAVE_V3_DEBT_SWITCH = 168,
|
|
96
|
+
AAVE_V3_DEBT_SWITCH_EOA = 169
|
|
95
97
|
}
|
|
96
98
|
enum OptimismIds {
|
|
97
99
|
EXCHANGE_DCA = 8,
|
|
98
100
|
EXCHANGE_LIMIT_ORDER = 9,
|
|
99
|
-
AAVE_V3_COLLATERAL_SWITCH = 24
|
|
101
|
+
AAVE_V3_COLLATERAL_SWITCH = 24,
|
|
102
|
+
AAVE_V3_DEBT_SWITCH = 25,
|
|
103
|
+
AAVE_V3_DEBT_SWITCH_EOA = 26
|
|
100
104
|
}
|
|
101
105
|
enum BaseIds {
|
|
102
106
|
EXCHANGE_DCA = 8,
|
|
103
107
|
EXCHANGE_LIMIT_ORDER = 9,
|
|
104
|
-
AAVE_V3_COLLATERAL_SWITCH = 56
|
|
108
|
+
AAVE_V3_COLLATERAL_SWITCH = 56,
|
|
109
|
+
AAVE_V3_DEBT_SWITCH = 61,
|
|
110
|
+
AAVE_V3_DEBT_SWITCH_EOA = 62
|
|
105
111
|
}
|
|
106
112
|
enum ArbitrumIds {
|
|
107
113
|
EXCHANGE_DCA = 8,
|
|
108
114
|
EXCHANGE_LIMIT_ORDER = 9,
|
|
109
|
-
AAVE_V3_COLLATERAL_SWITCH = 50
|
|
115
|
+
AAVE_V3_COLLATERAL_SWITCH = 50,
|
|
116
|
+
AAVE_V3_DEBT_SWITCH = 55,
|
|
117
|
+
AAVE_V3_DEBT_SWITCH_EOA = 56
|
|
110
118
|
}
|
|
111
119
|
enum Identifiers {
|
|
112
120
|
SavingsLiqProtection = "smart-savings-liquidation-protection",
|
|
@@ -124,8 +132,6 @@ export declare namespace Strategies {
|
|
|
124
132
|
CloseOnPriceToColl = "close-on-price-to-collateral",
|
|
125
133
|
CloseOnPrice = "close-on-price",
|
|
126
134
|
EoaCloseOnPrice = "eoa-close-on-price",
|
|
127
|
-
InstantCloseOnPrice = "instant-close-on-price",
|
|
128
|
-
EoaInstantCloseOnPrice = "eoa-instant-close-on-price",
|
|
129
135
|
TrailingStopToColl = "trailing-stop-to-collateral",
|
|
130
136
|
TrailingStopToDebt = "trailing-stop-to-debt",
|
|
131
137
|
Rebond = "rebond",
|
|
@@ -142,6 +148,8 @@ export declare namespace Strategies {
|
|
|
142
148
|
EoaRepayOnPrice = "eoa-repay-on-price",
|
|
143
149
|
CollateralSwitch = "collateral-switch",
|
|
144
150
|
EoaCollateralSwitch = "eoa-collateral-switch",
|
|
151
|
+
DebtSwitch = "debt-switch",
|
|
152
|
+
EoaDebtSwitch = "eoa-debt-switch",
|
|
145
153
|
LiquidationProtection = "liquidation-protection",
|
|
146
154
|
EoaLiquidationProtection = "liquidation-protection-eoa"
|
|
147
155
|
}
|
|
@@ -252,9 +260,7 @@ export declare namespace Bundles {
|
|
|
252
260
|
SPARK_EOA_REPAY_ON_PRICE = 90,
|
|
253
261
|
SPARK_EOA_BOOST_ON_PRICE = 91,
|
|
254
262
|
SPARK_EOA_CLOSE = 92,
|
|
255
|
-
SPARK_EOA_LIQUIDATION_PROTECTION = 93
|
|
256
|
-
AAVE_V3_SW_INSTANT_CLOSE = 94,
|
|
257
|
-
AAVE_V3_EOA_INSTANT_CLOSE = 95
|
|
263
|
+
SPARK_EOA_LIQUIDATION_PROTECTION = 93
|
|
258
264
|
}
|
|
259
265
|
enum OptimismIds {
|
|
260
266
|
AAVE_V3_REPAY = 0,
|
|
@@ -269,9 +275,7 @@ export declare namespace Bundles {
|
|
|
269
275
|
AAVE_V3_EOA_BOOST_ON_PRICE = 9,
|
|
270
276
|
AAVE_V3_EOA_CLOSE = 10,
|
|
271
277
|
AAVE_V3_SW_LIQUIDATION_PROTECTION = 11,
|
|
272
|
-
AAVE_V3_EOA_LIQUIDATION_PROTECTION = 12
|
|
273
|
-
AAVE_V3_SW_INSTANT_CLOSE = 13,
|
|
274
|
-
AAVE_V3_EOA_INSTANT_CLOSE = 14
|
|
278
|
+
AAVE_V3_EOA_LIQUIDATION_PROTECTION = 12
|
|
275
279
|
}
|
|
276
280
|
enum BaseIds {
|
|
277
281
|
AAVE_V3_REPAY = 0,
|
|
@@ -313,9 +317,7 @@ export declare namespace Bundles {
|
|
|
313
317
|
MORPHO_BLUE_EOA_BOOST_ON_PRICE = 39,
|
|
314
318
|
MORPHO_BLUE_EOA_REPAY_ON_PRICE = 40,
|
|
315
319
|
MORPHO_BLUE_EOA_CLOSE = 41,
|
|
316
|
-
MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 42
|
|
317
|
-
AAVE_V3_SW_INSTANT_CLOSE = 43,
|
|
318
|
-
AAVE_V3_EOA_INSTANT_CLOSE = 44
|
|
320
|
+
MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 42
|
|
319
321
|
}
|
|
320
322
|
enum ArbitrumIds {
|
|
321
323
|
AAVE_V3_REPAY = 0,
|
|
@@ -357,8 +359,6 @@ export declare namespace Bundles {
|
|
|
357
359
|
MORPHO_BLUE_REPAY_ON_PRICE = 36,
|
|
358
360
|
MORPHO_BLUE_EOA_BOOST_ON_PRICE = 37,
|
|
359
361
|
MORPHO_BLUE_EOA_REPAY_ON_PRICE = 38,
|
|
360
|
-
MORPHO_BLUE_EOA_CLOSE = 39
|
|
361
|
-
AAVE_V3_SW_INSTANT_CLOSE = 40,
|
|
362
|
-
AAVE_V3_EOA_INSTANT_CLOSE = 41
|
|
362
|
+
MORPHO_BLUE_EOA_CLOSE = 39
|
|
363
363
|
}
|
|
364
364
|
}
|