@defisaver/automation-sdk 1.2.0 → 1.2.2

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.
@@ -166,6 +166,7 @@ function parseCompoundV3LeverageManagement(position, parseData) {
166
166
  const subData = subDataService.compoundV3LeverageManagementSubData.decode(subStruct.subData);
167
167
  _position.strategyData.decoded.triggerData = triggerData;
168
168
  _position.strategyData.decoded.subData = subData;
169
+ _position.owner = triggerData.owner;
169
170
  const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
170
171
  if (isRepay) {
171
172
  _position.specific = {
@@ -25,7 +25,9 @@ export declare const makerRatioTrigger: {
25
25
  };
26
26
  };
27
27
  export declare const aaveV3RatioTrigger: {
28
+ encode(owner: EthereumAddress, market: EthereumAddress, ratioPercentage: number, ratioState: RatioState): string[];
28
29
  decode(triggerData: string[]): {
30
+ owner: string;
29
31
  market: string;
30
32
  ratio: number;
31
33
  ratioState: number;
@@ -33,9 +33,14 @@ export const makerRatioTrigger = {
33
33
  },
34
34
  };
35
35
  export const aaveV3RatioTrigger = {
36
+ encode(owner, market, ratioPercentage, ratioState) {
37
+ const ratioWei = ratioPercentageToWei(ratioPercentage);
38
+ return [mockedWeb3.eth.abi.encodeParameters(['address', 'address', 'uint256', 'uint8'], [owner, market, ratioWei, ratioState])];
39
+ },
36
40
  decode(triggerData) {
37
41
  const decodedData = mockedWeb3.eth.abi.decodeParameters(['address', 'address', 'uint256', 'uint8'], triggerData[0]);
38
42
  return {
43
+ owner: decodedData[0],
39
44
  market: decodedData[1],
40
45
  ratio: new Dec(mockedWeb3.utils.fromWei(decodedData[2])).mul(100).toNumber(),
41
46
  ratioState: Number(decodedData[3]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/index.js",
@@ -236,7 +236,7 @@ function parseCompoundV3LeverageManagement(position: Position.Automated, parseDa
236
236
 
237
237
  _position.strategyData.decoded.triggerData = triggerData;
238
238
  _position.strategyData.decoded.subData = subData;
239
-
239
+ _position.owner = triggerData.owner;
240
240
  const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId as Strategies.Identifiers);
241
241
 
242
242
  if (isRepay) {