aboutsummaryrefslogtreecommitdiffstats
path: root/InterfaceHandler.cpp
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-05-19 21:24:33 +0800
committerLiana Husikyan <liana@ethdev.com>2015-05-19 21:28:44 +0800
commite7931ade613c6a6fedba75d851042b69b72f52f0 (patch)
treeb05c662a46b861d91ef2004281966fda2c2cb1ee /InterfaceHandler.cpp
parent9c8525475164c630658b95a1132bf6064c4143f4 (diff)
downloaddexon-solidity-e7931ade613c6a6fedba75d851042b69b72f52f0.tar.gz
dexon-solidity-e7931ade613c6a6fedba75d851042b69b72f52f0.tar.zst
dexon-solidity-e7931ade613c6a6fedba75d851042b69b72f52f0.zip
added constructor to solidiy abi
Diffstat (limited to 'InterfaceHandler.cpp')
-rw-r--r--InterfaceHandler.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/InterfaceHandler.cpp b/InterfaceHandler.cpp
index 85026ac1..9817455b 100644
--- a/InterfaceHandler.cpp
+++ b/InterfaceHandler.cpp
@@ -107,17 +107,25 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
unique_ptr<string> InterfaceHandler::getABISolidityInterface(ContractDefinition const& _contractDef)
{
string ret = "contract " + _contractDef.getName() + "{";
+
+ auto populateParameters = [](vector<string> const& _paramNames,
+ vector<string> const& _paramTypes)
+ {
+ string r = "";
+ solAssert(_paramNames.size() == _paramTypes.size(), "Names and types vector size does not match");
+ for (unsigned i = 0; i < _paramNames.size(); ++i)
+ r += (r.size() ? "," : "(") + _paramTypes[i] + " " + _paramNames[i];
+ return r.size() ? r + ")" : "()";
+ };
+ if (_contractDef.getConstructor())
+ {
+ auto externalFunction = FunctionType(*_contractDef.getConstructor()).externalFunctionType();
+ solAssert(!!externalFunction, "");
+ ret += "function " + _contractDef.getName() +
+ populateParameters(externalFunction->getParameterNames(), externalFunction->getParameterTypeNames());
+ }
for (auto const& it: _contractDef.getInterfaceFunctions())
{
- auto populateParameters = [](vector<string> const& _paramNames,
- vector<string> const& _paramTypes)
- {
- string r = "";
- solAssert(_paramNames.size() == _paramTypes.size(), "Names and types vector size does not match");
- for (unsigned i = 0; i < _paramNames.size(); ++i)
- r += (r.size() ? "," : "(") + _paramTypes[i] + " " + _paramNames[i];
- return r.size() ? r + ")" : "()";
- };
ret += "function " + it.second->getDeclaration().getName() +
populateParameters(it.second->getParameterNames(), it.second->getParameterTypeNames()) +
(it.second->isConstant() ? "constant " : "");