@defisaver/automation-sdk 1.0.1
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/.babelrc +3 -0
- package/.editorconfig +9 -0
- package/.eslintignore +7 -0
- package/.eslintrc.js +104 -0
- package/esm/abis/Erc20.json +223 -0
- package/esm/abis/SubStorage.json +17 -0
- package/esm/abis/UniMulticall.json +14 -0
- package/esm/abis/index.d.ts +9 -0
- package/esm/abis/index.js +18 -0
- package/esm/abis/legacy_AaveV2Subscriptions.json +8 -0
- package/esm/abis/legacy_AuthCheck.json +8 -0
- package/esm/abis/legacy_CompoundV2Subscriptions.json +9 -0
- package/esm/abis/legacy_MakerSubscriptions.json +9 -0
- package/esm/automation/private/Automation.d.ts +12 -0
- package/esm/automation/private/Automation.js +39 -0
- package/esm/automation/private/LegacyAutomation.d.ts +25 -0
- package/esm/automation/private/LegacyAutomation.js +102 -0
- package/esm/automation/private/LegacyProtocol.d.ts +20 -0
- package/esm/automation/private/LegacyProtocol.js +34 -0
- package/esm/automation/private/Protocol.d.ts +20 -0
- package/esm/automation/private/Protocol.js +34 -0
- package/esm/automation/private/StrategiesAutomation.d.ts +24 -0
- package/esm/automation/private/StrategiesAutomation.js +111 -0
- package/esm/automation/public/ArbitrumStrategies.d.ts +5 -0
- package/esm/automation/public/ArbitrumStrategies.js +7 -0
- package/esm/automation/public/EthereumStrategies.d.ts +5 -0
- package/esm/automation/public/EthereumStrategies.js +7 -0
- package/esm/automation/public/OptimismStrategies.d.ts +5 -0
- package/esm/automation/public/OptimismStrategies.js +7 -0
- package/esm/automation/public/legacy/LegacyAaveAutomation.d.ts +6 -0
- package/esm/automation/public/legacy/LegacyAaveAutomation.js +14 -0
- package/esm/automation/public/legacy/LegacyCompoundAutomation.d.ts +6 -0
- package/esm/automation/public/legacy/LegacyCompoundAutomation.js +14 -0
- package/esm/automation/public/legacy/LegacyMakerAutomation.d.ts +6 -0
- package/esm/automation/public/legacy/LegacyMakerAutomation.js +14 -0
- package/esm/configuration.d.ts +1 -0
- package/esm/configuration.js +9 -0
- package/esm/constants/index.d.ts +23 -0
- package/esm/constants/index.js +153 -0
- package/esm/index.d.ts +20 -0
- package/esm/index.js +22 -0
- package/esm/services/contractService.d.ts +11 -0
- package/esm/services/contractService.js +40 -0
- package/esm/services/ethereumService.d.ts +7 -0
- package/esm/services/ethereumService.js +34 -0
- package/esm/services/strategiesService.d.ts +2 -0
- package/esm/services/strategiesService.js +244 -0
- package/esm/services/strategySubService.d.ts +32 -0
- package/esm/services/strategySubService.js +91 -0
- package/esm/services/subDataService.d.ts +62 -0
- package/esm/services/subDataService.js +148 -0
- package/esm/services/triggerService.d.ts +89 -0
- package/esm/services/triggerService.js +141 -0
- package/esm/services/utils.d.ts +24 -0
- package/esm/services/utils.js +78 -0
- package/esm/types/contracts/generated/Erc20.d.ts +53 -0
- package/esm/types/contracts/generated/Erc20.js +4 -0
- package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.d.ts +129 -0
- package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.js +4 -0
- package/esm/types/contracts/generated/Legacy_AuthCheck.d.ts +20 -0
- package/esm/types/contracts/generated/Legacy_AuthCheck.js +4 -0
- package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.d.ts +128 -0
- package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.js +4 -0
- package/esm/types/contracts/generated/Legacy_MakerSubscriptions.d.ts +246 -0
- package/esm/types/contracts/generated/Legacy_MakerSubscriptions.js +4 -0
- package/esm/types/contracts/generated/SubStorage.d.ts +114 -0
- package/esm/types/contracts/generated/SubStorage.js +4 -0
- package/esm/types/contracts/generated/UniMulticall.d.ts +55 -0
- package/esm/types/contracts/generated/UniMulticall.js +4 -0
- package/esm/types/contracts/generated/index.d.ts +7 -0
- package/esm/types/contracts/generated/index.js +1 -0
- package/esm/types/contracts/generated/types.d.ts +54 -0
- package/esm/types/contracts/generated/types.js +1 -0
- package/esm/types/enums.d.ts +97 -0
- package/esm/types/enums.js +113 -0
- package/esm/types/index.d.ts +180 -0
- package/esm/types/index.js +1 -0
- package/package.json +66 -0
- package/scripts/generateContractTypes.js +39 -0
- package/src/abis/Erc20.json +223 -0
- package/src/abis/SubStorage.json +17 -0
- package/src/abis/UniMulticall.json +14 -0
- package/src/abis/index.ts +28 -0
- package/src/abis/legacy_AaveV2Subscriptions.json +8 -0
- package/src/abis/legacy_AuthCheck.json +8 -0
- package/src/abis/legacy_CompoundV2Subscriptions.json +9 -0
- package/src/abis/legacy_MakerSubscriptions.json +9 -0
- package/src/automation/private/Automation.ts +44 -0
- package/src/automation/private/LegacyAutomation.ts +124 -0
- package/src/automation/private/LegacyProtocol.ts +45 -0
- package/src/automation/private/Protocol.ts +45 -0
- package/src/automation/private/StrategiesAutomation.ts +157 -0
- package/src/automation/public/ArbitrumStrategies.ts +10 -0
- package/src/automation/public/EthereumStrategies.ts +10 -0
- package/src/automation/public/OptimismStrategies.ts +10 -0
- package/src/automation/public/legacy/LegacyAaveAutomation.ts +20 -0
- package/src/automation/public/legacy/LegacyCompoundAutomation.ts +20 -0
- package/src/automation/public/legacy/LegacyMakerAutomation.ts +20 -0
- package/src/configuration.ts +11 -0
- package/src/constants/index.ts +173 -0
- package/src/index.ts +38 -0
- package/src/services/contractService.ts +65 -0
- package/src/services/ethereumService.ts +55 -0
- package/src/services/strategiesService.ts +336 -0
- package/src/services/strategySubService.ts +202 -0
- package/src/services/subDataService.ts +212 -0
- package/src/services/triggerService.ts +173 -0
- package/src/services/utils.ts +101 -0
- package/src/types/contracts/generated/Erc20.ts +95 -0
- package/src/types/contracts/generated/Legacy_AaveV2Subscriptions.ts +207 -0
- package/src/types/contracts/generated/Legacy_AuthCheck.ts +41 -0
- package/src/types/contracts/generated/Legacy_CompoundV2Subscriptions.ts +205 -0
- package/src/types/contracts/generated/Legacy_MakerSubscriptions.ts +338 -0
- package/src/types/contracts/generated/SubStorage.ts +196 -0
- package/src/types/contracts/generated/UniMulticall.ts +83 -0
- package/src/types/contracts/generated/index.ts +10 -0
- package/src/types/contracts/generated/types.ts +73 -0
- package/src/types/enums.ts +108 -0
- package/src/types/index.ts +217 -0
- package/src/types/typings/process.d.ts +9 -0
- package/tsconfig.json +79 -0
- package/umd/web3.d.ts +28961 -0
- package/webpack.umd.js +52 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { ChainId, ProtocolIdentifiers, Strategies, Bundles, BundleProtocols, } from '../types/enums';
|
|
2
|
+
import Protocol from '../automation/private/Protocol';
|
|
3
|
+
import LegacyProtocol from '../automation/private/LegacyProtocol';
|
|
4
|
+
// General
|
|
5
|
+
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
6
|
+
export const PROTOCOLS = (() => {
|
|
7
|
+
const protocolsMapping = {};
|
|
8
|
+
Object.entries(ProtocolIdentifiers.StrategiesAutomation).forEach(([id, value]) => {
|
|
9
|
+
protocolsMapping[id] = new Protocol({ id: value });
|
|
10
|
+
});
|
|
11
|
+
return protocolsMapping;
|
|
12
|
+
})();
|
|
13
|
+
export const LEGACY_PROTOCOLS = (() => {
|
|
14
|
+
const protocolsMapping = {};
|
|
15
|
+
Object.entries(ProtocolIdentifiers.LegacyAutomation).forEach(([id, value]) => {
|
|
16
|
+
protocolsMapping[id] = new LegacyProtocol({ id: value });
|
|
17
|
+
});
|
|
18
|
+
return protocolsMapping;
|
|
19
|
+
})();
|
|
20
|
+
// Strategies info
|
|
21
|
+
export const MAINNET_STRATEGIES_INFO = {
|
|
22
|
+
[Strategies.MainnetIds.MAKER_CLOSE_ON_PRICE_TO_DAI]: {
|
|
23
|
+
strategyId: Strategies.Identifiers.CloseOnPriceToDebt,
|
|
24
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
25
|
+
},
|
|
26
|
+
[Strategies.MainnetIds.MAKER_CLOSE_ON_PRICE_TO_COLL]: {
|
|
27
|
+
strategyId: Strategies.Identifiers.CloseOnPriceToColl,
|
|
28
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
29
|
+
},
|
|
30
|
+
[Strategies.MainnetIds.LIQUITY_CLOSE_ON_PRICE_TO_COLL_DEPRECATED]: {
|
|
31
|
+
strategyId: Strategies.Identifiers.CloseOnPriceToColl,
|
|
32
|
+
protocol: PROTOCOLS.Liquity,
|
|
33
|
+
},
|
|
34
|
+
[Strategies.MainnetIds.LIQUITY_CLOSE_ON_PRICE_TO_COLL]: {
|
|
35
|
+
strategyId: Strategies.Identifiers.CloseOnPriceToColl,
|
|
36
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
37
|
+
},
|
|
38
|
+
[Strategies.MainnetIds.MAKER_TRAILING_STOP_LOSS_TO_COLL]: {
|
|
39
|
+
strategyId: Strategies.Identifiers.TrailingStopToColl,
|
|
40
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
41
|
+
},
|
|
42
|
+
[Strategies.MainnetIds.MAKER_TRAILING_STOP_LOSS_TO_DAI]: {
|
|
43
|
+
strategyId: Strategies.Identifiers.TrailingStopToDebt,
|
|
44
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
45
|
+
},
|
|
46
|
+
[Strategies.MainnetIds.LIQUITY_TRAILING_STOP_LOSS_TO_COLL]: {
|
|
47
|
+
strategyId: Strategies.Identifiers.TrailingStopToColl,
|
|
48
|
+
protocol: PROTOCOLS.Liquity,
|
|
49
|
+
},
|
|
50
|
+
[Strategies.MainnetIds.CHICKEN_BONDS_REBOND]: {
|
|
51
|
+
strategyId: Strategies.Identifiers.Rebond,
|
|
52
|
+
protocol: PROTOCOLS.ChickenBonds,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
export const OPTIMISM_STRATEGIES_INFO = {};
|
|
56
|
+
export const ARBITRUM_STRATEGIES_INFO = {};
|
|
57
|
+
export const STRATEGIES_INFO = {
|
|
58
|
+
[ChainId.Ethereum]: MAINNET_STRATEGIES_INFO,
|
|
59
|
+
[ChainId.Optimism]: OPTIMISM_STRATEGIES_INFO,
|
|
60
|
+
[ChainId.Arbitrum]: ARBITRUM_STRATEGIES_INFO,
|
|
61
|
+
};
|
|
62
|
+
export const STRATEGY_IDS = {
|
|
63
|
+
[ChainId.Ethereum]: Strategies.MainnetIds,
|
|
64
|
+
[ChainId.Optimism]: Strategies.OptimismIds,
|
|
65
|
+
[ChainId.Arbitrum]: Strategies.ArbitrumIds,
|
|
66
|
+
};
|
|
67
|
+
// Bundles info
|
|
68
|
+
export const MAINNET_BUNDLES_INFO = {
|
|
69
|
+
[Bundles.MainnetIds.MAKER_REPAY_FROM_SMART_SAVINGS_YEARN]: {
|
|
70
|
+
bundleId: BundleProtocols.Yearn,
|
|
71
|
+
bundleName: 'Yearn',
|
|
72
|
+
strategyId: Strategies.Identifiers.SavingsLiqProtection,
|
|
73
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
74
|
+
},
|
|
75
|
+
[Bundles.MainnetIds.MAKER_REPAY_FROM_SMART_SAVINGS_MSTABLE]: {
|
|
76
|
+
bundleId: BundleProtocols.MStable,
|
|
77
|
+
bundleName: 'mStable',
|
|
78
|
+
strategyId: Strategies.Identifiers.SavingsLiqProtection,
|
|
79
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
80
|
+
},
|
|
81
|
+
[Bundles.MainnetIds.MAKER_REPAY_FROM_SMART_SAVINGS_RARI]: {
|
|
82
|
+
bundleId: BundleProtocols.Rari,
|
|
83
|
+
bundleName: 'Rari',
|
|
84
|
+
strategyId: Strategies.Identifiers.SavingsLiqProtection,
|
|
85
|
+
protocol: PROTOCOLS.MakerDAO,
|
|
86
|
+
},
|
|
87
|
+
[Bundles.MainnetIds.COMP_V3_SW_REPAY_BUNDLE]: {
|
|
88
|
+
strategyId: Strategies.Identifiers.Repay,
|
|
89
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
90
|
+
},
|
|
91
|
+
[Bundles.MainnetIds.COMP_V3_SW_BOOST_BUNDLE]: {
|
|
92
|
+
strategyId: Strategies.Identifiers.Boost,
|
|
93
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
94
|
+
},
|
|
95
|
+
[Bundles.MainnetIds.COMP_V3_EOA_REPAY_BUNDLE]: {
|
|
96
|
+
strategyId: Strategies.Identifiers.EoaRepay,
|
|
97
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
98
|
+
},
|
|
99
|
+
[Bundles.MainnetIds.COMP_V3_EOA_BOOST_BUNDLE]: {
|
|
100
|
+
strategyId: Strategies.Identifiers.EoaBoost,
|
|
101
|
+
protocol: PROTOCOLS.CompoundV3,
|
|
102
|
+
},
|
|
103
|
+
[Bundles.MainnetIds.LIQUITY_PAYBACK_USING_CHICKEN_BOND]: {
|
|
104
|
+
strategyId: Strategies.Identifiers.BondProtection,
|
|
105
|
+
protocol: PROTOCOLS.Liquity,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
export const OPTIMISM_BUNDLES_INFO = {
|
|
109
|
+
[Bundles.OptimismIds.AAVE_V3_REPAY]: {
|
|
110
|
+
strategyId: Strategies.Identifiers.Repay,
|
|
111
|
+
protocol: PROTOCOLS.AaveV3,
|
|
112
|
+
},
|
|
113
|
+
[Bundles.OptimismIds.AAVE_V3_BOOST]: {
|
|
114
|
+
strategyId: Strategies.Identifiers.Boost,
|
|
115
|
+
protocol: PROTOCOLS.AaveV3,
|
|
116
|
+
},
|
|
117
|
+
[Bundles.OptimismIds.AAVE_V3_CLOSE_TO_DEBT]: {
|
|
118
|
+
strategyId: Strategies.Identifiers.CloseToDebt,
|
|
119
|
+
protocol: PROTOCOLS.AaveV3,
|
|
120
|
+
},
|
|
121
|
+
[Bundles.OptimismIds.AAVE_V3_CLOSE_TO_COLLATERAL]: {
|
|
122
|
+
strategyId: Strategies.Identifiers.CloseToCollateral,
|
|
123
|
+
protocol: PROTOCOLS.AaveV3,
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
export const ARBITRUM_BUNDLES_INFO = {
|
|
127
|
+
[Bundles.ArbitrumIds.AAVE_V3_REPAY]: {
|
|
128
|
+
strategyId: Strategies.Identifiers.Repay,
|
|
129
|
+
protocol: PROTOCOLS.AaveV3,
|
|
130
|
+
},
|
|
131
|
+
[Bundles.ArbitrumIds.AAVE_V3_BOOST]: {
|
|
132
|
+
strategyId: Strategies.Identifiers.Boost,
|
|
133
|
+
protocol: PROTOCOLS.AaveV3,
|
|
134
|
+
},
|
|
135
|
+
[Bundles.ArbitrumIds.AAVE_V3_CLOSE_TO_DEBT]: {
|
|
136
|
+
strategyId: Strategies.Identifiers.CloseToDebt,
|
|
137
|
+
protocol: PROTOCOLS.AaveV3,
|
|
138
|
+
},
|
|
139
|
+
[Bundles.ArbitrumIds.AAVE_V3_CLOSE_TO_COLLATERAL]: {
|
|
140
|
+
strategyId: Strategies.Identifiers.CloseToCollateral,
|
|
141
|
+
protocol: PROTOCOLS.AaveV3,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
export const BUNDLES_INFO = {
|
|
145
|
+
[ChainId.Ethereum]: MAINNET_BUNDLES_INFO,
|
|
146
|
+
[ChainId.Optimism]: OPTIMISM_BUNDLES_INFO,
|
|
147
|
+
[ChainId.Arbitrum]: ARBITRUM_BUNDLES_INFO,
|
|
148
|
+
};
|
|
149
|
+
export const BUNDLE_IDS = {
|
|
150
|
+
[ChainId.Ethereum]: Bundles.MainnetIds,
|
|
151
|
+
[ChainId.Optimism]: Bundles.OptimismIds,
|
|
152
|
+
[ChainId.Arbitrum]: Bundles.ArbitrumIds,
|
|
153
|
+
};
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './configuration';
|
|
2
|
+
import LegacyMakerAutomation from './automation/public/legacy/LegacyMakerAutomation';
|
|
3
|
+
import LegacyAaveAutomation from './automation/public/legacy/LegacyAaveAutomation';
|
|
4
|
+
import LegacyCompoundAutomation from './automation/public/legacy/LegacyCompoundAutomation';
|
|
5
|
+
import EthereumStrategies from './automation/public/EthereumStrategies';
|
|
6
|
+
import OptimismStrategies from './automation/public/OptimismStrategies';
|
|
7
|
+
import ArbitrumStrategies from './automation/public/ArbitrumStrategies';
|
|
8
|
+
import * as triggerService from './services/triggerService';
|
|
9
|
+
import * as subDataService from './services/subDataService';
|
|
10
|
+
import * as strategySubService from './services/strategySubService';
|
|
11
|
+
import * as constants from './constants';
|
|
12
|
+
import { getRatioStateInfoForAaveCloseStrategy, compareSubHashes } from './services/utils';
|
|
13
|
+
import * as enums from './types/enums';
|
|
14
|
+
import type * as types from './types';
|
|
15
|
+
declare const utils: {
|
|
16
|
+
getRatioStateInfoForAaveCloseStrategy: typeof getRatioStateInfoForAaveCloseStrategy;
|
|
17
|
+
compareSubHashes: typeof compareSubHashes;
|
|
18
|
+
};
|
|
19
|
+
export { LegacyMakerAutomation, LegacyAaveAutomation, LegacyCompoundAutomation, EthereumStrategies, OptimismStrategies, ArbitrumStrategies, triggerService, subDataService, strategySubService, utils, enums, constants, };
|
|
20
|
+
export type { types };
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// TODO
|
|
2
|
+
// [] Check @ts-ignores and PlaceholderType
|
|
3
|
+
// [] Improve typing for subData, trigger and strategySub services
|
|
4
|
+
// [] Make possible to use any provider not only web3 (This requires changes throughout the package)
|
|
5
|
+
// [] Write unit tests
|
|
6
|
+
import './configuration';
|
|
7
|
+
import LegacyMakerAutomation from './automation/public/legacy/LegacyMakerAutomation';
|
|
8
|
+
import LegacyAaveAutomation from './automation/public/legacy/LegacyAaveAutomation';
|
|
9
|
+
import LegacyCompoundAutomation from './automation/public/legacy/LegacyCompoundAutomation';
|
|
10
|
+
import EthereumStrategies from './automation/public/EthereumStrategies';
|
|
11
|
+
import OptimismStrategies from './automation/public/OptimismStrategies';
|
|
12
|
+
import ArbitrumStrategies from './automation/public/ArbitrumStrategies';
|
|
13
|
+
import * as triggerService from './services/triggerService';
|
|
14
|
+
import * as subDataService from './services/subDataService';
|
|
15
|
+
import * as strategySubService from './services/strategySubService';
|
|
16
|
+
import * as constants from './constants';
|
|
17
|
+
import { getRatioStateInfoForAaveCloseStrategy, compareSubHashes } from './services/utils';
|
|
18
|
+
import * as enums from './types/enums';
|
|
19
|
+
const utils = {
|
|
20
|
+
getRatioStateInfoForAaveCloseStrategy, compareSubHashes,
|
|
21
|
+
};
|
|
22
|
+
export { LegacyMakerAutomation, LegacyAaveAutomation, LegacyCompoundAutomation, EthereumStrategies, OptimismStrategies, ArbitrumStrategies, triggerService, subDataService, strategySubService, utils, enums, constants, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type Web3 from 'web3';
|
|
2
|
+
import type { AbiItem } from 'web3-utils';
|
|
3
|
+
import type { Contract } from '../types';
|
|
4
|
+
import type { BaseContract } from '../types/contracts/generated/types';
|
|
5
|
+
import type { Legacy_AuthCheck, SubStorage, UniMulticall } from '../types/contracts/generated';
|
|
6
|
+
import { ChainId } from '../types/enums';
|
|
7
|
+
export declare function getAbiItem(abi: AbiItem[], itemName: string): AbiItem;
|
|
8
|
+
export declare function makeUniMulticallContract(web3: Web3, chainId: ChainId): Contract.WithMeta<UniMulticall>;
|
|
9
|
+
export declare function makeSubStorageContract(web3: Web3, chainId: ChainId): Contract.WithMeta<SubStorage>;
|
|
10
|
+
export declare function makeAuthCheckerContract(web3: Web3, chainId: ChainId): Contract.WithMeta<Legacy_AuthCheck>;
|
|
11
|
+
export declare function makeLegacySubscriptionContract<T extends BaseContract>(web3: Web3, contractJson: Contract.Json): Contract.WithMeta<T>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { UniMulticallJson, SubStorageJson, AuthCheckJson } from '../abis';
|
|
2
|
+
import { isDefined } from './utils';
|
|
3
|
+
import { ChainId } from '../types/enums';
|
|
4
|
+
export function getAbiItem(abi, itemName) {
|
|
5
|
+
const abiItem = abi.find(i => i.name === itemName);
|
|
6
|
+
if (isDefined(abiItem)) {
|
|
7
|
+
return abiItem;
|
|
8
|
+
}
|
|
9
|
+
throw new Error(`Can't find abi item for itemName: ${itemName}`);
|
|
10
|
+
}
|
|
11
|
+
function makeContract(web3, contractJson, chainId) {
|
|
12
|
+
const { abi } = contractJson;
|
|
13
|
+
let _address = '';
|
|
14
|
+
let _createdBlock = 'earliest';
|
|
15
|
+
if (contractJson.networks) {
|
|
16
|
+
const { address, createdBlock } = contractJson.networks[chainId];
|
|
17
|
+
_address = address;
|
|
18
|
+
if (isDefined(createdBlock)) {
|
|
19
|
+
_createdBlock = createdBlock;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
abi,
|
|
24
|
+
address: _address,
|
|
25
|
+
createdBlock: _createdBlock,
|
|
26
|
+
contract: new web3.eth.Contract(abi, _address),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function makeUniMulticallContract(web3, chainId) {
|
|
30
|
+
return makeContract(web3, UniMulticallJson, chainId);
|
|
31
|
+
}
|
|
32
|
+
export function makeSubStorageContract(web3, chainId) {
|
|
33
|
+
return makeContract(web3, SubStorageJson, chainId);
|
|
34
|
+
}
|
|
35
|
+
export function makeAuthCheckerContract(web3, chainId) {
|
|
36
|
+
return makeContract(web3, AuthCheckJson, chainId);
|
|
37
|
+
}
|
|
38
|
+
export function makeLegacySubscriptionContract(web3, contractJson) {
|
|
39
|
+
return makeContract(web3, contractJson, ChainId.Ethereum);
|
|
40
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type Web3 from 'web3';
|
|
2
|
+
import type { PastEventOptions } from 'web3-eth-contract';
|
|
3
|
+
import type { BlockNumber, Multicall, Contract } from '../types';
|
|
4
|
+
import type { BaseContract } from '../types/contracts/generated/types';
|
|
5
|
+
import type { ChainId } from '../types/enums';
|
|
6
|
+
export declare function multicall(web3: Web3, chainId: ChainId, calls: Multicall.Calls[], block?: BlockNumber): Promise<Multicall.Payload>;
|
|
7
|
+
export declare function getEventsFromContract<T extends BaseContract>(contractWithMeta: Contract.WithMeta<T>, event: string, options?: PastEventOptions): Promise<import("web3-eth-contract").EventData[]>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { makeUniMulticallContract } from './contractService';
|
|
11
|
+
import { addToObjectIf, isDefined } from './utils';
|
|
12
|
+
const { mockedWeb3 } = process;
|
|
13
|
+
export function multicall(web3, chainId, calls, block = 'latest') {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const multicallContract = makeUniMulticallContract(web3, chainId).contract;
|
|
16
|
+
const formattedCalls = calls.map((call) => ({
|
|
17
|
+
callData: mockedWeb3.eth.abi.encodeFunctionCall(call.abiItem, call.params),
|
|
18
|
+
target: call.target || '0x0',
|
|
19
|
+
gasLimit: call.gasLimit || 1e6,
|
|
20
|
+
}));
|
|
21
|
+
const callResult = yield multicallContract.methods.multicall(formattedCalls.filter(item => item.target !== '0x0')).call({}, block);
|
|
22
|
+
let formattedResult = [];
|
|
23
|
+
callResult.returnData.forEach(([success, gasUsed, result], i) => {
|
|
24
|
+
const formattedRes = (result !== '0x'
|
|
25
|
+
? mockedWeb3.eth.abi.decodeParameters(calls[i].abiItem.outputs, result)
|
|
26
|
+
: undefined);
|
|
27
|
+
formattedResult = [...formattedResult, formattedRes];
|
|
28
|
+
});
|
|
29
|
+
return formattedResult;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export function getEventsFromContract(contractWithMeta, event, options) {
|
|
33
|
+
return contractWithMeta.contract.getPastEvents(event, Object.assign(Object.assign({}, addToObjectIf(isDefined(options), options)), { fromBlock: contractWithMeta.createdBlock }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash';
|
|
2
|
+
import { BUNDLES_INFO, STRATEGIES_INFO } from '../constants';
|
|
3
|
+
import { ProtocolIdentifiers, Strategies } from '../types/enums';
|
|
4
|
+
import { getRatioStateInfoForAaveCloseStrategy, isRatioStateOver, wethToEthByAddress } from './utils';
|
|
5
|
+
import * as subDataService from './subDataService';
|
|
6
|
+
import * as triggerService from './triggerService';
|
|
7
|
+
function parseMakerSavingsLiqProtection(position, parseData) {
|
|
8
|
+
const _position = cloneDeep(position);
|
|
9
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
10
|
+
const triggerData = triggerService.makerRatioTrigger.decode(subStruct.triggerData);
|
|
11
|
+
const subData = subDataService.makerRepayFromSavingsSubData.decode(subStruct.subData);
|
|
12
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
13
|
+
_position.strategyData.decoded.subData = subData;
|
|
14
|
+
_position.specific = {
|
|
15
|
+
minRatio: Number(triggerData.ratio),
|
|
16
|
+
minOptimalRatio: Number(subData.targetRatio),
|
|
17
|
+
repayEnabled: true,
|
|
18
|
+
boostEnabled: false,
|
|
19
|
+
};
|
|
20
|
+
return _position;
|
|
21
|
+
}
|
|
22
|
+
function parseMakerCloseOnPrice(position, parseData) {
|
|
23
|
+
const _position = cloneDeep(position);
|
|
24
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
25
|
+
const triggerData = triggerService.chainlinkPriceTrigger.decode(subStruct.triggerData);
|
|
26
|
+
const subData = subDataService.makerCloseSubData.decode(subStruct.subData);
|
|
27
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
28
|
+
_position.strategyData.decoded.subData = subData;
|
|
29
|
+
const isTakeProfit = isRatioStateOver(Number(triggerData.state));
|
|
30
|
+
_position.strategy.strategyId = isTakeProfit ? Strategies.IdOverrides.TakeProfit : Strategies.IdOverrides.StopLoss;
|
|
31
|
+
_position.specific = {
|
|
32
|
+
price: triggerData.price,
|
|
33
|
+
closeToAssetAddr: subData.closeToAssetAddr,
|
|
34
|
+
};
|
|
35
|
+
return _position;
|
|
36
|
+
}
|
|
37
|
+
function parseMakerTrailingStop(position, parseData) {
|
|
38
|
+
const _position = cloneDeep(position);
|
|
39
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
40
|
+
const triggerData = triggerService.trailingStopTrigger.decode(subStruct.triggerData);
|
|
41
|
+
const subData = subDataService.makerCloseSubData.decode(subStruct.subData);
|
|
42
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
43
|
+
_position.strategyData.decoded.subData = subData;
|
|
44
|
+
_position.strategy.strategyId = Strategies.IdOverrides.TrailingStop;
|
|
45
|
+
_position.specific = {
|
|
46
|
+
triggerPercentage: Number(triggerData.triggerPercentage),
|
|
47
|
+
roundId: Number(triggerData.roundId),
|
|
48
|
+
closeToAssetAddr: subData.closeToAssetAddr,
|
|
49
|
+
};
|
|
50
|
+
return _position;
|
|
51
|
+
}
|
|
52
|
+
function parseLiquityCloseOnPrice(position, parseData) {
|
|
53
|
+
const _position = cloneDeep(position);
|
|
54
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
55
|
+
const triggerData = triggerService.chainlinkPriceTrigger.decode(subStruct.triggerData);
|
|
56
|
+
const subData = subDataService.liquityCloseSubData.decode(subStruct.subData);
|
|
57
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
58
|
+
_position.strategyData.decoded.subData = subData;
|
|
59
|
+
const isTakeProfit = isRatioStateOver(Number(triggerData.state));
|
|
60
|
+
_position.strategy.strategyId = isTakeProfit ? Strategies.IdOverrides.TakeProfit : Strategies.IdOverrides.StopLoss;
|
|
61
|
+
_position.specific = {
|
|
62
|
+
price: triggerData.price,
|
|
63
|
+
closeToAssetAddr: subData.closeToAssetAddr,
|
|
64
|
+
};
|
|
65
|
+
return _position;
|
|
66
|
+
}
|
|
67
|
+
function parseLiquityTrailingStop(position, parseData) {
|
|
68
|
+
const _position = cloneDeep(position);
|
|
69
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
70
|
+
const triggerData = triggerService.trailingStopTrigger.decode(subStruct.triggerData);
|
|
71
|
+
const subData = subDataService.liquityCloseSubData.decode(subStruct.subData);
|
|
72
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
73
|
+
_position.strategyData.decoded.subData = subData;
|
|
74
|
+
_position.strategy.strategyId = Strategies.IdOverrides.TrailingStop;
|
|
75
|
+
_position.specific = {
|
|
76
|
+
triggerPercentage: Number(triggerData.triggerPercentage),
|
|
77
|
+
roundId: Number(triggerData.roundId),
|
|
78
|
+
closeToAssetAddr: subData.closeToAssetAddr,
|
|
79
|
+
};
|
|
80
|
+
return _position;
|
|
81
|
+
}
|
|
82
|
+
function parseAaveV3LeverageManagement(position, parseData) {
|
|
83
|
+
const _position = cloneDeep(position);
|
|
84
|
+
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
85
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
86
|
+
const triggerData = triggerService.aaveV3RatioTrigger.decode(subStruct.triggerData);
|
|
87
|
+
const subData = subDataService.aaveLeverageManagementSubData.decode(subStruct.subData);
|
|
88
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
89
|
+
_position.strategyData.decoded.subData = subData;
|
|
90
|
+
const isRepay = _position.strategy.strategyId === Strategies.Identifiers.Repay;
|
|
91
|
+
if (isRepay) {
|
|
92
|
+
_position.specific = {
|
|
93
|
+
minRatio: triggerData.ratio,
|
|
94
|
+
minOptimalRatio: subData.targetRatio,
|
|
95
|
+
repayEnabled: true,
|
|
96
|
+
subId1: Number(subId),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
_position.specific = {
|
|
101
|
+
maxRatio: triggerData.ratio,
|
|
102
|
+
maxOptimalRatio: subData.targetRatio,
|
|
103
|
+
boostEnabled: isEnabled,
|
|
104
|
+
subId2: Number(subId),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
_position.strategy.strategyId = Strategies.IdOverrides.LeverageManagement;
|
|
108
|
+
_position.specific.mergeWithSameId = true;
|
|
109
|
+
return _position;
|
|
110
|
+
}
|
|
111
|
+
function parseAaveV3CloseOnPrice(position, parseData) {
|
|
112
|
+
const _position = cloneDeep(position);
|
|
113
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
114
|
+
const triggerData = triggerService.aaveV3QuotePriceTrigger.decode(subStruct.triggerData);
|
|
115
|
+
const subData = subDataService.aaveV3QuotePriceSubData.decode(subStruct.subData);
|
|
116
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
117
|
+
_position.strategyData.decoded.subData = subData;
|
|
118
|
+
_position.specific = {
|
|
119
|
+
collAsset: subData.collAsset,
|
|
120
|
+
collAssetId: subData.collAssetId,
|
|
121
|
+
debtAsset: subData.debtAsset,
|
|
122
|
+
debtAssetId: subData.debtAssetId,
|
|
123
|
+
baseToken: triggerData.baseTokenAddress,
|
|
124
|
+
quoteToken: triggerData.quoteTokenAddress,
|
|
125
|
+
price: triggerData.price,
|
|
126
|
+
ratioState: triggerData.ratioState,
|
|
127
|
+
};
|
|
128
|
+
const { ratioState } = getRatioStateInfoForAaveCloseStrategy(_position.specific.ratioState, wethToEthByAddress(_position.specific.collAsset), wethToEthByAddress(_position.specific.debtAsset), parseData.chainId);
|
|
129
|
+
_position.strategy.strategyId = isRatioStateOver(ratioState) ? Strategies.IdOverrides.TakeProfit : Strategies.IdOverrides.StopLoss;
|
|
130
|
+
return _position;
|
|
131
|
+
}
|
|
132
|
+
function parseCompoundV3LeverageManagement(position, parseData) {
|
|
133
|
+
const _position = cloneDeep(position);
|
|
134
|
+
const { subStruct, subId } = parseData.subscriptionEventData;
|
|
135
|
+
const { isEnabled } = parseData.strategiesSubsData;
|
|
136
|
+
const triggerData = triggerService.compoundV3RatioTrigger.decode(subStruct.triggerData);
|
|
137
|
+
const subData = subDataService.compoundV3LeverageManagementSubData.decode(subStruct.subData);
|
|
138
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
139
|
+
_position.strategyData.decoded.subData = subData;
|
|
140
|
+
const isRepay = [Strategies.Identifiers.Repay, Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
|
|
141
|
+
if (isRepay) {
|
|
142
|
+
_position.specific = {
|
|
143
|
+
minRatio: triggerData.ratio,
|
|
144
|
+
minOptimalRatio: subData.targetRatio,
|
|
145
|
+
repayEnabled: true,
|
|
146
|
+
subId1: Number(subId),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
_position.specific = {
|
|
151
|
+
maxRatio: triggerData.ratio,
|
|
152
|
+
maxOptimalRatio: subData.targetRatio,
|
|
153
|
+
boostEnabled: isEnabled,
|
|
154
|
+
subId2: Number(subId),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
const isEOA = _position.strategy.strategyId.includes('eoa');
|
|
158
|
+
_position.strategy.strategyId = isEOA ? Strategies.IdOverrides.EoaLeverageManagement : Strategies.IdOverrides.LeverageManagement;
|
|
159
|
+
_position.specific.mergeWithSameId = true;
|
|
160
|
+
return _position;
|
|
161
|
+
}
|
|
162
|
+
function parseChickenBondsRebond(position, parseData) {
|
|
163
|
+
const _position = cloneDeep(position);
|
|
164
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
165
|
+
_position.strategyData.decoded.triggerData = triggerService.cBondsRebondTrigger.decode(subStruct.triggerData);
|
|
166
|
+
_position.strategyData.decoded.subData = subDataService.cBondsRebondSubData.decode(subStruct.subData);
|
|
167
|
+
return _position;
|
|
168
|
+
}
|
|
169
|
+
function parseLiquityBondProtection(position, parseData) {
|
|
170
|
+
const _position = cloneDeep(position);
|
|
171
|
+
const { subStruct } = parseData.subscriptionEventData;
|
|
172
|
+
const triggerData = triggerService.liquityRatioTrigger.decode(subStruct.triggerData);
|
|
173
|
+
_position.strategyData.decoded.subData = subDataService.liquityPaybackUsingChickenBondSubData.decode(subStruct.subData);
|
|
174
|
+
_position.strategyData.decoded.triggerData = triggerData;
|
|
175
|
+
_position.specific = {
|
|
176
|
+
minRatio: Number(triggerData.ratio),
|
|
177
|
+
minOptimalRatio: Infinity,
|
|
178
|
+
repayEnabled: true,
|
|
179
|
+
};
|
|
180
|
+
return _position;
|
|
181
|
+
}
|
|
182
|
+
const parsingMethodsMapping = {
|
|
183
|
+
[ProtocolIdentifiers.StrategiesAutomation.MakerDAO]: {
|
|
184
|
+
[Strategies.Identifiers.SavingsLiqProtection]: parseMakerSavingsLiqProtection,
|
|
185
|
+
[Strategies.Identifiers.CloseOnPriceToDebt]: parseMakerCloseOnPrice,
|
|
186
|
+
[Strategies.Identifiers.CloseOnPriceToColl]: parseMakerCloseOnPrice,
|
|
187
|
+
[Strategies.Identifiers.TrailingStopToColl]: parseMakerTrailingStop,
|
|
188
|
+
[Strategies.Identifiers.TrailingStopToDebt]: parseMakerTrailingStop,
|
|
189
|
+
},
|
|
190
|
+
[ProtocolIdentifiers.StrategiesAutomation.Liquity]: {
|
|
191
|
+
[Strategies.Identifiers.CloseOnPriceToColl]: parseLiquityCloseOnPrice,
|
|
192
|
+
[Strategies.Identifiers.TrailingStopToColl]: parseLiquityTrailingStop,
|
|
193
|
+
[Strategies.Identifiers.BondProtection]: parseLiquityBondProtection,
|
|
194
|
+
},
|
|
195
|
+
[ProtocolIdentifiers.StrategiesAutomation.AaveV3]: {
|
|
196
|
+
[Strategies.Identifiers.Repay]: parseAaveV3LeverageManagement,
|
|
197
|
+
[Strategies.Identifiers.Boost]: parseAaveV3LeverageManagement,
|
|
198
|
+
[Strategies.Identifiers.CloseToDebt]: parseAaveV3CloseOnPrice,
|
|
199
|
+
[Strategies.Identifiers.CloseToCollateral]: parseAaveV3CloseOnPrice,
|
|
200
|
+
},
|
|
201
|
+
[ProtocolIdentifiers.StrategiesAutomation.CompoundV3]: {
|
|
202
|
+
[Strategies.Identifiers.Repay]: parseCompoundV3LeverageManagement,
|
|
203
|
+
[Strategies.Identifiers.Boost]: parseCompoundV3LeverageManagement,
|
|
204
|
+
[Strategies.Identifiers.EoaRepay]: parseCompoundV3LeverageManagement,
|
|
205
|
+
[Strategies.Identifiers.EoaBoost]: parseCompoundV3LeverageManagement,
|
|
206
|
+
},
|
|
207
|
+
[ProtocolIdentifiers.StrategiesAutomation.ChickenBonds]: {
|
|
208
|
+
[Strategies.Identifiers.Rebond]: parseChickenBondsRebond,
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
function getParsingMethod(id, strategy) {
|
|
212
|
+
return parsingMethodsMapping[id][strategy.strategyId];
|
|
213
|
+
}
|
|
214
|
+
export function parseStrategiesAutomatedPosition(parseData) {
|
|
215
|
+
const { chainId, subscriptionEventData, strategiesSubsData } = parseData;
|
|
216
|
+
const { subStruct, proxy, subId } = subscriptionEventData;
|
|
217
|
+
const { isEnabled } = strategiesSubsData;
|
|
218
|
+
const id = subStruct.strategyOrBundleId;
|
|
219
|
+
const strategyOrBundleInfo = (subStruct.isBundle
|
|
220
|
+
? BUNDLES_INFO[chainId][id]
|
|
221
|
+
: STRATEGIES_INFO[chainId][id]);
|
|
222
|
+
if (!strategyOrBundleInfo)
|
|
223
|
+
return null;
|
|
224
|
+
const position = {
|
|
225
|
+
isEnabled,
|
|
226
|
+
chainId,
|
|
227
|
+
subId: Number(subId),
|
|
228
|
+
owner: proxy,
|
|
229
|
+
protocol: Object.assign({}, strategyOrBundleInfo.protocol),
|
|
230
|
+
strategy: Object.assign({ isBundle: subStruct.isBundle }, strategyOrBundleInfo),
|
|
231
|
+
strategyData: {
|
|
232
|
+
encoded: {
|
|
233
|
+
triggerData: subStruct.triggerData,
|
|
234
|
+
subData: subStruct.subData,
|
|
235
|
+
},
|
|
236
|
+
decoded: {
|
|
237
|
+
triggerData: null,
|
|
238
|
+
subData: null,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
specific: {},
|
|
242
|
+
};
|
|
243
|
+
return getParsingMethod(position.protocol.id, position.strategy)(position, parseData);
|
|
244
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Bundles, ChainId, RatioState, Strategies } from '../types/enums';
|
|
2
|
+
import type { EthereumAddress, StrategyOrBundleIds } from '../types';
|
|
3
|
+
export declare const makerEncode: {
|
|
4
|
+
repayFromSavings(bundleId: StrategyOrBundleIds, vaultId: number, priceOverOrUnder: RatioState, targetRatio: number, chainId?: ChainId, isBundle?: boolean, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[])[];
|
|
5
|
+
closeOnPrice(vaultId: number, ratioState: RatioState, price: string, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
6
|
+
trailingStop(vaultId: number, triggerPercentage: number, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, roundId: number, chainId?: ChainId, daiAddr?: EthereumAddress, mcdCdpManagerAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
7
|
+
};
|
|
8
|
+
export declare const liquityEncode: {
|
|
9
|
+
closeOnPrice(priceOverOrUnder: RatioState, price: string, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, chainId?: ChainId, collAddr?: EthereumAddress, debtAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
10
|
+
trailingStop(triggerPercentage: number, closeToAssetAddr: EthereumAddress, chainlinkCollAddress: EthereumAddress, roundId: number, chainId?: ChainId, collAddr?: EthereumAddress, debtAddr?: EthereumAddress): (boolean | string[] | Strategies.MainnetIds)[];
|
|
11
|
+
paybackFromChickenBondStrategySub(proxyAddress: EthereumAddress, ratio: number, sourceId: string, sourceType: number, ratioState?: RatioState): (boolean | string[] | Bundles.MainnetIds)[];
|
|
12
|
+
};
|
|
13
|
+
export declare const chickenBondsEncode: {
|
|
14
|
+
rebond(bondId: number): string[];
|
|
15
|
+
};
|
|
16
|
+
export declare const aaveV3Encode: {
|
|
17
|
+
leverageManagement(minRatio: number, maxRatio: number, maxOptimalRatio: number, minOptimalRatio: number, boostEnabled: boolean): string;
|
|
18
|
+
closeToAsset(strategyOrBundleId: number, isBundle: boolean | undefined, triggerData: {
|
|
19
|
+
baseTokenAddress: EthereumAddress;
|
|
20
|
+
quoteTokenAddress: EthereumAddress;
|
|
21
|
+
price: number;
|
|
22
|
+
ratioState: RatioState;
|
|
23
|
+
}, subData: {
|
|
24
|
+
collAsset: EthereumAddress;
|
|
25
|
+
collAssetId: number;
|
|
26
|
+
debtAsset: EthereumAddress;
|
|
27
|
+
debtAssetId: number;
|
|
28
|
+
}): (number | boolean | string[])[];
|
|
29
|
+
};
|
|
30
|
+
export declare const compoundV3Encode: {
|
|
31
|
+
leverageManagement(market: EthereumAddress, baseToken: EthereumAddress, repayFrom: number, boostFrom: number, boostTo: number, repayTo: number, boostEnabled: boolean, isEOA: boolean): string[];
|
|
32
|
+
};
|