From 5c3a80ab5bac2dd5faf19416a640990af3da0a31 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 22 Mar 2017 20:56:44 +0100 Subject: Also generate optimized code. --- scripts/bytecodecompare/storebytecode.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'scripts/bytecodecompare/storebytecode.sh') diff --git a/scripts/bytecodecompare/storebytecode.sh b/scripts/bytecodecompare/storebytecode.sh index 8a3953c3..cdf376a6 100755 --- a/scripts/bytecodecompare/storebytecode.sh +++ b/scripts/bytecodecompare/storebytecode.sh @@ -49,23 +49,26 @@ var fs = require('fs') var compiler = require('solc/wrapper.js')(require('./soljson.js')) -for (var filename of process.argv.slice(2)) +for (var optimize of [false, true]) { - if (filename !== undefined) + for (var filename of process.argv.slice(2)) { - var inputs = {} - inputs[filename] = fs.readFileSync(filename).toString() - var result = compiler.compile({sources: inputs}) - if (!('contracts' in result) || Object.keys(result['contracts']).length === 0) + if (filename !== undefined) { - console.log(filename + ': ERROR') - } - else - { - for (var contractName in result['contracts']) + var inputs = {} + inputs[filename] = fs.readFileSync(filename).toString() + var result = compiler.compile({sources: inputs}, optimize) + if (!('contracts' in result) || Object.keys(result['contracts']).length === 0) + { + console.log(filename + ': ERROR') + } + else { - console.log(contractName + ' ' + result['contracts'][contractName].bytecode) - console.log(contractName + ' ' + result['contracts'][contractName].metadata) + for (var contractName in result['contracts']) + { + console.log(contractName + ' ' + result['contracts'][contractName].bytecode) + console.log(contractName + ' ' + result['contracts'][contractName].metadata) + } } } } -- cgit v1.2.3