@defisaver/automation-sdk 1.2.3 → 1.2.5
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/esm/automation/private/StrategiesAutomation.d.ts +1 -1
- package/esm/automation/private/StrategiesAutomation.js +1 -1
- package/esm/constants/index.js +10 -0
- package/esm/types/enums.d.ts +3 -1
- package/esm/types/enums.js +2 -0
- package/esm/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/automation/private/StrategiesAutomation.ts +2 -2
- package/src/constants/index.ts +10 -0
- package/src/services/strategiesService.ts +1 -1
- package/src/types/enums.ts +2 -0
- package/src/types/index.ts +3 -1
- package/umd/index.js +324 -531
|
@@ -2,8 +2,8 @@ import type Web3 from 'web3';
|
|
|
2
2
|
import type { PastEventOptions } from 'web3-eth-contract';
|
|
3
3
|
import type { Position, Interfaces, EthereumAddress, SubscriptionOptions, Contract, ParseData } from '../../types';
|
|
4
4
|
import type { StrategyModel, SubStorage } from '../../types/contracts/generated/SubStorage';
|
|
5
|
-
import Automation from './Automation';
|
|
6
5
|
import type { ChainId } from '../../types/enums';
|
|
6
|
+
import Automation from './Automation';
|
|
7
7
|
interface IStrategiesAutomation extends Interfaces.Automation {
|
|
8
8
|
chainId: ChainId;
|
|
9
9
|
providerFork: Web3;
|
|
@@ -11,8 +11,8 @@ import Dec from 'decimal.js';
|
|
|
11
11
|
import { addToObjectIf, isDefined } from '../../services/utils';
|
|
12
12
|
import { getAbiItem, makeSubStorageContract } from '../../services/contractService';
|
|
13
13
|
import { getEventsFromContract, multicall } from '../../services/ethereumService';
|
|
14
|
-
import Automation from './Automation';
|
|
15
14
|
import { parseStrategiesAutomatedPosition } from '../../services/strategiesService';
|
|
15
|
+
import Automation from './Automation';
|
|
16
16
|
export default class StrategiesAutomation extends Automation {
|
|
17
17
|
constructor(args) {
|
|
18
18
|
super();
|
package/esm/constants/index.js
CHANGED
|
@@ -140,6 +140,16 @@ export const MAINNET_BUNDLES_INFO = {
|
|
|
140
140
|
strategyId: Strategies.Identifiers.Boost,
|
|
141
141
|
protocol: PROTOCOLS.MakerDAO,
|
|
142
142
|
},
|
|
143
|
+
[Bundles.MainnetIds.AAVE_V3_CLOSE_TO_DEBT]: {
|
|
144
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_CLOSE_TO_DEBT,
|
|
145
|
+
strategyId: Strategies.Identifiers.CloseToDebt,
|
|
146
|
+
protocol: PROTOCOLS.AaveV3,
|
|
147
|
+
},
|
|
148
|
+
[Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL]: {
|
|
149
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL,
|
|
150
|
+
strategyId: Strategies.Identifiers.CloseToCollateral,
|
|
151
|
+
protocol: PROTOCOLS.AaveV3,
|
|
152
|
+
},
|
|
143
153
|
};
|
|
144
154
|
export const OPTIMISM_BUNDLES_INFO = {
|
|
145
155
|
[Bundles.OptimismIds.AAVE_V3_REPAY]: {
|
package/esm/types/enums.d.ts
CHANGED
|
@@ -84,7 +84,9 @@ export declare namespace Bundles {
|
|
|
84
84
|
AAVE_V3_REPAY = 8,
|
|
85
85
|
AAVE_V3_BOOST = 9,
|
|
86
86
|
MAKER_REPAY = 10,
|
|
87
|
-
MAKER_BOOST = 11
|
|
87
|
+
MAKER_BOOST = 11,
|
|
88
|
+
AAVE_V3_CLOSE_TO_DEBT = 12,
|
|
89
|
+
AAVE_V3_CLOSE_TO_COLLATERAL = 13
|
|
88
90
|
}
|
|
89
91
|
enum OptimismIds {
|
|
90
92
|
AAVE_V3_REPAY = 0,
|
package/esm/types/enums.js
CHANGED
|
@@ -99,6 +99,8 @@ export var Bundles;
|
|
|
99
99
|
MainnetIds[MainnetIds["AAVE_V3_BOOST"] = 9] = "AAVE_V3_BOOST";
|
|
100
100
|
MainnetIds[MainnetIds["MAKER_REPAY"] = 10] = "MAKER_REPAY";
|
|
101
101
|
MainnetIds[MainnetIds["MAKER_BOOST"] = 11] = "MAKER_BOOST";
|
|
102
|
+
MainnetIds[MainnetIds["AAVE_V3_CLOSE_TO_DEBT"] = 12] = "AAVE_V3_CLOSE_TO_DEBT";
|
|
103
|
+
MainnetIds[MainnetIds["AAVE_V3_CLOSE_TO_COLLATERAL"] = 13] = "AAVE_V3_CLOSE_TO_COLLATERAL";
|
|
102
104
|
})(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
|
|
103
105
|
let OptimismIds;
|
|
104
106
|
(function (OptimismIds) {
|
package/esm/types/index.d.ts
CHANGED
|
@@ -122,6 +122,7 @@ export declare namespace Position {
|
|
|
122
122
|
closeToAssetAddr: EthereumAddress;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
+
type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave;
|
|
125
126
|
interface Automated {
|
|
126
127
|
chainId: ChainId;
|
|
127
128
|
owner: EthereumAddress;
|
|
@@ -142,7 +143,7 @@ export declare namespace Position {
|
|
|
142
143
|
subData: PlaceholderType;
|
|
143
144
|
};
|
|
144
145
|
};
|
|
145
|
-
specific:
|
|
146
|
+
specific: SpecificAny;
|
|
146
147
|
}
|
|
147
148
|
interface LegacyAutomated {
|
|
148
149
|
chainId: ChainId;
|
package/package.json
CHANGED
|
@@ -8,14 +8,14 @@ import type {
|
|
|
8
8
|
import type {
|
|
9
9
|
Subscribe, StrategyModel, SubStorage, UpdateData,
|
|
10
10
|
} from '../../types/contracts/generated/SubStorage';
|
|
11
|
+
import type { ChainId } from '../../types/enums';
|
|
11
12
|
|
|
12
13
|
import { addToObjectIf, isDefined } from '../../services/utils';
|
|
13
14
|
import { getAbiItem, makeSubStorageContract } from '../../services/contractService';
|
|
14
15
|
import { getEventsFromContract, multicall } from '../../services/ethereumService';
|
|
16
|
+
import { parseStrategiesAutomatedPosition } from '../../services/strategiesService';
|
|
15
17
|
|
|
16
18
|
import Automation from './Automation';
|
|
17
|
-
import { parseStrategiesAutomatedPosition } from '../../services/strategiesService';
|
|
18
|
-
import type { ChainId } from '../../types/enums';
|
|
19
19
|
|
|
20
20
|
interface IStrategiesAutomation extends Interfaces.Automation {
|
|
21
21
|
chainId: ChainId,
|
package/src/constants/index.ts
CHANGED
|
@@ -156,6 +156,16 @@ export const MAINNET_BUNDLES_INFO: MainnetBundleInfo = {
|
|
|
156
156
|
strategyId: Strategies.Identifiers.Boost,
|
|
157
157
|
protocol: PROTOCOLS.MakerDAO,
|
|
158
158
|
},
|
|
159
|
+
[Bundles.MainnetIds.AAVE_V3_CLOSE_TO_DEBT]: {
|
|
160
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_CLOSE_TO_DEBT,
|
|
161
|
+
strategyId: Strategies.Identifiers.CloseToDebt,
|
|
162
|
+
protocol: PROTOCOLS.AaveV3,
|
|
163
|
+
},
|
|
164
|
+
[Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL]: {
|
|
165
|
+
strategyOrBundleId: Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL,
|
|
166
|
+
strategyId: Strategies.Identifiers.CloseToCollateral,
|
|
167
|
+
protocol: PROTOCOLS.AaveV3,
|
|
168
|
+
},
|
|
159
169
|
};
|
|
160
170
|
|
|
161
171
|
export const OPTIMISM_BUNDLES_INFO: OptimismBundleInfo = {
|
|
@@ -294,7 +294,7 @@ function parseLiquityBondProtection(position: Position.Automated, parseData: Par
|
|
|
294
294
|
|
|
295
295
|
const parsingMethodsMapping: StrategiesToProtocolVersionMapping = {
|
|
296
296
|
[ProtocolIdentifiers.StrategiesAutomation.MakerDAO]: {
|
|
297
|
-
[Strategies.Identifiers.SavingsLiqProtection]: parseMakerSavingsLiqProtection,
|
|
297
|
+
[Strategies.Identifiers.SavingsLiqProtection]: parseMakerSavingsLiqProtection,
|
|
298
298
|
[Strategies.Identifiers.CloseOnPriceToDebt]: parseMakerCloseOnPrice,
|
|
299
299
|
[Strategies.Identifiers.CloseOnPriceToColl]: parseMakerCloseOnPrice,
|
|
300
300
|
[Strategies.Identifiers.TrailingStopToColl]: parseMakerTrailingStop,
|
package/src/types/enums.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -147,6 +147,8 @@ export declare namespace Position {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
type SpecificAny = Specific.CloseOnPrice | Specific.TrailingStop | Specific.RatioProtection | Specific.CloseOnPriceAave;
|
|
151
|
+
|
|
150
152
|
export interface Automated {
|
|
151
153
|
chainId: ChainId,
|
|
152
154
|
owner: EthereumAddress,
|
|
@@ -167,7 +169,7 @@ export declare namespace Position {
|
|
|
167
169
|
subData: PlaceholderType,
|
|
168
170
|
},
|
|
169
171
|
},
|
|
170
|
-
specific:
|
|
172
|
+
specific: SpecificAny,
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
export interface LegacyAutomated {
|