evm-contracts-tools 0.0.36 → 0.0.38
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/Makefile +12 -0
- package/dist/evm-contract-deployment-address/index.html +31 -0
- package/dist/evm-contract-deployment-networks/index.html +31 -0
- package/dist/evm-contract-deployment-versions/index.html +33 -0
- package/dist/libevm-contract-call/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-address/index.html +24 -0
- package/dist/libevm-contract-deployment-networks/index.html +24 -0
- package/dist/libevm-contract-deployment-versions/index.html +33 -0
- package/evm-contract-call +2 -1
- package/evm-contract-deployment-address +407 -0
- package/evm-contract-deployment-networks +433 -0
- package/evm-contract-deployment-versions +407 -0
- package/libevm-contract-deployment-address +287 -0
- package/libevm-contract-deployment-networks +287 -0
- package/libevm-contract-deployments-dir +0 -81
- package/package.json +55 -16
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
/** ----------------------------------------------------------------
|
|
6
|
+
* evm-contract-deployment-address.js
|
|
7
|
+
* ----------------------------------------------------------------
|
|
8
|
+
* Copyright ©
|
|
9
|
+
* Pellegrino Prevete
|
|
10
|
+
* 2024, 2025, 2026
|
|
11
|
+
*
|
|
12
|
+
* All rights reserved
|
|
13
|
+
* ----------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* This program is free software: you can redistribute it and/or
|
|
16
|
+
* modify it under the terms of the GNU General Public License as
|
|
17
|
+
* published by the Free Software Foundation, either version 3 of
|
|
18
|
+
* the License, or (at your option) any later version.
|
|
19
|
+
*
|
|
20
|
+
* This program is distributed in the hope that it will be useful,
|
|
21
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
+
* GNU General Public License for more details.
|
|
24
|
+
*
|
|
25
|
+
* You should have received a copy of the GNU General Public License
|
|
26
|
+
* along with this program.
|
|
27
|
+
* If not, see <https://www.gnu.org/licenses/>.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/* eslint-disable
|
|
31
|
+
no-unused-vars */
|
|
32
|
+
|
|
33
|
+
/* Crash Javascript global variables */
|
|
34
|
+
/* global
|
|
35
|
+
quiet:
|
|
36
|
+
writable */
|
|
37
|
+
|
|
38
|
+
const
|
|
39
|
+
_libcrash =
|
|
40
|
+
require(
|
|
41
|
+
"crash-js");
|
|
42
|
+
/* global
|
|
43
|
+
_argv_get */
|
|
44
|
+
const
|
|
45
|
+
_argv_get =
|
|
46
|
+
_libcrash._argv_get;
|
|
47
|
+
/* global
|
|
48
|
+
_argv_url_get */
|
|
49
|
+
const
|
|
50
|
+
_argv_url_get =
|
|
51
|
+
_libcrash._argv_url_get;
|
|
52
|
+
/* global
|
|
53
|
+
_cmdline_check */
|
|
54
|
+
const
|
|
55
|
+
_cmdline_check =
|
|
56
|
+
_libcrash._cmdline_check;
|
|
57
|
+
/* global
|
|
58
|
+
_get_date_human */
|
|
59
|
+
const
|
|
60
|
+
_get_date_human =
|
|
61
|
+
_libcrash._get_date_human;
|
|
62
|
+
/* global
|
|
63
|
+
_msg_info */
|
|
64
|
+
const
|
|
65
|
+
_msg_info =
|
|
66
|
+
_libcrash._msg_info;
|
|
67
|
+
/* global
|
|
68
|
+
_msg_error */
|
|
69
|
+
const
|
|
70
|
+
_msg_error =
|
|
71
|
+
_libcrash._msg_error;
|
|
72
|
+
/* global
|
|
73
|
+
_printf */
|
|
74
|
+
const
|
|
75
|
+
_printf =
|
|
76
|
+
_libcrash._printf;
|
|
77
|
+
/* global
|
|
78
|
+
_process_exit */
|
|
79
|
+
const
|
|
80
|
+
_process_exit =
|
|
81
|
+
_libcrash._process_exit;
|
|
82
|
+
|
|
83
|
+
function
|
|
84
|
+
_global_variables() {
|
|
85
|
+
/* global
|
|
86
|
+
app_name:
|
|
87
|
+
writable */
|
|
88
|
+
app_name =
|
|
89
|
+
"evm-contract-deployments-address.js";
|
|
90
|
+
/* global
|
|
91
|
+
app_opts:
|
|
92
|
+
writable */
|
|
93
|
+
app_opts =
|
|
94
|
+
[];
|
|
95
|
+
/* global
|
|
96
|
+
runtime_environment:
|
|
97
|
+
writable */
|
|
98
|
+
runtime_environment =
|
|
99
|
+
"";
|
|
100
|
+
/* global
|
|
101
|
+
resolve_date:
|
|
102
|
+
writable */
|
|
103
|
+
resolve_date =
|
|
104
|
+
"";
|
|
105
|
+
/* global
|
|
106
|
+
user_level:
|
|
107
|
+
writable */
|
|
108
|
+
user_level =
|
|
109
|
+
"";
|
|
110
|
+
/* global
|
|
111
|
+
target_networks:
|
|
112
|
+
writable */
|
|
113
|
+
target_networks =
|
|
114
|
+
[];
|
|
115
|
+
/* global
|
|
116
|
+
network_ids:
|
|
117
|
+
writable */
|
|
118
|
+
network_ids =
|
|
119
|
+
[];
|
|
120
|
+
/* global
|
|
121
|
+
networks_all:
|
|
122
|
+
writable */
|
|
123
|
+
networks_all =
|
|
124
|
+
"";
|
|
125
|
+
/* global
|
|
126
|
+
target_app:
|
|
127
|
+
writable */
|
|
128
|
+
target_app =
|
|
129
|
+
"";
|
|
130
|
+
/* global
|
|
131
|
+
target_contract:
|
|
132
|
+
writable */
|
|
133
|
+
target_contract =
|
|
134
|
+
"";
|
|
135
|
+
/* global
|
|
136
|
+
contract_version:
|
|
137
|
+
writable */
|
|
138
|
+
contract_version =
|
|
139
|
+
"";
|
|
140
|
+
/* global
|
|
141
|
+
user_defined:
|
|
142
|
+
writable */
|
|
143
|
+
user_defined =
|
|
144
|
+
"";
|
|
145
|
+
/* global
|
|
146
|
+
deployments_dir:
|
|
147
|
+
writable */
|
|
148
|
+
deployments_dir =
|
|
149
|
+
"";
|
|
150
|
+
quiet =
|
|
151
|
+
"";
|
|
152
|
+
/* global
|
|
153
|
+
verbose:
|
|
154
|
+
writable */
|
|
155
|
+
verbose =
|
|
156
|
+
"";
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function
|
|
160
|
+
_overrides_set(
|
|
161
|
+
_help_display) {
|
|
162
|
+
if ( ! _help_display &&
|
|
163
|
+
typeof(_help_display) != "undefined" &&
|
|
164
|
+
_help_display != "" ) {
|
|
165
|
+
const
|
|
166
|
+
_address_valid =
|
|
167
|
+
_address_check(
|
|
168
|
+
contract_address);
|
|
169
|
+
if ( ! _address_valid ) {
|
|
170
|
+
const
|
|
171
|
+
_msg =
|
|
172
|
+
"Contract address " +
|
|
173
|
+
`'${contract_address}' is ` +
|
|
174
|
+
`invalid.`;
|
|
175
|
+
_msg_error(
|
|
176
|
+
_msg,
|
|
177
|
+
1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if ( resolve_date == "" ||
|
|
181
|
+
typeof(
|
|
182
|
+
resolve_date) == "undefined" ) {
|
|
183
|
+
resolve_date =
|
|
184
|
+
_get_date_human();
|
|
185
|
+
}
|
|
186
|
+
if ( user_level == "" ) {
|
|
187
|
+
user_level =
|
|
188
|
+
"n";
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function
|
|
193
|
+
_config_show() {
|
|
194
|
+
let
|
|
195
|
+
_line;
|
|
196
|
+
const
|
|
197
|
+
_text = [
|
|
198
|
+
`${app_name} configuration:`,
|
|
199
|
+
` Resolve date: ${resolve_date}`,
|
|
200
|
+
` Runtime environment: ${runtime_environment}`,
|
|
201
|
+
` Target application: ${target_app}`,
|
|
202
|
+
` User level: ${user_level}`,
|
|
203
|
+
];
|
|
204
|
+
for ( _line of _text ) {
|
|
205
|
+
_msg_info(
|
|
206
|
+
_line);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function
|
|
211
|
+
_usage(
|
|
212
|
+
_exit_code) {
|
|
213
|
+
let
|
|
214
|
+
_line;
|
|
215
|
+
const
|
|
216
|
+
_text = [
|
|
217
|
+
"",
|
|
218
|
+
"Returns default deployments directory for an application",
|
|
219
|
+
"",
|
|
220
|
+
"Usage:",
|
|
221
|
+
"",
|
|
222
|
+
` ${app_name}`,
|
|
223
|
+
" [options]",
|
|
224
|
+
" <target-app>",
|
|
225
|
+
"",
|
|
226
|
+
" options:",
|
|
227
|
+
"",
|
|
228
|
+
" -u --user-level Returns user-level location",
|
|
229
|
+
" for an application deployments",
|
|
230
|
+
` Default: '${user_level}`,
|
|
231
|
+
"",
|
|
232
|
+
" -h --help This message.",
|
|
233
|
+
" -v --verbose Enable verbose output.",
|
|
234
|
+
""
|
|
235
|
+
];
|
|
236
|
+
for ( _line of _text ) {
|
|
237
|
+
console.log(
|
|
238
|
+
_line);
|
|
239
|
+
}
|
|
240
|
+
_process_exit(
|
|
241
|
+
_exit_code);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async function
|
|
245
|
+
_cmdline_parse() {
|
|
246
|
+
let
|
|
247
|
+
_help_display,
|
|
248
|
+
_msg;
|
|
249
|
+
const
|
|
250
|
+
_argv_args = {
|
|
251
|
+
"booleans": [
|
|
252
|
+
"u",
|
|
253
|
+
"user-level",
|
|
254
|
+
"h",
|
|
255
|
+
"help",
|
|
256
|
+
"v",
|
|
257
|
+
"verbose"
|
|
258
|
+
]
|
|
259
|
+
};
|
|
260
|
+
const
|
|
261
|
+
_argv =
|
|
262
|
+
_argv_get(
|
|
263
|
+
_argv_args);
|
|
264
|
+
const
|
|
265
|
+
_options =
|
|
266
|
+
_argv[
|
|
267
|
+
"_"];
|
|
268
|
+
quiet =
|
|
269
|
+
"y";
|
|
270
|
+
runtime_environment =
|
|
271
|
+
"node";
|
|
272
|
+
if ( _argv[
|
|
273
|
+
"h"] ) {
|
|
274
|
+
_help_display =
|
|
275
|
+
true;
|
|
276
|
+
}
|
|
277
|
+
if ( _argv[
|
|
278
|
+
"help"] ) {
|
|
279
|
+
_help_display =
|
|
280
|
+
true;
|
|
281
|
+
}
|
|
282
|
+
if ( ( _options.indexOf(
|
|
283
|
+
"--help") > -1 ||
|
|
284
|
+
_options.indexOf(
|
|
285
|
+
"-h") > -1) ) {
|
|
286
|
+
_help_display =
|
|
287
|
+
true;
|
|
288
|
+
}
|
|
289
|
+
if ( _help_display ) {
|
|
290
|
+
quiet =
|
|
291
|
+
"n";
|
|
292
|
+
await _overrides_set(
|
|
293
|
+
_help_display);
|
|
294
|
+
_usage(
|
|
295
|
+
0);
|
|
296
|
+
}
|
|
297
|
+
if ( typeof(
|
|
298
|
+
_argv) == "undefined" ||
|
|
299
|
+
_argv[
|
|
300
|
+
"_"].length < 1 ) {
|
|
301
|
+
_msg =
|
|
302
|
+
"Target application " +
|
|
303
|
+
"argument required.";
|
|
304
|
+
_msg_error(
|
|
305
|
+
_msg,
|
|
306
|
+
0);
|
|
307
|
+
_usage(
|
|
308
|
+
1);
|
|
309
|
+
}
|
|
310
|
+
target_app =
|
|
311
|
+
_argv[
|
|
312
|
+
"_"][
|
|
313
|
+
0];
|
|
314
|
+
if ( "u" in _argv ) {
|
|
315
|
+
user_level =
|
|
316
|
+
_argv[
|
|
317
|
+
"u"];
|
|
318
|
+
}
|
|
319
|
+
if ( "user_level" in _argv ) {
|
|
320
|
+
user_level =
|
|
321
|
+
_argv[
|
|
322
|
+
"user_level"];
|
|
323
|
+
}
|
|
324
|
+
if ( _argv[
|
|
325
|
+
"v"] ||
|
|
326
|
+
_argv[
|
|
327
|
+
"verbose"] ) {
|
|
328
|
+
quiet =
|
|
329
|
+
"n";
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function
|
|
334
|
+
_url_parse() {
|
|
335
|
+
let
|
|
336
|
+
_method,
|
|
337
|
+
_network;
|
|
338
|
+
runtime_environment =
|
|
339
|
+
"browser";
|
|
340
|
+
user_level =
|
|
341
|
+
_argv_url_get(
|
|
342
|
+
"user_level")[
|
|
343
|
+
0];
|
|
344
|
+
quiet =
|
|
345
|
+
_argv_url_get(
|
|
346
|
+
"quiet");
|
|
347
|
+
if ( quiet.length === 0 ) {
|
|
348
|
+
quiet =
|
|
349
|
+
"n";
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
async function
|
|
354
|
+
_evm_contract_deployments_dir_cmdline(
|
|
355
|
+
_app_opts) {
|
|
356
|
+
let
|
|
357
|
+
_result;
|
|
358
|
+
const
|
|
359
|
+
_results =
|
|
360
|
+
await _evm_contract_deployments_dir.apply(
|
|
361
|
+
null,
|
|
362
|
+
app_opts);
|
|
363
|
+
const
|
|
364
|
+
_results_type =
|
|
365
|
+
typeof(
|
|
366
|
+
_results);
|
|
367
|
+
if ( _results_type == "object" ) {
|
|
368
|
+
for ( _result of _results ) {
|
|
369
|
+
console.log(
|
|
370
|
+
_result);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
else if ( _results_type == "string" ) {
|
|
374
|
+
_printf(
|
|
375
|
+
_results);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
async function
|
|
380
|
+
_main() {
|
|
381
|
+
const
|
|
382
|
+
_overrides_set_up =
|
|
383
|
+
await _overrides_set();
|
|
384
|
+
_config_show();
|
|
385
|
+
const
|
|
386
|
+
app_opts = [
|
|
387
|
+
target_app,
|
|
388
|
+
user_level
|
|
389
|
+
];
|
|
390
|
+
const
|
|
391
|
+
_deployments =
|
|
392
|
+
await _evm_contract_deployments_dir.apply(
|
|
393
|
+
null,
|
|
394
|
+
app_opts);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
_global_variables();
|
|
398
|
+
if ( _cmdline_check(
|
|
399
|
+
"evm-contract-deployments-dir.js") == true ||
|
|
400
|
+
_cmdline_check(
|
|
401
|
+
"evm-contract-deployments-dir") == true ) {
|
|
402
|
+
_cmdline_parse();
|
|
403
|
+
}
|
|
404
|
+
else{
|
|
405
|
+
_url_parse();
|
|
406
|
+
}
|
|
407
|
+
_main();
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
/** ----------------------------------------------------------------
|
|
6
|
+
* libevm-contract-deployments-dir
|
|
7
|
+
* ----------------------------------------------------------------
|
|
8
|
+
* Copyright ©
|
|
9
|
+
* Pellegrino Prevete
|
|
10
|
+
* 2025, 2026
|
|
11
|
+
*
|
|
12
|
+
* All rights reserved
|
|
13
|
+
* ----------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* This program is free software: you can redistribute it and/or
|
|
16
|
+
* modify it under the terms of the GNU General Public License as
|
|
17
|
+
* published by the Free Software Foundation, either version 3 of
|
|
18
|
+
* the License, or (at your option) any later version.
|
|
19
|
+
*
|
|
20
|
+
* This program is distributed in the hope that it will be useful,
|
|
21
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
+
* GNU General Public License for more details.
|
|
24
|
+
*
|
|
25
|
+
* You should have received a copy of the
|
|
26
|
+
* GNU General Public License
|
|
27
|
+
* along with this program.
|
|
28
|
+
* If not, see <https://www.gnu.org/licenses/>.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/* eslint-disable
|
|
32
|
+
no-unused-vars */
|
|
33
|
+
/* eslint-disable
|
|
34
|
+
no-useless-assignment */
|
|
35
|
+
|
|
36
|
+
/* EVM Contracts tools global variables */
|
|
37
|
+
/* global
|
|
38
|
+
call_type */
|
|
39
|
+
/* global
|
|
40
|
+
call_auth:
|
|
41
|
+
writable */
|
|
42
|
+
|
|
43
|
+
/* libEVM global variables */
|
|
44
|
+
/* global
|
|
45
|
+
api_key */
|
|
46
|
+
/* global
|
|
47
|
+
contract_abi:
|
|
48
|
+
writable */
|
|
49
|
+
/* global
|
|
50
|
+
contract_address */
|
|
51
|
+
/* global
|
|
52
|
+
contract_bytecode:
|
|
53
|
+
writable */
|
|
54
|
+
/* global
|
|
55
|
+
contract_compiler_output:
|
|
56
|
+
writable */
|
|
57
|
+
/* global
|
|
58
|
+
target_network:
|
|
59
|
+
writable */
|
|
60
|
+
/* global
|
|
61
|
+
target_networks:
|
|
62
|
+
writable */
|
|
63
|
+
|
|
64
|
+
const
|
|
65
|
+
_libcrash_module =
|
|
66
|
+
require(
|
|
67
|
+
"crash-js");
|
|
68
|
+
/* global
|
|
69
|
+
_dirname */
|
|
70
|
+
/* eslint-disable-next-line
|
|
71
|
+
no-global-assign */
|
|
72
|
+
const
|
|
73
|
+
_dirname =
|
|
74
|
+
_libcrash_module._dirname;
|
|
75
|
+
/* global
|
|
76
|
+
_file_exists */
|
|
77
|
+
/* eslint-disable-next-line
|
|
78
|
+
no-global-assign */
|
|
79
|
+
const
|
|
80
|
+
_file_exists =
|
|
81
|
+
_libcrash_module._file_exists;
|
|
82
|
+
/* global
|
|
83
|
+
_homedir_get */
|
|
84
|
+
/* eslint-disable-next-line
|
|
85
|
+
no-global-assign */
|
|
86
|
+
const
|
|
87
|
+
_homedir_get =
|
|
88
|
+
_libcrash_module._homedir_get;
|
|
89
|
+
/* global
|
|
90
|
+
_json_read */
|
|
91
|
+
/* eslint-disable-next-line
|
|
92
|
+
no-global-assign */
|
|
93
|
+
const
|
|
94
|
+
_json_read =
|
|
95
|
+
_libcrash_module._json_read;
|
|
96
|
+
/* global
|
|
97
|
+
_lib_get */
|
|
98
|
+
/* eslint-disable-next-line
|
|
99
|
+
no-global-assign */
|
|
100
|
+
const
|
|
101
|
+
_lib_get =
|
|
102
|
+
_libcrash_module._lib_get;
|
|
103
|
+
/* global
|
|
104
|
+
_msg_info */
|
|
105
|
+
/* eslint-disable-next-line
|
|
106
|
+
no-global-assign */
|
|
107
|
+
const
|
|
108
|
+
_msg_info =
|
|
109
|
+
_libcrash_module._msg_info;
|
|
110
|
+
/* global
|
|
111
|
+
_msg_error */
|
|
112
|
+
/* eslint-disable-next-line
|
|
113
|
+
no-global-assign */
|
|
114
|
+
const
|
|
115
|
+
_msg_error =
|
|
116
|
+
_libcrash_module._msg_error;
|
|
117
|
+
/* global
|
|
118
|
+
_path_join */
|
|
119
|
+
/* eslint-disable-next-line
|
|
120
|
+
no-global-assign */
|
|
121
|
+
const
|
|
122
|
+
_path_join =
|
|
123
|
+
_libcrash_module._path_join;
|
|
124
|
+
/* global
|
|
125
|
+
_range */
|
|
126
|
+
/* eslint-disable-next-line
|
|
127
|
+
no-global-assign */
|
|
128
|
+
const
|
|
129
|
+
_range =
|
|
130
|
+
_libcrash_module._range;
|
|
131
|
+
const
|
|
132
|
+
_libevm_contract_deployments_dir_module =
|
|
133
|
+
require(
|
|
134
|
+
"./libevm-contract-deployments-dir");
|
|
135
|
+
/* global
|
|
136
|
+
_evm_contract_deployments_dir */
|
|
137
|
+
const
|
|
138
|
+
_evm_contract_deployments_dir =
|
|
139
|
+
_libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
|
|
140
|
+
const
|
|
141
|
+
_evm_chains_info_module =
|
|
142
|
+
require(
|
|
143
|
+
"evm-chains-info");
|
|
144
|
+
/* global
|
|
145
|
+
_evm_chains_info */
|
|
146
|
+
const
|
|
147
|
+
_evm_chains_info =
|
|
148
|
+
_evm_chains_info_module._evm_chains_info;
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
function
|
|
152
|
+
_contract_address_get(
|
|
153
|
+
_deployments,
|
|
154
|
+
_contract,
|
|
155
|
+
_network,
|
|
156
|
+
_network_id,
|
|
157
|
+
_version) {
|
|
158
|
+
let
|
|
159
|
+
_config_path,
|
|
160
|
+
_address,
|
|
161
|
+
_found,
|
|
162
|
+
_msg,
|
|
163
|
+
_net;
|
|
164
|
+
const
|
|
165
|
+
_networks = [
|
|
166
|
+
_network,
|
|
167
|
+
_network_id
|
|
168
|
+
];
|
|
169
|
+
_found =
|
|
170
|
+
false;
|
|
171
|
+
for ( _net of _networks ) {
|
|
172
|
+
_config_path =
|
|
173
|
+
`${_deployments}/${_contract}/${_net}/config.sh`;
|
|
174
|
+
if ( _file_exists(
|
|
175
|
+
_config_path) ) {
|
|
176
|
+
_found =
|
|
177
|
+
true;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if ( ! _found ) {
|
|
182
|
+
_msg =
|
|
183
|
+
`No network '${_network}' deployment ` +
|
|
184
|
+
`configuration for '${_contract}' ` +
|
|
185
|
+
`found at path '${_deployments}'.`;
|
|
186
|
+
_msg_error(
|
|
187
|
+
_msg,
|
|
188
|
+
1);
|
|
189
|
+
}
|
|
190
|
+
const
|
|
191
|
+
_config =
|
|
192
|
+
_json_read(
|
|
193
|
+
_config);
|
|
194
|
+
const
|
|
195
|
+
_contract_address =
|
|
196
|
+
_config[
|
|
197
|
+
"contract-address"][
|
|
198
|
+
_version];
|
|
199
|
+
if ( _contract_address == "" ||
|
|
200
|
+
_contract_address == null ) {
|
|
201
|
+
_msg =
|
|
202
|
+
`No '${_contract}' version '${_version}' ` +
|
|
203
|
+
`contract deployment specified for network ` +
|
|
204
|
+
`'${_network}' for directory at path `+
|
|
205
|
+
`'${_deployments}'.`;
|
|
206
|
+
_msg_error(
|
|
207
|
+
_msg,
|
|
208
|
+
1);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function
|
|
213
|
+
_network_check(
|
|
214
|
+
_deployments,
|
|
215
|
+
_contract,
|
|
216
|
+
_target_network,
|
|
217
|
+
_target_network_id) {
|
|
218
|
+
let
|
|
219
|
+
_msg,
|
|
220
|
+
_network_id,
|
|
221
|
+
_networks;
|
|
222
|
+
_networks = [
|
|
223
|
+
// I need to write that first apparently
|
|
224
|
+
_evm_contract_deployment_networks
|
|
225
|
+
];
|
|
226
|
+
_app_check(
|
|
227
|
+
_app);
|
|
228
|
+
if ( typeof(
|
|
229
|
+
_type) == "undefined" ||
|
|
230
|
+
_type == "" ) {
|
|
231
|
+
_type =
|
|
232
|
+
"system";
|
|
233
|
+
}
|
|
234
|
+
let
|
|
235
|
+
_conf_dir;
|
|
236
|
+
if ( _type == "system" ) {
|
|
237
|
+
_conf_dir =
|
|
238
|
+
_lib_get();
|
|
239
|
+
}
|
|
240
|
+
else if ( _type == "user" ) {
|
|
241
|
+
const
|
|
242
|
+
_homedir =
|
|
243
|
+
_homedir_get();
|
|
244
|
+
_conf_dir =
|
|
245
|
+
`${_homedir}/.config`;
|
|
246
|
+
}
|
|
247
|
+
return `${_conf_dir}/${_app}/deployments`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function
|
|
251
|
+
_evm_contract_deployments_dir(
|
|
252
|
+
_app,
|
|
253
|
+
_user_level) {
|
|
254
|
+
let
|
|
255
|
+
_deployments,
|
|
256
|
+
_deployment_type;
|
|
257
|
+
_app_check(
|
|
258
|
+
_app);
|
|
259
|
+
if ( _user_level == "n" ) {
|
|
260
|
+
_deployment_type =
|
|
261
|
+
"system";
|
|
262
|
+
}
|
|
263
|
+
else if ( _user_level == "n" ) {
|
|
264
|
+
_deployment_type =
|
|
265
|
+
"system";
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
_msg =
|
|
269
|
+
"User level argument must be " +
|
|
270
|
+
"can be 'y' or 'n'."
|
|
271
|
+
_msg_error(
|
|
272
|
+
_msg,
|
|
273
|
+
1);
|
|
274
|
+
}
|
|
275
|
+
_deployments =
|
|
276
|
+
_default_deployments_dir_get(
|
|
277
|
+
_app,
|
|
278
|
+
_deployment_type);
|
|
279
|
+
return _deployments;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
module.exports = {
|
|
283
|
+
_default_deployments_dir_get:
|
|
284
|
+
_default_deployments_dir_get,
|
|
285
|
+
_evm_contract_deployments_dir:
|
|
286
|
+
_evm_contract_deployments_dir,
|
|
287
|
+
};
|