@defisaver/automation-sdk 2.0.5 → 2.0.8
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 +5 -0
- package/.tests.sh +3 -0
- package/README.md +3 -1
- package/esm/automation/private/LegacyProtocol.test.d.ts +1 -0
- package/esm/automation/private/LegacyProtocol.test.js +25 -0
- package/esm/automation/private/Protocol.test.d.ts +1 -0
- package/esm/automation/private/Protocol.test.js +25 -0
- package/esm/automation/private/StrategiesAutomation.js +1 -1
- package/esm/constants/index.js +15 -0
- package/esm/services/contractService.d.ts +3 -2
- package/esm/services/contractService.js +7 -1
- package/esm/services/ethereumService.test.d.ts +1 -0
- package/esm/services/ethereumService.test.js +241 -0
- package/esm/services/strategiesService.js +40 -0
- package/esm/services/strategiesService.test.d.ts +1 -0
- package/esm/services/strategiesService.test.js +108 -0
- package/esm/services/strategySubService.d.ts +17 -3
- package/esm/services/strategySubService.js +17 -6
- package/esm/services/strategySubService.test.d.ts +1 -0
- package/esm/services/strategySubService.test.js +692 -0
- package/esm/services/subDataService.d.ts +8 -1
- package/esm/services/subDataService.js +23 -14
- package/esm/services/subDataService.test.d.ts +1 -0
- package/esm/services/subDataService.test.js +993 -0
- package/esm/services/triggerService.d.ts +17 -0
- package/esm/services/triggerService.js +42 -1
- package/esm/services/triggerService.test.js +119 -17
- package/esm/types/enums.d.ts +10 -2
- package/esm/types/enums.js +8 -0
- package/esm/types/index.d.ts +19 -2
- package/package.json +3 -3
- package/src/automation/private/LegacyProtocol.test.ts +24 -0
- package/src/automation/private/Protocol.test.ts +24 -0
- package/src/automation/private/StrategiesAutomation.ts +1 -1
- package/src/constants/index.ts +15 -0
- package/src/services/contractService.ts +17 -4
- package/src/services/ethereumService.test.ts +256 -0
- package/src/services/ethereumService.ts +2 -1
- package/src/services/strategiesService.test.ts +103 -0
- package/src/services/strategiesService.ts +66 -3
- package/src/services/strategySubService.test.ts +835 -0
- package/src/services/strategySubService.ts +50 -15
- package/src/services/subDataService.test.ts +1063 -0
- package/src/services/subDataService.ts +29 -14
- package/src/services/triggerService.test.ts +133 -20
- package/src/services/triggerService.ts +55 -0
- package/src/services/utils.test.ts +1 -1
- package/src/types/enums.ts +8 -0
- package/src/types/index.ts +27 -3
- package/umd/index.js +282 -115
package/.env.dev
ADDED
package/.tests.sh
ADDED
package/README.md
CHANGED
|
@@ -33,4 +33,6 @@ const subscriptions = await ethereumStrategies.getSubscriptionsFor(
|
|
|
33
33
|
- `./src/services/subDataService.ts`
|
|
34
34
|
- `./src/services/triggerService.ts`
|
|
35
35
|
- Write parsing for the strategy in `./src/services/strategeiesService.ts` and add assign it to `const parsingMethodsMapping`
|
|
36
|
-
-
|
|
36
|
+
- Write tests for each method
|
|
37
|
+
- Run tests with `yarn test` or `yarn test fileName` for a specific file (e.g. `yarn test utils`)
|
|
38
|
+
- Congrats! 🥳
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const chai_1 = require("chai");
|
|
7
|
+
const enums_1 = require("../../types/enums");
|
|
8
|
+
const LegacyProtocol_1 = __importDefault(require("./LegacyProtocol"));
|
|
9
|
+
describe('Feature: LegacyProtocol.ts', () => {
|
|
10
|
+
describe('When testing class LegacyProtocol', () => {
|
|
11
|
+
const exampleProtocol = new LegacyProtocol_1.default({ id: enums_1.ProtocolIdentifiers.LegacyAutomation.MakerDAO });
|
|
12
|
+
const examples = [
|
|
13
|
+
[exampleProtocol.id, 'MakerDAO'],
|
|
14
|
+
[exampleProtocol.name, 'MakerDAO'],
|
|
15
|
+
[exampleProtocol.slug, 'makerdao'],
|
|
16
|
+
[exampleProtocol.version, ''],
|
|
17
|
+
[exampleProtocol.fullName, 'MakerDAO'],
|
|
18
|
+
];
|
|
19
|
+
examples.forEach(([expected, actual]) => {
|
|
20
|
+
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
21
|
+
(0, chai_1.expect)(actual).to.equal(expected);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const chai_1 = require("chai");
|
|
7
|
+
const enums_1 = require("../../types/enums");
|
|
8
|
+
const Protocol_1 = __importDefault(require("./Protocol"));
|
|
9
|
+
describe('Feature: Protocol.ts', () => {
|
|
10
|
+
describe('When testing class Protocol', () => {
|
|
11
|
+
const exampleProtocol = new Protocol_1.default({ id: enums_1.ProtocolIdentifiers.StrategiesAutomation.AaveV3 });
|
|
12
|
+
const examples = [
|
|
13
|
+
[exampleProtocol.id, 'Aave__V3'],
|
|
14
|
+
[exampleProtocol.name, 'Aave'],
|
|
15
|
+
[exampleProtocol.slug, 'aave'],
|
|
16
|
+
[exampleProtocol.version, 'V3'],
|
|
17
|
+
[exampleProtocol.fullName, 'Aave V3'],
|
|
18
|
+
];
|
|
19
|
+
examples.forEach(([expected, actual]) => {
|
|
20
|
+
it(`Given ${actual} should return expected value: ${expected}`, () => {
|
|
21
|
+
(0, chai_1.expect)(actual).to.equal(expected);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -77,7 +77,7 @@ class StrategiesAutomation extends Automation_1.default {
|
|
|
77
77
|
let subscriptions = [];
|
|
78
78
|
if (subscriptionEvents) {
|
|
79
79
|
// @ts-ignore
|
|
80
|
-
const strategiesSubs = yield this.getStrategiesSubs(subscriptionEvents.map((e) => e.returnValues.subId), _options.
|
|
80
|
+
const strategiesSubs = yield this.getStrategiesSubs(subscriptionEvents.map((e) => e.returnValues.subId), _options.toBlock);
|
|
81
81
|
subscriptions = yield Promise.all(strategiesSubs.map((sub, index) => __awaiter(this, void 0, void 0, function* () {
|
|
82
82
|
var _a;
|
|
83
83
|
let latestUpdate = subscriptionEvents[index].returnValues;
|
package/esm/constants/index.js
CHANGED
|
@@ -85,6 +85,11 @@ exports.MAINNET_STRATEGIES_INFO = {
|
|
|
85
85
|
strategyId: enums_1.Strategies.Identifiers.SavingsDsrSupply,
|
|
86
86
|
protocol: exports.PROTOCOLS.Liquity,
|
|
87
87
|
},
|
|
88
|
+
[enums_1.Strategies.MainnetIds.LIQUITY_DEBT_IN_FRONT_REPAY]: {
|
|
89
|
+
strategyOrBundleId: enums_1.Strategies.MainnetIds.LIQUITY_DEBT_IN_FRONT_REPAY,
|
|
90
|
+
strategyId: enums_1.Strategies.Identifiers.DebtInFrontRepay,
|
|
91
|
+
protocol: exports.PROTOCOLS.Liquity,
|
|
92
|
+
},
|
|
88
93
|
};
|
|
89
94
|
exports.OPTIMISM_STRATEGIES_INFO = {
|
|
90
95
|
[enums_1.Strategies.OptimismIds.EXCHANGE_DCA]: {
|
|
@@ -193,11 +198,21 @@ exports.MAINNET_BUNDLES_INFO = {
|
|
|
193
198
|
strategyId: enums_1.Strategies.Identifiers.CloseToDebt,
|
|
194
199
|
protocol: exports.PROTOCOLS.AaveV3,
|
|
195
200
|
},
|
|
201
|
+
[enums_1.Bundles.MainnetIds.AAVE_V3_CLOSE_TO_DEBT_WITH_GAS_PRICE]: {
|
|
202
|
+
strategyOrBundleId: enums_1.Bundles.MainnetIds.AAVE_V3_CLOSE_TO_DEBT_WITH_GAS_PRICE,
|
|
203
|
+
strategyId: enums_1.Strategies.Identifiers.CloseToDebtWithGasPrice,
|
|
204
|
+
protocol: exports.PROTOCOLS.AaveV3,
|
|
205
|
+
},
|
|
196
206
|
[enums_1.Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL]: {
|
|
197
207
|
strategyOrBundleId: enums_1.Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL,
|
|
198
208
|
strategyId: enums_1.Strategies.Identifiers.CloseToCollateral,
|
|
199
209
|
protocol: exports.PROTOCOLS.AaveV3,
|
|
200
210
|
},
|
|
211
|
+
[enums_1.Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL_WITH_GAS_PRICE]: {
|
|
212
|
+
strategyOrBundleId: enums_1.Bundles.MainnetIds.AAVE_V3_CLOSE_TO_COLLATERAL_WITH_GAS_PRICE,
|
|
213
|
+
strategyId: enums_1.Strategies.Identifiers.CloseToCollateralWithGasPrice,
|
|
214
|
+
protocol: exports.PROTOCOLS.AaveV3,
|
|
215
|
+
},
|
|
201
216
|
[enums_1.Bundles.MainnetIds.MORPHO_AAVE_V2_REPAY]: {
|
|
202
217
|
strategyOrBundleId: enums_1.Bundles.MainnetIds.MORPHO_AAVE_V2_REPAY,
|
|
203
218
|
strategyId: enums_1.Strategies.Identifiers.Repay,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type Web3 from 'web3';
|
|
2
2
|
import type { AbiItem } from 'web3-utils';
|
|
3
|
-
import type { Contract } from '../types';
|
|
3
|
+
import type { Contract, EthereumAddress } from '../types';
|
|
4
4
|
import type { BaseContract } from '../types/contracts/generated/types';
|
|
5
|
-
import type { Legacy_AuthCheck, SubStorage, UniMulticall } from '../types/contracts/generated';
|
|
5
|
+
import type { Legacy_AuthCheck, SubStorage, UniMulticall, Erc20 } from '../types/contracts/generated';
|
|
6
6
|
import { ChainId } from '../types/enums';
|
|
7
7
|
export declare function getAbiItem(abi: AbiItem[], itemName: string): AbiItem;
|
|
8
8
|
export declare function makeUniMulticallContract(web3: Web3, chainId: ChainId): Contract.WithMeta<UniMulticall>;
|
|
9
9
|
export declare function makeSubStorageContract(web3: Web3, chainId: ChainId): Contract.WithMeta<SubStorage>;
|
|
10
10
|
export declare function makeAuthCheckerContract(web3: Web3, chainId: ChainId): Contract.WithMeta<Legacy_AuthCheck>;
|
|
11
11
|
export declare function makeLegacySubscriptionContract<T extends BaseContract>(web3: Web3, contractJson: Contract.Json): Contract.WithMeta<T>;
|
|
12
|
+
export declare function makeErc20Contract(web3: Web3, tokenAddress: EthereumAddress, chainId: ChainId): Contract.WithMeta<Erc20>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeLegacySubscriptionContract = exports.makeAuthCheckerContract = exports.makeSubStorageContract = exports.makeUniMulticallContract = exports.getAbiItem = void 0;
|
|
3
|
+
exports.makeErc20Contract = exports.makeLegacySubscriptionContract = exports.makeAuthCheckerContract = exports.makeSubStorageContract = exports.makeUniMulticallContract = exports.getAbiItem = void 0;
|
|
4
4
|
const abis_1 = require("../abis");
|
|
5
5
|
const utils_1 = require("./utils");
|
|
6
6
|
const enums_1 = require("../types/enums");
|
|
@@ -46,3 +46,9 @@ function makeLegacySubscriptionContract(web3, contractJson) {
|
|
|
46
46
|
return makeContract(web3, contractJson, enums_1.ChainId.Ethereum);
|
|
47
47
|
}
|
|
48
48
|
exports.makeLegacySubscriptionContract = makeLegacySubscriptionContract;
|
|
49
|
+
function makeErc20Contract(web3, tokenAddress, chainId) {
|
|
50
|
+
return makeContract(web3, Object.assign(Object.assign({}, abis_1.Erc20Json), { networks: {
|
|
51
|
+
[chainId]: { address: tokenAddress },
|
|
52
|
+
} }), chainId);
|
|
53
|
+
}
|
|
54
|
+
exports.makeErc20Contract = makeErc20Contract;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const web3_1 = __importDefault(require("web3"));
|
|
16
|
+
const chai_1 = require("chai");
|
|
17
|
+
const tokens_1 = require("@defisaver/tokens");
|
|
18
|
+
const enums_1 = require("../types/enums");
|
|
19
|
+
const ethereumService_1 = require("./ethereumService");
|
|
20
|
+
const contractService_1 = require("./contractService");
|
|
21
|
+
require('dotenv').config({ path: '.env' });
|
|
22
|
+
const Web3_1 = new web3_1.default(process.env.RPC_1);
|
|
23
|
+
const Web3_10 = new web3_1.default(process.env.RPC_10);
|
|
24
|
+
const Web3_42161 = new web3_1.default(process.env.RPC_42161);
|
|
25
|
+
describe('Feature: ethereumService.ts', () => {
|
|
26
|
+
describe('When testing ethereumService.multicall', () => {
|
|
27
|
+
const examples = [
|
|
28
|
+
[
|
|
29
|
+
[{ 0: 'Wrapped Ether', '__length__': 1 }, { 0: '18', '__length__': 1 }],
|
|
30
|
+
[
|
|
31
|
+
Web3_1,
|
|
32
|
+
enums_1.ChainId.Ethereum,
|
|
33
|
+
[
|
|
34
|
+
{
|
|
35
|
+
abiItem: { 'constant': true, 'inputs': [], 'name': 'name', 'outputs': [{ 'name': '', 'type': 'string' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' },
|
|
36
|
+
target: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
37
|
+
params: [],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
abiItem: { 'constant': true, 'inputs': [], 'name': 'decimals', 'outputs': [{ 'name': '', 'type': 'uint8' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' },
|
|
41
|
+
target: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
42
|
+
params: [],
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
'latest',
|
|
46
|
+
]
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
[{ 0: 'Wrapped Ether', '__length__': 1 }, { 0: '18', '__length__': 1 }],
|
|
50
|
+
[
|
|
51
|
+
Web3_10,
|
|
52
|
+
enums_1.ChainId.Optimism,
|
|
53
|
+
[
|
|
54
|
+
{
|
|
55
|
+
abiItem: { 'constant': true, 'inputs': [], 'name': 'name', 'outputs': [{ 'name': '', 'type': 'string' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' },
|
|
56
|
+
target: '0x4200000000000000000000000000000000000006',
|
|
57
|
+
params: [],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
abiItem: { 'constant': true, 'inputs': [], 'name': 'decimals', 'outputs': [{ 'name': '', 'type': 'uint8' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' },
|
|
61
|
+
target: '0x4200000000000000000000000000000000000006',
|
|
62
|
+
params: [],
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
'latest',
|
|
66
|
+
]
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
[{ 0: 'Wrapped Ether', '__length__': 1 }, { 0: '18', '__length__': 1 }],
|
|
70
|
+
[
|
|
71
|
+
Web3_42161,
|
|
72
|
+
enums_1.ChainId.Arbitrum,
|
|
73
|
+
[
|
|
74
|
+
{
|
|
75
|
+
abiItem: { 'constant': true, 'inputs': [], 'name': 'name', 'outputs': [{ 'name': '', 'type': 'string' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' },
|
|
76
|
+
target: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
|
|
77
|
+
params: [],
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
abiItem: { 'constant': true, 'inputs': [], 'name': 'decimals', 'outputs': [{ 'name': '', 'type': 'uint8' }], 'payable': false, 'stateMutability': 'view', 'type': 'function' },
|
|
81
|
+
target: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',
|
|
82
|
+
params: [],
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
'latest',
|
|
86
|
+
]
|
|
87
|
+
],
|
|
88
|
+
];
|
|
89
|
+
examples.forEach(([expected, actual]) => {
|
|
90
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
91
|
+
(0, chai_1.expect)(yield (0, ethereumService_1.multicall)(...actual)).to.eql(expected);
|
|
92
|
+
}));
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe('When testing ethereumService.getEventsFromContract', () => {
|
|
96
|
+
const examples = [
|
|
97
|
+
[
|
|
98
|
+
[
|
|
99
|
+
{
|
|
100
|
+
'address': '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0',
|
|
101
|
+
'blockHash': '0xb92cab2569456dbfbdb853d2c67d72c9a7580543dbcb55d483a77322b40755a4',
|
|
102
|
+
'blockNumber': 15166163,
|
|
103
|
+
'event': 'Transfer',
|
|
104
|
+
'id': 'log_e2258e3a',
|
|
105
|
+
'logIndex': 385,
|
|
106
|
+
'raw': {
|
|
107
|
+
'data': '0x0000000000000000000000000000000000000000000001b58c2186829983fca9',
|
|
108
|
+
'topics': [
|
|
109
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
110
|
+
'0x000000000000000000000000ea57dc30959eb17c506e4da095fa9181f3e0ac6d',
|
|
111
|
+
'0x0000000000000000000000009ccf93089cb14f94baeb8822f8ceffd91bd71649',
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
'removed': false,
|
|
115
|
+
'returnValues': {
|
|
116
|
+
'0': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
117
|
+
'1': '0x9cCf93089cb14F94BAeB8822F8CeFfd91Bd71649',
|
|
118
|
+
'2': '8071324659946094853289',
|
|
119
|
+
'from': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
120
|
+
'to': '0x9cCf93089cb14F94BAeB8822F8CeFfd91Bd71649',
|
|
121
|
+
'value': '8071324659946094853289',
|
|
122
|
+
},
|
|
123
|
+
'signature': '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
124
|
+
'transactionHash': '0x95b28d8f71719c219e09b428e6ff781d717088784fbf63681446da13de6b0c4a',
|
|
125
|
+
'transactionIndex': 187,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
[
|
|
129
|
+
(0, contractService_1.makeErc20Contract)(Web3_1, (0, tokens_1.getAssetInfo)('LUSD').address, enums_1.ChainId.Ethereum),
|
|
130
|
+
null,
|
|
131
|
+
'Transfer',
|
|
132
|
+
{
|
|
133
|
+
fromBlock: 15166163,
|
|
134
|
+
toBlock: 15166163,
|
|
135
|
+
filter: {
|
|
136
|
+
from: '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
137
|
+
to: '0x9cCf93089cb14F94BAeB8822F8CeFfd91Bd71649',
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
]
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
[
|
|
144
|
+
{
|
|
145
|
+
'address': '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
146
|
+
'blockHash': '0xacb0213af63b4c17c436f084a96d1ac385641a59a9a4cf014ae3337cbe545aa7',
|
|
147
|
+
'blockNumber': 5353002,
|
|
148
|
+
'event': 'Transfer',
|
|
149
|
+
'id': 'log_f49645b8',
|
|
150
|
+
'logIndex': 1,
|
|
151
|
+
'raw': {
|
|
152
|
+
'data': '0x000000000000000000000000000000000000000000000001158e460913d00000',
|
|
153
|
+
'topics': [
|
|
154
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
155
|
+
'0x000000000000000000000000ea57dc30959eb17c506e4da095fa9181f3e0ac6d',
|
|
156
|
+
'0x00000000000000000000000013a22f1bba428eaaf56960530ec11118da916c11',
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
'removed': false,
|
|
160
|
+
'returnValues': {
|
|
161
|
+
'0': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
162
|
+
'1': '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
|
|
163
|
+
'2': '20000000000000000000',
|
|
164
|
+
'from': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
165
|
+
'to': '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
|
|
166
|
+
'value': '20000000000000000000',
|
|
167
|
+
},
|
|
168
|
+
'signature': '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
169
|
+
'transactionHash': '0x37c886a97c938747299c0f6b3e4591304bdd47a938df7c8146454d6fee5a6501',
|
|
170
|
+
'transactionIndex': 0,
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
[
|
|
174
|
+
(0, contractService_1.makeErc20Contract)(Web3_10, (0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Optimism).address, enums_1.ChainId.Optimism),
|
|
175
|
+
null,
|
|
176
|
+
'Transfer',
|
|
177
|
+
{
|
|
178
|
+
fromBlock: 5353002,
|
|
179
|
+
toBlock: 5353002,
|
|
180
|
+
filter: {
|
|
181
|
+
from: '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
182
|
+
to: '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
]
|
|
186
|
+
],
|
|
187
|
+
[
|
|
188
|
+
[
|
|
189
|
+
{
|
|
190
|
+
'address': '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
191
|
+
'blockHash': '0xacb0213af63b4c17c436f084a96d1ac385641a59a9a4cf014ae3337cbe545aa7',
|
|
192
|
+
'blockNumber': 5353002,
|
|
193
|
+
'event': 'Transfer',
|
|
194
|
+
'id': 'log_f49645b8',
|
|
195
|
+
'logIndex': 1,
|
|
196
|
+
'raw': {
|
|
197
|
+
'data': '0x000000000000000000000000000000000000000000000001158e460913d00000',
|
|
198
|
+
'topics': [
|
|
199
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
200
|
+
'0x000000000000000000000000ea57dc30959eb17c506e4da095fa9181f3e0ac6d',
|
|
201
|
+
'0x00000000000000000000000013a22f1bba428eaaf56960530ec11118da916c11',
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
'removed': false,
|
|
205
|
+
'returnValues': {
|
|
206
|
+
'0': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
207
|
+
'1': '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
|
|
208
|
+
'2': '20000000000000000000',
|
|
209
|
+
'from': '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
210
|
+
'to': '0x13A22f1bBa428eaAf56960530Ec11118DA916C11',
|
|
211
|
+
'value': '20000000000000000000',
|
|
212
|
+
},
|
|
213
|
+
'signature': '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
214
|
+
'transactionHash': '0x37c886a97c938747299c0f6b3e4591304bdd47a938df7c8146454d6fee5a6501',
|
|
215
|
+
'transactionIndex': 0,
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
[
|
|
219
|
+
(0, contractService_1.makeErc20Contract)(Web3_10, (0, tokens_1.getAssetInfo)('DAI', enums_1.ChainId.Arbitrum).address, enums_1.ChainId.Arbitrum),
|
|
220
|
+
null,
|
|
221
|
+
'Transfer',
|
|
222
|
+
{
|
|
223
|
+
fromBlock: 5353002,
|
|
224
|
+
toBlock: 5353002,
|
|
225
|
+
filter: {
|
|
226
|
+
from: '0xEA57Dc30959eb17c506E4dA095fa9181f3E0Ac6D',
|
|
227
|
+
to: '0x13a22f1bba428eaaf56960530ec11118da916c11',
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
]
|
|
231
|
+
],
|
|
232
|
+
];
|
|
233
|
+
examples.forEach(([expected, actual]) => {
|
|
234
|
+
it(`Given ${actual} should return expected value: ${JSON.stringify(expected)}`, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
235
|
+
const data = yield (0, ethereumService_1.getEventsFromContract)(...actual);
|
|
236
|
+
console.log(data);
|
|
237
|
+
(0, chai_1.expect)(yield (0, ethereumService_1.getEventsFromContract)(...actual)).to.eql(expected);
|
|
238
|
+
}));
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
});
|
|
@@ -243,6 +243,30 @@ function parseAaveV3CloseOnPrice(position, parseData) {
|
|
|
243
243
|
_position.strategy.strategyId = (0, utils_1.isRatioStateOver)(ratioState) ? enums_1.Strategies.IdOverrides.TakeProfit : enums_1.Strategies.IdOverrides.StopLoss;
|
|
244
244
|
return _position;
|
|
245
245
|
}
|
|
246
|
+
function parseAaveV3CloseOnPriceWithMaximumGasPrice(position, parseData) {
|
|
247
|
+
const _position = (0, lodash_1.cloneDeep)(position);
|
|
248
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
249
|
+
const triggerData = triggerService.aaveV3QuotePriceWithMaximumGasPriceTrigger.decode(subStruct.triggerData);
|
|
250
|
+
const subData = subDataService.aaveV3QuotePriceSubData.decode(subStruct.subData);
|
|
251
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
252
|
+
_position.strategyData.decoded.subData = subData;
|
|
253
|
+
_position.specific = {
|
|
254
|
+
collAsset: subData.collAsset,
|
|
255
|
+
collAssetId: subData.collAssetId,
|
|
256
|
+
debtAsset: subData.debtAsset,
|
|
257
|
+
debtAssetId: subData.debtAssetId,
|
|
258
|
+
baseToken: triggerData.baseTokenAddress,
|
|
259
|
+
quoteToken: triggerData.quoteTokenAddress,
|
|
260
|
+
price: triggerData.price,
|
|
261
|
+
maximumGasPrice: triggerData.maximumGasPrice,
|
|
262
|
+
ratioState: triggerData.ratioState,
|
|
263
|
+
};
|
|
264
|
+
const { ratioState } = (0, utils_1.getRatioStateInfoForAaveCloseStrategy)(_position.specific.ratioState, (0, utils_1.wethToEthByAddress)(_position.specific.collAsset, parseData.chainId), (0, utils_1.wethToEthByAddress)(_position.specific.debtAsset, parseData.chainId), parseData.chainId);
|
|
265
|
+
_position.strategy.strategyId = (0, utils_1.isRatioStateOver)(ratioState)
|
|
266
|
+
? enums_1.Strategies.IdOverrides.TakeProfitWithGasPrice
|
|
267
|
+
: enums_1.Strategies.IdOverrides.StopLossWithGasPrice;
|
|
268
|
+
return _position;
|
|
269
|
+
}
|
|
246
270
|
function parseCompoundV2LeverageManagement(position, parseData) {
|
|
247
271
|
const _position = (0, lodash_1.cloneDeep)(position);
|
|
248
272
|
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
@@ -434,6 +458,19 @@ function parseLiquitySavingsLiqProtection(position, parseData) {
|
|
|
434
458
|
};
|
|
435
459
|
return _position;
|
|
436
460
|
}
|
|
461
|
+
function parseDebtInFrontRepay(position, parseData) {
|
|
462
|
+
const _position = (0, lodash_1.cloneDeep)(position);
|
|
463
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
464
|
+
const triggerData = triggerService.liquityDebtInFrontWithLimitTrigger.decode(subStruct.triggerData);
|
|
465
|
+
const subData = subDataService.liquityDebtInFrontRepaySubData.decode(subStruct.subData);
|
|
466
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
467
|
+
_position.strategyData.decoded.subData = subData;
|
|
468
|
+
_position.specific = {
|
|
469
|
+
debtInFrontMin: triggerData.debtInFrontMin,
|
|
470
|
+
targetRepayRatioIncrease: subData.targetRatioIncrease,
|
|
471
|
+
};
|
|
472
|
+
return _position;
|
|
473
|
+
}
|
|
437
474
|
const parsingMethodsMapping = {
|
|
438
475
|
[enums_1.ProtocolIdentifiers.StrategiesAutomation.MakerDAO]: {
|
|
439
476
|
[enums_1.Strategies.Identifiers.SavingsLiqProtection]: parseMakerSavingsLiqProtection,
|
|
@@ -452,6 +489,7 @@ const parsingMethodsMapping = {
|
|
|
452
489
|
[enums_1.Strategies.Identifiers.Boost]: parseLiquityLeverageManagement,
|
|
453
490
|
[enums_1.Strategies.Identifiers.SavingsDsrPayback]: parseLiquitySavingsLiqProtection,
|
|
454
491
|
[enums_1.Strategies.Identifiers.SavingsDsrSupply]: parseLiquitySavingsLiqProtection,
|
|
492
|
+
[enums_1.Strategies.Identifiers.DebtInFrontRepay]: parseDebtInFrontRepay,
|
|
455
493
|
},
|
|
456
494
|
[enums_1.ProtocolIdentifiers.StrategiesAutomation.AaveV2]: {
|
|
457
495
|
[enums_1.Strategies.Identifiers.Repay]: parseAaveV2LeverageManagement,
|
|
@@ -461,7 +499,9 @@ const parsingMethodsMapping = {
|
|
|
461
499
|
[enums_1.Strategies.Identifiers.Repay]: parseAaveV3LeverageManagement,
|
|
462
500
|
[enums_1.Strategies.Identifiers.Boost]: parseAaveV3LeverageManagement,
|
|
463
501
|
[enums_1.Strategies.Identifiers.CloseToDebt]: parseAaveV3CloseOnPrice,
|
|
502
|
+
[enums_1.Strategies.Identifiers.CloseToDebtWithGasPrice]: parseAaveV3CloseOnPriceWithMaximumGasPrice,
|
|
464
503
|
[enums_1.Strategies.Identifiers.CloseToCollateral]: parseAaveV3CloseOnPrice,
|
|
504
|
+
[enums_1.Strategies.Identifiers.CloseToCollateralWithGasPrice]: parseAaveV3CloseOnPriceWithMaximumGasPrice,
|
|
465
505
|
},
|
|
466
506
|
[enums_1.ProtocolIdentifiers.StrategiesAutomation.CompoundV2]: {
|
|
467
507
|
[enums_1.Strategies.Identifiers.Repay]: parseCompoundV2LeverageManagement,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const chai_1 = require("chai");
|
|
13
|
+
const enums_1 = require("../types/enums");
|
|
14
|
+
const strategiesService_1 = require("./strategiesService");
|
|
15
|
+
describe('Feature: strategiesService.ts', () => {
|
|
16
|
+
describe('When testing strategiesService.parseStrategiesAutomatedPosition', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
// TODO: we should probably write this for every strategy?
|
|
18
|
+
const examples = [
|
|
19
|
+
[
|
|
20
|
+
{
|
|
21
|
+
isEnabled: true,
|
|
22
|
+
chainId: 1,
|
|
23
|
+
subHash: '0xafa4d200be62f171b57b1ae0f4e8348d1ac3f6d0812ad6da74a2adae8037dde1',
|
|
24
|
+
blockNumber: 18015756,
|
|
25
|
+
subId: 379,
|
|
26
|
+
owner: '0x9cB7E19861665366011899d74E75d4F2A419aEeD',
|
|
27
|
+
protocol: {
|
|
28
|
+
id: enums_1.ProtocolIdentifiers.StrategiesAutomation.AaveV3,
|
|
29
|
+
name: 'Aave',
|
|
30
|
+
slug: 'aave',
|
|
31
|
+
version: 'V3',
|
|
32
|
+
fullName: 'Aave V3'
|
|
33
|
+
},
|
|
34
|
+
strategy: {
|
|
35
|
+
isBundle: true,
|
|
36
|
+
strategyOrBundleId: 8,
|
|
37
|
+
strategyId: enums_1.Strategies.IdOverrides.LeverageManagement,
|
|
38
|
+
protocol: {
|
|
39
|
+
id: enums_1.ProtocolIdentifiers.StrategiesAutomation.AaveV3,
|
|
40
|
+
name: 'Aave',
|
|
41
|
+
slug: 'aave',
|
|
42
|
+
version: 'V3',
|
|
43
|
+
fullName: 'Aave V3'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
strategyData: {
|
|
47
|
+
encoded: {
|
|
48
|
+
triggerData: [
|
|
49
|
+
'0x0000000000000000000000009cb7e19861665366011899d74e75d4f2a419aeed0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e00000000000000000000000000000000000000000000000019ac8532c27900000000000000000000000000000000000000000000000000000000000000000001',
|
|
50
|
+
],
|
|
51
|
+
subData: [
|
|
52
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000',
|
|
53
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
54
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
55
|
+
'0x0000000000000000000000000000000000000000000000000000000000000000'
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
decoded: {
|
|
59
|
+
triggerData: {
|
|
60
|
+
owner: '0x9cB7E19861665366011899d74E75d4F2A419aEeD',
|
|
61
|
+
market: '0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e',
|
|
62
|
+
ratio: 185,
|
|
63
|
+
ratioState: 1
|
|
64
|
+
},
|
|
65
|
+
subData: { targetRatio: 200 }
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
specific: {
|
|
69
|
+
triggerRepayRatio: 185,
|
|
70
|
+
targetRepayRatio: 200,
|
|
71
|
+
repayEnabled: true,
|
|
72
|
+
subId1: 379,
|
|
73
|
+
mergeWithSameId: true
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
chainId: 1,
|
|
78
|
+
blockNumber: 18015756,
|
|
79
|
+
subscriptionEventData: {
|
|
80
|
+
subId: '379',
|
|
81
|
+
proxy: '0x9cB7E19861665366011899d74E75d4F2A419aEeD',
|
|
82
|
+
subHash: '0xafa4d200be62f171b57b1ae0f4e8348d1ac3f6d0812ad6da74a2adae8037dde1',
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
subStruct: {
|
|
85
|
+
strategyOrBundleId: '8',
|
|
86
|
+
isBundle: true,
|
|
87
|
+
triggerData: ['0x0000000000000000000000009cb7e19861665366011899d74e75d4f2a419aeed0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e00000000000000000000000000000000000000000000000019ac8532c27900000000000000000000000000000000000000000000000000000000000000000001'],
|
|
88
|
+
subData: [
|
|
89
|
+
'0x0000000000000000000000000000000000000000000000001bc16d674ec80000', '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
90
|
+
'0x0000000000000000000000000000000000000000000000000000000000000001', '0x0000000000000000000000000000000000000000000000000000000000000000',
|
|
91
|
+
],
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
strategiesSubsData: {
|
|
95
|
+
userProxy: '0x9cb7e19861665366011899d74e75d4f2a419aeed',
|
|
96
|
+
isEnabled: true,
|
|
97
|
+
strategySubHash: '0xafa4d200be62f171b57b1ae0f4e8348d1ac3f6d0812ad6da74a2adae8037dde1'
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
];
|
|
102
|
+
examples.forEach(([expected, actual]) => {
|
|
103
|
+
it(`Given ${JSON.stringify(actual)} should return expected value: ${JSON.stringify(expected)}`, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
104
|
+
(0, chai_1.expect)((0, strategiesService_1.parseStrategiesAutomatedPosition)(actual)).to.eql(expected);
|
|
105
|
+
}));
|
|
106
|
+
});
|
|
107
|
+
}));
|
|
108
|
+
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { OrderType } from '../types/enums';
|
|
1
2
|
import { Bundles, ChainId, RatioState, Strategies } from '../types/enums';
|
|
2
3
|
import type { EthereumAddress, StrategyOrBundleIds } from '../types';
|
|
3
4
|
export declare const makerEncode: {
|
|
4
|
-
repayFromSavings(bundleId: StrategyOrBundleIds, vaultId: number, triggerRepayRatio: number, targetRepayRatio: number, isBundle?: boolean, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[])[];
|
|
5
|
+
repayFromSavings(bundleId: StrategyOrBundleIds, vaultId: number, triggerRepayRatio: number, targetRepayRatio: number, isBundle?: boolean, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds | Strategies.OptimismIds | Strategies.ArbitrumIds | Bundles.MainnetIds | Bundles.OptimismIds | Bundles.ArbitrumIds)[];
|
|
5
6
|
closeOnPrice(vaultId: number, ratioState: RatioState, price: string, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
6
7
|
trailingStop(vaultId: number, triggerPercentage: number, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, roundId: number, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
7
8
|
leverageManagement(vaultId: number, triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string, targetRepayRatio: string, boostEnabled: boolean): (string | number | boolean)[];
|
|
@@ -13,6 +14,7 @@ export declare const liquityEncode: {
|
|
|
13
14
|
leverageManagement(triggerRepayRatio: string, triggerBoostRatio: string, targetBoostRatio: string, targetRepayRatio: string, boostEnabled: boolean): (string | boolean)[];
|
|
14
15
|
dsrPayback(proxyAddress: EthereumAddress, triggerRatio: number, targetRatio: number): (boolean | string[] | Strategies.MainnetIds)[];
|
|
15
16
|
dsrSupply(proxyAddress: EthereumAddress, triggerRatio: number, targetRatio: number): (boolean | string[] | Strategies.MainnetIds)[];
|
|
17
|
+
debtInFrontRepay(proxyAddress: EthereumAddress, debtInFrontMin: string, targetRatioIncrease: number): (boolean | string[] | Strategies.MainnetIds)[];
|
|
16
18
|
};
|
|
17
19
|
export declare const chickenBondsEncode: {
|
|
18
20
|
rebond(bondId: number): string[];
|
|
@@ -33,6 +35,18 @@ export declare const aaveV3Encode: {
|
|
|
33
35
|
debtAsset: EthereumAddress;
|
|
34
36
|
debtAssetId: number;
|
|
35
37
|
}): (number | boolean | string[])[];
|
|
38
|
+
closeToAssetWithMaximumGasPrice(strategyOrBundleId: number, isBundle: boolean | undefined, triggerData: {
|
|
39
|
+
baseTokenAddress: EthereumAddress;
|
|
40
|
+
quoteTokenAddress: EthereumAddress;
|
|
41
|
+
price: number;
|
|
42
|
+
ratioState: RatioState;
|
|
43
|
+
maximumGasPrice: number;
|
|
44
|
+
}, subData: {
|
|
45
|
+
collAsset: EthereumAddress;
|
|
46
|
+
collAssetId: number;
|
|
47
|
+
debtAsset: EthereumAddress;
|
|
48
|
+
debtAssetId: number;
|
|
49
|
+
}): (number | boolean | string[])[];
|
|
36
50
|
};
|
|
37
51
|
export declare const compoundV2Encode: {
|
|
38
52
|
leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string[];
|
|
@@ -44,8 +58,8 @@ export declare const morphoAaveV2Encode: {
|
|
|
44
58
|
leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string[];
|
|
45
59
|
};
|
|
46
60
|
export declare const exchangeEncode: {
|
|
47
|
-
dca(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, timestamp: number, interval: number, network:
|
|
48
|
-
limitOrder(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string, orderType:
|
|
61
|
+
dca(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, timestamp: number, interval: number, network: ChainId): (boolean | string[] | Strategies.MainnetIds | Strategies.OptimismIds | Strategies.ArbitrumIds)[];
|
|
62
|
+
limitOrder(fromToken: EthereumAddress, toToken: EthereumAddress, amount: string, targetPrice: string, goodUntil: string | number, orderType: OrderType): string[];
|
|
49
63
|
};
|
|
50
64
|
export declare const sparkEncode: {
|
|
51
65
|
leverageManagement(triggerRepayRatio: number, triggerBoostRatio: number, targetBoostRatio: number, targetRepayRatio: number, boostEnabled: boolean): string;
|