Fuzzer: Permit linking of libraries in compilation framework

This commit is contained in:
Bhargava Shastry 2020-04-20 14:28:38 +02:00
parent c24c4f85e4
commit ea5b64ca9e
2 changed files with 8 additions and 4 deletions

View File

@ -9,13 +9,16 @@ SolidityCompilationFramework::SolidityCompilationFramework(langutil::EVMVersion
solidity::bytes SolidityCompilationFramework::compileContract(
std::string const& _sourceCode,
std::string const& _contractName
std::string const& _contractName,
std::map<std::string, solidity::util::h160> const& _libraryAddresses,
frontend::OptimiserSettings _optimization
)
{
std::string sourceCode = _sourceCode;
m_compiler.setSources({{"", sourceCode}});
m_compiler.setLibraries(_libraryAddresses);
m_compiler.setEVMVersion(m_evmVersion);
m_compiler.setOptimiserSettings(m_optimiserSettings);
m_compiler.setOptimiserSettings(_optimization);
if (!m_compiler.compile())
{
langutil::SourceReferenceFormatter formatter(std::cerr);

View File

@ -23,12 +23,13 @@ public:
}
bytes compileContract(
std::string const& _sourceCode,
std::string const& _contractName = {}
std::string const& _contractName,
std::map<std::string, solidity::util::h160> const& _libraryAddresses = {},
frontend::OptimiserSettings _optimization = frontend::OptimiserSettings::minimal()
);
protected:
frontend::CompilerStack m_compiler;
langutil::EVMVersion m_evmVersion;
frontend::OptimiserSettings m_optimiserSettings = frontend::OptimiserSettings::none();
};
}