Export runtime bytecode and version.

This commit is contained in:
chriseth 2015-09-15 12:27:29 +02:00
parent 6b4e564b7c
commit b55cc00180

View File

@ -36,6 +36,7 @@
#include <libsolidity/CompilerStack.h> #include <libsolidity/CompilerStack.h>
#include <libsolidity/SourceReferenceFormatter.h> #include <libsolidity/SourceReferenceFormatter.h>
#include <libsolidity/ASTJsonConverter.h> #include <libsolidity/ASTJsonConverter.h>
#include <libsolidity/Version.h>
using namespace std; using namespace std;
using namespace dev; using namespace dev;
@ -169,6 +170,7 @@ string compile(string _input, bool _optimize)
contractData["solidity_interface"] = compiler.solidityInterface(contractName); contractData["solidity_interface"] = compiler.solidityInterface(contractName);
contractData["interface"] = compiler.interface(contractName); contractData["interface"] = compiler.interface(contractName);
contractData["bytecode"] = compiler.object(contractName).toHex(); contractData["bytecode"] = compiler.object(contractName).toHex();
contractData["runtimeBytecode"] = compiler.runtimeObject(contractName).toHex();
contractData["opcodes"] = eth::disassemble(compiler.object(contractName).bytecode); contractData["opcodes"] = eth::disassemble(compiler.object(contractName).bytecode);
contractData["functionHashes"] = functionHashes(compiler.contractDefinition(contractName)); contractData["functionHashes"] = functionHashes(compiler.contractDefinition(contractName));
contractData["gasEstimates"] = estimateGas(compiler, contractName); contractData["gasEstimates"] = estimateGas(compiler, contractName);
@ -188,6 +190,10 @@ static string outputBuffer;
extern "C" extern "C"
{ {
extern char const* version()
{
return VersionString.c_str();
}
extern char const* compileJSON(char const* _input, bool _optimize) extern char const* compileJSON(char const* _input, bool _optimize)
{ {
outputBuffer = compile(_input, _optimize); outputBuffer = compile(_input, _optimize);