@defisaver/automation-sdk 3.0.4 → 3.0.6
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 -3
- package/.editorconfig +9 -9
- package/.env.dev +4 -4
- package/.eslintignore +6 -6
- package/.eslintrc.js +41 -41
- package/.tests.sh +2 -2
- package/README.md +41 -41
- package/esm/abis/Erc20.json +223 -223
- package/esm/abis/SubStorage.json +17 -17
- package/esm/abis/UniMulticall.json +14 -14
- package/esm/abis/index.d.ts +9 -9
- package/esm/abis/index.js +30 -30
- package/esm/abis/legacy_AaveV2Subscriptions.json +8 -8
- package/esm/abis/legacy_AuthCheck.json +8 -8
- package/esm/abis/legacy_CompoundV2Subscriptions.json +9 -9
- package/esm/abis/legacy_MakerSubscriptions.json +9 -9
- package/esm/automation/private/Automation.d.ts +12 -12
- package/esm/automation/private/Automation.js +42 -42
- package/esm/automation/private/LegacyAutomation.d.ts +25 -25
- package/esm/automation/private/LegacyAutomation.js +118 -118
- package/esm/automation/private/LegacyProtocol.d.ts +22 -22
- package/esm/automation/private/LegacyProtocol.js +41 -41
- package/esm/automation/private/LegacyProtocol.test.d.ts +1 -1
- package/esm/automation/private/LegacyProtocol.test.js +25 -25
- package/esm/automation/private/Protocol.d.ts +22 -22
- package/esm/automation/private/Protocol.js +41 -41
- package/esm/automation/private/Protocol.test.d.ts +1 -1
- package/esm/automation/private/Protocol.test.js +25 -25
- package/esm/automation/private/StrategiesAutomation.d.ts +33 -33
- package/esm/automation/private/StrategiesAutomation.js +181 -181
- package/esm/automation/private/StrategiesAutomation.test.d.ts +1 -1
- package/esm/automation/private/StrategiesAutomation.test.js +671 -671
- package/esm/automation/public/ArbitrumStrategies.d.ts +5 -5
- package/esm/automation/public/ArbitrumStrategies.js +13 -13
- package/esm/automation/public/EthereumStrategies.d.ts +5 -5
- package/esm/automation/public/EthereumStrategies.js +13 -13
- package/esm/automation/public/OptimismStrategies.d.ts +5 -5
- package/esm/automation/public/OptimismStrategies.js +13 -13
- package/esm/automation/public/legacy/LegacyAaveAutomation.d.ts +6 -6
- package/esm/automation/public/legacy/LegacyAaveAutomation.js +20 -20
- package/esm/automation/public/legacy/LegacyCompoundAutomation.d.ts +6 -6
- package/esm/automation/public/legacy/LegacyCompoundAutomation.js +20 -20
- package/esm/automation/public/legacy/LegacyMakerAutomation.d.ts +6 -6
- package/esm/automation/public/legacy/LegacyMakerAutomation.js +20 -20
- package/esm/configuration.d.ts +1 -1
- package/esm/configuration.js +12 -12
- package/esm/constants/index.d.ts +45 -45
- package/esm/constants/index.js +395 -385
- package/esm/index.d.ts +22 -22
- package/esm/index.js +63 -63
- package/esm/services/contractService.d.ts +12 -12
- package/esm/services/contractService.js +54 -54
- package/esm/services/ethereumService.d.ts +7 -7
- package/esm/services/ethereumService.js +49 -49
- package/esm/services/ethereumService.test.d.ts +1 -1
- package/esm/services/ethereumService.test.js +242 -242
- package/esm/services/strategiesService.d.ts +2 -2
- package/esm/services/strategiesService.js +701 -698
- package/esm/services/strategiesService.test.d.ts +1 -1
- package/esm/services/strategiesService.test.js +110 -110
- package/esm/services/strategySubService.d.ts +87 -87
- package/esm/services/strategySubService.js +257 -252
- package/esm/services/strategySubService.test.d.ts +1 -1
- package/esm/services/strategySubService.test.js +894 -890
- package/esm/services/subDataService.d.ts +181 -181
- package/esm/services/subDataService.js +443 -442
- package/esm/services/subDataService.test.d.ts +1 -1
- package/esm/services/subDataService.test.js +1225 -1223
- package/esm/services/triggerService.d.ts +191 -191
- package/esm/services/triggerService.js +367 -367
- package/esm/services/triggerService.test.d.ts +1 -1
- package/esm/services/triggerService.test.js +926 -926
- package/esm/services/utils.d.ts +25 -25
- package/esm/services/utils.js +131 -131
- package/esm/services/utils.test.d.ts +1 -1
- package/esm/services/utils.test.js +376 -376
- package/esm/types/contracts/generated/Erc20.d.ts +53 -53
- package/esm/types/contracts/generated/Erc20.js +5 -5
- package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.d.ts +129 -129
- package/esm/types/contracts/generated/Legacy_AaveV2Subscriptions.js +5 -5
- package/esm/types/contracts/generated/Legacy_AuthCheck.d.ts +20 -20
- package/esm/types/contracts/generated/Legacy_AuthCheck.js +5 -5
- package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.d.ts +128 -128
- package/esm/types/contracts/generated/Legacy_CompoundV2Subscriptions.js +5 -5
- package/esm/types/contracts/generated/Legacy_MakerSubscriptions.d.ts +246 -246
- package/esm/types/contracts/generated/Legacy_MakerSubscriptions.js +5 -5
- package/esm/types/contracts/generated/SubStorage.d.ts +114 -114
- package/esm/types/contracts/generated/SubStorage.js +5 -5
- package/esm/types/contracts/generated/UniMulticall.d.ts +55 -55
- package/esm/types/contracts/generated/UniMulticall.js +5 -5
- package/esm/types/contracts/generated/index.d.ts +7 -7
- package/esm/types/contracts/generated/index.js +2 -2
- package/esm/types/contracts/generated/types.d.ts +54 -54
- package/esm/types/contracts/generated/types.js +2 -2
- package/esm/types/enums.d.ts +160 -158
- package/esm/types/enums.js +180 -178
- package/esm/types/index.d.ts +217 -217
- package/esm/types/index.js +2 -2
- package/package.json +71 -71
- package/scripts/generateContractTypes.js +39 -39
- package/src/abis/Erc20.json +222 -222
- package/src/abis/SubStorage.json +17 -17
- package/src/abis/UniMulticall.json +14 -14
- package/src/abis/index.ts +28 -28
- package/src/abis/legacy_AaveV2Subscriptions.json +7 -7
- package/src/abis/legacy_AuthCheck.json +7 -7
- package/src/abis/legacy_CompoundV2Subscriptions.json +8 -8
- package/src/abis/legacy_MakerSubscriptions.json +8 -8
- package/src/automation/private/Automation.ts +44 -44
- package/src/automation/private/LegacyAutomation.ts +135 -135
- package/src/automation/private/LegacyProtocol.test.ts +23 -23
- package/src/automation/private/LegacyProtocol.ts +51 -51
- package/src/automation/private/Protocol.test.ts +23 -23
- package/src/automation/private/Protocol.ts +51 -51
- package/src/automation/private/StrategiesAutomation.test.ts +663 -663
- package/src/automation/private/StrategiesAutomation.ts +242 -242
- package/src/automation/public/ArbitrumStrategies.ts +10 -10
- package/src/automation/public/EthereumStrategies.ts +10 -10
- package/src/automation/public/OptimismStrategies.ts +10 -10
- package/src/automation/public/legacy/LegacyAaveAutomation.ts +20 -20
- package/src/automation/public/legacy/LegacyCompoundAutomation.ts +20 -20
- package/src/automation/public/legacy/LegacyMakerAutomation.ts +20 -20
- package/src/configuration.ts +8 -8
- package/src/constants/index.ts +409 -399
- package/src/index.ts +38 -38
- package/src/services/contractService.ts +77 -77
- package/src/services/ethereumService.test.ts +257 -257
- package/src/services/ethereumService.ts +69 -69
- package/src/services/strategiesService.test.ts +105 -105
- package/src/services/strategiesService.ts +905 -901
- package/src/services/strategySubService.test.ts +1065 -1060
- package/src/services/strategySubService.ts +496 -492
- package/src/services/subDataService.test.ts +1326 -1324
- package/src/services/subDataService.ts +595 -593
- package/src/services/triggerService.test.ts +1004 -1004
- package/src/services/triggerService.ts +449 -449
- package/src/services/utils.test.ts +430 -430
- package/src/services/utils.ts +103 -103
- package/src/types/enums.ts +174 -172
- package/src/types/index.ts +262 -262
- package/tsconfig.json +79 -79
- package/umd/index.js +42 -24
- package/webpack.umd.js +52 -52
package/tsconfig.json
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Basic Options */
|
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
-
"target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
-
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
-
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
|
-
"allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
-
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
-
// "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
13
|
-
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
-
// "emitDeclarationOnly": false,
|
|
15
|
-
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
16
|
-
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
17
|
-
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
18
|
-
"outDir": "./esm/", /* Redirect output structure to the directory. */
|
|
19
|
-
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
20
|
-
// "composite": true, /* Enable project compilation */
|
|
21
|
-
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
22
|
-
// "removeComments": true, /* Do not emit comments to output. */
|
|
23
|
-
// "noEmit": true, /* Do not emit outputs. */
|
|
24
|
-
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
25
|
-
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
26
|
-
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
27
|
-
|
|
28
|
-
/* Strict Type-Checking Options */
|
|
29
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
30
|
-
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
31
|
-
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
32
|
-
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
33
|
-
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
34
|
-
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
35
|
-
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
36
|
-
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
37
|
-
"resolveJsonModule": true,
|
|
38
|
-
|
|
39
|
-
/* Additional Checks */
|
|
40
|
-
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
41
|
-
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
42
|
-
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
43
|
-
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
44
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
45
|
-
|
|
46
|
-
/* Module Resolution Options */
|
|
47
|
-
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
48
|
-
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
49
|
-
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
50
|
-
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
51
|
-
//"typeRoots": ["utils.ts"], /* List of folders to include type definitions from. */
|
|
52
|
-
//"types": ["./src/utils.ts"], /* Type declaration files to be included in compilation. */
|
|
53
|
-
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
54
|
-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
55
|
-
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
56
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
57
|
-
|
|
58
|
-
/* Source Map Options */
|
|
59
|
-
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
60
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
61
|
-
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
62
|
-
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
63
|
-
|
|
64
|
-
/* Experimental Options */
|
|
65
|
-
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
66
|
-
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
67
|
-
|
|
68
|
-
/* Advanced Options */
|
|
69
|
-
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
|
70
|
-
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
71
|
-
},
|
|
72
|
-
"include": [
|
|
73
|
-
"./src/**/*",
|
|
74
|
-
],
|
|
75
|
-
"typedocOptions": {
|
|
76
|
-
"entryPoints": ["./src/index.ts"],
|
|
77
|
-
"out": "docs",
|
|
78
|
-
}
|
|
79
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
4
|
+
|
|
5
|
+
/* Basic Options */
|
|
6
|
+
// "incremental": true, /* Enable incremental compilation */
|
|
7
|
+
"target": "ES2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
|
|
8
|
+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
|
+
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
|
+
"allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
|
+
// "checkJs": true, /* Report errors in .js files. */
|
|
12
|
+
// "jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
13
|
+
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
|
+
// "emitDeclarationOnly": false,
|
|
15
|
+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
16
|
+
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
17
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
18
|
+
"outDir": "./esm/", /* Redirect output structure to the directory. */
|
|
19
|
+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
20
|
+
// "composite": true, /* Enable project compilation */
|
|
21
|
+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
|
22
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
23
|
+
// "noEmit": true, /* Do not emit outputs. */
|
|
24
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
25
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
26
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
27
|
+
|
|
28
|
+
/* Strict Type-Checking Options */
|
|
29
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
30
|
+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
31
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
32
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
33
|
+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
34
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
35
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
36
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
37
|
+
"resolveJsonModule": true,
|
|
38
|
+
|
|
39
|
+
/* Additional Checks */
|
|
40
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
41
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
42
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
43
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
44
|
+
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
|
45
|
+
|
|
46
|
+
/* Module Resolution Options */
|
|
47
|
+
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
48
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
49
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
50
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
51
|
+
//"typeRoots": ["utils.ts"], /* List of folders to include type definitions from. */
|
|
52
|
+
//"types": ["./src/utils.ts"], /* Type declaration files to be included in compilation. */
|
|
53
|
+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
54
|
+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
55
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
56
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
57
|
+
|
|
58
|
+
/* Source Map Options */
|
|
59
|
+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
60
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
61
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
62
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
63
|
+
|
|
64
|
+
/* Experimental Options */
|
|
65
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
66
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
67
|
+
|
|
68
|
+
/* Advanced Options */
|
|
69
|
+
"skipLibCheck": true, /* Skip type checking of declaration files. */
|
|
70
|
+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
|
|
71
|
+
},
|
|
72
|
+
"include": [
|
|
73
|
+
"./src/**/*",
|
|
74
|
+
],
|
|
75
|
+
"typedocOptions": {
|
|
76
|
+
"entryPoints": ["./src/index.ts"],
|
|
77
|
+
"out": "docs",
|
|
78
|
+
}
|
|
79
|
+
}
|
package/umd/index.js
CHANGED
|
@@ -407,6 +407,16 @@ var MAINNET_BUNDLES_INFO = {
|
|
|
407
407
|
strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_BOOST,
|
|
408
408
|
strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.Boost,
|
|
409
409
|
protocol: PROTOCOLS.MorphoBlue
|
|
410
|
+
},
|
|
411
|
+
[_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY]: {
|
|
412
|
+
strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY,
|
|
413
|
+
strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.EoaRepay,
|
|
414
|
+
protocol: PROTOCOLS.MorphoBlue
|
|
415
|
+
},
|
|
416
|
+
[_types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST]: {
|
|
417
|
+
strategyOrBundleId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST,
|
|
418
|
+
strategyId: _types_enums__WEBPACK_IMPORTED_MODULE_0__.Strategies.Identifiers.EoaBoost,
|
|
419
|
+
protocol: PROTOCOLS.MorphoBlue
|
|
410
420
|
}
|
|
411
421
|
};
|
|
412
422
|
var OPTIMISM_BUNDLES_INFO = {
|
|
@@ -507,12 +517,12 @@ var OrderType;
|
|
|
507
517
|
})(OrderType || (OrderType = {}));
|
|
508
518
|
var BundleProtocols;
|
|
509
519
|
|
|
510
|
-
/**
|
|
511
|
-
* @dev Follow the naming convention:
|
|
512
|
-
* - Enum name consists of two parts, name and version
|
|
513
|
-
* - Name should be human-readable name of the protocol, it can include spaces or any characters needed
|
|
514
|
-
* - Version should be separated from the name with double underscores `__` (If there is no version leave it out)
|
|
515
|
-
* - Example `Name of ThePROTOCOL__v1` (Without version `Name of ThePROTOCOL`)
|
|
520
|
+
/**
|
|
521
|
+
* @dev Follow the naming convention:
|
|
522
|
+
* - Enum name consists of two parts, name and version
|
|
523
|
+
* - Name should be human-readable name of the protocol, it can include spaces or any characters needed
|
|
524
|
+
* - Version should be separated from the name with double underscores `__` (If there is no version leave it out)
|
|
525
|
+
* - Example `Name of ThePROTOCOL__v1` (Without version `Name of ThePROTOCOL`)
|
|
516
526
|
*/
|
|
517
527
|
(function (BundleProtocols) {
|
|
518
528
|
BundleProtocols["MStable"] = "mstable";
|
|
@@ -654,6 +664,8 @@ var Bundles;
|
|
|
654
664
|
MainnetIds[MainnetIds["COMP_V3_EOA_BOOST_V2_BUNDLE"] = 31] = "COMP_V3_EOA_BOOST_V2_BUNDLE";
|
|
655
665
|
MainnetIds[MainnetIds["MORPHO_BLUE_REPAY"] = 32] = "MORPHO_BLUE_REPAY";
|
|
656
666
|
MainnetIds[MainnetIds["MORPHO_BLUE_BOOST"] = 33] = "MORPHO_BLUE_BOOST";
|
|
667
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_EOA_REPAY"] = 34] = "MORPHO_BLUE_EOA_REPAY";
|
|
668
|
+
MainnetIds[MainnetIds["MORPHO_BLUE_EOA_BOOST"] = 35] = "MORPHO_BLUE_EOA_BOOST";
|
|
657
669
|
})(MainnetIds || (MainnetIds = {}));
|
|
658
670
|
_Bundles.MainnetIds = MainnetIds;
|
|
659
671
|
var OptimismIds;
|
|
@@ -718,8 +730,8 @@ class Protocol {
|
|
|
718
730
|
return this.id.split(_classPrivateFieldGet(this, _versionSeparator));
|
|
719
731
|
}
|
|
720
732
|
|
|
721
|
-
/**
|
|
722
|
-
* @dev See naming convention at ProtocolIdentifiers declaration
|
|
733
|
+
/**
|
|
734
|
+
* @dev See naming convention at ProtocolIdentifiers declaration
|
|
723
735
|
*/
|
|
724
736
|
getVersion() {
|
|
725
737
|
return this.hasVersion() ? this.splitId().reverse()[0] : '';
|
|
@@ -777,8 +789,8 @@ class Protocol {
|
|
|
777
789
|
return this.id.split(_classPrivateFieldGet(this, _versionSeparator));
|
|
778
790
|
}
|
|
779
791
|
|
|
780
|
-
/**
|
|
781
|
-
* @dev See naming convention at ProtocolIdentifiers declaration
|
|
792
|
+
/**
|
|
793
|
+
* @dev See naming convention at ProtocolIdentifiers declaration
|
|
782
794
|
*/
|
|
783
795
|
getVersion() {
|
|
784
796
|
return this.hasVersion() ? this.splitId().reverse()[0] : '';
|
|
@@ -1548,8 +1560,8 @@ class StrategiesAutomation extends _Automation__WEBPACK_IMPORTED_MODULE_6__["def
|
|
|
1548
1560
|
return (0,_services_strategiesService__WEBPACK_IMPORTED_MODULE_5__.parseStrategiesAutomatedPosition)(parseData);
|
|
1549
1561
|
}
|
|
1550
1562
|
|
|
1551
|
-
/**
|
|
1552
|
-
* @description Removes expired Limit Order subscriptions
|
|
1563
|
+
/**
|
|
1564
|
+
* @description Removes expired Limit Order subscriptions
|
|
1553
1565
|
*/
|
|
1554
1566
|
removeExpiredSubscriptions(subscriptions) {
|
|
1555
1567
|
return subscriptions.filter(subscription => {
|
|
@@ -2312,7 +2324,7 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
|
|
|
2312
2324
|
_position.strategyData.decoded.triggerData = triggerData;
|
|
2313
2325
|
_position.strategyData.decoded.subData = subData;
|
|
2314
2326
|
_position.positionId = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getPositionId)(_position.chainId, _position.protocol.id, _position.owner, triggerData.marketId);
|
|
2315
|
-
var isRepay =
|
|
2327
|
+
var isRepay = [_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Repay, _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.EoaRepay].includes(_position.strategy.strategyId);
|
|
2316
2328
|
if (isRepay) {
|
|
2317
2329
|
_position.specific = {
|
|
2318
2330
|
triggerRepayRatio: triggerData.ratio,
|
|
@@ -2332,7 +2344,8 @@ function parseMorphoBlueLeverageManagement(position, parseData) {
|
|
|
2332
2344
|
mergeId: _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Boost
|
|
2333
2345
|
};
|
|
2334
2346
|
}
|
|
2335
|
-
_position.strategy.strategyId
|
|
2347
|
+
var isEOA = _position.strategy.strategyId.includes('eoa');
|
|
2348
|
+
_position.strategy.strategyId = isEOA ? _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.IdOverrides.EoaLeverageManagement : _types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.IdOverrides.LeverageManagement;
|
|
2336
2349
|
return _position;
|
|
2337
2350
|
}
|
|
2338
2351
|
var parsingMethodsMapping = {
|
|
@@ -2401,7 +2414,9 @@ var parsingMethodsMapping = {
|
|
|
2401
2414
|
},
|
|
2402
2415
|
[_types_enums__WEBPACK_IMPORTED_MODULE_3__.ProtocolIdentifiers.StrategiesAutomation.MorphoBlue]: {
|
|
2403
2416
|
[_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Repay]: parseMorphoBlueLeverageManagement,
|
|
2404
|
-
[_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Boost]: parseMorphoBlueLeverageManagement
|
|
2417
|
+
[_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.Boost]: parseMorphoBlueLeverageManagement,
|
|
2418
|
+
[_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.EoaRepay]: parseMorphoBlueLeverageManagement,
|
|
2419
|
+
[_types_enums__WEBPACK_IMPORTED_MODULE_3__.Strategies.Identifiers.EoaBoost]: parseMorphoBlueLeverageManagement
|
|
2405
2420
|
}
|
|
2406
2421
|
};
|
|
2407
2422
|
function getParsingMethod(id, strategy) {
|
|
@@ -19943,10 +19958,10 @@ var cBondsRebondSubData = {
|
|
|
19943
19958
|
}
|
|
19944
19959
|
};
|
|
19945
19960
|
var liquityPaybackUsingChickenBondSubData = {
|
|
19946
|
-
/**
|
|
19947
|
-
* @param sourceId bondId or subId
|
|
19948
|
-
* @param sourceType 0 for bond, 1 for subId
|
|
19949
|
-
* @param chainId
|
|
19961
|
+
/**
|
|
19962
|
+
* @param sourceId bondId or subId
|
|
19963
|
+
* @param sourceType 0 for bond, 1 for subId
|
|
19964
|
+
* @param chainId
|
|
19950
19965
|
*/
|
|
19951
19966
|
encode: function encode(sourceId, sourceType) {
|
|
19952
19967
|
var chainId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _types_enums__WEBPACK_IMPORTED_MODULE_5__.ChainId.Ethereum;
|
|
@@ -20133,7 +20148,7 @@ var crvUSDPaybackSubData = {
|
|
|
20133
20148
|
}
|
|
20134
20149
|
};
|
|
20135
20150
|
var morphoBlueLeverageManagementSubData = {
|
|
20136
|
-
encode: (loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user) => {
|
|
20151
|
+
encode: (loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA) => {
|
|
20137
20152
|
var loanTokenEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', loanToken);
|
|
20138
20153
|
var collTokenEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', collToken);
|
|
20139
20154
|
var oracleEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', oracle);
|
|
@@ -20142,7 +20157,8 @@ var morphoBlueLeverageManagementSubData = {
|
|
|
20142
20157
|
var ratioStateEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('uint8', ratioState);
|
|
20143
20158
|
var targetRatioEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('uint256', (0,_utils__WEBPACK_IMPORTED_MODULE_7__.ratioPercentageToWei)(targetRatio));
|
|
20144
20159
|
var userEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('address', user);
|
|
20145
|
-
|
|
20160
|
+
var isEOAEncoded = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().encodeParameter('bool', isEOA);
|
|
20161
|
+
return [loanTokenEncoded, collTokenEncoded, oracleEncoded, irmEncoded, lltvEncoded, ratioStateEncoded, targetRatioEncoded, userEncoded, isEOAEncoded];
|
|
20146
20162
|
},
|
|
20147
20163
|
decode: subData => {
|
|
20148
20164
|
var loanToken = web3_eth_abi__WEBPACK_IMPORTED_MODULE_1___default().decodeParameter('address', subData[0]);
|
|
@@ -33927,12 +33943,14 @@ var crvUSDEncode = {
|
|
|
33927
33943
|
}
|
|
33928
33944
|
};
|
|
33929
33945
|
var morphoBlueEncode = {
|
|
33930
|
-
leverageManagement(marketId, loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, triggerRatio, user) {
|
|
33931
|
-
var subData = _subDataService__WEBPACK_IMPORTED_MODULE_4__.morphoBlueLeverageManagementSubData.encode(loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user);
|
|
33946
|
+
leverageManagement(marketId, loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, triggerRatio, user, isEOA) {
|
|
33947
|
+
var subData = _subDataService__WEBPACK_IMPORTED_MODULE_4__.morphoBlueLeverageManagementSubData.encode(loanToken, collToken, oracle, irm, lltv, ratioState, targetRatio, user, isEOA);
|
|
33932
33948
|
var triggerData = _triggerService__WEBPACK_IMPORTED_MODULE_5__.morphoBlueRatioTrigger.encode(marketId, user, triggerRatio, ratioState);
|
|
33933
33949
|
|
|
33934
33950
|
// over is boost, under is repay
|
|
33935
|
-
var
|
|
33951
|
+
var isBoost = ratioState === _types_enums__WEBPACK_IMPORTED_MODULE_2__.RatioState.OVER;
|
|
33952
|
+
var strategyOrBundleId;
|
|
33953
|
+
if (isBoost) strategyOrBundleId = isEOA ? _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_EOA_BOOST : _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_BOOST;else strategyOrBundleId = isEOA ? _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_EOA_REPAY : _types_enums__WEBPACK_IMPORTED_MODULE_2__.Bundles.MainnetIds.MORPHO_BLUE_REPAY;
|
|
33936
33954
|
var isBundle = true;
|
|
33937
33955
|
return [strategyOrBundleId, isBundle, triggerData, subData];
|
|
33938
33956
|
}
|
package/webpack.umd.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
mode: "none",
|
|
5
|
-
entry: './src/index.ts',
|
|
6
|
-
target: 'node',
|
|
7
|
-
output: {
|
|
8
|
-
library: 'defisaver-sdk',
|
|
9
|
-
libraryTarget: 'umd',
|
|
10
|
-
path: path.resolve(__dirname, 'umd'),
|
|
11
|
-
filename: 'index.js',
|
|
12
|
-
globalObject: 'this'
|
|
13
|
-
},
|
|
14
|
-
module: {
|
|
15
|
-
rules: [
|
|
16
|
-
{
|
|
17
|
-
test: /\.[tj]s$/,
|
|
18
|
-
exclude: /node_modules/,
|
|
19
|
-
use: {
|
|
20
|
-
loader: "babel-loader",
|
|
21
|
-
options: {
|
|
22
|
-
presets: [
|
|
23
|
-
'@babel/preset-typescript',
|
|
24
|
-
[
|
|
25
|
-
"@babel/preset-env",
|
|
26
|
-
{
|
|
27
|
-
"targets": {
|
|
28
|
-
"esmodules": true
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
externals: [
|
|
39
|
-
"decimal.js",
|
|
40
|
-
'web3',
|
|
41
|
-
"web3-eth-abi",
|
|
42
|
-
"web3-utils",
|
|
43
|
-
"@defisaver/tokens",
|
|
44
|
-
"@ethersproject/address",
|
|
45
|
-
"@ethersproject/solidity",
|
|
46
|
-
"@types/web3-eth-abi",
|
|
47
|
-
'@types/web3',
|
|
48
|
-
"axios"],
|
|
49
|
-
resolve: {
|
|
50
|
-
extensions: ['.ts', '.js'],
|
|
51
|
-
},
|
|
52
|
-
};
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
mode: "none",
|
|
5
|
+
entry: './src/index.ts',
|
|
6
|
+
target: 'node',
|
|
7
|
+
output: {
|
|
8
|
+
library: 'defisaver-sdk',
|
|
9
|
+
libraryTarget: 'umd',
|
|
10
|
+
path: path.resolve(__dirname, 'umd'),
|
|
11
|
+
filename: 'index.js',
|
|
12
|
+
globalObject: 'this'
|
|
13
|
+
},
|
|
14
|
+
module: {
|
|
15
|
+
rules: [
|
|
16
|
+
{
|
|
17
|
+
test: /\.[tj]s$/,
|
|
18
|
+
exclude: /node_modules/,
|
|
19
|
+
use: {
|
|
20
|
+
loader: "babel-loader",
|
|
21
|
+
options: {
|
|
22
|
+
presets: [
|
|
23
|
+
'@babel/preset-typescript',
|
|
24
|
+
[
|
|
25
|
+
"@babel/preset-env",
|
|
26
|
+
{
|
|
27
|
+
"targets": {
|
|
28
|
+
"esmodules": true
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
externals: [
|
|
39
|
+
"decimal.js",
|
|
40
|
+
'web3',
|
|
41
|
+
"web3-eth-abi",
|
|
42
|
+
"web3-utils",
|
|
43
|
+
"@defisaver/tokens",
|
|
44
|
+
"@ethersproject/address",
|
|
45
|
+
"@ethersproject/solidity",
|
|
46
|
+
"@types/web3-eth-abi",
|
|
47
|
+
'@types/web3',
|
|
48
|
+
"axios"],
|
|
49
|
+
resolve: {
|
|
50
|
+
extensions: ['.ts', '.js'],
|
|
51
|
+
},
|
|
52
|
+
};
|