@defisaver/automation-sdk 2.0.6 → 2.0.9

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 (54) hide show
  1. package/.env +4 -0
  2. package/.env.dev +5 -0
  3. package/.tests.sh +3 -0
  4. package/README.md +3 -1
  5. package/esm/automation/private/LegacyAutomation.js +9 -3
  6. package/esm/automation/private/LegacyProtocol.test.d.ts +1 -0
  7. package/esm/automation/private/LegacyProtocol.test.js +25 -0
  8. package/esm/automation/private/Protocol.test.d.ts +1 -0
  9. package/esm/automation/private/Protocol.test.js +25 -0
  10. package/esm/automation/private/StrategiesAutomation.d.ts +4 -0
  11. package/esm/automation/private/StrategiesAutomation.js +29 -4
  12. package/esm/constants/index.js +5 -0
  13. package/esm/services/contractService.d.ts +3 -2
  14. package/esm/services/contractService.js +7 -1
  15. package/esm/services/ethereumService.test.d.ts +1 -0
  16. package/esm/services/ethereumService.test.js +241 -0
  17. package/esm/services/strategiesService.js +14 -0
  18. package/esm/services/strategiesService.test.d.ts +1 -0
  19. package/esm/services/strategiesService.test.js +108 -0
  20. package/esm/services/strategySubService.d.ts +5 -3
  21. package/esm/services/strategySubService.js +10 -6
  22. package/esm/services/strategySubService.test.d.ts +1 -0
  23. package/esm/services/strategySubService.test.js +692 -0
  24. package/esm/services/subDataService.d.ts +8 -1
  25. package/esm/services/subDataService.js +23 -14
  26. package/esm/services/subDataService.test.d.ts +1 -0
  27. package/esm/services/subDataService.test.js +993 -0
  28. package/esm/services/triggerService.d.ts +7 -0
  29. package/esm/services/triggerService.js +14 -1
  30. package/esm/services/triggerService.test.js +119 -17
  31. package/esm/types/enums.d.ts +4 -2
  32. package/esm/types/enums.js +2 -0
  33. package/esm/types/index.d.ts +13 -4
  34. package/package.json +5 -5
  35. package/src/automation/private/LegacyAutomation.ts +14 -4
  36. package/src/automation/private/LegacyProtocol.test.ts +24 -0
  37. package/src/automation/private/Protocol.test.ts +24 -0
  38. package/src/automation/private/StrategiesAutomation.ts +40 -6
  39. package/src/constants/index.ts +5 -0
  40. package/src/services/contractService.ts +17 -4
  41. package/src/services/ethereumService.test.ts +256 -0
  42. package/src/services/ethereumService.ts +2 -1
  43. package/src/services/strategiesService.test.ts +103 -0
  44. package/src/services/strategiesService.ts +27 -3
  45. package/src/services/strategySubService.test.ts +835 -0
  46. package/src/services/strategySubService.ts +28 -15
  47. package/src/services/subDataService.test.ts +1063 -0
  48. package/src/services/subDataService.ts +29 -14
  49. package/src/services/triggerService.test.ts +131 -19
  50. package/src/services/triggerService.ts +14 -0
  51. package/src/services/utils.test.ts +1 -1
  52. package/src/types/enums.ts +2 -0
  53. package/src/types/index.ts +20 -5
  54. package/umd/index.js +919 -523
@@ -0,0 +1,256 @@
1
+ import Web3 from 'web3';
2
+ import { expect } from 'chai';
3
+ import { getAssetInfo } from '@defisaver/tokens';
4
+ import { PastEventOptions } from 'web3-eth-contract';
5
+
6
+ import { ChainId } from '../types/enums';
7
+ import type { BlockNumber, Multicall } from '../types';
8
+ import { Contract } from '../types';
9
+ import type { Erc20 } from '../types/contracts/generated';
10
+
11
+ import { getEventsFromContract, multicall, } from './ethereumService';
12
+
13
+ import { makeErc20Contract } from './contractService';
14
+
15
+ require('dotenv').config({ path: '.env' });
16
+
17
+ const Web3_1 = new Web3(process.env.RPC_1!);
18
+ const Web3_10 = new Web3(process.env.RPC_10!);
19
+ const Web3_42161 = new Web3(process.env.RPC_42161!);
20
+
21
+ describe('Feature: ethereumService.ts', () => {
22
+ describe('When testing ethereumService.multicall', () => {
23
+ const examples: Array<[
24
+ Multicall.Payload,
25
+ [
26
+ web3: Web3,
27
+ chainId: ChainId,
28
+ calls: Multicall.Calls[],
29
+ block: BlockNumber,
30
+ ]
31
+ ]> = [
32
+ [
33
+ [{ 0: 'Wrapped Ether', '__length__': 1 }, { 0: '18', '__length__': 1 }],
34
+ [
35
+ Web3_1,
36
+ ChainId.Ethereum,
37
+ [
38
+ {
39
+ abiItem: {'constant':true,'inputs':[],'name':'name','outputs':[{'name':'','type':'string'}],'payable':false,'stateMutability':'view','type':'function'},
40
+ target: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
41
+ params: [],
42
+ },
43
+ {
44
+ abiItem: {'constant':true,'inputs':[],'name':'decimals','outputs':[{'name':'','type':'uint8'}],'payable':false,'stateMutability':'view','type':'function'},
45
+ target: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
46
+ params: [],
47
+ }
48
+ ],
49
+ 'latest',
50
+ ]
51
+ ],
52
+ [
53
+ [{ 0: 'Wrapped Ether', '__length__': 1 }, { 0: '18', '__length__': 1 }],
54
+ [
55
+ Web3_10,
56
+ ChainId.Optimism,
57
+ [
58
+ {
59
+ abiItem: {'constant':true,'inputs':[],'name':'name','outputs':[{'name':'','type':'string'}],'payable':false,'stateMutability':'view','type':'function'},
60
+ target: '0x4200000000000000000000000000000000000006',
61
+ params: [],
62
+ },
63
+ {
64
+ abiItem: {'constant':true,'inputs':[],'name':'decimals','outputs':[{'name':'','type':'uint8'}],'payable':false,'stateMutability':'view','type':'function'},
65
+ target: '0x4200000000000000000000000000000000000006',
66
+ params: [],
67
+ }
68
+ ],
69
+ 'latest',
70
+ ]
71
+ ],
72
+ [
73
+ [{ 0: 'Wrapped Ether', '__length__': 1 }, { 0: '18', '__length__': 1 }],
74
+ [
75
+ Web3_42161,
76
+ ChainId.Arbitrum,
77
+ [
78
+ {
79
+ abiItem: {'constant':true,'inputs':[],'name':'name','outputs':[{'name':'','type':'string'}],'payable':false,'stateMutability':'view','type':'function'},
80
+ target: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
81
+ params: [],
82
+ },
83
+ {
84
+ abiItem: {'constant':true,'inputs':[],'name':'decimals','outputs':[{'name':'','type':'uint8'}],'payable':false,'stateMutability':'view','type':'function'},
85
+ target: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
86
+ params: [],
87
+ }
88
+ ],
89
+ 'latest',
90
+ ]
91
+ ],
92
+ ];
93
+
94
+ examples.forEach(([expected, actual]) => {
95
+ it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, async () => {
96
+ expect(await multicall(...actual)).to.eql(expected);
97
+ });
98
+ });
99
+ });
100
+
101
+ describe('When testing ethereumService.getEventsFromContract', () => {
102
+ const examples: Array<[
103
+ any[],
104
+ [
105
+ contractWithMeta: Contract.WithMeta<Erc20>,
106
+ contractWithMetaFork: Contract.WithMeta<Erc20> | null,
107
+ event: string,
108
+ options?: PastEventOptions,
109
+ ]
110
+ ]> = [
111
+ [
112
+ [
113
+ {
114
+ 'address': '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0',
115
+ 'blockHash': '0xb92cab2569456dbfbdb853d2c67d72c9a7580543dbcb55d483a77322b40755a4',
116
+ 'blockNumber': 15166163,
117
+ 'event': 'Transfer',
118
+ 'id': 'log_e2258e3a',
119
+ 'logIndex': 385,
120
+ 'raw': {
121
+ 'data': '0x0000000000000000000000000000000000000000000001b58c2186829983fca9',
122
+ 'topics': [
123
+ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
124
+ '0x000000000000000000000000ea57dc30959eb17c506e4da095fa9181f3e0ac6d',
125
+ '0x0000000000000000000000009ccf93089cb14f94baeb8822f8ceffd91bd71649',
126
+ ],
127
+ },
128
+ 'removed': false,
129
+ 'returnValues': {
130
+ '0': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
131
+ '1': '0x9cCf93089cb14F94BAeB8822F8CeFfd91Bd71649',
132
+ '2': '8071324659946094853289',
133
+ 'from': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
134
+ 'to': '0x9cCf93089cb14F94BAeB8822F8CeFfd91Bd71649',
135
+ 'value': '8071324659946094853289',
136
+ },
137
+ 'signature': '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
138
+ 'transactionHash': '0x95b28d8f71719c219e09b428e6ff781d717088784fbf63681446da13de6b0c4a',
139
+ 'transactionIndex': 187,
140
+ },
141
+ ],
142
+ [
143
+ makeErc20Contract(Web3_1, getAssetInfo('LUSD').address, ChainId.Ethereum),
144
+ null,
145
+ 'Transfer',
146
+ {
147
+ fromBlock: 15166163,
148
+ toBlock: 15166163,
149
+ filter: {
150
+ from: '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
151
+ to: '0x9cCf93089cb14F94BAeB8822F8CeFfd91Bd71649',
152
+ }
153
+ },
154
+ ]
155
+ ],
156
+ [
157
+ [
158
+ {
159
+ 'address': '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
160
+ 'blockHash': '0xacb0213af63b4c17c436f084a96d1ac385641a59a9a4cf014ae3337cbe545aa7',
161
+ 'blockNumber': 5353002,
162
+ 'event': 'Transfer',
163
+ 'id': 'log_f49645b8',
164
+ 'logIndex': 1,
165
+ 'raw': {
166
+ 'data': '0x000000000000000000000000000000000000000000000001158e460913d00000',
167
+ 'topics': [
168
+ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
169
+ '0x000000000000000000000000ea57dc30959eb17c506e4da095fa9181f3e0ac6d',
170
+ '0x00000000000000000000000013a22f1bba428eaaf56960530ec11118da916c11',
171
+ ],
172
+ },
173
+ 'removed': false,
174
+ 'returnValues': {
175
+ '0': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
176
+ '1': '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
177
+ '2': '20000000000000000000',
178
+ 'from': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
179
+ 'to': '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
180
+ 'value': '20000000000000000000',
181
+ },
182
+ 'signature': '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
183
+ 'transactionHash': '0x37c886a97c938747299c0f6b3e4591304bdd47a938df7c8146454d6fee5a6501',
184
+ 'transactionIndex': 0,
185
+ },
186
+ ],
187
+ [
188
+ makeErc20Contract(Web3_10, getAssetInfo('DAI', ChainId.Optimism).address, ChainId.Optimism),
189
+ null,
190
+ 'Transfer',
191
+ {
192
+ fromBlock: 5353002,
193
+ toBlock: 5353002,
194
+ filter: {
195
+ from: '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
196
+ to: '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
197
+ }
198
+ },
199
+ ]
200
+ ],
201
+ [
202
+ [
203
+ {
204
+ 'address': '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
205
+ 'blockHash': '0xacb0213af63b4c17c436f084a96d1ac385641a59a9a4cf014ae3337cbe545aa7',
206
+ 'blockNumber': 5353002,
207
+ 'event': 'Transfer',
208
+ 'id': 'log_f49645b8',
209
+ 'logIndex': 1,
210
+ 'raw': {
211
+ 'data': '0x000000000000000000000000000000000000000000000001158e460913d00000',
212
+ 'topics': [
213
+ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
214
+ '0x000000000000000000000000ea57dc30959eb17c506e4da095fa9181f3e0ac6d',
215
+ '0x00000000000000000000000013a22f1bba428eaaf56960530ec11118da916c11',
216
+ ],
217
+ },
218
+ 'removed': false,
219
+ 'returnValues': {
220
+ '0': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
221
+ '1': '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
222
+ '2': '20000000000000000000',
223
+ 'from': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
224
+ 'to': '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
225
+ 'value': '20000000000000000000',
226
+ },
227
+ 'signature': '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
228
+ 'transactionHash': '0x37c886a97c938747299c0f6b3e4591304bdd47a938df7c8146454d6fee5a6501',
229
+ 'transactionIndex': 0,
230
+ },
231
+ ],
232
+ [
233
+ makeErc20Contract(Web3_10, getAssetInfo('DAI', ChainId.Arbitrum).address, ChainId.Arbitrum),
234
+ null,
235
+ 'Transfer',
236
+ {
237
+ fromBlock: 5353002,
238
+ toBlock: 5353002,
239
+ filter: {
240
+ from: '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
241
+ to: '0x13a22f1bba428eaaf56960530ec11118da916c11',
242
+ }
243
+ },
244
+ ]
245
+ ],
246
+ ];
247
+
248
+ examples.forEach(([expected, actual]) => {
249
+ it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, async () => {
250
+ const data = await getEventsFromContract(...actual);
251
+ console.log(data);
252
+ expect(await getEventsFromContract(...actual)).to.eql(expected);
253
+ });
254
+ });
255
+ });
256
+ });
@@ -44,7 +44,8 @@ export async function multicall(
44
44
  export async function getEventsFromContract<T extends BaseContract>(
45
45
  contractWithMeta: Contract.WithMeta<T>,
46
46
  contractWithMetaFork: Contract.WithMeta<T> | null,
47
- event: string, options?: PastEventOptions,
47
+ event: string,
48
+ options?: PastEventOptions,
48
49
  ) {
49
50
  const events = await contractWithMeta.contract.getPastEvents(
50
51
  event,
@@ -0,0 +1,103 @@
1
+ import { expect } from 'chai';
2
+
3
+ import { ProtocolIdentifiers, Strategies } from '../types/enums';
4
+ import type { ParseData, Position } from '../types';
5
+
6
+ import { parseStrategiesAutomatedPosition } from './strategiesService';
7
+
8
+ describe('Feature: strategiesService.ts', () => {
9
+ describe('When testing strategiesService.parseStrategiesAutomatedPosition', async () => {
10
+ // TODO: we should probably write this for every strategy?
11
+ const examples: Array<[Position.Automated | null, ParseData]> = [
12
+ [
13
+ {
14
+ isEnabled: true,
15
+ chainId: 1,
16
+ subHash: '0xafa4d200be62f171b57b1ae0f4e8348d1ac3f6d0812ad6da74a2adae8037dde1',
17
+ blockNumber: 18015756,
18
+ subId: 379,
19
+ owner: '0x9cB7E19861665366011899d74E75d4F2A419aEeD',
20
+ protocol: {
21
+ id: ProtocolIdentifiers.StrategiesAutomation.AaveV3,
22
+ name: 'Aave',
23
+ slug: 'aave',
24
+ version: 'V3',
25
+ fullName: 'Aave V3'
26
+ },
27
+ strategy: {
28
+ isBundle: true,
29
+ strategyOrBundleId: 8,
30
+ strategyId: Strategies.IdOverrides.LeverageManagement,
31
+ protocol: {
32
+ id: ProtocolIdentifiers.StrategiesAutomation.AaveV3,
33
+ name: 'Aave',
34
+ slug: 'aave',
35
+ version: 'V3',
36
+ fullName: 'Aave V3'
37
+ }
38
+ },
39
+ strategyData: {
40
+ encoded: {
41
+ triggerData: [
42
+ '0x0000000000000000000000009cb7e19861665366011899d74e75d4f2a419aeed0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e00000000000000000000000000000000000000000000000019ac8532c27900000000000000000000000000000000000000000000000000000000000000000001',
43
+ ],
44
+ subData: [
45
+ '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
46
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
47
+ '0x0000000000000000000000000000000000000000000000000000000000000001',
48
+ '0x0000000000000000000000000000000000000000000000000000000000000000'
49
+ ]
50
+ },
51
+ decoded: {
52
+ triggerData: {
53
+ owner: '0x9cB7E19861665366011899d74E75d4F2A419aEeD',
54
+ market: '0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e',
55
+ ratio: 185,
56
+ ratioState: 1
57
+ },
58
+ subData: { targetRatio: 200 }
59
+ }
60
+ },
61
+ specific: {
62
+ triggerRepayRatio: 185,
63
+ targetRepayRatio: 200,
64
+ repayEnabled: true,
65
+ subId1: 379,
66
+ mergeWithSameId: true
67
+ }
68
+ },
69
+ {
70
+ chainId: 1,
71
+ blockNumber: 18015756,
72
+ subscriptionEventData: {
73
+ subId: '379',
74
+ proxy: '0x9cB7E19861665366011899d74E75d4F2A419aEeD',
75
+ subHash: '0xafa4d200be62f171b57b1ae0f4e8348d1ac3f6d0812ad6da74a2adae8037dde1',
76
+ // @ts-ignore
77
+ subStruct:
78
+ {
79
+ strategyOrBundleId: '8',
80
+ isBundle: true,
81
+ triggerData: ['0x0000000000000000000000009cb7e19861665366011899d74e75d4f2a419aeed0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e00000000000000000000000000000000000000000000000019ac8532c27900000000000000000000000000000000000000000000000000000000000000000001'],
82
+ subData: [
83
+ '0x0000000000000000000000000000000000000000000000001bc16d674ec80000', '0x0000000000000000000000000000000000000000000000000000000000000001',
84
+ '0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000000000000000000000',
85
+ ],
86
+ }
87
+ },
88
+ strategiesSubsData: {
89
+ userProxy: '0x9cb7e19861665366011899d74e75d4f2a419aeed',
90
+ isEnabled: true,
91
+ strategySubHash: '0xafa4d200be62f171b57b1ae0f4e8348d1ac3f6d0812ad6da74a2adae8037dde1'
92
+ }
93
+ },
94
+ ],
95
+ ];
96
+
97
+ examples.forEach(([expected, actual]) => {
98
+ it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, async () => {
99
+ expect(parseStrategiesAutomatedPosition(actual)).to.eql(expected);
100
+ });
101
+ });
102
+ });
103
+ });
@@ -4,6 +4,7 @@ import { cloneDeep } from 'lodash';
4
4
  import { BUNDLES_INFO, STRATEGIES_INFO } from '../constants';
5
5
  import type {
6
6
  Position, ParseData, StrategiesToProtocolVersionMapping, BundleOrStrategy, StrategyOrBundleIds,
7
+ BundleInfoUnion, StrategyInfoUnion,
7
8
  } from '../types';
8
9
  import type { ChainId } from '../types/enums';
9
10
  import { ProtocolIdentifiers, Strategies } from '../types/enums';
@@ -77,6 +78,7 @@ function parseMakerTrailingStop(position: Position.Automated, parseData: ParseDa
77
78
 
78
79
  return _position;
79
80
  }
81
+
80
82
  function parseMakerLeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
81
83
  const _position = cloneDeep(position);
82
84
 
@@ -112,6 +114,7 @@ function parseMakerLeverageManagement(position: Position.Automated, parseData: P
112
114
 
113
115
  return _position;
114
116
  }
117
+
115
118
  function parseLiquityCloseOnPrice(position: Position.Automated, parseData: ParseData): Position.Automated {
116
119
  const _position = cloneDeep(position);
117
120
 
@@ -449,6 +452,7 @@ function parseExchangeDca(position: Position.Automated, parseData: ParseData, ch
449
452
 
450
453
  return _position;
451
454
  }
455
+
452
456
  function parseExchangeLimitOrder(position: Position.Automated, parseData: ParseData, chainId: ChainId): Position.Automated {
453
457
  const _position = cloneDeep(position);
454
458
 
@@ -461,6 +465,7 @@ function parseExchangeLimitOrder(position: Position.Automated, parseData: ParseD
461
465
 
462
466
  return _position;
463
467
  }
468
+
464
469
  function parseLiquityLeverageManagement(position: Position.Automated, parseData: ParseData): Position.Automated {
465
470
  const _position = cloneDeep(position);
466
471
 
@@ -588,6 +593,24 @@ function parseLiquitySavingsLiqProtection(position: Position.Automated, parseDat
588
593
  return _position;
589
594
  }
590
595
 
596
+ function parseDebtInFrontRepay(position: Position.Automated, parseData: ParseData): Position.Automated {
597
+ const _position = cloneDeep(position);
598
+
599
+ const { subStruct } = parseData.subscriptionEventData;
600
+
601
+ const triggerData = triggerService.liquityDebtInFrontWithLimitTrigger.decode(subStruct.triggerData);
602
+ const subData = subDataService.liquityDebtInFrontRepaySubData.decode(subStruct.subData);
603
+
604
+ _position.strategyData.decoded.triggerData = triggerData;
605
+ _position.strategyData.decoded.subData = subData;
606
+
607
+ _position.specific = {
608
+ debtInFrontMin: triggerData.debtInFrontMin,
609
+ targetRepayRatioIncrease: subData.targetRatioIncrease,
610
+ };
611
+
612
+ return _position;
613
+ }
591
614
 
592
615
  const parsingMethodsMapping: StrategiesToProtocolVersionMapping = {
593
616
  [ProtocolIdentifiers.StrategiesAutomation.MakerDAO]: {
@@ -607,6 +630,7 @@ const parsingMethodsMapping: StrategiesToProtocolVersionMapping = {
607
630
  [Strategies.Identifiers.Boost]: parseLiquityLeverageManagement,
608
631
  [Strategies.Identifiers.SavingsDsrPayback]: parseLiquitySavingsLiqProtection,
609
632
  [Strategies.Identifiers.SavingsDsrSupply]: parseLiquitySavingsLiqProtection,
633
+ [Strategies.Identifiers.DebtInFrontRepay]: parseDebtInFrontRepay,
610
634
  },
611
635
  [ProtocolIdentifiers.StrategiesAutomation.AaveV2]: {
612
636
  [Strategies.Identifiers.Repay]: parseAaveV2LeverageManagement,
@@ -662,12 +686,12 @@ export function parseStrategiesAutomatedPosition(parseData: ParseData): Position
662
686
  } = subscriptionEventData;
663
687
  const { isEnabled } = strategiesSubsData;
664
688
 
665
- const id = subStruct.strategyOrBundleId as StrategyOrBundleIds;
689
+ const id = subStruct.strategyOrBundleId as unknown as StrategyOrBundleIds;
666
690
 
667
691
  const strategyOrBundleInfo = (
668
692
  subStruct.isBundle
669
- ? BUNDLES_INFO[chainId][id]
670
- : STRATEGIES_INFO[chainId][id]
693
+ ? BUNDLES_INFO[chainId][id as keyof BundleInfoUnion]
694
+ : STRATEGIES_INFO[chainId][id as keyof StrategyInfoUnion]
671
695
  ) as BundleOrStrategy;
672
696
 
673
697
  if (!strategyOrBundleInfo) return null;