@defisaver/automation-sdk 3.3.16-liq-prot-dev → 3.3.17-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 +60 -0
- package/cjs/services/strategiesService.js +12 -3
- package/cjs/services/strategySubService.d.ts +6 -2
- package/cjs/services/strategySubService.js +51 -15
- package/cjs/services/strategySubService.test.js +109 -1
- package/cjs/services/utils.d.ts +1 -2
- package/cjs/services/utils.js +1 -14
- package/cjs/types/enums.d.ts +15 -3
- package/cjs/types/enums.js +12 -0
- package/esm/constants/index.js +60 -0
- package/esm/services/strategiesService.js +12 -3
- package/esm/services/strategySubService.d.ts +6 -2
- package/esm/services/strategySubService.js +50 -15
- package/esm/services/strategySubService.test.js +109 -1
- package/esm/services/utils.d.ts +1 -2
- package/esm/services/utils.js +1 -13
- package/esm/types/enums.d.ts +15 -3
- package/esm/types/enums.js +12 -0
- package/package.json +1 -1
- package/src/constants/index.ts +60 -0
- package/src/services/strategiesService.ts +14 -4
- package/src/services/strategySubService.test.ts +145 -1
- package/src/services/strategySubService.ts +89 -17
- package/src/services/utils.ts +0 -12
- package/src/types/enums.ts +12 -0
package/cjs/constants/index.js
CHANGED
|
@@ -609,6 +609,21 @@ exports.MAINNET_BUNDLES_INFO = {
|
|
|
609
609
|
strategyId: enums_1.Strategies.Identifiers.RepayOnPrice,
|
|
610
610
|
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
611
611
|
},
|
|
612
|
+
[enums_1.Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
613
|
+
strategyOrBundleId: enums_1.Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
614
|
+
strategyId: enums_1.Strategies.Identifiers.EoaBoostOnPrice,
|
|
615
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
616
|
+
},
|
|
617
|
+
[enums_1.Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
618
|
+
strategyOrBundleId: enums_1.Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
619
|
+
strategyId: enums_1.Strategies.Identifiers.EoaRepayOnPrice,
|
|
620
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
621
|
+
},
|
|
622
|
+
[enums_1.Bundles.MainnetIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
623
|
+
strategyOrBundleId: enums_1.Bundles.MainnetIds.MORPHO_BLUE_EOA_CLOSE,
|
|
624
|
+
strategyId: enums_1.Strategies.Identifiers.EoaCloseOnPrice,
|
|
625
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
626
|
+
},
|
|
612
627
|
};
|
|
613
628
|
exports.OPTIMISM_BUNDLES_INFO = {
|
|
614
629
|
[enums_1.Bundles.OptimismIds.AAVE_V3_REPAY]: {
|
|
@@ -838,6 +853,11 @@ exports.BASE_BUNDLES_INFO = {
|
|
|
838
853
|
strategyId: enums_1.Strategies.Identifiers.LiquidationProtection,
|
|
839
854
|
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
840
855
|
},
|
|
856
|
+
[enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION]: {
|
|
857
|
+
strategyOrBundleId: enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION,
|
|
858
|
+
strategyId: enums_1.Strategies.Identifiers.EoaLiquidationProtection,
|
|
859
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
860
|
+
},
|
|
841
861
|
[enums_1.Bundles.BaseIds.FLUID_T1_SW_LIQUIDATION_PROTECTION]: {
|
|
842
862
|
strategyOrBundleId: enums_1.Bundles.BaseIds.FLUID_T1_SW_LIQUIDATION_PROTECTION,
|
|
843
863
|
strategyId: enums_1.Strategies.Identifiers.LiquidationProtection,
|
|
@@ -848,6 +868,31 @@ exports.BASE_BUNDLES_INFO = {
|
|
|
848
868
|
strategyId: enums_1.Strategies.Identifiers.EoaLiquidationProtection,
|
|
849
869
|
protocol: exports.PROTOCOLS.AaveV3,
|
|
850
870
|
},
|
|
871
|
+
[enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY]: {
|
|
872
|
+
strategyOrBundleId: enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY,
|
|
873
|
+
strategyId: enums_1.Strategies.Identifiers.EoaRepay,
|
|
874
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
875
|
+
},
|
|
876
|
+
[enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST]: {
|
|
877
|
+
strategyOrBundleId: enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST,
|
|
878
|
+
strategyId: enums_1.Strategies.Identifiers.EoaBoost,
|
|
879
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
880
|
+
},
|
|
881
|
+
[enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
882
|
+
strategyOrBundleId: enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
883
|
+
strategyId: enums_1.Strategies.Identifiers.EoaBoostOnPrice,
|
|
884
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
885
|
+
},
|
|
886
|
+
[enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
887
|
+
strategyOrBundleId: enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
888
|
+
strategyId: enums_1.Strategies.Identifiers.EoaRepayOnPrice,
|
|
889
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
890
|
+
},
|
|
891
|
+
[enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
892
|
+
strategyOrBundleId: enums_1.Bundles.BaseIds.MORPHO_BLUE_EOA_CLOSE,
|
|
893
|
+
strategyId: enums_1.Strategies.Identifiers.EoaCloseOnPrice,
|
|
894
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
895
|
+
},
|
|
851
896
|
};
|
|
852
897
|
exports.ARBITRUM_BUNDLES_INFO = {
|
|
853
898
|
[enums_1.Bundles.ArbitrumIds.AAVE_V3_REPAY]: {
|
|
@@ -1035,6 +1080,21 @@ exports.ARBITRUM_BUNDLES_INFO = {
|
|
|
1035
1080
|
strategyId: enums_1.Strategies.Identifiers.EoaLiquidationProtection,
|
|
1036
1081
|
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
1037
1082
|
},
|
|
1083
|
+
[enums_1.Bundles.ArbitrumIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
1084
|
+
strategyOrBundleId: enums_1.Bundles.ArbitrumIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
1085
|
+
strategyId: enums_1.Strategies.Identifiers.EoaBoostOnPrice,
|
|
1086
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
1087
|
+
},
|
|
1088
|
+
[enums_1.Bundles.ArbitrumIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
1089
|
+
strategyOrBundleId: enums_1.Bundles.ArbitrumIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
1090
|
+
strategyId: enums_1.Strategies.Identifiers.EoaRepayOnPrice,
|
|
1091
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
1092
|
+
},
|
|
1093
|
+
[enums_1.Bundles.ArbitrumIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
1094
|
+
strategyOrBundleId: enums_1.Bundles.ArbitrumIds.MORPHO_BLUE_EOA_CLOSE,
|
|
1095
|
+
strategyId: enums_1.Strategies.Identifiers.EoaCloseOnPrice,
|
|
1096
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
1097
|
+
},
|
|
1038
1098
|
};
|
|
1039
1099
|
exports.BUNDLES_INFO = {
|
|
1040
1100
|
[enums_1.ChainId.Ethereum]: exports.MAINNET_BUNDLES_INFO,
|
|
@@ -947,6 +947,7 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
|
|
|
947
947
|
const _position = (0, lodash_1.cloneDeep)(position);
|
|
948
948
|
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
949
949
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
950
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
950
951
|
const triggerData = triggerService.morphoBlueRatioTrigger.decode(subStruct.triggerData);
|
|
951
952
|
const subData = subDataService.morphoBlueLeverageManagementSubData.decode(subStruct.subData);
|
|
952
953
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
@@ -960,7 +961,7 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
|
|
|
960
961
|
repayEnabled: isEnabled,
|
|
961
962
|
subId1: Number(subId),
|
|
962
963
|
subHashRepay: subHash,
|
|
963
|
-
mergeWithId: enums_1.Strategies.Identifiers.Boost,
|
|
964
|
+
mergeWithId: isEOA ? enums_1.Strategies.Identifiers.EoaBoost : enums_1.Strategies.Identifiers.Boost,
|
|
964
965
|
};
|
|
965
966
|
}
|
|
966
967
|
else {
|
|
@@ -970,10 +971,9 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
|
|
|
970
971
|
boostEnabled: isEnabled,
|
|
971
972
|
subId2: Number(subId),
|
|
972
973
|
subHashBoost: subHash,
|
|
973
|
-
mergeId: enums_1.Strategies.Identifiers.Boost,
|
|
974
|
+
mergeId: isEOA ? enums_1.Strategies.Identifiers.EoaBoost : enums_1.Strategies.Identifiers.Boost,
|
|
974
975
|
};
|
|
975
976
|
}
|
|
976
|
-
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
977
977
|
_position.strategy.strategyId = isEOA ? enums_1.Strategies.IdOverrides.EoaLeverageManagement : enums_1.Strategies.IdOverrides.LeverageManagement;
|
|
978
978
|
return _position;
|
|
979
979
|
}
|
|
@@ -1000,6 +1000,7 @@ function parseMorphoBlueLiquidationProtection(position, parseData) {
|
|
|
1000
1000
|
function parseMorphoBlueLeverageManagementOnPrice(position, parseData) {
|
|
1001
1001
|
const _position = (0, lodash_1.cloneDeep)(position);
|
|
1002
1002
|
const { subStruct } = parseData.subscriptionEventData;
|
|
1003
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
1003
1004
|
const triggerData = triggerService.morphoBluePriceTrigger.decode(subStruct.triggerData);
|
|
1004
1005
|
const subData = subDataService.morphoBlueLeverageManagementOnPriceSubData.decode(subStruct.subData);
|
|
1005
1006
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
@@ -1022,11 +1023,15 @@ function parseMorphoBlueLeverageManagementOnPrice(position, parseData) {
|
|
|
1022
1023
|
ratio: subData.targetRatio,
|
|
1023
1024
|
ratioState: triggerData.priceState,
|
|
1024
1025
|
};
|
|
1026
|
+
_position.strategy.strategyId = isEOA
|
|
1027
|
+
? enums_1.Strategies.IdOverrides.EoaLeverageManagementOnPrice
|
|
1028
|
+
: enums_1.Strategies.IdOverrides.LeverageManagementOnPrice;
|
|
1025
1029
|
return _position;
|
|
1026
1030
|
}
|
|
1027
1031
|
function parseMorphoBlueCloseOnPrice(position, parseData) {
|
|
1028
1032
|
const _position = (0, lodash_1.cloneDeep)(position);
|
|
1029
1033
|
const { subStruct } = parseData.subscriptionEventData;
|
|
1034
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
1030
1035
|
const triggerData = triggerService.morphoBluePriceRangeTrigger.decode(subStruct.triggerData);
|
|
1031
1036
|
const subData = subDataService.morphoBlueCloseOnPriceSubData.decode(subStruct.subData);
|
|
1032
1037
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
@@ -1041,6 +1046,7 @@ function parseMorphoBlueCloseOnPrice(position, parseData) {
|
|
|
1041
1046
|
]);
|
|
1042
1047
|
const marketId = web3.utils.keccak256(marketIdEncodedData);
|
|
1043
1048
|
const { takeProfitType, stopLossType } = (0, utils_1.getStopLossAndTakeProfitTypeByCloseStrategyType)(+subData.closeType);
|
|
1049
|
+
_position.strategy.strategyId = isEOA ? enums_1.Strategies.Identifiers.EoaCloseOnPrice : enums_1.Strategies.Identifiers.CloseOnPrice;
|
|
1044
1050
|
_position.specific = {
|
|
1045
1051
|
subHash: _position.subHash,
|
|
1046
1052
|
marketId,
|
|
@@ -1285,9 +1291,12 @@ const parsingMethodsMapping = {
|
|
|
1285
1291
|
[enums_1.Strategies.Identifiers.EoaBoost]: parseMorphoBlueLeverageManagement,
|
|
1286
1292
|
[enums_1.Strategies.Identifiers.BoostOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
|
|
1287
1293
|
[enums_1.Strategies.Identifiers.RepayOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
|
|
1294
|
+
[enums_1.Strategies.Identifiers.EoaBoostOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
|
|
1295
|
+
[enums_1.Strategies.Identifiers.EoaRepayOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
|
|
1288
1296
|
[enums_1.Strategies.Identifiers.CloseOnPrice]: parseMorphoBlueCloseOnPrice,
|
|
1289
1297
|
[enums_1.Strategies.Identifiers.LiquidationProtection]: parseMorphoBlueLiquidationProtection,
|
|
1290
1298
|
[enums_1.Strategies.Identifiers.EoaLiquidationProtection]: parseMorphoBlueLiquidationProtection,
|
|
1299
|
+
[enums_1.Strategies.Identifiers.EoaCloseOnPrice]: parseMorphoBlueCloseOnPrice,
|
|
1291
1300
|
},
|
|
1292
1301
|
[enums_1.ProtocolIdentifiers.StrategiesAutomation.FluidT1]: {
|
|
1293
1302
|
[enums_1.Strategies.Identifiers.Repay]: parseFluidT1LeverageManagement,
|
|
@@ -99,11 +99,15 @@ export declare const crvUSDEncode: {
|
|
|
99
99
|
leverageManagement(owner: EthereumAddress, controllerAddr: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number, collTokenAddr: EthereumAddress, crvUSDAddr: EthereumAddress): (boolean | string[] | Bundles.MainnetIds)[];
|
|
100
100
|
payback(proxyAddress: EthereumAddress, addressToPullTokensFrom: EthereumAddress, positionOwner: EthereumAddress, paybackAmount: string, crvUSDAddr: EthereumAddress, controllerAddr: EthereumAddress, minHealthRatio: number): (boolean | string[] | Strategies.MainnetIds)[];
|
|
101
101
|
};
|
|
102
|
+
export type MorphoBlueBundleStrategy = 'repay' | 'boost' | 'repayOnPrice' | 'boostOnPrice' | 'close' | 'liquidationProtection';
|
|
103
|
+
export declare function getMorphoBlueBundleId(network: ChainId, strategy: MorphoBlueBundleStrategy, isEOA: boolean): number;
|
|
102
104
|
export declare const morphoBlueEncode: {
|
|
103
|
-
leverageManagement(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean, network: ChainId): (
|
|
104
|
-
liquidationProtection(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean, network: ChainId): (boolean | string[]
|
|
105
|
+
leverageManagement(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean, network: ChainId): (number | boolean | string[])[];
|
|
106
|
+
liquidationProtection(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean, network: ChainId): (number | boolean | string[])[];
|
|
105
107
|
leverageManagementOnPrice(strategyOrBundleId: number, isBundle: boolean | undefined, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, user: EthereumAddress, targetRatio: number, price: number, priceState: RatioState): (number | boolean | string[])[];
|
|
108
|
+
leverageManagementOnPriceGeneric(loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, user: EthereumAddress, targetRatio: number, price: number, priceState: RatioState, isBoost: boolean, isEOA: boolean, network: ChainId): (number | boolean | string[])[];
|
|
106
109
|
closeOnPrice(strategyOrBundleId: number, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, user: EthereumAddress, stopLossPrice?: number, stopLossType?: CloseToAssetType, takeProfitPrice?: number, takeProfitType?: CloseToAssetType): (number | boolean | string[])[];
|
|
110
|
+
closeOnPriceGeneric(loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, user: EthereumAddress, stopLossPrice: number | undefined, stopLossType: CloseToAssetType | undefined, takeProfitPrice: number | undefined, takeProfitType: CloseToAssetType | undefined, isEOA: boolean, network: ChainId): (number | boolean | string[])[];
|
|
107
111
|
};
|
|
108
112
|
export declare const liquityV2Encode: {
|
|
109
113
|
leverageManagement(market: EthereumAddress, troveId: string, collToken: EthereumAddress, boldToken: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number, strategyOrBundleId: number): (number | boolean | string[])[];
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.aaveV4Encode = exports.fluidEncode = exports.liquityV2Encode = exports.morphoBlueEncode = exports.crvUSDEncode = exports.sparkEncode = exports.exchangeEncode = exports.compoundV3Encode = exports.compoundV2Encode = exports.aaveV3Encode = exports.aaveV2Encode = exports.liquityEncode = exports.makerEncode = void 0;
|
|
26
|
+
exports.aaveV4Encode = exports.fluidEncode = exports.liquityV2Encode = exports.morphoBlueEncode = exports.getMorphoBlueBundleId = exports.crvUSDEncode = exports.sparkEncode = exports.exchangeEncode = exports.compoundV3Encode = exports.compoundV2Encode = exports.aaveV3Encode = exports.aaveV2Encode = exports.liquityEncode = exports.makerEncode = void 0;
|
|
27
27
|
const tokens_1 = require("@defisaver/tokens");
|
|
28
28
|
const constants_1 = require("../constants");
|
|
29
29
|
const enums_1 = require("../types/enums");
|
|
@@ -300,31 +300,52 @@ exports.crvUSDEncode = {
|
|
|
300
300
|
return [strategyId, isBundle, triggerData, subData];
|
|
301
301
|
},
|
|
302
302
|
};
|
|
303
|
+
function getMorphoBlueBundlesIds(network) {
|
|
304
|
+
switch (network) {
|
|
305
|
+
case enums_1.ChainId.Ethereum:
|
|
306
|
+
return enums_1.Bundles.MainnetIds;
|
|
307
|
+
case enums_1.ChainId.Base:
|
|
308
|
+
return enums_1.Bundles.BaseIds;
|
|
309
|
+
case enums_1.ChainId.Arbitrum:
|
|
310
|
+
return enums_1.Bundles.ArbitrumIds;
|
|
311
|
+
default:
|
|
312
|
+
throw new Error(`Morpho Blue strategies are not supported on chain ${network}`);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function getMorphoBlueBundleId(network, strategy, isEOA) {
|
|
316
|
+
const bundlesIds = getMorphoBlueBundlesIds(network);
|
|
317
|
+
switch (strategy) {
|
|
318
|
+
case 'repay':
|
|
319
|
+
return isEOA ? bundlesIds.MORPHO_BLUE_EOA_REPAY : bundlesIds.MORPHO_BLUE_REPAY;
|
|
320
|
+
case 'boost':
|
|
321
|
+
return isEOA ? bundlesIds.MORPHO_BLUE_EOA_BOOST : bundlesIds.MORPHO_BLUE_BOOST;
|
|
322
|
+
case 'repayOnPrice':
|
|
323
|
+
return isEOA ? bundlesIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE : bundlesIds.MORPHO_BLUE_REPAY_ON_PRICE;
|
|
324
|
+
case 'boostOnPrice':
|
|
325
|
+
return isEOA ? bundlesIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE : bundlesIds.MORPHO_BLUE_BOOST_ON_PRICE;
|
|
326
|
+
case 'close':
|
|
327
|
+
return isEOA ? bundlesIds.MORPHO_BLUE_EOA_CLOSE : bundlesIds.MORPHO_BLUE_CLOSE;
|
|
328
|
+
case 'liquidationProtection':
|
|
329
|
+
return isEOA ? bundlesIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION : bundlesIds.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION;
|
|
330
|
+
default:
|
|
331
|
+
throw new Error(`Unknown Morpho Blue strategy: ${strategy}`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
exports.getMorphoBlueBundleId = getMorphoBlueBundleId;
|
|
303
335
|
exports.morphoBlueEncode = {
|
|
304
336
|
leverageManagement(marketId, loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, triggerRatio, user, isEOA, network) {
|
|
305
337
|
const subData = subDataService.morphoBlueLeverageManagementSubData.encode(loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA);
|
|
306
338
|
const triggerData = triggerService.morphoBlueRatioTrigger.encode(marketId, user, triggerRatio, ratioState);
|
|
307
339
|
// over is boost, under is repay
|
|
308
340
|
const isBoost = ratioState === enums_1.RatioState.OVER;
|
|
309
|
-
|
|
310
|
-
if (network === enums_1.ChainId.Base) {
|
|
311
|
-
return [isBoost ? enums_1.Bundles.BaseIds.MORPHO_BLUE_BOOST : enums_1.Bundles.BaseIds.MORPHO_BLUE_REPAY, true, triggerData, subData];
|
|
312
|
-
}
|
|
313
|
-
const bundlesIds = network === enums_1.ChainId.Arbitrum ? enums_1.Bundles.ArbitrumIds : enums_1.Bundles.MainnetIds;
|
|
314
|
-
if (isBoost)
|
|
315
|
-
strategyOrBundleId = isEOA ? bundlesIds.MORPHO_BLUE_EOA_BOOST : bundlesIds.MORPHO_BLUE_BOOST;
|
|
316
|
-
else
|
|
317
|
-
strategyOrBundleId = isEOA ? bundlesIds.MORPHO_BLUE_EOA_REPAY : bundlesIds.MORPHO_BLUE_REPAY;
|
|
341
|
+
const bundleId = getMorphoBlueBundleId(network, isBoost ? 'boost' : 'repay', isEOA);
|
|
318
342
|
const isBundle = true;
|
|
319
|
-
return [
|
|
343
|
+
return [bundleId, isBundle, triggerData, subData];
|
|
320
344
|
},
|
|
321
345
|
liquidationProtection(marketId, loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, triggerRatio, user, isEOA, network) {
|
|
322
346
|
const subData = subDataService.morphoBlueLiquidationProtectionSubData.encode(loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA);
|
|
323
347
|
const triggerData = triggerService.morphoBlueRatioTrigger.encode(marketId, user, triggerRatio, ratioState);
|
|
324
|
-
|
|
325
|
-
// That is fine because we will just always send isEOA == false for Base chain.
|
|
326
|
-
const bundleNetwork = (0, utils_1.getBundleIdsByNetwork)(network);
|
|
327
|
-
const bundleId = isEOA ? bundleNetwork.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION : bundleNetwork.MORPHO_BLUE_SW_LIQUIDATION_PROTECTION;
|
|
348
|
+
const bundleId = getMorphoBlueBundleId(network, 'liquidationProtection', isEOA);
|
|
328
349
|
const isBundle = true;
|
|
329
350
|
return [bundleId, isBundle, triggerData, subData];
|
|
330
351
|
},
|
|
@@ -333,6 +354,13 @@ exports.morphoBlueEncode = {
|
|
|
333
354
|
const triggerData = triggerService.morphoBluePriceTrigger.encode(oracle, collToken, loanToken, price, priceState);
|
|
334
355
|
return [strategyOrBundleId, isBundle, triggerData, subData];
|
|
335
356
|
},
|
|
357
|
+
leverageManagementOnPriceGeneric(loanToken, collToken, oracle, irm, lltv, user, targetRatio, price, priceState, isBoost, isEOA, network) {
|
|
358
|
+
const subData = subDataService.morphoBlueLeverageManagementOnPriceSubData.encode(loanToken, collToken, oracle, irm, lltv, targetRatio, user);
|
|
359
|
+
const triggerData = triggerService.morphoBluePriceTrigger.encode(oracle, collToken, loanToken, price, priceState);
|
|
360
|
+
const bundleId = getMorphoBlueBundleId(network, isBoost ? 'boostOnPrice' : 'repayOnPrice', isEOA);
|
|
361
|
+
const isBundle = true;
|
|
362
|
+
return [bundleId, isBundle, triggerData, subData];
|
|
363
|
+
},
|
|
336
364
|
closeOnPrice(strategyOrBundleId, loanToken, collToken, oracle, irm, lltv, user, stopLossPrice = 0, stopLossType = enums_1.CloseToAssetType.DEBT, takeProfitPrice = 0, takeProfitType = enums_1.CloseToAssetType.COLLATERAL) {
|
|
337
365
|
const isBundle = true;
|
|
338
366
|
const closeType = (0, utils_1.getCloseStrategyType)(stopLossPrice, stopLossType, takeProfitPrice, takeProfitType);
|
|
@@ -340,6 +368,14 @@ exports.morphoBlueEncode = {
|
|
|
340
368
|
const triggerDataEncoded = triggerService.morphoBluePriceRangeTrigger.encode(oracle, collToken, loanToken, stopLossPrice, takeProfitPrice);
|
|
341
369
|
return [strategyOrBundleId, isBundle, triggerDataEncoded, subDataEncoded];
|
|
342
370
|
},
|
|
371
|
+
closeOnPriceGeneric(loanToken, collToken, oracle, irm, lltv, user, stopLossPrice = 0, stopLossType = enums_1.CloseToAssetType.DEBT, takeProfitPrice = 0, takeProfitType = enums_1.CloseToAssetType.COLLATERAL, isEOA, network) {
|
|
372
|
+
const isBundle = true;
|
|
373
|
+
const closeType = (0, utils_1.getCloseStrategyType)(stopLossPrice, stopLossType, takeProfitPrice, takeProfitType);
|
|
374
|
+
const subDataEncoded = subDataService.morphoBlueCloseOnPriceSubData.encode(loanToken, collToken, oracle, irm, lltv, user, closeType);
|
|
375
|
+
const triggerDataEncoded = triggerService.morphoBluePriceRangeTrigger.encode(oracle, collToken, loanToken, stopLossPrice, takeProfitPrice);
|
|
376
|
+
const bundleId = getMorphoBlueBundleId(network, 'close', isEOA);
|
|
377
|
+
return [bundleId, isBundle, triggerDataEncoded, subDataEncoded];
|
|
378
|
+
},
|
|
343
379
|
};
|
|
344
380
|
exports.liquityV2Encode = {
|
|
345
381
|
leverageManagement(market, troveId, collToken, boldToken, ratioState, targetRatio, triggerRatio, strategyOrBundleId) {
|
|
@@ -1254,6 +1254,75 @@ describe('Feature: strategySubService.ts', () => {
|
|
|
1254
1254
|
});
|
|
1255
1255
|
});
|
|
1256
1256
|
});
|
|
1257
|
+
describe('leverageManagementOnPriceGeneric()', () => {
|
|
1258
|
+
const examples = [
|
|
1259
|
+
[
|
|
1260
|
+
[
|
|
1261
|
+
enums_1.Bundles.MainnetIds.MORPHO_BLUE_REPAY_ON_PRICE,
|
|
1262
|
+
true,
|
|
1263
|
+
['0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000003a352944000000000000000000000000000000000000000000000000000000000000000001'],
|
|
1264
|
+
[
|
|
1265
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1266
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1267
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1268
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1269
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
1270
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
1271
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
1272
|
+
],
|
|
1273
|
+
],
|
|
1274
|
+
[
|
|
1275
|
+
web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
|
|
1276
|
+
web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
|
|
1277
|
+
web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
|
|
1278
|
+
web3Utils.toChecksumAddress('0x0000000000000000000000000000000000000000'),
|
|
1279
|
+
'945000000000000000',
|
|
1280
|
+
web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'),
|
|
1281
|
+
200,
|
|
1282
|
+
2500,
|
|
1283
|
+
enums_1.RatioState.UNDER,
|
|
1284
|
+
false,
|
|
1285
|
+
false,
|
|
1286
|
+
enums_1.ChainId.Ethereum,
|
|
1287
|
+
],
|
|
1288
|
+
],
|
|
1289
|
+
[
|
|
1290
|
+
[
|
|
1291
|
+
enums_1.Bundles.MainnetIds.MORPHO_BLUE_BOOST_ON_PRICE,
|
|
1292
|
+
true,
|
|
1293
|
+
['0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000005d21dba0000000000000000000000000000000000000000000000000000000000000000000'],
|
|
1294
|
+
[
|
|
1295
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1296
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1297
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1298
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1299
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
1300
|
+
'0x00000000000000000000000000000000000000000000000016345785d8a00000',
|
|
1301
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
1302
|
+
],
|
|
1303
|
+
],
|
|
1304
|
+
[
|
|
1305
|
+
web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
|
|
1306
|
+
web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
|
|
1307
|
+
web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
|
|
1308
|
+
web3Utils.toChecksumAddress('0x0000000000000000000000000000000000000000'),
|
|
1309
|
+
'945000000000000000',
|
|
1310
|
+
web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'),
|
|
1311
|
+
160,
|
|
1312
|
+
4000,
|
|
1313
|
+
enums_1.RatioState.OVER,
|
|
1314
|
+
true,
|
|
1315
|
+
false,
|
|
1316
|
+
enums_1.ChainId.Ethereum,
|
|
1317
|
+
],
|
|
1318
|
+
],
|
|
1319
|
+
];
|
|
1320
|
+
examples.forEach(([expected, actual]) => {
|
|
1321
|
+
it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1322
|
+
(0, chai_1.expect)(strategySubService_1.morphoBlueEncode.leverageManagementOnPriceGeneric(...actual)).to.eql(expected);
|
|
1323
|
+
});
|
|
1324
|
+
});
|
|
1325
|
+
});
|
|
1257
1326
|
describe('closeOnPrice()', () => {
|
|
1258
1327
|
const examples = [
|
|
1259
1328
|
[
|
|
@@ -1282,7 +1351,7 @@ describe('Feature: strategySubService.ts', () => {
|
|
|
1282
1351
|
1500,
|
|
1283
1352
|
enums_1.CloseToAssetType.DEBT,
|
|
1284
1353
|
4000,
|
|
1285
|
-
enums_1.CloseToAssetType.COLLATERAL
|
|
1354
|
+
enums_1.CloseToAssetType.COLLATERAL,
|
|
1286
1355
|
]
|
|
1287
1356
|
],
|
|
1288
1357
|
];
|
|
@@ -1292,6 +1361,45 @@ describe('Feature: strategySubService.ts', () => {
|
|
|
1292
1361
|
});
|
|
1293
1362
|
});
|
|
1294
1363
|
});
|
|
1364
|
+
describe('closeOnPriceGeneric()', () => {
|
|
1365
|
+
const examples = [
|
|
1366
|
+
[
|
|
1367
|
+
[
|
|
1368
|
+
enums_1.Bundles.MainnetIds.MORPHO_BLUE_CLOSE,
|
|
1369
|
+
true,
|
|
1370
|
+
['0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000022ecb25c000000000000000000000000000000000000000000000000000000005d21dba000'],
|
|
1371
|
+
[
|
|
1372
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1373
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1374
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1375
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1376
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
1377
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
1378
|
+
'0x0000000000000000000000000000000000000000000000000000000000000005',
|
|
1379
|
+
],
|
|
1380
|
+
],
|
|
1381
|
+
[
|
|
1382
|
+
web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
|
|
1383
|
+
web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
|
|
1384
|
+
web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
|
|
1385
|
+
web3Utils.toChecksumAddress('0x0000000000000000000000000000000000000000'),
|
|
1386
|
+
'945000000000000000',
|
|
1387
|
+
web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'),
|
|
1388
|
+
1500,
|
|
1389
|
+
enums_1.CloseToAssetType.DEBT,
|
|
1390
|
+
4000,
|
|
1391
|
+
enums_1.CloseToAssetType.COLLATERAL,
|
|
1392
|
+
false,
|
|
1393
|
+
enums_1.ChainId.Ethereum,
|
|
1394
|
+
]
|
|
1395
|
+
],
|
|
1396
|
+
];
|
|
1397
|
+
examples.forEach(([expected, actual]) => {
|
|
1398
|
+
it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1399
|
+
(0, chai_1.expect)(strategySubService_1.morphoBlueEncode.closeOnPriceGeneric(...actual)).to.eql(expected);
|
|
1400
|
+
});
|
|
1401
|
+
});
|
|
1402
|
+
});
|
|
1295
1403
|
});
|
|
1296
1404
|
describe('When testing strategySubService.sparkEncode', () => {
|
|
1297
1405
|
describe('leverageManagementOnPrice()', () => {
|
package/cjs/services/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EthereumAddress } from '../types';
|
|
2
|
-
import {
|
|
2
|
+
import { 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,4 +28,3 @@ 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.ArbitrumIds | typeof Bundles.BaseIds;
|
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.
|
|
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;
|
|
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,16 +188,3 @@ function getStopLossAndTakeProfitTypeByCloseStrategyType(closeStrategyType) {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
exports.getStopLossAndTakeProfitTypeByCloseStrategyType = getStopLossAndTakeProfitTypeByCloseStrategyType;
|
|
191
|
-
function getBundleIdsByNetwork(network) {
|
|
192
|
-
switch (Number(network)) {
|
|
193
|
-
case enums_1.ChainId.Ethereum:
|
|
194
|
-
return enums_1.Bundles.MainnetIds;
|
|
195
|
-
case enums_1.ChainId.Arbitrum:
|
|
196
|
-
return enums_1.Bundles.ArbitrumIds;
|
|
197
|
-
case enums_1.ChainId.Base:
|
|
198
|
-
return enums_1.Bundles.BaseIds;
|
|
199
|
-
default:
|
|
200
|
-
throw new Error(`Unsupported network ${network}`);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
exports.getBundleIdsByNetwork = getBundleIdsByNetwork;
|
package/cjs/types/enums.d.ts
CHANGED
|
@@ -240,7 +240,10 @@ export declare namespace Bundles {
|
|
|
240
240
|
MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 81,
|
|
241
241
|
COMP_V3_SW_LIQUIDATION_PROTECTION = 82,
|
|
242
242
|
COMP_V3_EOA_LIQUIDATION_PROTECTION = 83,
|
|
243
|
-
MORPHO_BLUE_REPAY_ON_PRICE = 84
|
|
243
|
+
MORPHO_BLUE_REPAY_ON_PRICE = 84,
|
|
244
|
+
MORPHO_BLUE_EOA_BOOST_ON_PRICE = 85,
|
|
245
|
+
MORPHO_BLUE_EOA_REPAY_ON_PRICE = 86,
|
|
246
|
+
MORPHO_BLUE_EOA_CLOSE = 87
|
|
244
247
|
}
|
|
245
248
|
enum OptimismIds {
|
|
246
249
|
AAVE_V3_REPAY = 0,
|
|
@@ -291,7 +294,13 @@ export declare namespace Bundles {
|
|
|
291
294
|
COMP_V3_EOA_LIQUIDATION_PROTECTION = 33,
|
|
292
295
|
AAVE_V3_EOA_LIQUIDATION_PROTECTION = 34,
|
|
293
296
|
MORPHO_BLUE_SW_LIQUIDATION_PROTECTION = 35,
|
|
294
|
-
MORPHO_BLUE_REPAY_ON_PRICE = 36
|
|
297
|
+
MORPHO_BLUE_REPAY_ON_PRICE = 36,
|
|
298
|
+
MORPHO_BLUE_EOA_REPAY = 37,
|
|
299
|
+
MORPHO_BLUE_EOA_BOOST = 38,
|
|
300
|
+
MORPHO_BLUE_EOA_BOOST_ON_PRICE = 39,
|
|
301
|
+
MORPHO_BLUE_EOA_REPAY_ON_PRICE = 40,
|
|
302
|
+
MORPHO_BLUE_EOA_CLOSE = 41,
|
|
303
|
+
MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 42
|
|
295
304
|
}
|
|
296
305
|
enum ArbitrumIds {
|
|
297
306
|
AAVE_V3_REPAY = 0,
|
|
@@ -330,6 +339,9 @@ export declare namespace Bundles {
|
|
|
330
339
|
COMP_V3_EOA_LIQUIDATION_PROTECTION = 33,
|
|
331
340
|
AAVE_V3_EOA_LIQUIDATION_PROTECTION = 34,
|
|
332
341
|
MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION = 35,
|
|
333
|
-
MORPHO_BLUE_REPAY_ON_PRICE = 36
|
|
342
|
+
MORPHO_BLUE_REPAY_ON_PRICE = 36,
|
|
343
|
+
MORPHO_BLUE_EOA_BOOST_ON_PRICE = 37,
|
|
344
|
+
MORPHO_BLUE_EOA_REPAY_ON_PRICE = 38,
|
|
345
|
+
MORPHO_BLUE_EOA_CLOSE = 39
|
|
334
346
|
}
|
|
335
347
|
}
|
package/cjs/types/enums.js
CHANGED
|
@@ -264,6 +264,9 @@ var Bundles;
|
|
|
264
264
|
MainnetIds[MainnetIds["COMP_V3_SW_LIQUIDATION_PROTECTION"] = 82] = "COMP_V3_SW_LIQUIDATION_PROTECTION";
|
|
265
265
|
MainnetIds[MainnetIds["COMP_V3_EOA_LIQUIDATION_PROTECTION"] = 83] = "COMP_V3_EOA_LIQUIDATION_PROTECTION";
|
|
266
266
|
MainnetIds[MainnetIds["MORPHO_BLUE_REPAY_ON_PRICE"] = 84] = "MORPHO_BLUE_REPAY_ON_PRICE";
|
|
267
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_EOA_BOOST_ON_PRICE"] = 85] = "MORPHO_BLUE_EOA_BOOST_ON_PRICE";
|
|
268
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_EOA_REPAY_ON_PRICE"] = 86] = "MORPHO_BLUE_EOA_REPAY_ON_PRICE";
|
|
269
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_EOA_CLOSE"] = 87] = "MORPHO_BLUE_EOA_CLOSE";
|
|
267
270
|
})(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
|
|
268
271
|
let OptimismIds;
|
|
269
272
|
(function (OptimismIds) {
|
|
@@ -317,6 +320,12 @@ var Bundles;
|
|
|
317
320
|
BaseIds[BaseIds["AAVE_V3_EOA_LIQUIDATION_PROTECTION"] = 34] = "AAVE_V3_EOA_LIQUIDATION_PROTECTION";
|
|
318
321
|
BaseIds[BaseIds["MORPHO_BLUE_SW_LIQUIDATION_PROTECTION"] = 35] = "MORPHO_BLUE_SW_LIQUIDATION_PROTECTION";
|
|
319
322
|
BaseIds[BaseIds["MORPHO_BLUE_REPAY_ON_PRICE"] = 36] = "MORPHO_BLUE_REPAY_ON_PRICE";
|
|
323
|
+
BaseIds[BaseIds["MORPHO_BLUE_EOA_REPAY"] = 37] = "MORPHO_BLUE_EOA_REPAY";
|
|
324
|
+
BaseIds[BaseIds["MORPHO_BLUE_EOA_BOOST"] = 38] = "MORPHO_BLUE_EOA_BOOST";
|
|
325
|
+
BaseIds[BaseIds["MORPHO_BLUE_EOA_BOOST_ON_PRICE"] = 39] = "MORPHO_BLUE_EOA_BOOST_ON_PRICE";
|
|
326
|
+
BaseIds[BaseIds["MORPHO_BLUE_EOA_REPAY_ON_PRICE"] = 40] = "MORPHO_BLUE_EOA_REPAY_ON_PRICE";
|
|
327
|
+
BaseIds[BaseIds["MORPHO_BLUE_EOA_CLOSE"] = 41] = "MORPHO_BLUE_EOA_CLOSE";
|
|
328
|
+
BaseIds[BaseIds["MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION"] = 42] = "MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION";
|
|
320
329
|
})(BaseIds = Bundles.BaseIds || (Bundles.BaseIds = {}));
|
|
321
330
|
let ArbitrumIds;
|
|
322
331
|
(function (ArbitrumIds) {
|
|
@@ -357,5 +366,8 @@ var Bundles;
|
|
|
357
366
|
ArbitrumIds[ArbitrumIds["AAVE_V3_EOA_LIQUIDATION_PROTECTION"] = 34] = "AAVE_V3_EOA_LIQUIDATION_PROTECTION";
|
|
358
367
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION"] = 35] = "MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION";
|
|
359
368
|
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_REPAY_ON_PRICE"] = 36] = "MORPHO_BLUE_REPAY_ON_PRICE";
|
|
369
|
+
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_BOOST_ON_PRICE"] = 37] = "MORPHO_BLUE_EOA_BOOST_ON_PRICE";
|
|
370
|
+
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_REPAY_ON_PRICE"] = 38] = "MORPHO_BLUE_EOA_REPAY_ON_PRICE";
|
|
371
|
+
ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_CLOSE"] = 39] = "MORPHO_BLUE_EOA_CLOSE";
|
|
360
372
|
})(ArbitrumIds = Bundles.ArbitrumIds || (Bundles.ArbitrumIds = {}));
|
|
361
373
|
})(Bundles = exports.Bundles || (exports.Bundles = {}));
|
package/esm/constants/index.js
CHANGED
|
@@ -603,6 +603,21 @@ export const MAINNET_BUNDLES_INFO = {
|
|
|
603
603
|
strategyId: Strategies.Identifiers.RepayOnPrice,
|
|
604
604
|
protocol: PROTOCOLS.MorphoBlue,
|
|
605
605
|
},
|
|
606
|
+
[Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
607
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
608
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
609
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
610
|
+
},
|
|
611
|
+
[Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
612
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
613
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
614
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
615
|
+
},
|
|
616
|
+
[Bundles.MainnetIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
617
|
+
strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_EOA_CLOSE,
|
|
618
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
619
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
620
|
+
},
|
|
606
621
|
};
|
|
607
622
|
export const OPTIMISM_BUNDLES_INFO = {
|
|
608
623
|
[Bundles.OptimismIds.AAVE_V3_REPAY]: {
|
|
@@ -832,6 +847,11 @@ export const BASE_BUNDLES_INFO = {
|
|
|
832
847
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
833
848
|
protocol: PROTOCOLS.MorphoBlue,
|
|
834
849
|
},
|
|
850
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION]: {
|
|
851
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_LIQUIDATION_PROTECTION,
|
|
852
|
+
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
853
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
854
|
+
},
|
|
835
855
|
[Bundles.BaseIds.FLUID_T1_SW_LIQUIDATION_PROTECTION]: {
|
|
836
856
|
strategyOrBundleId: Bundles.BaseIds.FLUID_T1_SW_LIQUIDATION_PROTECTION,
|
|
837
857
|
strategyId: Strategies.Identifiers.LiquidationProtection,
|
|
@@ -842,6 +862,31 @@ export const BASE_BUNDLES_INFO = {
|
|
|
842
862
|
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
843
863
|
protocol: PROTOCOLS.AaveV3,
|
|
844
864
|
},
|
|
865
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY]: {
|
|
866
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY,
|
|
867
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
868
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
869
|
+
},
|
|
870
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST]: {
|
|
871
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST,
|
|
872
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
873
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
874
|
+
},
|
|
875
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
876
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
877
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
878
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
879
|
+
},
|
|
880
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
881
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
882
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
883
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
884
|
+
},
|
|
885
|
+
[Bundles.BaseIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
886
|
+
strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_EOA_CLOSE,
|
|
887
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
888
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
889
|
+
},
|
|
845
890
|
};
|
|
846
891
|
export const ARBITRUM_BUNDLES_INFO = {
|
|
847
892
|
[Bundles.ArbitrumIds.AAVE_V3_REPAY]: {
|
|
@@ -1029,6 +1074,21 @@ export const ARBITRUM_BUNDLES_INFO = {
|
|
|
1029
1074
|
strategyId: Strategies.Identifiers.EoaLiquidationProtection,
|
|
1030
1075
|
protocol: PROTOCOLS.MorphoBlue,
|
|
1031
1076
|
},
|
|
1077
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE]: {
|
|
1078
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_BOOST_ON_PRICE,
|
|
1079
|
+
strategyId: Strategies.Identifiers.EoaBoostOnPrice,
|
|
1080
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1081
|
+
},
|
|
1082
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE]: {
|
|
1083
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_REPAY_ON_PRICE,
|
|
1084
|
+
strategyId: Strategies.Identifiers.EoaRepayOnPrice,
|
|
1085
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1086
|
+
},
|
|
1087
|
+
[Bundles.ArbitrumIds.MORPHO_BLUE_EOA_CLOSE]: {
|
|
1088
|
+
strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_EOA_CLOSE,
|
|
1089
|
+
strategyId: Strategies.Identifiers.EoaCloseOnPrice,
|
|
1090
|
+
protocol: PROTOCOLS.MorphoBlue,
|
|
1091
|
+
},
|
|
1032
1092
|
};
|
|
1033
1093
|
export const BUNDLES_INFO = {
|
|
1034
1094
|
[ChainId.Ethereum]: MAINNET_BUNDLES_INFO,
|