@defisaver/automation-sdk 2.1.3 → 2.1.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/.env +4 -0
- package/esm/constants/index.js +10 -0
- package/esm/services/strategiesService.js +4 -1
- package/esm/services/strategySubService.d.ts +3 -0
- package/esm/services/strategySubService.js +6 -1
- package/esm/services/strategySubService.test.js +29 -0
- package/esm/services/subDataService.d.ts +6 -0
- package/esm/services/subDataService.js +24 -1
- package/esm/services/subDataService.test.js +165 -123
- package/esm/types/enums.d.ts +3 -1
- package/esm/types/enums.js +2 -0
- package/package.json +1 -1
- package/src/constants/index.ts +10 -0
- package/src/services/strategiesService.ts +5 -1
- package/src/services/strategySubService.test.ts +33 -1
- package/src/services/strategySubService.ts +14 -0
- package/src/services/subDataService.test.ts +174 -123
- package/src/services/subDataService.ts +36 -1
- package/src/types/enums.ts +2 -0
- package/umd/index.js +42 -1
|
@@ -38,8 +38,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
38
38
|
const examples = [
|
|
39
39
|
[
|
|
40
40
|
[
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
'0x000000000000000000000000000000000000000000000000000000000000007b', '0x00000000000000000000000000000000000000000000000010a741a462780000',
|
|
42
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
43
43
|
],
|
|
44
44
|
[123, 120, enums_1.ChainId.Ethereum, web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address), web3Utils.toChecksumAddress('0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e')]
|
|
45
45
|
],
|
|
@@ -60,8 +60,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
60
60
|
targetRatio: 120,
|
|
61
61
|
},
|
|
62
62
|
[
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
'0x000000000000000000000000000000000000000000000000000000000000007b', '0x00000000000000000000000000000000000000000000000010a741a462780000',
|
|
64
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
65
65
|
],
|
|
66
66
|
],
|
|
67
67
|
];
|
|
@@ -78,8 +78,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
78
78
|
[
|
|
79
79
|
{ targetRatio: 120 },
|
|
80
80
|
[
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x00000000000000000000000000000000000000000000000010a741a462780000',
|
|
82
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
83
83
|
],
|
|
84
84
|
],
|
|
85
85
|
];
|
|
@@ -95,15 +95,15 @@ describe('Feature: subDataService.ts', () => {
|
|
|
95
95
|
const examples = [
|
|
96
96
|
[
|
|
97
97
|
[
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
'0x0000000000000000000000000000000000000000000000000000000000000141', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
99
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
100
100
|
],
|
|
101
101
|
[321, web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address), enums_1.ChainId.Ethereum, web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address), web3Utils.toChecksumAddress('0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e')]
|
|
102
102
|
],
|
|
103
103
|
[
|
|
104
104
|
[
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
'0x00000000000000000000000000000000000000000000000000000000000001a4', '0x0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599',
|
|
106
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000002439d218133afab8f2b819b1066c7e434ad94e9e',
|
|
107
107
|
],
|
|
108
108
|
[420, web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WBTC', enums_1.ChainId.Ethereum).address), enums_1.ChainId.Ethereum, web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address), web3Utils.toChecksumAddress('0x2439d218133AFaB8F2B819B1066c7E434Ad94E9e')]
|
|
109
109
|
],
|
|
@@ -122,8 +122,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
122
122
|
closeToAssetAddr: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
123
123
|
},
|
|
124
124
|
[
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
'0x0000000000000000000000000000000000000000000000000000000000000141', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
126
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
127
127
|
],
|
|
128
128
|
],
|
|
129
129
|
[
|
|
@@ -132,8 +132,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
132
132
|
closeToAssetAddr: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WBTC', enums_1.ChainId.Ethereum).address),
|
|
133
133
|
},
|
|
134
134
|
[
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
'0x00000000000000000000000000000000000000000000000000000000000001a4', '0x0000000000000000000000002260fac5e5542a773aa44fbcfedf7c193bc2c599',
|
|
136
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000002439d218133afab8f2b819b1066c7e434ad94e9e',
|
|
137
137
|
],
|
|
138
138
|
],
|
|
139
139
|
];
|
|
@@ -185,13 +185,13 @@ describe('Feature: subDataService.ts', () => {
|
|
|
185
185
|
const examples = [
|
|
186
186
|
[
|
|
187
187
|
[
|
|
188
|
-
|
|
188
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
189
189
|
],
|
|
190
190
|
[web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('LUSD', enums_1.ChainId.Ethereum).address), enums_1.ChainId.Ethereum, web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address), web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('LUSD', enums_1.ChainId.Ethereum).address)]
|
|
191
191
|
],
|
|
192
192
|
[
|
|
193
193
|
[
|
|
194
|
-
|
|
194
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
195
195
|
],
|
|
196
196
|
[web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('LUSD', enums_1.ChainId.Ethereum).address), enums_1.ChainId.Ethereum]
|
|
197
197
|
],
|
|
@@ -210,7 +210,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
210
210
|
debtAddr: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('LUSD', enums_1.ChainId.Ethereum).address),
|
|
211
211
|
},
|
|
212
212
|
[
|
|
213
|
-
|
|
213
|
+
'0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
214
214
|
],
|
|
215
215
|
],
|
|
216
216
|
[
|
|
@@ -219,7 +219,7 @@ describe('Feature: subDataService.ts', () => {
|
|
|
219
219
|
debtAddr: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('LUSD', enums_1.ChainId.Ethereum).address),
|
|
220
220
|
},
|
|
221
221
|
[
|
|
222
|
-
|
|
222
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
223
223
|
],
|
|
224
224
|
],
|
|
225
225
|
];
|
|
@@ -252,11 +252,11 @@ describe('Feature: subDataService.ts', () => {
|
|
|
252
252
|
const examples = [
|
|
253
253
|
[
|
|
254
254
|
{ targetRatio: 200 },
|
|
255
|
-
[
|
|
255
|
+
['0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001bc16d674ec80000'],
|
|
256
256
|
],
|
|
257
257
|
[
|
|
258
258
|
{ targetRatio: 123 },
|
|
259
|
-
[
|
|
259
|
+
['0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001111d67bb1bb0000'],
|
|
260
260
|
],
|
|
261
261
|
];
|
|
262
262
|
examples.forEach(([expected, actual]) => {
|
|
@@ -271,11 +271,11 @@ describe('Feature: subDataService.ts', () => {
|
|
|
271
271
|
const examples = [
|
|
272
272
|
[
|
|
273
273
|
{ targetRatio: 200 },
|
|
274
|
-
[
|
|
274
|
+
['0x0000000000000000000000000000000000000000000000001bc16d674ec80000'],
|
|
275
275
|
],
|
|
276
276
|
[
|
|
277
277
|
{ targetRatio: 123 },
|
|
278
|
-
[
|
|
278
|
+
['0x0000000000000000000000000000000000000000000000001111d67bb1bb0000'],
|
|
279
279
|
],
|
|
280
280
|
];
|
|
281
281
|
examples.forEach(([expected, actual]) => {
|
|
@@ -290,9 +290,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
290
290
|
const examples = [
|
|
291
291
|
[
|
|
292
292
|
[
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
294
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000000000000000000000000000000000000000000004',
|
|
295
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
296
296
|
],
|
|
297
297
|
[
|
|
298
298
|
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
@@ -303,9 +303,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
303
303
|
],
|
|
304
304
|
[
|
|
305
305
|
[
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
'0x0000000000000000000000005979d7b546e38e414f7e9822514be443a4800529', '0x0000000000000000000000000000000000000000000000000000000000000006',
|
|
307
|
+
'0x000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831', '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
308
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
309
309
|
],
|
|
310
310
|
[
|
|
311
311
|
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('wstETH', enums_1.ChainId.Arbitrum).address),
|
|
@@ -331,9 +331,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
331
331
|
debtAssetId: 4,
|
|
332
332
|
},
|
|
333
333
|
[
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
334
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
335
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000000000000000000000000000000000000000000004',
|
|
336
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
337
337
|
],
|
|
338
338
|
],
|
|
339
339
|
[
|
|
@@ -344,9 +344,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
344
344
|
debtAssetId: 2,
|
|
345
345
|
},
|
|
346
346
|
[
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
'0x0000000000000000000000005979d7b546e38e414f7e9822514be443a4800529', '0x0000000000000000000000000000000000000000000000000000000000000006',
|
|
348
|
+
'0x000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831', '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
349
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
350
350
|
],
|
|
351
351
|
],
|
|
352
352
|
];
|
|
@@ -379,11 +379,11 @@ describe('Feature: subDataService.ts', () => {
|
|
|
379
379
|
const examples = [
|
|
380
380
|
[
|
|
381
381
|
{ targetRatio: 200 },
|
|
382
|
-
[
|
|
382
|
+
['0x0000000000000000000000000000000000000000000000001bc16d674ec80000'],
|
|
383
383
|
],
|
|
384
384
|
[
|
|
385
385
|
{ targetRatio: 123 },
|
|
386
|
-
[
|
|
386
|
+
['0x0000000000000000000000000000000000000000000000001111d67bb1bb0000'],
|
|
387
387
|
],
|
|
388
388
|
];
|
|
389
389
|
examples.forEach(([expected, actual]) => {
|
|
@@ -442,15 +442,15 @@ describe('Feature: subDataService.ts', () => {
|
|
|
442
442
|
[
|
|
443
443
|
{ targetRatio: 123 },
|
|
444
444
|
[
|
|
445
|
-
|
|
446
|
-
|
|
445
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
446
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001111d67bb1bb0000',
|
|
447
447
|
],
|
|
448
448
|
],
|
|
449
449
|
[
|
|
450
450
|
{ targetRatio: 200 },
|
|
451
451
|
[
|
|
452
|
-
|
|
453
|
-
|
|
452
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
453
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
454
454
|
],
|
|
455
455
|
],
|
|
456
456
|
];
|
|
@@ -483,11 +483,11 @@ describe('Feature: subDataService.ts', () => {
|
|
|
483
483
|
const examples = [
|
|
484
484
|
[
|
|
485
485
|
{ targetRatio: 200 },
|
|
486
|
-
[
|
|
486
|
+
['0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001bc16d674ec80000'],
|
|
487
487
|
],
|
|
488
488
|
[
|
|
489
489
|
{ targetRatio: 123 },
|
|
490
|
-
[
|
|
490
|
+
['0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001111d67bb1bb0000'],
|
|
491
491
|
],
|
|
492
492
|
];
|
|
493
493
|
examples.forEach(([expected, actual]) => {
|
|
@@ -501,11 +501,11 @@ describe('Feature: subDataService.ts', () => {
|
|
|
501
501
|
describe('encode()', () => {
|
|
502
502
|
const examples = [
|
|
503
503
|
[
|
|
504
|
-
[
|
|
504
|
+
['0x00000000000000000000000000000000000000000000000000000000000000c8'],
|
|
505
505
|
[200]
|
|
506
506
|
],
|
|
507
507
|
[
|
|
508
|
-
[
|
|
508
|
+
['0x000000000000000000000000000000000000000000000000000000000000a119'],
|
|
509
509
|
[41241]
|
|
510
510
|
],
|
|
511
511
|
];
|
|
@@ -519,11 +519,11 @@ describe('Feature: subDataService.ts', () => {
|
|
|
519
519
|
const examples = [
|
|
520
520
|
[
|
|
521
521
|
{ bondId: '200' },
|
|
522
|
-
[
|
|
522
|
+
['0x0000000000000000000000000000000000000000000000000000000000000000', '0x00000000000000000000000000000000000000000000000000000000000000c8'],
|
|
523
523
|
],
|
|
524
524
|
[
|
|
525
525
|
{ bondId: '41241' },
|
|
526
|
-
[
|
|
526
|
+
['0x0000000000000000000000000000000000000000000000000000000000000000', '0x000000000000000000000000000000000000000000000000000000000000a119'],
|
|
527
527
|
],
|
|
528
528
|
];
|
|
529
529
|
examples.forEach(([expected, actual]) => {
|
|
@@ -538,15 +538,15 @@ describe('Feature: subDataService.ts', () => {
|
|
|
538
538
|
const examples = [
|
|
539
539
|
[
|
|
540
540
|
[
|
|
541
|
-
|
|
542
|
-
|
|
541
|
+
'0x0000000000000000000000000000000000000000000000000000000000001076', '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
542
|
+
'0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0', '0x000000000000000000000000b9d7dddca9a4ac480991865efef82e01273f79c3',
|
|
543
543
|
],
|
|
544
544
|
['4214', 0, enums_1.ChainId.Ethereum]
|
|
545
545
|
],
|
|
546
546
|
[
|
|
547
547
|
[
|
|
548
|
-
|
|
549
|
-
|
|
548
|
+
'0x00000000000000000000000000000000000000000000000000000000000002b8', '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
549
|
+
'0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0', '0x000000000000000000000000b9d7dddca9a4ac480991865efef82e01273f79c3',
|
|
550
550
|
],
|
|
551
551
|
['696', 1]
|
|
552
552
|
],
|
|
@@ -562,15 +562,15 @@ describe('Feature: subDataService.ts', () => {
|
|
|
562
562
|
[
|
|
563
563
|
{ sourceId: '4214', sourceType: '0' },
|
|
564
564
|
[
|
|
565
|
-
|
|
566
|
-
|
|
565
|
+
'0x0000000000000000000000000000000000000000000000000000000000001076', '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
566
|
+
'0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0', '0x000000000000000000000000b9d7dddca9a4ac480991865efef82e01273f79c3',
|
|
567
567
|
],
|
|
568
568
|
],
|
|
569
569
|
[
|
|
570
570
|
{ sourceId: '696', sourceType: '1' },
|
|
571
571
|
[
|
|
572
|
-
|
|
573
|
-
|
|
572
|
+
'0x00000000000000000000000000000000000000000000000000000000000002b8', '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
573
|
+
'0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0', '0x000000000000000000000000b9d7dddca9a4ac480991865efef82e01273f79c3',
|
|
574
574
|
],
|
|
575
575
|
],
|
|
576
576
|
];
|
|
@@ -586,8 +586,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
586
586
|
const examples = [
|
|
587
587
|
[
|
|
588
588
|
[
|
|
589
|
-
|
|
590
|
-
|
|
589
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
590
|
+
'0x0000000000000000000000000000000000000000000000000000000000000853', '0x0000000000000000000000000000000000000000000000000000000000231860'
|
|
591
591
|
],
|
|
592
592
|
[
|
|
593
593
|
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
@@ -598,8 +598,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
598
598
|
],
|
|
599
599
|
[
|
|
600
600
|
[
|
|
601
|
-
|
|
602
|
-
|
|
601
|
+
'0x0000000000000000000000002f2a2543b76a4166549f7aab2e75bef0aefc5b0f', '0x000000000000000000000000f97f4df75117a78c1a5a0dbb814af92458539fb4',
|
|
602
|
+
'0x00000000000000000000000000000000000000000000000000000000003eddd7', '0x0000000000000000000000000000000000000000000000000000000008f57500'
|
|
603
603
|
],
|
|
604
604
|
[
|
|
605
605
|
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WBTC', enums_1.ChainId.Arbitrum).address),
|
|
@@ -626,8 +626,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
626
626
|
},
|
|
627
627
|
[
|
|
628
628
|
[
|
|
629
|
-
|
|
630
|
-
|
|
629
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
630
|
+
'0x0000000000000000000000000000000000000000000000000000000000000853', '0x0000000000000000000000000000000000000000000000000000000000231860'
|
|
631
631
|
],
|
|
632
632
|
enums_1.ChainId.Ethereum
|
|
633
633
|
],
|
|
@@ -641,8 +641,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
641
641
|
},
|
|
642
642
|
[
|
|
643
643
|
[
|
|
644
|
-
|
|
645
|
-
|
|
644
|
+
'0x0000000000000000000000002f2a2543b76a4166549f7aab2e75bef0aefc5b0f', '0x000000000000000000000000f97f4df75117a78c1a5a0dbb814af92458539fb4',
|
|
645
|
+
'0x00000000000000000000000000000000000000000000000000000000003eddd7', '0x0000000000000000000000000000000000000000000000000000000008f57500'
|
|
646
646
|
],
|
|
647
647
|
enums_1.ChainId.Arbitrum
|
|
648
648
|
]
|
|
@@ -711,8 +711,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
711
711
|
},
|
|
712
712
|
[
|
|
713
713
|
[
|
|
714
|
-
|
|
715
|
-
|
|
714
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
715
|
+
'0x0000000000000000000000000000000000000000000000000000000000000853', '0x0000000000000000000000000000000000000000000000000000000000231860'
|
|
716
716
|
],
|
|
717
717
|
enums_1.ChainId.Ethereum
|
|
718
718
|
],
|
|
@@ -725,8 +725,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
725
725
|
},
|
|
726
726
|
[
|
|
727
727
|
[
|
|
728
|
-
|
|
729
|
-
|
|
728
|
+
'0x0000000000000000000000002f2a2543b76a4166549f7aab2e75bef0aefc5b0f', '0x000000000000000000000000f97f4df75117a78c1a5a0dbb814af92458539fb4',
|
|
729
|
+
'0x00000000000000000000000000000000000000000000000000000000003eddd7', '0x0000000000000000000000000000000000000000000000000000000008f57500'
|
|
730
730
|
],
|
|
731
731
|
enums_1.ChainId.Arbitrum
|
|
732
732
|
]
|
|
@@ -744,11 +744,11 @@ describe('Feature: subDataService.ts', () => {
|
|
|
744
744
|
const examples = [
|
|
745
745
|
[
|
|
746
746
|
{ targetRatio: 200 },
|
|
747
|
-
[
|
|
747
|
+
['0x0000000000000000000000000000000000000000000000001bc16d674ec80000'],
|
|
748
748
|
],
|
|
749
749
|
[
|
|
750
750
|
{ targetRatio: 123 },
|
|
751
|
-
[
|
|
751
|
+
['0x0000000000000000000000000000000000000000000000001111d67bb1bb0000'],
|
|
752
752
|
],
|
|
753
753
|
];
|
|
754
754
|
examples.forEach(([expected, actual]) => {
|
|
@@ -763,9 +763,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
763
763
|
const examples = [
|
|
764
764
|
[
|
|
765
765
|
[
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
766
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
767
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000000000000000000000000000000000000000000004',
|
|
768
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
769
769
|
],
|
|
770
770
|
[
|
|
771
771
|
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
@@ -776,9 +776,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
776
776
|
],
|
|
777
777
|
[
|
|
778
778
|
[
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
779
|
+
'0x0000000000000000000000005979d7b546e38e414f7e9822514be443a4800529', '0x0000000000000000000000000000000000000000000000000000000000000006',
|
|
780
|
+
'0x000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831', '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
781
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
782
782
|
],
|
|
783
783
|
[
|
|
784
784
|
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('wstETH', enums_1.ChainId.Arbitrum).address),
|
|
@@ -804,9 +804,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
804
804
|
debtAssetId: 4,
|
|
805
805
|
},
|
|
806
806
|
[
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
807
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
808
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000000000000000000000000000000000000000000004',
|
|
809
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
810
810
|
],
|
|
811
811
|
],
|
|
812
812
|
[
|
|
@@ -817,9 +817,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
817
817
|
debtAssetId: 2,
|
|
818
818
|
},
|
|
819
819
|
[
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
820
|
+
'0x0000000000000000000000005979d7b546e38e414f7e9822514be443a4800529', '0x0000000000000000000000000000000000000000000000000000000000000006',
|
|
821
|
+
'0x000000000000000000000000af88d065e77c8cc2239327c5edb3a432268e5831', '0x0000000000000000000000000000000000000000000000000000000000000002',
|
|
822
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
823
823
|
],
|
|
824
824
|
],
|
|
825
825
|
];
|
|
@@ -835,15 +835,15 @@ describe('Feature: subDataService.ts', () => {
|
|
|
835
835
|
const examples = [
|
|
836
836
|
[
|
|
837
837
|
[
|
|
838
|
-
|
|
839
|
-
|
|
838
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000001111d67bb1bb0000',
|
|
839
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
840
840
|
],
|
|
841
841
|
[123]
|
|
842
842
|
],
|
|
843
843
|
[
|
|
844
844
|
[
|
|
845
|
-
|
|
846
|
-
|
|
845
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000003a4965bf58a40000',
|
|
846
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
847
847
|
],
|
|
848
848
|
[420]
|
|
849
849
|
],
|
|
@@ -861,8 +861,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
861
861
|
targetRatio: 123,
|
|
862
862
|
},
|
|
863
863
|
[
|
|
864
|
-
|
|
865
|
-
|
|
864
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000001111d67bb1bb0000',
|
|
865
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
866
866
|
],
|
|
867
867
|
],
|
|
868
868
|
[
|
|
@@ -870,8 +870,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
870
870
|
targetRatio: 420,
|
|
871
871
|
},
|
|
872
872
|
[
|
|
873
|
-
|
|
874
|
-
|
|
873
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000003a4965bf58a40000',
|
|
874
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
875
875
|
],
|
|
876
876
|
],
|
|
877
877
|
];
|
|
@@ -887,15 +887,15 @@ describe('Feature: subDataService.ts', () => {
|
|
|
887
887
|
const examples = [
|
|
888
888
|
[
|
|
889
889
|
[
|
|
890
|
-
|
|
891
|
-
|
|
890
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000002c68af0bb1400000',
|
|
891
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
892
892
|
],
|
|
893
893
|
[320]
|
|
894
894
|
],
|
|
895
895
|
[
|
|
896
896
|
[
|
|
897
|
-
|
|
898
|
-
|
|
897
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000001eab7f4a799d0000',
|
|
898
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
899
899
|
],
|
|
900
900
|
[221]
|
|
901
901
|
],
|
|
@@ -913,8 +913,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
913
913
|
targetRatio: 320,
|
|
914
914
|
},
|
|
915
915
|
[
|
|
916
|
-
|
|
917
|
-
|
|
916
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000002c68af0bb1400000',
|
|
917
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
918
918
|
],
|
|
919
919
|
],
|
|
920
920
|
[
|
|
@@ -922,8 +922,8 @@ describe('Feature: subDataService.ts', () => {
|
|
|
922
922
|
targetRatio: 221,
|
|
923
923
|
},
|
|
924
924
|
[
|
|
925
|
-
|
|
926
|
-
|
|
925
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000001eab7f4a799d0000',
|
|
926
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
927
927
|
],
|
|
928
928
|
],
|
|
929
929
|
];
|
|
@@ -939,17 +939,17 @@ describe('Feature: subDataService.ts', () => {
|
|
|
939
939
|
const examples = [
|
|
940
940
|
[
|
|
941
941
|
[
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
942
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
943
|
+
'0x000000000000000000000000000000000000000000000000016345785d8a0000', '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
944
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
945
945
|
],
|
|
946
946
|
[10]
|
|
947
947
|
],
|
|
948
948
|
[
|
|
949
949
|
[
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
950
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
951
|
+
'0x000000000000000000000000000000000000000000000000063eb89da4ed0000', '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
952
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
953
953
|
],
|
|
954
954
|
[45]
|
|
955
955
|
],
|
|
@@ -967,9 +967,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
967
967
|
targetRatioIncrease: 10,
|
|
968
968
|
},
|
|
969
969
|
[
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
970
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
971
|
+
'0x000000000000000000000000000000000000000000000000016345785d8a0000', '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
972
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
973
973
|
],
|
|
974
974
|
],
|
|
975
975
|
[
|
|
@@ -977,9 +977,9 @@ describe('Feature: subDataService.ts', () => {
|
|
|
977
977
|
targetRatioIncrease: 45,
|
|
978
978
|
},
|
|
979
979
|
[
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
980
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x0000000000000000000000005f98805a4e8be255a32880fdec7f6728c6568ba0',
|
|
981
|
+
'0x000000000000000000000000000000000000000000000000063eb89da4ed0000', '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
982
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
983
983
|
],
|
|
984
984
|
],
|
|
985
985
|
];
|
|
@@ -995,23 +995,23 @@ describe('Feature: subDataService.ts', () => {
|
|
|
995
995
|
const examples = [
|
|
996
996
|
[
|
|
997
997
|
[
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
998
|
+
'0x000000000000000000000000a920de414ea4ab66b97da1bfe9e6eca7d4219635',
|
|
999
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
1000
|
+
'0x00000000000000000000000000000000000000000000000010a741a462780000',
|
|
1001
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1002
|
+
'0x000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e',
|
|
1003
1003
|
],
|
|
1004
|
-
[
|
|
1004
|
+
['0xa920de414ea4ab66b97da1bfe9e6eca7d4219635', enums_1.RatioState.UNDER, 120, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E'],
|
|
1005
1005
|
],
|
|
1006
1006
|
[
|
|
1007
1007
|
[
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1008
|
+
'0x000000000000000000000000a920de414ea4ab66b97da1bfe9e6eca7d4219635',
|
|
1009
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1010
|
+
'0x00000000000000000000000000000000000000000000000018fae27693b40000',
|
|
1011
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1012
|
+
'0x000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e',
|
|
1013
1013
|
],
|
|
1014
|
-
[
|
|
1014
|
+
['0xa920de414ea4ab66b97da1bfe9e6eca7d4219635', enums_1.RatioState.OVER, 180, '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E']
|
|
1015
1015
|
],
|
|
1016
1016
|
];
|
|
1017
1017
|
examples.forEach(([expected, actual]) => {
|
|
@@ -1027,14 +1027,14 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1027
1027
|
controller: '0xA920De414eA4Ab66b97dA1bFE9e6EcA7d4219635',
|
|
1028
1028
|
targetRatio: 120,
|
|
1029
1029
|
},
|
|
1030
|
-
[
|
|
1030
|
+
['0x000000000000000000000000a920de414ea4ab66b97da1bfe9e6eca7d4219635', '0x0000000000000000000000000000000000000000000000000000000000000001', '0x00000000000000000000000000000000000000000000000010a741a462780000', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e',],
|
|
1031
1031
|
],
|
|
1032
1032
|
[
|
|
1033
1033
|
{
|
|
1034
|
-
controller:
|
|
1034
|
+
controller: '0xA920De414eA4Ab66b97dA1bFE9e6EcA7d4219635',
|
|
1035
1035
|
targetRatio: 180,
|
|
1036
1036
|
},
|
|
1037
|
-
[
|
|
1037
|
+
['0x000000000000000000000000a920de414ea4ab66b97da1bfe9e6eca7d4219635', '0x0000000000000000000000000000000000000000000000000000000000000000', '0x00000000000000000000000000000000000000000000000018fae27693b40000', '0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', '0x000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e',],
|
|
1038
1038
|
],
|
|
1039
1039
|
];
|
|
1040
1040
|
examples.forEach(([expected, actual]) => {
|
|
@@ -1044,4 +1044,46 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1044
1044
|
});
|
|
1045
1045
|
});
|
|
1046
1046
|
});
|
|
1047
|
+
describe('When testing subDataService.compoundV3L2LeverageManagementSubData', () => {
|
|
1048
|
+
describe('encode()', () => {
|
|
1049
|
+
const examples = [
|
|
1050
|
+
[
|
|
1051
|
+
'0x0313D212133AFab8F2b829B1066c7e43caD94e2c0213D212133AfaB8F2b829B1066C7E43cAD94E2c000000000000000016345785d8a0000000000000000000001e87f85809dc0000000000000000000018fae27693b4000000000000000000001a5e27eef13e000001',
|
|
1052
|
+
[web3Utils.toChecksumAddress('0x0313d212133AFaB8F2B829B1066c7E43cAd94E2c'), web3Utils.toChecksumAddress('0x0213d212133AFaB8F2B829B1066c7E43cAd94E2c'), 160, 220, 180, 190, true]
|
|
1053
|
+
],
|
|
1054
|
+
[
|
|
1055
|
+
'0x0313D212133AFab8F2b829B1066c7e43caD94e2c0413d212133afAb8F2B829b1066C7e43cAd94e2c000000000000000016345785d8a0000000000000000000001e87f85809dc0000000000000000000018fae27693b4000000000000000000000f43fc2c04ee000000',
|
|
1056
|
+
[web3Utils.toChecksumAddress('0x0313d212133AFaB8F2B829B1066c7E43cAd94E2c'), web3Utils.toChecksumAddress('0x0413d212133AFaB8F2B829B1066c7E43cAd94E2c'), 160, 220, 180, 110, false]
|
|
1057
|
+
],
|
|
1058
|
+
];
|
|
1059
|
+
examples.forEach(([expected, actual]) => {
|
|
1060
|
+
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1061
|
+
(0, chai_1.expect)(subDataService_1.compoundV3L2LeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
1062
|
+
});
|
|
1063
|
+
});
|
|
1064
|
+
});
|
|
1065
|
+
describe('decode()', () => {
|
|
1066
|
+
const examples = [
|
|
1067
|
+
[
|
|
1068
|
+
{ targetRatio: 200 },
|
|
1069
|
+
[
|
|
1070
|
+
'0x0000000000000000000000000313d212133AFaB8F2B829B1066c7E43cAd94E2c', '0x0000000000000000000000000213d212133AFaB8F2B829B1066c7E43cAd94E2c',
|
|
1071
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
1072
|
+
],
|
|
1073
|
+
],
|
|
1074
|
+
[
|
|
1075
|
+
{ targetRatio: 123 },
|
|
1076
|
+
[
|
|
1077
|
+
'0x0000000000000000000000000313d212133AFaB8F2B829B1066c7E43cAd94E2c', '0x0000000000000000000000000413d212133AFaB8F2B829B1066c7E43cAd94E2c',
|
|
1078
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000', '0x0000000000000000000000000000000000000000000000001111d67bb1bb0000',
|
|
1079
|
+
],
|
|
1080
|
+
],
|
|
1081
|
+
];
|
|
1082
|
+
examples.forEach(([expected, actual]) => {
|
|
1083
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1084
|
+
(0, chai_1.expect)(subDataService_1.compoundV3L2LeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
1085
|
+
});
|
|
1086
|
+
});
|
|
1087
|
+
});
|
|
1088
|
+
});
|
|
1047
1089
|
});
|