@defisaver/automation-sdk 3.3.14 → 3.3.15-dev-13011-morpho-repay-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.
@@ -1337,48 +1337,6 @@ describe('Feature: subDataService.ts', () => {
1337
1337
  });
1338
1338
  });
1339
1339
  });
1340
- describe('When testing subDataService.compoundV3L2LeverageManagementSubData', () => {
1341
- describe('encode()', () => {
1342
- const examples = [
1343
- [
1344
- '0x0313D212133AFab8F2b829B1066c7e43caD94e2c0213D212133AfaB8F2b829B1066C7E43cAD94E2c000000000000000016345785d8a0000000000000000000001e87f85809dc0000000000000000000018fae27693b4000000000000000000001a5e27eef13e00000100',
1345
- [web3Utils.toChecksumAddress('0x0313d212133AFaB8F2B829B1066c7E43cAd94E2c'), web3Utils.toChecksumAddress('0x0213d212133AFaB8F2B829B1066c7E43cAd94E2c'), 160, 220, 180, 190, true, false]
1346
- ],
1347
- [
1348
- '0x0313D212133AFab8F2b829B1066c7e43caD94e2c0413d212133afAb8F2B829b1066C7e43cAd94e2c000000000000000016345785d8a0000000000000000000001e87f85809dc0000000000000000000018fae27693b4000000000000000000000f43fc2c04ee00000000',
1349
- [web3Utils.toChecksumAddress('0x0313d212133AFaB8F2B829B1066c7E43cAd94E2c'), web3Utils.toChecksumAddress('0x0413d212133AFaB8F2B829B1066c7E43cAd94E2c'), 160, 220, 180, 110, false, false]
1350
- ],
1351
- ];
1352
- examples.forEach(([expected, actual]) => {
1353
- it(`Given ${actual} should return expected value: ${expected}`, () => {
1354
- (0, chai_1.expect)(subDataService.compoundV3L2LeverageManagementSubData.encode(...actual)).to.eql(expected);
1355
- });
1356
- });
1357
- });
1358
- describe('decode()', () => {
1359
- const examples = [
1360
- [
1361
- { targetRatio: 200 },
1362
- [
1363
- '0x0000000000000000000000000313d212133AFaB8F2B829B1066c7E43cAd94E2c', '0x0000000000000000000000000213d212133AFaB8F2B829B1066c7E43cAd94E2c',
1364
- '0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
1365
- ],
1366
- ],
1367
- [
1368
- { targetRatio: 123 },
1369
- [
1370
- '0x0000000000000000000000000313d212133AFaB8F2B829B1066c7E43cAd94E2c', '0x0000000000000000000000000413d212133AFaB8F2B829B1066c7E43cAd94E2c',
1371
- '0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001111d67bb1bb0000',
1372
- ],
1373
- ],
1374
- ];
1375
- examples.forEach(([expected, actual]) => {
1376
- it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1377
- (0, chai_1.expect)(subDataService.compoundV3L2LeverageManagementSubData.decode(actual)).to.eql(expected);
1378
- });
1379
- });
1380
- });
1381
- });
1382
1340
  describe('When testing subDataService.morphoBlueLeverageManagementSubData', () => {
1383
1341
  describe('encode()', () => {
1384
1342
  const examples = [
@@ -1521,6 +1479,106 @@ describe('Feature: subDataService.ts', () => {
1521
1479
  });
1522
1480
  });
1523
1481
  });
1482
+ describe('When testing subDataService.morphoBlueLeverageManagementOnPriceSubData', () => {
1483
+ describe('encode()', () => {
1484
+ const examples = [
1485
+ [
1486
+ [
1487
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1488
+ '0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
1489
+ '0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
1490
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1491
+ '0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
1492
+ '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
1493
+ '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
1494
+ ],
1495
+ [
1496
+ web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
1497
+ web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
1498
+ web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
1499
+ web3Utils.toChecksumAddress('0x0000000000000000000000000000000000000000'),
1500
+ '945000000000000000',
1501
+ 200,
1502
+ web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'),
1503
+ ],
1504
+ ],
1505
+ [
1506
+ [
1507
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1508
+ '0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
1509
+ '0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
1510
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1511
+ '0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
1512
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
1513
+ '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
1514
+ ],
1515
+ [
1516
+ web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
1517
+ web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
1518
+ web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
1519
+ web3Utils.toChecksumAddress('0x0000000000000000000000000000000000000000'),
1520
+ '945000000000000000',
1521
+ 160,
1522
+ web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'),
1523
+ ],
1524
+ ],
1525
+ ];
1526
+ examples.forEach(([expected, actual]) => {
1527
+ it(`Given ${actual} should return expected value: ${expected}`, () => {
1528
+ (0, chai_1.expect)(subDataService.morphoBlueLeverageManagementOnPriceSubData.encode(...actual)).to.eql(expected);
1529
+ });
1530
+ });
1531
+ });
1532
+ describe('decode()', () => {
1533
+ const examples = [
1534
+ [
1535
+ {
1536
+ loanToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
1537
+ collToken: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
1538
+ oracle: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
1539
+ irm: '0x0000000000000000000000000000000000000000',
1540
+ lltv: '945000000000000000',
1541
+ targetRatio: 200,
1542
+ user: '0x1031d218133AFaB8C2B819B1366c7e434Ad91e9c',
1543
+ },
1544
+ [
1545
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1546
+ '0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
1547
+ '0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
1548
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1549
+ '0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
1550
+ '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
1551
+ '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
1552
+ ],
1553
+ ],
1554
+ [
1555
+ {
1556
+ loanToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
1557
+ collToken: '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
1558
+ oracle: '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
1559
+ irm: '0x0000000000000000000000000000000000000000',
1560
+ lltv: '945000000000000000',
1561
+ targetRatio: 160,
1562
+ user: '0x1031d218133AFaB8C2B819B1366c7e434Ad91e9c',
1563
+ },
1564
+ [
1565
+ '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
1566
+ '0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
1567
+ '0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
1568
+ '0x0000000000000000000000000000000000000000000000000000000000000000',
1569
+ '0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
1570
+ '0x00000000000000000000000000000000000000000000000016345785d8a00000',
1571
+ '0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
1572
+ ],
1573
+ ],
1574
+ ];
1575
+ examples.forEach(([expected, actual]) => {
1576
+ it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1577
+ (0, chai_1.expect)(subDataService.morphoBlueLeverageManagementOnPriceSubData.decode(actual)).to.eql(expected);
1578
+ });
1579
+ });
1580
+ });
1581
+ });
1524
1582
  describe('When testing subDataService.aaveV3LeverageManagementOnPriceSubData', () => {
1525
1583
  describe('encode()', () => {
1526
1584
  const examples = [
@@ -1184,6 +1184,66 @@ describe('Feature: triggerService.ts', () => {
1184
1184
  });
1185
1185
  });
1186
1186
  });
1187
+ describe('When testing triggerService.morphoBluePriceTrigger', () => {
1188
+ describe('encode()', () => {
1189
+ const examples = [
1190
+ [
1191
+ ['0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000003a352944000000000000000000000000000000000000000000000000000000000000000001'],
1192
+ [
1193
+ web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
1194
+ web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
1195
+ web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
1196
+ 2500,
1197
+ enums_1.RatioState.UNDER,
1198
+ ],
1199
+ ],
1200
+ [
1201
+ ['0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000005d21dba0000000000000000000000000000000000000000000000000000000000000000000'],
1202
+ [
1203
+ web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
1204
+ web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
1205
+ web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
1206
+ 4000,
1207
+ enums_1.RatioState.OVER,
1208
+ ],
1209
+ ],
1210
+ ];
1211
+ examples.forEach(([expected, actual]) => {
1212
+ it(`Given ${actual} should return expected value: ${expected}`, () => {
1213
+ (0, chai_1.expect)(triggerService_1.morphoBluePriceTrigger.encode(...actual)).to.eql(expected);
1214
+ });
1215
+ });
1216
+ });
1217
+ describe('decode()', () => {
1218
+ const examples = [
1219
+ [
1220
+ {
1221
+ oracle: web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
1222
+ collateralToken: web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
1223
+ loanToken: web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
1224
+ price: '2500',
1225
+ priceState: enums_1.RatioState.UNDER,
1226
+ },
1227
+ ['0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000003a352944000000000000000000000000000000000000000000000000000000000000000001'],
1228
+ ],
1229
+ [
1230
+ {
1231
+ oracle: web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
1232
+ collateralToken: web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
1233
+ loanToken: web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
1234
+ price: '4000',
1235
+ priceState: enums_1.RatioState.OVER,
1236
+ },
1237
+ ['0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000005d21dba0000000000000000000000000000000000000000000000000000000000000000000'],
1238
+ ],
1239
+ ];
1240
+ examples.forEach(([expected, actual]) => {
1241
+ it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1242
+ (0, chai_1.expect)(triggerService_1.morphoBluePriceTrigger.decode(actual)).to.eql(expected);
1243
+ });
1244
+ });
1245
+ });
1246
+ });
1187
1247
  describe('When testing triggerService.aaveV4RatioTrigger', () => {
1188
1248
  describe('encode()', () => {
1189
1249
  const examples = [
@@ -224,7 +224,8 @@ export declare namespace Bundles {
224
224
  AAVE_V4_EOA_BOOST = 67,
225
225
  AAVE_V4_EOA_REPAY_ON_PRICE = 68,
226
226
  AAVE_V4_EOA_BOOST_ON_PRICE = 69,
227
- AAVE_V4_EOA_CLOSE = 70
227
+ AAVE_V4_EOA_CLOSE = 70,
228
+ MORPHO_BLUE_REPAY_ON_PRICE = 84
228
229
  }
229
230
  enum OptimismIds {
230
231
  AAVE_V3_REPAY = 0,
@@ -266,7 +267,8 @@ export declare namespace Bundles {
266
267
  AAVE_V3_EOA_REPAY_ON_PRICE = 25,
267
268
  AAVE_V3_EOA_BOOST_ON_PRICE = 26,
268
269
  AAVE_V3_EOA_CLOSE = 27,
269
- MORPHO_BLUE_CLOSE = 28
270
+ MORPHO_BLUE_CLOSE = 28,
271
+ MORPHO_BLUE_REPAY_ON_PRICE = 36
270
272
  }
271
273
  enum ArbitrumIds {
272
274
  AAVE_V3_REPAY = 0,
@@ -297,6 +299,7 @@ export declare namespace Bundles {
297
299
  MORPHO_BLUE_BOOST_ON_PRICE = 25,
298
300
  MORPHO_BLUE_EOA_REPAY = 26,
299
301
  MORPHO_BLUE_EOA_BOOST = 27,
300
- MORPHO_BLUE_CLOSE = 28
302
+ MORPHO_BLUE_CLOSE = 28,
303
+ MORPHO_BLUE_REPAY_ON_PRICE = 36
301
304
  }
302
305
  }
@@ -248,6 +248,7 @@ var Bundles;
248
248
  MainnetIds[MainnetIds["AAVE_V4_EOA_REPAY_ON_PRICE"] = 68] = "AAVE_V4_EOA_REPAY_ON_PRICE";
249
249
  MainnetIds[MainnetIds["AAVE_V4_EOA_BOOST_ON_PRICE"] = 69] = "AAVE_V4_EOA_BOOST_ON_PRICE";
250
250
  MainnetIds[MainnetIds["AAVE_V4_EOA_CLOSE"] = 70] = "AAVE_V4_EOA_CLOSE";
251
+ MainnetIds[MainnetIds["MORPHO_BLUE_REPAY_ON_PRICE"] = 84] = "MORPHO_BLUE_REPAY_ON_PRICE";
251
252
  })(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
252
253
  let OptimismIds;
253
254
  (function (OptimismIds) {
@@ -292,6 +293,7 @@ var Bundles;
292
293
  BaseIds[BaseIds["AAVE_V3_EOA_BOOST_ON_PRICE"] = 26] = "AAVE_V3_EOA_BOOST_ON_PRICE";
293
294
  BaseIds[BaseIds["AAVE_V3_EOA_CLOSE"] = 27] = "AAVE_V3_EOA_CLOSE";
294
295
  BaseIds[BaseIds["MORPHO_BLUE_CLOSE"] = 28] = "MORPHO_BLUE_CLOSE";
296
+ BaseIds[BaseIds["MORPHO_BLUE_REPAY_ON_PRICE"] = 36] = "MORPHO_BLUE_REPAY_ON_PRICE";
295
297
  })(BaseIds = Bundles.BaseIds || (Bundles.BaseIds = {}));
296
298
  let ArbitrumIds;
297
299
  (function (ArbitrumIds) {
@@ -324,5 +326,6 @@ var Bundles;
324
326
  ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_REPAY"] = 26] = "MORPHO_BLUE_EOA_REPAY";
325
327
  ArbitrumIds[ArbitrumIds["MORPHO_BLUE_EOA_BOOST"] = 27] = "MORPHO_BLUE_EOA_BOOST";
326
328
  ArbitrumIds[ArbitrumIds["MORPHO_BLUE_CLOSE"] = 28] = "MORPHO_BLUE_CLOSE";
329
+ ArbitrumIds[ArbitrumIds["MORPHO_BLUE_REPAY_ON_PRICE"] = 36] = "MORPHO_BLUE_REPAY_ON_PRICE";
327
330
  })(ArbitrumIds = Bundles.ArbitrumIds || (Bundles.ArbitrumIds = {}));
328
331
  })(Bundles = exports.Bundles || (exports.Bundles = {}));
@@ -543,6 +543,11 @@ export const MAINNET_BUNDLES_INFO = {
543
543
  strategyId: Strategies.Identifiers.EoaCloseOnPrice,
544
544
  protocol: PROTOCOLS.AaveV4,
545
545
  },
546
+ [Bundles.MainnetIds.MORPHO_BLUE_REPAY_ON_PRICE]: {
547
+ strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_REPAY_ON_PRICE,
548
+ strategyId: Strategies.Identifiers.RepayOnPrice,
549
+ protocol: PROTOCOLS.MorphoBlue,
550
+ },
546
551
  };
547
552
  export const OPTIMISM_BUNDLES_INFO = {
548
553
  [Bundles.OptimismIds.AAVE_V3_REPAY]: {
@@ -737,6 +742,11 @@ export const BASE_BUNDLES_INFO = {
737
742
  strategyId: Strategies.Identifiers.CloseOnPrice,
738
743
  protocol: PROTOCOLS.MorphoBlue,
739
744
  },
745
+ [Bundles.BaseIds.MORPHO_BLUE_REPAY_ON_PRICE]: {
746
+ strategyOrBundleId: Bundles.BaseIds.MORPHO_BLUE_REPAY_ON_PRICE,
747
+ strategyId: Strategies.Identifiers.RepayOnPrice,
748
+ protocol: PROTOCOLS.MorphoBlue,
749
+ },
740
750
  };
741
751
  export const ARBITRUM_BUNDLES_INFO = {
742
752
  [Bundles.ArbitrumIds.AAVE_V3_REPAY]: {
@@ -884,6 +894,11 @@ export const ARBITRUM_BUNDLES_INFO = {
884
894
  strategyId: Strategies.Identifiers.CloseOnPrice,
885
895
  protocol: PROTOCOLS.MorphoBlue,
886
896
  },
897
+ [Bundles.ArbitrumIds.MORPHO_BLUE_REPAY_ON_PRICE]: {
898
+ strategyOrBundleId: Bundles.ArbitrumIds.MORPHO_BLUE_REPAY_ON_PRICE,
899
+ strategyId: Strategies.Identifiers.RepayOnPrice,
900
+ protocol: PROTOCOLS.MorphoBlue,
901
+ },
887
902
  };
888
903
  export const BUNDLES_INFO = {
889
904
  [ChainId.Ethereum]: MAINNET_BUNDLES_INFO,
@@ -63,7 +63,7 @@ function parseMakerTrailingStop(position, parseData) {
63
63
  }
64
64
  function parseMakerLeverageManagement(position, parseData) {
65
65
  const _position = cloneDeep(position);
66
- const { subStruct, subId } = parseData.subscriptionEventData;
66
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
67
67
  const { isEnabled } = parseData.strategiesSubsData;
68
68
  const triggerData = triggerService.makerRatioTrigger.decode(subStruct.triggerData);
69
69
  const subData = subDataService.makerLeverageManagementSubData.decode(subStruct.subData);
@@ -75,9 +75,10 @@ function parseMakerLeverageManagement(position, parseData) {
75
75
  _position.specific = {
76
76
  triggerRepayRatio: triggerData.ratio,
77
77
  targetRepayRatio: subData.targetRatio,
78
- repayEnabled: true,
78
+ repayEnabled: isEnabled,
79
79
  subId1: Number(subId),
80
80
  mergeWithId: Strategies.Identifiers.Boost,
81
+ subHashRepay: subHash,
81
82
  };
82
83
  }
83
84
  else {
@@ -87,6 +88,7 @@ function parseMakerLeverageManagement(position, parseData) {
87
88
  boostEnabled: isEnabled,
88
89
  subId2: Number(subId),
89
90
  mergeId: Strategies.Identifiers.Boost,
91
+ subHashBoost: subHash,
90
92
  };
91
93
  }
92
94
  _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
@@ -126,7 +128,7 @@ function parseLiquityTrailingStop(position, parseData) {
126
128
  }
127
129
  function parseAaveV2LeverageManagement(position, parseData) {
128
130
  const _position = cloneDeep(position);
129
- const { subStruct, subId } = parseData.subscriptionEventData;
131
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
130
132
  const { isEnabled } = parseData.strategiesSubsData;
131
133
  const triggerData = triggerService.aaveV2RatioTrigger.decode(subStruct.triggerData);
132
134
  const subData = subDataService.aaveV2LeverageManagementSubData.decode(subStruct.subData);
@@ -138,9 +140,10 @@ function parseAaveV2LeverageManagement(position, parseData) {
138
140
  _position.specific = {
139
141
  triggerRepayRatio: triggerData.ratio,
140
142
  targetRepayRatio: subData.targetRatio,
141
- repayEnabled: true,
143
+ repayEnabled: isEnabled,
142
144
  subId1: Number(subId),
143
145
  mergeWithId: Strategies.Identifiers.Boost,
146
+ subHashRepay: subHash,
144
147
  };
145
148
  }
146
149
  else {
@@ -150,6 +153,7 @@ function parseAaveV2LeverageManagement(position, parseData) {
150
153
  boostEnabled: isEnabled,
151
154
  subId2: Number(subId),
152
155
  mergeId: Strategies.Identifiers.Boost,
156
+ subHashBoost: subHash,
153
157
  };
154
158
  }
155
159
  _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
@@ -387,7 +391,7 @@ function parseAaveV4CollateralSwitch(position, parseData) {
387
391
  }
388
392
  function parseMorphoAaveV2LeverageManagement(position, parseData) {
389
393
  const _position = cloneDeep(position);
390
- const { subStruct, subId } = parseData.subscriptionEventData;
394
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
391
395
  const { isEnabled } = parseData.strategiesSubsData;
392
396
  const triggerData = triggerService.morphoAaveV2RatioTrigger.decode(subStruct.triggerData);
393
397
  const subData = subDataService.morphoAaveV2LeverageManagementSubData.decode(subStruct.subData);
@@ -399,9 +403,10 @@ function parseMorphoAaveV2LeverageManagement(position, parseData) {
399
403
  _position.specific = {
400
404
  triggerRepayRatio: triggerData.ratio,
401
405
  targetRepayRatio: subData.targetRatio,
402
- repayEnabled: true,
406
+ repayEnabled: isEnabled,
403
407
  subId1: Number(subId),
404
408
  mergeWithId: Strategies.Identifiers.Boost,
409
+ subHashRepay: subHash,
405
410
  };
406
411
  }
407
412
  else {
@@ -411,6 +416,7 @@ function parseMorphoAaveV2LeverageManagement(position, parseData) {
411
416
  boostEnabled: isEnabled,
412
417
  subId2: Number(subId),
413
418
  mergeId: Strategies.Identifiers.Boost,
419
+ subHashBoost: subHash,
414
420
  };
415
421
  }
416
422
  _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
@@ -443,7 +449,7 @@ function parseAaveV3CloseOnPriceWithMaximumGasPrice(position, parseData) {
443
449
  }
444
450
  function parseCompoundV2LeverageManagement(position, parseData) {
445
451
  const _position = cloneDeep(position);
446
- const { subStruct, subId } = parseData.subscriptionEventData;
452
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
447
453
  const { isEnabled } = parseData.strategiesSubsData;
448
454
  const triggerData = triggerService.compoundV2RatioTrigger.decode(subStruct.triggerData);
449
455
  const subData = subDataService.compoundV2LeverageManagementSubData.decode(subStruct.subData);
@@ -456,9 +462,10 @@ function parseCompoundV2LeverageManagement(position, parseData) {
456
462
  _position.specific = {
457
463
  triggerRepayRatio: triggerData.ratio,
458
464
  targetRepayRatio: subData.targetRatio,
459
- repayEnabled: true,
465
+ repayEnabled: isEnabled,
460
466
  subId1: Number(subId),
461
467
  mergeWithId: Strategies.Identifiers.Boost,
468
+ subHashRepay: subHash,
462
469
  };
463
470
  }
464
471
  else {
@@ -468,6 +475,7 @@ function parseCompoundV2LeverageManagement(position, parseData) {
468
475
  boostEnabled: isEnabled,
469
476
  subId2: Number(subId),
470
477
  mergeId: Strategies.Identifiers.Boost,
478
+ subHashBoost: subHash,
471
479
  };
472
480
  }
473
481
  const isEOA = _position.strategy.strategyId.includes('eoa');
@@ -476,11 +484,9 @@ function parseCompoundV2LeverageManagement(position, parseData) {
476
484
  }
477
485
  function parseCompoundV3LeverageManagement(position, parseData) {
478
486
  const _position = cloneDeep(position);
479
- const { subStruct, subId } = parseData.subscriptionEventData;
487
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
480
488
  const { isEnabled } = parseData.strategiesSubsData;
481
- const subDataDecoder = position.chainId !== 1
482
- ? subDataService.compoundV3L2LeverageManagementSubData
483
- : subDataService.compoundV3LeverageManagementSubData;
489
+ const subDataDecoder = subDataService.compoundV3LeverageManagementSubDataWithoutSubProxy;
484
490
  const triggerData = triggerService.compoundV3RatioTrigger.decode(subStruct.triggerData);
485
491
  const subData = subDataDecoder.decode(subStruct.subData);
486
492
  _position.strategyData.decoded.triggerData = triggerData;
@@ -492,9 +498,10 @@ function parseCompoundV3LeverageManagement(position, parseData) {
492
498
  _position.specific = {
493
499
  triggerRepayRatio: triggerData.ratio,
494
500
  targetRepayRatio: subData.targetRatio,
495
- repayEnabled: true,
501
+ repayEnabled: isEnabled,
496
502
  subId1: Number(subId),
497
503
  mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
504
+ subHashRepay: subHash,
498
505
  };
499
506
  }
500
507
  else {
@@ -504,6 +511,7 @@ function parseCompoundV3LeverageManagement(position, parseData) {
504
511
  boostEnabled: isEnabled,
505
512
  subId2: Number(subId),
506
513
  mergeId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
514
+ subHashBoost: subHash,
507
515
  };
508
516
  }
509
517
  _position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLeverageManagement : Strategies.IdOverrides.LeverageManagement;
@@ -591,7 +599,7 @@ function parseExchangeLimitOrder(position, parseData, chainId) {
591
599
  }
592
600
  function parseLiquityLeverageManagement(position, parseData) {
593
601
  const _position = cloneDeep(position);
594
- const { subStruct, subId } = parseData.subscriptionEventData;
602
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
595
603
  const { isEnabled } = parseData.strategiesSubsData;
596
604
  const triggerData = triggerService.liquityRatioTrigger.decode(subStruct.triggerData);
597
605
  const subData = subDataService.liquityLeverageManagementSubData.decode(subStruct.subData);
@@ -603,9 +611,10 @@ function parseLiquityLeverageManagement(position, parseData) {
603
611
  _position.specific = {
604
612
  triggerRepayRatio: triggerData.ratio,
605
613
  targetRepayRatio: subData.targetRatio,
606
- repayEnabled: true,
614
+ repayEnabled: isEnabled,
607
615
  subId1: Number(subId),
608
616
  mergeWithId: Strategies.Identifiers.Boost,
617
+ subHashRepay: subHash,
609
618
  };
610
619
  }
611
620
  else {
@@ -615,6 +624,7 @@ function parseLiquityLeverageManagement(position, parseData) {
615
624
  boostEnabled: isEnabled,
616
625
  subId2: Number(subId),
617
626
  mergeId: Strategies.Identifiers.Boost,
627
+ subHashBoost: subHash,
618
628
  };
619
629
  }
620
630
  _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
@@ -655,7 +665,7 @@ function parseLiquityV2LeverageManagement(position, parseData) {
655
665
  }
656
666
  function parseSparkLeverageManagement(position, parseData) {
657
667
  const _position = cloneDeep(position);
658
- const { subStruct, subId } = parseData.subscriptionEventData;
668
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
659
669
  const { isEnabled } = parseData.strategiesSubsData;
660
670
  const triggerData = triggerService.sparkRatioTrigger.decode(subStruct.triggerData);
661
671
  const subData = subDataService.sparkLeverageManagementSubData.decode(subStruct.subData);
@@ -667,9 +677,10 @@ function parseSparkLeverageManagement(position, parseData) {
667
677
  _position.specific = {
668
678
  triggerRepayRatio: triggerData.ratio,
669
679
  targetRepayRatio: subData.targetRatio,
670
- repayEnabled: true,
680
+ repayEnabled: isEnabled,
671
681
  subId1: Number(subId),
672
682
  mergeWithId: Strategies.Identifiers.Boost,
683
+ subHashRepay: subHash,
673
684
  };
674
685
  }
675
686
  else {
@@ -679,6 +690,7 @@ function parseSparkLeverageManagement(position, parseData) {
679
690
  boostEnabled: isEnabled,
680
691
  subId2: Number(subId),
681
692
  mergeId: Strategies.Identifiers.Boost,
693
+ subHashBoost: subHash,
682
694
  };
683
695
  }
684
696
  _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
@@ -861,6 +873,7 @@ function parseMorphoBlueLeverageManagementOnPrice(position, parseData) {
861
873
  debtAsset: subData.loanToken,
862
874
  price: triggerData.price,
863
875
  ratio: subData.targetRatio,
876
+ ratioState: triggerData.priceState,
864
877
  };
865
878
  return _position;
866
879
  }
@@ -1097,6 +1110,7 @@ const parsingMethodsMapping = {
1097
1110
  [Strategies.Identifiers.EoaRepay]: parseMorphoBlueLeverageManagement,
1098
1111
  [Strategies.Identifiers.EoaBoost]: parseMorphoBlueLeverageManagement,
1099
1112
  [Strategies.Identifiers.BoostOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
1113
+ [Strategies.Identifiers.RepayOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
1100
1114
  [Strategies.Identifiers.CloseOnPrice]: parseMorphoBlueCloseOnPrice,
1101
1115
  },
1102
1116
  [ProtocolIdentifiers.StrategiesAutomation.FluidT1]: {
@@ -5,14 +5,13 @@ export declare const makerEncode: {
5
5
  repayFromSavings(bundleId: StrategyOrBundleIds, vaultId: number, triggerRepayRatio: number, targetRepayRatio: number, isBundle?: boolean, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds | Strategies.OptimismIds | Strategies.ArbitrumIds | Strategies.BaseIds | Bundles.MainnetIds | Bundles.OptimismIds | Bundles.ArbitrumIds | Bundles.BaseIds)[];
6
6
  closeOnPrice(vaultId: number, ratioState: RatioState, price: string, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
7
7
  trailingStop(vaultId: number, triggerPercentage: number, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, roundId: number, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
8
- leverageManagement(vaultId: number, triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string, targetRepayRatio: string, boostEnabled: boolean): (string | number | boolean)[];
9
8
  leverageManagementWithoutSubProxy(vaultId: number, triggerRatio: number, targetRatio: number, ratioState: RatioState, isBoost: boolean, daiAddr?: EthereumAddress): (boolean | string[] | Bundles.MainnetIds)[];
10
9
  };
11
10
  export declare const liquityEncode: {
12
11
  closeOnPrice(priceOverOrUnder: RatioState, price: string, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, chainId?: ChainId, collAddr?: EthereumAddress, debtAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
13
12
  trailingStop(triggerPercentage: number, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, roundId: number, chainId?: ChainId, collAddr?: EthereumAddress, debtAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
14
13
  paybackFromChickenBondStrategySub(proxyAddress: EthereumAddress, ratio: number, sourceId: string, sourceType: number, ratioState?: RatioState): (boolean | string[] | Bundles.MainnetIds)[];
15
- leverageManagement(triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string, targetRepayRatio: string, boostEnabled: boolean): (string | boolean)[];
14
+ leverageManagementWithoutSubProxy(strategyOrBundleId: number, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
16
15
  dsrPayback(proxyAddress: EthereumAddress, triggerRatio: number, targetRatio: number): (boolean | string[] | Strategies.MainnetIds)[];
17
16
  dsrSupply(proxyAddress: EthereumAddress, triggerRatio: number, targetRatio: number): (boolean | string[] | Strategies.MainnetIds)[];
18
17
  debtInFrontRepay(proxyAddress: EthereumAddress, debtInFrontMin: string, targetRatioIncrease: number): (boolean | string[] | Strategies.MainnetIds)[];
@@ -21,10 +20,9 @@ export declare const chickenBondsEncode: {
21
20
  rebond(bondId: number): string[];
22
21
  };
23
22
  export declare const aaveV2Encode: {
24
- leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string[];
23
+ leverageManagementWithoutSubProxy(strategyOrBundleId: number, market: EthereumAddress, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
25
24
  };
26
25
  export declare const aaveV3Encode: {
27
- leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string;
28
26
  closeToAsset(strategyOrBundleId: number, isBundle: boolean | undefined, triggerData: {
29
27
  baseTokenAddress: EthereumAddress;
30
28
  quoteTokenAddress: EthereumAddress;
@@ -67,25 +65,21 @@ export declare const aaveV3Encode: {
67
65
  collateralSwitch(strategyOrBundleId: number, fromAsset: EthereumAddress, fromAssetId: number, toAsset: EthereumAddress, toAssetId: number, marketAddr: EthereumAddress, amountToSwitch: string, baseTokenAddress: EthereumAddress, quoteTokenAddress: EthereumAddress, price: number, state: RatioState): (number | boolean | string[])[];
68
66
  };
69
67
  export declare const compoundV2Encode: {
70
- leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string[];
68
+ leverageManagementWithoutSubProxy(strategyOrBundleId: number, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
71
69
  };
72
70
  export declare const compoundV3Encode: {
73
- leverageManagement(market: EthereumAddress, baseToken: EthereumAddress, triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean, isEOA: boolean): string[];
71
+ leverageManagementWithoutSubProxy(strategyOrBundleId: number, market: EthereumAddress, baseToken: EthereumAddress, user: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number): (number | boolean | string[])[];
74
72
  leverageManagementOnPrice(strategyOrBundleId: number, market: EthereumAddress, collToken: EthereumAddress, baseToken: EthereumAddress, targetRatio: number, price: number, priceState: RatioState, ratioState: RatioState, user: EthereumAddress): (number | boolean | string[])[];
75
73
  closeOnPrice(strategyOrBundleId: number, market: EthereumAddress, collToken: EthereumAddress, baseToken: EthereumAddress, stopLossPrice: number | undefined, stopLossType: CloseToAssetType | undefined, takeProfitPrice: number | undefined, takeProfitType: CloseToAssetType | undefined, user: EthereumAddress): (number | boolean | string[])[];
76
74
  };
77
- export declare const compoundV3L2Encode: {
78
- leverageManagement(market: EthereumAddress, baseToken: EthereumAddress, triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean, isEOA?: boolean): string;
79
- };
80
75
  export declare const morphoAaveV2Encode: {
81
76
  leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string[];
82
77
  };
83
78
  export declare const exchangeEncode: {
84
79
  dca(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, timestamp: number, interval: number, network: ChainId): (boolean | string[] | Strategies.MainnetIds | Strategies.OptimismIds | Strategies.ArbitrumIds | Strategies.BaseIds)[];
85
- limitOrder(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string | number, orderType: OrderType): string[];
80
+ limitOrderWithoutSubProxy(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string | number, orderType: OrderType, fromTokenDecimals: number, toTokenDecimals: number, network: ChainId): (boolean | string[] | Strategies.MainnetIds | Strategies.OptimismIds | Strategies.ArbitrumIds | Strategies.BaseIds)[];
86
81
  };
87
82
  export declare const sparkEncode: {
88
- leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string;
89
83
  leverageManagementOnPrice(strategyOrBundleId: number, isBundle: boolean | undefined, triggerData: {
90
84
  baseTokenAddr: EthereumAddress;
91
85
  quoteTokenAddr: EthereumAddress;