@defisaver/automation-sdk 2.1.0 → 2.1.2
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/.yarn/releases/yarn-1.22.1.cjs +147386 -0
- package/.yarnrc.yml +3 -0
- package/README.md +3 -0
- package/esm/automation/private/StrategiesAutomation.js +3 -1
- package/esm/services/triggerService.js +1 -12
- package/esm/services/triggerService.test.js +50 -46
- package/package.json +1 -1
- package/src/automation/private/StrategiesAutomation.ts +5 -1
- package/src/services/triggerService.test.ts +51 -51
- package/src/services/triggerService.ts +2 -13
- package/umd/index.js +3 -13
- package/.env +0 -4
package/.yarnrc.yml
ADDED
package/README.md
CHANGED
|
@@ -18,6 +18,9 @@ const subscriptions = await ethereumStrategies.getSubscriptionsFor(
|
|
|
18
18
|
{
|
|
19
19
|
fromBlock: 0,
|
|
20
20
|
toBlock: 'latest',
|
|
21
|
+
mergeWithSameId: true, // Used for merging subscriptions with same strategy ID (e.g. boost and repay)
|
|
22
|
+
enabledOnly: true,
|
|
23
|
+
unexpiredOnly: true, // Referring to exchange subscriptions
|
|
21
24
|
}
|
|
22
25
|
);
|
|
23
26
|
|
|
@@ -125,7 +125,9 @@ class StrategiesAutomation extends Automation_1.default {
|
|
|
125
125
|
const mergePairIndex = copyList.findIndex(s => (s && s.specific.mergeWithSameId
|
|
126
126
|
&& s.owner === current.owner
|
|
127
127
|
&& s.strategy.strategyId === current.strategy.strategyId
|
|
128
|
-
&& s.protocol.id === current.protocol.id
|
|
128
|
+
&& s.protocol.id === current.protocol.id
|
|
129
|
+
&& (s.protocol.id !== enums_1.ProtocolIdentifiers.StrategiesAutomation.MakerDAO // reflexer needs to get added if we have it
|
|
130
|
+
|| s.strategyData.decoded.subData.vaultId === current.strategyData.decoded.triggerData.vaultId)));
|
|
129
131
|
if (mergePairIndex !== -1) {
|
|
130
132
|
const mergePair = copyList[mergePairIndex];
|
|
131
133
|
if ((0, utils_1.isDefined)(mergePair)) {
|
|
@@ -166,18 +166,6 @@ exports.liquityRatioTrigger = {
|
|
|
166
166
|
},
|
|
167
167
|
};
|
|
168
168
|
exports.liquityDebtInFrontTrigger = {
|
|
169
|
-
encode(owner, debtInFrontMin) {
|
|
170
|
-
return [web3_eth_abi_1.default.encodeParameters(['address', 'uint256'], [owner, debtInFrontMin])];
|
|
171
|
-
},
|
|
172
|
-
decode(triggerData) {
|
|
173
|
-
const decodedData = web3_eth_abi_1.default.decodeParameters(['address', 'uint256'], triggerData[0]);
|
|
174
|
-
return {
|
|
175
|
-
owner: decodedData[0],
|
|
176
|
-
debtInFrontMin: decodedData[1],
|
|
177
|
-
};
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
exports.liquityDebtInFrontWithLimitTrigger = {
|
|
181
169
|
encode(owner, debtInFrontMin) {
|
|
182
170
|
const debtInFrontMinWei = web3Utils.toWei(new decimal_js_1.default(debtInFrontMin).toString(), 'ether');
|
|
183
171
|
return [web3_eth_abi_1.default.encodeParameters(['address', 'uint256'], [owner, debtInFrontMinWei])];
|
|
@@ -190,6 +178,7 @@ exports.liquityDebtInFrontWithLimitTrigger = {
|
|
|
190
178
|
};
|
|
191
179
|
},
|
|
192
180
|
};
|
|
181
|
+
exports.liquityDebtInFrontWithLimitTrigger = exports.liquityDebtInFrontTrigger;
|
|
193
182
|
exports.aaveV2RatioTrigger = {
|
|
194
183
|
encode(owner, market, ratioPercentage, ratioState) {
|
|
195
184
|
const ratioWei = (0, utils_1.ratioPercentageToWei)(ratioPercentage);
|
|
@@ -363,17 +363,34 @@ describe('Feature: triggerService.ts', () => {
|
|
|
363
363
|
describe('encode()', () => {
|
|
364
364
|
const examples = [
|
|
365
365
|
[
|
|
366
|
-
['
|
|
366
|
+
['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434ad94e2c00000000000000000000000000000000000000000000006e0be8c4995af80000'],
|
|
367
367
|
[web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434Ad94E2c'), '2030']
|
|
368
368
|
],
|
|
369
369
|
[
|
|
370
|
-
['
|
|
370
|
+
['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434a192e2c000000000000000000000000000000000000000000004697f83e6356dd440000'],
|
|
371
371
|
[web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434A192E2c'), '333369']
|
|
372
372
|
],
|
|
373
|
+
[
|
|
374
|
+
['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf000000000000000000000000000000000000000000084595161401484a000000'],
|
|
375
|
+
[web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'), '10000000']
|
|
376
|
+
],
|
|
377
|
+
[
|
|
378
|
+
['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf0000000000000000000000000000000000000000000000000000000000989680'],
|
|
379
|
+
[web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'), '0.00000000001']
|
|
380
|
+
],
|
|
381
|
+
[
|
|
382
|
+
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a0000000000000000000000000000000000000000019d971e4fe8401e74000000'],
|
|
383
|
+
[web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '500000000']
|
|
384
|
+
],
|
|
385
|
+
[
|
|
386
|
+
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a00000000000000000000000000000000000000000001a784379d99db42000000'],
|
|
387
|
+
[web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '2000000']
|
|
388
|
+
],
|
|
373
389
|
];
|
|
374
390
|
examples.forEach(([expected, actual]) => {
|
|
375
391
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
376
392
|
(0, chai_1.expect)(triggerService_1.liquityDebtInFrontTrigger.encode(...actual)).to.eql(expected);
|
|
393
|
+
(0, chai_1.expect)(triggerService_1.liquityDebtInFrontWithLimitTrigger.encode(...actual)).to.eql(expected);
|
|
377
394
|
});
|
|
378
395
|
});
|
|
379
396
|
});
|
|
@@ -384,19 +401,48 @@ describe('Feature: triggerService.ts', () => {
|
|
|
384
401
|
owner: web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434Ad94E2c'),
|
|
385
402
|
debtInFrontMin: '2030',
|
|
386
403
|
},
|
|
387
|
-
['
|
|
404
|
+
['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434ad94e2c00000000000000000000000000000000000000000000006e0be8c4995af80000'],
|
|
388
405
|
],
|
|
389
406
|
[
|
|
390
407
|
{
|
|
391
408
|
owner: web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434A192E2c'),
|
|
392
409
|
debtInFrontMin: '333369',
|
|
393
410
|
},
|
|
394
|
-
['
|
|
411
|
+
['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434a192e2c000000000000000000000000000000000000000000004697f83e6356dd440000'],
|
|
412
|
+
],
|
|
413
|
+
[
|
|
414
|
+
{
|
|
415
|
+
owner: web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'),
|
|
416
|
+
debtInFrontMin: '10000000',
|
|
417
|
+
},
|
|
418
|
+
['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf000000000000000000000000000000000000000000084595161401484a000000'],
|
|
419
|
+
],
|
|
420
|
+
[
|
|
421
|
+
{
|
|
422
|
+
owner: web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'),
|
|
423
|
+
debtInFrontMin: '0.00000000001',
|
|
424
|
+
},
|
|
425
|
+
['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf0000000000000000000000000000000000000000000000000000000000989680'],
|
|
426
|
+
],
|
|
427
|
+
[
|
|
428
|
+
{
|
|
429
|
+
owner: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
|
|
430
|
+
debtInFrontMin: '500000000',
|
|
431
|
+
},
|
|
432
|
+
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a0000000000000000000000000000000000000000019d971e4fe8401e74000000'],
|
|
433
|
+
],
|
|
434
|
+
[
|
|
435
|
+
{
|
|
436
|
+
owner: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
|
|
437
|
+
debtInFrontMin: '2000000',
|
|
438
|
+
},
|
|
439
|
+
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a00000000000000000000000000000000000000000001a784379d99db42000000'],
|
|
395
440
|
],
|
|
396
441
|
];
|
|
397
442
|
examples.forEach(([expected, actual]) => {
|
|
398
443
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
399
444
|
(0, chai_1.expect)(triggerService_1.liquityDebtInFrontTrigger.decode(actual)).to.eql(expected);
|
|
445
|
+
(0, chai_1.expect)(triggerService_1.liquityDebtInFrontWithLimitTrigger.decode(actual)).to.eql(expected);
|
|
400
446
|
});
|
|
401
447
|
});
|
|
402
448
|
});
|
|
@@ -776,46 +822,4 @@ describe('Feature: triggerService.ts', () => {
|
|
|
776
822
|
});
|
|
777
823
|
});
|
|
778
824
|
});
|
|
779
|
-
describe('When testing triggerService.liquityDebtInFrontWithLimitTrigger', () => {
|
|
780
|
-
describe('encode()', () => {
|
|
781
|
-
const examples = [
|
|
782
|
-
[
|
|
783
|
-
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a0000000000000000000000000000000000000000019d971e4fe8401e74000000'],
|
|
784
|
-
[web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '500000000']
|
|
785
|
-
],
|
|
786
|
-
[
|
|
787
|
-
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a00000000000000000000000000000000000000000001a784379d99db42000000'],
|
|
788
|
-
[web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '2000000']
|
|
789
|
-
],
|
|
790
|
-
];
|
|
791
|
-
examples.forEach(([expected, actual]) => {
|
|
792
|
-
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
793
|
-
(0, chai_1.expect)(triggerService_1.liquityDebtInFrontWithLimitTrigger.encode(...actual)).to.eql(expected);
|
|
794
|
-
});
|
|
795
|
-
});
|
|
796
|
-
});
|
|
797
|
-
describe('decode()', () => {
|
|
798
|
-
const examples = [
|
|
799
|
-
[
|
|
800
|
-
{
|
|
801
|
-
owner: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
|
|
802
|
-
debtInFrontMin: '500000000',
|
|
803
|
-
},
|
|
804
|
-
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a0000000000000000000000000000000000000000019d971e4fe8401e74000000'],
|
|
805
|
-
],
|
|
806
|
-
[
|
|
807
|
-
{
|
|
808
|
-
owner: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
|
|
809
|
-
debtInFrontMin: '2000000',
|
|
810
|
-
},
|
|
811
|
-
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a00000000000000000000000000000000000000000001a784379d99db42000000'],
|
|
812
|
-
],
|
|
813
|
-
];
|
|
814
|
-
examples.forEach(([expected, actual]) => {
|
|
815
|
-
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
816
|
-
(0, chai_1.expect)(triggerService_1.liquityDebtInFrontWithLimitTrigger.decode(actual)).to.eql(expected);
|
|
817
|
-
});
|
|
818
|
-
});
|
|
819
|
-
});
|
|
820
|
-
});
|
|
821
825
|
});
|
package/package.json
CHANGED
|
@@ -165,6 +165,10 @@ export default class StrategiesAutomation extends Automation {
|
|
|
165
165
|
&& s.owner === current.owner
|
|
166
166
|
&& s.strategy.strategyId === current.strategy.strategyId
|
|
167
167
|
&& s.protocol.id === current.protocol.id
|
|
168
|
+
&& (
|
|
169
|
+
s.protocol.id !== ProtocolIdentifiers.StrategiesAutomation.MakerDAO // reflexer needs to get added if we have it
|
|
170
|
+
|| s.strategyData.decoded.subData.vaultId === current.strategyData.decoded.triggerData.vaultId
|
|
171
|
+
)
|
|
168
172
|
));
|
|
169
173
|
|
|
170
174
|
if (mergePairIndex !== -1) {
|
|
@@ -212,4 +216,4 @@ export default class StrategiesAutomation extends Automation {
|
|
|
212
216
|
public async getSubscriptionsFor(addresses: EthereumAddress[], options?: SubscriptionOptions): Promise<(Position.Automated | null)[]> {
|
|
213
217
|
return this._getSubscriptions(addresses, options);
|
|
214
218
|
}
|
|
215
|
-
}
|
|
219
|
+
}
|
|
@@ -395,18 +395,35 @@ describe('Feature: triggerService.ts', () => {
|
|
|
395
395
|
describe('encode()', () => {
|
|
396
396
|
const examples: Array<[[string], [owner: EthereumAddress, debtInFrontMin: string]]> = [
|
|
397
397
|
[
|
|
398
|
-
['
|
|
398
|
+
['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434ad94e2c00000000000000000000000000000000000000000000006e0be8c4995af80000'],
|
|
399
399
|
[web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434Ad94E2c'), '2030']
|
|
400
400
|
],
|
|
401
401
|
[
|
|
402
|
-
['
|
|
402
|
+
['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434a192e2c000000000000000000000000000000000000000000004697f83e6356dd440000'],
|
|
403
403
|
[web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434A192E2c'), '333369']
|
|
404
404
|
],
|
|
405
|
+
[
|
|
406
|
+
['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf000000000000000000000000000000000000000000084595161401484a000000'],
|
|
407
|
+
[web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'), '10000000']
|
|
408
|
+
],
|
|
409
|
+
[
|
|
410
|
+
['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf0000000000000000000000000000000000000000000000000000000000989680'],
|
|
411
|
+
[web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'), '0.00000000001']
|
|
412
|
+
],
|
|
413
|
+
[
|
|
414
|
+
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a0000000000000000000000000000000000000000019d971e4fe8401e74000000'],
|
|
415
|
+
[web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '500000000']
|
|
416
|
+
],
|
|
417
|
+
[
|
|
418
|
+
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a00000000000000000000000000000000000000000001a784379d99db42000000'],
|
|
419
|
+
[web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '2000000']
|
|
420
|
+
],
|
|
405
421
|
];
|
|
406
422
|
|
|
407
423
|
examples.forEach(([expected, actual]) => {
|
|
408
424
|
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
409
425
|
expect(liquityDebtInFrontTrigger.encode(...actual)).to.eql(expected);
|
|
426
|
+
expect(liquityDebtInFrontWithLimitTrigger.encode(...actual)).to.eql(expected);
|
|
410
427
|
});
|
|
411
428
|
});
|
|
412
429
|
});
|
|
@@ -418,20 +435,49 @@ describe('Feature: triggerService.ts', () => {
|
|
|
418
435
|
owner: web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434Ad94E2c'),
|
|
419
436
|
debtInFrontMin: '2030',
|
|
420
437
|
},
|
|
421
|
-
['
|
|
438
|
+
['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434ad94e2c00000000000000000000000000000000000000000000006e0be8c4995af80000'],
|
|
422
439
|
],
|
|
423
440
|
[
|
|
424
441
|
{
|
|
425
442
|
owner: web3Utils.toChecksumAddress('0x0049d218133AFaB8F2B829B1066c7E434A192E2c'),
|
|
426
443
|
debtInFrontMin: '333369',
|
|
427
444
|
},
|
|
428
|
-
['
|
|
445
|
+
['0x0000000000000000000000000049d218133afab8f2b829b1066c7e434a192e2c000000000000000000000000000000000000000000004697f83e6356dd440000'],
|
|
446
|
+
],
|
|
447
|
+
[
|
|
448
|
+
{
|
|
449
|
+
owner: web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'),
|
|
450
|
+
debtInFrontMin: '10000000',
|
|
451
|
+
},
|
|
452
|
+
['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf000000000000000000000000000000000000000000084595161401484a000000'],
|
|
453
|
+
],
|
|
454
|
+
[
|
|
455
|
+
{
|
|
456
|
+
owner: web3Utils.toChecksumAddress('0x30462AD9D8F01A20A2EC7E7F1A8F1B303662AEBF'),
|
|
457
|
+
debtInFrontMin: '0.00000000001',
|
|
458
|
+
},
|
|
459
|
+
['0x00000000000000000000000030462ad9d8f01a20a2ec7e7f1a8f1b303662aebf0000000000000000000000000000000000000000000000000000000000989680'],
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
{
|
|
463
|
+
owner: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
|
|
464
|
+
debtInFrontMin: '500000000',
|
|
465
|
+
},
|
|
466
|
+
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a0000000000000000000000000000000000000000019d971e4fe8401e74000000'],
|
|
467
|
+
],
|
|
468
|
+
[
|
|
469
|
+
{
|
|
470
|
+
owner: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
|
|
471
|
+
debtInFrontMin: '2000000',
|
|
472
|
+
},
|
|
473
|
+
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a00000000000000000000000000000000000000000001a784379d99db42000000'],
|
|
429
474
|
],
|
|
430
475
|
];
|
|
431
476
|
|
|
432
477
|
examples.forEach(([expected, actual]) => {
|
|
433
478
|
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
434
479
|
expect(liquityDebtInFrontTrigger.decode(actual)).to.eql(expected);
|
|
480
|
+
expect(liquityDebtInFrontWithLimitTrigger.decode(actual)).to.eql(expected);
|
|
435
481
|
});
|
|
436
482
|
});
|
|
437
483
|
});
|
|
@@ -848,50 +894,4 @@ describe('Feature: triggerService.ts', () => {
|
|
|
848
894
|
});
|
|
849
895
|
});
|
|
850
896
|
|
|
851
|
-
|
|
852
|
-
describe('encode()', () => {
|
|
853
|
-
const examples: Array<[[string], [owner: EthereumAddress, debtInFrontMin: string]]> = [
|
|
854
|
-
[
|
|
855
|
-
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a0000000000000000000000000000000000000000019d971e4fe8401e74000000'],
|
|
856
|
-
[web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '500000000']
|
|
857
|
-
],
|
|
858
|
-
[
|
|
859
|
-
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a00000000000000000000000000000000000000000001a784379d99db42000000'],
|
|
860
|
-
[web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'), '2000000']
|
|
861
|
-
],
|
|
862
|
-
];
|
|
863
|
-
|
|
864
|
-
examples.forEach(([expected, actual]) => {
|
|
865
|
-
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
866
|
-
expect(liquityDebtInFrontWithLimitTrigger.encode(...actual)).to.eql(expected);
|
|
867
|
-
});
|
|
868
|
-
});
|
|
869
|
-
});
|
|
870
|
-
|
|
871
|
-
describe('decode()', () => {
|
|
872
|
-
const examples: Array<[{ owner: EthereumAddress, debtInFrontMin: string }, TriggerData]> = [
|
|
873
|
-
[
|
|
874
|
-
{
|
|
875
|
-
owner: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
|
|
876
|
-
debtInFrontMin: '500000000',
|
|
877
|
-
},
|
|
878
|
-
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a0000000000000000000000000000000000000000019d971e4fe8401e74000000'],
|
|
879
|
-
],
|
|
880
|
-
[
|
|
881
|
-
{
|
|
882
|
-
owner: web3Utils.toChecksumAddress('0x235d6A8DB3C57c3f7b4ebA749E1738Db6093732a'),
|
|
883
|
-
debtInFrontMin: '2000000',
|
|
884
|
-
},
|
|
885
|
-
['0x000000000000000000000000235d6a8db3c57c3f7b4eba749e1738db6093732a00000000000000000000000000000000000000000001a784379d99db42000000'],
|
|
886
|
-
],
|
|
887
|
-
];
|
|
888
|
-
|
|
889
|
-
examples.forEach(([expected, actual]) => {
|
|
890
|
-
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
891
|
-
expect(liquityDebtInFrontWithLimitTrigger.decode(actual)).to.eql(expected);
|
|
892
|
-
});
|
|
893
|
-
});
|
|
894
|
-
});
|
|
895
|
-
});
|
|
896
|
-
|
|
897
|
-
});
|
|
897
|
+
});
|
|
@@ -172,19 +172,6 @@ export const liquityRatioTrigger = {
|
|
|
172
172
|
};
|
|
173
173
|
|
|
174
174
|
export const liquityDebtInFrontTrigger = {
|
|
175
|
-
encode(owner: EthereumAddress, debtInFrontMin: string) {
|
|
176
|
-
return [AbiCoder.encodeParameters(['address', 'uint256'], [owner, debtInFrontMin])];
|
|
177
|
-
},
|
|
178
|
-
decode(triggerData: TriggerData): { owner: EthereumAddress, debtInFrontMin: string } {
|
|
179
|
-
const decodedData = AbiCoder.decodeParameters(['address', 'uint256'], triggerData[0]);
|
|
180
|
-
return {
|
|
181
|
-
owner: decodedData[0] as EthereumAddress,
|
|
182
|
-
debtInFrontMin: decodedData[1] as string,
|
|
183
|
-
};
|
|
184
|
-
},
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export const liquityDebtInFrontWithLimitTrigger = {
|
|
188
175
|
encode(owner: EthereumAddress, debtInFrontMin: string) {
|
|
189
176
|
const debtInFrontMinWei = web3Utils.toWei(new Dec(debtInFrontMin).toString(), 'ether');
|
|
190
177
|
return [AbiCoder.encodeParameters(['address', 'uint256'], [owner, debtInFrontMinWei])];
|
|
@@ -198,6 +185,8 @@ export const liquityDebtInFrontWithLimitTrigger = {
|
|
|
198
185
|
},
|
|
199
186
|
};
|
|
200
187
|
|
|
188
|
+
export const liquityDebtInFrontWithLimitTrigger = liquityDebtInFrontTrigger;
|
|
189
|
+
|
|
201
190
|
export const aaveV2RatioTrigger = {
|
|
202
191
|
encode(owner: EthereumAddress, market: EthereumAddress, ratioPercentage: number, ratioState: RatioState) {
|
|
203
192
|
const ratioWei = ratioPercentageToWei(ratioPercentage);
|
package/umd/index.js
CHANGED
|
@@ -1541,7 +1541,8 @@ class StrategiesAutomation extends _Automation__WEBPACK_IMPORTED_MODULE_6__["def
|
|
|
1541
1541
|
var copyList = [...list];
|
|
1542
1542
|
if ((0,_services_utils__WEBPACK_IMPORTED_MODULE_2__.isDefined)(current)) {
|
|
1543
1543
|
if (current.specific.mergeWithSameId) {
|
|
1544
|
-
var mergePairIndex = copyList.findIndex(s => s && s.specific.mergeWithSameId && s.owner === current.owner && s.strategy.strategyId === current.strategy.strategyId && s.protocol.id === current.protocol.id
|
|
1544
|
+
var mergePairIndex = copyList.findIndex(s => s && s.specific.mergeWithSameId && s.owner === current.owner && s.strategy.strategyId === current.strategy.strategyId && s.protocol.id === current.protocol.id && (s.protocol.id !== _types_enums__WEBPACK_IMPORTED_MODULE_1__.ProtocolIdentifiers.StrategiesAutomation.MakerDAO // reflexer needs to get added if we have it
|
|
1545
|
+
|| s.strategyData.decoded.subData.vaultId === current.strategyData.decoded.triggerData.vaultId));
|
|
1545
1546
|
if (mergePairIndex !== -1) {
|
|
1546
1547
|
var mergePair = copyList[mergePairIndex];
|
|
1547
1548
|
if ((0,_services_utils__WEBPACK_IMPORTED_MODULE_2__.isDefined)(mergePair)) {
|
|
@@ -32961,18 +32962,6 @@ var liquityRatioTrigger = {
|
|
|
32961
32962
|
}
|
|
32962
32963
|
};
|
|
32963
32964
|
var liquityDebtInFrontTrigger = {
|
|
32964
|
-
encode(owner, debtInFrontMin) {
|
|
32965
|
-
return [web3_eth_abi__WEBPACK_IMPORTED_MODULE_2___default().encodeParameters(['address', 'uint256'], [owner, debtInFrontMin])];
|
|
32966
|
-
},
|
|
32967
|
-
decode(triggerData) {
|
|
32968
|
-
var decodedData = web3_eth_abi__WEBPACK_IMPORTED_MODULE_2___default().decodeParameters(['address', 'uint256'], triggerData[0]);
|
|
32969
|
-
return {
|
|
32970
|
-
owner: decodedData[0],
|
|
32971
|
-
debtInFrontMin: decodedData[1]
|
|
32972
|
-
};
|
|
32973
|
-
}
|
|
32974
|
-
};
|
|
32975
|
-
var liquityDebtInFrontWithLimitTrigger = {
|
|
32976
32965
|
encode(owner, debtInFrontMin) {
|
|
32977
32966
|
var debtInFrontMinWei = web3_utils__WEBPACK_IMPORTED_MODULE_3__.toWei(new (decimal_js__WEBPACK_IMPORTED_MODULE_0___default())(debtInFrontMin).toString(), 'ether');
|
|
32978
32967
|
return [web3_eth_abi__WEBPACK_IMPORTED_MODULE_2___default().encodeParameters(['address', 'uint256'], [owner, debtInFrontMinWei])];
|
|
@@ -32985,6 +32974,7 @@ var liquityDebtInFrontWithLimitTrigger = {
|
|
|
32985
32974
|
};
|
|
32986
32975
|
}
|
|
32987
32976
|
};
|
|
32977
|
+
var liquityDebtInFrontWithLimitTrigger = liquityDebtInFrontTrigger;
|
|
32988
32978
|
var aaveV2RatioTrigger = {
|
|
32989
32979
|
encode(owner, market, ratioPercentage, ratioState) {
|
|
32990
32980
|
var ratioWei = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.ratioPercentageToWei)(ratioPercentage);
|
package/.env
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
RPC_1=https://mainnet.infura.io/v3/a3503e4501d040cd9ea2c913c68983a1
|
|
2
|
-
RPC_10=https://opt-mainnet.g.alchemy.com/v2/Pwh-hdbsP7Bf0CP_UMw4_Pw-NfHhSpIA
|
|
3
|
-
RPC_8453=https://base-mainnet.g.alchemy.com/v2/TERsAaPNcA7sgCVHHAMBvd95UtT4wCEf
|
|
4
|
-
RPC_42161=https://arb-mainnet.g.alchemy.com/v2/Pwh-hdbsP7Bf0CP_UMw4_Pw-NfHhSpIA
|