@defisaver/automation-sdk 3.3.2-dev.8 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -208,7 +208,7 @@ function parseAaveV3LeverageManagement(position, parseData) {
208
208
  _position.specific = {
209
209
  triggerRepayRatio: triggerData.ratio,
210
210
  targetRepayRatio: subData.targetRatio,
211
- repayEnabled: true,
211
+ repayEnabled: isEnabled,
212
212
  subId1: Number(subId),
213
213
  mergeWithId: isEOA ? enums_1.Strategies.Identifiers.EoaBoost : enums_1.Strategies.Identifiers.Boost,
214
214
  subHashRepay: subHash,
@@ -268,6 +268,7 @@ function parseAaveV3CloseOnPrice(position, parseData) {
268
268
  if (isEOA) {
269
269
  const triggerData = triggerService.aaveV3QuotePriceRangeTrigger.decode(subStruct.triggerData);
270
270
  const subData = subDataService.aaveV3CloseGenericSubData.decode(subStruct.subData);
271
+ const { takeProfitType, stopLossType } = (0, utils_1.getStopLossAndTakeProfitTypeByCloseStrategyType)(+subData.closeType);
271
272
  _position.strategyData.decoded.triggerData = triggerData;
272
273
  _position.strategyData.decoded.subData = subData;
273
274
  _position.specific = {
@@ -279,6 +280,8 @@ function parseAaveV3CloseOnPrice(position, parseData) {
279
280
  quoteToken: triggerData.debtToken,
280
281
  stopLossPrice: triggerData.lowerPrice,
281
282
  takeProfitPrice: triggerData.upperPrice,
283
+ stopLossType,
284
+ takeProfitType,
282
285
  };
283
286
  _position.strategy.strategyId = enums_1.Strategies.Identifiers.EoaCloseOnPrice;
284
287
  }
@@ -221,7 +221,6 @@ var Bundles;
221
221
  MainnetIds[MainnetIds["COMP_V3_EOA_REPAY_ON_PRICE"] = 49] = "COMP_V3_EOA_REPAY_ON_PRICE";
222
222
  MainnetIds[MainnetIds["COMP_V3_EOA_BOOST_ON_PRICE"] = 50] = "COMP_V3_EOA_BOOST_ON_PRICE";
223
223
  MainnetIds[MainnetIds["COMP_V3_EOA_CLOSE"] = 51] = "COMP_V3_EOA_CLOSE";
224
- // TODO -> Watch out for Liquity V2 Strategy deploy, should change IDs or here or there !!!
225
224
  MainnetIds[MainnetIds["AAVE_V3_EOA_REPAY"] = 52] = "AAVE_V3_EOA_REPAY";
226
225
  MainnetIds[MainnetIds["AAVE_V3_EOA_BOOST"] = 53] = "AAVE_V3_EOA_BOOST";
227
226
  MainnetIds[MainnetIds["AAVE_V3_EOA_REPAY_ON_PRICE"] = 54] = "AAVE_V3_EOA_REPAY_ON_PRICE";
@@ -179,7 +179,7 @@ function parseAaveV3LeverageManagement(position, parseData) {
179
179
  _position.specific = {
180
180
  triggerRepayRatio: triggerData.ratio,
181
181
  targetRepayRatio: subData.targetRatio,
182
- repayEnabled: true,
182
+ repayEnabled: isEnabled,
183
183
  subId1: Number(subId),
184
184
  mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
185
185
  subHashRepay: subHash,
@@ -239,6 +239,7 @@ function parseAaveV3CloseOnPrice(position, parseData) {
239
239
  if (isEOA) {
240
240
  const triggerData = triggerService.aaveV3QuotePriceRangeTrigger.decode(subStruct.triggerData);
241
241
  const subData = subDataService.aaveV3CloseGenericSubData.decode(subStruct.subData);
242
+ const { takeProfitType, stopLossType } = getStopLossAndTakeProfitTypeByCloseStrategyType(+subData.closeType);
242
243
  _position.strategyData.decoded.triggerData = triggerData;
243
244
  _position.strategyData.decoded.subData = subData;
244
245
  _position.specific = {
@@ -250,6 +251,8 @@ function parseAaveV3CloseOnPrice(position, parseData) {
250
251
  quoteToken: triggerData.debtToken,
251
252
  stopLossPrice: triggerData.lowerPrice,
252
253
  takeProfitPrice: triggerData.upperPrice,
254
+ stopLossType,
255
+ takeProfitType,
253
256
  };
254
257
  _position.strategy.strategyId = Strategies.Identifiers.EoaCloseOnPrice;
255
258
  }
@@ -218,7 +218,6 @@ export var Bundles;
218
218
  MainnetIds[MainnetIds["COMP_V3_EOA_REPAY_ON_PRICE"] = 49] = "COMP_V3_EOA_REPAY_ON_PRICE";
219
219
  MainnetIds[MainnetIds["COMP_V3_EOA_BOOST_ON_PRICE"] = 50] = "COMP_V3_EOA_BOOST_ON_PRICE";
220
220
  MainnetIds[MainnetIds["COMP_V3_EOA_CLOSE"] = 51] = "COMP_V3_EOA_CLOSE";
221
- // TODO -> Watch out for Liquity V2 Strategy deploy, should change IDs or here or there !!!
222
221
  MainnetIds[MainnetIds["AAVE_V3_EOA_REPAY"] = 52] = "AAVE_V3_EOA_REPAY";
223
222
  MainnetIds[MainnetIds["AAVE_V3_EOA_BOOST"] = 53] = "AAVE_V3_EOA_BOOST";
224
223
  MainnetIds[MainnetIds["AAVE_V3_EOA_REPAY_ON_PRICE"] = 54] = "AAVE_V3_EOA_REPAY_ON_PRICE";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defisaver/automation-sdk",
3
- "version": "3.3.2-dev.8",
3
+ "version": "3.3.2",
4
4
  "description": "",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./esm/index.js",
@@ -23,7 +23,7 @@
23
23
  "repository": "https://github.com/defisaver/automation-sdk",
24
24
  "license": "ISC",
25
25
  "dependencies": {
26
- "@defisaver/sdk": "1.3.6-dev.3",
26
+ "@defisaver/sdk": "^1.3.9",
27
27
  "@defisaver/tokens": "^1.6.19",
28
28
  "@ethersproject/address": "^5.0.10",
29
29
  "@ethersproject/solidity": "^5.0.9",
@@ -254,7 +254,7 @@ function parseAaveV3LeverageManagement(position: Position.Automated, parseData:
254
254
  _position.specific = {
255
255
  triggerRepayRatio: triggerData.ratio,
256
256
  targetRepayRatio: subData.targetRatio,
257
- repayEnabled: true,
257
+ repayEnabled: isEnabled,
258
258
  subId1: Number(subId),
259
259
  mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
260
260
  subHashRepay: subHash,
@@ -323,6 +323,8 @@ function parseAaveV3CloseOnPrice(position: Position.Automated, parseData: ParseD
323
323
  const triggerData = triggerService.aaveV3QuotePriceRangeTrigger.decode(subStruct.triggerData);
324
324
  const subData = subDataService.aaveV3CloseGenericSubData.decode(subStruct.subData);
325
325
 
326
+ const { takeProfitType, stopLossType } = getStopLossAndTakeProfitTypeByCloseStrategyType(+subData.closeType);
327
+
326
328
  _position.strategyData.decoded.triggerData = triggerData;
327
329
  _position.strategyData.decoded.subData = subData;
328
330
 
@@ -335,6 +337,8 @@ function parseAaveV3CloseOnPrice(position: Position.Automated, parseData: ParseD
335
337
  quoteToken: triggerData.debtToken,
336
338
  stopLossPrice: triggerData.lowerPrice,
337
339
  takeProfitPrice: triggerData.upperPrice,
340
+ stopLossType,
341
+ takeProfitType,
338
342
  };
339
343
 
340
344
  _position.strategy.strategyId = Strategies.Identifiers.EoaCloseOnPrice;
@@ -213,7 +213,6 @@ export namespace Bundles {
213
213
  COMP_V3_EOA_REPAY_ON_PRICE = 49,
214
214
  COMP_V3_EOA_BOOST_ON_PRICE = 50,
215
215
  COMP_V3_EOA_CLOSE = 51,
216
- // TODO -> Watch out for Liquity V2 Strategy deploy, should change IDs or here or there !!!
217
216
  AAVE_V3_EOA_REPAY = 52,
218
217
  AAVE_V3_EOA_BOOST = 53,
219
218
  AAVE_V3_EOA_REPAY_ON_PRICE = 54,
@@ -124,26 +124,6 @@ export declare namespace Position {
124
124
  mergeWithId?: Strategies.Identifiers,
125
125
  mergeId?: Strategies.Identifiers
126
126
  }
127
- // TODO -> Prob should be better to type it something like this
128
- // type RatioProtection =
129
- // | (Base & {
130
- // triggerRepayRatio: number
131
- // targetRepayRatio: number
132
- // repayEnabled: boolean
133
-
134
- // triggerBoostRatio?: never
135
- // targetBoostRatio?: never
136
- // boostEnabled?: never
137
- // })
138
- // | (Base & {
139
- // triggerBoostRatio: number
140
- // targetBoostRatio: number
141
- // boostEnabled: boolean
142
-
143
- // triggerRepayRatio?: never
144
- // targetRepayRatio?: never
145
- // repayEnabled?: never
146
- // });
147
127
  interface RatioProtection extends Base {
148
128
  triggerRepayRatio?: number,
149
129
  targetRepayRatio?: number,