From fd46b0217dd08ba01648b52d7a7e31c5c42ccd98 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 14 Sep 2015 21:01:42 -0400 Subject: [PATCH 1/5] support for both solc 0.1.1 and 0.1.2 --- lib/compiler.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index bcac64e6..63919338 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -21,9 +21,20 @@ Compiler.prototype.init = function(env) { }; Compiler.prototype.compile_solidity = function(contractFile) { - var cmd, result, output, json, compiled_object; + var cmd, result, output, version, json, compiled_object; - cmd = "solc --input-file " + contractFile + " --combined-json bin,abi"; + cmd = "solc --version"; + + result = exec(cmd, {silent: true}); + output = result.output; + version = output.split('\n')[1].split(' ')[1].slice(0,5); + + if (version == '0.1.1') { + cmd = "solc --input-file " + contractFile + " --combined-json binary,json-abi"; + } + else { + cmd = "solc --input-file " + contractFile + " --combined-json bin,abi"; + } result = exec(cmd, {silent: true}); output = result.output; @@ -41,7 +52,7 @@ Compiler.prototype.compile_solidity = function(contractFile) { compiled_object[className] = {}; compiled_object[className].code = contract.binary; compiled_object[className].info = {}; - compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"]); + compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"] || contract["json-abi"]); } return compiled_object; From 052c2de4b92e9f2a0a7b1c0f8ac0e7936044587d Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 14 Sep 2015 21:35:44 -0400 Subject: [PATCH 2/5] get correct compiled code --- lib/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 63919338..31b45e72 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -50,7 +50,7 @@ Compiler.prototype.compile_solidity = function(contractFile) { var contract = json[className]; compiled_object[className] = {}; - compiled_object[className].code = contract.binary; + compiled_object[className].code = contract.binary || contact.bin; compiled_object[className].info = {}; compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"] || contract["json-abi"]); } From b383c24496806c2830f8da93a8c5dd268815ed7a Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Mon, 14 Sep 2015 21:38:32 -0400 Subject: [PATCH 3/5] update to 0.9.2 --- bin/embark | 2 +- boilerplate/package.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/embark b/bin/embark index f9141ca0..8a3b7ae7 100755 --- a/bin/embark +++ b/bin/embark @@ -29,7 +29,7 @@ var deploy = function(env, embarkConfig) { } program - .version('0.9.1') + .version('0.9.2') program.command('new [name]').description('New application').action(function(name) { if (name === undefined) { diff --git a/boilerplate/package.json b/boilerplate/package.json index c7235070..458c8ec2 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,8 +10,8 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "^0.9.1", - "grunt-embark": "^0.4.1", + "embark-framework": "^0.9.2", + "grunt-embark": "^0.4.3", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-coffee": "^0.13.0", "grunt-contrib-concat": "^0.5.1", diff --git a/package.json b/package.json index 2f8517ca..0f15b435 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark-framework", - "version": "0.9.1", + "version": "0.9.2", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From 92ca694d35dee200df563386fb353e1b30bc4551 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 15 Sep 2015 09:02:43 -0400 Subject: [PATCH 4/5] fix embarassing typo --- lib/compiler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compiler.js b/lib/compiler.js index 31b45e72..89d9bf4c 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -50,7 +50,7 @@ Compiler.prototype.compile_solidity = function(contractFile) { var contract = json[className]; compiled_object[className] = {}; - compiled_object[className].code = contract.binary || contact.bin; + compiled_object[className].code = contract.binary || contract.bin; compiled_object[className].info = {}; compiled_object[className].info.abiDefinition = JSON.parse(contract["abi"] || contract["json-abi"]); } From 8539ff241f7785685cfe88737615216c195777f0 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 15 Sep 2015 09:03:25 -0400 Subject: [PATCH 5/5] update to 0.9.3 --- bin/embark | 2 +- boilerplate/package.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/embark b/bin/embark index 8a3b7ae7..f633663e 100755 --- a/bin/embark +++ b/bin/embark @@ -29,7 +29,7 @@ var deploy = function(env, embarkConfig) { } program - .version('0.9.2') + .version('0.9.3') program.command('new [name]').description('New application').action(function(name) { if (name === undefined) { diff --git a/boilerplate/package.json b/boilerplate/package.json index 458c8ec2..e82b7d0f 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,7 +10,7 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "^0.9.2", + "embark-framework": "^0.9.3", "grunt-embark": "^0.4.3", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-coffee": "^0.13.0", diff --git a/package.json b/package.json index 0f15b435..0987a62a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark-framework", - "version": "0.9.2", + "version": "0.9.3", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1"