@defisaver/automation-sdk 3.0.5 → 3.0.7

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.
@@ -333,8 +333,7 @@ function parseCompoundV3LeverageManagement(position, parseData) {
333
333
  const subData = subDataDecoder.decode(subStruct.subData);
334
334
  _position.strategyData.decoded.triggerData = triggerData;
335
335
  _position.strategyData.decoded.subData = subData;
336
- _position.owner = triggerData.owner.toLowerCase();
337
- _position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, triggerData.market);
336
+ _position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.market);
338
337
  const isRepay = [enums_1.Strategies.Identifiers.Repay, enums_1.Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
339
338
  if (isRepay) {
340
339
  _position.specific = {
@@ -564,7 +563,7 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
564
563
  const subData = subDataService.morphoBlueLeverageManagementSubData.decode(subStruct.subData);
565
564
  _position.strategyData.decoded.triggerData = triggerData;
566
565
  _position.strategyData.decoded.subData = subData;
567
- _position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, triggerData.marketId);
566
+ _position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.marketId);
568
567
  const isRepay = [enums_1.Strategies.Identifiers.Repay, enums_1.Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
569
568
  if (isRepay) {
570
569
  _position.specific = {
@@ -83,5 +83,5 @@ export declare const crvUSDEncode: {
83
83
  payback(proxyAddress: EthereumAddress, addressToPullTokensFrom: EthereumAddress, positionOwner: EthereumAddress, paybackAmount: string, crvUSDAddr: EthereumAddress, controllerAddr: EthereumAddress, minHealthRatio: number): (boolean | string[] | Strategies.MainnetIds)[];
84
84
  };
85
85
  export declare const morphoBlueEncode: {
86
- leverageManagement(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean): (boolean | Bundles.MainnetIds | (string | boolean)[])[];
86
+ leverageManagement(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean): (boolean | string[] | Bundles.MainnetIds)[];
87
87
  };
@@ -804,6 +804,7 @@ describe('Feature: strategySubService.ts', () => {
804
804
  '0x0000000000000000000000000000000000000000000000000000000000000001',
805
805
  '0x000000000000000000000000000000000000000000000000136dcc951d8c0000',
806
806
  '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
807
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
807
808
  ],
808
809
  ],
809
810
  [
@@ -836,6 +837,7 @@ describe('Feature: strategySubService.ts', () => {
836
837
  '0x0000000000000000000000000000000000000000000000000000000000000000',
837
838
  '0x00000000000000000000000000000000000000000000000016345785d8a00000',
838
839
  '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
840
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
839
841
  ],
840
842
  ],
841
843
  [
@@ -168,7 +168,7 @@ export declare const crvUSDPaybackSubData: {
168
168
  };
169
169
  };
170
170
  export declare const morphoBlueLeverageManagementSubData: {
171
- encode: (loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, user: EthereumAddress, isEOA: boolean) => (string | boolean)[];
171
+ encode: (loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, user: EthereumAddress, isEOA: boolean) => string[];
172
172
  decode: (subData: string[]) => {
173
173
  loanToken: string;
174
174
  collToken: string;
@@ -418,7 +418,8 @@ exports.morphoBlueLeverageManagementSubData = {
418
418
  const ratioStateEncoded = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
419
419
  const targetRatioEncoded = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
420
420
  const userEncoded = web3_eth_abi_1.default.encodeParameter('address', user);
421
- return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOA];
421
+ const isEOAEncoded = web3_eth_abi_1.default.encodeParameter('bool', isEOA);
422
+ return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOAEncoded];
422
423
  },
423
424
  decode: (subData) => {
424
425
  const loanToken = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
@@ -1145,6 +1145,7 @@ describe('Feature: subDataService.ts', () => {
1145
1145
  '0x0000000000000000000000000000000000000000000000000000000000000001',
1146
1146
  '0x00000000000000000000000000000000000000000000000010a741a462780000',
1147
1147
  '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
1148
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1148
1149
  ],
1149
1150
  [web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'), web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), web3Utils.toChecksumAddress('0x2a01eb9496094da03c4e364def50f5ad1280ad72'), web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'), '945000000000000000', enums_1.RatioState.UNDER, 120, web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'), false]
1150
1151
  ],
@@ -1158,6 +1159,7 @@ describe('Feature: subDataService.ts', () => {
1158
1159
  '0x0000000000000000000000000000000000000000000000000000000000000000',
1159
1160
  '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
1160
1161
  '0x0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c',
1162
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1161
1163
  ],
1162
1164
  [web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'), web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), web3Utils.toChecksumAddress('0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2'), web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'), '860000000000000000', enums_1.RatioState.OVER, 200, web3Utils.toChecksumAddress('0x0043d218133AFaB8F2B829B106633E434Ad94E2c'), false]
1163
1165
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "3.0.5",
3
+ "version": "3.0.7",
4
4
  "description": "",
5
5
  "main": "./umd/index.js",
6
6
  "module": "./esm/index.js",
@@ -431,9 +431,8 @@ function parseCompoundV3LeverageManagement(position: Position.Automated, parseDa
431
431
 
432
432
  _position.strategyData.decoded.triggerData = triggerData;
433
433
  _position.strategyData.decoded.subData = subData;
434
- _position.owner = triggerData.owner.toLowerCase();
435
434
 
436
- _position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.market);
435
+ _position.positionId = getPositionId(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.market);
437
436
 
438
437
  const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId as Strategies.Identifiers);
439
438
 
@@ -747,7 +746,7 @@ function parseMorphoBlueLeverageManagement(position: Position.Automated, parseDa
747
746
  _position.strategyData.decoded.triggerData = triggerData;
748
747
  _position.strategyData.decoded.subData = subData;
749
748
 
750
- _position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.marketId);
749
+ _position.positionId = getPositionId(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.marketId);
751
750
 
752
751
  const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId as Strategies.Identifiers);
753
752
 
@@ -972,6 +972,7 @@ describe('Feature: strategySubService.ts', () => {
972
972
  '0x0000000000000000000000000000000000000000000000000000000000000001',
973
973
  '0x000000000000000000000000000000000000000000000000136dcc951d8c0000',
974
974
  '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
975
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
975
976
  ],
976
977
  ],
977
978
  [
@@ -1004,6 +1005,7 @@ describe('Feature: strategySubService.ts', () => {
1004
1005
  '0x0000000000000000000000000000000000000000000000000000000000000000',
1005
1006
  '0x00000000000000000000000000000000000000000000000016345785d8a00000',
1006
1007
  '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
1008
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1007
1009
  ],
1008
1010
  ],
1009
1011
  [
@@ -1241,6 +1241,7 @@ describe('Feature: subDataService.ts', () => {
1241
1241
  '0x0000000000000000000000000000000000000000000000000000000000000001',
1242
1242
  '0x00000000000000000000000000000000000000000000000010a741a462780000',
1243
1243
  '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
1244
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1244
1245
  ],
1245
1246
  [web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'), web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), web3Utils.toChecksumAddress('0x2a01eb9496094da03c4e364def50f5ad1280ad72'), web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'), '945000000000000000', RatioState.UNDER, 120, web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'), false]
1246
1247
  ],
@@ -1254,6 +1255,7 @@ describe('Feature: subDataService.ts', () => {
1254
1255
  '0x0000000000000000000000000000000000000000000000000000000000000000',
1255
1256
  '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
1256
1257
  '0x0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c',
1258
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1257
1259
  ],
1258
1260
  [web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'), web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), web3Utils.toChecksumAddress('0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2'), web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'), '860000000000000000', RatioState.OVER, 200, web3Utils.toChecksumAddress('0x0043d218133AFaB8F2B829B106633E434Ad94E2c'), false]
1259
1261
  ],
@@ -569,7 +569,8 @@ export const morphoBlueLeverageManagementSubData = {
569
569
  const ratioStateEncoded = AbiCoder.encodeParameter('uint8', ratioState);
570
570
  const targetRatioEncoded = AbiCoder.encodeParameter('uint256', ratioPercentageToWei(targetRatio));
571
571
  const userEncoded = AbiCoder.encodeParameter('address', user);
572
- return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOA];
572
+ const isEOAEncoded = AbiCoder.encodeParameter('bool', isEOA);
573
+ return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOAEncoded];
573
574
  },
574
575
  decode: (subData: SubData) => {
575
576
  const loanToken = AbiCoder.decodeParameter('address', subData[0]) as unknown as EthereumAddress;
package/umd/index.js CHANGED
@@ -2055,8 +2055,7 @@ function parseCompoundV3LeverageManagement(position, parseData) {
2055
2055
  var subData = subDataDecoder.decode(subStruct.subData);
2056
2056
  _position.strategyData.decoded.triggerData = triggerData;
2057
2057
  _position.strategyData.decoded.subData = subData;
2058
- _position.owner = triggerData.owner.toLowerCase();
2059
- _position.positionId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, triggerData.market);
2058
+ _position.positionId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getPositionId)(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.market);
2060
2059
  var isRepay = [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Repay, _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
2061
2060
  if (isRepay) {
2062
2061
  _position.specific = {
@@ -2323,7 +2322,7 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
2323
2322
  var subData = _subDataService__WEBPACK_IMPORTED_MODULE_5__.morphoBlueLeverageManagementSubData.decode(subStruct.subData);
2324
2323
  _position.strategyData.decoded.triggerData = triggerData;
2325
2324
  _position.strategyData.decoded.subData = subData;
2326
- _position.positionId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, triggerData.marketId);
2325
+ _position.positionId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getPositionId)(_position.chainId, _position.protocol.id, triggerData.owner.toLowerCase(), triggerData.marketId);
2327
2326
  var isRepay = [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Repay, _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
2328
2327
  if (isRepay) {
2329
2328
  _position.specific = {
@@ -20157,7 +20156,8 @@ var morphoBlueLeverageManagementSubData = {
20157
20156
  var ratioStateEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('uint8', ratioState);
20158
20157
  var targetRatioEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('uint256', (0,_utils__WEBPACK_IMPORTED_MODULE_7__.ratioPercentageToWei)(targetRatio));
20159
20158
  var userEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', user);
20160
- return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOA];
20159
+ var isEOAEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('bool', isEOA);
20160
+ return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOAEncoded];
20161
20161
  },
20162
20162
  decode: subData => {
20163
20163
  var loanToken = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().decodeParameter('address', subData[0]);