mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use CompilerStack.contractABI directly
This commit is contained in:
@@ -266,12 +266,24 @@ void CommandLineInterface::handleOnChainMetadata(string const& _contract)
|
||||
return;
|
||||
|
||||
string data = m_compiler->onChainMetadata(_contract);
|
||||
if (m_args.count("output-dir"))
|
||||
if (m_args.count(g_argOutputDir))
|
||||
createFile(m_compiler->filesystemFriendlyName(_contract) + "_meta.json", data);
|
||||
else
|
||||
cout << "Metadata: " << endl << data << endl;
|
||||
}
|
||||
|
||||
void CommandLineInterface::handleABI(string const& _contract)
|
||||
{
|
||||
if (!m_args.count(g_argAbi))
|
||||
return;
|
||||
|
||||
string data = dev::jsonCompactPrint(m_compiler->contractABI(_contract));
|
||||
if (m_args.count(g_argOutputDir))
|
||||
createFile(m_compiler->filesystemFriendlyName(_contract) + ".abi", data);
|
||||
else
|
||||
cout << "Contract JSON ABI " << endl << data << endl;
|
||||
}
|
||||
|
||||
void CommandLineInterface::handleMeta(DocumentationType _type, string const& _contract)
|
||||
{
|
||||
std::string argName;
|
||||
@@ -279,11 +291,6 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
|
||||
std::string title;
|
||||
switch(_type)
|
||||
{
|
||||
case DocumentationType::ABIInterface:
|
||||
argName = g_argAbi;
|
||||
suffix = ".abi";
|
||||
title = "Contract JSON ABI";
|
||||
break;
|
||||
case DocumentationType::NatspecUser:
|
||||
argName = g_argNatspecUser;
|
||||
suffix = ".docuser";
|
||||
@@ -301,11 +308,7 @@ void CommandLineInterface::handleMeta(DocumentationType _type, string const& _co
|
||||
|
||||
if (m_args.count(argName))
|
||||
{
|
||||
std::string output;
|
||||
if (_type == DocumentationType::ABIInterface)
|
||||
output = dev::jsonCompactPrint(m_compiler->metadata(_contract, _type));
|
||||
else
|
||||
output = dev::jsonPrettyPrint(m_compiler->metadata(_contract, _type));
|
||||
std::string output = dev::jsonPrettyPrint(m_compiler->metadata(_contract, _type));
|
||||
|
||||
if (m_args.count(g_argOutputDir))
|
||||
createFile(m_compiler->filesystemFriendlyName(_contract) + suffix, output);
|
||||
@@ -1069,7 +1072,7 @@ void CommandLineInterface::outputCompilationResults()
|
||||
handleBytecode(contract);
|
||||
handleSignatureHashes(contract);
|
||||
handleOnChainMetadata(contract);
|
||||
handleMeta(DocumentationType::ABIInterface, contract);
|
||||
handleABI(contract);
|
||||
handleMeta(DocumentationType::NatspecDev, contract);
|
||||
handleMeta(DocumentationType::NatspecUser, contract);
|
||||
} // end of contracts iteration
|
||||
|
||||
Reference in New Issue
Block a user