aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/interface/CompilerStack.h
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-11-14 18:46:43 +0800
committerchriseth <c@ethdev.com>2016-12-01 23:03:59 +0800
commit5789eaa78d0e00f6289101e02f7de5e9decdc7e5 (patch)
tree8964f493235d310baa50806fdff65138054d2439 /libsolidity/interface/CompilerStack.h
parent55a719a79c1ab5b78ea6e1bcb4f27a888494a538 (diff)
downloaddexon-solidity-5789eaa78d0e00f6289101e02f7de5e9decdc7e5.tar.gz
dexon-solidity-5789eaa78d0e00f6289101e02f7de5e9decdc7e5.tar.zst
dexon-solidity-5789eaa78d0e00f6289101e02f7de5e9decdc7e5.zip
Metadata stamp.
Diffstat (limited to 'libsolidity/interface/CompilerStack.h')
-rw-r--r--libsolidity/interface/CompilerStack.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h
index ea706122..74a7dfc5 100644
--- a/libsolidity/interface/CompilerStack.h
+++ b/libsolidity/interface/CompilerStack.h
@@ -113,14 +113,15 @@ public:
/// Compiles the source units that were previously added and parsed.
/// @returns false on error.
- bool compile(bool _optimize = false, unsigned _runs = 200);
+ bool compile(
+ bool _optimize = false,
+ unsigned _runs = 200,
+ std::map<std::string, h160> const& _libraries = std::map<std::string, h160>{}
+ );
/// Parses and compiles the given source code.
/// @returns false on error.
bool compile(std::string const& _sourceCode, bool _optimize = false);
- /// Inserts the given addresses into the linker objects of all compiled contracts.
- void link(std::map<std::string, h160> const& _libraries);
-
/// Tries to translate all source files into a language suitable for formal analysis.
/// @param _errors list to store errors - defaults to the internal error list.
/// @returns false on error.
@@ -170,6 +171,7 @@ public:
/// @param type The type of the documentation to get.
/// Can be one of 4 types defined at @c DocumentationType
Json::Value const& metadata(std::string const& _contractName, DocumentationType _type) const;
+ std::string const& onChainMetadata(std::string const& _contractName) const;
/// @returns the previously used scanner, useful for counting lines during error reporting.
Scanner const& scanner(std::string const& _sourceName = "") const;
@@ -213,6 +215,7 @@ private:
eth::LinkerObject object;
eth::LinkerObject runtimeObject;
eth::LinkerObject cloneObject;
+ std::string onChainMetadata; ///< The metadata json that will be hashed into the chain.
mutable std::unique_ptr<Json::Value const> interface;
mutable std::unique_ptr<Json::Value const> userDocumentation;
mutable std::unique_ptr<Json::Value const> devDocumentation;
@@ -233,16 +236,18 @@ private:
std::string absolutePath(std::string const& _path, std::string const& _reference) const;
/// Compile a single contract and put the result in @a _compiledContracts.
void compileContract(
- bool _optimize,
- unsigned _runs,
ContractDefinition const& _contract,
std::map<ContractDefinition const*, eth::Assembly const*>& _compiledContracts
);
+ void link();
+
Contract const& contract(std::string const& _contractName = "") const;
Source const& source(std::string const& _sourceName = "") const;
+ std::string createOnChainMetadata(Contract const& _contract) const;
std::string computeSourceMapping(eth::AssemblyItems const& _items) const;
+ Json::Value const& metadata(Contract const&, DocumentationType _type) const;
struct Remapping
{
@@ -252,6 +257,9 @@ private:
};
ReadFileCallback m_readFile;
+ bool m_optimize = false;
+ size_t m_optimizeRuns = 200;
+ std::map<std::string, h160> m_libraries;
/// list of path prefix remappings, e.g. mylibrary: github.com/ethereum = /usr/local/ethereum
/// "context:prefix=target"
std::vector<Remapping> m_remappings;