@defisaver/automation-sdk 3.0.0 → 3.0.2-dev
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.dev +1 -1
- package/README.md +3 -3
- package/esm/automation/private/LegacyAutomation.js +2 -2
- package/esm/automation/private/StrategiesAutomation.d.ts +1 -0
- package/esm/automation/private/StrategiesAutomation.js +34 -24
- package/esm/automation/private/StrategiesAutomation.test.d.ts +1 -0
- package/esm/automation/private/StrategiesAutomation.test.js +671 -0
- package/esm/constants/index.js +10 -0
- package/esm/services/ethereumService.test.d.ts +1 -1
- package/esm/services/ethereumService.test.js +1 -0
- package/esm/services/strategiesService.js +37 -0
- package/esm/services/strategiesService.test.d.ts +1 -1
- package/esm/services/strategiesService.test.js +1 -0
- package/esm/services/strategySubService.d.ts +3 -0
- package/esm/services/strategySubService.js +11 -1
- package/esm/services/strategySubService.test.d.ts +1 -1
- package/esm/services/strategySubService.test.js +74 -0
- package/esm/services/subDataService.d.ts +12 -0
- package/esm/services/subDataService.js +33 -1
- package/esm/services/subDataService.test.d.ts +1 -1
- package/esm/services/subDataService.test.js +89 -0
- package/esm/services/triggerService.d.ts +9 -0
- package/esm/services/triggerService.js +17 -1
- package/esm/services/triggerService.test.d.ts +1 -1
- package/esm/services/triggerService.test.js +37 -0
- package/esm/services/utils.test.d.ts +1 -1
- package/esm/services/utils.test.js +1 -0
- package/esm/types/enums.d.ts +5 -2
- package/esm/types/enums.js +3 -0
- package/esm/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/scripts/generateContractTypes.js +1 -1
- package/src/automation/private/LegacyAutomation.ts +2 -2
- package/src/automation/private/StrategiesAutomation.test.ts +663 -0
- package/src/automation/private/StrategiesAutomation.ts +56 -41
- package/src/constants/index.ts +10 -0
- package/src/services/ethereumService.test.ts +1 -0
- package/src/services/strategiesService.test.ts +1 -0
- package/src/services/strategiesService.ts +42 -0
- package/src/services/strategySubService.test.ts +90 -1
- package/src/services/strategySubService.ts +25 -0
- package/src/services/subDataService.test.ts +97 -1
- package/src/services/subDataService.ts +43 -0
- package/src/services/triggerService.test.ts +40 -0
- package/src/services/triggerService.ts +23 -0
- package/src/services/utils.test.ts +1 -0
- package/src/types/enums.ts +3 -0
- package/src/types/index.ts +1 -1
- package/umd/index.js +162 -33
- package/.env +0 -4
- package/.yarn/releases/yarn-1.22.1.cjs +0 -147386
- package/.yarnrc.yml +0 -3
package/esm/constants/index.js
CHANGED
|
@@ -283,6 +283,16 @@ exports.MAINNET_BUNDLES_INFO = {
|
|
|
283
283
|
strategyId: enums_1.Strategies.Identifiers.Boost,
|
|
284
284
|
protocol: exports.PROTOCOLS.CrvUSD,
|
|
285
285
|
},
|
|
286
|
+
[enums_1.Bundles.MainnetIds.MORPHO_BLUE_REPAY]: {
|
|
287
|
+
strategyOrBundleId: enums_1.Bundles.MainnetIds.MORPHO_BLUE_REPAY,
|
|
288
|
+
strategyId: enums_1.Strategies.Identifiers.Repay,
|
|
289
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
290
|
+
},
|
|
291
|
+
[enums_1.Bundles.MainnetIds.MORPHO_BLUE_BOOST]: {
|
|
292
|
+
strategyOrBundleId: enums_1.Bundles.MainnetIds.MORPHO_BLUE_BOOST,
|
|
293
|
+
strategyId: enums_1.Strategies.Identifiers.Boost,
|
|
294
|
+
protocol: exports.PROTOCOLS.MorphoBlue,
|
|
295
|
+
},
|
|
286
296
|
};
|
|
287
297
|
exports.OPTIMISM_BUNDLES_INFO = {
|
|
288
298
|
[enums_1.Bundles.OptimismIds.AAVE_V3_REPAY]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../configuration';
|
|
@@ -16,6 +16,7 @@ const web3_1 = __importDefault(require("web3"));
|
|
|
16
16
|
const chai_1 = require("chai");
|
|
17
17
|
const tokens_1 = require("@defisaver/tokens");
|
|
18
18
|
const enums_1 = require("../types/enums");
|
|
19
|
+
require("../configuration");
|
|
19
20
|
const ethereumService_1 = require("./ethereumService");
|
|
20
21
|
const contractService_1 = require("./contractService");
|
|
21
22
|
require('dotenv').config({ path: '.env' });
|
|
@@ -545,6 +545,39 @@ function parseCrvUSDLeverageManagement(position, parseData) {
|
|
|
545
545
|
_position.strategy.strategyId = enums_1.Strategies.IdOverrides.LeverageManagement;
|
|
546
546
|
return _position;
|
|
547
547
|
}
|
|
548
|
+
function parseMorphoBlueLeverageManagement(position, parseData) {
|
|
549
|
+
const _position = (0, lodash_1.cloneDeep)(position);
|
|
550
|
+
const { subStruct, subId, subHash } = parseData.subscriptionEventData;
|
|
551
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
552
|
+
const triggerData = triggerService.morphoBlueRatioTrigger.decode(subStruct.triggerData);
|
|
553
|
+
const subData = subDataService.morphoBlueLeverageManagementSubData.decode(subStruct.subData);
|
|
554
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
555
|
+
_position.strategyData.decoded.subData = subData;
|
|
556
|
+
const isRepay = _position.strategy.strategyId === enums_1.Strategies.Identifiers.Repay;
|
|
557
|
+
if (isRepay) {
|
|
558
|
+
_position.specific = {
|
|
559
|
+
triggerRepayRatio: triggerData.ratio,
|
|
560
|
+
targetRepayRatio: subData.targetRatio,
|
|
561
|
+
repayEnabled: isEnabled,
|
|
562
|
+
subId1: Number(subId),
|
|
563
|
+
subHashRepay: subHash,
|
|
564
|
+
mergeWithId: enums_1.Strategies.Identifiers.Boost,
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
_position.specific = {
|
|
569
|
+
triggerBoostRatio: triggerData.ratio,
|
|
570
|
+
targetBoostRatio: subData.targetRatio,
|
|
571
|
+
boostEnabled: isEnabled,
|
|
572
|
+
subId2: Number(subId),
|
|
573
|
+
subHashBoost: subHash,
|
|
574
|
+
mergeId: enums_1.Strategies.Identifiers.Boost,
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
_position.positionId = (0, utils_1.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, triggerData.marketId);
|
|
578
|
+
_position.strategy.strategyId = enums_1.Strategies.IdOverrides.LeverageManagement;
|
|
579
|
+
return _position;
|
|
580
|
+
}
|
|
548
581
|
const parsingMethodsMapping = {
|
|
549
582
|
[enums_1.ProtocolIdentifiers.StrategiesAutomation.MakerDAO]: {
|
|
550
583
|
[enums_1.Strategies.Identifiers.SavingsLiqProtection]: parseMakerSavingsLiqProtection,
|
|
@@ -608,6 +641,10 @@ const parsingMethodsMapping = {
|
|
|
608
641
|
[enums_1.Strategies.Identifiers.Repay]: parseCrvUSDLeverageManagement,
|
|
609
642
|
[enums_1.Strategies.Identifiers.Boost]: parseCrvUSDLeverageManagement,
|
|
610
643
|
},
|
|
644
|
+
[enums_1.ProtocolIdentifiers.StrategiesAutomation.MorphoBlue]: {
|
|
645
|
+
[enums_1.Strategies.Identifiers.Repay]: parseMorphoBlueLeverageManagement,
|
|
646
|
+
[enums_1.Strategies.Identifiers.Boost]: parseMorphoBlueLeverageManagement,
|
|
647
|
+
},
|
|
611
648
|
};
|
|
612
649
|
function getParsingMethod(id, strategy) {
|
|
613
650
|
return parsingMethodsMapping[id][strategy.strategyId];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../configuration';
|
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const chai_1 = require("chai");
|
|
13
13
|
const enums_1 = require("../types/enums");
|
|
14
|
+
require("../configuration");
|
|
14
15
|
const strategiesService_1 = require("./strategiesService");
|
|
15
16
|
describe('Feature: strategiesService.ts', () => {
|
|
16
17
|
describe('When testing strategiesService.parseStrategiesAutomatedPosition', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -81,3 +81,6 @@ export declare const sparkEncode: {
|
|
|
81
81
|
export declare const crvUSDEncode: {
|
|
82
82
|
leverageManagement(owner: EthereumAddress, controllerAddr: EthereumAddress, ratioState: RatioState, targetRatio: number, triggerRatio: number, collTokenAddr: EthereumAddress, crvUSDAddr: EthereumAddress): (boolean | string[] | Bundles.MainnetIds)[];
|
|
83
83
|
};
|
|
84
|
+
export declare const morphoBlueEncode: {
|
|
85
|
+
leverageManagement(marketId: string, loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, triggerRatio: number, user: EthereumAddress): (boolean | string[] | Bundles.MainnetIds)[];
|
|
86
|
+
};
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.crvUSDEncode = exports.sparkEncode = exports.exchangeEncode = exports.morphoAaveV2Encode = exports.compoundV3L2Encode = exports.compoundV3Encode = exports.compoundV2Encode = exports.aaveV3Encode = exports.aaveV2Encode = exports.chickenBondsEncode = exports.liquityEncode = exports.makerEncode = void 0;
|
|
29
|
+
exports.morphoBlueEncode = exports.crvUSDEncode = exports.sparkEncode = exports.exchangeEncode = exports.morphoAaveV2Encode = exports.compoundV3L2Encode = exports.compoundV3Encode = exports.compoundV2Encode = exports.aaveV3Encode = exports.aaveV2Encode = exports.chickenBondsEncode = exports.liquityEncode = exports.makerEncode = void 0;
|
|
30
30
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
31
31
|
const tokens_1 = require("@defisaver/tokens");
|
|
32
32
|
const enums_1 = require("../types/enums");
|
|
@@ -233,3 +233,13 @@ exports.crvUSDEncode = {
|
|
|
233
233
|
return [strategyOrBundleId, isBundle, triggerData, subData];
|
|
234
234
|
},
|
|
235
235
|
};
|
|
236
|
+
exports.morphoBlueEncode = {
|
|
237
|
+
leverageManagement(marketId, loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, triggerRatio, user) {
|
|
238
|
+
const subData = subDataService.morphoBlueLeverageManagementSubData.encode(loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user);
|
|
239
|
+
const triggerData = triggerService.morphoBlueRatioTrigger.encode(marketId, user, triggerRatio, ratioState);
|
|
240
|
+
// over is boost, under is repay
|
|
241
|
+
const strategyOrBundleId = ratioState === enums_1.RatioState.OVER ? enums_1.Bundles.MainnetIds.MORPHO_BLUE_BOOST : enums_1.Bundles.MainnetIds.MORPHO_BLUE_REPAY;
|
|
242
|
+
const isBundle = true;
|
|
243
|
+
return [strategyOrBundleId, isBundle, triggerData, subData];
|
|
244
|
+
},
|
|
245
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../configuration';
|
|
@@ -32,6 +32,7 @@ const sdk_1 = require("@defisaver/sdk");
|
|
|
32
32
|
const tokens_1 = require("@defisaver/tokens");
|
|
33
33
|
const web3Utils = __importStar(require("web3-utils"));
|
|
34
34
|
const enums_1 = require("../types/enums");
|
|
35
|
+
require("../configuration");
|
|
35
36
|
const strategySubService_1 = require("./strategySubService");
|
|
36
37
|
describe('Feature: strategySubService.ts', () => {
|
|
37
38
|
describe('When testing strategySubService.makerEncode', () => {
|
|
@@ -750,6 +751,79 @@ describe('Feature: strategySubService.ts', () => {
|
|
|
750
751
|
});
|
|
751
752
|
});
|
|
752
753
|
});
|
|
754
|
+
describe('When testing strategySubService.morphoBlueEncode', () => {
|
|
755
|
+
describe('leverageManagement()', () => {
|
|
756
|
+
const examples = [
|
|
757
|
+
[
|
|
758
|
+
[
|
|
759
|
+
enums_1.Bundles.MainnetIds.MORPHO_BLUE_REPAY,
|
|
760
|
+
true,
|
|
761
|
+
[
|
|
762
|
+
'0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec410000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c00000000000000000000000000000000000000000000000010a741a4627800000000000000000000000000000000000000000000000000000000000000000001',
|
|
763
|
+
],
|
|
764
|
+
[
|
|
765
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
766
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
767
|
+
'0x0000000000000000000000002a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
768
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
769
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
770
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
771
|
+
'0x000000000000000000000000000000000000000000000000136dcc951d8c0000',
|
|
772
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
773
|
+
],
|
|
774
|
+
],
|
|
775
|
+
[
|
|
776
|
+
'0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41',
|
|
777
|
+
web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
|
|
778
|
+
web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
|
|
779
|
+
web3Utils.toChecksumAddress('0x2a01eb9496094da03c4e364def50f5ad1280ad72'),
|
|
780
|
+
web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
|
|
781
|
+
'945000000000000000',
|
|
782
|
+
enums_1.RatioState.UNDER,
|
|
783
|
+
140,
|
|
784
|
+
120,
|
|
785
|
+
web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c')
|
|
786
|
+
]
|
|
787
|
+
],
|
|
788
|
+
[
|
|
789
|
+
[
|
|
790
|
+
enums_1.Bundles.MainnetIds.MORPHO_BLUE_BOOST,
|
|
791
|
+
true,
|
|
792
|
+
[
|
|
793
|
+
'0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec410000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c0000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000000'
|
|
794
|
+
],
|
|
795
|
+
[
|
|
796
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
797
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
798
|
+
'0x0000000000000000000000002a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
799
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
800
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
801
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
802
|
+
'0x00000000000000000000000000000000000000000000000016345785d8a00000',
|
|
803
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
804
|
+
],
|
|
805
|
+
],
|
|
806
|
+
[
|
|
807
|
+
'0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41',
|
|
808
|
+
web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
|
|
809
|
+
web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'),
|
|
810
|
+
web3Utils.toChecksumAddress('0x2a01eb9496094da03c4e364def50f5ad1280ad72'),
|
|
811
|
+
web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'),
|
|
812
|
+
'945000000000000000',
|
|
813
|
+
enums_1.RatioState.OVER,
|
|
814
|
+
160,
|
|
815
|
+
200,
|
|
816
|
+
web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c')
|
|
817
|
+
]
|
|
818
|
+
],
|
|
819
|
+
];
|
|
820
|
+
examples.forEach(([expected, actual]) => {
|
|
821
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
822
|
+
(0, chai_1.expect)(strategySubService_1.morphoBlueEncode.leverageManagement(...actual)).to.eql(expected);
|
|
823
|
+
});
|
|
824
|
+
});
|
|
825
|
+
});
|
|
826
|
+
});
|
|
753
827
|
describe('When testing strategySubService.compoundV3L2Encode', () => {
|
|
754
828
|
describe('leverageManagement()', () => {
|
|
755
829
|
const examples = [
|
|
@@ -158,3 +158,15 @@ export declare const crvUSDLeverageManagementSubData: {
|
|
|
158
158
|
targetRatio: number;
|
|
159
159
|
};
|
|
160
160
|
};
|
|
161
|
+
export declare const morphoBlueLeverageManagementSubData: {
|
|
162
|
+
encode: (loanToken: EthereumAddress, collToken: EthereumAddress, oracle: EthereumAddress, irm: EthereumAddress, lltv: string, ratioState: RatioState, targetRatio: number, user: EthereumAddress) => string[];
|
|
163
|
+
decode: (subData: string[]) => {
|
|
164
|
+
loanToken: string;
|
|
165
|
+
collToken: string;
|
|
166
|
+
oracle: string;
|
|
167
|
+
irm: string;
|
|
168
|
+
lltv: string;
|
|
169
|
+
user: string;
|
|
170
|
+
targetRatio: number;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.crvUSDLeverageManagementSubData = exports.liquityDebtInFrontRepaySubData = exports.liquityDsrSupplySubData = exports.liquityDsrPaybackSubData = exports.sparkQuotePriceSubData = exports.sparkLeverageManagementSubData = exports.exchangeLimitOrderSubData = exports.exchangeDcaSubData = exports.liquityPaybackUsingChickenBondSubData = exports.cBondsRebondSubData = exports.morphoAaveV2LeverageManagementSubData = exports.compoundV3L2LeverageManagementSubData = exports.compoundV3LeverageManagementSubData = exports.compoundV2LeverageManagementSubData = exports.aaveV3QuotePriceSubData = exports.aaveV3LeverageManagementSubData = exports.aaveV2LeverageManagementSubData = exports.liquityCloseSubData = exports.liquityLeverageManagementSubData = exports.makerLeverageManagementSubData = exports.makerCloseSubData = exports.liquityRepayFromSavingsSubData = exports.makerRepayFromSavingsSubData = void 0;
|
|
6
|
+
exports.morphoBlueLeverageManagementSubData = exports.crvUSDLeverageManagementSubData = exports.liquityDebtInFrontRepaySubData = exports.liquityDsrSupplySubData = exports.liquityDsrPaybackSubData = exports.sparkQuotePriceSubData = exports.sparkLeverageManagementSubData = exports.exchangeLimitOrderSubData = exports.exchangeDcaSubData = exports.liquityPaybackUsingChickenBondSubData = exports.cBondsRebondSubData = exports.morphoAaveV2LeverageManagementSubData = exports.compoundV3L2LeverageManagementSubData = exports.compoundV3LeverageManagementSubData = exports.compoundV2LeverageManagementSubData = exports.aaveV3QuotePriceSubData = exports.aaveV3LeverageManagementSubData = exports.aaveV2LeverageManagementSubData = exports.liquityCloseSubData = exports.liquityLeverageManagementSubData = exports.makerLeverageManagementSubData = exports.makerCloseSubData = exports.liquityRepayFromSavingsSubData = exports.makerRepayFromSavingsSubData = void 0;
|
|
7
7
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
8
8
|
const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
|
|
9
9
|
const tokens_1 = require("@defisaver/tokens");
|
|
@@ -378,3 +378,35 @@ exports.crvUSDLeverageManagementSubData = {
|
|
|
378
378
|
return { controller, targetRatio };
|
|
379
379
|
},
|
|
380
380
|
};
|
|
381
|
+
exports.morphoBlueLeverageManagementSubData = {
|
|
382
|
+
encode: (loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user) => {
|
|
383
|
+
const loanTokenEncoded = web3_eth_abi_1.default.encodeParameter('address', loanToken);
|
|
384
|
+
const collTokenEncoded = web3_eth_abi_1.default.encodeParameter('address', collToken);
|
|
385
|
+
const oracleEncoded = web3_eth_abi_1.default.encodeParameter('address', oracle);
|
|
386
|
+
const irmEncoded = web3_eth_abi_1.default.encodeParameter('address', irm);
|
|
387
|
+
const lltvEncoded = web3_eth_abi_1.default.encodeParameter('uint256', lltv);
|
|
388
|
+
const ratioStateEncoded = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
|
|
389
|
+
const targetRatioEncoded = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
390
|
+
const userEncoded = web3_eth_abi_1.default.encodeParameter('address', user);
|
|
391
|
+
return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded];
|
|
392
|
+
},
|
|
393
|
+
decode: (subData) => {
|
|
394
|
+
const loanToken = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
|
|
395
|
+
const collToken = web3_eth_abi_1.default.decodeParameter('address', subData[1]);
|
|
396
|
+
const oracle = web3_eth_abi_1.default.decodeParameter('address', subData[2]);
|
|
397
|
+
const irm = web3_eth_abi_1.default.decodeParameter('address', subData[3]);
|
|
398
|
+
const lltv = web3_eth_abi_1.default.decodeParameter('uint256', subData[4]);
|
|
399
|
+
const weiRatio = web3_eth_abi_1.default.decodeParameter('uint256', subData[6]);
|
|
400
|
+
const user = web3_eth_abi_1.default.decodeParameter('address', subData[7]);
|
|
401
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(weiRatio);
|
|
402
|
+
return {
|
|
403
|
+
loanToken,
|
|
404
|
+
collToken,
|
|
405
|
+
oracle,
|
|
406
|
+
irm,
|
|
407
|
+
lltv,
|
|
408
|
+
user,
|
|
409
|
+
targetRatio,
|
|
410
|
+
};
|
|
411
|
+
},
|
|
412
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../configuration';
|
|
@@ -31,6 +31,7 @@ const chai_1 = require("chai");
|
|
|
31
31
|
const tokens_1 = require("@defisaver/tokens");
|
|
32
32
|
const web3Utils = __importStar(require("web3-utils"));
|
|
33
33
|
const enums_1 = require("../types/enums");
|
|
34
|
+
require("../configuration");
|
|
34
35
|
const subDataService_1 = require("./subDataService");
|
|
35
36
|
describe('Feature: subDataService.ts', () => {
|
|
36
37
|
describe('When testing subDataService.makerRepayFromSavingsSubData', () => {
|
|
@@ -1086,4 +1087,92 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1086
1087
|
});
|
|
1087
1088
|
});
|
|
1088
1089
|
});
|
|
1090
|
+
describe('When testing subDataService.morphoBlueLeverageManagementSubData', () => {
|
|
1091
|
+
describe('encode()', () => {
|
|
1092
|
+
const examples = [
|
|
1093
|
+
[
|
|
1094
|
+
[
|
|
1095
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1096
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1097
|
+
'0x0000000000000000000000002a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
1098
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1099
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
1100
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
1101
|
+
'0x00000000000000000000000000000000000000000000000010a741a462780000',
|
|
1102
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
1103
|
+
],
|
|
1104
|
+
[web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'), web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), web3Utils.toChecksumAddress('0x2a01eb9496094da03c4e364def50f5ad1280ad72'), web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'), '945000000000000000', enums_1.RatioState.UNDER, 120, web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c')]
|
|
1105
|
+
],
|
|
1106
|
+
[
|
|
1107
|
+
[
|
|
1108
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
1109
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1110
|
+
'0x00000000000000000000000048f7e36eb6b826b2df4b2e630b62cd25e89e40e2',
|
|
1111
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1112
|
+
'0x0000000000000000000000000000000000000000000000000bef55718ad60000',
|
|
1113
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1114
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
1115
|
+
'0x0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c',
|
|
1116
|
+
],
|
|
1117
|
+
[web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'), web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), web3Utils.toChecksumAddress('0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2'), web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'), '860000000000000000', enums_1.RatioState.OVER, 200, web3Utils.toChecksumAddress('0x0043d218133AFaB8F2B829B106633E434Ad94E2c')]
|
|
1118
|
+
],
|
|
1119
|
+
];
|
|
1120
|
+
examples.forEach(([expected, actual]) => {
|
|
1121
|
+
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1122
|
+
(0, chai_1.expect)(subDataService_1.morphoBlueLeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
1123
|
+
});
|
|
1124
|
+
});
|
|
1125
|
+
});
|
|
1126
|
+
describe('decode()', () => {
|
|
1127
|
+
const examples = [
|
|
1128
|
+
[
|
|
1129
|
+
{
|
|
1130
|
+
'collToken': '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
1131
|
+
'irm': '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
1132
|
+
'lltv': '945000000000000000',
|
|
1133
|
+
'loanToken': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
1134
|
+
'oracle': '0x2a01EB9496094dA03c4E364Def50f5aD1280AD72',
|
|
1135
|
+
'targetRatio': 120,
|
|
1136
|
+
'user': '0x1031d218133AFaB8C2B819B1366c7e434Ad91e9c',
|
|
1137
|
+
},
|
|
1138
|
+
[
|
|
1139
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1140
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1141
|
+
'0x0000000000000000000000002a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
1142
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1143
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
1144
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
1145
|
+
'0x00000000000000000000000000000000000000000000000010a741a462780000',
|
|
1146
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
1147
|
+
],
|
|
1148
|
+
],
|
|
1149
|
+
[
|
|
1150
|
+
{
|
|
1151
|
+
'collToken': '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
1152
|
+
'irm': '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
1153
|
+
'lltv': '860000000000000000',
|
|
1154
|
+
'loanToken': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
1155
|
+
'oracle': '0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2',
|
|
1156
|
+
'targetRatio': 200,
|
|
1157
|
+
'user': '0x0043d218133aFaB8F2b829B106633E434aD94e2C',
|
|
1158
|
+
},
|
|
1159
|
+
[
|
|
1160
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
1161
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1162
|
+
'0x00000000000000000000000048f7e36eb6b826b2df4b2e630b62cd25e89e40e2',
|
|
1163
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1164
|
+
'0x0000000000000000000000000000000000000000000000000bef55718ad60000',
|
|
1165
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1166
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
1167
|
+
'0x0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c',
|
|
1168
|
+
],
|
|
1169
|
+
],
|
|
1170
|
+
];
|
|
1171
|
+
examples.forEach(([expected, actual]) => {
|
|
1172
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1173
|
+
(0, chai_1.expect)(subDataService_1.morphoBlueLeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
1174
|
+
});
|
|
1175
|
+
});
|
|
1176
|
+
});
|
|
1177
|
+
});
|
|
1089
1178
|
});
|
|
@@ -172,3 +172,12 @@ export declare const crvUSDRatioTrigger: {
|
|
|
172
172
|
ratioState: number;
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
|
+
export declare const morphoBlueRatioTrigger: {
|
|
176
|
+
encode(marketId: string, owner: EthereumAddress, ratioPercentage: number, ratioState: RatioState): string[];
|
|
177
|
+
decode(triggerData: string[]): {
|
|
178
|
+
marketId: string;
|
|
179
|
+
owner: string;
|
|
180
|
+
ratio: number;
|
|
181
|
+
ratioState: number;
|
|
182
|
+
};
|
|
183
|
+
};
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.crvUSDRatioTrigger = exports.curveUsdSoftLiquidationTrigger = exports.curveUsdBorrowRateTrigger = exports.sparkQuotePriceTrigger = exports.sparkRatioTrigger = exports.exchangeOffchainPriceTrigger = exports.exchangeTimestampTrigger = exports.compoundV3RatioTrigger = exports.cBondsRebondTrigger = exports.aaveV2RatioTrigger = exports.liquityDebtInFrontWithLimitTrigger = exports.liquityDebtInFrontTrigger = exports.liquityRatioTrigger = exports.compoundV2RatioTrigger = exports.aaveV3QuotePriceWithMaximumGasPriceTrigger = exports.aaveV3QuotePriceTrigger = exports.morphoAaveV2RatioTrigger = exports.aaveV3RatioTrigger = exports.makerRatioTrigger = exports.trailingStopTrigger = exports.chainlinkPriceTrigger = void 0;
|
|
29
|
+
exports.morphoBlueRatioTrigger = exports.crvUSDRatioTrigger = exports.curveUsdSoftLiquidationTrigger = exports.curveUsdBorrowRateTrigger = exports.sparkQuotePriceTrigger = exports.sparkRatioTrigger = exports.exchangeOffchainPriceTrigger = exports.exchangeTimestampTrigger = exports.compoundV3RatioTrigger = exports.cBondsRebondTrigger = exports.aaveV2RatioTrigger = exports.liquityDebtInFrontWithLimitTrigger = exports.liquityDebtInFrontTrigger = exports.liquityRatioTrigger = exports.compoundV2RatioTrigger = exports.aaveV3QuotePriceWithMaximumGasPriceTrigger = exports.aaveV3QuotePriceTrigger = exports.morphoAaveV2RatioTrigger = exports.aaveV3RatioTrigger = exports.makerRatioTrigger = exports.trailingStopTrigger = exports.chainlinkPriceTrigger = void 0;
|
|
30
30
|
const decimal_js_1 = __importDefault(require("decimal.js"));
|
|
31
31
|
const tokens_1 = require("@defisaver/tokens");
|
|
32
32
|
const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
|
|
@@ -335,3 +335,19 @@ exports.crvUSDRatioTrigger = {
|
|
|
335
335
|
};
|
|
336
336
|
},
|
|
337
337
|
};
|
|
338
|
+
exports.morphoBlueRatioTrigger = {
|
|
339
|
+
encode(marketId, // bytes32
|
|
340
|
+
owner, ratioPercentage, ratioState) {
|
|
341
|
+
const ratioWei = (0, utils_1.ratioPercentageToWei)(ratioPercentage);
|
|
342
|
+
return [web3_eth_abi_1.default.encodeParameters(['bytes32', 'address', 'uint256', 'uint8'], [marketId, owner, ratioWei, ratioState])];
|
|
343
|
+
},
|
|
344
|
+
decode(triggerData) {
|
|
345
|
+
const decodedData = web3_eth_abi_1.default.decodeParameters(['bytes32', 'address', 'uint256', 'uint8'], triggerData[0]);
|
|
346
|
+
return {
|
|
347
|
+
marketId: decodedData[0],
|
|
348
|
+
owner: decodedData[1],
|
|
349
|
+
ratio: (0, utils_1.weiToRatioPercentage)(decodedData[2]),
|
|
350
|
+
ratioState: Number(decodedData[3]),
|
|
351
|
+
};
|
|
352
|
+
},
|
|
353
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../configuration';
|
|
@@ -27,6 +27,7 @@ const chai_1 = require("chai");
|
|
|
27
27
|
const tokens_1 = require("@defisaver/tokens");
|
|
28
28
|
const web3Utils = __importStar(require("web3-utils"));
|
|
29
29
|
const enums_1 = require("../types/enums");
|
|
30
|
+
require("../configuration");
|
|
30
31
|
const triggerService_1 = require("./triggerService");
|
|
31
32
|
describe('Feature: triggerService.ts', () => {
|
|
32
33
|
describe('When testing triggerService.chainlinkPriceTrigger', () => {
|
|
@@ -858,4 +859,40 @@ describe('Feature: triggerService.ts', () => {
|
|
|
858
859
|
});
|
|
859
860
|
});
|
|
860
861
|
});
|
|
862
|
+
describe('When testing triggerService.morphoBlueRatioTrigger', () => {
|
|
863
|
+
describe('encode()', () => {
|
|
864
|
+
const examples = [
|
|
865
|
+
[
|
|
866
|
+
['0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec410000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c00000000000000000000000000000000000000000000000010a741a4627800000000000000000000000000000000000000000000000000000000000000000001'],
|
|
867
|
+
['0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41', web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'), 120, enums_1.RatioState.UNDER]
|
|
868
|
+
],
|
|
869
|
+
[
|
|
870
|
+
['0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c0000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000000'],
|
|
871
|
+
['0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc', web3Utils.toChecksumAddress('0x0043d218133AFaB8F2B829B106633E434Ad94E2c'), 200, enums_1.RatioState.OVER]
|
|
872
|
+
],
|
|
873
|
+
];
|
|
874
|
+
examples.forEach(([expected, actual]) => {
|
|
875
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
876
|
+
(0, chai_1.expect)(triggerService_1.morphoBlueRatioTrigger.encode(...actual)).to.eql(expected);
|
|
877
|
+
});
|
|
878
|
+
});
|
|
879
|
+
});
|
|
880
|
+
describe('decode()', () => {
|
|
881
|
+
const examples = [
|
|
882
|
+
[
|
|
883
|
+
{ marketId: '0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41', owner: web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'), ratio: 120, ratioState: enums_1.RatioState.UNDER },
|
|
884
|
+
['0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec410000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c00000000000000000000000000000000000000000000000010a741a4627800000000000000000000000000000000000000000000000000000000000000000001'],
|
|
885
|
+
],
|
|
886
|
+
[
|
|
887
|
+
{ marketId: '0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc', owner: web3Utils.toChecksumAddress('0x0043d218133AFaB8F2B829B106633E434Ad94E2c'), ratio: 200, ratioState: enums_1.RatioState.OVER },
|
|
888
|
+
['0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c0000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000000'],
|
|
889
|
+
],
|
|
890
|
+
];
|
|
891
|
+
examples.forEach(([expected, actual]) => {
|
|
892
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
893
|
+
(0, chai_1.expect)(triggerService_1.morphoBlueRatioTrigger.decode(actual)).to.eql(expected);
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
});
|
|
897
|
+
});
|
|
861
898
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../configuration';
|
|
@@ -32,6 +32,7 @@ const web3_eth_abi_1 = __importDefault(require("web3-eth-abi"));
|
|
|
32
32
|
const tokens_1 = require("@defisaver/tokens");
|
|
33
33
|
const enums_1 = require("../types/enums");
|
|
34
34
|
const strategySubService_1 = require("./strategySubService");
|
|
35
|
+
require("../configuration");
|
|
35
36
|
const utils_1 = require("./utils");
|
|
36
37
|
describe('Feature: utils.ts', () => {
|
|
37
38
|
describe('When testing utils.isDefined()', () => {
|
package/esm/types/enums.d.ts
CHANGED
|
@@ -35,7 +35,8 @@ export declare namespace ProtocolIdentifiers {
|
|
|
35
35
|
MorphoAaveV2 = "Morpho-Aave__V2",
|
|
36
36
|
Exchange = "Exchange",
|
|
37
37
|
Spark = "Spark",
|
|
38
|
-
CrvUSD = "CurveUSD"
|
|
38
|
+
CrvUSD = "CurveUSD",
|
|
39
|
+
MorphoBlue = "MorphoBlue"
|
|
39
40
|
}
|
|
40
41
|
enum LegacyAutomation {
|
|
41
42
|
MakerDAO = "MakerDAO",
|
|
@@ -130,7 +131,9 @@ export declare namespace Bundles {
|
|
|
130
131
|
COMP_V2_REPAY = 20,
|
|
131
132
|
COMP_V2_BOOST = 21,
|
|
132
133
|
CRVUSD_REPAY = 26,
|
|
133
|
-
CRVUSD_BOOST = 27
|
|
134
|
+
CRVUSD_BOOST = 27,
|
|
135
|
+
MORPHO_BLUE_REPAY = 32,
|
|
136
|
+
MORPHO_BLUE_BOOST = 33
|
|
134
137
|
}
|
|
135
138
|
enum OptimismIds {
|
|
136
139
|
AAVE_V3_REPAY = 0,
|
package/esm/types/enums.js
CHANGED
|
@@ -45,6 +45,7 @@ var ProtocolIdentifiers;
|
|
|
45
45
|
StrategiesAutomation["Exchange"] = "Exchange";
|
|
46
46
|
StrategiesAutomation["Spark"] = "Spark";
|
|
47
47
|
StrategiesAutomation["CrvUSD"] = "CurveUSD";
|
|
48
|
+
StrategiesAutomation["MorphoBlue"] = "MorphoBlue";
|
|
48
49
|
})(StrategiesAutomation = ProtocolIdentifiers.StrategiesAutomation || (ProtocolIdentifiers.StrategiesAutomation = {}));
|
|
49
50
|
let LegacyAutomation;
|
|
50
51
|
(function (LegacyAutomation) {
|
|
@@ -149,6 +150,8 @@ var Bundles;
|
|
|
149
150
|
MainnetIds[MainnetIds["COMP_V2_BOOST"] = 21] = "COMP_V2_BOOST";
|
|
150
151
|
MainnetIds[MainnetIds["CRVUSD_REPAY"] = 26] = "CRVUSD_REPAY";
|
|
151
152
|
MainnetIds[MainnetIds["CRVUSD_BOOST"] = 27] = "CRVUSD_BOOST";
|
|
153
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_REPAY"] = 32] = "MORPHO_BLUE_REPAY";
|
|
154
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_BOOST"] = 33] = "MORPHO_BLUE_BOOST";
|
|
152
155
|
})(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
|
|
153
156
|
let OptimismIds;
|
|
154
157
|
(function (OptimismIds) {
|
package/esm/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defisaver/automation-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2-dev",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./umd/index.js",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@babel/eslint-parser": "^7.12.17",
|
|
37
37
|
"@babel/preset-env": "^7.12.11",
|
|
38
38
|
"@babel/preset-typescript": "^7.12.7",
|
|
39
|
-
"
|
|
39
|
+
"typechain-target-web3-v1-3mihai3": "^6.0.1",
|
|
40
40
|
"@types/chai": "^4.3.6",
|
|
41
41
|
"@types/lodash": "^4.14.191",
|
|
42
42
|
"@types/mocha": "^10.0.1",
|
|
@@ -101,12 +101,12 @@ export default class LegacyAutomation extends Automation {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
protected async getParsedSubscriptions(addresses?: EthereumAddress[], options?: SubscriptionOptions): Promise<Position.LegacyAutomated[]> {
|
|
104
|
-
|
|
104
|
+
const legacyAutomationSunset = 18213086;
|
|
105
105
|
if (
|
|
106
106
|
!options?.fromBlock
|
|
107
107
|
|| options?.fromBlock === 'latest'
|
|
108
108
|
|| options?.fromBlock === 'pending'
|
|
109
|
-
|| (options?.fromBlock && new Dec(options?.fromBlock.toString()).
|
|
109
|
+
|| (options?.fromBlock && new Dec(options?.fromBlock.toString()).gte(legacyAutomationSunset))
|
|
110
110
|
) {
|
|
111
111
|
return [];
|
|
112
112
|
}
|