@defisaver/automation-sdk 3.3.14-strategies-refactor-dev → 3.3.15-liq-prot-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 +95 -0
- package/cjs/index.d.ts +4 -3
- package/cjs/index.js +6 -2
- package/cjs/services/strategiesService.js +151 -0
- package/cjs/services/strategySubService.d.ts +9 -2
- package/cjs/services/strategySubService.js +47 -1
- package/cjs/services/subDataService.d.ts +64 -0
- package/cjs/services/subDataService.js +199 -5
- package/cjs/services/utils.d.ts +3 -1
- package/cjs/services/utils.js +34 -1
- package/cjs/services/utils.test.js +25 -0
- package/cjs/types/enums.d.ts +29 -6
- package/cjs/types/enums.js +23 -0
- package/esm/constants/index.js +95 -0
- package/esm/index.d.ts +4 -3
- package/esm/index.js +7 -3
- package/esm/services/strategiesService.js +151 -0
- package/esm/services/strategySubService.d.ts +9 -2
- package/esm/services/strategySubService.js +48 -2
- package/esm/services/subDataService.d.ts +64 -0
- package/esm/services/subDataService.js +197 -3
- package/esm/services/utils.d.ts +3 -1
- package/esm/services/utils.js +32 -1
- package/esm/services/utils.test.js +27 -2
- package/esm/types/enums.d.ts +29 -6
- package/esm/types/enums.js +23 -0
- package/package.json +1 -1
- package/src/constants/index.ts +96 -0
- package/src/index.ts +24 -6
- package/src/services/strategiesService.ts +216 -0
- package/src/services/strategySubService.ts +142 -5
- package/src/services/subDataService.ts +283 -3
- package/src/services/utils.test.ts +32 -1
- package/src/services/utils.ts +32 -1
- package/src/types/enums.ts +23 -0
|
@@ -71,6 +71,14 @@ export declare const makerLeverageManagementWithoutSubProxy: {
|
|
|
71
71
|
daiAddr: string;
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
+
export declare const makerLiquidationProtectionSubData: {
|
|
75
|
+
encode(vaultId: number, targetRatio: number, daiAddr?: EthereumAddress): string[];
|
|
76
|
+
decode(subData: string[]): {
|
|
77
|
+
vaultId: number;
|
|
78
|
+
targetRatio: number;
|
|
79
|
+
daiAddr: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
74
82
|
/**
|
|
75
83
|
__ __ ______ __ __ __ .___________.____ ____ ____ ____ __
|
|
76
84
|
| | | | / __ \ | | | | | | | |\ \ / / \ \ / / /_ |
|
|
@@ -212,6 +220,13 @@ export declare const aaveV3LeverageManagementSubDataWithoutSubProxy: {
|
|
|
212
220
|
ratioState: RatioState;
|
|
213
221
|
};
|
|
214
222
|
};
|
|
223
|
+
export declare const aaveV3LiquidationProtectionSubData: {
|
|
224
|
+
encode(targetRatio: number, ratioState: RatioState, market: EthereumAddress, user: EthereumAddress): string[];
|
|
225
|
+
decode(subData: string[]): {
|
|
226
|
+
targetRatio: number;
|
|
227
|
+
ratioState: RatioState;
|
|
228
|
+
};
|
|
229
|
+
};
|
|
215
230
|
export declare const aaveV3LeverageManagementOnPriceGeneric: {
|
|
216
231
|
encode(collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, marketAddr: EthereumAddress, targetRatio: number, user: EthereumAddress): string[];
|
|
217
232
|
decode(subData: string[]): {
|
|
@@ -284,6 +299,15 @@ export declare const aaveV4LeverageManagementSubData: {
|
|
|
284
299
|
targetRatio: number;
|
|
285
300
|
};
|
|
286
301
|
};
|
|
302
|
+
export declare const aaveV4LiquidationProtectionSubData: {
|
|
303
|
+
encode: (spoke: EthereumAddress, owner: EthereumAddress, ratioState: RatioState, targetRatio: number) => string[];
|
|
304
|
+
decode: (subData: string[]) => {
|
|
305
|
+
spoke: string;
|
|
306
|
+
owner: string;
|
|
307
|
+
ratioState: RatioState;
|
|
308
|
+
targetRatio: number;
|
|
309
|
+
};
|
|
310
|
+
};
|
|
287
311
|
export declare const aaveV4LeverageManagementOnPriceSubData: {
|
|
288
312
|
encode: (spoke: EthereumAddress, owner: EthereumAddress, collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, ratioState: RatioState, targetRatio: number) => string[];
|
|
289
313
|
decode: (subData: string[]) => {
|
|
@@ -365,6 +389,18 @@ export declare const compoundV3LeverageManagementSubDataWithoutSubProxy: {
|
|
|
365
389
|
ratioState: RatioState;
|
|
366
390
|
};
|
|
367
391
|
};
|
|
392
|
+
export declare const compoundV3LiquidationProtectionSubData: {
|
|
393
|
+
encode(market: EthereumAddress, baseToken: EthereumAddress, triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean, isEOA: boolean): string[];
|
|
394
|
+
decode(subData: string[]): {
|
|
395
|
+
targetRatio: number;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
export declare const compoundV3L2LiquidationProtectionSubData: {
|
|
399
|
+
encode(market: EthereumAddress, baseToken: EthereumAddress, triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean, isEOA: boolean): string;
|
|
400
|
+
decode(subData: string[]): {
|
|
401
|
+
targetRatio: number;
|
|
402
|
+
};
|
|
403
|
+
};
|
|
368
404
|
export declare const compoundV3LeverageManagementOnPriceSubData: {
|
|
369
405
|
encode(market: EthereumAddress, collToken: EthereumAddress, baseToken: EthereumAddress, targetRatio: number, ratioState: RatioState, user: EthereumAddress): string[];
|
|
370
406
|
decode(subData: string[]): {
|
|
@@ -439,6 +475,13 @@ export declare const sparkLeverageManagementSubDataWithoutSubProxy: {
|
|
|
439
475
|
ratioState: RatioState;
|
|
440
476
|
};
|
|
441
477
|
};
|
|
478
|
+
export declare const sparkLiquidationProtectionSubData: {
|
|
479
|
+
encode(targetRatio: number, ratioState: RatioState): string[];
|
|
480
|
+
decode(subData: string[]): {
|
|
481
|
+
targetRatio: number;
|
|
482
|
+
ratioState: RatioState;
|
|
483
|
+
};
|
|
484
|
+
};
|
|
442
485
|
export declare const sparkCloseGenericSubData: {
|
|
443
486
|
encode(collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, closeType: CloseStrategyType, marketAddr: EthereumAddress, user: EthereumAddress): string[];
|
|
444
487
|
decode(subData: string[]): {
|
|
@@ -517,6 +560,18 @@ export declare const morphoBlueLeverageManagementSubData: {
|
|
|
517
560
|
targetRatio: number;
|
|
518
561
|
};
|
|
519
562
|
};
|
|
563
|
+
export declare const morphoBlueLiquidationProtectionSubData: {
|
|
564
|
+
encode: (loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, user: EthereumAddress, isEOA: boolean) => string[];
|
|
565
|
+
decode: (subData: string[]) => {
|
|
566
|
+
loanToken: string;
|
|
567
|
+
collToken: string;
|
|
568
|
+
oracle: string;
|
|
569
|
+
irm: string;
|
|
570
|
+
lltv: string;
|
|
571
|
+
user: string;
|
|
572
|
+
targetRatio: number;
|
|
573
|
+
};
|
|
574
|
+
};
|
|
520
575
|
export declare const morphoBlueLeverageManagementOnPriceSubData: {
|
|
521
576
|
encode(loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, targetRatio: number, user: EthereumAddress): string[];
|
|
522
577
|
decode(subData: string[]): {
|
|
@@ -558,3 +613,12 @@ export declare const fluidLeverageManagementSubData: {
|
|
|
558
613
|
targetRatio: number;
|
|
559
614
|
};
|
|
560
615
|
};
|
|
616
|
+
export declare const fluidLiquidationProtectionSubData: {
|
|
617
|
+
encode: (nftId: string, vault: EthereumAddress, ratioState: RatioState, targetRatio: number) => string[];
|
|
618
|
+
decode: (subData: string[]) => {
|
|
619
|
+
nftId: string;
|
|
620
|
+
vault: string;
|
|
621
|
+
ratioState: RatioState;
|
|
622
|
+
targetRatio: number;
|
|
623
|
+
};
|
|
624
|
+
};
|
|
@@ -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.
|
|
7
|
-
exports.fluidLeverageManagementSubData = void 0;
|
|
6
|
+
exports.sparkLeverageManagementOnPriceSubData = exports.sparkCloseGenericSubData = exports.sparkLiquidationProtectionSubData = exports.sparkLeverageManagementSubDataWithoutSubProxy = exports.sparkLeverageManagementSubData = exports.exchangeLimitOrderSubDataWithoutSubProxy = exports.exchangeLimitOrderSubData = exports.exchangeDcaSubData = exports.compoundV3CloseSubData = exports.compoundV3LeverageManagementOnPriceSubData = exports.compoundV3L2LiquidationProtectionSubData = exports.compoundV3LiquidationProtectionSubData = exports.compoundV3LeverageManagementSubDataWithoutSubProxy = exports.compoundV3LeverageManagementSubData = exports.compoundV2LeverageManagementSubDataWithoutSubProxy = exports.compoundV2LeverageManagementSubData = exports.aaveV4CollateralSwitchSubData = exports.aaveV4CloseSubData = exports.aaveV4LeverageManagementOnPriceSubData = exports.aaveV4LiquidationProtectionSubData = exports.aaveV4LeverageManagementSubData = exports.aaveV3LeverageManagementOnPriceSubData = exports.aaveV3QuotePriceSubData = exports.aaveV3CollateralSwitchSubData = exports.aaveV3CloseGenericSubData = exports.aaveV3LeverageManagementOnPriceGeneric = exports.aaveV3LiquidationProtectionSubData = exports.aaveV3LeverageManagementSubDataWithoutSubProxy = exports.aaveV3LeverageManagementSubData = exports.aaveV2LeverageManagementSubDataWithoutSubProxy = exports.aaveV2LeverageManagementSubData = exports.liquityV2PaybackSubData = exports.liquityV2LeverageManagementOnPriceSubData = exports.liquityV2CloseSubData = exports.liquityV2LeverageManagementSubData = exports.liquityDebtInFrontRepaySubData = exports.liquityDsrSupplySubData = exports.liquityDsrPaybackSubData = exports.liquityCloseSubData = exports.liquityLeverageManagementSubDataWithoutSubProxy = exports.liquityLeverageManagementSubData = exports.liquityRepayFromSavingsSubData = exports.makerLiquidationProtectionSubData = exports.makerLeverageManagementWithoutSubProxy = exports.makerLeverageManagementSubData = 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.sparkCollateralSwitchSubData = 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");
|
|
@@ -132,6 +132,8 @@ exports.makerLeverageManagementSubData = {
|
|
|
132
132
|
return { vaultId, targetRatio };
|
|
133
133
|
},
|
|
134
134
|
};
|
|
135
|
+
// ! Any change here will PROBABLY require a change in makerLiquidationProtectionSubData as well, since it is copy paste
|
|
136
|
+
// ! Double check before changing
|
|
135
137
|
exports.makerLeverageManagementWithoutSubProxy = {
|
|
136
138
|
encode(vaultId, targetRatio, daiAddr) {
|
|
137
139
|
const encodedVaultId = web3_eth_abi_1.default.encodeParameter('uint256', vaultId);
|
|
@@ -146,6 +148,20 @@ exports.makerLeverageManagementWithoutSubProxy = {
|
|
|
146
148
|
return { vaultId, targetRatio, daiAddr };
|
|
147
149
|
},
|
|
148
150
|
};
|
|
151
|
+
exports.makerLiquidationProtectionSubData = {
|
|
152
|
+
encode(vaultId, targetRatio, daiAddr) {
|
|
153
|
+
const encodedVaultId = web3_eth_abi_1.default.encodeParameter('uint256', vaultId);
|
|
154
|
+
const encodedTargetRatio = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
155
|
+
const encodedDaiAddr = web3_eth_abi_1.default.encodeParameter('address', daiAddr || (0, tokens_1.getAssetInfo)('DAI', 1).address);
|
|
156
|
+
return [encodedVaultId, encodedTargetRatio, encodedDaiAddr];
|
|
157
|
+
},
|
|
158
|
+
decode(subData) {
|
|
159
|
+
const vaultId = +web3_eth_abi_1.default.decodeParameter('uint256', subData[0]).toString();
|
|
160
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(web3_eth_abi_1.default.decodeParameter('uint256', subData[1]));
|
|
161
|
+
const daiAddr = web3_eth_abi_1.default.decodeParameter('address', subData[2]).toString();
|
|
162
|
+
return { vaultId, targetRatio, daiAddr };
|
|
163
|
+
},
|
|
164
|
+
};
|
|
149
165
|
/**
|
|
150
166
|
__ __ ______ __ __ __ .___________.____ ____ ____ ____ __
|
|
151
167
|
| | | | / __ \ | | | | | | | |\ \ / / \ \ / / /_ |
|
|
@@ -450,6 +466,8 @@ exports.aaveV3LeverageManagementSubData = {
|
|
|
450
466
|
return { targetRatio };
|
|
451
467
|
},
|
|
452
468
|
};
|
|
469
|
+
// ! Any change here will PROBABLY require a change in aaveV3LiquidationProtectionSubData as well
|
|
470
|
+
// ! Double check before changing. Liquidation protection is using Generic encoding for both - EOA and SW
|
|
453
471
|
exports.aaveV3LeverageManagementSubDataWithoutSubProxy = {
|
|
454
472
|
encode(targetRatio, ratioState, market, user, isGeneric) {
|
|
455
473
|
const encodedTargetRatio = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
@@ -469,6 +487,20 @@ exports.aaveV3LeverageManagementSubDataWithoutSubProxy = {
|
|
|
469
487
|
return { targetRatio, ratioState };
|
|
470
488
|
},
|
|
471
489
|
};
|
|
490
|
+
exports.aaveV3LiquidationProtectionSubData = {
|
|
491
|
+
encode(targetRatio, ratioState, market, user) {
|
|
492
|
+
const encodedTargetRatio = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
493
|
+
const encodedRatioState = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
|
|
494
|
+
const encodedMarket = web3_eth_abi_1.default.encodeParameter('address', market);
|
|
495
|
+
const encodedUser = web3_eth_abi_1.default.encodeParameter('address', user);
|
|
496
|
+
return [encodedTargetRatio, encodedRatioState, encodedMarket, encodedUser];
|
|
497
|
+
},
|
|
498
|
+
decode(subData) {
|
|
499
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(web3_eth_abi_1.default.decodeParameter('uint256', subData[0]));
|
|
500
|
+
const ratioState = web3_eth_abi_1.default.decodeParameter('uint8', subData[1]);
|
|
501
|
+
return { targetRatio, ratioState };
|
|
502
|
+
},
|
|
503
|
+
};
|
|
472
504
|
exports.aaveV3LeverageManagementOnPriceGeneric = {
|
|
473
505
|
encode(collAsset, collAssetId, debtAsset, debtAssetId, marketAddr, targetRatio, user) {
|
|
474
506
|
const encodedColl = web3_eth_abi_1.default.encodeParameter('address', collAsset);
|
|
@@ -630,6 +662,8 @@ exports.aaveV3LeverageManagementOnPriceSubData = {
|
|
|
630
662
|
/ _____ \ / _____ \ \ / | |____ \ / | |
|
|
631
663
|
/__/ \__\ /__/ \__\ \__/ |_______| \__/ |_|
|
|
632
664
|
*/
|
|
665
|
+
// ! Any change here will PROBABLY require a change in aaveV4LiquidationProtectionSubData as well, since it is copy paste
|
|
666
|
+
// ! Double check before changing
|
|
633
667
|
exports.aaveV4LeverageManagementSubData = {
|
|
634
668
|
encode: (spoke, owner, ratioState, targetRatio) => {
|
|
635
669
|
const spokeEncoded = web3_eth_abi_1.default.encodeParameter('address', spoke);
|
|
@@ -656,6 +690,32 @@ exports.aaveV4LeverageManagementSubData = {
|
|
|
656
690
|
};
|
|
657
691
|
},
|
|
658
692
|
};
|
|
693
|
+
exports.aaveV4LiquidationProtectionSubData = {
|
|
694
|
+
encode: (spoke, owner, ratioState, targetRatio) => {
|
|
695
|
+
const spokeEncoded = web3_eth_abi_1.default.encodeParameter('address', spoke);
|
|
696
|
+
const ownerEncoded = web3_eth_abi_1.default.encodeParameter('address', owner);
|
|
697
|
+
const ratioStateEncoded = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
|
|
698
|
+
const targetRatioEncoded = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
699
|
+
// Add two empty slots for future addons (e.g tsi or slippage settings)
|
|
700
|
+
return [
|
|
701
|
+
spokeEncoded,
|
|
702
|
+
ownerEncoded,
|
|
703
|
+
ratioStateEncoded,
|
|
704
|
+
targetRatioEncoded,
|
|
705
|
+
constants_1.EMPTY_SLOT,
|
|
706
|
+
constants_1.EMPTY_SLOT,
|
|
707
|
+
];
|
|
708
|
+
},
|
|
709
|
+
decode: (subData) => {
|
|
710
|
+
const spoke = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
|
|
711
|
+
const owner = web3_eth_abi_1.default.decodeParameter('address', subData[1]);
|
|
712
|
+
const ratioState = Number(web3_eth_abi_1.default.decodeParameter('uint8', subData[2]));
|
|
713
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(web3_eth_abi_1.default.decodeParameter('uint256', subData[3]));
|
|
714
|
+
return {
|
|
715
|
+
spoke, owner, ratioState, targetRatio,
|
|
716
|
+
};
|
|
717
|
+
},
|
|
718
|
+
};
|
|
659
719
|
exports.aaveV4LeverageManagementOnPriceSubData = {
|
|
660
720
|
encode: (spoke, owner, collAsset, collAssetId, debtAsset, debtAssetId, ratioState, targetRatio) => {
|
|
661
721
|
const spokeEncoded = web3_eth_abi_1.default.encodeParameter('address', spoke);
|
|
@@ -814,6 +874,8 @@ exports.compoundV2LeverageManagementSubDataWithoutSubProxy = {
|
|
|
814
874
|
| `----.| `--' | | | | | | | \ / ___) |
|
|
815
875
|
\______| \______/ |__| |__| | _| \__/ |____/
|
|
816
876
|
*/
|
|
877
|
+
// ! Any change here will PROBABLY require a change in compoundV3LiquidationProtectionSubData as well, since it is copy paste
|
|
878
|
+
// ! Double check before changing
|
|
817
879
|
exports.compoundV3LeverageManagementSubData = {
|
|
818
880
|
encode(market, baseToken, triggerRepayRatio, triggerBoostRatio, targetBoostRatio, targetRepayRatio, boostEnabled, isEOA) {
|
|
819
881
|
return [
|
|
@@ -833,6 +895,8 @@ exports.compoundV3LeverageManagementSubData = {
|
|
|
833
895
|
return { targetRatio };
|
|
834
896
|
},
|
|
835
897
|
};
|
|
898
|
+
// ! Any change here will PROBABLY require a change in compoundV3L2LiquidationProtectionSubData as well, since it is copy paste
|
|
899
|
+
// ! Double check before changing
|
|
836
900
|
exports.compoundV3LeverageManagementSubDataWithoutSubProxy = {
|
|
837
901
|
encode(market, baseToken, targetRatio, ratioState) {
|
|
838
902
|
const encodedMarket = web3_eth_abi_1.default.encodeParameter('address', market);
|
|
@@ -851,6 +915,52 @@ exports.compoundV3LeverageManagementSubDataWithoutSubProxy = {
|
|
|
851
915
|
};
|
|
852
916
|
},
|
|
853
917
|
};
|
|
918
|
+
exports.compoundV3LiquidationProtectionSubData = {
|
|
919
|
+
encode(market, baseToken, triggerRepayRatio,
|
|
920
|
+
// TODO -> can remove boost stuff ? Not sure if want it to be compatible or not.
|
|
921
|
+
triggerBoostRatio, targetBoostRatio, targetRepayRatio, boostEnabled, isEOA) {
|
|
922
|
+
return [
|
|
923
|
+
market,
|
|
924
|
+
baseToken,
|
|
925
|
+
new decimal_js_1.default(triggerRepayRatio).mul(1e16).toString(),
|
|
926
|
+
new decimal_js_1.default(triggerBoostRatio).mul(1e16).toString(),
|
|
927
|
+
new decimal_js_1.default(targetBoostRatio).mul(1e16).toString(),
|
|
928
|
+
new decimal_js_1.default(targetRepayRatio).mul(1e16).toString(),
|
|
929
|
+
// @ts-ignore // TODO
|
|
930
|
+
boostEnabled, isEOA,
|
|
931
|
+
];
|
|
932
|
+
},
|
|
933
|
+
decode(subData) {
|
|
934
|
+
const weiRatio = web3_eth_abi_1.default.decodeParameter('uint256', subData[3]);
|
|
935
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(weiRatio);
|
|
936
|
+
return { targetRatio };
|
|
937
|
+
},
|
|
938
|
+
};
|
|
939
|
+
exports.compoundV3L2LiquidationProtectionSubData = {
|
|
940
|
+
encode(market, baseToken, triggerRepayRatio,
|
|
941
|
+
// TODO -> can remove boost stuff ? Not sure if want it to be compatible or not.
|
|
942
|
+
triggerBoostRatio, targetBoostRatio, targetRepayRatio, boostEnabled, isEOA) {
|
|
943
|
+
let subInput = '0x';
|
|
944
|
+
subInput = subInput.concat(market.slice(2));
|
|
945
|
+
subInput = subInput.concat(baseToken.slice(2));
|
|
946
|
+
subInput = subInput.concat(new decimal_js_1.default(triggerRepayRatio).mul(1e16).toHex().slice(2)
|
|
947
|
+
.padStart(32, '0'));
|
|
948
|
+
subInput = subInput.concat(new decimal_js_1.default(triggerBoostRatio).mul(1e16).toHex().slice(2)
|
|
949
|
+
.padStart(32, '0'));
|
|
950
|
+
subInput = subInput.concat(new decimal_js_1.default(targetBoostRatio).mul(1e16).toHex().slice(2)
|
|
951
|
+
.padStart(32, '0'));
|
|
952
|
+
subInput = subInput.concat(new decimal_js_1.default(targetRepayRatio).mul(1e16).toHex().slice(2)
|
|
953
|
+
.padStart(32, '0'));
|
|
954
|
+
subInput = subInput.concat(boostEnabled ? '01' : '00');
|
|
955
|
+
subInput = subInput.concat(isEOA ? '01' : '00');
|
|
956
|
+
return subInput;
|
|
957
|
+
},
|
|
958
|
+
decode(subData) {
|
|
959
|
+
const ratioWei = web3_eth_abi_1.default.decodeParameter('uint256', subData[3]);
|
|
960
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(ratioWei);
|
|
961
|
+
return { targetRatio };
|
|
962
|
+
},
|
|
963
|
+
};
|
|
854
964
|
exports.compoundV3LeverageManagementOnPriceSubData = {
|
|
855
965
|
encode(market, collToken, baseToken, targetRatio, ratioState, user) {
|
|
856
966
|
const marketEncoded = web3_eth_abi_1.default.encodeParameter('address', market);
|
|
@@ -984,6 +1094,8 @@ exports.sparkLeverageManagementSubData = {
|
|
|
984
1094
|
return { targetRatio };
|
|
985
1095
|
},
|
|
986
1096
|
};
|
|
1097
|
+
// ! Any change here will PROBABLY require a change in sparkLiquidationProtectionSubData as well, since it is copy paste
|
|
1098
|
+
// ! Double check before changing
|
|
987
1099
|
exports.sparkLeverageManagementSubDataWithoutSubProxy = {
|
|
988
1100
|
encode(targetRatio, ratioState) {
|
|
989
1101
|
const encodedTargetRatio = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
@@ -998,6 +1110,20 @@ exports.sparkLeverageManagementSubDataWithoutSubProxy = {
|
|
|
998
1110
|
return { targetRatio, ratioState };
|
|
999
1111
|
},
|
|
1000
1112
|
};
|
|
1113
|
+
exports.sparkLiquidationProtectionSubData = {
|
|
1114
|
+
encode(targetRatio, ratioState) {
|
|
1115
|
+
const encodedTargetRatio = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
1116
|
+
const encodedRatioState = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
|
|
1117
|
+
const encodedUseDefaultMarket = web3_eth_abi_1.default.encodeParameter('bool', true);
|
|
1118
|
+
const encodedUseOnBehalf = web3_eth_abi_1.default.encodeParameter('bool', false);
|
|
1119
|
+
return [encodedTargetRatio, encodedRatioState, encodedUseDefaultMarket, encodedUseOnBehalf];
|
|
1120
|
+
},
|
|
1121
|
+
decode(subData) {
|
|
1122
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(web3_eth_abi_1.default.decodeParameter('uint256', subData[0]));
|
|
1123
|
+
const ratioState = web3_eth_abi_1.default.decodeParameter('uint8', subData[1]);
|
|
1124
|
+
return { targetRatio, ratioState };
|
|
1125
|
+
},
|
|
1126
|
+
};
|
|
1001
1127
|
exports.sparkCloseGenericSubData = {
|
|
1002
1128
|
encode(collAsset, collAssetId, debtAsset, debtAssetId, closeType, marketAddr, user) {
|
|
1003
1129
|
const encodedColl = web3_eth_abi_1.default.encodeParameter('address', collAsset);
|
|
@@ -1146,6 +1272,8 @@ exports.crvUSDPaybackSubData = {
|
|
|
1146
1272
|
| | | | | `--' | | |\ \----.| | | | | | | `--' |
|
|
1147
1273
|
|__| |__| \______/ | _| `._____|| _| |__| |__| \______/
|
|
1148
1274
|
*/
|
|
1275
|
+
// ! Any change here will PROBABLY require a change in morphoBlueLiquidationProtectionSubData as well, since it is copy paste
|
|
1276
|
+
// ! Double check before changing
|
|
1149
1277
|
exports.morphoBlueLeverageManagementSubData = {
|
|
1150
1278
|
encode: (loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA) => {
|
|
1151
1279
|
const loanTokenEncoded = web3_eth_abi_1.default.encodeParameter('address', loanToken);
|
|
@@ -1179,6 +1307,39 @@ exports.morphoBlueLeverageManagementSubData = {
|
|
|
1179
1307
|
};
|
|
1180
1308
|
},
|
|
1181
1309
|
};
|
|
1310
|
+
exports.morphoBlueLiquidationProtectionSubData = {
|
|
1311
|
+
encode: (loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA) => {
|
|
1312
|
+
const loanTokenEncoded = web3_eth_abi_1.default.encodeParameter('address', loanToken);
|
|
1313
|
+
const collTokenEncoded = web3_eth_abi_1.default.encodeParameter('address', collToken);
|
|
1314
|
+
const oracleEncoded = web3_eth_abi_1.default.encodeParameter('address', oracle);
|
|
1315
|
+
const irmEncoded = web3_eth_abi_1.default.encodeParameter('address', irm);
|
|
1316
|
+
const lltvEncoded = web3_eth_abi_1.default.encodeParameter('uint256', lltv);
|
|
1317
|
+
const ratioStateEncoded = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
|
|
1318
|
+
const targetRatioEncoded = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
1319
|
+
const userEncoded = web3_eth_abi_1.default.encodeParameter('address', user);
|
|
1320
|
+
const isEOAEncoded = web3_eth_abi_1.default.encodeParameter('bool', isEOA);
|
|
1321
|
+
return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOAEncoded];
|
|
1322
|
+
},
|
|
1323
|
+
decode: (subData) => {
|
|
1324
|
+
const loanToken = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
|
|
1325
|
+
const collToken = web3_eth_abi_1.default.decodeParameter('address', subData[1]);
|
|
1326
|
+
const oracle = web3_eth_abi_1.default.decodeParameter('address', subData[2]);
|
|
1327
|
+
const irm = web3_eth_abi_1.default.decodeParameter('address', subData[3]);
|
|
1328
|
+
const lltv = web3_eth_abi_1.default.decodeParameter('uint256', subData[4]);
|
|
1329
|
+
const weiRatio = web3_eth_abi_1.default.decodeParameter('uint256', subData[6]);
|
|
1330
|
+
const user = web3_eth_abi_1.default.decodeParameter('address', subData[7]);
|
|
1331
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(weiRatio);
|
|
1332
|
+
return {
|
|
1333
|
+
loanToken,
|
|
1334
|
+
collToken,
|
|
1335
|
+
oracle,
|
|
1336
|
+
irm,
|
|
1337
|
+
lltv,
|
|
1338
|
+
user,
|
|
1339
|
+
targetRatio,
|
|
1340
|
+
};
|
|
1341
|
+
},
|
|
1342
|
+
};
|
|
1182
1343
|
exports.morphoBlueLeverageManagementOnPriceSubData = {
|
|
1183
1344
|
encode(loanToken, collToken, oracle, irm, lltv, targetRatio, user) {
|
|
1184
1345
|
const loanTokenEncoded = web3_eth_abi_1.default.encodeParameter('address', loanToken);
|
|
@@ -1248,6 +1409,8 @@ _______ __ __ __ __ _______
|
|
|
1248
1409
|
| | | `----.| `--' | | | | '--' |
|
|
1249
1410
|
|__| |_______| \______/ |__| |_______/
|
|
1250
1411
|
*/
|
|
1412
|
+
// ! Any change here will PROBABLY require a change in fluidLeverageManagementSubData as well, since it is copy paste
|
|
1413
|
+
// ! Double check before changing
|
|
1251
1414
|
exports.fluidLeverageManagementSubData = {
|
|
1252
1415
|
encode: (nftId, vault, ratioState, targetRatio) => {
|
|
1253
1416
|
const nftIdEncoded = web3_eth_abi_1.default.encodeParameter('uint256', nftId);
|
|
@@ -1255,9 +1418,40 @@ exports.fluidLeverageManagementSubData = {
|
|
|
1255
1418
|
const ratioStateEncoded = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
|
|
1256
1419
|
const targetRatioEncoded = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
1257
1420
|
const wrapEthEncoded = web3_eth_abi_1.default.encodeParameter('bool', true);
|
|
1258
|
-
const
|
|
1259
|
-
const
|
|
1260
|
-
const
|
|
1421
|
+
const collActionType = enums_1.CollActionType.WITHDRAW;
|
|
1422
|
+
const debtActionType = enums_1.DebtActionType.PAYBACK;
|
|
1423
|
+
const collActionTypeEncoded = web3_eth_abi_1.default.encodeParameter('uint8', collActionType);
|
|
1424
|
+
const debtActionTypeEncoded = web3_eth_abi_1.default.encodeParameter('uint8', debtActionType);
|
|
1425
|
+
return [
|
|
1426
|
+
nftIdEncoded,
|
|
1427
|
+
vaultEncoded,
|
|
1428
|
+
ratioStateEncoded,
|
|
1429
|
+
targetRatioEncoded,
|
|
1430
|
+
wrapEthEncoded,
|
|
1431
|
+
collActionTypeEncoded,
|
|
1432
|
+
debtActionTypeEncoded,
|
|
1433
|
+
];
|
|
1434
|
+
},
|
|
1435
|
+
decode: (subData) => {
|
|
1436
|
+
const nftId = web3_eth_abi_1.default.decodeParameter('uint256', subData[0]);
|
|
1437
|
+
const vault = web3_eth_abi_1.default.decodeParameter('address', subData[1]);
|
|
1438
|
+
const ratioState = web3_eth_abi_1.default.decodeParameter('uint8', subData[2]);
|
|
1439
|
+
const weiRatio = web3_eth_abi_1.default.decodeParameter('uint256', subData[3]);
|
|
1440
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(weiRatio);
|
|
1441
|
+
return {
|
|
1442
|
+
nftId, vault, ratioState, targetRatio,
|
|
1443
|
+
};
|
|
1444
|
+
},
|
|
1445
|
+
};
|
|
1446
|
+
exports.fluidLiquidationProtectionSubData = {
|
|
1447
|
+
encode: (nftId, vault, ratioState, targetRatio) => {
|
|
1448
|
+
const nftIdEncoded = web3_eth_abi_1.default.encodeParameter('uint256', nftId);
|
|
1449
|
+
const vaultEncoded = web3_eth_abi_1.default.encodeParameter('address', vault);
|
|
1450
|
+
const ratioStateEncoded = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
|
|
1451
|
+
const targetRatioEncoded = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
1452
|
+
const wrapEthEncoded = web3_eth_abi_1.default.encodeParameter('bool', true);
|
|
1453
|
+
const collActionType = enums_1.CollActionType.WITHDRAW;
|
|
1454
|
+
const debtActionType = enums_1.DebtActionType.PAYBACK;
|
|
1261
1455
|
const collActionTypeEncoded = web3_eth_abi_1.default.encodeParameter('uint8', collActionType);
|
|
1262
1456
|
const debtActionTypeEncoded = web3_eth_abi_1.default.encodeParameter('uint8', debtActionType);
|
|
1263
1457
|
return [
|
package/cjs/services/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EthereumAddress } from '../types';
|
|
2
|
-
import { ChainId, CloseStrategyType, CloseToAssetType, RatioState } from '../types/enums';
|
|
2
|
+
import { Bundles, ChainId, CloseStrategyType, CloseToAssetType, RatioState } from '../types/enums';
|
|
3
3
|
export declare function isDefined<T>(value: T): value is NonNullable<T>;
|
|
4
4
|
export declare function isUndefined(value: unknown): boolean;
|
|
5
5
|
export declare function compareAddresses(firstAddress: EthereumAddress, secondAddress: EthereumAddress): boolean;
|
|
@@ -28,3 +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.OptimismIds | typeof Bundles.ArbitrumIds | typeof Bundles.BaseIds;
|
|
32
|
+
export declare function getCompoundV3LeverageManagementBundleId(network: ChainId, isEOA: boolean, isBoost: boolean): number;
|
package/cjs/services/utils.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getStopLossAndTakeProfitTypeByCloseStrategyType = exports.getCloseStrategyType = exports.getPositionId = exports.getRatioStateInfoForAaveCloseStrategy = exports.requireAddresses = exports.requireAddress = exports.isEmptyBytes = exports.isRatioStateUnder = exports.isRatioStateOver = exports.weiToRatioPercentage = exports.ratioPercentageToWei = exports.encodeSubId = exports.compareSubHashes = exports.wethToEthByAddress = exports.wethToEth = exports.ethToWeth = exports.addToObjectIf = exports.addToArrayIf = exports.isAddress = exports.compareAddresses = exports.isUndefined = exports.isDefined = void 0;
|
|
29
|
+
exports.getCompoundV3LeverageManagementBundleId = exports.getBundleIdsByNetwork = exports.getStopLossAndTakeProfitTypeByCloseStrategyType = exports.getCloseStrategyType = exports.getPositionId = exports.getRatioStateInfoForAaveCloseStrategy = exports.requireAddresses = exports.requireAddress = exports.isEmptyBytes = exports.isRatioStateUnder = exports.isRatioStateOver = exports.weiToRatioPercentage = exports.ratioPercentageToWei = exports.encodeSubId = exports.compareSubHashes = exports.wethToEthByAddress = exports.wethToEth = exports.ethToWeth = exports.addToObjectIf = exports.addToArrayIf = exports.isAddress = exports.compareAddresses = exports.isUndefined = exports.isDefined = void 0;
|
|
30
30
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
31
31
|
const web3Utils = __importStar(require("web3-utils"));
|
|
32
32
|
const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
|
|
@@ -188,3 +188,36 @@ function getStopLossAndTakeProfitTypeByCloseStrategyType(closeStrategyType) {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
exports.getStopLossAndTakeProfitTypeByCloseStrategyType = getStopLossAndTakeProfitTypeByCloseStrategyType;
|
|
191
|
+
function getBundleIdsByNetwork(network) {
|
|
192
|
+
switch (network) {
|
|
193
|
+
case enums_1.ChainId.Arbitrum:
|
|
194
|
+
return enums_1.Bundles.ArbitrumIds;
|
|
195
|
+
case enums_1.ChainId.Base:
|
|
196
|
+
return enums_1.Bundles.BaseIds;
|
|
197
|
+
case enums_1.ChainId.Optimism:
|
|
198
|
+
return enums_1.Bundles.OptimismIds;
|
|
199
|
+
default:
|
|
200
|
+
return enums_1.Bundles.MainnetIds;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.getBundleIdsByNetwork = getBundleIdsByNetwork;
|
|
204
|
+
// Mainnet uses the V2 bundle ids; L2s use the original bundle ids.
|
|
205
|
+
function getCompoundV3LeverageManagementBundleId(network, isEOA, isBoost) {
|
|
206
|
+
switch (Number(network)) {
|
|
207
|
+
case enums_1.ChainId.Ethereum:
|
|
208
|
+
if (isEOA)
|
|
209
|
+
return isBoost ? enums_1.Bundles.MainnetIds.COMP_V3_EOA_BOOST_V2_BUNDLE : enums_1.Bundles.MainnetIds.COMP_V3_EOA_REPAY_V2_BUNDLE;
|
|
210
|
+
return isBoost ? enums_1.Bundles.MainnetIds.COMP_V3_SW_BOOST_V2_BUNDLE : enums_1.Bundles.MainnetIds.COMP_V3_SW_REPAY_V2_BUNDLE;
|
|
211
|
+
case enums_1.ChainId.Base:
|
|
212
|
+
if (isEOA)
|
|
213
|
+
return isBoost ? enums_1.Bundles.BaseIds.COMP_V3_EOA_BOOST : enums_1.Bundles.BaseIds.COMP_V3_EOA_REPAY;
|
|
214
|
+
return isBoost ? enums_1.Bundles.BaseIds.COMP_V3_SW_BOOST_BUNDLE : enums_1.Bundles.BaseIds.COMP_V3_SW_REPAY_BUNDLE;
|
|
215
|
+
case enums_1.ChainId.Arbitrum:
|
|
216
|
+
if (isEOA)
|
|
217
|
+
return isBoost ? enums_1.Bundles.ArbitrumIds.COMP_V3_EOA_BOOST : enums_1.Bundles.ArbitrumIds.COMP_V3_EOA_REPAY;
|
|
218
|
+
return isBoost ? enums_1.Bundles.ArbitrumIds.COMP_V3_SW_BOOST_BUNDLE : enums_1.Bundles.ArbitrumIds.COMP_V3_SW_REPAY_BUNDLE;
|
|
219
|
+
default:
|
|
220
|
+
throw new Error(`Compound V3 leverage management is not supported on network ${network}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.getCompoundV3LeverageManagementBundleId = getCompoundV3LeverageManagementBundleId;
|
|
@@ -296,4 +296,29 @@ describe('Feature: utils.ts', () => {
|
|
|
296
296
|
});
|
|
297
297
|
});
|
|
298
298
|
});
|
|
299
|
+
describe('When testing utils.getCompoundV3LeverageManagementBundleId()', () => {
|
|
300
|
+
// Mainnet uses the V2 bundle ids; L2s use the original bundle ids.
|
|
301
|
+
const examples = [
|
|
302
|
+
[enums_1.Bundles.MainnetIds.COMP_V3_SW_REPAY_V2_BUNDLE, [enums_1.ChainId.Ethereum, false, false]],
|
|
303
|
+
[enums_1.Bundles.MainnetIds.COMP_V3_SW_BOOST_V2_BUNDLE, [enums_1.ChainId.Ethereum, false, true]],
|
|
304
|
+
[enums_1.Bundles.MainnetIds.COMP_V3_EOA_REPAY_V2_BUNDLE, [enums_1.ChainId.Ethereum, true, false]],
|
|
305
|
+
[enums_1.Bundles.MainnetIds.COMP_V3_EOA_BOOST_V2_BUNDLE, [enums_1.ChainId.Ethereum, true, true]],
|
|
306
|
+
[enums_1.Bundles.BaseIds.COMP_V3_SW_REPAY_BUNDLE, [enums_1.ChainId.Base, false, false]],
|
|
307
|
+
[enums_1.Bundles.BaseIds.COMP_V3_SW_BOOST_BUNDLE, [enums_1.ChainId.Base, false, true]],
|
|
308
|
+
[enums_1.Bundles.BaseIds.COMP_V3_EOA_REPAY, [enums_1.ChainId.Base, true, false]],
|
|
309
|
+
[enums_1.Bundles.BaseIds.COMP_V3_EOA_BOOST, [enums_1.ChainId.Base, true, true]],
|
|
310
|
+
[enums_1.Bundles.ArbitrumIds.COMP_V3_SW_REPAY_BUNDLE, [enums_1.ChainId.Arbitrum, false, false]],
|
|
311
|
+
[enums_1.Bundles.ArbitrumIds.COMP_V3_SW_BOOST_BUNDLE, [enums_1.ChainId.Arbitrum, false, true]],
|
|
312
|
+
[enums_1.Bundles.ArbitrumIds.COMP_V3_EOA_REPAY, [enums_1.ChainId.Arbitrum, true, false]],
|
|
313
|
+
[enums_1.Bundles.ArbitrumIds.COMP_V3_EOA_BOOST, [enums_1.ChainId.Arbitrum, true, true]],
|
|
314
|
+
];
|
|
315
|
+
examples.forEach(([expected, actual]) => {
|
|
316
|
+
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
317
|
+
(0, chai_1.expect)((0, utils_1.getCompoundV3LeverageManagementBundleId)(...actual)).to.equal(expected);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
it(`Given ${enums_1.ChainId.Optimism} (unsupported) should throw an error`, () => {
|
|
321
|
+
(0, chai_1.expect)(() => (0, utils_1.getCompoundV3LeverageManagementBundleId)(enums_1.ChainId.Optimism, false, false)).to.throw(Error);
|
|
322
|
+
});
|
|
323
|
+
});
|
|
299
324
|
});
|
package/cjs/types/enums.d.ts
CHANGED
|
@@ -138,7 +138,9 @@ export declare namespace Strategies {
|
|
|
138
138
|
EoaBoostOnPrice = "eoa-boost-on-price",
|
|
139
139
|
EoaRepayOnPrice = "eoa-repay-on-price",
|
|
140
140
|
CollateralSwitch = "collateral-switch",
|
|
141
|
-
EoaCollateralSwitch = "eoa-collateral-switch"
|
|
141
|
+
EoaCollateralSwitch = "eoa-collateral-switch",
|
|
142
|
+
LiquidationProtection = "liquidation-protection",
|
|
143
|
+
EoaLiquidationProtection = "eoa-liquidation-protection"
|
|
142
144
|
}
|
|
143
145
|
enum IdOverrides {
|
|
144
146
|
TakeProfit = "take-profit",
|
|
@@ -149,7 +151,9 @@ export declare namespace Strategies {
|
|
|
149
151
|
LeverageManagement = "leverage-management",
|
|
150
152
|
EoaLeverageManagement = "leverage-management-eoa",
|
|
151
153
|
LeverageManagementOnPrice = "leverage-management-on-price",
|
|
152
|
-
EoaLeverageManagementOnPrice = "leverage-management-on-price-eoa"
|
|
154
|
+
EoaLeverageManagementOnPrice = "leverage-management-on-price-eoa",
|
|
155
|
+
LiquidationProtection = "liquidation-protection",
|
|
156
|
+
EoaLiquidationProtection = "liquidation-protection-eoa"
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
159
|
export declare namespace Bundles {
|
|
@@ -224,7 +228,15 @@ export declare namespace Bundles {
|
|
|
224
228
|
AAVE_V4_EOA_BOOST = 67,
|
|
225
229
|
AAVE_V4_EOA_REPAY_ON_PRICE = 68,
|
|
226
230
|
AAVE_V4_EOA_BOOST_ON_PRICE = 69,
|
|
227
|
-
AAVE_V4_EOA_CLOSE = 70
|
|
231
|
+
AAVE_V4_EOA_CLOSE = 70,
|
|
232
|
+
AAVE_V3_LIQUIDATION_PROTECTION = 71,
|
|
233
|
+
SPARK_LIQUIDATION_PROTECTION = 72,
|
|
234
|
+
COMP_V3_SW_LIQUIDATION_PROTECTION = 73,
|
|
235
|
+
COMP_V3_EOA_LIQUIDATION_PROTECTION = 74,
|
|
236
|
+
MAKER_LIQUIDATION_PROTECTION = 75,
|
|
237
|
+
FLUID_T1_LIQUIDATION_PROTECTION = 76,
|
|
238
|
+
AAVE_V4_LIQUIDATION_PROTECTION = 77,
|
|
239
|
+
MORPHO_BLUE_LIQUIDATION_PROTECTION = 78
|
|
228
240
|
}
|
|
229
241
|
enum OptimismIds {
|
|
230
242
|
AAVE_V3_REPAY = 0,
|
|
@@ -237,7 +249,8 @@ export declare namespace Bundles {
|
|
|
237
249
|
AAVE_V3_EOA_BOOST = 7,
|
|
238
250
|
AAVE_V3_EOA_REPAY_ON_PRICE = 8,
|
|
239
251
|
AAVE_V3_EOA_BOOST_ON_PRICE = 9,
|
|
240
|
-
AAVE_V3_EOA_CLOSE = 10
|
|
252
|
+
AAVE_V3_EOA_CLOSE = 10,
|
|
253
|
+
AAVE_V3_LIQUIDATION_PROTECTION = 11
|
|
241
254
|
}
|
|
242
255
|
enum BaseIds {
|
|
243
256
|
AAVE_V3_REPAY = 0,
|
|
@@ -266,7 +279,12 @@ export declare namespace Bundles {
|
|
|
266
279
|
AAVE_V3_EOA_REPAY_ON_PRICE = 25,
|
|
267
280
|
AAVE_V3_EOA_BOOST_ON_PRICE = 26,
|
|
268
281
|
AAVE_V3_EOA_CLOSE = 27,
|
|
269
|
-
MORPHO_BLUE_CLOSE = 28
|
|
282
|
+
MORPHO_BLUE_CLOSE = 28,
|
|
283
|
+
AAVE_V3_LIQUIDATION_PROTECTION = 29,
|
|
284
|
+
FLUID_T1_LIQUIDATION_PROTECTION = 30,
|
|
285
|
+
MORPHO_BLUE_LIQUIDATION_PROTECTION = 31,
|
|
286
|
+
COMP_V3_SW_LIQUIDATION_PROTECTION = 32,
|
|
287
|
+
COMP_V3_EOA_LIQUIDATION_PROTECTION = 33
|
|
270
288
|
}
|
|
271
289
|
enum ArbitrumIds {
|
|
272
290
|
AAVE_V3_REPAY = 0,
|
|
@@ -297,6 +315,11 @@ export declare namespace Bundles {
|
|
|
297
315
|
MORPHO_BLUE_BOOST_ON_PRICE = 25,
|
|
298
316
|
MORPHO_BLUE_EOA_REPAY = 26,
|
|
299
317
|
MORPHO_BLUE_EOA_BOOST = 27,
|
|
300
|
-
MORPHO_BLUE_CLOSE = 28
|
|
318
|
+
MORPHO_BLUE_CLOSE = 28,
|
|
319
|
+
AAVE_V3_LIQUIDATION_PROTECTION = 29,
|
|
320
|
+
FLUID_T1_LIQUIDATION_PROTECTION = 30,
|
|
321
|
+
MORPHO_BLUE_LIQUIDATION_PROTECTION = 31,
|
|
322
|
+
COMP_V3_SW_LIQUIDATION_PROTECTION = 32,
|
|
323
|
+
COMP_V3_EOA_LIQUIDATION_PROTECTION = 33
|
|
301
324
|
}
|
|
302
325
|
}
|
package/cjs/types/enums.js
CHANGED
|
@@ -159,6 +159,8 @@ var Strategies;
|
|
|
159
159
|
Identifiers["EoaRepayOnPrice"] = "eoa-repay-on-price";
|
|
160
160
|
Identifiers["CollateralSwitch"] = "collateral-switch";
|
|
161
161
|
Identifiers["EoaCollateralSwitch"] = "eoa-collateral-switch";
|
|
162
|
+
Identifiers["LiquidationProtection"] = "liquidation-protection";
|
|
163
|
+
Identifiers["EoaLiquidationProtection"] = "eoa-liquidation-protection";
|
|
162
164
|
})(Identifiers = Strategies.Identifiers || (Strategies.Identifiers = {}));
|
|
163
165
|
let IdOverrides;
|
|
164
166
|
(function (IdOverrides) {
|
|
@@ -171,6 +173,8 @@ var Strategies;
|
|
|
171
173
|
IdOverrides["EoaLeverageManagement"] = "leverage-management-eoa";
|
|
172
174
|
IdOverrides["LeverageManagementOnPrice"] = "leverage-management-on-price";
|
|
173
175
|
IdOverrides["EoaLeverageManagementOnPrice"] = "leverage-management-on-price-eoa";
|
|
176
|
+
IdOverrides["LiquidationProtection"] = "liquidation-protection";
|
|
177
|
+
IdOverrides["EoaLiquidationProtection"] = "liquidation-protection-eoa";
|
|
174
178
|
})(IdOverrides = Strategies.IdOverrides || (Strategies.IdOverrides = {}));
|
|
175
179
|
})(Strategies = exports.Strategies || (exports.Strategies = {}));
|
|
176
180
|
var Bundles;
|
|
@@ -248,6 +252,14 @@ var Bundles;
|
|
|
248
252
|
MainnetIds[MainnetIds["AAVE_V4_EOA_REPAY_ON_PRICE"] = 68] = "AAVE_V4_EOA_REPAY_ON_PRICE";
|
|
249
253
|
MainnetIds[MainnetIds["AAVE_V4_EOA_BOOST_ON_PRICE"] = 69] = "AAVE_V4_EOA_BOOST_ON_PRICE";
|
|
250
254
|
MainnetIds[MainnetIds["AAVE_V4_EOA_CLOSE"] = 70] = "AAVE_V4_EOA_CLOSE";
|
|
255
|
+
MainnetIds[MainnetIds["AAVE_V3_LIQUIDATION_PROTECTION"] = 71] = "AAVE_V3_LIQUIDATION_PROTECTION";
|
|
256
|
+
MainnetIds[MainnetIds["SPARK_LIQUIDATION_PROTECTION"] = 72] = "SPARK_LIQUIDATION_PROTECTION";
|
|
257
|
+
MainnetIds[MainnetIds["COMP_V3_SW_LIQUIDATION_PROTECTION"] = 73] = "COMP_V3_SW_LIQUIDATION_PROTECTION";
|
|
258
|
+
MainnetIds[MainnetIds["COMP_V3_EOA_LIQUIDATION_PROTECTION"] = 74] = "COMP_V3_EOA_LIQUIDATION_PROTECTION";
|
|
259
|
+
MainnetIds[MainnetIds["MAKER_LIQUIDATION_PROTECTION"] = 75] = "MAKER_LIQUIDATION_PROTECTION";
|
|
260
|
+
MainnetIds[MainnetIds["FLUID_T1_LIQUIDATION_PROTECTION"] = 76] = "FLUID_T1_LIQUIDATION_PROTECTION";
|
|
261
|
+
MainnetIds[MainnetIds["AAVE_V4_LIQUIDATION_PROTECTION"] = 77] = "AAVE_V4_LIQUIDATION_PROTECTION";
|
|
262
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_LIQUIDATION_PROTECTION"] = 78] = "MORPHO_BLUE_LIQUIDATION_PROTECTION";
|
|
251
263
|
})(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
|
|
252
264
|
let OptimismIds;
|
|
253
265
|
(function (OptimismIds) {
|
|
@@ -262,6 +274,7 @@ var Bundles;
|
|
|
262
274
|
OptimismIds[OptimismIds["AAVE_V3_EOA_REPAY_ON_PRICE"] = 8] = "AAVE_V3_EOA_REPAY_ON_PRICE";
|
|
263
275
|
OptimismIds[OptimismIds["AAVE_V3_EOA_BOOST_ON_PRICE"] = 9] = "AAVE_V3_EOA_BOOST_ON_PRICE";
|
|
264
276
|
OptimismIds[OptimismIds["AAVE_V3_EOA_CLOSE"] = 10] = "AAVE_V3_EOA_CLOSE";
|
|
277
|
+
OptimismIds[OptimismIds["AAVE_V3_LIQUIDATION_PROTECTION"] = 11] = "AAVE_V3_LIQUIDATION_PROTECTION";
|
|
265
278
|
})(OptimismIds = Bundles.OptimismIds || (Bundles.OptimismIds = {}));
|
|
266
279
|
let BaseIds;
|
|
267
280
|
(function (BaseIds) {
|
|
@@ -292,6 +305,11 @@ var Bundles;
|
|
|
292
305
|
BaseIds[BaseIds["AAVE_V3_EOA_BOOST_ON_PRICE"] = 26] = "AAVE_V3_EOA_BOOST_ON_PRICE";
|
|
293
306
|
BaseIds[BaseIds["AAVE_V3_EOA_CLOSE"] = 27] = "AAVE_V3_EOA_CLOSE";
|
|
294
307
|
BaseIds[BaseIds["MORPHO_BLUE_CLOSE"] = 28] = "MORPHO_BLUE_CLOSE";
|
|
308
|
+
BaseIds[BaseIds["AAVE_V3_LIQUIDATION_PROTECTION"] = 29] = "AAVE_V3_LIQUIDATION_PROTECTION";
|
|
309
|
+
BaseIds[BaseIds["FLUID_T1_LIQUIDATION_PROTECTION"] = 30] = "FLUID_T1_LIQUIDATION_PROTECTION";
|
|
310
|
+
BaseIds[BaseIds["MORPHO_BLUE_LIQUIDATION_PROTECTION"] = 31] = "MORPHO_BLUE_LIQUIDATION_PROTECTION";
|
|
311
|
+
BaseIds[BaseIds["COMP_V3_SW_LIQUIDATION_PROTECTION"] = 32] = "COMP_V3_SW_LIQUIDATION_PROTECTION";
|
|
312
|
+
BaseIds[BaseIds["COMP_V3_EOA_LIQUIDATION_PROTECTION"] = 33] = "COMP_V3_EOA_LIQUIDATION_PROTECTION";
|
|
295
313
|
})(BaseIds = Bundles.BaseIds || (Bundles.BaseIds = {}));
|
|
296
314
|
let ArbitrumIds;
|
|
297
315
|
(function (ArbitrumIds) {
|
|
@@ -324,5 +342,10 @@ var Bundles;
|
|
|
324
342
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_REPAY"] = 26] = "MORPHO_BLUE_EOA_REPAY";
|
|
325
343
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_BOOST"] = 27] = "MORPHO_BLUE_EOA_BOOST";
|
|
326
344
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_CLOSE"] = 28] = "MORPHO_BLUE_CLOSE";
|
|
345
|
+
ArbitrumIds[ArbitrumIds["AAVE_V3_LIQUIDATION_PROTECTION"] = 29] = "AAVE_V3_LIQUIDATION_PROTECTION";
|
|
346
|
+
ArbitrumIds[ArbitrumIds["FLUID_T1_LIQUIDATION_PROTECTION"] = 30] = "FLUID_T1_LIQUIDATION_PROTECTION";
|
|
347
|
+
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_LIQUIDATION_PROTECTION"] = 31] = "MORPHO_BLUE_LIQUIDATION_PROTECTION";
|
|
348
|
+
ArbitrumIds[ArbitrumIds["COMP_V3_SW_LIQUIDATION_PROTECTION"] = 32] = "COMP_V3_SW_LIQUIDATION_PROTECTION";
|
|
349
|
+
ArbitrumIds[ArbitrumIds["COMP_V3_EOA_LIQUIDATION_PROTECTION"] = 33] = "COMP_V3_EOA_LIQUIDATION_PROTECTION";
|
|
327
350
|
})(ArbitrumIds = Bundles.ArbitrumIds || (Bundles.ArbitrumIds = {}));
|
|
328
351
|
})(Bundles = exports.Bundles || (exports.Bundles = {}));
|