aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/CompilerStack.cpp8
-rw-r--r--libsolidity/interface/CompilerStack.h3
2 files changed, 11 insertions, 0 deletions
diff --git a/libsolidity/interface/CompilerStack.cpp b/libsolidity/interface/CompilerStack.cpp
index aca9ce39..b09108b0 100644
--- a/libsolidity/interface/CompilerStack.cpp
+++ b/libsolidity/interface/CompilerStack.cpp
@@ -481,6 +481,14 @@ Json::Value const& CompilerStack::natspec(Contract const& _contract, Documentati
return *(*doc);
}
+Json::Value CompilerStack::functionHashes(ContractDefinition const& _contract)
+{
+ Json::Value functionHashes(Json::objectValue);
+ for (auto const& it: _contract.interfaceFunctions())
+ functionHashes[it.second->externalSignature()] = toHex(it.first.ref());
+ return functionHashes;
+}
+
string const& CompilerStack::onChainMetadata(string const& _contractName) const
{
if (m_stackState != CompilationSuccessful)
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h
index bffdeabd..3250429b 100644
--- a/libsolidity/interface/CompilerStack.h
+++ b/libsolidity/interface/CompilerStack.h
@@ -177,6 +177,9 @@ public:
/// @param type The type of the documentation to get.
/// Can be one of 4 types defined at @c DocumentationType
Json::Value const& natspec(std::string const& _contractName, DocumentationType _type) const;
+
+ Json::Value functionHashes(ContractDefinition const& _contract);
+
std::string const& onChainMetadata(std::string const& _contractName) const;
void useMetadataLiteralSources(bool _metadataLiteralSources) { m_metadataLiteralSources = _metadataLiteralSources; }