@defisaver/automation-sdk 3.2.0 → 3.2.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.
- package/cjs/automation/private/StrategiesAutomation.js +5 -5
- package/cjs/constants/index.js +70 -0
- package/cjs/services/strategiesService.js +174 -0
- package/cjs/services/strategySubService.d.ts +11 -1
- package/cjs/services/strategySubService.js +42 -1
- package/cjs/services/subDataService.d.ts +63 -1
- package/cjs/services/subDataService.js +195 -1
- package/cjs/services/triggerService.d.ts +43 -0
- package/cjs/services/triggerService.js +81 -1
- package/cjs/services/utils.d.ts +6 -1
- package/cjs/services/utils.js +52 -1
- package/cjs/types/contracts/generated/SubStorage.d.ts +4 -0
- package/cjs/types/enums.d.ts +45 -5
- package/cjs/types/enums.js +45 -1
- package/cjs/types/index.d.ts +26 -2
- package/esm/automation/private/StrategiesAutomation.js +5 -5
- package/esm/constants/index.js +70 -0
- package/esm/services/strategiesService.js +172 -1
- package/esm/services/strategySubService.d.ts +11 -1
- package/esm/services/strategySubService.js +43 -2
- package/esm/services/subDataService.d.ts +63 -1
- package/esm/services/subDataService.js +195 -1
- package/esm/services/triggerService.d.ts +43 -0
- package/esm/services/triggerService.js +80 -0
- package/esm/services/utils.d.ts +6 -1
- package/esm/services/utils.js +50 -1
- package/esm/types/contracts/generated/SubStorage.d.ts +4 -0
- package/esm/types/enums.d.ts +45 -5
- package/esm/types/enums.js +44 -0
- package/esm/types/index.d.ts +26 -2
- package/package.json +3 -5
- package/src/automation/private/StrategiesAutomation.ts +5 -4
- package/src/constants/index.ts +70 -0
- package/src/services/strategiesService.ts +224 -1
- package/src/services/strategySubService.ts +111 -1
- package/src/services/subDataService.ts +271 -2
- package/src/services/triggerService.ts +125 -0
- package/src/services/utils.ts +60 -1
- package/src/types/enums.ts +44 -0
- package/src/types/index.ts +34 -1
package/src/types/enums.ts
CHANGED
|
@@ -21,6 +21,32 @@ export enum BundleProtocols {
|
|
|
21
21
|
Rari = 'rari',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export enum CollActionType {
|
|
25
|
+
SUPPLY = 0,
|
|
26
|
+
WITHDRAW = 1,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum DebtActionType {
|
|
30
|
+
PAYBACK = 0,
|
|
31
|
+
BORROW = 1,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export enum CloseStrategyType {
|
|
35
|
+
TAKE_PROFIT_IN_COLLATERAL = 0,
|
|
36
|
+
STOP_LOSS_IN_COLLATERAL = 1,
|
|
37
|
+
TAKE_PROFIT_IN_DEBT = 2,
|
|
38
|
+
STOP_LOSS_IN_DEBT = 3,
|
|
39
|
+
TAKE_PROFIT_AND_STOP_LOSS_IN_COLLATERAL = 4,
|
|
40
|
+
TAKE_PROFIT_IN_COLLATERAL_AND_STOP_LOSS_IN_DEBT = 5,
|
|
41
|
+
TAKE_PROFIT_AND_STOP_LOSS_IN_DEBT = 6,
|
|
42
|
+
TAKE_PROFIT_IN_DEBT_AND_STOP_LOSS_IN_COLLATERAL = 7,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export enum CloseToAssetType {
|
|
46
|
+
COLLATERAL = 0,
|
|
47
|
+
DEBT = 1,
|
|
48
|
+
}
|
|
49
|
+
|
|
24
50
|
/**
|
|
25
51
|
* @dev Follow the naming convention:
|
|
26
52
|
* - Enum name consists of two parts, name and version
|
|
@@ -32,6 +58,7 @@ export namespace ProtocolIdentifiers {
|
|
|
32
58
|
export enum StrategiesAutomation {
|
|
33
59
|
MakerDAO = 'MakerDAO',
|
|
34
60
|
Liquity = 'Liquity',
|
|
61
|
+
LiquityV2 = 'Liquity__V2',
|
|
35
62
|
ChickenBonds = 'Chicken Bonds',
|
|
36
63
|
CompoundV2 = 'Compound__V2',
|
|
37
64
|
CompoundV3 = 'Compound__V3',
|
|
@@ -42,6 +69,7 @@ export namespace ProtocolIdentifiers {
|
|
|
42
69
|
Spark = 'Spark',
|
|
43
70
|
CrvUSD = 'CurveUSD',
|
|
44
71
|
MorphoBlue = 'MorphoBlue',
|
|
72
|
+
FluidT1 = 'FluidT1',
|
|
45
73
|
}
|
|
46
74
|
|
|
47
75
|
export enum LegacyAutomation {
|
|
@@ -67,6 +95,7 @@ export namespace Strategies {
|
|
|
67
95
|
LIQUITY_DSR_SUPPLY = 70,
|
|
68
96
|
LIQUITY_DEBT_IN_FRONT_REPAY = 75,
|
|
69
97
|
CURVEUSD_PAYBACK = 92,
|
|
98
|
+
LIQUITY_V2_PAYBACK = 113,
|
|
70
99
|
}
|
|
71
100
|
|
|
72
101
|
export enum OptimismIds {
|
|
@@ -98,6 +127,7 @@ export namespace Strategies {
|
|
|
98
127
|
CloseToCollateralWithGasPrice = 'close-to-collateral-with-gas-price',
|
|
99
128
|
CloseOnPriceToDebt = 'close-on-price-to-debt',
|
|
100
129
|
CloseOnPriceToColl = 'close-on-price-to-collateral',
|
|
130
|
+
CloseOnPrice = 'close-on-price',
|
|
101
131
|
TrailingStopToColl = 'trailing-stop-to-collateral',
|
|
102
132
|
TrailingStopToDebt = 'trailing-stop-to-debt',
|
|
103
133
|
Rebond = 'rebond',
|
|
@@ -108,6 +138,7 @@ export namespace Strategies {
|
|
|
108
138
|
DebtInFrontRepay = 'debt-in-front-repay',
|
|
109
139
|
OpenOrderFromCollateral = 'open-order-from-collateral',
|
|
110
140
|
OpenOrderFromDebt = 'open-order-from-debt',
|
|
141
|
+
BoostOnPrice = 'boost-on-price',
|
|
111
142
|
RepayOnPrice = 'repay-on-price',
|
|
112
143
|
}
|
|
113
144
|
export enum IdOverrides {
|
|
@@ -163,6 +194,14 @@ export namespace Bundles {
|
|
|
163
194
|
MORPHO_BLUE_EOA_BOOST = 35,
|
|
164
195
|
AAVE_V3_OPEN_ORDER_FROM_COLLATERAL = 36,
|
|
165
196
|
AAVE_V3_REPAY_ON_PRICE = 37,
|
|
197
|
+
MORPHO_BLUE_BOOST_ON_PRICE = 38,
|
|
198
|
+
LIQUITY_V2_REPAY = 39,
|
|
199
|
+
LIQUITY_V2_BOOST = 40,
|
|
200
|
+
LIQUITY_V2_CLOSE = 41,
|
|
201
|
+
LIQUITY_V2_REPAY_ON_PRICE = 42,
|
|
202
|
+
LIQUITY_V2_BOOST_ON_PRICE = 43,
|
|
203
|
+
FLUID_T1_REPAY = 44,
|
|
204
|
+
FLUID_T1_BOOST = 45,
|
|
166
205
|
}
|
|
167
206
|
|
|
168
207
|
export enum OptimismIds {
|
|
@@ -185,6 +224,9 @@ export namespace Bundles {
|
|
|
185
224
|
MORPHO_BLUE_BOOST = 9,
|
|
186
225
|
AAVE_V3_OPEN_ORDER_FROM_COLLATERAL = 10,
|
|
187
226
|
AAVE_V3_REPAY_ON_PRICE = 11,
|
|
227
|
+
MORPHO_BLUE_BOOST_ON_PRICE = 12,
|
|
228
|
+
FLUID_T1_REPAY = 13,
|
|
229
|
+
FLUID_T1_BOOST = 14,
|
|
188
230
|
}
|
|
189
231
|
|
|
190
232
|
export enum ArbitrumIds {
|
|
@@ -196,6 +238,8 @@ export namespace Bundles {
|
|
|
196
238
|
COMP_V3_SW_BOOST_BUNDLE = 5,
|
|
197
239
|
AAVE_V3_OPEN_ORDER_FROM_COLLATERAL = 6,
|
|
198
240
|
AAVE_V3_REPAY_ON_PRICE = 7,
|
|
241
|
+
FLUID_T1_REPAY = 8,
|
|
242
|
+
FLUID_T1_BOOST = 9,
|
|
199
243
|
}
|
|
200
244
|
}
|
|
201
245
|
|
package/src/types/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { Subscribe, StrategyModel } from './contracts/generated/SubStorage'
|
|
|
5
5
|
import type {
|
|
6
6
|
ChainId, Strategies, Bundles, ProtocolIdentifiers,
|
|
7
7
|
RatioState,
|
|
8
|
+
CloseToAssetType,
|
|
8
9
|
} from './enums';
|
|
9
10
|
|
|
10
11
|
export type PlaceholderType = any; // TODO - fix any types
|
|
@@ -149,6 +150,11 @@ export declare namespace Position {
|
|
|
149
150
|
ratio: number,
|
|
150
151
|
}
|
|
151
152
|
|
|
153
|
+
interface BoostOnPriceMorpho extends Base {
|
|
154
|
+
marketId: string;
|
|
155
|
+
subHash: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
152
158
|
interface CloseOnPriceWithMaximumGasPriceAave extends Base {
|
|
153
159
|
collAsset: EthereumAddress,
|
|
154
160
|
collAssetId: number,
|
|
@@ -161,6 +167,29 @@ export declare namespace Position {
|
|
|
161
167
|
ratioState: RatioState,
|
|
162
168
|
}
|
|
163
169
|
|
|
170
|
+
interface CloseOnPriceLiquityV2 extends Base {
|
|
171
|
+
market: EthereumAddress,
|
|
172
|
+
troveId: string,
|
|
173
|
+
stopLossPrice: string,
|
|
174
|
+
takeProfitPrice: string,
|
|
175
|
+
closeToAssetAddr: EthereumAddress,
|
|
176
|
+
stopLossType: CloseToAssetType | undefined,
|
|
177
|
+
takeProfitType: CloseToAssetType | undefined,
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface BoostOnPriceLiquityV2 extends Base {
|
|
181
|
+
market: EthereumAddress,
|
|
182
|
+
troveId: string,
|
|
183
|
+
subHash: string;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface PaybackLiquityV2 extends Base {
|
|
187
|
+
market: EthereumAddress,
|
|
188
|
+
troveId: string,
|
|
189
|
+
targetRatio: number;
|
|
190
|
+
triggerRatio: number;
|
|
191
|
+
}
|
|
192
|
+
|
|
164
193
|
interface TrailingStop extends Base {
|
|
165
194
|
roundId: number,
|
|
166
195
|
triggerPercentage: number,
|
|
@@ -186,7 +215,11 @@ export declare namespace Position {
|
|
|
186
215
|
| Specific.BoostOnPriceAave
|
|
187
216
|
| Specific.CloseOnPriceWithMaximumGasPriceAave
|
|
188
217
|
| Specific.DebtInFrontRepay
|
|
189
|
-
| Specific.LeverageManagementCrvUSD
|
|
218
|
+
| Specific.LeverageManagementCrvUSD
|
|
219
|
+
| Specific.CloseOnPriceLiquityV2
|
|
220
|
+
| Specific.BoostOnPriceMorpho
|
|
221
|
+
| Specific.BoostOnPriceLiquityV2
|
|
222
|
+
| Specific.PaybackLiquityV2;
|
|
190
223
|
|
|
191
224
|
export interface Automated {
|
|
192
225
|
chainId: ChainId,
|