diff options
author | chriseth <chris@ethereum.org> | 2017-03-23 03:56:44 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-03-23 16:56:18 +0800 |
commit | 5c3a80ab5bac2dd5faf19416a640990af3da0a31 (patch) | |
tree | 69c5699ba612cc3a28dfb1edae57b545814663ef /scripts/bytecodecompare/storebytecode.sh | |
parent | bbe3557a2fda2f4a09b63b1f3e501d4c8625bfe1 (diff) | |
download | dexon-solidity-5c3a80ab5bac2dd5faf19416a640990af3da0a31.tar.gz dexon-solidity-5c3a80ab5bac2dd5faf19416a640990af3da0a31.tar.zst dexon-solidity-5c3a80ab5bac2dd5faf19416a640990af3da0a31.zip |
Also generate optimized code.
Diffstat (limited to 'scripts/bytecodecompare/storebytecode.sh')
-rwxr-xr-x | scripts/bytecodecompare/storebytecode.sh | 29 |
1 files changed, 16 insertions, 13 deletions
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) + } } } } |