@defisaver/automation-sdk 1.2.5 → 1.2.6

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.
@@ -150,6 +150,16 @@ export const MAINNET_BUNDLES_INFO = {
150
150
  strategyId: Strategies.Identifiers.CloseToCollateral,
151
151
  protocol: PROTOCOLS.AaveV3,
152
152
  },
153
+ [Bundles.MainnetIds.MORPHO_AAVE_V2_REPAY]: {
154
+ strategyOrBundleId: Bundles.MainnetIds.MORPHO_AAVE_V2_REPAY,
155
+ strategyId: Strategies.Identifiers.Repay,
156
+ protocol: PROTOCOLS.Morpho,
157
+ },
158
+ [Bundles.MainnetIds.MORPHO_AAVE_V2_BOOST]: {
159
+ strategyOrBundleId: Bundles.MainnetIds.MORPHO_AAVE_V2_BOOST,
160
+ strategyId: Strategies.Identifiers.Boost,
161
+ protocol: PROTOCOLS.Morpho,
162
+ },
153
163
  };
154
164
  export const OPTIMISM_BUNDLES_INFO = {
155
165
  [Bundles.OptimismIds.AAVE_V3_REPAY]: {
@@ -137,6 +137,35 @@ function parseAaveV3LeverageManagement(position, parseData) {
137
137
  _position.specific.mergeWithSameId = true;
138
138
  return _position;
139
139
  }
140
+ function parseMorphoAaveV2LeverageManagement(position, parseData) {
141
+ const _position = cloneDeep(position);
142
+ const { subStruct, subId } = parseData.subscriptionEventData;
143
+ const { isEnabled } = parseData.strategiesSubsData;
144
+ const triggerData = triggerService.morphoAaveV2RatioTrigger.decode(subStruct.triggerData);
145
+ const subData = subDataService.morphoLeverageManagementSubData.decode(subStruct.subData);
146
+ _position.strategyData.decoded.triggerData = triggerData;
147
+ _position.strategyData.decoded.subData = subData;
148
+ const isRepay = _position.strategy.strategyId === Strategies.Identifiers.Repay;
149
+ if (isRepay) {
150
+ _position.specific = {
151
+ minRatio: triggerData.ratio,
152
+ minOptimalRatio: subData.targetRatio,
153
+ repayEnabled: true,
154
+ subId1: Number(subId),
155
+ };
156
+ }
157
+ else {
158
+ _position.specific = {
159
+ maxRatio: triggerData.ratio,
160
+ maxOptimalRatio: subData.targetRatio,
161
+ boostEnabled: isEnabled,
162
+ subId2: Number(subId),
163
+ };
164
+ }
165
+ _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
166
+ _position.specific.mergeWithSameId = true;
167
+ return _position;
168
+ }
140
169
  function parseAaveV3CloseOnPrice(position, parseData) {
141
170
  const _position = cloneDeep(position);
142
171
  const { subStruct } = parseData.subscriptionEventData;
@@ -239,6 +268,10 @@ const parsingMethodsMapping = {
239
268
  [ProtocolIdentifiers.StrategiesAutomation.ChickenBonds]: {
240
269
  [Strategies.Identifiers.Rebond]: parseChickenBondsRebond,
241
270
  },
271
+ [ProtocolIdentifiers.StrategiesAutomation.Morpho]: {
272
+ [Strategies.Identifiers.Repay]: parseMorphoAaveV2LeverageManagement,
273
+ [Strategies.Identifiers.Boost]: parseMorphoAaveV2LeverageManagement,
274
+ },
242
275
  };
243
276
  function getParsingMethod(id, strategy) {
244
277
  return parsingMethodsMapping[id][strategy.strategyId];
@@ -34,6 +34,11 @@ export declare const aaveLeverageManagementSubData: {
34
34
  targetRatio: number;
35
35
  };
36
36
  };
37
+ export declare const morphoLeverageManagementSubData: {
38
+ decode(subData: string[]): {
39
+ targetRatio: number;
40
+ };
41
+ };
37
42
  export declare const aaveV3QuotePriceSubData: {
38
43
  encode(collAsset: EthereumAddress, collAssetId: number, debtAsset: EthereumAddress, debtAssetId: number, nullAddress?: EthereumAddress): string[];
39
44
  decode(subData: string[]): {
@@ -96,6 +96,13 @@ export const aaveLeverageManagementSubData = {
96
96
  return { targetRatio };
97
97
  },
98
98
  };
99
+ export const morphoLeverageManagementSubData = {
100
+ decode(subData) {
101
+ const ratioWei = mockedWeb3.eth.abi.decodeParameter('uint256', subData[0]);
102
+ const targetRatio = weiToRatioPercentage(ratioWei);
103
+ return { targetRatio };
104
+ },
105
+ };
99
106
  export const aaveV3QuotePriceSubData = {
100
107
  encode(collAsset, collAssetId, debtAsset, debtAssetId, nullAddress = ZERO_ADDRESS) {
101
108
  const encodedColl = mockedWeb3.eth.abi.encodeParameter('address', collAsset);
@@ -33,6 +33,14 @@ export declare const aaveV3RatioTrigger: {
33
33
  ratioState: number;
34
34
  };
35
35
  };
36
+ export declare const morphoAaveV2RatioTrigger: {
37
+ encode(owner: EthereumAddress, ratioPercentage: number, ratioState: RatioState): string[];
38
+ decode(triggerData: string[]): {
39
+ owner: string;
40
+ ratio: number;
41
+ ratioState: number;
42
+ };
43
+ };
36
44
  export declare const aaveV3QuotePriceTrigger: {
37
45
  encode(baseTokenAddress: EthereumAddress, quoteTokenAddress: EthereumAddress, price: number, ratioState: RatioState): string[];
38
46
  decode(triggerData: string[]): {
@@ -47,6 +47,20 @@ export const aaveV3RatioTrigger = {
47
47
  };
48
48
  },
49
49
  };
50
+ export const morphoAaveV2RatioTrigger = {
51
+ encode(owner, ratioPercentage, ratioState) {
52
+ const ratioWei = ratioPercentageToWei(ratioPercentage);
53
+ return [mockedWeb3.eth.abi.encodeParameters(['address', 'uint256', 'uint8'], [owner, ratioWei, ratioState])];
54
+ },
55
+ decode(triggerData) {
56
+ const decodedData = mockedWeb3.eth.abi.decodeParameters(['address', 'uint256', 'uint8'], triggerData[0]);
57
+ return {
58
+ owner: decodedData[0],
59
+ ratio: new Dec(mockedWeb3.utils.fromWei(decodedData[2])).mul(100).toNumber(),
60
+ ratioState: Number(decodedData[3]),
61
+ };
62
+ },
63
+ };
50
64
  export const aaveV3QuotePriceTrigger = {
51
65
  encode(baseTokenAddress, quoteTokenAddress, price, ratioState) {
52
66
  // Price is always in 8 decimals
@@ -25,7 +25,8 @@ export declare namespace ProtocolIdentifiers {
25
25
  Liquity = "Liquity",
26
26
  ChickenBonds = "Chicken Bonds",
27
27
  CompoundV3 = "Compound__V3",
28
- AaveV3 = "Aave__V3"
28
+ AaveV3 = "Aave__V3",
29
+ Morpho = "Morpho"
29
30
  }
30
31
  enum LegacyAutomation {
31
32
  MakerDAO = "MakerDAO",
@@ -86,7 +87,9 @@ export declare namespace Bundles {
86
87
  MAKER_REPAY = 10,
87
88
  MAKER_BOOST = 11,
88
89
  AAVE_V3_CLOSE_TO_DEBT = 12,
89
- AAVE_V3_CLOSE_TO_COLLATERAL = 13
90
+ AAVE_V3_CLOSE_TO_COLLATERAL = 13,
91
+ MORPHO_AAVE_V2_REPAY = 14,
92
+ MORPHO_AAVE_V2_BOOST = 15
90
93
  }
91
94
  enum OptimismIds {
92
95
  AAVE_V3_REPAY = 0,
@@ -31,6 +31,7 @@ export var ProtocolIdentifiers;
31
31
  StrategiesAutomation["ChickenBonds"] = "Chicken Bonds";
32
32
  StrategiesAutomation["CompoundV3"] = "Compound__V3";
33
33
  StrategiesAutomation["AaveV3"] = "Aave__V3";
34
+ StrategiesAutomation["Morpho"] = "Morpho";
34
35
  })(StrategiesAutomation = ProtocolIdentifiers.StrategiesAutomation || (ProtocolIdentifiers.StrategiesAutomation = {}));
35
36
  let LegacyAutomation;
36
37
  (function (LegacyAutomation) {
@@ -101,6 +102,8 @@ export var Bundles;
101
102
  MainnetIds[MainnetIds["MAKER_BOOST"] = 11] = "MAKER_BOOST";
102
103
  MainnetIds[MainnetIds["AAVE_V3_CLOSE_TO_DEBT"] = 12] = "AAVE_V3_CLOSE_TO_DEBT";
103
104
  MainnetIds[MainnetIds["AAVE_V3_CLOSE_TO_COLLATERAL"] = 13] = "AAVE_V3_CLOSE_TO_COLLATERAL";
105
+ MainnetIds[MainnetIds["MORPHO_AAVE_V2_REPAY"] = 14] = "MORPHO_AAVE_V2_REPAY";
106
+ MainnetIds[MainnetIds["MORPHO_AAVE_V2_BOOST"] = 15] = "MORPHO_AAVE_V2_BOOST";
104
107
  })(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
105
108
  let OptimismIds;
106
109
  (function (OptimismIds) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/index.js",
@@ -166,6 +166,16 @@ export const MAINNET_BUNDLES_INFO: MainnetBundleInfo = {
166
166
  strategyId: Strategies.Identifiers.CloseToCollateral,
167
167
  protocol: PROTOCOLS.AaveV3,
168
168
  },
169
+ [Bundles.MainnetIds.MORPHO_AAVE_V2_REPAY]: {
170
+ strategyOrBundleId: Bundles.MainnetIds.MORPHO_AAVE_V2_REPAY,
171
+ strategyId: Strategies.Identifiers.Repay,
172
+ protocol: PROTOCOLS.Morpho,
173
+ },
174
+ [Bundles.MainnetIds.MORPHO_AAVE_V2_BOOST]: {
175
+ strategyOrBundleId: Bundles.MainnetIds.MORPHO_AAVE_V2_BOOST,
176
+ strategyId: Strategies.Identifiers.Boost,
177
+ protocol: PROTOCOLS.Morpho,
178
+ },
169
179
  };
170
180
 
171
181
  export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {
@@ -191,6 +191,42 @@ function parseAaveV3LeverageManagement(position: Position.Automated, parseData:
191
191
  return _position;
192
192
  }
193
193
 
194
+ function parseMorphoAaveV2LeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
195
+ const _position = cloneDeep(position);
196
+
197
+ const { subStruct, subId } = parseData.subscriptionEventData;
198
+ const { isEnabled } = parseData.strategiesSubsData;
199
+
200
+ const triggerData = triggerService.morphoAaveV2RatioTrigger.decode(subStruct.triggerData);
201
+ const subData = subDataService.morphoLeverageManagementSubData.decode(subStruct.subData);
202
+
203
+ _position.strategyData.decoded.triggerData = triggerData;
204
+ _position.strategyData.decoded.subData = subData;
205
+
206
+ const isRepay = _position.strategy.strategyId === Strategies.Identifiers.Repay;
207
+
208
+ if (isRepay) {
209
+ _position.specific = {
210
+ minRatio: triggerData.ratio,
211
+ minOptimalRatio: subData.targetRatio,
212
+ repayEnabled: true,
213
+ subId1: Number(subId),
214
+ };
215
+ } else {
216
+ _position.specific = {
217
+ maxRatio: triggerData.ratio,
218
+ maxOptimalRatio: subData.targetRatio,
219
+ boostEnabled: isEnabled,
220
+ subId2: Number(subId),
221
+ };
222
+ }
223
+
224
+ _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
225
+ _position.specific.mergeWithSameId = true;
226
+
227
+ return _position;
228
+ }
229
+
194
230
  function parseAaveV3CloseOnPrice(position: Position.Automated, parseData: ParseData): Position.Automated {
195
231
  const _position = cloneDeep(position);
196
232
 
@@ -322,6 +358,10 @@ const parsingMethodsMapping: StrategiesToProtocolVersionMapping = {
322
358
  [ProtocolIdentifiers.StrategiesAutomation.ChickenBonds]: {
323
359
  [Strategies.Identifiers.Rebond]: parseChickenBondsRebond,
324
360
  },
361
+ [ProtocolIdentifiers.StrategiesAutomation.Morpho]: {
362
+ [Strategies.Identifiers.Repay]: parseMorphoAaveV2LeverageManagement,
363
+ [Strategies.Identifiers.Boost]: parseMorphoAaveV2LeverageManagement,
364
+ },
325
365
  };
326
366
 
327
367
  function getParsingMethod(id: ProtocolIdentifiers.StrategiesAutomation, strategy: BundleOrStrategy) {
@@ -134,6 +134,15 @@ export const aaveLeverageManagementSubData = { // TODO encode?
134
134
  },
135
135
  };
136
136
 
137
+ export const morphoLeverageManagementSubData = {
138
+ decode(subData: SubData): { targetRatio: number } {
139
+ const ratioWei = mockedWeb3.eth.abi.decodeParameter('uint256', subData[0]) as any as string;
140
+ const targetRatio = weiToRatioPercentage(ratioWei);
141
+
142
+ return { targetRatio };
143
+ },
144
+ };
145
+
137
146
  export const aaveV3QuotePriceSubData = {
138
147
  encode(
139
148
  collAsset: EthereumAddress,
@@ -59,6 +59,21 @@ export const aaveV3RatioTrigger = {
59
59
  },
60
60
  };
61
61
 
62
+ export const morphoAaveV2RatioTrigger = {
63
+ encode(owner: EthereumAddress, ratioPercentage: number, ratioState: RatioState) {
64
+ const ratioWei = ratioPercentageToWei(ratioPercentage);
65
+ return [mockedWeb3.eth.abi.encodeParameters(['address', 'uint256', 'uint8'], [owner, ratioWei, ratioState])];
66
+ },
67
+ decode(triggerData: TriggerData) {
68
+ const decodedData = mockedWeb3.eth.abi.decodeParameters(['address', 'uint256', 'uint8'], triggerData[0]) as string[];
69
+ return {
70
+ owner: decodedData[0],
71
+ ratio: new Dec(mockedWeb3.utils.fromWei(decodedData[2])).mul(100).toNumber(),
72
+ ratioState: Number(decodedData[3]),
73
+ };
74
+ },
75
+ };
76
+
62
77
  export const aaveV3QuotePriceTrigger = {
63
78
  encode(
64
79
  baseTokenAddress: EthereumAddress,
@@ -29,6 +29,7 @@ export namespace ProtocolIdentifiers {
29
29
  ChickenBonds = 'Chicken Bonds',
30
30
  CompoundV3 = 'Compound__V3',
31
31
  AaveV3 = 'Aave__V3',
32
+ Morpho = 'Morpho',
32
33
  }
33
34
 
34
35
  export enum LegacyAutomation {
@@ -94,6 +95,8 @@ export namespace Bundles {
94
95
  MAKER_BOOST = 11,
95
96
  AAVE_V3_CLOSE_TO_DEBT = 12,
96
97
  AAVE_V3_CLOSE_TO_COLLATERAL = 13,
98
+ MORPHO_AAVE_V2_REPAY = 14,
99
+ MORPHO_AAVE_V2_BOOST = 15,
97
100
  }
98
101
 
99
102
  export enum OptimismIds {
package/umd/index.js CHANGED
@@ -256,6 +256,16 @@ var MAINNET_BUNDLES_INFO = {
256
256
  strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL,
257
257
  strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.CloseToCollateral,
258
258
  protocol: PROTOCOLS.AaveV3
259
+ },
260
+ [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_AAVE_V2_REPAY]: {
261
+ strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_AAVE_V2_REPAY,
262
+ strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.Repay,
263
+ protocol: PROTOCOLS.Morpho
264
+ },
265
+ [_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_AAVE_V2_BOOST]: {
266
+ strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_AAVE_V2_BOOST,
267
+ strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.Boost,
268
+ protocol: PROTOCOLS.Morpho
259
269
  }
260
270
  };
261
271
  var OPTIMISM_BUNDLES_INFO = {
@@ -361,6 +371,7 @@ var ProtocolIdentifiers;
361
371
  StrategiesAutomation["ChickenBonds"] = "Chicken Bonds";
362
372
  StrategiesAutomation["CompoundV3"] = "Compound__V3";
363
373
  StrategiesAutomation["AaveV3"] = "Aave__V3";
374
+ StrategiesAutomation["Morpho"] = "Morpho";
364
375
  })(StrategiesAutomation || (StrategiesAutomation = {}));
365
376
  _ProtocolIdentifiers.StrategiesAutomation = StrategiesAutomation;
366
377
  var LegacyAutomation;
@@ -436,6 +447,8 @@ var Bundles;
436
447
  MainnetIds[MainnetIds["MAKER_BOOST"] = 11] = "MAKER_BOOST";
437
448
  MainnetIds[MainnetIds["AAVE_V3_CLOSE_TO_DEBT"] = 12] = "AAVE_V3_CLOSE_TO_DEBT";
438
449
  MainnetIds[MainnetIds["AAVE_V3_CLOSE_TO_COLLATERAL"] = 13] = "AAVE_V3_CLOSE_TO_COLLATERAL";
450
+ MainnetIds[MainnetIds["MORPHO_AAVE_V2_REPAY"] = 14] = "MORPHO_AAVE_V2_REPAY";
451
+ MainnetIds[MainnetIds["MORPHO_AAVE_V2_BOOST"] = 15] = "MORPHO_AAVE_V2_BOOST";
439
452
  })(MainnetIds || (MainnetIds = {}));
440
453
  _Bundles.MainnetIds = MainnetIds;
441
454
  var OptimismIds;
@@ -1538,6 +1551,39 @@ function parseAaveV3LeverageManagement(position, parseData) {
1538
1551
  _position.specific.mergeWithSameId = true;
1539
1552
  return _position;
1540
1553
  }
1554
+ function parseMorphoAaveV2LeverageManagement(position, parseData) {
1555
+ var _position = (0,lodash__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(position);
1556
+ var {
1557
+ subStruct,
1558
+ subId
1559
+ } = parseData.subscriptionEventData;
1560
+ var {
1561
+ isEnabled
1562
+ } = parseData.strategiesSubsData;
1563
+ var triggerData = _triggerService__WEBPACK_IMPORTED_MODULE_5__.morphoAaveV2RatioTrigger.decode(subStruct.triggerData);
1564
+ var subData = _subDataService__WEBPACK_IMPORTED_MODULE_4__.morphoLeverageManagementSubData.decode(subStruct.subData);
1565
+ _position.strategyData.decoded.triggerData = triggerData;
1566
+ _position.strategyData.decoded.subData = subData;
1567
+ var isRepay = _position.strategy.strategyId === _types_enums__WEBPACK_IMPORTED_MODULE_2__.Strategies.Identifiers.Repay;
1568
+ if (isRepay) {
1569
+ _position.specific = {
1570
+ minRatio: triggerData.ratio,
1571
+ minOptimalRatio: subData.targetRatio,
1572
+ repayEnabled: true,
1573
+ subId1: Number(subId)
1574
+ };
1575
+ } else {
1576
+ _position.specific = {
1577
+ maxRatio: triggerData.ratio,
1578
+ maxOptimalRatio: subData.targetRatio,
1579
+ boostEnabled: isEnabled,
1580
+ subId2: Number(subId)
1581
+ };
1582
+ }
1583
+ _position.strategy.strategyId = _types_enums__WEBPACK_IMPORTED_MODULE_2__.Strategies.IdOverrides.LeverageManagement;
1584
+ _position.specific.mergeWithSameId = true;
1585
+ return _position;
1586
+ }
1541
1587
  function parseAaveV3CloseOnPrice(position, parseData) {
1542
1588
  var _position = (0,lodash__WEBPACK_IMPORTED_MODULE_0__.cloneDeep)(position);
1543
1589
  var {
@@ -1652,6 +1698,10 @@ var parsingMethodsMapping = {
1652
1698
  },
1653
1699
  [_types_enums__WEBPACK_IMPORTED_MODULE_2__.ProtocolIdentifiers.StrategiesAutomation.ChickenBonds]: {
1654
1700
  [_types_enums__WEBPACK_IMPORTED_MODULE_2__.Strategies.Identifiers.Rebond]: parseChickenBondsRebond
1701
+ },
1702
+ [_types_enums__WEBPACK_IMPORTED_MODULE_2__.ProtocolIdentifiers.StrategiesAutomation.Morpho]: {
1703
+ [_types_enums__WEBPACK_IMPORTED_MODULE_2__.Strategies.Identifiers.Repay]: parseMorphoAaveV2LeverageManagement,
1704
+ [_types_enums__WEBPACK_IMPORTED_MODULE_2__.Strategies.Identifiers.Boost]: parseMorphoAaveV2LeverageManagement
1655
1705
  }
1656
1706
  };
1657
1707
  function getParsingMethod(id, strategy) {
@@ -18925,7 +18975,8 @@ __webpack_require__.r(__webpack_exports__);
18925
18975
  /* harmony export */ "liquityPaybackUsingChickenBondSubData": () => (/* binding */ liquityPaybackUsingChickenBondSubData),
18926
18976
  /* harmony export */ "makerCloseSubData": () => (/* binding */ makerCloseSubData),
18927
18977
  /* harmony export */ "makerLeverageManagementSubData": () => (/* binding */ makerLeverageManagementSubData),
18928
- /* harmony export */ "makerRepayFromSavingsSubData": () => (/* binding */ makerRepayFromSavingsSubData)
18978
+ /* harmony export */ "makerRepayFromSavingsSubData": () => (/* binding */ makerRepayFromSavingsSubData),
18979
+ /* harmony export */ "morphoLeverageManagementSubData": () => (/* binding */ morphoLeverageManagementSubData)
18929
18980
  /* harmony export */ });
18930
18981
  /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
18931
18982
  /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_0__);
@@ -19051,6 +19102,15 @@ var aaveLeverageManagementSubData = {
19051
19102
  };
19052
19103
  }
19053
19104
  };
19105
+ var morphoLeverageManagementSubData = {
19106
+ decode(subData) {
19107
+ var ratioWei = mockedWeb3.eth.abi.decodeParameter('uint256', subData[0]);
19108
+ var targetRatio = (0,_utils__WEBPACK_IMPORTED_MODULE_5__.weiToRatioPercentage)(ratioWei);
19109
+ return {
19110
+ targetRatio
19111
+ };
19112
+ }
19113
+ };
19054
19114
  var aaveV3QuotePriceSubData = {
19055
19115
  encode(collAsset, collAssetId, debtAsset, debtAssetId) {
19056
19116
  var nullAddress = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : _constants__WEBPACK_IMPORTED_MODULE_4__.ZERO_ADDRESS;
@@ -28637,6 +28697,7 @@ __webpack_require__.r(__webpack_exports__);
28637
28697
  /* harmony export */ "liquityDebtInFrontTrigger": () => (/* binding */ liquityDebtInFrontTrigger),
28638
28698
  /* harmony export */ "liquityRatioTrigger": () => (/* binding */ liquityRatioTrigger),
28639
28699
  /* harmony export */ "makerRatioTrigger": () => (/* binding */ makerRatioTrigger),
28700
+ /* harmony export */ "morphoAaveV2RatioTrigger": () => (/* binding */ morphoAaveV2RatioTrigger),
28640
28701
  /* harmony export */ "trailingStopTrigger": () => (/* binding */ trailingStopTrigger)
28641
28702
  /* harmony export */ });
28642
28703
  /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
@@ -28705,6 +28766,20 @@ var aaveV3RatioTrigger = {
28705
28766
  };
28706
28767
  }
28707
28768
  };
28769
+ var morphoAaveV2RatioTrigger = {
28770
+ encode(owner, ratioPercentage, ratioState) {
28771
+ var ratioWei = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.ratioPercentageToWei)(ratioPercentage);
28772
+ return [mockedWeb3.eth.abi.encodeParameters(['address', 'uint256', 'uint8'], [owner, ratioWei, ratioState])];
28773
+ },
28774
+ decode(triggerData) {
28775
+ var decodedData = mockedWeb3.eth.abi.decodeParameters(['address', 'uint256', 'uint8'], triggerData[0]);
28776
+ return {
28777
+ owner: decodedData[0],
28778
+ ratio: new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(mockedWeb3.utils.fromWei(decodedData[2])).mul(100).toNumber(),
28779
+ ratioState: Number(decodedData[3])
28780
+ };
28781
+ }
28782
+ };
28708
28783
  var aaveV3QuotePriceTrigger = {
28709
28784
  encode(baseTokenAddress, quoteTokenAddress, price, ratioState) {
28710
28785
  // Price is always in 8 decimals