File tree Expand file tree Collapse file tree 6 files changed +222
-0
lines changed Expand file tree Collapse file tree 6 files changed +222
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # compiled output
3
+ /dist
4
+ /tmp
5
+ /out-tsc
6
+
7
+ # Runtime data
8
+ pids
9
+ * .pid
10
+ * .seed
11
+ * .pid.lock
12
+
13
+ # Directory for instrumented libs generated by jscoverage/JSCover
14
+ lib-cov
15
+
16
+ # Coverage directory used by tools like istanbul
17
+ coverage
18
+
19
+ # nyc test coverage
20
+ .nyc_output
21
+
22
+ # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
23
+ .grunt
24
+
25
+ # Bower dependency directory (https://bower.io/)
26
+ bower_components
27
+
28
+ # node-waf configuration
29
+ .lock-wscript
30
+
31
+ # IDEs and editors
32
+ .idea
33
+ .project
34
+ .classpath
35
+ .c9 /
36
+ * .launch
37
+ .settings /
38
+ * .sublime-workspace
39
+
40
+ # IDE - VSCode
41
+ .vscode /*
42
+ ! .vscode /settings.json
43
+ ! .vscode /tasks.json
44
+ ! .vscode /launch.json
45
+ ! .vscode /extensions.json
46
+
47
+ # misc
48
+ .sass-cache
49
+ connect.lock
50
+ typings
51
+
52
+ # Logs
53
+ logs
54
+ * .log
55
+ npm-debug.log *
56
+ yarn-debug.log *
57
+ yarn-error.log *
58
+
59
+
60
+ # Dependency directories
61
+ node_modules /
62
+ jspm_packages /
63
+
64
+ # Optional npm cache directory
65
+ .npm
66
+
67
+ # Optional eslint cache
68
+ .eslintcache
69
+
70
+ # Optional REPL history
71
+ .node_repl_history
72
+
73
+ # Output of 'npm pack'
74
+ * .tgz
75
+
76
+ # Yarn Integrity file
77
+ .yarn-integrity
78
+
79
+ # dotenv environment variables file
80
+ .env
81
+
82
+ # next.js build output
83
+ .next
84
+
85
+ # Lerna
86
+ lerna-debug.log
87
+
88
+ # System Files
89
+ .DS_Store
90
+ Thumbs.db
91
+
92
+ TODO
Original file line number Diff line number Diff line change
1
+ // require imports the library i need
2
+ const path = require ( 'path' ) ; // path is to avoid problems with different machines
3
+ const fs = require ( 'fs' ) ;
4
+ const solc = require ( 'solc' ) ;
5
+
6
+ // __dirname is the working directory in JS
7
+ const doubleCheck = path . resolve ( __dirname , 'contracts' , 'DoubleCheck.sol' ) ;
8
+ const source = fs . readFileSync ( doubleCheck , 'utf8' ) ;
9
+ // give the source to solc.compile and specify how many contracts to compile
10
+
11
+ // export the bytecode and ABI inside module export
12
+ module . exports = solc . compile ( source , 1 ) . contracts [ ':DoubleCheck' ] ;
13
+ // in this way we can use the statement: const {interface,bytecode} = require('./compile');
Original file line number Diff line number Diff line change
1
+ const inquirer = require ( 'inquirer' ) ;
2
+
3
+ module . exports = {
4
+ printMessage : ( msg ) => {
5
+ console . log ( msg ) ;
6
+ return inquirer . prompt ( "Press any key to continue!" )
7
+ } ,
8
+
9
+ askCredentials : ( ) => {
10
+ const questions = [
11
+ {
12
+ name : 'password' ,
13
+ type : 'password' ,
14
+ message : 'Enter your private key:' ,
15
+ validate : function ( value ) {
16
+ if ( value === 'pswd' ) {
17
+ return true ;
18
+ } else {
19
+ return 'Please enter your password.' ;
20
+ }
21
+ }
22
+ }
23
+ ] ;
24
+ return inquirer . prompt ( questions ) ;
25
+ } ,
26
+
27
+ askQuestionsNewArt : ( ) => {
28
+ const questions = [
29
+ {
30
+ name : 'title' ,
31
+ type : 'input' ,
32
+ message : 'Insert the title of the artwork:' ,
33
+ validate : function ( value ) {
34
+ if ( value . length ) {
35
+ return true ;
36
+ } else {
37
+ return 'This field cannot be empty!' ;
38
+ }
39
+ }
40
+ } ,
41
+ {
42
+ name : 'author' ,
43
+ type : 'input' ,
44
+ message : 'Insert the author of the artwork:' ,
45
+ validate : function ( value ) {
46
+ if ( value . length ) {
47
+ return true ;
48
+ } else {
49
+ return 'This field cannot be empty!' ;
50
+ }
51
+ }
52
+ } ,
53
+ {
54
+ name : 'date' ,
55
+ type : 'input' ,
56
+ message : 'Insert the date of the artwork:' ,
57
+ validate : function ( value ) {
58
+ if ( value . length ) {
59
+ return true ;
60
+ } else {
61
+ return 'This field cannot be empty!' ;
62
+ }
63
+ }
64
+ } ,
65
+ ] ;
66
+ return inquirer . prompt ( questions ) ;
67
+ }
68
+ }
Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) ;
2
+ const contract = JSON . parse ( fs . readFileSync ( './build/contracts/TransArt.json' , 'utf8' ) ) ;
3
+ const { interface, bytecode} = require ( '../compile' ) ;
4
+ const utils = require ( './utils.js' )
5
+ const Web3 = require ( 'web3' ) ;
6
+ const web3 = new Web3 ( new Web3 . providers . HttpProvider ( "http://localhost:8545" ) ) ;
7
+
8
+ module . exports = {
9
+
10
+ deploy : async function deploy ( sendingAddress ) {
11
+ const gasPrice = await web3 . eth . getGasPrice ( ) ;
12
+ console . log ( "Gas Price is: " + gasPrice ) ;
13
+
14
+ const transart = await new web3 . eth . Contract ( JSON . parse ( interface ) )
15
+ . deploy ( { data :bytecode } )
16
+ . send ( { from : sendingAddress , gas :2000000 } ) ;
17
+
18
+ console . log ( 'Request sent from: ' , sendingAddress )
19
+ console . log ( 'Contract deployed to address: ' , transart . options . address ) ;
20
+ }
21
+
22
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " DoubleCheck" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " DoubleCheck CLI" ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {
7
+ "test" : " mocha"
8
+ },
9
+ "author" : " " ,
10
+ "license" : " ISC" ,
11
+ "dependencies" : {
12
+ "chai" : " ^4.2.0" ,
13
+ "chai-as-promised" : " ^7.1.1" ,
14
+ "chalk" : " ^2.4.2" ,
15
+ "clear" : " ^0.1.0" ,
16
+ "figlet" : " ^1.2.1" ,
17
+ "ganache-cli" : " ^6.3.0" ,
18
+ "inquirer" : " ^6.2.2" ,
19
+ "mocha" : " ^5.2.0" ,
20
+ "solc" : " ^0.4.25" ,
21
+ "truffle-hdwallet-provider" : " ^1.0.4" ,
22
+ "web3" : " ^1.0.0-beta.36"
23
+ },
24
+ "bin" : {
25
+ "OSS" : " ./index.js"
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments