aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-08-25 18:17:11 +0800
committerGitHub <noreply@github.com>2017-08-25 18:17:11 +0800
commite945f4589408e35e0d0c3cff22091c61c9771410 (patch)
tree0b3da0f1d1779a0848f0aab258ce74be865f2d38 /libsolidity
parentde5c702cc690dbfc51d9e7203328d81c6ede13b4 (diff)
parent20e3b98d1fd7e95b7b03e10e68373283666d1c3c (diff)
downloaddexon-solidity-e945f4589408e35e0d0c3cff22091c61c9771410.tar.gz
dexon-solidity-e945f4589408e35e0d0c3cff22091c61c9771410.tar.zst
dexon-solidity-e945f4589408e35e0d0c3cff22091c61c9771410.zip
Merge pull request #2806 from ethereum/abi
Reorder ABI for readability
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/interface/ABI.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/libsolidity/interface/ABI.cpp b/libsolidity/interface/ABI.cpp
index 3df9d1f8..49df843d 100644
--- a/libsolidity/interface/ABI.cpp
+++ b/libsolidity/interface/ABI.cpp
@@ -32,13 +32,14 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
for (auto it: _contractDef.interfaceFunctions())
{
auto externalFunctionType = it.second->interfaceFunctionType();
+ solAssert(!!externalFunctionType, "");
Json::Value method;
method["type"] = "function";
method["name"] = it.second->declaration().name();
// TODO: deprecate constant in a future release
- method["constant"] = it.second->stateMutability() == StateMutability::Pure || it.second->stateMutability() == StateMutability::View;
- method["payable"] = it.second->isPayable();
- method["stateMutability"] = stateMutabilityToString(it.second->stateMutability());
+ method["constant"] = externalFunctionType->stateMutability() == StateMutability::Pure || it.second->stateMutability() == StateMutability::View;
+ method["payable"] = externalFunctionType->isPayable();
+ method["stateMutability"] = stateMutabilityToString(externalFunctionType->stateMutability());
method["inputs"] = formatTypeList(
externalFunctionType->parameterNames(),
externalFunctionType->parameterTypes(),
@@ -53,15 +54,15 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
}
if (_contractDef.constructor())
{
+ auto externalFunctionType = FunctionType(*_contractDef.constructor(), false).interfaceFunctionType();
+ solAssert(!!externalFunctionType, "");
Json::Value method;
method["type"] = "constructor";
- auto externalFunction = FunctionType(*_contractDef.constructor(), false).interfaceFunctionType();
- solAssert(!!externalFunction, "");
- method["payable"] = externalFunction->isPayable();
- method["stateMutability"] = stateMutabilityToString(externalFunction->stateMutability());
+ method["payable"] = externalFunctionType->isPayable();
+ method["stateMutability"] = stateMutabilityToString(externalFunctionType->stateMutability());
method["inputs"] = formatTypeList(
- externalFunction->parameterNames(),
- externalFunction->parameterTypes(),
+ externalFunctionType->parameterNames(),
+ externalFunctionType->parameterTypes(),
_contractDef.isLibrary()
);
abi.append(method);