@defisaver/automation-sdk 3.2.3 → 3.2.4-dev-1

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.
Files changed (39) hide show
  1. package/cjs/constants/index.js +90 -0
  2. package/cjs/services/strategiesService.js +48 -1
  3. package/cjs/services/strategySubService.d.ts +2 -0
  4. package/cjs/services/strategySubService.js +13 -0
  5. package/cjs/services/strategySubService.test.js +108 -0
  6. package/cjs/services/subDataService.d.ts +18 -0
  7. package/cjs/services/subDataService.js +48 -1
  8. package/cjs/services/subDataService.test.js +124 -48
  9. package/cjs/services/triggerService.d.ts +33 -0
  10. package/cjs/services/triggerService.js +62 -1
  11. package/cjs/services/triggerService.test.js +211 -0
  12. package/cjs/types/enums.d.ts +28 -5
  13. package/cjs/types/enums.js +23 -0
  14. package/cjs/types/index.d.ts +17 -1
  15. package/esm/constants/index.js +90 -0
  16. package/esm/services/strategiesService.js +48 -1
  17. package/esm/services/strategySubService.d.ts +2 -0
  18. package/esm/services/strategySubService.js +13 -0
  19. package/esm/services/strategySubService.test.js +109 -1
  20. package/esm/services/subDataService.d.ts +18 -0
  21. package/esm/services/subDataService.js +47 -0
  22. package/esm/services/subDataService.test.js +124 -48
  23. package/esm/services/triggerService.d.ts +33 -0
  24. package/esm/services/triggerService.js +61 -0
  25. package/esm/services/triggerService.test.js +212 -1
  26. package/esm/types/enums.d.ts +28 -5
  27. package/esm/types/enums.js +23 -0
  28. package/esm/types/index.d.ts +17 -1
  29. package/package.json +2 -2
  30. package/src/constants/index.ts +90 -1
  31. package/src/services/strategiesService.ts +62 -1
  32. package/src/services/strategySubService.test.ts +115 -1
  33. package/src/services/strategySubService.ts +33 -0
  34. package/src/services/subDataService.test.ts +128 -73
  35. package/src/services/subDataService.ts +73 -0
  36. package/src/services/triggerService.test.ts +229 -1
  37. package/src/services/triggerService.ts +83 -0
  38. package/src/types/enums.ts +23 -0
  39. package/src/types/index.ts +22 -1
@@ -15,6 +15,7 @@ import {
15
15
  chainlinkPriceTrigger,
16
16
  compoundV2RatioTrigger,
17
17
  compoundV3RatioTrigger,
18
+ compoundV3PriceTrigger,
18
19
  curveUsdBorrowRateTrigger,
19
20
  curveUsdSoftLiquidationTrigger,
20
21
  exchangeOffchainPriceTrigger,
@@ -28,7 +29,8 @@ import {
28
29
  liquityDebtInFrontWithLimitTrigger,
29
30
  crvUSDRatioTrigger,
30
31
  morphoBlueRatioTrigger,
31
- crvUsdHealthRatioTrigger,
32
+ crvUsdHealthRatioTrigger, liquityV2DebtInFrontTrigger, liquityV2AdjustTimeTrigger,
33
+ compoundV3PriceRangeTrigger,
32
34
  } from './triggerService';
33
35
 
34
36
  describe('Feature: triggerService.ts', () => {
@@ -487,6 +489,132 @@ describe('Feature: triggerService.ts', () => {
487
489
  });
488
490
  });
489
491
 
492
+ describe('When testing triggerService.liquityV2DebtInFrontTrigger', () => {
493
+ describe('encode()', () => {
494
+ const examples: Array<[[string], [market: EthereumAddress, troveId: string, debtInFrontMin: string]]> = [
495
+ [
496
+ ['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434ad94e2c00000000000000000000000000000000000000000000000000000000075bcd1500000000000000000000000000000000000000000000006e0be8c4995af80000'],
497
+ [web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434Ad94E2c'), '123456789', '2030']
498
+ ],
499
+ [
500
+ ['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434a192e2c000000000000000000000000000000000000000000000000000000003ade68b1000000000000000000000000000000000000000000004697f83e6356dd440000'],
501
+ [web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434A192E2c'), '987654321', '333369']
502
+ ],
503
+ [
504
+ ['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf00000000000000000000000000000000000000000000000000000000075bd924000000000000000000000000000000000000000000084595161401484a000000'],
505
+ [web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'), '123459876', '10000000']
506
+ ],
507
+ [
508
+ ['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf000000000000000000000000000000000000000000000000000000002060d4950000000000000000000000000000000000000000000000000000000000989680'],
509
+ [web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'), '543216789', '0.00000000001']
510
+ ],
511
+ [
512
+ ['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a000000000000000000000000000000000000000000000000000000003ade5ca20000000000000000000000000000000000000000019d971e4fe8401e74000000'],
513
+ [web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '987651234', '500000000']
514
+ ],
515
+ ];
516
+
517
+ examples.forEach(([expected, actual]) => {
518
+ it(`Given ${actual} should return expected value: ${expected}`, () => {
519
+ expect(liquityV2DebtInFrontTrigger.encode(...actual)).to.eql(expected);
520
+ });
521
+ });
522
+ });
523
+
524
+ describe('decode()', () => {
525
+ const examples: Array<[{ market: EthereumAddress, troveId: string, debtInFrontMin: string }, TriggerData]> = [
526
+ [
527
+ {
528
+ market: web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434Ad94E2c'),
529
+ troveId: '123456789',
530
+ debtInFrontMin: '2030',
531
+ },
532
+ ['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434ad94e2c00000000000000000000000000000000000000000000000000000000075bcd1500000000000000000000000000000000000000000000006e0be8c4995af80000'],
533
+ ],
534
+ [
535
+ {
536
+ market: web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434A192E2c'),
537
+ troveId: '987654321',
538
+ debtInFrontMin: '333369',
539
+ },
540
+ ['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434a192e2c000000000000000000000000000000000000000000000000000000003ade68b1000000000000000000000000000000000000000000004697f83e6356dd440000'],
541
+ ], [
542
+ {
543
+ market: web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'),
544
+ troveId: '123459876',
545
+ debtInFrontMin: '10000000',
546
+ },
547
+ ['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf00000000000000000000000000000000000000000000000000000000075bd924000000000000000000000000000000000000000000084595161401484a000000'],
548
+ ], [
549
+ {
550
+ market: web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'),
551
+ troveId: '543216789',
552
+ debtInFrontMin: '0.00000000001',
553
+ },
554
+ ['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf000000000000000000000000000000000000000000000000000000002060d4950000000000000000000000000000000000000000000000000000000000989680'],
555
+ ], [
556
+ {
557
+ market: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
558
+ troveId: '987651234',
559
+ debtInFrontMin: '500000000',
560
+ },
561
+ ['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a000000000000000000000000000000000000000000000000000000003ade5ca20000000000000000000000000000000000000000019d971e4fe8401e74000000'],
562
+ ]
563
+ ];
564
+
565
+ examples.forEach(([expected, actual]) => {
566
+ it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
567
+ expect(liquityV2DebtInFrontTrigger.decode(actual)).to.eql(expected);
568
+ });
569
+ });
570
+ });
571
+ });
572
+
573
+ describe('When testing triggerService.liquityV2AdjustTimeTrigger', () => {
574
+ describe('encode()', () => {
575
+ const examples: Array<[[string], [market: EthereumAddress, troveId: string]]> = [
576
+ [
577
+ ['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434ad94e2c00000000000000000000000000000000000000000000000000000000075bcd15'],
578
+ [web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434Ad94E2c'), '123456789']
579
+ ],
580
+ [
581
+ ['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434a192e2c000000000000000000000000000000000000000000000000000000003ade68b1'],
582
+ [web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434A192E2c'), '987654321']
583
+ ],
584
+ ];
585
+
586
+ examples.forEach(([expected, actual]) => {
587
+ it(`Given ${actual} should return expected value: ${expected}`, () => {
588
+ expect(liquityV2AdjustTimeTrigger.encode(...actual)).to.eql(expected);
589
+ });
590
+ });
591
+ });
592
+
593
+ describe('decode()', () => {
594
+ const examples: Array<[{ market: EthereumAddress, troveId: string }, TriggerData]> = [
595
+ [
596
+ {
597
+ market: web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434Ad94E2c'),
598
+ troveId: '123456789',
599
+ },
600
+ ['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434ad94e2c00000000000000000000000000000000000000000000000000000000075bcd15'],
601
+ ],
602
+ [
603
+ {
604
+ market: web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434A192E2c'),
605
+ troveId: '987654321',
606
+ },
607
+ ['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434a192e2c000000000000000000000000000000000000000000000000000000003ade68b1'],
608
+ ]
609
+ ];
610
+
611
+ examples.forEach(([expected, actual]) => {
612
+ it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
613
+ expect(liquityV2AdjustTimeTrigger.decode(actual)).to.eql(expected);
614
+ });
615
+ });
616
+ });
617
+ });
490
618
  describe('When testing triggerService.aaveV2RatioTrigger', () => {
491
619
  describe('encode()', () => {
492
620
  const examples: Array<[[string], [owner: EthereumAddress, market: EthereumAddress, ratioPercentage: number, ratioState: RatioState]]> = [
@@ -1001,4 +1129,104 @@ describe('Feature: triggerService.ts', () => {
1001
1129
  });
1002
1130
  });
1003
1131
  });
1132
+
1133
+ describe('When testing triggerService.compoundV3PriceTrigger', () => {
1134
+ describe('encode()', () => {
1135
+ const examples: Array<[[string], [market: EthereumAddress, collToken: EthereumAddress, price: number, priceState: RatioState]]> = [
1136
+ [
1137
+ ['0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000002e90edd0000000000000000000000000000000000000000000000000000000000000000001'],
1138
+ [web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'), web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'), 2000, RatioState.UNDER]
1139
+ ],
1140
+ [
1141
+ ['0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000045d964b8000000000000000000000000000000000000000000000000000000000000000000'],
1142
+ [web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'), web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'), 3000, RatioState.OVER]
1143
+ ],
1144
+ ];
1145
+
1146
+ examples.forEach(([expected, actual]) => {
1147
+ it(`Given ${actual} should return expected value: ${expected}`, () => {
1148
+ expect(compoundV3PriceTrigger.encode(...actual)).to.eql(expected);
1149
+ });
1150
+ });
1151
+ });
1152
+
1153
+ describe('decode()', () => {
1154
+ const examples: Array<[{ market: EthereumAddress, collToken: EthereumAddress, price: string, priceState: RatioState }, TriggerData]> = [
1155
+ [
1156
+ {
1157
+ market: web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
1158
+ collToken: web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
1159
+ price: '2000',
1160
+ priceState: RatioState.UNDER,
1161
+ },
1162
+ ['0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000002e90edd0000000000000000000000000000000000000000000000000000000000000000001'],
1163
+ ],
1164
+ [
1165
+ {
1166
+ market: web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
1167
+ collToken: web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
1168
+ price: '3000',
1169
+ priceState: RatioState.OVER,
1170
+ },
1171
+ ['0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000045d964b8000000000000000000000000000000000000000000000000000000000000000000'],
1172
+ ],
1173
+ ];
1174
+
1175
+ examples.forEach(([expected, actual]) => {
1176
+ it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1177
+ expect(compoundV3PriceTrigger.decode(actual)).to.eql(expected);
1178
+ });
1179
+ });
1180
+ });
1181
+ });
1182
+
1183
+ describe('When testing triggerService.compoundV3PriceRangeTrigger', () => {
1184
+ describe('encode()', () => {
1185
+ const examples: Array<[[string], [market: EthereumAddress, collToken: EthereumAddress, lowerPrice: number, upperPrice: number]]> = [
1186
+ [
1187
+ ['0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000022ecb25c000000000000000000000000000000000000000000000000000000005d21dba000'],
1188
+ [web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'), web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'), 1500, 4000]
1189
+ ],
1190
+ [
1191
+ ['0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000746a528800'],
1192
+ [web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'), web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'), 0, 5000]
1193
+ ],
1194
+ ];
1195
+
1196
+ examples.forEach(([expected, actual]) => {
1197
+ it(`Given ${actual} should return expected value: ${expected}`, () => {
1198
+ expect(compoundV3PriceRangeTrigger.encode(...actual)).to.eql(expected);
1199
+ });
1200
+ });
1201
+ });
1202
+
1203
+ describe('decode()', () => {
1204
+ const examples: Array<[{ market: EthereumAddress, collToken: EthereumAddress, lowerPrice: string, upperPrice: string }, TriggerData]> = [
1205
+ [
1206
+ {
1207
+ market: web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
1208
+ collToken: web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
1209
+ lowerPrice: '1500',
1210
+ upperPrice: '4000',
1211
+ },
1212
+ ['0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000022ecb25c000000000000000000000000000000000000000000000000000000005d21dba000'],
1213
+ ],
1214
+ [
1215
+ {
1216
+ market: web3Utils.toChecksumAddress('0xc3d688B66703497DAA19211EEdff47f25384cdc3'),
1217
+ collToken: web3Utils.toChecksumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'),
1218
+ lowerPrice: '0',
1219
+ upperPrice: '5000',
1220
+ },
1221
+ ['0x000000000000000000000000c3d688b66703497daa19211eedff47f25384cdc3000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000746a528800'],
1222
+ ],
1223
+ ];
1224
+
1225
+ examples.forEach(([expected, actual]) => {
1226
+ it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
1227
+ expect(compoundV3PriceRangeTrigger.decode(actual)).to.eql(expected);
1228
+ });
1229
+ });
1230
+ });
1231
+ });
1004
1232
  });
@@ -187,6 +187,34 @@ export const liquityDebtInFrontTrigger = {
187
187
 
188
188
  export const liquityDebtInFrontWithLimitTrigger = liquityDebtInFrontTrigger;
189
189
 
190
+ export const liquityV2DebtInFrontTrigger = {
191
+ encode(market: EthereumAddress, troveId: string, debtInFrontMin: string) {
192
+ const debtInFrontMinWei = web3Utils.toWei(new Dec(debtInFrontMin).toString(), 'ether');
193
+ return [AbiCoder.encodeParameters(['address', 'uint256', 'uint256'], [market, troveId, debtInFrontMinWei])];
194
+ },
195
+ decode(triggerData: TriggerData): { market: EthereumAddress, troveId: string, debtInFrontMin: string } {
196
+ const decodedData = AbiCoder.decodeParameters(['address', 'uint256', 'uint256'], triggerData[0]);
197
+ return {
198
+ market: decodedData[0] as EthereumAddress,
199
+ troveId: decodedData[1] as string,
200
+ debtInFrontMin: new Dec(decodedData[2] as string).div(10 ** 18).toString(),
201
+ };
202
+ },
203
+ };
204
+
205
+ export const liquityV2AdjustTimeTrigger = {
206
+ encode(market: EthereumAddress, troveId: string) {
207
+ return [AbiCoder.encodeParameters(['address', 'uint256'], [market, troveId])];
208
+ },
209
+ decode(triggerData: TriggerData): { market: EthereumAddress, troveId: string } {
210
+ const decodedData = AbiCoder.decodeParameters(['address', 'uint256'], triggerData[0]);
211
+ return {
212
+ market: decodedData[0] as EthereumAddress,
213
+ troveId: decodedData[1] as string,
214
+ };
215
+ },
216
+ };
217
+
190
218
  export const aaveV2RatioTrigger = {
191
219
  encode(owner: EthereumAddress, market: EthereumAddress, ratioPercentage: number, ratioState: RatioState) {
192
220
  const ratioWei = ratioPercentageToWei(ratioPercentage);
@@ -571,4 +599,59 @@ export const fluidRatioTrigger = {
571
599
  ratioState: Number(decodedData[2]),
572
600
  };
573
601
  },
602
+ };
603
+
604
+ export const compoundV3PriceTrigger = {
605
+ encode(
606
+ market: EthereumAddress,
607
+ collToken: EthereumAddress,
608
+ price: number,
609
+ priceState: RatioState,
610
+ ) {
611
+ const _price = new Dec(price.toString()).mul(1e8).floor().toString();
612
+ return [
613
+ AbiCoder.encodeParameters(
614
+ ['address', 'address', 'uint256', 'uint8'],
615
+ [market, collToken, _price, priceState]),
616
+ ];
617
+ },
618
+ decode(
619
+ triggerData: TriggerData,
620
+ ) {
621
+ const decodedData = AbiCoder.decodeParameters(['address', 'address', 'uint256', 'uint8'], triggerData[0]);
622
+ return {
623
+ market: decodedData[0] as EthereumAddress,
624
+ collToken: decodedData[1] as EthereumAddress,
625
+ price: new Dec(decodedData[2] as string).div(1e8).toString(),
626
+ priceState: Number(decodedData[3]),
627
+ };
628
+ },
629
+ };
630
+
631
+ export const compoundV3PriceRangeTrigger = {
632
+ encode(
633
+ market: EthereumAddress,
634
+ collToken: EthereumAddress,
635
+ lowerPrice: number,
636
+ upperPrice: number,
637
+ ) {
638
+ const lowerPriceFormatted = new Dec(lowerPrice).mul(1e8).floor().toString();
639
+ const upperPriceFormatted = new Dec(upperPrice).mul(1e8).floor().toString();
640
+ return [
641
+ AbiCoder.encodeParameters(
642
+ ['address', 'address', 'uint256', 'uint256'],
643
+ [market, collToken, lowerPriceFormatted, upperPriceFormatted]),
644
+ ];
645
+ },
646
+ decode(
647
+ triggerData: TriggerData,
648
+ ) {
649
+ const decodedData = AbiCoder.decodeParameters(['address', 'address', 'uint256', 'uint256'], triggerData[0]);
650
+ return {
651
+ market: decodedData[0] as EthereumAddress,
652
+ collToken: decodedData[1] as EthereumAddress,
653
+ lowerPrice: new Dec(decodedData[2] as string).div(1e8).toString(),
654
+ upperPrice: new Dec(decodedData[3] as string).div(1e8).toString(),
655
+ };
656
+ },
574
657
  };
@@ -128,6 +128,7 @@ export namespace Strategies {
128
128
  CloseOnPriceToDebt = 'close-on-price-to-debt',
129
129
  CloseOnPriceToColl = 'close-on-price-to-collateral',
130
130
  CloseOnPrice = 'close-on-price',
131
+ EoaCloseOnPrice = 'eoa-close-on-price',
131
132
  TrailingStopToColl = 'trailing-stop-to-collateral',
132
133
  TrailingStopToDebt = 'trailing-stop-to-debt',
133
134
  Rebond = 'rebond',
@@ -140,6 +141,8 @@ export namespace Strategies {
140
141
  OpenOrderFromDebt = 'open-order-from-debt',
141
142
  BoostOnPrice = 'boost-on-price',
142
143
  RepayOnPrice = 'repay-on-price',
144
+ EoaBoostOnPrice = 'eoa-boost-on-price',
145
+ EoaRepayOnPrice = 'eoa-repay-on-price',
143
146
  }
144
147
  export enum IdOverrides {
145
148
  TakeProfit = 'take-profit',
@@ -149,6 +152,8 @@ export namespace Strategies {
149
152
  TrailingStop = 'trailing-stop',
150
153
  LeverageManagement = 'leverage-management',
151
154
  EoaLeverageManagement = 'leverage-management-eoa',
155
+ LeverageManagementOnPrice = 'leverage-management-on-price',
156
+ EoaLeverageManagementOnPrice = 'leverage-management-on-price-eoa',
152
157
  }
153
158
  }
154
159
 
@@ -202,6 +207,12 @@ export namespace Bundles {
202
207
  LIQUITY_V2_BOOST_ON_PRICE = 43,
203
208
  FLUID_T1_REPAY = 44,
204
209
  FLUID_T1_BOOST = 45,
210
+ COMP_V3_SW_REPAY_ON_PRICE = 46,
211
+ COMP_V3_SW_BOOST_ON_PRICE = 47,
212
+ COMP_V3_SW_CLOSE = 48,
213
+ COMP_V3_EOA_REPAY_ON_PRICE = 49,
214
+ COMP_V3_EOA_BOOST_ON_PRICE = 50,
215
+ COMP_V3_EOA_CLOSE = 51,
205
216
  }
206
217
 
207
218
  export enum OptimismIds {
@@ -227,6 +238,12 @@ export namespace Bundles {
227
238
  MORPHO_BLUE_BOOST_ON_PRICE = 12,
228
239
  FLUID_T1_REPAY = 13,
229
240
  FLUID_T1_BOOST = 14,
241
+ COMP_V3_SW_REPAY_ON_PRICE = 15,
242
+ COMP_V3_SW_BOOST_ON_PRICE = 16,
243
+ COMP_V3_SW_CLOSE = 17,
244
+ COMP_V3_EOA_REPAY_ON_PRICE = 18,
245
+ COMP_V3_EOA_BOOST_ON_PRICE = 19,
246
+ COMP_V3_EOA_CLOSE = 20,
230
247
  }
231
248
 
232
249
  export enum ArbitrumIds {
@@ -240,6 +257,12 @@ export namespace Bundles {
240
257
  AAVE_V3_REPAY_ON_PRICE = 7,
241
258
  FLUID_T1_REPAY = 8,
242
259
  FLUID_T1_BOOST = 9,
260
+ COMP_V3_SW_REPAY_ON_PRICE = 10,
261
+ COMP_V3_SW_BOOST_ON_PRICE = 11,
262
+ COMP_V3_SW_CLOSE = 12,
263
+ COMP_V3_EOA_REPAY_ON_PRICE = 13,
264
+ COMP_V3_EOA_BOOST_ON_PRICE = 14,
265
+ COMP_V3_EOA_CLOSE = 15,
243
266
  }
244
267
  }
245
268
 
@@ -205,6 +205,25 @@ export declare namespace Position {
205
205
  subHashBoost?: string,
206
206
  subHashRepay?: string,
207
207
  }
208
+
209
+ interface CompoundV3Base extends Base {
210
+ market: EthereumAddress,
211
+ collToken: EthereumAddress,
212
+ baseToken: EthereumAddress,
213
+ }
214
+
215
+ interface CompoundV3LeverageManagementOnPrice extends CompoundV3Base {
216
+ ratio: number,
217
+ price: string,
218
+ priceState: RatioState,
219
+ }
220
+
221
+ interface CompoundV3CloseOnPrice extends CompoundV3Base {
222
+ stopLossPrice: string,
223
+ takeProfitPrice: string,
224
+ stopLossType: CloseToAssetType | undefined,
225
+ takeProfitType: CloseToAssetType | undefined,
226
+ }
208
227
  }
209
228
 
210
229
  type SpecificAny =
@@ -219,7 +238,9 @@ export declare namespace Position {
219
238
  | Specific.CloseOnPriceLiquityV2
220
239
  | Specific.BoostOnPriceMorpho
221
240
  | Specific.BoostOnPriceLiquityV2
222
- | Specific.PaybackLiquityV2;
241
+ | Specific.PaybackLiquityV2
242
+ | Specific.CompoundV3LeverageManagementOnPrice
243
+ | Specific.CompoundV3CloseOnPrice;
223
244
 
224
245
  export interface Automated {
225
246
  chainId: ChainId,