aboutsummaryrefslogtreecommitdiffstats
path: root/solc/CommandLineInterface.cpp
diff options
context:
space:
mode:
authorLianaHus <liana@ethdev.com>2015-08-24 23:24:48 +0800
committerLianaHus <liana@ethdev.com>2015-08-24 23:24:48 +0800
commita37c0dddc5cf579701fb7ab2b5ee2d8c7ba2599c (patch)
treeb992d2950ef391ade1ef5dcba330b96788383de8 /solc/CommandLineInterface.cpp
parentffcf18406b605afe56f545fa4a41bc3bbb870c28 (diff)
downloaddexon-solidity-a37c0dddc5cf579701fb7ab2b5ee2d8c7ba2599c.tar.gz
dexon-solidity-a37c0dddc5cf579701fb7ab2b5ee2d8c7ba2599c.tar.zst
dexon-solidity-a37c0dddc5cf579701fb7ab2b5ee2d8c7ba2599c.zip
added option to solc to output runtimr part of the contract
Diffstat (limited to 'solc/CommandLineInterface.cpp')
-rw-r--r--solc/CommandLineInterface.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp
index 8c8ff03e..28f550ea 100644
--- a/solc/CommandLineInterface.cpp
+++ b/solc/CommandLineInterface.cpp
@@ -63,6 +63,7 @@ static string const g_argAsmJsonStr = "asm-json";
static string const g_argAstStr = "ast";
static string const g_argAstJson = "ast-json";
static string const g_argBinaryStr = "bin";
+static string const g_argRuntimeBinaryStr = "bin-runtime";
static string const g_argCloneBinaryStr = "clone-bin";
static string const g_argOpcodesStr = "opcodes";
static string const g_argNatspecDevStr = "devdoc";
@@ -113,6 +114,7 @@ static bool needsHumanTargetedStdout(po::variables_map const& _args)
humanTargetedStdout(_args, g_argAsmJsonStr) ||
humanTargetedStdout(_args, g_argOpcodesStr) ||
humanTargetedStdout(_args, g_argBinaryStr) ||
+ humanTargetedStdout(_args, g_argRuntimeBinaryStr) ||
humanTargetedStdout(_args, g_argCloneBinaryStr);
}
@@ -138,6 +140,16 @@ void CommandLineInterface::handleBinary(string const& _contract)
cout << toHex(m_compiler->getCloneBytecode(_contract)) << endl;
}
}
+ if (m_args.count(g_argRuntimeBinaryStr))
+ {
+ if (m_args.count("output-dir"))
+ createFile(_contract + ".bin", toHex(m_compiler->getRuntimeBytecode(_contract)));
+ else
+ {
+ cout << "Binary of the runtime part: " << endl;
+ cout << toHex(m_compiler->getRuntimeBytecode(_contract)) << endl;
+ }
+ }
}
void CommandLineInterface::handleOpcode(string const& _contract)
@@ -157,7 +169,7 @@ void CommandLineInterface::handleBytecode(string const& _contract)
{
if (m_args.count(g_argOpcodesStr))
handleOpcode(_contract);
- if (m_args.count(g_argBinaryStr) || m_args.count(g_argCloneBinaryStr))
+ if (m_args.count(g_argBinaryStr) || m_args.count(g_argCloneBinaryStr) || m_args.count(g_argRuntimeBinaryStr))
handleBinary(_contract);
}
@@ -326,6 +338,7 @@ Allowed options)",
(g_argAsmJsonStr.c_str(), "EVM assembly of the contracts in JSON format.")
(g_argOpcodesStr.c_str(), "Opcodes of the contracts.")
(g_argBinaryStr.c_str(), "Binary of the contracts in hex.")
+ (g_argRuntimeBinaryStr.c_str(), "Binary of the runtime part of the contracts in hex.")
(g_argCloneBinaryStr.c_str(), "Binary of the clone contracts in hex.")
(g_argAbiStr.c_str(), "ABI specification of the contracts.")
(g_argSolInterfaceStr.c_str(), "Solidity interface of the contracts.")