@defisaver/automation-sdk 3.0.1 → 3.0.2-dev2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/automation/private/LegacyAutomation.js +2 -2
- package/esm/automation/private/StrategiesAutomation.js +9 -1
- package/esm/automation/private/StrategiesAutomation.test.d.ts +1 -1
- package/esm/automation/private/StrategiesAutomation.test.js +500 -499
- package/esm/constants/index.d.ts +4 -25
- package/esm/constants/index.js +77 -1
- package/esm/services/ethereumService.test.d.ts +1 -1
- package/esm/services/ethereumService.test.js +1 -0
- package/esm/services/strategiesService.js +63 -3
- package/esm/services/strategiesService.test.d.ts +1 -1
- package/esm/services/strategiesService.test.js +1 -0
- package/esm/services/strategySubService.d.ts +17 -0
- package/esm/services/strategySubService.js +30 -1
- package/esm/services/strategySubService.test.d.ts +1 -1
- package/esm/services/strategySubService.test.js +152 -0
- package/esm/services/subDataService.d.ts +32 -0
- package/esm/services/subDataService.js +96 -1
- package/esm/services/subDataService.test.d.ts +1 -1
- package/esm/services/subDataService.test.js +193 -0
- package/esm/services/triggerService.d.ts +17 -0
- package/esm/services/triggerService.js +31 -1
- package/esm/services/triggerService.test.d.ts +1 -1
- package/esm/services/triggerService.test.js +65 -0
- package/esm/services/utils.test.d.ts +1 -1
- package/esm/services/utils.test.js +1 -0
- package/esm/types/enums.d.ts +27 -8
- package/esm/types/enums.js +19 -0
- package/package.json +3 -3
- package/scripts/generateContractTypes.js +1 -1
- package/src/automation/private/LegacyAutomation.ts +2 -2
- package/src/automation/private/StrategiesAutomation.test.ts +503 -501
- package/src/automation/private/StrategiesAutomation.ts +9 -0
- package/src/constants/index.ts +80 -3
- package/src/services/ethereumService.test.ts +1 -0
- package/src/services/ethereumService.ts +1 -1
- package/src/services/strategiesService.test.ts +1 -0
- package/src/services/strategiesService.ts +81 -3
- package/src/services/strategySubService.test.ts +187 -1
- package/src/services/strategySubService.ts +68 -0
- package/src/services/subDataService.test.ts +212 -1
- package/src/services/subDataService.ts +134 -1
- package/src/services/triggerService.test.ts +70 -0
- package/src/services/triggerService.ts +44 -1
- package/src/services/utils.test.ts +1 -0
- package/src/types/enums.ts +19 -0
- package/umd/index.js +397 -58
- package/.env +0 -4
- package/.yarn/releases/yarn-1.22.1.cjs +0 -147386
- package/.yarnrc.yml +0 -3
|
@@ -3,9 +3,10 @@ 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.aaveV3OpenOrderSubData = exports.morphoBlueLeverageManagementSubData = exports.crvUSDPaybackSubData = 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
|
+
const web3_utils_1 = require("web3-utils");
|
|
9
10
|
const tokens_1 = require("@defisaver/tokens");
|
|
10
11
|
const sdk_1 = require("@defisaver/sdk");
|
|
11
12
|
const enums_1 = require("../types/enums");
|
|
@@ -378,3 +379,97 @@ exports.crvUSDLeverageManagementSubData = {
|
|
|
378
379
|
return { controller, targetRatio };
|
|
379
380
|
},
|
|
380
381
|
};
|
|
382
|
+
exports.crvUSDPaybackSubData = {
|
|
383
|
+
encode: (controllerAddr, addressToPullTokensFrom, positionOwner, paybackAmount, crvUSDAddr) => {
|
|
384
|
+
const controllerAddrEncoded = web3_eth_abi_1.default.encodeParameter('address', controllerAddr);
|
|
385
|
+
const addressToPullTokensFromEncoded = web3_eth_abi_1.default.encodeParameter('address', addressToPullTokensFrom);
|
|
386
|
+
const positionOwnerEncoded = web3_eth_abi_1.default.encodeParameter('address', positionOwner);
|
|
387
|
+
const paybackAmountEncoded = web3_eth_abi_1.default.encodeParameter('uint256', (0, web3_utils_1.toWei)(paybackAmount, 'ether'));
|
|
388
|
+
const crvUSDAddrEncoded = web3_eth_abi_1.default.encodeParameter('address', crvUSDAddr);
|
|
389
|
+
return [
|
|
390
|
+
controllerAddrEncoded,
|
|
391
|
+
addressToPullTokensFromEncoded,
|
|
392
|
+
positionOwnerEncoded,
|
|
393
|
+
paybackAmountEncoded,
|
|
394
|
+
crvUSDAddrEncoded,
|
|
395
|
+
];
|
|
396
|
+
},
|
|
397
|
+
decode: (subData) => {
|
|
398
|
+
const controller = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
|
|
399
|
+
const addressToPullTokensFrom = web3_eth_abi_1.default.decodeParameter('address', subData[1]);
|
|
400
|
+
const positionOwner = web3_eth_abi_1.default.decodeParameter('address', subData[2]);
|
|
401
|
+
const weiPaybackAmount = web3_eth_abi_1.default.decodeParameter('uint256', subData[3]);
|
|
402
|
+
const paybackAmount = (0, web3_utils_1.fromWei)(weiPaybackAmount, 'ether');
|
|
403
|
+
return {
|
|
404
|
+
controller,
|
|
405
|
+
addressToPullTokensFrom,
|
|
406
|
+
positionOwner,
|
|
407
|
+
paybackAmount,
|
|
408
|
+
};
|
|
409
|
+
},
|
|
410
|
+
};
|
|
411
|
+
exports.morphoBlueLeverageManagementSubData = {
|
|
412
|
+
encode: (loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA) => {
|
|
413
|
+
const loanTokenEncoded = web3_eth_abi_1.default.encodeParameter('address', loanToken);
|
|
414
|
+
const collTokenEncoded = web3_eth_abi_1.default.encodeParameter('address', collToken);
|
|
415
|
+
const oracleEncoded = web3_eth_abi_1.default.encodeParameter('address', oracle);
|
|
416
|
+
const irmEncoded = web3_eth_abi_1.default.encodeParameter('address', irm);
|
|
417
|
+
const lltvEncoded = web3_eth_abi_1.default.encodeParameter('uint256', lltv);
|
|
418
|
+
const ratioStateEncoded = web3_eth_abi_1.default.encodeParameter('uint8', ratioState);
|
|
419
|
+
const targetRatioEncoded = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
420
|
+
const userEncoded = web3_eth_abi_1.default.encodeParameter('address', user);
|
|
421
|
+
const isEOAEncoded = web3_eth_abi_1.default.encodeParameter('bool', isEOA);
|
|
422
|
+
return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOAEncoded];
|
|
423
|
+
},
|
|
424
|
+
decode: (subData) => {
|
|
425
|
+
const loanToken = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
|
|
426
|
+
const collToken = web3_eth_abi_1.default.decodeParameter('address', subData[1]);
|
|
427
|
+
const oracle = web3_eth_abi_1.default.decodeParameter('address', subData[2]);
|
|
428
|
+
const irm = web3_eth_abi_1.default.decodeParameter('address', subData[3]);
|
|
429
|
+
const lltv = web3_eth_abi_1.default.decodeParameter('uint256', subData[4]);
|
|
430
|
+
const weiRatio = web3_eth_abi_1.default.decodeParameter('uint256', subData[6]);
|
|
431
|
+
const user = web3_eth_abi_1.default.decodeParameter('address', subData[7]);
|
|
432
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(weiRatio);
|
|
433
|
+
return {
|
|
434
|
+
loanToken,
|
|
435
|
+
collToken,
|
|
436
|
+
oracle,
|
|
437
|
+
irm,
|
|
438
|
+
lltv,
|
|
439
|
+
user,
|
|
440
|
+
targetRatio,
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
exports.aaveV3OpenOrderSubData = {
|
|
445
|
+
encode(collAsset, collAssetId, debtAsset, debtAssetId, marketAddr, targetRatio) {
|
|
446
|
+
const encodedColl = web3_eth_abi_1.default.encodeParameter('address', collAsset);
|
|
447
|
+
const encodedCollId = web3_eth_abi_1.default.encodeParameter('uint8', collAssetId);
|
|
448
|
+
const encodedDebt = web3_eth_abi_1.default.encodeParameter('address', debtAsset);
|
|
449
|
+
const encodedDebtId = web3_eth_abi_1.default.encodeParameter('uint8', debtAssetId);
|
|
450
|
+
const encodedMarket = web3_eth_abi_1.default.encodeParameter('address', marketAddr);
|
|
451
|
+
const encodedTargetRatio = web3_eth_abi_1.default.encodeParameter('uint256', (0, utils_1.ratioPercentageToWei)(targetRatio));
|
|
452
|
+
const useOnBehalfEncoded = web3_eth_abi_1.default.encodeParameter('bool', false);
|
|
453
|
+
return [
|
|
454
|
+
encodedColl,
|
|
455
|
+
encodedCollId,
|
|
456
|
+
encodedDebt,
|
|
457
|
+
encodedDebtId,
|
|
458
|
+
encodedMarket,
|
|
459
|
+
encodedTargetRatio,
|
|
460
|
+
useOnBehalfEncoded,
|
|
461
|
+
];
|
|
462
|
+
},
|
|
463
|
+
decode(subData) {
|
|
464
|
+
const collAsset = web3_eth_abi_1.default.decodeParameter('address', subData[0]);
|
|
465
|
+
const collAssetId = Number(web3_eth_abi_1.default.decodeParameter('uint8', subData[1]));
|
|
466
|
+
const debtAsset = web3_eth_abi_1.default.decodeParameter('address', subData[2]);
|
|
467
|
+
const debtAssetId = Number(web3_eth_abi_1.default.decodeParameter('uint8', subData[3]));
|
|
468
|
+
const marketAddr = web3_eth_abi_1.default.decodeParameter('address', subData[4]);
|
|
469
|
+
const weiRatio = web3_eth_abi_1.default.decodeParameter('uint256', subData[5]);
|
|
470
|
+
const targetRatio = (0, utils_1.weiToRatioPercentage)(weiRatio);
|
|
471
|
+
return {
|
|
472
|
+
collAsset, collAssetId, debtAsset, debtAssetId, marketAddr, targetRatio,
|
|
473
|
+
};
|
|
474
|
+
},
|
|
475
|
+
};
|
|
@@ -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', () => {
|
|
@@ -1044,6 +1045,51 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1044
1045
|
});
|
|
1045
1046
|
});
|
|
1046
1047
|
});
|
|
1048
|
+
describe('When testing subDataService.crvUSDPaybackSubData', () => {
|
|
1049
|
+
describe('encode()', () => {
|
|
1050
|
+
const examples = [
|
|
1051
|
+
[
|
|
1052
|
+
[
|
|
1053
|
+
'0x000000000000000000000000a920de414ea4ab66b97da1bfe9e6eca7d4219635',
|
|
1054
|
+
'0x000000000000000000000000dc0ad7a48088f1aa55d26f8b36f7c1e827ddd280',
|
|
1055
|
+
'0x000000000000000000000000dc0ad7a48088f1aa55d26f8b36f7c1e827ddd280',
|
|
1056
|
+
'0x00000000000000000000000000000000000000000000043c33c1937564800000',
|
|
1057
|
+
'0x000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e',
|
|
1058
|
+
],
|
|
1059
|
+
['0xa920de414ea4ab66b97da1bfe9e6eca7d4219635', '0xDc0Ad7a48088f1AA55d26f8b36F7C1E827DdD280', '0xDc0Ad7a48088f1AA55d26f8b36F7C1E827DdD280', '20000', '0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E'],
|
|
1060
|
+
]
|
|
1061
|
+
];
|
|
1062
|
+
examples.forEach(([expected, actual]) => {
|
|
1063
|
+
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1064
|
+
(0, chai_1.expect)(subDataService_1.crvUSDPaybackSubData.encode(...actual)).to.eql(expected);
|
|
1065
|
+
});
|
|
1066
|
+
});
|
|
1067
|
+
});
|
|
1068
|
+
describe('decode()', () => {
|
|
1069
|
+
const examples = [
|
|
1070
|
+
[
|
|
1071
|
+
{
|
|
1072
|
+
controller: '0xA920De414eA4Ab66b97dA1bFE9e6EcA7d4219635',
|
|
1073
|
+
addressToPullTokensFrom: '0xDc0Ad7a48088f1AA55d26f8b36F7C1E827DdD280',
|
|
1074
|
+
positionOwner: '0xDc0Ad7a48088f1AA55d26f8b36F7C1E827DdD280',
|
|
1075
|
+
paybackAmount: '20000'
|
|
1076
|
+
},
|
|
1077
|
+
[
|
|
1078
|
+
'0x000000000000000000000000a920de414ea4ab66b97da1bfe9e6eca7d4219635',
|
|
1079
|
+
'0x000000000000000000000000dc0ad7a48088f1aa55d26f8b36f7c1e827ddd280',
|
|
1080
|
+
'0x000000000000000000000000dc0ad7a48088f1aa55d26f8b36f7c1e827ddd280',
|
|
1081
|
+
'0x00000000000000000000000000000000000000000000043c33c1937564800000',
|
|
1082
|
+
'0x000000000000000000000000f939e0a03fb07f59a73314e73794be0e57ac1b4e',
|
|
1083
|
+
]
|
|
1084
|
+
]
|
|
1085
|
+
];
|
|
1086
|
+
examples.forEach(([expected, actual]) => {
|
|
1087
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1088
|
+
(0, chai_1.expect)(subDataService_1.crvUSDPaybackSubData.decode(actual)).to.eql(expected);
|
|
1089
|
+
});
|
|
1090
|
+
});
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1047
1093
|
describe('When testing subDataService.compoundV3L2LeverageManagementSubData', () => {
|
|
1048
1094
|
describe('encode()', () => {
|
|
1049
1095
|
const examples = [
|
|
@@ -1086,4 +1132,151 @@ describe('Feature: subDataService.ts', () => {
|
|
|
1086
1132
|
});
|
|
1087
1133
|
});
|
|
1088
1134
|
});
|
|
1135
|
+
describe('When testing subDataService.morphoBlueLeverageManagementSubData', () => {
|
|
1136
|
+
describe('encode()', () => {
|
|
1137
|
+
const examples = [
|
|
1138
|
+
[
|
|
1139
|
+
[
|
|
1140
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1141
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1142
|
+
'0x0000000000000000000000002a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
1143
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1144
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
1145
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
1146
|
+
'0x00000000000000000000000000000000000000000000000010a741a462780000',
|
|
1147
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
1148
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1149
|
+
],
|
|
1150
|
+
[web3Utils.toChecksumAddress('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'), web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), web3Utils.toChecksumAddress('0x2a01eb9496094da03c4e364def50f5ad1280ad72'), web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'), '945000000000000000', enums_1.RatioState.UNDER, 120, web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'), false]
|
|
1151
|
+
],
|
|
1152
|
+
[
|
|
1153
|
+
[
|
|
1154
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
1155
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1156
|
+
'0x00000000000000000000000048f7e36eb6b826b2df4b2e630b62cd25e89e40e2',
|
|
1157
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1158
|
+
'0x0000000000000000000000000000000000000000000000000bef55718ad60000',
|
|
1159
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1160
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
1161
|
+
'0x0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c',
|
|
1162
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1163
|
+
],
|
|
1164
|
+
[web3Utils.toChecksumAddress('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'), web3Utils.toChecksumAddress('0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0'), web3Utils.toChecksumAddress('0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2'), web3Utils.toChecksumAddress('0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC'), '860000000000000000', enums_1.RatioState.OVER, 200, web3Utils.toChecksumAddress('0x0043d218133AFaB8F2B829B106633E434Ad94E2c'), false]
|
|
1165
|
+
],
|
|
1166
|
+
];
|
|
1167
|
+
examples.forEach(([expected, actual]) => {
|
|
1168
|
+
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1169
|
+
(0, chai_1.expect)(subDataService_1.morphoBlueLeverageManagementSubData.encode(...actual)).to.eql(expected);
|
|
1170
|
+
});
|
|
1171
|
+
});
|
|
1172
|
+
});
|
|
1173
|
+
describe('decode()', () => {
|
|
1174
|
+
const examples = [
|
|
1175
|
+
[
|
|
1176
|
+
{
|
|
1177
|
+
'collToken': '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
1178
|
+
'irm': '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
1179
|
+
'lltv': '945000000000000000',
|
|
1180
|
+
'loanToken': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
1181
|
+
'oracle': '0x2a01EB9496094dA03c4E364Def50f5aD1280AD72',
|
|
1182
|
+
'targetRatio': 120,
|
|
1183
|
+
'user': '0x1031d218133AFaB8C2B819B1366c7e434Ad91e9c',
|
|
1184
|
+
},
|
|
1185
|
+
[
|
|
1186
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1187
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1188
|
+
'0x0000000000000000000000002a01eb9496094da03c4e364def50f5ad1280ad72',
|
|
1189
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1190
|
+
'0x0000000000000000000000000000000000000000000000000d1d507e40be8000',
|
|
1191
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
1192
|
+
'0x00000000000000000000000000000000000000000000000010a741a462780000',
|
|
1193
|
+
'0x0000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c',
|
|
1194
|
+
],
|
|
1195
|
+
],
|
|
1196
|
+
[
|
|
1197
|
+
{
|
|
1198
|
+
'collToken': '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
|
|
1199
|
+
'irm': '0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC',
|
|
1200
|
+
'lltv': '860000000000000000',
|
|
1201
|
+
'loanToken': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
1202
|
+
'oracle': '0x48F7E36EB6B826B2dF4B2E630B62Cd25e89E40e2',
|
|
1203
|
+
'targetRatio': 200,
|
|
1204
|
+
'user': '0x0043d218133aFaB8F2b829B106633E434aD94e2C',
|
|
1205
|
+
},
|
|
1206
|
+
[
|
|
1207
|
+
'0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',
|
|
1208
|
+
'0x0000000000000000000000007f39c581f595b53c5cb19bd0b3f8da6c935e2ca0',
|
|
1209
|
+
'0x00000000000000000000000048f7e36eb6b826b2df4b2e630b62cd25e89e40e2',
|
|
1210
|
+
'0x000000000000000000000000870ac11d48b15db9a138cf899d20f13f79ba00bc',
|
|
1211
|
+
'0x0000000000000000000000000000000000000000000000000bef55718ad60000',
|
|
1212
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1213
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
1214
|
+
'0x0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c',
|
|
1215
|
+
],
|
|
1216
|
+
],
|
|
1217
|
+
];
|
|
1218
|
+
examples.forEach(([expected, actual]) => {
|
|
1219
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1220
|
+
(0, chai_1.expect)(subDataService_1.morphoBlueLeverageManagementSubData.decode(actual)).to.eql(expected);
|
|
1221
|
+
});
|
|
1222
|
+
});
|
|
1223
|
+
});
|
|
1224
|
+
});
|
|
1225
|
+
describe('When testing subDataService.aaveV3OpenOrderSubData', () => {
|
|
1226
|
+
describe('encode()', () => {
|
|
1227
|
+
const examples = [
|
|
1228
|
+
[
|
|
1229
|
+
[
|
|
1230
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1231
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1232
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
1233
|
+
'0x0000000000000000000000000000000000000000000000000000000000000004',
|
|
1234
|
+
'0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
1235
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
1236
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1237
|
+
],
|
|
1238
|
+
[
|
|
1239
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
1240
|
+
0,
|
|
1241
|
+
web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
1242
|
+
4,
|
|
1243
|
+
web3Utils.toChecksumAddress('0x2f39d218133afab8f2b819b1066c7e434ad94e9e'),
|
|
1244
|
+
200,
|
|
1245
|
+
]
|
|
1246
|
+
],
|
|
1247
|
+
];
|
|
1248
|
+
examples.forEach(([expected, actual]) => {
|
|
1249
|
+
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
1250
|
+
(0, chai_1.expect)(subDataService_1.aaveV3OpenOrderSubData.encode(...actual)).to.eql(expected);
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
});
|
|
1254
|
+
describe('decode()', () => {
|
|
1255
|
+
const examples = [
|
|
1256
|
+
[
|
|
1257
|
+
{
|
|
1258
|
+
collAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('WETH', enums_1.ChainId.Ethereum).address),
|
|
1259
|
+
collAssetId: 0,
|
|
1260
|
+
debtAsset: web3Utils.toChecksumAddress((0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Ethereum).address),
|
|
1261
|
+
debtAssetId: 4,
|
|
1262
|
+
marketAddr: web3Utils.toChecksumAddress('0x2f39d218133afab8f2b819b1066c7e434ad94e9e'),
|
|
1263
|
+
targetRatio: 200,
|
|
1264
|
+
},
|
|
1265
|
+
[
|
|
1266
|
+
'0x000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
1267
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
1268
|
+
'0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f',
|
|
1269
|
+
'0x0000000000000000000000000000000000000000000000000000000000000004',
|
|
1270
|
+
'0x0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e',
|
|
1271
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
1272
|
+
],
|
|
1273
|
+
],
|
|
1274
|
+
];
|
|
1275
|
+
examples.forEach(([expected, actual]) => {
|
|
1276
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
1277
|
+
(0, chai_1.expect)(subDataService_1.aaveV3OpenOrderSubData.decode(actual)).to.eql(expected);
|
|
1278
|
+
});
|
|
1279
|
+
});
|
|
1280
|
+
});
|
|
1281
|
+
});
|
|
1089
1282
|
});
|
|
@@ -172,3 +172,20 @@ export declare const crvUSDRatioTrigger: {
|
|
|
172
172
|
ratioState: number;
|
|
173
173
|
};
|
|
174
174
|
};
|
|
175
|
+
export declare const crvUsdHealthRatioTrigger: {
|
|
176
|
+
encode(owner: EthereumAddress, controller: EthereumAddress, ratioPercentage: number): string[];
|
|
177
|
+
decode(triggerData: string[]): {
|
|
178
|
+
owner: string;
|
|
179
|
+
controller: string;
|
|
180
|
+
ratio: number;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
export declare const morphoBlueRatioTrigger: {
|
|
184
|
+
encode(marketId: string, owner: EthereumAddress, ratioPercentage: number, ratioState: RatioState): string[];
|
|
185
|
+
decode(triggerData: string[]): {
|
|
186
|
+
marketId: string;
|
|
187
|
+
owner: string;
|
|
188
|
+
ratio: number;
|
|
189
|
+
ratioState: number;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
@@ -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.crvUsdHealthRatioTrigger = 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,33 @@ exports.crvUSDRatioTrigger = {
|
|
|
335
335
|
};
|
|
336
336
|
},
|
|
337
337
|
};
|
|
338
|
+
exports.crvUsdHealthRatioTrigger = {
|
|
339
|
+
encode(owner, controller, ratioPercentage) {
|
|
340
|
+
const ratioWei = (0, utils_1.ratioPercentageToWei)(ratioPercentage);
|
|
341
|
+
return [web3_eth_abi_1.default.encodeParameters(['address', 'address', 'uint256'], [owner, controller, ratioWei])];
|
|
342
|
+
},
|
|
343
|
+
decode(triggerData) {
|
|
344
|
+
const decodedData = web3_eth_abi_1.default.decodeParameters(['address', 'address', 'uint256'], triggerData[0]);
|
|
345
|
+
return {
|
|
346
|
+
owner: decodedData[0],
|
|
347
|
+
controller: decodedData[1],
|
|
348
|
+
ratio: (0, utils_1.weiToRatioPercentage)(decodedData[2]),
|
|
349
|
+
};
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
exports.morphoBlueRatioTrigger = {
|
|
353
|
+
encode(marketId, // bytes32
|
|
354
|
+
owner, ratioPercentage, ratioState) {
|
|
355
|
+
const ratioWei = (0, utils_1.ratioPercentageToWei)(ratioPercentage);
|
|
356
|
+
return [web3_eth_abi_1.default.encodeParameters(['bytes32', 'address', 'uint256', 'uint8'], [marketId, owner, ratioWei, ratioState])];
|
|
357
|
+
},
|
|
358
|
+
decode(triggerData) {
|
|
359
|
+
const decodedData = web3_eth_abi_1.default.decodeParameters(['bytes32', 'address', 'uint256', 'uint8'], triggerData[0]);
|
|
360
|
+
return {
|
|
361
|
+
marketId: decodedData[0],
|
|
362
|
+
owner: decodedData[1],
|
|
363
|
+
ratio: (0, utils_1.weiToRatioPercentage)(decodedData[2]),
|
|
364
|
+
ratioState: Number(decodedData[3]),
|
|
365
|
+
};
|
|
366
|
+
},
|
|
367
|
+
};
|
|
@@ -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,68 @@ describe('Feature: triggerService.ts', () => {
|
|
|
858
859
|
});
|
|
859
860
|
});
|
|
860
861
|
});
|
|
862
|
+
describe('When testing triggerService.crvUsdHealthRatioTrigger', () => {
|
|
863
|
+
describe('encode()', () => {
|
|
864
|
+
const examples = [
|
|
865
|
+
[
|
|
866
|
+
['0x0000000000000000000000007a2af22ba3276108cd331c8985ef9528e10a871a000000000000000000000000a920de414ea4ab66b97da1bfe9e6eca7d421963500000000000000000000000000000000000000000000000002c68af0bb140000'],
|
|
867
|
+
[web3Utils.toChecksumAddress('0x7a2af22ba3276108cd331c8985ef9528e10a871a'), web3Utils.toChecksumAddress('0xa920de414ea4ab66b97da1bfe9e6eca7d4219635'), 20]
|
|
868
|
+
]
|
|
869
|
+
];
|
|
870
|
+
examples.forEach(([expected, actual]) => {
|
|
871
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
872
|
+
(0, chai_1.expect)(triggerService_1.crvUsdHealthRatioTrigger.encode(...actual)).to.eql(expected);
|
|
873
|
+
});
|
|
874
|
+
});
|
|
875
|
+
});
|
|
876
|
+
describe('decode()', () => {
|
|
877
|
+
const examples = [
|
|
878
|
+
[
|
|
879
|
+
{ owner: web3Utils.toChecksumAddress('0x7a2af22ba3276108cd331c8985ef9528e10a871a'), controller: web3Utils.toChecksumAddress('0xa920de414ea4ab66b97da1bfe9e6eca7d4219635'), ratio: 20 },
|
|
880
|
+
['0x0000000000000000000000007a2af22ba3276108cd331c8985ef9528e10a871a000000000000000000000000a920de414ea4ab66b97da1bfe9e6eca7d421963500000000000000000000000000000000000000000000000002c68af0bb140000'],
|
|
881
|
+
],
|
|
882
|
+
];
|
|
883
|
+
examples.forEach(([expected, actual]) => {
|
|
884
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
885
|
+
(0, chai_1.expect)(triggerService_1.crvUsdHealthRatioTrigger.decode(actual)).to.eql(expected);
|
|
886
|
+
});
|
|
887
|
+
});
|
|
888
|
+
});
|
|
889
|
+
});
|
|
890
|
+
describe('When testing triggerService.morphoBlueRatioTrigger', () => {
|
|
891
|
+
describe('encode()', () => {
|
|
892
|
+
const examples = [
|
|
893
|
+
[
|
|
894
|
+
['0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec410000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c00000000000000000000000000000000000000000000000010a741a4627800000000000000000000000000000000000000000000000000000000000000000001'],
|
|
895
|
+
['0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41', web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'), 120, enums_1.RatioState.UNDER]
|
|
896
|
+
],
|
|
897
|
+
[
|
|
898
|
+
['0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c0000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000000'],
|
|
899
|
+
['0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc', web3Utils.toChecksumAddress('0x0043d218133AFaB8F2B829B106633E434Ad94E2c'), 200, enums_1.RatioState.OVER]
|
|
900
|
+
],
|
|
901
|
+
];
|
|
902
|
+
examples.forEach(([expected, actual]) => {
|
|
903
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
904
|
+
(0, chai_1.expect)(triggerService_1.morphoBlueRatioTrigger.encode(...actual)).to.eql(expected);
|
|
905
|
+
});
|
|
906
|
+
});
|
|
907
|
+
});
|
|
908
|
+
describe('decode()', () => {
|
|
909
|
+
const examples = [
|
|
910
|
+
[
|
|
911
|
+
{ marketId: '0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec41', owner: web3Utils.toChecksumAddress('0x1031d218133AFaB8c2B819B1366c7E434Ad91E9c'), ratio: 120, ratioState: enums_1.RatioState.UNDER },
|
|
912
|
+
['0xc54d7acf14de29e0e5527cabd7a576506870346a78a11a6762e2cca66322ec410000000000000000000000001031d218133afab8c2b819b1366c7e434ad91e9c00000000000000000000000000000000000000000000000010a741a4627800000000000000000000000000000000000000000000000000000000000000000001'],
|
|
913
|
+
],
|
|
914
|
+
[
|
|
915
|
+
{ marketId: '0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc', owner: web3Utils.toChecksumAddress('0x0043d218133AFaB8F2B829B106633E434Ad94E2c'), ratio: 200, ratioState: enums_1.RatioState.OVER },
|
|
916
|
+
['0xb323495f7e4148be5643a4ea4a8221eef163e4bccfdedc2a6f4696baacbc86cc0000000000000000000000000043d218133afab8f2b829b106633e434ad94e2c0000000000000000000000000000000000000000000000001bc16d674ec800000000000000000000000000000000000000000000000000000000000000000000'],
|
|
917
|
+
],
|
|
918
|
+
];
|
|
919
|
+
examples.forEach(([expected, actual]) => {
|
|
920
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => {
|
|
921
|
+
(0, chai_1.expect)(triggerService_1.morphoBlueRatioTrigger.decode(actual)).to.eql(expected);
|
|
922
|
+
});
|
|
923
|
+
});
|
|
924
|
+
});
|
|
925
|
+
});
|
|
861
926
|
});
|
|
@@ -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",
|
|
@@ -57,15 +58,19 @@ export declare namespace Strategies {
|
|
|
57
58
|
EXCHANGE_LIMIT_ORDER = 51,
|
|
58
59
|
LIQUITY_DSR_PAYBACK = 69,
|
|
59
60
|
LIQUITY_DSR_SUPPLY = 70,
|
|
60
|
-
LIQUITY_DEBT_IN_FRONT_REPAY = 75
|
|
61
|
+
LIQUITY_DEBT_IN_FRONT_REPAY = 75,
|
|
62
|
+
CURVEUSD_PAYBACK = 92,
|
|
63
|
+
AAVE_V3_OPEN_ORDER_FROM_DEBT = 96
|
|
61
64
|
}
|
|
62
65
|
enum OptimismIds {
|
|
63
66
|
EXCHANGE_DCA = 8,
|
|
64
|
-
EXCHANGE_LIMIT_ORDER = 9
|
|
67
|
+
EXCHANGE_LIMIT_ORDER = 9,
|
|
68
|
+
AAVE_V3_OPEN_ORDER_FROM_DEBT = 12
|
|
65
69
|
}
|
|
66
70
|
enum ArbitrumIds {
|
|
67
71
|
EXCHANGE_DCA = 8,
|
|
68
|
-
EXCHANGE_LIMIT_ORDER = 9
|
|
72
|
+
EXCHANGE_LIMIT_ORDER = 9,
|
|
73
|
+
AAVE_V3_OPEN_ORDER_FROM_DEBT = 16
|
|
69
74
|
}
|
|
70
75
|
enum Identifiers {
|
|
71
76
|
SavingsLiqProtection = "smart-savings-liquidation-protection",
|
|
@@ -84,10 +89,13 @@ export declare namespace Strategies {
|
|
|
84
89
|
TrailingStopToColl = "trailing-stop-to-collateral",
|
|
85
90
|
TrailingStopToDebt = "trailing-stop-to-debt",
|
|
86
91
|
Rebond = "rebond",
|
|
92
|
+
Payback = "payback",
|
|
87
93
|
BondProtection = "bond-protection",
|
|
88
94
|
Dca = "dca",
|
|
89
95
|
LimitOrder = "limit-order",
|
|
90
|
-
DebtInFrontRepay = "debt-in-front-repay"
|
|
96
|
+
DebtInFrontRepay = "debt-in-front-repay",
|
|
97
|
+
OpenOrderFromCollateral = "open-order-from-collateral",
|
|
98
|
+
OpenOrderFromDebt = "open-order-from-debt"
|
|
91
99
|
}
|
|
92
100
|
enum IdOverrides {
|
|
93
101
|
TakeProfit = "take-profit",
|
|
@@ -130,13 +138,23 @@ export declare namespace Bundles {
|
|
|
130
138
|
COMP_V2_REPAY = 20,
|
|
131
139
|
COMP_V2_BOOST = 21,
|
|
132
140
|
CRVUSD_REPAY = 26,
|
|
133
|
-
CRVUSD_BOOST = 27
|
|
141
|
+
CRVUSD_BOOST = 27,
|
|
142
|
+
COMP_V3_SW_REPAY_V2_BUNDLE = 28,
|
|
143
|
+
COMP_V3_SW_BOOST_V2_BUNDLE = 29,
|
|
144
|
+
COMP_V3_EOA_REPAY_V2_BUNDLE = 30,
|
|
145
|
+
COMP_V3_EOA_BOOST_V2_BUNDLE = 31,
|
|
146
|
+
MORPHO_BLUE_REPAY = 32,
|
|
147
|
+
MORPHO_BLUE_BOOST = 33,
|
|
148
|
+
MORPHO_BLUE_EOA_REPAY = 34,
|
|
149
|
+
MORPHO_BLUE_EOA_BOOST = 35,
|
|
150
|
+
AAVE_V3_OPEN_ORDER_FROM_COLLATERAL = 36
|
|
134
151
|
}
|
|
135
152
|
enum OptimismIds {
|
|
136
153
|
AAVE_V3_REPAY = 0,
|
|
137
154
|
AAVE_V3_BOOST = 1,
|
|
138
155
|
AAVE_V3_CLOSE_TO_DEBT = 2,
|
|
139
|
-
AAVE_V3_CLOSE_TO_COLLATERAL = 3
|
|
156
|
+
AAVE_V3_CLOSE_TO_COLLATERAL = 3,
|
|
157
|
+
AAVE_V3_OPEN_ORDER_FROM_COLLATERAL = 4
|
|
140
158
|
}
|
|
141
159
|
enum ArbitrumIds {
|
|
142
160
|
AAVE_V3_REPAY = 0,
|
|
@@ -144,6 +162,7 @@ export declare namespace Bundles {
|
|
|
144
162
|
AAVE_V3_CLOSE_TO_DEBT = 2,
|
|
145
163
|
AAVE_V3_CLOSE_TO_COLLATERAL = 3,
|
|
146
164
|
COMP_V3_SW_REPAY_BUNDLE = 4,
|
|
147
|
-
COMP_V3_SW_BOOST_BUNDLE = 5
|
|
165
|
+
COMP_V3_SW_BOOST_BUNDLE = 5,
|
|
166
|
+
AAVE_V3_OPEN_ORDER_FROM_COLLATERAL = 6
|
|
148
167
|
}
|
|
149
168
|
}
|
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) {
|
|
@@ -70,16 +71,20 @@ var Strategies;
|
|
|
70
71
|
MainnetIds[MainnetIds["LIQUITY_DSR_PAYBACK"] = 69] = "LIQUITY_DSR_PAYBACK";
|
|
71
72
|
MainnetIds[MainnetIds["LIQUITY_DSR_SUPPLY"] = 70] = "LIQUITY_DSR_SUPPLY";
|
|
72
73
|
MainnetIds[MainnetIds["LIQUITY_DEBT_IN_FRONT_REPAY"] = 75] = "LIQUITY_DEBT_IN_FRONT_REPAY";
|
|
74
|
+
MainnetIds[MainnetIds["CURVEUSD_PAYBACK"] = 92] = "CURVEUSD_PAYBACK";
|
|
75
|
+
MainnetIds[MainnetIds["AAVE_V3_OPEN_ORDER_FROM_DEBT"] = 96] = "AAVE_V3_OPEN_ORDER_FROM_DEBT";
|
|
73
76
|
})(MainnetIds = Strategies.MainnetIds || (Strategies.MainnetIds = {}));
|
|
74
77
|
let OptimismIds;
|
|
75
78
|
(function (OptimismIds) {
|
|
76
79
|
OptimismIds[OptimismIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
|
|
77
80
|
OptimismIds[OptimismIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
|
|
81
|
+
OptimismIds[OptimismIds["AAVE_V3_OPEN_ORDER_FROM_DEBT"] = 12] = "AAVE_V3_OPEN_ORDER_FROM_DEBT";
|
|
78
82
|
})(OptimismIds = Strategies.OptimismIds || (Strategies.OptimismIds = {}));
|
|
79
83
|
let ArbitrumIds;
|
|
80
84
|
(function (ArbitrumIds) {
|
|
81
85
|
ArbitrumIds[ArbitrumIds["EXCHANGE_DCA"] = 8] = "EXCHANGE_DCA";
|
|
82
86
|
ArbitrumIds[ArbitrumIds["EXCHANGE_LIMIT_ORDER"] = 9] = "EXCHANGE_LIMIT_ORDER";
|
|
87
|
+
ArbitrumIds[ArbitrumIds["AAVE_V3_OPEN_ORDER_FROM_DEBT"] = 16] = "AAVE_V3_OPEN_ORDER_FROM_DEBT";
|
|
83
88
|
})(ArbitrumIds = Strategies.ArbitrumIds || (Strategies.ArbitrumIds = {}));
|
|
84
89
|
let Identifiers;
|
|
85
90
|
(function (Identifiers) {
|
|
@@ -99,10 +104,13 @@ var Strategies;
|
|
|
99
104
|
Identifiers["TrailingStopToColl"] = "trailing-stop-to-collateral";
|
|
100
105
|
Identifiers["TrailingStopToDebt"] = "trailing-stop-to-debt";
|
|
101
106
|
Identifiers["Rebond"] = "rebond";
|
|
107
|
+
Identifiers["Payback"] = "payback";
|
|
102
108
|
Identifiers["BondProtection"] = "bond-protection";
|
|
103
109
|
Identifiers["Dca"] = "dca";
|
|
104
110
|
Identifiers["LimitOrder"] = "limit-order";
|
|
105
111
|
Identifiers["DebtInFrontRepay"] = "debt-in-front-repay";
|
|
112
|
+
Identifiers["OpenOrderFromCollateral"] = "open-order-from-collateral";
|
|
113
|
+
Identifiers["OpenOrderFromDebt"] = "open-order-from-debt";
|
|
106
114
|
})(Identifiers = Strategies.Identifiers || (Strategies.Identifiers = {}));
|
|
107
115
|
let IdOverrides;
|
|
108
116
|
(function (IdOverrides) {
|
|
@@ -149,6 +157,15 @@ var Bundles;
|
|
|
149
157
|
MainnetIds[MainnetIds["COMP_V2_BOOST"] = 21] = "COMP_V2_BOOST";
|
|
150
158
|
MainnetIds[MainnetIds["CRVUSD_REPAY"] = 26] = "CRVUSD_REPAY";
|
|
151
159
|
MainnetIds[MainnetIds["CRVUSD_BOOST"] = 27] = "CRVUSD_BOOST";
|
|
160
|
+
MainnetIds[MainnetIds["COMP_V3_SW_REPAY_V2_BUNDLE"] = 28] = "COMP_V3_SW_REPAY_V2_BUNDLE";
|
|
161
|
+
MainnetIds[MainnetIds["COMP_V3_SW_BOOST_V2_BUNDLE"] = 29] = "COMP_V3_SW_BOOST_V2_BUNDLE";
|
|
162
|
+
MainnetIds[MainnetIds["COMP_V3_EOA_REPAY_V2_BUNDLE"] = 30] = "COMP_V3_EOA_REPAY_V2_BUNDLE";
|
|
163
|
+
MainnetIds[MainnetIds["COMP_V3_EOA_BOOST_V2_BUNDLE"] = 31] = "COMP_V3_EOA_BOOST_V2_BUNDLE";
|
|
164
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_REPAY"] = 32] = "MORPHO_BLUE_REPAY";
|
|
165
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_BOOST"] = 33] = "MORPHO_BLUE_BOOST";
|
|
166
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_EOA_REPAY"] = 34] = "MORPHO_BLUE_EOA_REPAY";
|
|
167
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_EOA_BOOST"] = 35] = "MORPHO_BLUE_EOA_BOOST";
|
|
168
|
+
MainnetIds[MainnetIds["AAVE_V3_OPEN_ORDER_FROM_COLLATERAL"] = 36] = "AAVE_V3_OPEN_ORDER_FROM_COLLATERAL";
|
|
152
169
|
})(MainnetIds = Bundles.MainnetIds || (Bundles.MainnetIds = {}));
|
|
153
170
|
let OptimismIds;
|
|
154
171
|
(function (OptimismIds) {
|
|
@@ -156,6 +173,7 @@ var Bundles;
|
|
|
156
173
|
OptimismIds[OptimismIds["AAVE_V3_BOOST"] = 1] = "AAVE_V3_BOOST";
|
|
157
174
|
OptimismIds[OptimismIds["AAVE_V3_CLOSE_TO_DEBT"] = 2] = "AAVE_V3_CLOSE_TO_DEBT";
|
|
158
175
|
OptimismIds[OptimismIds["AAVE_V3_CLOSE_TO_COLLATERAL"] = 3] = "AAVE_V3_CLOSE_TO_COLLATERAL";
|
|
176
|
+
OptimismIds[OptimismIds["AAVE_V3_OPEN_ORDER_FROM_COLLATERAL"] = 4] = "AAVE_V3_OPEN_ORDER_FROM_COLLATERAL";
|
|
159
177
|
})(OptimismIds = Bundles.OptimismIds || (Bundles.OptimismIds = {}));
|
|
160
178
|
let ArbitrumIds;
|
|
161
179
|
(function (ArbitrumIds) {
|
|
@@ -165,5 +183,6 @@ var Bundles;
|
|
|
165
183
|
ArbitrumIds[ArbitrumIds["AAVE_V3_CLOSE_TO_COLLATERAL"] = 3] = "AAVE_V3_CLOSE_TO_COLLATERAL";
|
|
166
184
|
ArbitrumIds[ArbitrumIds["COMP_V3_SW_REPAY_BUNDLE"] = 4] = "COMP_V3_SW_REPAY_BUNDLE";
|
|
167
185
|
ArbitrumIds[ArbitrumIds["COMP_V3_SW_BOOST_BUNDLE"] = 5] = "COMP_V3_SW_BOOST_BUNDLE";
|
|
186
|
+
ArbitrumIds[ArbitrumIds["AAVE_V3_OPEN_ORDER_FROM_COLLATERAL"] = 6] = "AAVE_V3_OPEN_ORDER_FROM_COLLATERAL";
|
|
168
187
|
})(ArbitrumIds = Bundles.ArbitrumIds || (Bundles.ArbitrumIds = {}));
|
|
169
188
|
})(Bundles = exports.Bundles || (exports.Bundles = {}));
|