aboutsummaryrefslogtreecommitdiffstats
path: root/solc
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-05-07 01:02:56 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-05-19 22:57:36 +0800
commit4bf3cbb09a42131dba27b080a4917f30284959d3 (patch)
tree04623e38aee222c71192d42b132dc56a35fe621f /solc
parent8169e149c98b14861cc6467f9f796010f617c521 (diff)
downloaddexon-solidity-4bf3cbb09a42131dba27b080a4917f30284959d3.tar.gz
dexon-solidity-4bf3cbb09a42131dba27b080a4917f30284959d3.tar.zst
dexon-solidity-4bf3cbb09a42131dba27b080a4917f30284959d3.zip
Use CompilerStack.contractABI directly
Diffstat (limited to 'solc')
-rw-r--r--solc/CommandLineInterface.cpp27
-rw-r--r--solc/CommandLineInterface.h1
2 files changed, 16 insertions, 12 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index badebf38..ab79aaa3 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -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
diff --git a/solc/CommandLineInterface.h b/solc/CommandLineInterface.h
index f52a03c7..3428532a 100644
--- a/solc/CommandLineInterface.h
+++ b/solc/CommandLineInterface.h
@@ -67,6 +67,7 @@ private:
void handleBytecode(std::string const& _contract);
void handleSignatureHashes(std::string const& _contract);
void handleOnChainMetadata(std::string const& _contract);
+ void handleABI(std::string const& _contract);
void handleMeta(DocumentationType _type, std::string const& _contract);
void handleGasEstimation(std::string const& _contract);
void handleFormal();