@defisaver/automation-sdk 3.3.15-liq-prot-dev → 3.3.15-liq-prot-2-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 +64 -29
- package/cjs/services/strategiesService.js +9 -12
- package/cjs/services/strategySubService.d.ts +1 -1
- package/cjs/services/strategySubService.js +10 -5
- package/cjs/services/subDataService.d.ts +5 -14
- package/cjs/services/subDataService.js +20 -68
- package/cjs/services/subDataService.test.js +0 -68
- package/cjs/services/utils.d.ts +1 -1
- package/cjs/services/utils.js +4 -4
- package/cjs/types/enums.d.ts +25 -18
- package/cjs/types/enums.js +23 -16
- package/esm/constants/index.js +64 -29
- package/esm/services/strategiesService.js +9 -12
- package/esm/services/strategySubService.d.ts +1 -1
- package/esm/services/strategySubService.js +10 -5
- package/esm/services/subDataService.d.ts +5 -14
- package/esm/services/subDataService.js +18 -66
- package/esm/services/subDataService.test.js +0 -68
- package/esm/services/utils.d.ts +1 -1
- package/esm/services/utils.js +4 -4
- package/esm/types/enums.d.ts +25 -18
- package/esm/types/enums.js +23 -16
- package/package.json +1 -1
- package/src/constants/index.ts +66 -31
- package/src/services/strategiesService.ts +11 -15
- package/src/services/strategySubService.ts +18 -11
- package/src/services/subDataService.test.ts +0 -72
- package/src/services/subDataService.ts +20 -93
- package/src/services/utils.ts +4 -4
- package/src/types/enums.ts +23 -18
|
@@ -685,74 +685,6 @@ describe('Feature: subDataService.ts', () => {
|
|
|
685
685
|
});
|
|
686
686
|
});
|
|
687
687
|
});
|
|
688
|
-
describe('When testing subDataService.compoundV3LeverageManagementSubData', () => {
|
|
689
|
-
describe('encode()', () => {
|
|
690
|
-
const examples = [
|
|
691
|
-
[
|
|
692
|
-
[
|
|
693
|
-
web3Utils.toChecksumAddress('0x1C0F620155e85491f8D35440eb17538Ca5c55212'),
|
|
694
|
-
web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address),
|
|
695
|
-
new Dec(160).mul(1e16).toString(),
|
|
696
|
-
new Dec(220).mul(1e16).toString(),
|
|
697
|
-
new Dec(180).mul(1e16).toString(),
|
|
698
|
-
new Dec(190).mul(1e16).toString(),
|
|
699
|
-
true, false,
|
|
700
|
-
],
|
|
701
|
-
[
|
|
702
|
-
web3Utils.toChecksumAddress('0x1C0F620155e85491f8D35440eb17538Ca5c55212'),
|
|
703
|
-
web3Utils.toChecksumAddress(getAssetInfo('USDC', ChainId.Ethereum).address),
|
|
704
|
-
160, 220, 180, 190,
|
|
705
|
-
true, false,
|
|
706
|
-
]
|
|
707
|
-
],
|
|
708
|
-
[
|
|
709
|
-
[
|
|
710
|
-
web3Utils.toChecksumAddress('0xaC0F620155e85491f8D35440eb17538Ca5c55212'),
|
|
711
|
-
web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address),
|
|
712
|
-
new Dec(160).mul(1e16).toString(),
|
|
713
|
-
new Dec(210).mul(1e16).toString(),
|
|
714
|
-
new Dec(180).mul(1e16).toString(),
|
|
715
|
-
new Dec(190).mul(1e16).toString(),
|
|
716
|
-
false, true,
|
|
717
|
-
],
|
|
718
|
-
[
|
|
719
|
-
web3Utils.toChecksumAddress('0xaC0F620155e85491f8D35440eb17538Ca5c55212'),
|
|
720
|
-
web3Utils.toChecksumAddress(getAssetInfo('WETH', ChainId.Ethereum).address),
|
|
721
|
-
160, 210, 180, 190,
|
|
722
|
-
false, true,
|
|
723
|
-
]
|
|
724
|
-
],
|
|
725
|
-
];
|
|
726
|
-
examples.forEach(([expected, actual]) => {
|
|
727
|
-
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
728
|
-
expect(subDataService.compoundV3LeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
729
|
-
});
|
|
730
|
-
});
|
|
731
|
-
});
|
|
732
|
-
describe('decode()', () => {
|
|
733
|
-
const examples = [
|
|
734
|
-
[
|
|
735
|
-
{ targetRatio: 123 },
|
|
736
|
-
[
|
|
737
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
738
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001111d67bb1bb0000',
|
|
739
|
-
],
|
|
740
|
-
],
|
|
741
|
-
[
|
|
742
|
-
{ targetRatio: 200 },
|
|
743
|
-
[
|
|
744
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
745
|
-
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
746
|
-
],
|
|
747
|
-
],
|
|
748
|
-
];
|
|
749
|
-
examples.forEach(([expected, actual]) => {
|
|
750
|
-
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
751
|
-
expect(subDataService.compoundV3LeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
752
|
-
});
|
|
753
|
-
});
|
|
754
|
-
});
|
|
755
|
-
});
|
|
756
688
|
describe('When testing subDataService.morphoAaveV2LeverageManagementSubData', () => {
|
|
757
689
|
describe('encode()', () => {
|
|
758
690
|
const examples = [
|
package/esm/services/utils.d.ts
CHANGED
|
@@ -28,5 +28,5 @@ export declare function getStopLossAndTakeProfitTypeByCloseStrategyType(closeStr
|
|
|
28
28
|
stopLossType: CloseToAssetType | undefined;
|
|
29
29
|
takeProfitType: CloseToAssetType | undefined;
|
|
30
30
|
};
|
|
31
|
-
export declare function getBundleIdsByNetwork(network: ChainId): typeof Bundles.MainnetIds | typeof Bundles.
|
|
31
|
+
export declare function getBundleIdsByNetwork(network: ChainId): typeof Bundles.MainnetIds | typeof Bundles.ArbitrumIds | typeof Bundles.BaseIds;
|
|
32
32
|
export declare function getCompoundV3LeverageManagementBundleId(network: ChainId, isEOA: boolean, isBoost: boolean): number;
|
package/esm/services/utils.js
CHANGED
|
@@ -138,15 +138,15 @@ export function getStopLossAndTakeProfitTypeByCloseStrategyType(closeStrategyTyp
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
export function getBundleIdsByNetwork(network) {
|
|
141
|
-
switch (network) {
|
|
141
|
+
switch (Number(network)) {
|
|
142
|
+
case ChainId.Ethereum:
|
|
143
|
+
return Bundles.MainnetIds;
|
|
142
144
|
case ChainId.Arbitrum:
|
|
143
145
|
return Bundles.ArbitrumIds;
|
|
144
146
|
case ChainId.Base:
|
|
145
147
|
return Bundles.BaseIds;
|
|
146
|
-
case ChainId.Optimism:
|
|
147
|
-
return Bundles.OptimismIds;
|
|
148
148
|
default:
|
|
149
|
-
|
|
149
|
+
throw new Error(`Unsupported network ${network}`);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
// Mainnet uses the V2 bundle ids; L2s use the original bundle ids.
|
package/esm/types/enums.d.ts
CHANGED
|
@@ -140,7 +140,7 @@ export declare namespace Strategies {
|
|
|
140
140
|
CollateralSwitch = "collateral-switch",
|
|
141
141
|
EoaCollateralSwitch = "eoa-collateral-switch",
|
|
142
142
|
LiquidationProtection = "liquidation-protection",
|
|
143
|
-
EoaLiquidationProtection = "
|
|
143
|
+
EoaLiquidationProtection = "liquidation-protection-eoa"
|
|
144
144
|
}
|
|
145
145
|
enum IdOverrides {
|
|
146
146
|
TakeProfit = "take-profit",
|
|
@@ -229,14 +229,17 @@ export declare namespace Bundles {
|
|
|
229
229
|
AAVE_V4_EOA_REPAY_ON_PRICE = 68,
|
|
230
230
|
AAVE_V4_EOA_BOOST_ON_PRICE = 69,
|
|
231
231
|
AAVE_V4_EOA_CLOSE = 70,
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
232
|
+
AAVE_V3_SW_LIQUIDATION_PROTECTION = 71,
|
|
233
|
+
SPARK_SW_LIQUIDATION_PROTECTION = 72,
|
|
234
|
+
MAKER_SW_LIQUIDATION_PROTECTION = 75,
|
|
235
|
+
FLUID_T1_SW_LIQUIDATION_PROTECTION = 76,
|
|
236
|
+
AAVE_V4_SW_LIQUIDATION_PROTECTION = 77,
|
|
237
|
+
MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 78,
|
|
238
|
+
AAVE_V3_EOA_LIQUIDATION_PROTECTION = 79,
|
|
239
|
+
AAVE_V4_EOA_LIQUIDATION_PROTECTION = 80,
|
|
240
|
+
MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 81,
|
|
241
|
+
COMP_V3_SW_LIQUIDATION_PROTECTION = 82,
|
|
242
|
+
COMP_V3_EOA_LIQUIDATION_PROTECTION = 83
|
|
240
243
|
}
|
|
241
244
|
enum OptimismIds {
|
|
242
245
|
AAVE_V3_REPAY = 0,
|
|
@@ -250,7 +253,8 @@ export declare namespace Bundles {
|
|
|
250
253
|
AAVE_V3_EOA_REPAY_ON_PRICE = 8,
|
|
251
254
|
AAVE_V3_EOA_BOOST_ON_PRICE = 9,
|
|
252
255
|
AAVE_V3_EOA_CLOSE = 10,
|
|
253
|
-
|
|
256
|
+
AAVE_V3_SW_LIQUIDATION_PROTECTION = 11,
|
|
257
|
+
AAVE_V3_EOA_LIQUIDATION_PROTECTION = 12
|
|
254
258
|
}
|
|
255
259
|
enum BaseIds {
|
|
256
260
|
AAVE_V3_REPAY = 0,
|
|
@@ -280,11 +284,12 @@ export declare namespace Bundles {
|
|
|
280
284
|
AAVE_V3_EOA_BOOST_ON_PRICE = 26,
|
|
281
285
|
AAVE_V3_EOA_CLOSE = 27,
|
|
282
286
|
MORPHO_BLUE_CLOSE = 28,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
MORPHO_BLUE_LIQUIDATION_PROTECTION = 31,
|
|
287
|
+
AAVE_V3_SW_LIQUIDATION_PROTECTION = 29,
|
|
288
|
+
FLUID_T1_SW_LIQUIDATION_PROTECTION = 30,
|
|
286
289
|
COMP_V3_SW_LIQUIDATION_PROTECTION = 32,
|
|
287
|
-
COMP_V3_EOA_LIQUIDATION_PROTECTION = 33
|
|
290
|
+
COMP_V3_EOA_LIQUIDATION_PROTECTION = 33,
|
|
291
|
+
AAVE_V3_EOA_LIQUIDATION_PROTECTION = 34,
|
|
292
|
+
MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 35
|
|
288
293
|
}
|
|
289
294
|
enum ArbitrumIds {
|
|
290
295
|
AAVE_V3_REPAY = 0,
|
|
@@ -316,10 +321,12 @@ export declare namespace Bundles {
|
|
|
316
321
|
MORPHO_BLUE_EOA_REPAY = 26,
|
|
317
322
|
MORPHO_BLUE_EOA_BOOST = 27,
|
|
318
323
|
MORPHO_BLUE_CLOSE = 28,
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
324
|
+
AAVE_V3_SW_LIQUIDATION_PROTECTION = 29,
|
|
325
|
+
FLUID_T1_SW_LIQUIDATION_PROTECTION = 30,
|
|
326
|
+
MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 31,
|
|
322
327
|
COMP_V3_SW_LIQUIDATION_PROTECTION = 32,
|
|
323
|
-
COMP_V3_EOA_LIQUIDATION_PROTECTION = 33
|
|
328
|
+
COMP_V3_EOA_LIQUIDATION_PROTECTION = 33,
|
|
329
|
+
AAVE_V3_EOA_LIQUIDATION_PROTECTION = 34,
|
|
330
|
+
MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 35
|
|
324
331
|
}
|
|
325
332
|
}
|
package/esm/types/enums.js
CHANGED
|
@@ -157,7 +157,7 @@ export var Strategies;
|
|
|
157
157
|
Identifiers["CollateralSwitch"] = "collateral-switch";
|
|
158
158
|
Identifiers["EoaCollateralSwitch"] = "eoa-collateral-switch";
|
|
159
159
|
Identifiers["LiquidationProtection"] = "liquidation-protection";
|
|
160
|
-
Identifiers["EoaLiquidationProtection"] = "
|
|
160
|
+
Identifiers["EoaLiquidationProtection"] = "liquidation-protection-eoa";
|
|
161
161
|
})(Identifiers = Strategies.Identifiers || (Strategies.Identifiers = {}));
|
|
162
162
|
let IdOverrides;
|
|
163
163
|
(function (IdOverrides) {
|
|
@@ -249,14 +249,17 @@ export var Bundles;
|
|
|
249
249
|
MainnetIds[MainnetIds["AAVE_V4_EOA_REPAY_ON_PRICE"] = 68] = "AAVE_V4_EOA_REPAY_ON_PRICE";
|
|
250
250
|
MainnetIds[MainnetIds["AAVE_V4_EOA_BOOST_ON_PRICE"] = 69] = "AAVE_V4_EOA_BOOST_ON_PRICE";
|
|
251
251
|
MainnetIds[MainnetIds["AAVE_V4_EOA_CLOSE"] = 70] = "AAVE_V4_EOA_CLOSE";
|
|
252
|
-
MainnetIds[MainnetIds["
|
|
253
|
-
MainnetIds[MainnetIds["
|
|
254
|
-
MainnetIds[MainnetIds["
|
|
255
|
-
MainnetIds[MainnetIds["
|
|
256
|
-
MainnetIds[MainnetIds["
|
|
257
|
-
MainnetIds[MainnetIds["
|
|
258
|
-
MainnetIds[MainnetIds["
|
|
259
|
-
MainnetIds[MainnetIds["
|
|
252
|
+
MainnetIds[MainnetIds["AAVE_V3_SW_LIQUIDATION_PROTECTION"] = 71] = "AAVE_V3_SW_LIQUIDATION_PROTECTION";
|
|
253
|
+
MainnetIds[MainnetIds["SPARK_SW_LIQUIDATION_PROTECTION"] = 72] = "SPARK_SW_LIQUIDATION_PROTECTION";
|
|
254
|
+
MainnetIds[MainnetIds["MAKER_SW_LIQUIDATION_PROTECTION"] = 75] = "MAKER_SW_LIQUIDATION_PROTECTION";
|
|
255
|
+
MainnetIds[MainnetIds["FLUID_T1_SW_LIQUIDATION_PROTECTION"] = 76] = "FLUID_T1_SW_LIQUIDATION_PROTECTION";
|
|
256
|
+
MainnetIds[MainnetIds["AAVE_V4_SW_LIQUIDATION_PROTECTION"] = 77] = "AAVE_V4_SW_LIQUIDATION_PROTECTION";
|
|
257
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_SW_LIQUIDATION_PROTECTION"] = 78] = "MORPHO_BLUE_SW_LIQUIDATION_PROTECTION";
|
|
258
|
+
MainnetIds[MainnetIds["AAVE_V3_EOA_LIQUIDATION_PROTECTION"] = 79] = "AAVE_V3_EOA_LIQUIDATION_PROTECTION";
|
|
259
|
+
MainnetIds[MainnetIds["AAVE_V4_EOA_LIQUIDATION_PROTECTION"] = 80] = "AAVE_V4_EOA_LIQUIDATION_PROTECTION";
|
|
260
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION"] = 81] = "MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION";
|
|
261
|
+
MainnetIds[MainnetIds["COMP_V3_SW_LIQUIDATION_PROTECTION"] = 82] = "COMP_V3_SW_LIQUIDATION_PROTECTION";
|
|
262
|
+
MainnetIds[MainnetIds["COMP_V3_EOA_LIQUIDATION_PROTECTION"] = 83] = "COMP_V3_EOA_LIQUIDATION_PROTECTION";
|
|
260
263
|
})(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
|
|
261
264
|
let OptimismIds;
|
|
262
265
|
(function (OptimismIds) {
|
|
@@ -271,7 +274,8 @@ export var Bundles;
|
|
|
271
274
|
OptimismIds[OptimismIds["AAVE_V3_EOA_REPAY_ON_PRICE"] = 8] = "AAVE_V3_EOA_REPAY_ON_PRICE";
|
|
272
275
|
OptimismIds[OptimismIds["AAVE_V3_EOA_BOOST_ON_PRICE"] = 9] = "AAVE_V3_EOA_BOOST_ON_PRICE";
|
|
273
276
|
OptimismIds[OptimismIds["AAVE_V3_EOA_CLOSE"] = 10] = "AAVE_V3_EOA_CLOSE";
|
|
274
|
-
OptimismIds[OptimismIds["
|
|
277
|
+
OptimismIds[OptimismIds["AAVE_V3_SW_LIQUIDATION_PROTECTION"] = 11] = "AAVE_V3_SW_LIQUIDATION_PROTECTION";
|
|
278
|
+
OptimismIds[OptimismIds["AAVE_V3_EOA_LIQUIDATION_PROTECTION"] = 12] = "AAVE_V3_EOA_LIQUIDATION_PROTECTION";
|
|
275
279
|
})(OptimismIds = Bundles.OptimismIds || (Bundles.OptimismIds = {}));
|
|
276
280
|
let BaseIds;
|
|
277
281
|
(function (BaseIds) {
|
|
@@ -302,11 +306,12 @@ export var Bundles;
|
|
|
302
306
|
BaseIds[BaseIds["AAVE_V3_EOA_BOOST_ON_PRICE"] = 26] = "AAVE_V3_EOA_BOOST_ON_PRICE";
|
|
303
307
|
BaseIds[BaseIds["AAVE_V3_EOA_CLOSE"] = 27] = "AAVE_V3_EOA_CLOSE";
|
|
304
308
|
BaseIds[BaseIds["MORPHO_BLUE_CLOSE"] = 28] = "MORPHO_BLUE_CLOSE";
|
|
305
|
-
BaseIds[BaseIds["
|
|
306
|
-
BaseIds[BaseIds["
|
|
307
|
-
BaseIds[BaseIds["MORPHO_BLUE_LIQUIDATION_PROTECTION"] = 31] = "MORPHO_BLUE_LIQUIDATION_PROTECTION";
|
|
309
|
+
BaseIds[BaseIds["AAVE_V3_SW_LIQUIDATION_PROTECTION"] = 29] = "AAVE_V3_SW_LIQUIDATION_PROTECTION";
|
|
310
|
+
BaseIds[BaseIds["FLUID_T1_SW_LIQUIDATION_PROTECTION"] = 30] = "FLUID_T1_SW_LIQUIDATION_PROTECTION";
|
|
308
311
|
BaseIds[BaseIds["COMP_V3_SW_LIQUIDATION_PROTECTION"] = 32] = "COMP_V3_SW_LIQUIDATION_PROTECTION";
|
|
309
312
|
BaseIds[BaseIds["COMP_V3_EOA_LIQUIDATION_PROTECTION"] = 33] = "COMP_V3_EOA_LIQUIDATION_PROTECTION";
|
|
313
|
+
BaseIds[BaseIds["AAVE_V3_EOA_LIQUIDATION_PROTECTION"] = 34] = "AAVE_V3_EOA_LIQUIDATION_PROTECTION";
|
|
314
|
+
BaseIds[BaseIds["MORPHO_BLUE_SW_LIQUIDATION_PROTECTION"] = 35] = "MORPHO_BLUE_SW_LIQUIDATION_PROTECTION";
|
|
310
315
|
})(BaseIds = Bundles.BaseIds || (Bundles.BaseIds = {}));
|
|
311
316
|
let ArbitrumIds;
|
|
312
317
|
(function (ArbitrumIds) {
|
|
@@ -339,10 +344,12 @@ export var Bundles;
|
|
|
339
344
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_REPAY"] = 26] = "MORPHO_BLUE_EOA_REPAY";
|
|
340
345
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_BOOST"] = 27] = "MORPHO_BLUE_EOA_BOOST";
|
|
341
346
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_CLOSE"] = 28] = "MORPHO_BLUE_CLOSE";
|
|
342
|
-
ArbitrumIds[ArbitrumIds["
|
|
343
|
-
ArbitrumIds[ArbitrumIds["
|
|
344
|
-
ArbitrumIds[ArbitrumIds["
|
|
347
|
+
ArbitrumIds[ArbitrumIds["AAVE_V3_SW_LIQUIDATION_PROTECTION"] = 29] = "AAVE_V3_SW_LIQUIDATION_PROTECTION";
|
|
348
|
+
ArbitrumIds[ArbitrumIds["FLUID_T1_SW_LIQUIDATION_PROTECTION"] = 30] = "FLUID_T1_SW_LIQUIDATION_PROTECTION";
|
|
349
|
+
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_SW_LIQUIDATION_PROTECTION"] = 31] = "MORPHO_BLUE_SW_LIQUIDATION_PROTECTION";
|
|
345
350
|
ArbitrumIds[ArbitrumIds["COMP_V3_SW_LIQUIDATION_PROTECTION"] = 32] = "COMP_V3_SW_LIQUIDATION_PROTECTION";
|
|
346
351
|
ArbitrumIds[ArbitrumIds["COMP_V3_EOA_LIQUIDATION_PROTECTION"] = 33] = "COMP_V3_EOA_LIQUIDATION_PROTECTION";
|
|
352
|
+
ArbitrumIds[ArbitrumIds["AAVE_V3_EOA_LIQUIDATION_PROTECTION"] = 34] = "AAVE_V3_EOA_LIQUIDATION_PROTECTION";
|
|
353
|
+
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION"] = 35] = "MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION";
|
|
347
354
|
})(ArbitrumIds = Bundles.ArbitrumIds || (Bundles.ArbitrumIds = {}));
|
|
348
355
|
})(Bundles || (Bundles = {}));
|
package/package.json
CHANGED
package/src/constants/index.ts
CHANGED
|
@@ -573,23 +573,23 @@ export const MAINNET_BUNDLES_INFO: MainnetBundleInfo = {
|
|
|
573
573
|
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
574
574
|
protocol: PROTOCOLS.AaveV4,
|
|
575
575
|
},
|
|
576
|
-
[Bundles.MainnetIds.
|
|
577
|
-
strategyOrBundleId: Bundles.MainnetIds.
|
|
576
|
+
[Bundles.MainnetIds.MAKER_SW_LIQUIDATION_PROTECTION]: {
|
|
577
|
+
strategyOrBundleId: Bundles.MainnetIds.MAKER_SW_LIQUIDATION_PROTECTION,
|
|
578
578
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
579
579
|
protocol: PROTOCOLS.MakerDAO,
|
|
580
580
|
},
|
|
581
|
-
[Bundles.MainnetIds.
|
|
582
|
-
strategyOrBundleId: Bundles.MainnetIds.
|
|
581
|
+
[Bundles.MainnetIds.AAVE_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
582
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_SW_LIQUIDATION_PROTECTION,
|
|
583
583
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
584
584
|
protocol: PROTOCOLS.AaveV3,
|
|
585
585
|
},
|
|
586
|
-
[Bundles.MainnetIds.
|
|
587
|
-
strategyOrBundleId: Bundles.MainnetIds.
|
|
586
|
+
[Bundles.MainnetIds.AAVE_V4_SW_LIQUIDATION_PROTECTION]: {
|
|
587
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_SW_LIQUIDATION_PROTECTION,
|
|
588
588
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
589
589
|
protocol: PROTOCOLS.AaveV4,
|
|
590
590
|
},
|
|
591
|
-
[Bundles.MainnetIds.
|
|
592
|
-
strategyOrBundleId: Bundles.MainnetIds.
|
|
591
|
+
[Bundles.MainnetIds.SPARK_SW_LIQUIDATION_PROTECTION]: {
|
|
592
|
+
strategyOrBundleId: Bundles.MainnetIds.SPARK_SW_LIQUIDATION_PROTECTION,
|
|
593
593
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
594
594
|
protocol: PROTOCOLS.Spark,
|
|
595
595
|
},
|
|
@@ -600,19 +600,35 @@ export const MAINNET_BUNDLES_INFO: MainnetBundleInfo = {
|
|
|
600
600
|
},
|
|
601
601
|
[Bundles.MainnetIds.COMP_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
602
602
|
strategyOrBundleId: Bundles.MainnetIds.COMP_V3_EOA_LIQUIDATION_PROTECTION,
|
|
603
|
-
strategyId: Strategies.Identifiers.
|
|
603
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
604
604
|
protocol: PROTOCOLS.CompoundV3,
|
|
605
605
|
},
|
|
606
|
-
[Bundles.MainnetIds.
|
|
607
|
-
strategyOrBundleId:
|
|
606
|
+
[Bundles.MainnetIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION]: {
|
|
607
|
+
strategyOrBundleId:
|
|
608
|
+
Bundles.MainnetIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION,
|
|
608
609
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
609
610
|
protocol: PROTOCOLS.MorphoBlue,
|
|
610
611
|
},
|
|
611
|
-
[Bundles.MainnetIds.
|
|
612
|
-
strategyOrBundleId: Bundles.MainnetIds.
|
|
612
|
+
[Bundles.MainnetIds.FLUID_T1_SW_LIQUIDATION_PROTECTION]: {
|
|
613
|
+
strategyOrBundleId: Bundles.MainnetIds.FLUID_T1_SW_LIQUIDATION_PROTECTION,
|
|
613
614
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
614
615
|
protocol: PROTOCOLS.FluidT1,
|
|
615
616
|
},
|
|
617
|
+
[Bundles.MainnetIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
618
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION,
|
|
619
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
620
|
+
protocol: PROTOCOLS.AaveV3,
|
|
621
|
+
},
|
|
622
|
+
[Bundles.MainnetIds.AAVE_V4_EOA_LIQUIDATION_PROTECTION]: {
|
|
623
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V4_EOA_LIQUIDATION_PROTECTION,
|
|
624
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
625
|
+
protocol: PROTOCOLS.AaveV4,
|
|
626
|
+
},
|
|
627
|
+
[Bundles.MainnetIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION]: {
|
|
628
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION,
|
|
629
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
630
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
631
|
+
},
|
|
616
632
|
};
|
|
617
633
|
|
|
618
634
|
export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {
|
|
@@ -671,12 +687,16 @@ export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {
|
|
|
671
687
|
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
672
688
|
protocol: PROTOCOLS.AaveV3,
|
|
673
689
|
},
|
|
674
|
-
[Bundles.OptimismIds.
|
|
675
|
-
strategyOrBundleId: Bundles.OptimismIds.
|
|
690
|
+
[Bundles.OptimismIds.AAVE_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
691
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_SW_LIQUIDATION_PROTECTION,
|
|
676
692
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
677
693
|
protocol: PROTOCOLS.AaveV3,
|
|
678
694
|
},
|
|
679
|
-
|
|
695
|
+
[Bundles.OptimismIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
696
|
+
strategyOrBundleId: Bundles.OptimismIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION,
|
|
697
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
698
|
+
protocol: PROTOCOLS.AaveV3,
|
|
699
|
+
},
|
|
680
700
|
};
|
|
681
701
|
|
|
682
702
|
export const BASE_BUNDLES_INFO: BaseBundleInfo = {
|
|
@@ -815,8 +835,8 @@ export const BASE_BUNDLES_INFO: BaseBundleInfo = {
|
|
|
815
835
|
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
816
836
|
protocol: PROTOCOLS.MorphoBlue,
|
|
817
837
|
},
|
|
818
|
-
[Bundles.BaseIds.
|
|
819
|
-
strategyOrBundleId: Bundles.BaseIds.
|
|
838
|
+
[Bundles.BaseIds.AAVE_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
839
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_SW_LIQUIDATION_PROTECTION,
|
|
820
840
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
821
841
|
protocol: PROTOCOLS.AaveV3,
|
|
822
842
|
},
|
|
@@ -827,20 +847,24 @@ export const BASE_BUNDLES_INFO: BaseBundleInfo = {
|
|
|
827
847
|
},
|
|
828
848
|
[Bundles.BaseIds.COMP_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
829
849
|
strategyOrBundleId: Bundles.BaseIds.COMP_V3_EOA_LIQUIDATION_PROTECTION,
|
|
830
|
-
strategyId: Strategies.Identifiers.
|
|
850
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
831
851
|
protocol: PROTOCOLS.CompoundV3,
|
|
832
852
|
},
|
|
833
|
-
[Bundles.BaseIds.
|
|
834
|
-
strategyOrBundleId: Bundles.BaseIds.
|
|
853
|
+
[Bundles.BaseIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION]: {
|
|
854
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION,
|
|
835
855
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
836
856
|
protocol: PROTOCOLS.MorphoBlue,
|
|
837
857
|
},
|
|
838
|
-
[Bundles.BaseIds.
|
|
839
|
-
strategyOrBundleId: Bundles.BaseIds.
|
|
858
|
+
[Bundles.BaseIds.FLUID_T1_SW_LIQUIDATION_PROTECTION]: {
|
|
859
|
+
strategyOrBundleId: Bundles.BaseIds.FLUID_T1_SW_LIQUIDATION_PROTECTION,
|
|
840
860
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
841
861
|
protocol: PROTOCOLS.FluidT1,
|
|
842
862
|
},
|
|
843
|
-
|
|
863
|
+
[Bundles.BaseIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
864
|
+
strategyOrBundleId: Bundles.BaseIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION,
|
|
865
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
866
|
+
protocol: PROTOCOLS.AaveV3,
|
|
867
|
+
},
|
|
844
868
|
};
|
|
845
869
|
|
|
846
870
|
export const ARBITRUM_BUNDLES_INFO: ArbitrumBundleInfo = {
|
|
@@ -989,8 +1013,8 @@ export const ARBITRUM_BUNDLES_INFO: ArbitrumBundleInfo = {
|
|
|
989
1013
|
strategyId: Strategies.Identifiers.CloseOnPrice,
|
|
990
1014
|
protocol: PROTOCOLS.MorphoBlue,
|
|
991
1015
|
},
|
|
992
|
-
[Bundles.ArbitrumIds.
|
|
993
|
-
strategyOrBundleId: Bundles.ArbitrumIds.
|
|
1016
|
+
[Bundles.ArbitrumIds.AAVE_V3_SW_LIQUIDATION_PROTECTION]: {
|
|
1017
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_SW_LIQUIDATION_PROTECTION,
|
|
994
1018
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
995
1019
|
protocol: PROTOCOLS.AaveV3,
|
|
996
1020
|
},
|
|
@@ -1001,19 +1025,30 @@ export const ARBITRUM_BUNDLES_INFO: ArbitrumBundleInfo = {
|
|
|
1001
1025
|
},
|
|
1002
1026
|
[Bundles.ArbitrumIds.COMP_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
1003
1027
|
strategyOrBundleId: Bundles.ArbitrumIds.COMP_V3_EOA_LIQUIDATION_PROTECTION,
|
|
1004
|
-
strategyId: Strategies.Identifiers.
|
|
1028
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
1005
1029
|
protocol: PROTOCOLS.CompoundV3,
|
|
1006
1030
|
},
|
|
1007
|
-
[Bundles.ArbitrumIds.
|
|
1008
|
-
strategyOrBundleId:
|
|
1031
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION]: {
|
|
1032
|
+
strategyOrBundleId:
|
|
1033
|
+
Bundles.ArbitrumIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION,
|
|
1009
1034
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
1010
1035
|
protocol: PROTOCOLS.MorphoBlue,
|
|
1011
1036
|
},
|
|
1012
|
-
[Bundles.ArbitrumIds.
|
|
1013
|
-
strategyOrBundleId: Bundles.ArbitrumIds.
|
|
1037
|
+
[Bundles.ArbitrumIds.FLUID_T1_SW_LIQUIDATION_PROTECTION]: {
|
|
1038
|
+
strategyOrBundleId: Bundles.ArbitrumIds.FLUID_T1_SW_LIQUIDATION_PROTECTION,
|
|
1014
1039
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
1015
1040
|
protocol: PROTOCOLS.FluidT1,
|
|
1016
1041
|
},
|
|
1042
|
+
[Bundles.ArbitrumIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION]: {
|
|
1043
|
+
strategyOrBundleId: Bundles.ArbitrumIds.AAVE_V3_EOA_LIQUIDATION_PROTECTION,
|
|
1044
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
1045
|
+
protocol: PROTOCOLS.AaveV3,
|
|
1046
|
+
},
|
|
1047
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION]: {
|
|
1048
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION,
|
|
1049
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
1050
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1051
|
+
},
|
|
1017
1052
|
};
|
|
1018
1053
|
|
|
1019
1054
|
export const BUNDLES_INFO: BundlesInfo = {
|
|
@@ -158,11 +158,10 @@ function parseMakerLiquidationProtection(position: Position.Automated, parseData
|
|
|
158
158
|
_position.specific = {
|
|
159
159
|
triggerRepayRatio: triggerData.ratio,
|
|
160
160
|
targetRepayRatio: subData.targetRatio,
|
|
161
|
-
repayEnabled: isEnabled,
|
|
161
|
+
repayEnabled: isEnabled,
|
|
162
162
|
subId1: Number(subId),
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
// TODO -> Is this ok?
|
|
166
165
|
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
167
166
|
|
|
168
167
|
return _position;
|
|
@@ -315,7 +314,6 @@ function parseAaveV3LiquidationProtection(position: Position.Automated, parseDat
|
|
|
315
314
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
316
315
|
|
|
317
316
|
const triggerData = triggerService.aaveV3RatioTrigger.decode(subStruct.triggerData);
|
|
318
|
-
// const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
319
317
|
|
|
320
318
|
const subData = subDataService.aaveV3LiquidationProtectionSubData.decode(subStruct.subData);
|
|
321
319
|
|
|
@@ -332,8 +330,8 @@ function parseAaveV3LiquidationProtection(position: Position.Automated, parseDat
|
|
|
332
330
|
subHashRepay: subHash,
|
|
333
331
|
};
|
|
334
332
|
|
|
335
|
-
|
|
336
|
-
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
333
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
334
|
+
_position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLiquidationProtection : Strategies.IdOverrides.LiquidationProtection;
|
|
337
335
|
|
|
338
336
|
return _position;
|
|
339
337
|
}
|
|
@@ -501,13 +499,12 @@ function parseAaveV4LiquidationProtection(position: Position.Automated, parseDat
|
|
|
501
499
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
502
500
|
const triggerData = triggerService.aaveV4RatioTrigger.decode(subStruct.triggerData);
|
|
503
501
|
const subData = subDataService.aaveV4LiquidationProtectionSubData.decode(subStruct.subData);
|
|
504
|
-
|
|
505
|
-
// const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId as Strategies.Identifiers);
|
|
502
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
506
503
|
|
|
507
504
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
508
505
|
_position.strategyData.decoded.subData = subData;
|
|
509
506
|
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.spoke);
|
|
510
|
-
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
507
|
+
_position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLiquidationProtection : Strategies.IdOverrides.LiquidationProtection;
|
|
511
508
|
|
|
512
509
|
_position.specific = {
|
|
513
510
|
triggerRepayRatio: triggerData.ratio,
|
|
@@ -761,7 +758,7 @@ function parseCompoundV3LiquidationProtection(position: Position.Automated, pars
|
|
|
761
758
|
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
762
759
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
763
760
|
|
|
764
|
-
const subDataDecoder = subDataService.
|
|
761
|
+
const subDataDecoder = subDataService.compoundV3LiquidationProtectionSubDataWithoutSubProxy;
|
|
765
762
|
|
|
766
763
|
const triggerData = triggerService.compoundV3RatioTrigger.decode(subStruct.triggerData);
|
|
767
764
|
const subData = subDataDecoder.decode(subStruct.subData);
|
|
@@ -771,14 +768,12 @@ function parseCompoundV3LiquidationProtection(position: Position.Automated, pars
|
|
|
771
768
|
|
|
772
769
|
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.market);
|
|
773
770
|
|
|
774
|
-
// const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId as Strategies.Identifiers);
|
|
775
|
-
|
|
776
771
|
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
777
772
|
|
|
778
773
|
_position.specific = {
|
|
779
774
|
triggerRepayRatio: triggerData.ratio,
|
|
780
775
|
targetRepayRatio: subData.targetRatio,
|
|
781
|
-
repayEnabled: isEnabled,
|
|
776
|
+
repayEnabled: isEnabled,
|
|
782
777
|
subId1: Number(subId),
|
|
783
778
|
subHashRepay: subHash,
|
|
784
779
|
};
|
|
@@ -1279,8 +1274,7 @@ function parseMorphoBlueLiquidationProtection(position: Position.Automated, pars
|
|
|
1279
1274
|
};
|
|
1280
1275
|
|
|
1281
1276
|
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
1282
|
-
|
|
1283
|
-
_position.strategy.strategyId = Strategies.IdOverrides.LiquidationProtection;
|
|
1277
|
+
_position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLiquidationProtection : Strategies.IdOverrides.LiquidationProtection;
|
|
1284
1278
|
|
|
1285
1279
|
return _position;
|
|
1286
1280
|
}
|
|
@@ -1571,6 +1565,7 @@ const parsingMethodsMapping: StrategiesToProtocolVersionMapping = {
|
|
|
1571
1565
|
[Strategies.Identifiers.EoaCloseOnPrice]: parseAaveV3CloseOnPrice,
|
|
1572
1566
|
[Strategies.Identifiers.CollateralSwitch]: parseAaveV3CollateralSwitch,
|
|
1573
1567
|
[Strategies.Identifiers.LiquidationProtection]: parseAaveV3LiquidationProtection,
|
|
1568
|
+
[Strategies.Identifiers.EoaLiquidationProtection]: parseAaveV3LiquidationProtection,
|
|
1574
1569
|
},
|
|
1575
1570
|
[ProtocolIdentifiers.StrategiesAutomation.AaveV4]: {
|
|
1576
1571
|
[Strategies.Identifiers.Repay]: parseAaveV4LeverageManagement,
|
|
@@ -1586,6 +1581,7 @@ const parsingMethodsMapping: StrategiesToProtocolVersionMapping = {
|
|
|
1586
1581
|
[Strategies.Identifiers.CollateralSwitch]: parseAaveV4CollateralSwitch,
|
|
1587
1582
|
[Strategies.Identifiers.EoaCollateralSwitch]: parseAaveV4CollateralSwitch,
|
|
1588
1583
|
[Strategies.Identifiers.LiquidationProtection]: parseAaveV4LiquidationProtection,
|
|
1584
|
+
[Strategies.Identifiers.EoaLiquidationProtection]: parseAaveV4LiquidationProtection,
|
|
1589
1585
|
},
|
|
1590
1586
|
[ProtocolIdentifiers.StrategiesAutomation.CompoundV2]: {
|
|
1591
1587
|
[Strategies.Identifiers.Repay]: parseCompoundV2LeverageManagement,
|
|
@@ -1602,7 +1598,6 @@ const parsingMethodsMapping: StrategiesToProtocolVersionMapping = {
|
|
|
1602
1598
|
[Strategies.Identifiers.EoaBoostOnPrice]: parseCompoundV3LeverageManagementOnPrice,
|
|
1603
1599
|
[Strategies.Identifiers.CloseOnPrice]: parseCompoundV3CloseOnPrice,
|
|
1604
1600
|
[Strategies.Identifiers.EoaCloseOnPrice]: parseCompoundV3CloseOnPrice,
|
|
1605
|
-
// TODO -> here should prob separate EOA from SW
|
|
1606
1601
|
[Strategies.Identifiers.LiquidationProtection]: parseCompoundV3LiquidationProtection,
|
|
1607
1602
|
[Strategies.Identifiers.EoaLiquidationProtection]: parseCompoundV3LiquidationProtection,
|
|
1608
1603
|
},
|
|
@@ -1639,6 +1634,7 @@ const parsingMethodsMapping: StrategiesToProtocolVersionMapping = {
|
|
|
1639
1634
|
[Strategies.Identifiers.BoostOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
|
|
1640
1635
|
[Strategies.Identifiers.CloseOnPrice]: parseMorphoBlueCloseOnPrice,
|
|
1641
1636
|
[Strategies.Identifiers.LiquidationProtection]: parseMorphoBlueLiquidationProtection,
|
|
1637
|
+
[Strategies.Identifiers.EoaLiquidationProtection]: parseMorphoBlueLiquidationProtection,
|
|
1642
1638
|
},
|
|
1643
1639
|
[ProtocolIdentifiers.StrategiesAutomation.FluidT1]: {
|
|
1644
1640
|
[Strategies.Identifiers.Repay]: parseFluidT1LeverageManagement,
|
|
@@ -114,7 +114,7 @@ export const makerEncode = {
|
|
|
114
114
|
ratioState: RatioState,
|
|
115
115
|
daiAddr?: EthereumAddress,
|
|
116
116
|
) {
|
|
117
|
-
const bundleId = Bundles.MainnetIds.
|
|
117
|
+
const bundleId = Bundles.MainnetIds.MAKER_SW_LIQUIDATION_PROTECTION;
|
|
118
118
|
|
|
119
119
|
const triggerData = triggerService.makerRatioTrigger.encode(vaultId, triggerRatio, ratioState);
|
|
120
120
|
const subData = subDataService.makerLiquidationProtectionSubData.encode(vaultId, targetRatio, daiAddr);
|
|
@@ -487,17 +487,21 @@ export const compoundV3Encode = {
|
|
|
487
487
|
return [strategyOrBundleId, isBundle, triggerData, subData];
|
|
488
488
|
},
|
|
489
489
|
|
|
490
|
-
|
|
490
|
+
liquidationProtectionWithoutSubProxy(
|
|
491
|
+
strategyOrBundleId: number,
|
|
491
492
|
market: EthereumAddress,
|
|
492
493
|
baseToken: EthereumAddress,
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
boostEnabled: boolean,
|
|
498
|
-
isEOA: boolean,
|
|
494
|
+
user: EthereumAddress,
|
|
495
|
+
ratioState: RatioState,
|
|
496
|
+
targetRatio: number,
|
|
497
|
+
triggerRatio: number,
|
|
499
498
|
) {
|
|
500
|
-
|
|
499
|
+
const isBundle = true;
|
|
500
|
+
|
|
501
|
+
const subData = subDataService.compoundV3LiquidationProtectionSubDataWithoutSubProxy.encode(market, baseToken, targetRatio, ratioState);
|
|
502
|
+
const triggerData = triggerService.compoundV3RatioTrigger.encode(user, market, triggerRatio, ratioState);
|
|
503
|
+
|
|
504
|
+
return [strategyOrBundleId, isBundle, triggerData, subData];
|
|
501
505
|
},
|
|
502
506
|
|
|
503
507
|
leverageManagementOnPrice(
|
|
@@ -785,8 +789,11 @@ export const morphoBlueEncode = {
|
|
|
785
789
|
|
|
786
790
|
const triggerData = triggerService.morphoBlueRatioTrigger.encode(marketId, user, triggerRatio, ratioState);
|
|
787
791
|
|
|
788
|
-
|
|
789
|
-
|
|
792
|
+
|
|
793
|
+
// Type casting because there is no MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION for Base chain.
|
|
794
|
+
// That is fine because we will just always send isEOA == false for Base chain.
|
|
795
|
+
const bundleNetwork = getBundleIdsByNetwork(network) as typeof Bundles.MainnetIds;
|
|
796
|
+
const bundleId = isEOA ? bundleNetwork.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION : bundleNetwork.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION;
|
|
790
797
|
const isBundle = true;
|
|
791
798
|
|
|
792
799
|
return [bundleId, isBundle, triggerData, subData];
|