@defisaver/automation-sdk 3.3.2-dev.2 → 3.3.2-dev.4
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.
- package/cjs/services/strategiesService.js +83 -59
- package/cjs/types/index.d.ts +11 -1
- package/esm/services/strategiesService.js +83 -59
- package/esm/types/index.d.ts +11 -1
- package/package.json +2 -2
- package/src/services/strategiesService.ts +104 -81
- package/src/types/index.ts +14 -1
|
@@ -192,13 +192,17 @@ function parseAaveV3LeverageManagement(position, parseData) {
|
|
|
192
192
|
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
193
193
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
194
194
|
const triggerData = triggerService.aaveV3RatioTrigger.decode(subStruct.triggerData);
|
|
195
|
-
const
|
|
195
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
196
|
+
let subData;
|
|
197
|
+
if (isEOA) {
|
|
198
|
+
subData = subDataService.aaveV3LeverageManagementSubDataWithoutSubProxy.decode(subStruct.subData);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
subData = subDataService.aaveV3LeverageManagementSubData.decode(subStruct.subData);
|
|
202
|
+
}
|
|
196
203
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
197
204
|
_position.strategyData.decoded.subData = subData;
|
|
198
205
|
_position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, triggerData.market);
|
|
199
|
-
// TODO -> check if this change breaks something?
|
|
200
|
-
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
201
|
-
// TODO -> check if this change breaks something?
|
|
202
206
|
const isRepay = [enums_1.Strategies.Identifiers.Repay, enums_1.Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
|
|
203
207
|
if (isRepay) {
|
|
204
208
|
_position.specific = {
|
|
@@ -206,8 +210,8 @@ function parseAaveV3LeverageManagement(position, parseData) {
|
|
|
206
210
|
targetRepayRatio: subData.targetRatio,
|
|
207
211
|
repayEnabled: true,
|
|
208
212
|
subId1: Number(subId),
|
|
213
|
+
mergeWithId: isEOA ? enums_1.Strategies.Identifiers.EoaBoost : enums_1.Strategies.Identifiers.EoaBoost,
|
|
209
214
|
subHashRepay: subHash,
|
|
210
|
-
mergeWithId: isEOA ? enums_1.Strategies.Identifiers.EoaBoost : enums_1.Strategies.Identifiers.Boost,
|
|
211
215
|
};
|
|
212
216
|
}
|
|
213
217
|
else {
|
|
@@ -216,11 +220,83 @@ function parseAaveV3LeverageManagement(position, parseData) {
|
|
|
216
220
|
targetBoostRatio: subData.targetRatio,
|
|
217
221
|
boostEnabled: isEnabled,
|
|
218
222
|
subId2: Number(subId),
|
|
219
|
-
subHashBoost: subHash,
|
|
220
223
|
mergeId: isEOA ? enums_1.Strategies.Identifiers.EoaBoost : enums_1.Strategies.Identifiers.Boost,
|
|
224
|
+
subHashBoost: subHash,
|
|
221
225
|
};
|
|
222
226
|
}
|
|
223
|
-
_position.strategy.strategyId =
|
|
227
|
+
_position.strategy.strategyId = enums_1.Strategies.IdOverrides.LeverageManagement;
|
|
228
|
+
return _position;
|
|
229
|
+
}
|
|
230
|
+
function parseAaveV3LeverageManagementOnPrice(position, parseData) {
|
|
231
|
+
const _position = (0, lodash_1.cloneDeep)(position);
|
|
232
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
233
|
+
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
234
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
235
|
+
let subData;
|
|
236
|
+
if (isEOA) {
|
|
237
|
+
subData = subDataService.aaveV3LeverageManagementOnPriceGeneric.decode(subStruct.subData);
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
subData = subDataService.aaveV3LeverageManagementOnPriceSubData.decode(subStruct.subData);
|
|
241
|
+
}
|
|
242
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
243
|
+
_position.strategyData.decoded.subData = subData;
|
|
244
|
+
_position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, Math.random());
|
|
245
|
+
_position.specific = {
|
|
246
|
+
collAsset: subData.collAsset,
|
|
247
|
+
debtAsset: subData.debtAsset,
|
|
248
|
+
baseToken: triggerData.baseTokenAddress,
|
|
249
|
+
quoteToken: triggerData.quoteTokenAddress,
|
|
250
|
+
price: triggerData.price,
|
|
251
|
+
ratioState: triggerData.ratioState,
|
|
252
|
+
debtAssetId: subData.debtAssetId,
|
|
253
|
+
collAssetId: subData.collAssetId,
|
|
254
|
+
ratio: subData.targetRatio,
|
|
255
|
+
};
|
|
256
|
+
return _position;
|
|
257
|
+
}
|
|
258
|
+
function parseAaveV3CloseOnPrice(position, parseData) {
|
|
259
|
+
const _position = (0, lodash_1.cloneDeep)(position);
|
|
260
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
261
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
262
|
+
_position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, AAVE_V3_MARKET_ADDRESSES[_position.chainId]);
|
|
263
|
+
if (isEOA) {
|
|
264
|
+
const triggerData = triggerService.aaveV3QuotePriceRangeTrigger.decode(subStruct.triggerData);
|
|
265
|
+
const subData = subDataService.aaveV3CloseGenericSubData.decode(subStruct.subData);
|
|
266
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
267
|
+
_position.strategyData.decoded.subData = subData;
|
|
268
|
+
_position.specific = {
|
|
269
|
+
collAsset: subData.collAsset,
|
|
270
|
+
collAssetId: subData.collAssetId,
|
|
271
|
+
debtAsset: subData.debtAsset,
|
|
272
|
+
debtAssetId: subData.debtAssetId,
|
|
273
|
+
baseToken: triggerData.collToken,
|
|
274
|
+
quoteToken: triggerData.debtToken,
|
|
275
|
+
stopLossPrice: triggerData.lowerPrice,
|
|
276
|
+
takeProfitPrice: triggerData.upperPrice,
|
|
277
|
+
};
|
|
278
|
+
_position.strategy.strategyId = enums_1.Strategies.Identifiers.EoaCloseOnPrice;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
282
|
+
const subData = subDataService.aaveV3QuotePriceSubData.decode(subStruct.subData);
|
|
283
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
284
|
+
_position.strategyData.decoded.subData = subData;
|
|
285
|
+
_position.specific = {
|
|
286
|
+
collAsset: subData.collAsset,
|
|
287
|
+
collAssetId: subData.collAssetId,
|
|
288
|
+
debtAsset: subData.debtAsset,
|
|
289
|
+
debtAssetId: subData.debtAssetId,
|
|
290
|
+
baseToken: triggerData.baseTokenAddress,
|
|
291
|
+
quoteToken: triggerData.quoteTokenAddress,
|
|
292
|
+
price: triggerData.price,
|
|
293
|
+
ratioState: triggerData.ratioState,
|
|
294
|
+
};
|
|
295
|
+
const { ratioState } = (0, utils_1.getRatioStateInfoForAaveCloseStrategy)(_position.specific.ratioState, (0, utils_1.wethToEthByAddress)(_position.specific.collAsset, parseData.chainId), (0, utils_1.wethToEthByAddress)(_position.specific.debtAsset, parseData.chainId), parseData.chainId);
|
|
296
|
+
_position.strategy.strategyId = (0, utils_1.isRatioStateOver)(ratioState)
|
|
297
|
+
? enums_1.Strategies.IdOverrides.TakeProfit
|
|
298
|
+
: enums_1.Strategies.IdOverrides.StopLoss;
|
|
299
|
+
}
|
|
224
300
|
return _position;
|
|
225
301
|
}
|
|
226
302
|
function parseMorphoAaveV2LeverageManagement(position, parseData) {
|
|
@@ -254,34 +330,6 @@ function parseMorphoAaveV2LeverageManagement(position, parseData) {
|
|
|
254
330
|
_position.strategy.strategyId = enums_1.Strategies.IdOverrides.LeverageManagement;
|
|
255
331
|
return _position;
|
|
256
332
|
}
|
|
257
|
-
function parseAaveV3CloseOnPrice(position, parseData) {
|
|
258
|
-
const _position = (0, lodash_1.cloneDeep)(position);
|
|
259
|
-
const { subStruct } = parseData.subscriptionEventData;
|
|
260
|
-
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
261
|
-
const subData = subDataService.aaveV3QuotePriceSubData.decode(subStruct.subData);
|
|
262
|
-
_position.strategyData.decoded.triggerData = triggerData;
|
|
263
|
-
_position.strategyData.decoded.subData = subData;
|
|
264
|
-
_position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, AAVE_V3_MARKET_ADDRESSES[_position.chainId]);
|
|
265
|
-
_position.specific = {
|
|
266
|
-
collAsset: subData.collAsset,
|
|
267
|
-
collAssetId: subData.collAssetId,
|
|
268
|
-
debtAsset: subData.debtAsset,
|
|
269
|
-
debtAssetId: subData.debtAssetId,
|
|
270
|
-
baseToken: triggerData.baseTokenAddress,
|
|
271
|
-
quoteToken: triggerData.quoteTokenAddress,
|
|
272
|
-
price: triggerData.price,
|
|
273
|
-
ratioState: triggerData.ratioState,
|
|
274
|
-
};
|
|
275
|
-
const { ratioState } = (0, utils_1.getRatioStateInfoForAaveCloseStrategy)(_position.specific.ratioState, (0, utils_1.wethToEthByAddress)(_position.specific.collAsset, parseData.chainId), (0, utils_1.wethToEthByAddress)(_position.specific.debtAsset, parseData.chainId), parseData.chainId);
|
|
276
|
-
// TODO -> Check if those changes break something?
|
|
277
|
-
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
278
|
-
_position.strategy.strategyId = isEOA
|
|
279
|
-
? enums_1.Strategies.Identifiers.EoaCloseOnPrice
|
|
280
|
-
: (_position.strategy.strategyId = (0, utils_1.isRatioStateOver)(ratioState)
|
|
281
|
-
? enums_1.Strategies.IdOverrides.TakeProfit
|
|
282
|
-
: enums_1.Strategies.IdOverrides.StopLoss);
|
|
283
|
-
return _position;
|
|
284
|
-
}
|
|
285
333
|
function parseAaveV3CloseOnPriceWithMaximumGasPrice(position, parseData) {
|
|
286
334
|
const _position = (0, lodash_1.cloneDeep)(position);
|
|
287
335
|
const { subStruct } = parseData.subscriptionEventData;
|
|
@@ -706,30 +754,6 @@ function parseMorphoBlueLeverageManagementOnPrice(position, parseData) {
|
|
|
706
754
|
};
|
|
707
755
|
return _position;
|
|
708
756
|
}
|
|
709
|
-
function parseAaveV3LeverageManagementOnPrice(position, parseData) {
|
|
710
|
-
const _position = (0, lodash_1.cloneDeep)(position);
|
|
711
|
-
const { subStruct } = parseData.subscriptionEventData;
|
|
712
|
-
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
713
|
-
const subData = subDataService.aaveV3LeverageManagementOnPriceSubData.decode(subStruct.subData);
|
|
714
|
-
_position.strategyData.decoded.triggerData = triggerData;
|
|
715
|
-
_position.strategyData.decoded.subData = subData;
|
|
716
|
-
_position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, Math.random());
|
|
717
|
-
_position.specific = {
|
|
718
|
-
collAsset: subData.collAsset,
|
|
719
|
-
debtAsset: subData.debtAsset,
|
|
720
|
-
baseToken: triggerData.baseTokenAddress,
|
|
721
|
-
quoteToken: triggerData.quoteTokenAddress,
|
|
722
|
-
price: triggerData.price,
|
|
723
|
-
ratioState: triggerData.ratioState,
|
|
724
|
-
debtAssetId: subData.debtAssetId,
|
|
725
|
-
collAssetId: subData.collAssetId,
|
|
726
|
-
ratio: subData.targetRatio,
|
|
727
|
-
};
|
|
728
|
-
// // TODO -> check if this change breaks something?
|
|
729
|
-
// const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
730
|
-
// _position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLeverageManagementOnPrice : Strategies.IdOverrides.LeverageManagementOnPrice;
|
|
731
|
-
return _position;
|
|
732
|
-
}
|
|
733
757
|
function parseLiquityV2CloseOnPrice(position, parseData) {
|
|
734
758
|
const _position = (0, lodash_1.cloneDeep)(position);
|
|
735
759
|
const { subStruct } = parseData.subscriptionEventData;
|
package/cjs/types/index.d.ts
CHANGED
|
@@ -120,6 +120,16 @@ export declare namespace Position {
|
|
|
120
120
|
price: string;
|
|
121
121
|
ratioState: RatioState;
|
|
122
122
|
}
|
|
123
|
+
interface AaveV3CloseOnPriceGeneric extends Base {
|
|
124
|
+
collAsset: EthereumAddress;
|
|
125
|
+
collAssetId: number;
|
|
126
|
+
debtAsset: EthereumAddress;
|
|
127
|
+
debtAssetId: number;
|
|
128
|
+
baseToken: EthereumAddress;
|
|
129
|
+
quoteToken: EthereumAddress;
|
|
130
|
+
stopLossPrice: string;
|
|
131
|
+
takeProfitPrice: string;
|
|
132
|
+
}
|
|
123
133
|
interface BoostOnPriceAave extends CloseOnPriceAave {
|
|
124
134
|
ratio: number;
|
|
125
135
|
}
|
|
@@ -188,7 +198,7 @@ export declare namespace Position {
|
|
|
188
198
|
takeProfitType: CloseToAssetType | undefined;
|
|
189
199
|
}
|
|
190
200
|
}
|
|
191
|
-
type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.BoostOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD | Specific.CloseOnPriceLiquityV2 | Specific.BoostOnPriceMorpho | Specific.BoostOnPriceLiquityV2 | Specific.PaybackLiquityV2 | Specific.CompoundV3LeverageManagementOnPrice | Specific.CompoundV3CloseOnPrice;
|
|
201
|
+
type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.BoostOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD | Specific.CloseOnPriceLiquityV2 | Specific.BoostOnPriceMorpho | Specific.BoostOnPriceLiquityV2 | Specific.PaybackLiquityV2 | Specific.CompoundV3LeverageManagementOnPrice | Specific.CompoundV3CloseOnPrice | Specific.AaveV3CloseOnPriceGeneric;
|
|
192
202
|
interface Automated {
|
|
193
203
|
chainId: ChainId;
|
|
194
204
|
positionId: string;
|
|
@@ -163,13 +163,17 @@ function parseAaveV3LeverageManagement(position, parseData) {
|
|
|
163
163
|
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
164
164
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
165
165
|
const triggerData = triggerService.aaveV3RatioTrigger.decode(subStruct.triggerData);
|
|
166
|
-
const
|
|
166
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
167
|
+
let subData;
|
|
168
|
+
if (isEOA) {
|
|
169
|
+
subData = subDataService.aaveV3LeverageManagementSubDataWithoutSubProxy.decode(subStruct.subData);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
subData = subDataService.aaveV3LeverageManagementSubData.decode(subStruct.subData);
|
|
173
|
+
}
|
|
167
174
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
168
175
|
_position.strategyData.decoded.subData = subData;
|
|
169
176
|
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.market);
|
|
170
|
-
// TODO -> check if this change breaks something?
|
|
171
|
-
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
172
|
-
// TODO -> check if this change breaks something?
|
|
173
177
|
const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
|
|
174
178
|
if (isRepay) {
|
|
175
179
|
_position.specific = {
|
|
@@ -177,8 +181,8 @@ function parseAaveV3LeverageManagement(position, parseData) {
|
|
|
177
181
|
targetRepayRatio: subData.targetRatio,
|
|
178
182
|
repayEnabled: true,
|
|
179
183
|
subId1: Number(subId),
|
|
184
|
+
mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.EoaBoost,
|
|
180
185
|
subHashRepay: subHash,
|
|
181
|
-
mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
|
|
182
186
|
};
|
|
183
187
|
}
|
|
184
188
|
else {
|
|
@@ -187,11 +191,83 @@ function parseAaveV3LeverageManagement(position, parseData) {
|
|
|
187
191
|
targetBoostRatio: subData.targetRatio,
|
|
188
192
|
boostEnabled: isEnabled,
|
|
189
193
|
subId2: Number(subId),
|
|
190
|
-
subHashBoost: subHash,
|
|
191
194
|
mergeId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
|
|
195
|
+
subHashBoost: subHash,
|
|
192
196
|
};
|
|
193
197
|
}
|
|
194
|
-
_position.strategy.strategyId =
|
|
198
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
199
|
+
return _position;
|
|
200
|
+
}
|
|
201
|
+
function parseAaveV3LeverageManagementOnPrice(position, parseData) {
|
|
202
|
+
const _position = cloneDeep(position);
|
|
203
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
204
|
+
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
205
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
206
|
+
let subData;
|
|
207
|
+
if (isEOA) {
|
|
208
|
+
subData = subDataService.aaveV3LeverageManagementOnPriceGeneric.decode(subStruct.subData);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
subData = subDataService.aaveV3LeverageManagementOnPriceSubData.decode(subStruct.subData);
|
|
212
|
+
}
|
|
213
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
214
|
+
_position.strategyData.decoded.subData = subData;
|
|
215
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, Math.random());
|
|
216
|
+
_position.specific = {
|
|
217
|
+
collAsset: subData.collAsset,
|
|
218
|
+
debtAsset: subData.debtAsset,
|
|
219
|
+
baseToken: triggerData.baseTokenAddress,
|
|
220
|
+
quoteToken: triggerData.quoteTokenAddress,
|
|
221
|
+
price: triggerData.price,
|
|
222
|
+
ratioState: triggerData.ratioState,
|
|
223
|
+
debtAssetId: subData.debtAssetId,
|
|
224
|
+
collAssetId: subData.collAssetId,
|
|
225
|
+
ratio: subData.targetRatio,
|
|
226
|
+
};
|
|
227
|
+
return _position;
|
|
228
|
+
}
|
|
229
|
+
function parseAaveV3CloseOnPrice(position, parseData) {
|
|
230
|
+
const _position = cloneDeep(position);
|
|
231
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
232
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
233
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, AAVE_V3_MARKET_ADDRESSES[_position.chainId]);
|
|
234
|
+
if (isEOA) {
|
|
235
|
+
const triggerData = triggerService.aaveV3QuotePriceRangeTrigger.decode(subStruct.triggerData);
|
|
236
|
+
const subData = subDataService.aaveV3CloseGenericSubData.decode(subStruct.subData);
|
|
237
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
238
|
+
_position.strategyData.decoded.subData = subData;
|
|
239
|
+
_position.specific = {
|
|
240
|
+
collAsset: subData.collAsset,
|
|
241
|
+
collAssetId: subData.collAssetId,
|
|
242
|
+
debtAsset: subData.debtAsset,
|
|
243
|
+
debtAssetId: subData.debtAssetId,
|
|
244
|
+
baseToken: triggerData.collToken,
|
|
245
|
+
quoteToken: triggerData.debtToken,
|
|
246
|
+
stopLossPrice: triggerData.lowerPrice,
|
|
247
|
+
takeProfitPrice: triggerData.upperPrice,
|
|
248
|
+
};
|
|
249
|
+
_position.strategy.strategyId = Strategies.Identifiers.EoaCloseOnPrice;
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
253
|
+
const subData = subDataService.aaveV3QuotePriceSubData.decode(subStruct.subData);
|
|
254
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
255
|
+
_position.strategyData.decoded.subData = subData;
|
|
256
|
+
_position.specific = {
|
|
257
|
+
collAsset: subData.collAsset,
|
|
258
|
+
collAssetId: subData.collAssetId,
|
|
259
|
+
debtAsset: subData.debtAsset,
|
|
260
|
+
debtAssetId: subData.debtAssetId,
|
|
261
|
+
baseToken: triggerData.baseTokenAddress,
|
|
262
|
+
quoteToken: triggerData.quoteTokenAddress,
|
|
263
|
+
price: triggerData.price,
|
|
264
|
+
ratioState: triggerData.ratioState,
|
|
265
|
+
};
|
|
266
|
+
const { ratioState } = getRatioStateInfoForAaveCloseStrategy(_position.specific.ratioState, wethToEthByAddress(_position.specific.collAsset, parseData.chainId), wethToEthByAddress(_position.specific.debtAsset, parseData.chainId), parseData.chainId);
|
|
267
|
+
_position.strategy.strategyId = isRatioStateOver(ratioState)
|
|
268
|
+
? Strategies.IdOverrides.TakeProfit
|
|
269
|
+
: Strategies.IdOverrides.StopLoss;
|
|
270
|
+
}
|
|
195
271
|
return _position;
|
|
196
272
|
}
|
|
197
273
|
function parseMorphoAaveV2LeverageManagement(position, parseData) {
|
|
@@ -225,34 +301,6 @@ function parseMorphoAaveV2LeverageManagement(position, parseData) {
|
|
|
225
301
|
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
226
302
|
return _position;
|
|
227
303
|
}
|
|
228
|
-
function parseAaveV3CloseOnPrice(position, parseData) {
|
|
229
|
-
const _position = cloneDeep(position);
|
|
230
|
-
const { subStruct } = parseData.subscriptionEventData;
|
|
231
|
-
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
232
|
-
const subData = subDataService.aaveV3QuotePriceSubData.decode(subStruct.subData);
|
|
233
|
-
_position.strategyData.decoded.triggerData = triggerData;
|
|
234
|
-
_position.strategyData.decoded.subData = subData;
|
|
235
|
-
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, AAVE_V3_MARKET_ADDRESSES[_position.chainId]);
|
|
236
|
-
_position.specific = {
|
|
237
|
-
collAsset: subData.collAsset,
|
|
238
|
-
collAssetId: subData.collAssetId,
|
|
239
|
-
debtAsset: subData.debtAsset,
|
|
240
|
-
debtAssetId: subData.debtAssetId,
|
|
241
|
-
baseToken: triggerData.baseTokenAddress,
|
|
242
|
-
quoteToken: triggerData.quoteTokenAddress,
|
|
243
|
-
price: triggerData.price,
|
|
244
|
-
ratioState: triggerData.ratioState,
|
|
245
|
-
};
|
|
246
|
-
const { ratioState } = getRatioStateInfoForAaveCloseStrategy(_position.specific.ratioState, wethToEthByAddress(_position.specific.collAsset, parseData.chainId), wethToEthByAddress(_position.specific.debtAsset, parseData.chainId), parseData.chainId);
|
|
247
|
-
// TODO -> Check if those changes break something?
|
|
248
|
-
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
249
|
-
_position.strategy.strategyId = isEOA
|
|
250
|
-
? Strategies.Identifiers.EoaCloseOnPrice
|
|
251
|
-
: (_position.strategy.strategyId = isRatioStateOver(ratioState)
|
|
252
|
-
? Strategies.IdOverrides.TakeProfit
|
|
253
|
-
: Strategies.IdOverrides.StopLoss);
|
|
254
|
-
return _position;
|
|
255
|
-
}
|
|
256
304
|
function parseAaveV3CloseOnPriceWithMaximumGasPrice(position, parseData) {
|
|
257
305
|
const _position = cloneDeep(position);
|
|
258
306
|
const { subStruct } = parseData.subscriptionEventData;
|
|
@@ -677,30 +725,6 @@ function parseMorphoBlueLeverageManagementOnPrice(position, parseData) {
|
|
|
677
725
|
};
|
|
678
726
|
return _position;
|
|
679
727
|
}
|
|
680
|
-
function parseAaveV3LeverageManagementOnPrice(position, parseData) {
|
|
681
|
-
const _position = cloneDeep(position);
|
|
682
|
-
const { subStruct } = parseData.subscriptionEventData;
|
|
683
|
-
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
684
|
-
const subData = subDataService.aaveV3LeverageManagementOnPriceSubData.decode(subStruct.subData);
|
|
685
|
-
_position.strategyData.decoded.triggerData = triggerData;
|
|
686
|
-
_position.strategyData.decoded.subData = subData;
|
|
687
|
-
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, Math.random());
|
|
688
|
-
_position.specific = {
|
|
689
|
-
collAsset: subData.collAsset,
|
|
690
|
-
debtAsset: subData.debtAsset,
|
|
691
|
-
baseToken: triggerData.baseTokenAddress,
|
|
692
|
-
quoteToken: triggerData.quoteTokenAddress,
|
|
693
|
-
price: triggerData.price,
|
|
694
|
-
ratioState: triggerData.ratioState,
|
|
695
|
-
debtAssetId: subData.debtAssetId,
|
|
696
|
-
collAssetId: subData.collAssetId,
|
|
697
|
-
ratio: subData.targetRatio,
|
|
698
|
-
};
|
|
699
|
-
// // TODO -> check if this change breaks something?
|
|
700
|
-
// const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
701
|
-
// _position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLeverageManagementOnPrice : Strategies.IdOverrides.LeverageManagementOnPrice;
|
|
702
|
-
return _position;
|
|
703
|
-
}
|
|
704
728
|
function parseLiquityV2CloseOnPrice(position, parseData) {
|
|
705
729
|
const _position = cloneDeep(position);
|
|
706
730
|
const { subStruct } = parseData.subscriptionEventData;
|
package/esm/types/index.d.ts
CHANGED
|
@@ -120,6 +120,16 @@ export declare namespace Position {
|
|
|
120
120
|
price: string;
|
|
121
121
|
ratioState: RatioState;
|
|
122
122
|
}
|
|
123
|
+
interface AaveV3CloseOnPriceGeneric extends Base {
|
|
124
|
+
collAsset: EthereumAddress;
|
|
125
|
+
collAssetId: number;
|
|
126
|
+
debtAsset: EthereumAddress;
|
|
127
|
+
debtAssetId: number;
|
|
128
|
+
baseToken: EthereumAddress;
|
|
129
|
+
quoteToken: EthereumAddress;
|
|
130
|
+
stopLossPrice: string;
|
|
131
|
+
takeProfitPrice: string;
|
|
132
|
+
}
|
|
123
133
|
interface BoostOnPriceAave extends CloseOnPriceAave {
|
|
124
134
|
ratio: number;
|
|
125
135
|
}
|
|
@@ -188,7 +198,7 @@ export declare namespace Position {
|
|
|
188
198
|
takeProfitType: CloseToAssetType | undefined;
|
|
189
199
|
}
|
|
190
200
|
}
|
|
191
|
-
type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.BoostOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD | Specific.CloseOnPriceLiquityV2 | Specific.BoostOnPriceMorpho | Specific.BoostOnPriceLiquityV2 | Specific.PaybackLiquityV2 | Specific.CompoundV3LeverageManagementOnPrice | Specific.CompoundV3CloseOnPrice;
|
|
201
|
+
type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave | Specific.BoostOnPriceAave | Specific.CloseOnPriceWithMaximumGasPriceAave | Specific.DebtInFrontRepay | Specific.LeverageManagementCrvUSD | Specific.CloseOnPriceLiquityV2 | Specific.BoostOnPriceMorpho | Specific.BoostOnPriceLiquityV2 | Specific.PaybackLiquityV2 | Specific.CompoundV3LeverageManagementOnPrice | Specific.CompoundV3CloseOnPrice | Specific.AaveV3CloseOnPriceGeneric;
|
|
192
202
|
interface Automated {
|
|
193
203
|
chainId: ChainId;
|
|
194
204
|
positionId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/automation-sdk",
|
|
3
|
-
"version": "3.3.2-dev.
|
|
3
|
+
"version": "3.3.2-dev.4",
|
|
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.
|
|
26
|
+
"@defisaver/sdk": "1.3.6-dev.1",
|
|
27
27
|
"@defisaver/tokens": "^1.6.19",
|
|
28
28
|
"@ethersproject/address": "^5.0.10",
|
|
29
29
|
"@ethersproject/solidity": "^5.0.9",
|
|
@@ -235,17 +235,19 @@ function parseAaveV3LeverageManagement(position: Position.Automated, parseData:
|
|
|
235
235
|
const { isEnabled } = parseData.strategiesSubsData;
|
|
236
236
|
|
|
237
237
|
const triggerData = triggerService.aaveV3RatioTrigger.decode(subStruct.triggerData);
|
|
238
|
-
const
|
|
238
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
239
|
+
let subData;
|
|
240
|
+
if (isEOA) {
|
|
241
|
+
subData = subDataService.aaveV3LeverageManagementSubDataWithoutSubProxy.decode(subStruct.subData);
|
|
242
|
+
} else {
|
|
243
|
+
subData = subDataService.aaveV3LeverageManagementSubData.decode(subStruct.subData);
|
|
244
|
+
}
|
|
239
245
|
|
|
240
246
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
241
247
|
_position.strategyData.decoded.subData = subData;
|
|
242
248
|
|
|
243
249
|
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, triggerData.market);
|
|
244
250
|
|
|
245
|
-
// TODO -> check if this change breaks something?
|
|
246
|
-
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
247
|
-
|
|
248
|
-
// TODO -> check if this change breaks something?
|
|
249
251
|
const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId as Strategies.Identifiers);
|
|
250
252
|
|
|
251
253
|
if (isRepay) {
|
|
@@ -254,8 +256,8 @@ function parseAaveV3LeverageManagement(position: Position.Automated, parseData:
|
|
|
254
256
|
targetRepayRatio: subData.targetRatio,
|
|
255
257
|
repayEnabled: true,
|
|
256
258
|
subId1: Number(subId),
|
|
259
|
+
mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.EoaBoost,
|
|
257
260
|
subHashRepay: subHash,
|
|
258
|
-
mergeWithId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
|
|
259
261
|
};
|
|
260
262
|
} else {
|
|
261
263
|
_position.specific = {
|
|
@@ -263,12 +265,106 @@ function parseAaveV3LeverageManagement(position: Position.Automated, parseData:
|
|
|
263
265
|
targetBoostRatio: subData.targetRatio,
|
|
264
266
|
boostEnabled: isEnabled,
|
|
265
267
|
subId2: Number(subId),
|
|
266
|
-
subHashBoost: subHash,
|
|
267
268
|
mergeId: isEOA ? Strategies.Identifiers.EoaBoost : Strategies.Identifiers.Boost,
|
|
269
|
+
subHashBoost: subHash,
|
|
268
270
|
};
|
|
269
271
|
}
|
|
270
272
|
|
|
271
|
-
_position.strategy.strategyId =
|
|
273
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
274
|
+
|
|
275
|
+
return _position;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function parseAaveV3LeverageManagementOnPrice(position: Position.Automated, parseData: ParseData): Position.Automated {
|
|
279
|
+
const _position = cloneDeep(position);
|
|
280
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
281
|
+
|
|
282
|
+
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
283
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
284
|
+
let subData;
|
|
285
|
+
if (isEOA) {
|
|
286
|
+
subData = subDataService.aaveV3LeverageManagementOnPriceGeneric.decode(subStruct.subData);
|
|
287
|
+
} else {
|
|
288
|
+
subData = subDataService.aaveV3LeverageManagementOnPriceSubData.decode(subStruct.subData);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
292
|
+
_position.strategyData.decoded.subData = subData;
|
|
293
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, Math.random());
|
|
294
|
+
|
|
295
|
+
_position.specific = {
|
|
296
|
+
collAsset: subData.collAsset,
|
|
297
|
+
debtAsset: subData.debtAsset,
|
|
298
|
+
baseToken: triggerData.baseTokenAddress,
|
|
299
|
+
quoteToken: triggerData.quoteTokenAddress,
|
|
300
|
+
price: triggerData.price,
|
|
301
|
+
ratioState: triggerData.ratioState,
|
|
302
|
+
debtAssetId: subData.debtAssetId,
|
|
303
|
+
collAssetId: subData.collAssetId,
|
|
304
|
+
ratio: subData.targetRatio,
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
return _position;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function parseAaveV3CloseOnPrice(position: Position.Automated, parseData: ParseData): Position.Automated {
|
|
311
|
+
const _position = cloneDeep(position);
|
|
312
|
+
|
|
313
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
314
|
+
|
|
315
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
316
|
+
|
|
317
|
+
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, AAVE_V3_MARKET_ADDRESSES[_position.chainId]);
|
|
318
|
+
|
|
319
|
+
if (isEOA) {
|
|
320
|
+
const triggerData = triggerService.aaveV3QuotePriceRangeTrigger.decode(subStruct.triggerData);
|
|
321
|
+
const subData = subDataService.aaveV3CloseGenericSubData.decode(subStruct.subData);
|
|
322
|
+
|
|
323
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
324
|
+
_position.strategyData.decoded.subData = subData;
|
|
325
|
+
|
|
326
|
+
_position.specific = {
|
|
327
|
+
collAsset: subData.collAsset,
|
|
328
|
+
collAssetId: subData.collAssetId,
|
|
329
|
+
debtAsset: subData.debtAsset,
|
|
330
|
+
debtAssetId: subData.debtAssetId,
|
|
331
|
+
baseToken: triggerData.collToken,
|
|
332
|
+
quoteToken: triggerData.debtToken,
|
|
333
|
+
stopLossPrice: triggerData.lowerPrice,
|
|
334
|
+
takeProfitPrice: triggerData.upperPrice,
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
_position.strategy.strategyId = Strategies.Identifiers.EoaCloseOnPrice;
|
|
338
|
+
} else {
|
|
339
|
+
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
340
|
+
const subData = subDataService.aaveV3QuotePriceSubData.decode(subStruct.subData);
|
|
341
|
+
|
|
342
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
343
|
+
_position.strategyData.decoded.subData = subData;
|
|
344
|
+
|
|
345
|
+
_position.specific = {
|
|
346
|
+
collAsset: subData.collAsset,
|
|
347
|
+
collAssetId: subData.collAssetId,
|
|
348
|
+
debtAsset: subData.debtAsset,
|
|
349
|
+
debtAssetId: subData.debtAssetId,
|
|
350
|
+
baseToken: triggerData.baseTokenAddress,
|
|
351
|
+
quoteToken: triggerData.quoteTokenAddress,
|
|
352
|
+
price: triggerData.price,
|
|
353
|
+
ratioState: triggerData.ratioState,
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
const { ratioState } = getRatioStateInfoForAaveCloseStrategy(
|
|
357
|
+
_position.specific.ratioState,
|
|
358
|
+
wethToEthByAddress(_position.specific.collAsset, parseData.chainId),
|
|
359
|
+
wethToEthByAddress(_position.specific.debtAsset, parseData.chainId),
|
|
360
|
+
parseData.chainId,
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
_position.strategy.strategyId = isRatioStateOver(ratioState)
|
|
364
|
+
? Strategies.IdOverrides.TakeProfit
|
|
365
|
+
: Strategies.IdOverrides.StopLoss;
|
|
366
|
+
}
|
|
367
|
+
|
|
272
368
|
return _position;
|
|
273
369
|
}
|
|
274
370
|
|
|
@@ -311,48 +407,6 @@ function parseMorphoAaveV2LeverageManagement(position: Position.Automated, parse
|
|
|
311
407
|
return _position;
|
|
312
408
|
}
|
|
313
409
|
|
|
314
|
-
function parseAaveV3CloseOnPrice(position: Position.Automated, parseData: ParseData): Position.Automated {
|
|
315
|
-
const _position = cloneDeep(position);
|
|
316
|
-
|
|
317
|
-
const { subStruct } = parseData.subscriptionEventData;
|
|
318
|
-
|
|
319
|
-
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
320
|
-
const subData = subDataService.aaveV3QuotePriceSubData.decode(subStruct.subData);
|
|
321
|
-
|
|
322
|
-
_position.strategyData.decoded.triggerData = triggerData;
|
|
323
|
-
_position.strategyData.decoded.subData = subData;
|
|
324
|
-
|
|
325
|
-
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, AAVE_V3_MARKET_ADDRESSES[_position.chainId]);
|
|
326
|
-
|
|
327
|
-
_position.specific = {
|
|
328
|
-
collAsset: subData.collAsset,
|
|
329
|
-
collAssetId: subData.collAssetId,
|
|
330
|
-
debtAsset: subData.debtAsset,
|
|
331
|
-
debtAssetId: subData.debtAssetId,
|
|
332
|
-
baseToken: triggerData.baseTokenAddress,
|
|
333
|
-
quoteToken: triggerData.quoteTokenAddress,
|
|
334
|
-
price: triggerData.price,
|
|
335
|
-
ratioState: triggerData.ratioState,
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
const { ratioState } = getRatioStateInfoForAaveCloseStrategy(
|
|
339
|
-
_position.specific.ratioState,
|
|
340
|
-
wethToEthByAddress(_position.specific.collAsset, parseData.chainId),
|
|
341
|
-
wethToEthByAddress(_position.specific.debtAsset, parseData.chainId),
|
|
342
|
-
parseData.chainId,
|
|
343
|
-
);
|
|
344
|
-
|
|
345
|
-
// TODO -> Check if those changes break something?
|
|
346
|
-
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
347
|
-
_position.strategy.strategyId = isEOA
|
|
348
|
-
? Strategies.Identifiers.EoaCloseOnPrice
|
|
349
|
-
: (_position.strategy.strategyId = isRatioStateOver(ratioState)
|
|
350
|
-
? Strategies.IdOverrides.TakeProfit
|
|
351
|
-
: Strategies.IdOverrides.StopLoss);
|
|
352
|
-
|
|
353
|
-
return _position;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
410
|
function parseAaveV3CloseOnPriceWithMaximumGasPrice(position: Position.Automated, parseData: ParseData): Position.Automated {
|
|
357
411
|
const _position = cloneDeep(position);
|
|
358
412
|
|
|
@@ -926,37 +980,6 @@ function parseMorphoBlueLeverageManagementOnPrice(position: Position.Automated,
|
|
|
926
980
|
return _position;
|
|
927
981
|
}
|
|
928
982
|
|
|
929
|
-
function parseAaveV3LeverageManagementOnPrice(position: Position.Automated, parseData: ParseData): Position.Automated {
|
|
930
|
-
const _position = cloneDeep(position);
|
|
931
|
-
|
|
932
|
-
const { subStruct } = parseData.subscriptionEventData;
|
|
933
|
-
|
|
934
|
-
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
935
|
-
const subData = subDataService.aaveV3LeverageManagementOnPriceSubData.decode(subStruct.subData);
|
|
936
|
-
|
|
937
|
-
_position.strategyData.decoded.triggerData = triggerData;
|
|
938
|
-
_position.strategyData.decoded.subData = subData;
|
|
939
|
-
_position.positionId = getPositionId(_position.chainId, _position.protocol.id, _position.owner, Math.random());
|
|
940
|
-
|
|
941
|
-
_position.specific = {
|
|
942
|
-
collAsset: subData.collAsset,
|
|
943
|
-
debtAsset: subData.debtAsset,
|
|
944
|
-
baseToken: triggerData.baseTokenAddress,
|
|
945
|
-
quoteToken: triggerData.quoteTokenAddress,
|
|
946
|
-
price: triggerData.price,
|
|
947
|
-
ratioState: triggerData.ratioState,
|
|
948
|
-
debtAssetId: subData.debtAssetId,
|
|
949
|
-
collAssetId: subData.collAssetId,
|
|
950
|
-
ratio: subData.targetRatio,
|
|
951
|
-
};
|
|
952
|
-
|
|
953
|
-
// // TODO -> check if this change breaks something?
|
|
954
|
-
// const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
955
|
-
// _position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLeverageManagementOnPrice : Strategies.IdOverrides.LeverageManagementOnPrice;
|
|
956
|
-
|
|
957
|
-
return _position;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
983
|
function parseLiquityV2CloseOnPrice(position: Position.Automated, parseData: ParseData): Position.Automated {
|
|
961
984
|
const _position = cloneDeep(position);
|
|
962
985
|
|
package/src/types/index.ts
CHANGED
|
@@ -166,6 +166,18 @@ export declare namespace Position {
|
|
|
166
166
|
price: string,
|
|
167
167
|
ratioState: RatioState,
|
|
168
168
|
}
|
|
169
|
+
|
|
170
|
+
interface AaveV3CloseOnPriceGeneric extends Base {
|
|
171
|
+
collAsset: EthereumAddress,
|
|
172
|
+
collAssetId: number,
|
|
173
|
+
debtAsset: EthereumAddress,
|
|
174
|
+
debtAssetId: number,
|
|
175
|
+
baseToken: EthereumAddress,
|
|
176
|
+
quoteToken: EthereumAddress,
|
|
177
|
+
stopLossPrice: string,
|
|
178
|
+
takeProfitPrice: string,
|
|
179
|
+
}
|
|
180
|
+
|
|
169
181
|
interface BoostOnPriceAave extends CloseOnPriceAave {
|
|
170
182
|
ratio: number,
|
|
171
183
|
}
|
|
@@ -260,7 +272,8 @@ export declare namespace Position {
|
|
|
260
272
|
| Specific.BoostOnPriceLiquityV2
|
|
261
273
|
| Specific.PaybackLiquityV2
|
|
262
274
|
| Specific.CompoundV3LeverageManagementOnPrice
|
|
263
|
-
| Specific.CompoundV3CloseOnPrice
|
|
275
|
+
| Specific.CompoundV3CloseOnPrice
|
|
276
|
+
| Specific.AaveV3CloseOnPriceGeneric;
|
|
264
277
|
|
|
265
278
|
export interface Automated {
|
|
266
279
|
chainId: ChainId,
|