diff options
author | Gav Wood <g@ethdev.com> | 2015-08-28 04:37:51 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-08-28 04:37:51 +0800 |
commit | aad59bd1aaab3b2c3eb5b219a071bec1c5bc6f85 (patch) | |
tree | 2b70317b91e27179ec6a6be19dddc4494c9e0645 | |
parent | 714223f552ea16b2ab0dcc42374994811e3ac249 (diff) | |
parent | a37c0dddc5cf579701fb7ab2b5ee2d8c7ba2599c (diff) | |
download | dexon-solidity-aad59bd1aaab3b2c3eb5b219a071bec1c5bc6f85.tar dexon-solidity-aad59bd1aaab3b2c3eb5b219a071bec1c5bc6f85.tar.gz dexon-solidity-aad59bd1aaab3b2c3eb5b219a071bec1c5bc6f85.tar.bz2 dexon-solidity-aad59bd1aaab3b2c3eb5b219a071bec1c5bc6f85.tar.lz dexon-solidity-aad59bd1aaab3b2c3eb5b219a071bec1c5bc6f85.tar.xz dexon-solidity-aad59bd1aaab3b2c3eb5b219a071bec1c5bc6f85.tar.zst dexon-solidity-aad59bd1aaab3b2c3eb5b219a071bec1c5bc6f85.zip |
Merge pull request #27 from LianaHus/sol_runtime_binary_by_-solc
added option to solc to output runtime part of the contract
-rw-r--r-- | solc/CommandLineInterface.cpp | 15 |
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.") |