Support methodIdentifiers

This commit is contained in:
Alex Beregszaszi 2017-03-29 22:00:38 +01:00
parent f25efceaf8
commit 63b6d0099f

View File

@ -99,6 +99,14 @@ StringMap createSourceList(Json::Value const& _input)
return sources; return sources;
} }
Json::Value methodIdentifiers(ContractDefinition const& _contract)
{
Json::Value methodIdentifiers(Json::objectValue);
for (auto const& it: _contract.interfaceFunctions())
methodIdentifiers[it.second->externalSignature()] = toHex(it.first.ref());
return methodIdentifiers;
}
Json::Value StandardCompiler::compileInternal(Json::Value const& _input) Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
{ {
m_compilerStack.reset(false); m_compilerStack.reset(false);
@ -259,7 +267,7 @@ Json::Value StandardCompiler::compileInternal(Json::Value const& _input)
ostringstream unused; ostringstream unused;
evmData["legacyAssembly"] = m_compilerStack.streamAssembly(unused, contractName, createSourceList(_input), true); evmData["legacyAssembly"] = m_compilerStack.streamAssembly(unused, contractName, createSourceList(_input), true);
evmData["opcodes"] = solidity::disassemble(m_compilerStack.object(contractName).bytecode); evmData["opcodes"] = solidity::disassemble(m_compilerStack.object(contractName).bytecode);
// @TODO: add methodIdentifiers evmData["methodIdentifiers"] = methodIdentifiers(m_compilerStack.contractDefinition(contractName));
// @TODO: add gasEstimates // @TODO: add gasEstimates
// EVM bytecode // EVM bytecode