diff options
author | chriseth <c@ethdev.com> | 2015-05-15 23:00:08 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-05-15 23:00:08 +0800 |
commit | c82a3e06a01174831b7c919824c71110b5d8e267 (patch) | |
tree | bc89a15cefe2b7740460120832a6411a08931330 /jsonCompiler.cpp | |
parent | 3b6bd194b0f822cde1899daf7ec1a026f5a86609 (diff) | |
download | dexon-solidity-c82a3e06a01174831b7c919824c71110b5d8e267.tar dexon-solidity-c82a3e06a01174831b7c919824c71110b5d8e267.tar.gz dexon-solidity-c82a3e06a01174831b7c919824c71110b5d8e267.tar.bz2 dexon-solidity-c82a3e06a01174831b7c919824c71110b5d8e267.tar.lz dexon-solidity-c82a3e06a01174831b7c919824c71110b5d8e267.tar.xz dexon-solidity-c82a3e06a01174831b7c919824c71110b5d8e267.tar.zst dexon-solidity-c82a3e06a01174831b7c919824c71110b5d8e267.zip |
Function hashes for JSON compiler.
Diffstat (limited to 'jsonCompiler.cpp')
-rw-r--r-- | jsonCompiler.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jsonCompiler.cpp b/jsonCompiler.cpp index 6f3834af..d47903fc 100644 --- a/jsonCompiler.cpp +++ b/jsonCompiler.cpp @@ -50,6 +50,14 @@ string formatError(Exception const& _exception, string const& _name, CompilerSta return Json::FastWriter().write(output); } +Json::Value functionHashes(ContractDefinition const& _contract) +{ + Json::Value functionHashes(Json::objectValue); + for (auto const& it: _contract.getInterfaceFunctions()) + functionHashes[it.second->externalSignature()] = toHex(it.first.ref()); + return functionHashes; +} + string compile(string _input, bool _optimize) { StringMap sources; @@ -100,6 +108,7 @@ string compile(string _input, bool _optimize) contractData["interface"] = compiler.getInterface(contractName); contractData["bytecode"] = toHex(compiler.getBytecode(contractName)); contractData["opcodes"] = eth::disassemble(compiler.getBytecode(contractName)); + contractData["functionHashes"] = functionHashes(compiler.getContractDefinition(contractName)); ostringstream unused; contractData["assembly"] = compiler.streamAssembly(unused, contractName, sources, true); output["contracts"][contractName] = contractData; |