aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerStack.cpp
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-01-13 22:59:42 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-01-13 22:59:42 +0800
commit12e000e0d327ead61092c890d0e5a359a9b9a54d (patch)
tree0e2e54e42c7ceab279ff82351c244f40a344df10 /CompilerStack.cpp
parenta253abf0623aec5ebbf8fa8b4ec3b00596c724ee (diff)
downloaddexon-solidity-12e000e0d327ead61092c890d0e5a359a9b9a54d.tar
dexon-solidity-12e000e0d327ead61092c890d0e5a359a9b9a54d.tar.gz
dexon-solidity-12e000e0d327ead61092c890d0e5a359a9b9a54d.tar.bz2
dexon-solidity-12e000e0d327ead61092c890d0e5a359a9b9a54d.tar.lz
dexon-solidity-12e000e0d327ead61092c890d0e5a359a9b9a54d.tar.xz
dexon-solidity-12e000e0d327ead61092c890d0e5a359a9b9a54d.tar.zst
dexon-solidity-12e000e0d327ead61092c890d0e5a359a9b9a54d.zip
A first version of Natspec warning popup
- Runtime Contract code hash can now be retrieved from the Compiler - Using the hash the Natspec handler stores and later retrieves Natspec JSON for a given contract.
Diffstat (limited to 'CompilerStack.cpp')
-rw-r--r--CompilerStack.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/CompilerStack.cpp b/CompilerStack.cpp
index f0d2e7f7..b0642349 100644
--- a/CompilerStack.cpp
+++ b/CompilerStack.cpp
@@ -30,6 +30,8 @@
#include <libsolidity/CompilerStack.h>
#include <libsolidity/InterfaceHandler.h>
+#include <libdevcrypto/SHA3.h>
+
using namespace std;
namespace dev
@@ -117,6 +119,7 @@ void CompilerStack::compile(bool _optimize)
contractBytecode);
Contract& compiledContract = m_contracts[contract->getName()];
compiledContract.bytecode = compiler->getAssembledBytecode();
+ compiledContract.runtimeBytecode = compiler->getRuntimeBytecode();
compiledContract.compiler = move(compiler);
contractBytecode[compiledContract.contract] = &compiledContract.bytecode;
}
@@ -134,6 +137,16 @@ bytes const& CompilerStack::getBytecode(string const& _contractName) const
return getContract(_contractName).bytecode;
}
+bytes const& CompilerStack::getRuntimeBytecode(std::string const& _contractName) const
+{
+ return getContract(_contractName).runtimeBytecode;
+}
+
+dev::h256 CompilerStack::getContractCodeHash(std::string const& _contractName) const
+{
+ return dev::sha3(getRuntimeBytecode(_contractName));
+}
+
void CompilerStack::streamAssembly(ostream& _outStream, string const& _contractName) const
{
getContract(_contractName).compiler->streamAssembly(_outStream);
@@ -218,13 +231,6 @@ bytes CompilerStack::staticCompile(std::string const& _sourceCode, bool _optimiz
return stack.compile(_sourceCode, _optimize);
}
-dev::h256 CompilerStack::getContractCodeHash(std::string const& _contractName)
-{
- //LTODO
- (void) _contractName;
- return dev::h256("");
-}
-
void CompilerStack::reset(bool _keepSources)
{
m_parseSuccessful = false;