diff options
author | chriseth <chris@ethereum.org> | 2017-06-15 16:10:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-15 16:10:18 +0800 |
commit | 9084d48750afeed128e4d1b7cfe5e836d773d3f3 (patch) | |
tree | 83e7a9cc3375f0406bd6152e2963243c33849439 /libsolidity | |
parent | 3cb71ac51624377174029e244b3cef950dedbfe8 (diff) | |
parent | 5f7bca94e5174738aea294c51f4bea2f8b450d0d (diff) | |
download | dexon-solidity-9084d48750afeed128e4d1b7cfe5e836d773d3f3.tar dexon-solidity-9084d48750afeed128e4d1b7cfe5e836d773d3f3.tar.gz dexon-solidity-9084d48750afeed128e4d1b7cfe5e836d773d3f3.tar.bz2 dexon-solidity-9084d48750afeed128e4d1b7cfe5e836d773d3f3.tar.lz dexon-solidity-9084d48750afeed128e4d1b7cfe5e836d773d3f3.tar.xz dexon-solidity-9084d48750afeed128e4d1b7cfe5e836d773d3f3.tar.zst dexon-solidity-9084d48750afeed128e4d1b7cfe5e836d773d3f3.zip |
Merge pull request #2382 from ruchevits/combined-json-hashes
Allow including hashes of method signatures in --combined-json output
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/interface/CompilerStack.cpp | 8 | ||||
-rw-r--r-- | libsolidity/interface/CompilerStack.h | 3 |
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; } |