@defisaver/automation-sdk 2.1.3 → 2.1.4

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.
@@ -255,6 +255,40 @@ export const compoundV3LeverageManagementSubData = {
255
255
  },
256
256
  };
257
257
 
258
+ export const compoundV3L2LeverageManagementSubData = {
259
+ encode(
260
+ market: EthereumAddress,
261
+ baseToken: EthereumAddress,
262
+ triggerRepayRatio: number,
263
+ triggerBoostRatio: number,
264
+ targetBoostRatio: number,
265
+ targetRepayRatio: number,
266
+ boostEnabled: boolean,
267
+ ): string {
268
+ let subInput = '0x';
269
+
270
+ subInput = subInput.concat(market.slice(2).padStart(32, '0'));
271
+ subInput = subInput.concat(baseToken.slice(2).padStart(32, '0'));
272
+ subInput = subInput.concat(new Dec(triggerRepayRatio).mul(1e16).toHex().slice(2)
273
+ .padStart(32, '0'));
274
+ subInput = subInput.concat(new Dec(triggerBoostRatio).mul(1e16).toHex().slice(2)
275
+ .padStart(32, '0'));
276
+ subInput = subInput.concat(new Dec(targetBoostRatio).mul(1e16).toHex().slice(2)
277
+ .padStart(32, '0'));
278
+ subInput = subInput.concat(new Dec(targetRepayRatio).mul(1e16).toHex().slice(2)
279
+ .padStart(32, '0'));
280
+ subInput = subInput.concat(boostEnabled ? '01' : '00');
281
+
282
+ return subInput;
283
+ },
284
+ decode(subData: SubData): { targetRatio: number } {
285
+ const ratioWei = AbiCoder.decodeParameter('uint256', subData[3]) as any as string;
286
+ const targetRatio = weiToRatioPercentage(ratioWei);
287
+
288
+ return { targetRatio };
289
+ },
290
+ };
291
+
258
292
  export const morphoAaveV2LeverageManagementSubData = {
259
293
  encode(
260
294
  triggerRepayRatio: number,
@@ -155,6 +155,8 @@ export namespace Bundles {
155
155
  AAVE_V3_BOOST = 1,
156
156
  AAVE_V3_CLOSE_TO_DEBT = 2,
157
157
  AAVE_V3_CLOSE_TO_COLLATERAL = 3,
158
+ COMP_V3_SW_REPAY_BUNDLE = 4,
159
+ COMP_V3_SW_BOOST_BUNDLE = 5,
158
160
  }
159
161
  }
160
162