@defisaver/automation-sdk 3.1.5 → 3.1.6-fluid-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.
Files changed (44) hide show
  1. package/cjs/automation/private/StrategiesAutomation.d.ts +2 -2
  2. package/cjs/automation/public/Strategies.test.d.ts +1 -0
  3. package/cjs/automation/public/Strategies.test.js +61 -0
  4. package/cjs/constants/index.js +35 -0
  5. package/cjs/services/strategiesService.js +123 -0
  6. package/cjs/services/strategySubService.d.ts +9 -1
  7. package/cjs/services/strategySubService.js +30 -1
  8. package/cjs/services/subDataService.d.ts +43 -1
  9. package/cjs/services/subDataService.js +143 -1
  10. package/cjs/services/triggerService.d.ts +33 -0
  11. package/cjs/services/triggerService.js +63 -1
  12. package/cjs/services/utils.d.ts +6 -1
  13. package/cjs/services/utils.js +52 -1
  14. package/cjs/types/enums.d.ts +34 -2
  15. package/cjs/types/enums.js +37 -1
  16. package/cjs/types/index.d.ts +12 -3
  17. package/esm/automation/private/StrategiesAutomation.d.ts +2 -2
  18. package/esm/automation/public/Strategies.test.d.ts +1 -0
  19. package/esm/automation/public/Strategies.test.js +56 -0
  20. package/esm/constants/index.js +35 -0
  21. package/esm/services/strategiesService.js +124 -1
  22. package/esm/services/strategySubService.d.ts +9 -1
  23. package/esm/services/strategySubService.js +31 -2
  24. package/esm/services/subDataService.d.ts +43 -1
  25. package/esm/services/subDataService.js +143 -1
  26. package/esm/services/triggerService.d.ts +33 -0
  27. package/esm/services/triggerService.js +62 -0
  28. package/esm/services/utils.d.ts +6 -1
  29. package/esm/services/utils.js +50 -1
  30. package/esm/types/enums.d.ts +34 -2
  31. package/esm/types/enums.js +36 -0
  32. package/esm/types/index.d.ts +12 -3
  33. package/package.json +3 -3
  34. package/src/automation/private/StrategiesAutomation.ts +2 -2
  35. package/src/automation/public/Strategies.test.ts +49 -0
  36. package/src/constants/index.ts +35 -0
  37. package/src/services/strategiesService.ts +159 -1
  38. package/src/services/strategySubService.ts +80 -1
  39. package/src/services/subDataService.ts +202 -2
  40. package/src/services/triggerService.ts +96 -0
  41. package/src/services/utils.ts +60 -1
  42. package/src/types/enums.ts +36 -0
  43. package/src/types/index.ts +13 -1
  44. package/umd/index.js +34219 -0
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.morphoBluePriceTrigger = exports.morphoBlueRatioTrigger = exports.crvUsdHealthRatioTrigger = exports.crvUSDRatioTrigger = exports.curveUsdSoftLiquidationTrigger = exports.curveUsdBorrowRateTrigger = exports.sparkQuotePriceTrigger = exports.sparkRatioTrigger = exports.exchangeOffchainPriceTrigger = exports.exchangeTimestampTrigger = exports.compoundV3RatioTrigger = exports.cBondsRebondTrigger = exports.aaveV2RatioTrigger = exports.liquityDebtInFrontWithLimitTrigger = exports.liquityDebtInFrontTrigger = exports.liquityRatioTrigger = exports.compoundV2RatioTrigger = exports.aaveV3QuotePriceWithMaximumGasPriceTrigger = exports.aaveV3QuotePriceTrigger = exports.morphoAaveV2RatioTrigger = exports.aaveV3RatioTrigger = exports.makerRatioTrigger = exports.trailingStopTrigger = exports.chainlinkPriceTrigger = void 0;
29
+ exports.fluidRatioTrigger = exports.morphoBluePriceTrigger = exports.closePriceTrigger = exports.liquityV2QuotePriceTrigger = exports.liquityV2RatioTrigger = exports.morphoBlueRatioTrigger = exports.crvUsdHealthRatioTrigger = exports.crvUSDRatioTrigger = exports.curveUsdSoftLiquidationTrigger = exports.curveUsdBorrowRateTrigger = exports.sparkQuotePriceTrigger = exports.sparkRatioTrigger = exports.exchangeOffchainPriceTrigger = exports.exchangeTimestampTrigger = exports.compoundV3RatioTrigger = exports.cBondsRebondTrigger = exports.aaveV2RatioTrigger = exports.liquityDebtInFrontWithLimitTrigger = exports.liquityDebtInFrontTrigger = exports.liquityRatioTrigger = exports.compoundV2RatioTrigger = exports.aaveV3QuotePriceWithMaximumGasPriceTrigger = exports.aaveV3QuotePriceTrigger = exports.morphoAaveV2RatioTrigger = exports.aaveV3RatioTrigger = exports.makerRatioTrigger = exports.trailingStopTrigger = exports.chainlinkPriceTrigger = void 0;
30
30
  const decimal_js_1 = __importDefault(require("decimal.js"));
31
31
  const tokens_1 = require("@defisaver/tokens");
32
32
  const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
@@ -365,6 +365,54 @@ exports.morphoBlueRatioTrigger = {
365
365
  };
366
366
  },
367
367
  };
368
+ exports.liquityV2RatioTrigger = {
369
+ encode(market, troveId, ratioPercentage, ratioState) {
370
+ const ratioWei = (0, utils_1.ratioPercentageToWei)(ratioPercentage);
371
+ return [web3_eth_abi_1.default.encodeParameters(['address', 'uint256', 'uint256', 'uint8'], [market, troveId, ratioWei, ratioState])];
372
+ },
373
+ decode(triggerData) {
374
+ const decodedData = web3_eth_abi_1.default.decodeParameters(['address', 'uint256', 'uint256', 'uint8'], triggerData[0]);
375
+ return {
376
+ market: decodedData[0],
377
+ troveId: decodedData[1],
378
+ ratio: (0, utils_1.weiToRatioPercentage)(decodedData[2]),
379
+ ratioState: Number(decodedData[3]),
380
+ };
381
+ },
382
+ };
383
+ exports.liquityV2QuotePriceTrigger = {
384
+ encode(market, price, ratioState) {
385
+ // Price is always in 18 decimals
386
+ const _price = new decimal_js_1.default(price.toString()).mul(Math.pow(10, 18)).floor().toString();
387
+ return [web3_eth_abi_1.default.encodeParameters(['address', 'uint256', 'uint8'], [market, _price, ratioState])];
388
+ },
389
+ decode(triggerData) {
390
+ const decodedData = web3_eth_abi_1.default.decodeParameters(['address', 'uint256', 'uint8'], triggerData[0]);
391
+ const price = new decimal_js_1.default(decodedData[1]).div(Math.pow(10, 18)).toDP(18).toString();
392
+ return {
393
+ market: decodedData[0],
394
+ price,
395
+ ratioState: Number(decodedData[2]),
396
+ };
397
+ },
398
+ };
399
+ exports.closePriceTrigger = {
400
+ encode(tokenAddr, lowerPrice, upperPrice) {
401
+ const lowerPriceFormatted = new decimal_js_1.default(lowerPrice).mul(1e8).floor().toString();
402
+ const upperPriceFormatted = new decimal_js_1.default(upperPrice).mul(1e8).floor().toString();
403
+ return [
404
+ web3_eth_abi_1.default.encodeParameters(['address', 'uint256', 'uint256'], [tokenAddr, lowerPriceFormatted, upperPriceFormatted]),
405
+ ];
406
+ },
407
+ decode(triggerData) {
408
+ const decodedData = web3_eth_abi_1.default.decodeParameters(['address', 'uint256', 'uint256'], triggerData[0]);
409
+ return {
410
+ tokenAddr: decodedData[0],
411
+ lowerPrice: new decimal_js_1.default(decodedData[1]).div(1e8).toString(),
412
+ upperPrice: new decimal_js_1.default(decodedData[2]).div(1e8).toString(),
413
+ };
414
+ },
415
+ };
368
416
  exports.morphoBluePriceTrigger = {
369
417
  encode(oracle, collateralToken, loanToken, price, priceState) {
370
418
  const _price = new decimal_js_1.default(price.toString()).mul(1e8).floor().toString();
@@ -383,3 +431,17 @@ exports.morphoBluePriceTrigger = {
383
431
  };
384
432
  },
385
433
  };
434
+ exports.fluidRatioTrigger = {
435
+ encode(nftId, ratioPercentage, ratioState) {
436
+ const ratioWei = (0, utils_1.ratioPercentageToWei)(ratioPercentage);
437
+ return [web3_eth_abi_1.default.encodeParameters(['uint256', 'uint256', 'uint8'], [nftId, ratioWei, ratioState])];
438
+ },
439
+ decode(triggerData) {
440
+ const decodedData = web3_eth_abi_1.default.decodeParameters(['uint256', 'uint256', 'uint8'], triggerData[0]);
441
+ return {
442
+ nftId: decodedData[0],
443
+ ratio: (0, utils_1.weiToRatioPercentage)(decodedData[1]),
444
+ ratioState: Number(decodedData[2]),
445
+ };
446
+ },
447
+ };
@@ -1,5 +1,5 @@
1
1
  import type { EthereumAddress } from '../types';
2
- import { ChainId, RatioState } from '../types/enums';
2
+ import { ChainId, CloseStrategyType, CloseToAssetType, RatioState } from '../types/enums';
3
3
  export declare function isDefined<T>(value: T): value is NonNullable<T>;
4
4
  export declare function isUndefined(value: unknown): boolean;
5
5
  export declare function compareAddresses(firstAddress: EthereumAddress, secondAddress: EthereumAddress): boolean;
@@ -23,3 +23,8 @@ export declare function getRatioStateInfoForAaveCloseStrategy(currentRatioState:
23
23
  ratioState: RatioState;
24
24
  };
25
25
  export declare function getPositionId(...args: (number | string)[]): string;
26
+ export declare function getCloseStrategyType(stopLossPrice: number, stopLossType: CloseToAssetType, takeProfitPrice: number, takeProfitType: CloseToAssetType): CloseStrategyType;
27
+ export declare function getStopLossAndTakeProfitTypeByCloseStrategyType(closeStrategyType: CloseStrategyType): {
28
+ stopLossType: CloseToAssetType | undefined;
29
+ takeProfitType: CloseToAssetType | undefined;
30
+ };
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.getPositionId = exports.getRatioStateInfoForAaveCloseStrategy = exports.requireAddresses = exports.requireAddress = exports.isEmptyBytes = exports.isRatioStateUnder = exports.isRatioStateOver = exports.weiToRatioPercentage = exports.ratioPercentageToWei = exports.encodeSubId = exports.compareSubHashes = exports.wethToEthByAddress = exports.wethToEth = exports.ethToWeth = exports.addToObjectIf = exports.addToArrayIf = exports.isAddress = exports.compareAddresses = exports.isUndefined = exports.isDefined = void 0;
29
+ exports.getStopLossAndTakeProfitTypeByCloseStrategyType = exports.getCloseStrategyType = exports.getPositionId = exports.getRatioStateInfoForAaveCloseStrategy = exports.requireAddresses = exports.requireAddress = exports.isEmptyBytes = exports.isRatioStateUnder = exports.isRatioStateOver = exports.weiToRatioPercentage = exports.ratioPercentageToWei = exports.encodeSubId = exports.compareSubHashes = exports.wethToEthByAddress = exports.wethToEth = exports.ethToWeth = exports.addToObjectIf = exports.addToArrayIf = exports.isAddress = exports.compareAddresses = exports.isUndefined = exports.isDefined = void 0;
30
30
  const decimal_js_1 = __importDefault(require("decimal.js"));
31
31
  const web3Utils = __importStar(require("web3-utils"));
32
32
  const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
@@ -129,3 +129,54 @@ function getPositionId(...args) {
129
129
  return args.map(arg => arg.toString().toLowerCase().split(' ').join('_')).join('-');
130
130
  }
131
131
  exports.getPositionId = getPositionId;
132
+ function getCloseStrategyType(stopLossPrice, stopLossType, takeProfitPrice, takeProfitType) {
133
+ const isStopLoss = stopLossPrice > 0;
134
+ const isTakeProfit = takeProfitPrice > 0;
135
+ if (!isStopLoss && !isTakeProfit) {
136
+ throw new Error('CloseOnPrice: At least one price must be defined');
137
+ }
138
+ if (isStopLoss && isTakeProfit) {
139
+ if (stopLossType === enums_1.CloseToAssetType.COLLATERAL && takeProfitType === enums_1.CloseToAssetType.COLLATERAL) {
140
+ return enums_1.CloseStrategyType.TAKE_PROFIT_AND_STOP_LOSS_IN_COLLATERAL;
141
+ }
142
+ if (stopLossType === enums_1.CloseToAssetType.COLLATERAL) {
143
+ return enums_1.CloseStrategyType.TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL;
144
+ }
145
+ if (takeProfitType === enums_1.CloseToAssetType.COLLATERAL) {
146
+ return enums_1.CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL_AND_STOP_LOSS_IN_DEBT;
147
+ }
148
+ return enums_1.CloseStrategyType.TAKE_PROFIT_AND_STOP_LOSS_IN_DEBT;
149
+ }
150
+ if (isStopLoss) {
151
+ return stopLossType === enums_1.CloseToAssetType.COLLATERAL
152
+ ? enums_1.CloseStrategyType.STOP_LOSS_IN_COLLATERAL
153
+ : enums_1.CloseStrategyType.STOP_LOSS_IN_DEBT;
154
+ }
155
+ return takeProfitType === enums_1.CloseToAssetType.COLLATERAL
156
+ ? enums_1.CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL
157
+ : enums_1.CloseStrategyType.TAKE_PROFIT_IN_DEBT;
158
+ }
159
+ exports.getCloseStrategyType = getCloseStrategyType;
160
+ function getStopLossAndTakeProfitTypeByCloseStrategyType(closeStrategyType) {
161
+ switch (closeStrategyType) {
162
+ case enums_1.CloseStrategyType.STOP_LOSS_IN_COLLATERAL:
163
+ return { stopLossType: enums_1.CloseToAssetType.COLLATERAL, takeProfitType: undefined };
164
+ case enums_1.CloseStrategyType.STOP_LOSS_IN_DEBT:
165
+ return { stopLossType: enums_1.CloseToAssetType.DEBT, takeProfitType: undefined };
166
+ case enums_1.CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL:
167
+ return { stopLossType: undefined, takeProfitType: enums_1.CloseToAssetType.COLLATERAL };
168
+ case enums_1.CloseStrategyType.TAKE_PROFIT_IN_DEBT:
169
+ return { stopLossType: undefined, takeProfitType: enums_1.CloseToAssetType.DEBT };
170
+ case enums_1.CloseStrategyType.TAKE_PROFIT_IN_COLLATERAL_AND_STOP_LOSS_IN_DEBT:
171
+ return { stopLossType: enums_1.CloseToAssetType.DEBT, takeProfitType: enums_1.CloseToAssetType.COLLATERAL };
172
+ case enums_1.CloseStrategyType.TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL:
173
+ return { stopLossType: enums_1.CloseToAssetType.COLLATERAL, takeProfitType: enums_1.CloseToAssetType.DEBT };
174
+ case enums_1.CloseStrategyType.TAKE_PROFIT_AND_STOP_LOSS_IN_DEBT:
175
+ return { stopLossType: enums_1.CloseToAssetType.DEBT, takeProfitType: enums_1.CloseToAssetType.DEBT };
176
+ case enums_1.CloseStrategyType.TAKE_PROFIT_AND_STOP_LOSS_IN_COLLATERAL:
177
+ return { stopLossType: enums_1.CloseToAssetType.COLLATERAL, takeProfitType: enums_1.CloseToAssetType.COLLATERAL };
178
+ default:
179
+ throw new Error('CloseStrategyType not supported');
180
+ }
181
+ }
182
+ exports.getStopLossAndTakeProfitTypeByCloseStrategyType = getStopLossAndTakeProfitTypeByCloseStrategyType;
@@ -17,6 +17,28 @@ export declare enum BundleProtocols {
17
17
  Yearn = "yearn",
18
18
  Rari = "rari"
19
19
  }
20
+ export declare enum CollActionType {
21
+ SUPPLY = 0,
22
+ WITHDRAW = 1
23
+ }
24
+ export declare enum DebtActionType {
25
+ PAYBACK = 0,
26
+ BORROW = 1
27
+ }
28
+ export declare enum CloseStrategyType {
29
+ TAKE_PROFIT_IN_COLLATERAL = 0,
30
+ STOP_LOSS_IN_COLLATERAL = 1,
31
+ TAKE_PROFIT_IN_DEBT = 2,
32
+ STOP_LOSS_IN_DEBT = 3,
33
+ TAKE_PROFIT_AND_STOP_LOSS_IN_COLLATERAL = 4,
34
+ TAKE_PROFIT_IN_COLLATERAL_AND_STOP_LOSS_IN_DEBT = 5,
35
+ TAKE_PROFIT_AND_STOP_LOSS_IN_DEBT = 6,
36
+ TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL = 7
37
+ }
38
+ export declare enum CloseToAssetType {
39
+ COLLATERAL = 0,
40
+ DEBT = 1
41
+ }
20
42
  /**
21
43
  * @dev Follow the naming convention:
22
44
  * - Enum name consists of two parts, name and version
@@ -28,6 +50,7 @@ export declare namespace ProtocolIdentifiers {
28
50
  enum StrategiesAutomation {
29
51
  MakerDAO = "MakerDAO",
30
52
  Liquity = "Liquity",
53
+ LiquityV2 = "Liquity__V2",
31
54
  ChickenBonds = "Chicken Bonds",
32
55
  CompoundV2 = "Compound__V2",
33
56
  CompoundV3 = "Compound__V3",
@@ -37,7 +60,8 @@ export declare namespace ProtocolIdentifiers {
37
60
  Exchange = "Exchange",
38
61
  Spark = "Spark",
39
62
  CrvUSD = "CurveUSD",
40
- MorphoBlue = "MorphoBlue"
63
+ MorphoBlue = "MorphoBlue",
64
+ FluidT1 = "FluidT1"
41
65
  }
42
66
  enum LegacyAutomation {
43
67
  MakerDAO = "MakerDAO",
@@ -88,6 +112,7 @@ export declare namespace Strategies {
88
112
  CloseToCollateralWithGasPrice = "close-to-collateral-with-gas-price",
89
113
  CloseOnPriceToDebt = "close-on-price-to-debt",
90
114
  CloseOnPriceToColl = "close-on-price-to-collateral",
115
+ CloseOnPrice = "close-on-price",
91
116
  TrailingStopToColl = "trailing-stop-to-collateral",
92
117
  TrailingStopToDebt = "trailing-stop-to-debt",
93
118
  Rebond = "rebond",
@@ -153,7 +178,14 @@ export declare namespace Bundles {
153
178
  MORPHO_BLUE_EOA_BOOST = 35,
154
179
  AAVE_V3_OPEN_ORDER_FROM_COLLATERAL = 36,
155
180
  AAVE_V3_REPAY_ON_PRICE = 37,
156
- MORPHO_BLUE_BOOST_ON_PRICE = 38
181
+ MORPHO_BLUE_BOOST_ON_PRICE = 38,
182
+ LIQUITY_V2_REPAY = 39,
183
+ LIQUITY_V2_BOOST = 40,
184
+ LIQUITY_V2_CLOSE = 41,
185
+ LIQUITY_V2_REPAY_ON_PRICE = 42,
186
+ LIQUITY_V2_BOOST_ON_PRICE = 43,
187
+ FLUID_T1_REPAY = 44,
188
+ FLUID_T2_BOOST = 45
157
189
  }
158
190
  enum OptimismIds {
159
191
  AAVE_V3_REPAY = 0,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Bundles = exports.Strategies = exports.ProtocolIdentifiers = exports.BundleProtocols = exports.OrderType = exports.RatioState = exports.ChainId = void 0;
3
+ exports.Bundles = exports.Strategies = exports.ProtocolIdentifiers = exports.CloseToAssetType = exports.CloseStrategyType = exports.DebtActionType = exports.CollActionType = exports.BundleProtocols = exports.OrderType = exports.RatioState = exports.ChainId = void 0;
4
4
  var ChainId;
5
5
  (function (ChainId) {
6
6
  ChainId[ChainId["Ethereum"] = 1] = "Ethereum";
@@ -24,6 +24,32 @@ var BundleProtocols;
24
24
  BundleProtocols["Yearn"] = "yearn";
25
25
  BundleProtocols["Rari"] = "rari";
26
26
  })(BundleProtocols = exports.BundleProtocols || (exports.BundleProtocols = {}));
27
+ var CollActionType;
28
+ (function (CollActionType) {
29
+ CollActionType[CollActionType["SUPPLY"] = 0] = "SUPPLY";
30
+ CollActionType[CollActionType["WITHDRAW"] = 1] = "WITHDRAW";
31
+ })(CollActionType = exports.CollActionType || (exports.CollActionType = {}));
32
+ var DebtActionType;
33
+ (function (DebtActionType) {
34
+ DebtActionType[DebtActionType["PAYBACK"] = 0] = "PAYBACK";
35
+ DebtActionType[DebtActionType["BORROW"] = 1] = "BORROW";
36
+ })(DebtActionType = exports.DebtActionType || (exports.DebtActionType = {}));
37
+ var CloseStrategyType;
38
+ (function (CloseStrategyType) {
39
+ CloseStrategyType[CloseStrategyType["TAKE_PROFIT_IN_COLLATERAL"] = 0] = "TAKE_PROFIT_IN_COLLATERAL";
40
+ CloseStrategyType[CloseStrategyType["STOP_LOSS_IN_COLLATERAL"] = 1] = "STOP_LOSS_IN_COLLATERAL";
41
+ CloseStrategyType[CloseStrategyType["TAKE_PROFIT_IN_DEBT"] = 2] = "TAKE_PROFIT_IN_DEBT";
42
+ CloseStrategyType[CloseStrategyType["STOP_LOSS_IN_DEBT"] = 3] = "STOP_LOSS_IN_DEBT";
43
+ CloseStrategyType[CloseStrategyType["TAKE_PROFIT_AND_STOP_LOSS_IN_COLLATERAL"] = 4] = "TAKE_PROFIT_AND_STOP_LOSS_IN_COLLATERAL";
44
+ CloseStrategyType[CloseStrategyType["TAKE_PROFIT_IN_COLLATERAL_AND_STOP_LOSS_IN_DEBT"] = 5] = "TAKE_PROFIT_IN_COLLATERAL_AND_STOP_LOSS_IN_DEBT";
45
+ CloseStrategyType[CloseStrategyType["TAKE_PROFIT_AND_STOP_LOSS_IN_DEBT"] = 6] = "TAKE_PROFIT_AND_STOP_LOSS_IN_DEBT";
46
+ CloseStrategyType[CloseStrategyType["TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL"] = 7] = "TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL";
47
+ })(CloseStrategyType = exports.CloseStrategyType || (exports.CloseStrategyType = {}));
48
+ var CloseToAssetType;
49
+ (function (CloseToAssetType) {
50
+ CloseToAssetType[CloseToAssetType["COLLATERAL"] = 0] = "COLLATERAL";
51
+ CloseToAssetType[CloseToAssetType["DEBT"] = 1] = "DEBT";
52
+ })(CloseToAssetType = exports.CloseToAssetType || (exports.CloseToAssetType = {}));
27
53
  /**
28
54
  * @dev Follow the naming convention:
29
55
  * - Enum name consists of two parts, name and version
@@ -37,6 +63,7 @@ var ProtocolIdentifiers;
37
63
  (function (StrategiesAutomation) {
38
64
  StrategiesAutomation["MakerDAO"] = "MakerDAO";
39
65
  StrategiesAutomation["Liquity"] = "Liquity";
66
+ StrategiesAutomation["LiquityV2"] = "Liquity__V2";
40
67
  StrategiesAutomation["ChickenBonds"] = "Chicken Bonds";
41
68
  StrategiesAutomation["CompoundV2"] = "Compound__V2";
42
69
  StrategiesAutomation["CompoundV3"] = "Compound__V3";
@@ -47,6 +74,7 @@ var ProtocolIdentifiers;
47
74
  StrategiesAutomation["Spark"] = "Spark";
48
75
  StrategiesAutomation["CrvUSD"] = "CurveUSD";
49
76
  StrategiesAutomation["MorphoBlue"] = "MorphoBlue";
77
+ StrategiesAutomation["FluidT1"] = "FluidT1";
50
78
  })(StrategiesAutomation = ProtocolIdentifiers.StrategiesAutomation || (ProtocolIdentifiers.StrategiesAutomation = {}));
51
79
  let LegacyAutomation;
52
80
  (function (LegacyAutomation) {
@@ -104,6 +132,7 @@ var Strategies;
104
132
  Identifiers["CloseToCollateralWithGasPrice"] = "close-to-collateral-with-gas-price";
105
133
  Identifiers["CloseOnPriceToDebt"] = "close-on-price-to-debt";
106
134
  Identifiers["CloseOnPriceToColl"] = "close-on-price-to-collateral";
135
+ Identifiers["CloseOnPrice"] = "close-on-price";
107
136
  Identifiers["TrailingStopToColl"] = "trailing-stop-to-collateral";
108
137
  Identifiers["TrailingStopToDebt"] = "trailing-stop-to-debt";
109
138
  Identifiers["Rebond"] = "rebond";
@@ -173,6 +202,13 @@ var Bundles;
173
202
  MainnetIds[MainnetIds["AAVE_V3_OPEN_ORDER_FROM_COLLATERAL"] = 36] = "AAVE_V3_OPEN_ORDER_FROM_COLLATERAL";
174
203
  MainnetIds[MainnetIds["AAVE_V3_REPAY_ON_PRICE"] = 37] = "AAVE_V3_REPAY_ON_PRICE";
175
204
  MainnetIds[MainnetIds["MORPHO_BLUE_BOOST_ON_PRICE"] = 38] = "MORPHO_BLUE_BOOST_ON_PRICE";
205
+ MainnetIds[MainnetIds["LIQUITY_V2_REPAY"] = 39] = "LIQUITY_V2_REPAY";
206
+ MainnetIds[MainnetIds["LIQUITY_V2_BOOST"] = 40] = "LIQUITY_V2_BOOST";
207
+ MainnetIds[MainnetIds["LIQUITY_V2_CLOSE"] = 41] = "LIQUITY_V2_CLOSE";
208
+ MainnetIds[MainnetIds["LIQUITY_V2_REPAY_ON_PRICE"] = 42] = "LIQUITY_V2_REPAY_ON_PRICE";
209
+ MainnetIds[MainnetIds["LIQUITY_V2_BOOST_ON_PRICE"] = 43] = "LIQUITY_V2_BOOST_ON_PRICE";
210
+ MainnetIds[MainnetIds["FLUID_T1_REPAY"] = 44] = "FLUID_T1_REPAY";
211
+ MainnetIds[MainnetIds["FLUID_T2_BOOST"] = 45] = "FLUID_T2_BOOST";
176
212
  })(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
177
213
  let OptimismIds;
178
214
  (function (OptimismIds) {
@@ -2,7 +2,7 @@ import type Web3 from 'web3';
2
2
  import type { AbiItem } from 'web3-utils';
3
3
  import type { BaseContract, BlockType } from './contracts/generated/types';
4
4
  import type { Subscribe, StrategyModel } from './contracts/generated/SubStorage';
5
- import type { ChainId, Strategies, Bundles, ProtocolIdentifiers, RatioState } from './enums';
5
+ import type { ChainId, Strategies, Bundles, ProtocolIdentifiers, RatioState, CloseToAssetType } from './enums';
6
6
  export type PlaceholderType = any;
7
7
  export type EthereumAddress = string;
8
8
  export type BlockNumber = BlockType;
@@ -69,7 +69,7 @@ export declare namespace Interfaces {
69
69
  }
70
70
  interface Automation {
71
71
  provider: Web3;
72
- providerFork: Web3;
72
+ providerFork?: Web3;
73
73
  }
74
74
  interface LegacyAutomation<T extends BaseContract> {
75
75
  provider: Web3;
@@ -138,6 +138,15 @@ export declare namespace Position {
138
138
  maximumGasPrice: string;
139
139
  ratioState: RatioState;
140
140
  }
141
+ interface CloseOnPriceLiquityV2 extends Base {
142
+ market: EthereumAddress;
143
+ troveId: string;
144
+ stopLossPrice: string;
145
+ takeProfitPrice: string;
146
+ closeToAssetAddr: EthereumAddress;
147
+ stopLossType: CloseToAssetType | undefined;
148
+ takeProfitType: CloseToAssetType | undefined;
149
+ }
141
150
  interface TrailingStop extends Base {
142
151
  roundId: number;
143
152
  triggerPercentage: number;
@@ -152,7 +161,7 @@ export declare namespace Position {
152
161
  subHashRepay?: string;
153
162
  }
154
163
  }
155
- type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.BoostOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD | Specific.BoostOnPriceMorpho;
164
+ type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.BoostOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD | Specific.CloseOnPriceLiquityV2 | Specific.BoostOnPriceMorpho;
156
165
  interface Automated {
157
166
  chainId: ChainId;
158
167
  positionId: string;
@@ -6,12 +6,12 @@ import type { ChainId } from '../../types/enums';
6
6
  import Automation from './Automation';
7
7
  interface IStrategiesAutomation extends Interfaces.Automation {
8
8
  chainId: ChainId;
9
- providerFork: Web3;
9
+ providerFork?: Web3;
10
10
  }
11
11
  export default class StrategiesAutomation extends Automation {
12
12
  protected chainId: ChainId;
13
13
  protected web3: Web3;
14
- protected web3Fork: Web3;
14
+ protected web3Fork?: Web3;
15
15
  protected subStorageContract: Contract.WithMeta<SubStorage>;
16
16
  protected subStorageContractFork: Contract.WithMeta<SubStorage> | null;
17
17
  constructor(args: IStrategiesAutomation);
@@ -0,0 +1 @@
1
+ import '../../configuration';
@@ -0,0 +1,56 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import Web3 from 'web3';
11
+ import '../../configuration';
12
+ import EthereumStrategies from './EthereumStrategies';
13
+ import ArbitrumStrategies from './ArbitrumStrategies';
14
+ import OptimismStrategies from './OptimismStrategies';
15
+ import BaseStrategies from './BaseStrategies';
16
+ require('dotenv').config({ path: '.env' });
17
+ const Web3_1 = new Web3(process.env.RPC_1);
18
+ const Web3_42161 = new Web3(process.env.RPC_42161);
19
+ const Web3_10 = new Web3(process.env.RPC_10);
20
+ const Web3_8453 = new Web3(process.env.RPC_8453);
21
+ describe('Feature: StrategiesAutomation.ts', () => {
22
+ describe('Fetching subscriptions', () => {
23
+ it('can fetch subscriptions on Mainnet', function () {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ this.timeout(120000);
26
+ const ethStrategies = new EthereumStrategies({ provider: Web3_1 });
27
+ const subs = yield ethStrategies.getSubscriptions({ mergeSubs: true });
28
+ console.log(subs.length);
29
+ });
30
+ });
31
+ it('can fetch subscriptions on Arbitrum', function () {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ this.timeout(120000);
34
+ const arbiStrategies = new ArbitrumStrategies({ provider: Web3_42161 });
35
+ const subs = yield arbiStrategies.getSubscriptions({ mergeSubs: true });
36
+ console.log(subs.length);
37
+ });
38
+ });
39
+ it('can fetch subscriptions on Optimism', function () {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ this.timeout(120000);
42
+ const optimismStrategies = new OptimismStrategies({ provider: Web3_10 });
43
+ const subs = yield optimismStrategies.getSubscriptions({ mergeSubs: true });
44
+ console.log(subs.length);
45
+ });
46
+ });
47
+ it('can fetch subscriptions on Base', function () {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ this.timeout(120000);
50
+ const baseStrategies = new BaseStrategies({ provider: Web3_8453 });
51
+ const subs = yield baseStrategies.getSubscriptions({ mergeSubs: true });
52
+ console.log(subs.length);
53
+ });
54
+ });
55
+ });
56
+ });
@@ -347,11 +347,46 @@ export const MAINNET_BUNDLES_INFO = {
347
347
  strategyId: Strategies.Identifiers.RepayOnPrice,
348
348
  protocol: PROTOCOLS.AaveV3,
349
349
  },
350
+ [Bundles.MainnetIds.LIQUITY_V2_REPAY]: {
351
+ strategyOrBundleId: Bundles.MainnetIds.LIQUITY_V2_REPAY,
352
+ strategyId: Strategies.Identifiers.Repay,
353
+ protocol: PROTOCOLS.LiquityV2,
354
+ },
355
+ [Bundles.MainnetIds.LIQUITY_V2_BOOST]: {
356
+ strategyOrBundleId: Bundles.MainnetIds.LIQUITY_V2_BOOST,
357
+ strategyId: Strategies.Identifiers.Boost,
358
+ protocol: PROTOCOLS.LiquityV2,
359
+ },
360
+ [Bundles.MainnetIds.LIQUITY_V2_CLOSE]: {
361
+ strategyOrBundleId: Bundles.MainnetIds.LIQUITY_V2_CLOSE,
362
+ strategyId: Strategies.Identifiers.CloseOnPrice,
363
+ protocol: PROTOCOLS.LiquityV2,
364
+ },
365
+ [Bundles.MainnetIds.LIQUITY_V2_REPAY_ON_PRICE]: {
366
+ strategyOrBundleId: Bundles.MainnetIds.LIQUITY_V2_REPAY_ON_PRICE,
367
+ strategyId: Strategies.Identifiers.OpenOrderFromCollateral,
368
+ protocol: PROTOCOLS.LiquityV2,
369
+ },
370
+ [Bundles.MainnetIds.LIQUITY_V2_BOOST_ON_PRICE]: {
371
+ strategyOrBundleId: Bundles.MainnetIds.LIQUITY_V2_BOOST_ON_PRICE,
372
+ strategyId: Strategies.Identifiers.RepayOnPrice,
373
+ protocol: PROTOCOLS.LiquityV2,
374
+ },
350
375
  [Bundles.MainnetIds.MORPHO_BLUE_BOOST_ON_PRICE]: {
351
376
  strategyOrBundleId: Bundles.MainnetIds.MORPHO_BLUE_BOOST_ON_PRICE,
352
377
  strategyId: Strategies.Identifiers.BoostOnPrice,
353
378
  protocol: PROTOCOLS.MorphoBlue,
354
379
  },
380
+ [Bundles.MainnetIds.FLUID_T1_REPAY]: {
381
+ strategyOrBundleId: Bundles.MainnetIds.FLUID_T1_REPAY,
382
+ strategyId: Strategies.Identifiers.Repay,
383
+ protocol: PROTOCOLS.FluidT1,
384
+ },
385
+ [Bundles.MainnetIds.FLUID_T2_BOOST]: {
386
+ strategyOrBundleId: Bundles.MainnetIds.FLUID_T2_BOOST,
387
+ strategyId: Strategies.Identifiers.Boost,
388
+ protocol: PROTOCOLS.FluidT1,
389
+ },
355
390
  };
356
391
  export const OPTIMISM_BUNDLES_INFO = {
357
392
  [Bundles.OptimismIds.AAVE_V3_REPAY]: {
@@ -3,7 +3,7 @@ import { cloneDeep } from 'lodash';
3
3
  import Web3 from 'web3';
4
4
  import { BUNDLES_INFO, STRATEGIES_INFO } from '../constants';
5
5
  import { ChainId, ProtocolIdentifiers, Strategies } from '../types/enums';
6
- import { getPositionId, getRatioStateInfoForAaveCloseStrategy, isRatioStateOver, wethToEthByAddress, } from './utils';
6
+ import { getPositionId, getRatioStateInfoForAaveCloseStrategy, getStopLossAndTakeProfitTypeByCloseStrategyType, isRatioStateOver, wethToEthByAddress, } from './utils';
7
7
  import * as subDataService from './subDataService';
8
8
  import * as triggerService from './triggerService';
9
9
  const web3 = new Web3();
@@ -405,6 +405,39 @@ function parseLiquityLeverageManagement(position, parseData) {
405
405
  _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
406
406
  return _position;
407
407
  }
408
+ function parseLiquityV2LeverageManagement(position, parseData) {
409
+ const _position = cloneDeep(position);
410
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
411
+ const { isEnabled } = parseData.strategiesSubsData;
412
+ const triggerData = triggerService.liquityV2RatioTrigger.decode(subStruct.triggerData);
413
+ const subData = subDataService.liquityV2LeverageManagementSubData.decode(subStruct.subData);
414
+ _position.strategyData.decoded.triggerData = triggerData;
415
+ _position.strategyData.decoded.subData = subData;
416
+ _position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.troveId, triggerData.market);
417
+ const isRepay = _position.strategy.strategyId === Strategies.Identifiers.Repay;
418
+ if (isRepay) {
419
+ _position.specific = {
420
+ triggerRepayRatio: triggerData.ratio,
421
+ targetRepayRatio: subData.targetRatio,
422
+ repayEnabled: isEnabled,
423
+ subId1: Number(subId),
424
+ subHashRepay: subHash,
425
+ mergeWithId: Strategies.Identifiers.Boost,
426
+ };
427
+ }
428
+ else {
429
+ _position.specific = {
430
+ triggerBoostRatio: triggerData.ratio,
431
+ targetBoostRatio: subData.targetRatio,
432
+ boostEnabled: isEnabled,
433
+ subId2: Number(subId),
434
+ subHashBoost: subHash,
435
+ mergeId: Strategies.Identifiers.Boost,
436
+ };
437
+ }
438
+ _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
439
+ return _position;
440
+ }
408
441
  function parseSparkLeverageManagement(position, parseData) {
409
442
  const _position = cloneDeep(position);
410
443
  const { subStruct, subId } = parseData.subscriptionEventData;
@@ -613,6 +646,85 @@ function parseAaveV3LeverageManagementOnPrice(position, parseData) {
613
646
  };
614
647
  return _position;
615
648
  }
649
+ function parseLiquityV2CloseOnPrice(position, parseData) {
650
+ const _position = cloneDeep(position);
651
+ const { subStruct } = parseData.subscriptionEventData;
652
+ const triggerData = triggerService.closePriceTrigger.decode(subStruct.triggerData);
653
+ const subData = subDataService.liquityV2CloseSubData.decode(subStruct.subData);
654
+ _position.strategyData.decoded.triggerData = triggerData;
655
+ _position.strategyData.decoded.subData = subData;
656
+ _position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, subData.troveId, subData.market);
657
+ const { takeProfitType, stopLossType } = getStopLossAndTakeProfitTypeByCloseStrategyType(+subData.closeType);
658
+ // User can have:
659
+ // - Only TakeProfit
660
+ // - Only StopLoss
661
+ // - Both
662
+ // TODO: see on frontend what specific data we need here because stop-loss and take-profit is one bundle now
663
+ _position.strategy.strategyId = Strategies.Identifiers.CloseOnPrice;
664
+ _position.specific = {
665
+ market: subData.market,
666
+ troveId: subData.troveId,
667
+ stopLossPrice: triggerData.lowerPrice,
668
+ takeProfitPrice: triggerData.upperPrice,
669
+ closeToAssetAddr: triggerData.tokenAddr,
670
+ takeProfitType,
671
+ stopLossType,
672
+ };
673
+ return _position;
674
+ }
675
+ function parseLiquityV2LeverageManagementOnPrice(position, parseData) {
676
+ const _position = cloneDeep(position);
677
+ const { subStruct } = parseData.subscriptionEventData;
678
+ const triggerData = triggerService.liquityV2QuotePriceTrigger.decode(subStruct.triggerData);
679
+ const subData = subDataService.liquityV2LeverageManagementOnPriceSubData.decode(subStruct.subData);
680
+ _position.strategyData.decoded.triggerData = triggerData;
681
+ _position.strategyData.decoded.subData = subData;
682
+ _position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, Math.random());
683
+ /// @TODO: what does even go here
684
+ /*
685
+ _position.specific = {
686
+ market: subData.market,
687
+ troveId: subData.troveId,
688
+ ratio: subData.targetRatio,
689
+ price: triggerData.price,
690
+ ratioState: triggerData.ratioState,
691
+ };
692
+ */
693
+ return _position;
694
+ }
695
+ function parseFluidT1LeverageManagement(position, parseData) {
696
+ const _position = cloneDeep(position);
697
+ const { subStruct, subId, subHash } = parseData.subscriptionEventData;
698
+ const { isEnabled } = parseData.strategiesSubsData;
699
+ const triggerData = triggerService.fluidRatioTrigger.decode(subStruct.triggerData);
700
+ const subData = subDataService.fluidLeverageManagementSubData.decode(subStruct.subData);
701
+ _position.strategyData.decoded.triggerData = triggerData;
702
+ _position.strategyData.decoded.subData = subData;
703
+ _position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.nftId, subData.vault);
704
+ const isRepay = _position.strategy.strategyId === Strategies.Identifiers.Repay;
705
+ if (isRepay) {
706
+ _position.specific = {
707
+ triggerRepayRatio: triggerData.ratio,
708
+ targetRepayRatio: subData.targetRatio,
709
+ repayEnabled: isEnabled,
710
+ subId1: Number(subId),
711
+ subHashRepay: subHash,
712
+ mergeWithId: Strategies.Identifiers.Boost,
713
+ };
714
+ }
715
+ else {
716
+ _position.specific = {
717
+ triggerBoostRatio: triggerData.ratio,
718
+ targetBoostRatio: subData.targetRatio,
719
+ boostEnabled: isEnabled,
720
+ subId2: Number(subId),
721
+ subHashBoost: subHash,
722
+ mergeId: Strategies.Identifiers.Boost,
723
+ };
724
+ }
725
+ _position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
726
+ return _position;
727
+ }
616
728
  const parsingMethodsMapping = {
617
729
  [ProtocolIdentifiers.StrategiesAutomation.MakerDAO]: {
618
730
  [Strategies.Identifiers.SavingsLiqProtection]: parseMakerSavingsLiqProtection,
@@ -633,6 +745,13 @@ const parsingMethodsMapping = {
633
745
  [Strategies.Identifiers.SavingsDsrSupply]: parseLiquitySavingsLiqProtection,
634
746
  [Strategies.Identifiers.DebtInFrontRepay]: parseLiquityDebtInFrontRepay,
635
747
  },
748
+ [ProtocolIdentifiers.StrategiesAutomation.LiquityV2]: {
749
+ [Strategies.Identifiers.Repay]: parseLiquityV2LeverageManagement,
750
+ [Strategies.Identifiers.Boost]: parseLiquityV2LeverageManagement,
751
+ [Strategies.Identifiers.CloseOnPrice]: parseLiquityV2CloseOnPrice,
752
+ [Strategies.Identifiers.OpenOrderFromCollateral]: parseLiquityV2LeverageManagementOnPrice,
753
+ [Strategies.Identifiers.RepayOnPrice]: parseLiquityV2LeverageManagementOnPrice,
754
+ },
636
755
  [ProtocolIdentifiers.StrategiesAutomation.AaveV2]: {
637
756
  [Strategies.Identifiers.Repay]: parseAaveV2LeverageManagement,
638
757
  [Strategies.Identifiers.Boost]: parseAaveV2LeverageManagement,
@@ -686,6 +805,10 @@ const parsingMethodsMapping = {
686
805
  [Strategies.Identifiers.EoaBoost]: parseMorphoBlueLeverageManagement,
687
806
  [Strategies.Identifiers.BoostOnPrice]: parseMorphoBlueLeverageManagementOnPrice,
688
807
  },
808
+ [ProtocolIdentifiers.StrategiesAutomation.FluidT1]: {
809
+ [Strategies.Identifiers.Repay]: parseFluidT1LeverageManagement,
810
+ [Strategies.Identifiers.Boost]: parseFluidT1LeverageManagement,
811
+ },
689
812
  };
690
813
  function getParsingMethod(id, strategy) {
691
814
  return parsingMethodsMapping[id][strategy.strategyId];
@@ -1,5 +1,5 @@
1
1
  import type { OrderType } from '../types/enums';
2
- import { Bundles, ChainId, RatioState, Strategies } from '../types/enums';
2
+ import { CloseToAssetType, Bundles, ChainId, RatioState, Strategies } from '../types/enums';
3
3
  import type { EthereumAddress, StrategyOrBundleIds } from '../types';
4
4
  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)[];
@@ -99,3 +99,11 @@ export declare const morphoBlueEncode: {
99
99
  leverageManagement(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress, isEOA: boolean, network: ChainId): (boolean | string[] | Bundles.MainnetIds)[] | (boolean | string[] | Bundles.BaseIds)[];
100
100
  leverageManagementOnPrice(strategyOrBundleId: number, isBundle: boolean | undefined, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, user: EthereumAddress, targetRatio: number, price: number, priceState: RatioState): (number | boolean | string[])[];
101
101
  };
102
+ export declare const liquityV2Encode: {
103
+ leverageManagement(market: EthereumAddress, troveId: string, collToken: EthereumAddress, boldToken: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number, strategyOrBundleId: number): (number | boolean | string[])[];
104
+ closeOnPrice(strategyOrBundleId: number, market: EthereumAddress, troveId: string, collToken: EthereumAddress, boldToken: EthereumAddress, stopLossPrice?: number, stopLossType?: CloseToAssetType, takeProfitPrice?: number, takeProfitType?: CloseToAssetType): (number | boolean | string[])[];
105
+ leverageManagementOnPrice(strategyOrBundleId: number, market: EthereumAddress, price: number, state: RatioState, troveId: string, collToken: EthereumAddress, boldToken: EthereumAddress, targetRatio: number, isRepayOnPrice: boolean): (number | boolean | string[])[];
106
+ };
107
+ export declare const fluidEncode: {
108
+ leverageManagement(nftId: string, vault: EthereumAddress, collToken: EthereumAddress, debtToken: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number, strategyOrBundleId: number): (number | boolean | string[])[];
109
+ };