aboutsummaryrefslogtreecommitdiffstats
path: root/InterfaceHandler.cpp
diff options
context:
space:
mode:
authorGav Wood <i@gavwood.com>2015-02-01 00:23:58 +0800
committerGav Wood <i@gavwood.com>2015-02-01 00:23:58 +0800
commita52da461683280e9abea791c93b7e0035af1cc44 (patch)
tree2a3ed09f5e8a90b510912172e159f91b76af811e /InterfaceHandler.cpp
parent6c8b5cabdc9e3f48d95e945d093a480c2ab5032e (diff)
downloaddexon-solidity-a52da461683280e9abea791c93b7e0035af1cc44.tar.gz
dexon-solidity-a52da461683280e9abea791c93b7e0035af1cc44.tar.zst
dexon-solidity-a52da461683280e9abea791c93b7e0035af1cc44.zip
Code for outputing events as well as functions.
Diffstat (limited to 'InterfaceHandler.cpp')
-rw-r--r--InterfaceHandler.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/InterfaceHandler.cpp b/InterfaceHandler.cpp
index c4bed99f..8979f356 100644
--- a/InterfaceHandler.cpp
+++ b/InterfaceHandler.cpp
@@ -37,14 +37,28 @@ std::unique_ptr<std::string> InterfaceHandler::getDocumentation(ContractDefiniti
std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinition const& _contractDef)
{
- Json::Value methods(Json::arrayValue);
-
- for (auto const& it: _contractDef.getInterfaceFunctions())
+ Json::Value members(Json::arrayValue);
+/*
+ for (ASTPointer<EventDefinition> const& it: _contractDef.getEvents())
{
- Json::Value method;
+ Json::Value event;5
Json::Value inputs(Json::arrayValue);
- Json::Value outputs(Json::arrayValue);
+ event["type"] = "event";
+ Json::Value params(Json::arrayValue);
+ for (ASTPointer<VariableDeclaration> const& p: it->getParameters())
+ {
+ Json::Value param;
+ param["name"] = p->getName();
+ param["type"] = p->getType()->toString();
+ param["indexed"] = p->isIndexed();
+ params.append(param);
+ }
+ event["inputs"] = params;
+ members.append(event);
+ }*/
+ for (auto const& it: _contractDef.getInterfaceFunctions())
+ {
auto populateParameters = [](vector<string> const& _paramNames,
vector<string> const& _paramTypes)
{
@@ -59,6 +73,11 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
}
return params;
};
+
+ Json::Value method;
+ Json::Value inputs(Json::arrayValue);
+ Json::Value outputs(Json::arrayValue);
+
method["type"] = "function";
method["name"] = it.second->getDeclaration().getName();
method["constant"] = it.second->isConstant();
@@ -66,9 +85,9 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
it.second->getParameterTypeNames());
method["outputs"] = populateParameters(it.second->getReturnParameterNames(),
it.second->getReturnParameterTypeNames());
- methods.append(method);
+ members.append(method);
}
- return std::unique_ptr<std::string>(new std::string(m_writer.write(methods)));
+ return std::unique_ptr<std::string>(new std::string(m_writer.write(members)));
}
unique_ptr<string> InterfaceHandler::getABISolidityInterface(ContractDefinition const& _contractDef)