mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Reorder ABI for readability
This commit is contained in:
parent
dd67e5966f
commit
20e3b98d1f
@ -32,13 +32,14 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
|
|||||||
for (auto it: _contractDef.interfaceFunctions())
|
for (auto it: _contractDef.interfaceFunctions())
|
||||||
{
|
{
|
||||||
auto externalFunctionType = it.second->interfaceFunctionType();
|
auto externalFunctionType = it.second->interfaceFunctionType();
|
||||||
|
solAssert(!!externalFunctionType, "");
|
||||||
Json::Value method;
|
Json::Value method;
|
||||||
method["type"] = "function";
|
method["type"] = "function";
|
||||||
method["name"] = it.second->declaration().name();
|
method["name"] = it.second->declaration().name();
|
||||||
// TODO: deprecate constant in a future release
|
// TODO: deprecate constant in a future release
|
||||||
method["constant"] = it.second->stateMutability() == StateMutability::Pure || it.second->stateMutability() == StateMutability::View;
|
method["constant"] = externalFunctionType->stateMutability() == StateMutability::Pure || it.second->stateMutability() == StateMutability::View;
|
||||||
method["payable"] = it.second->isPayable();
|
method["payable"] = externalFunctionType->isPayable();
|
||||||
method["stateMutability"] = stateMutabilityToString(it.second->stateMutability());
|
method["stateMutability"] = stateMutabilityToString(externalFunctionType->stateMutability());
|
||||||
method["inputs"] = formatTypeList(
|
method["inputs"] = formatTypeList(
|
||||||
externalFunctionType->parameterNames(),
|
externalFunctionType->parameterNames(),
|
||||||
externalFunctionType->parameterTypes(),
|
externalFunctionType->parameterTypes(),
|
||||||
@ -53,15 +54,15 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
|
|||||||
}
|
}
|
||||||
if (_contractDef.constructor())
|
if (_contractDef.constructor())
|
||||||
{
|
{
|
||||||
|
auto externalFunctionType = FunctionType(*_contractDef.constructor(), false).interfaceFunctionType();
|
||||||
|
solAssert(!!externalFunctionType, "");
|
||||||
Json::Value method;
|
Json::Value method;
|
||||||
method["type"] = "constructor";
|
method["type"] = "constructor";
|
||||||
auto externalFunction = FunctionType(*_contractDef.constructor(), false).interfaceFunctionType();
|
method["payable"] = externalFunctionType->isPayable();
|
||||||
solAssert(!!externalFunction, "");
|
method["stateMutability"] = stateMutabilityToString(externalFunctionType->stateMutability());
|
||||||
method["payable"] = externalFunction->isPayable();
|
|
||||||
method["stateMutability"] = stateMutabilityToString(externalFunction->stateMutability());
|
|
||||||
method["inputs"] = formatTypeList(
|
method["inputs"] = formatTypeList(
|
||||||
externalFunction->parameterNames(),
|
externalFunctionType->parameterNames(),
|
||||||
externalFunction->parameterTypes(),
|
externalFunctionType->parameterTypes(),
|
||||||
_contractDef.isLibrary()
|
_contractDef.isLibrary()
|
||||||
);
|
);
|
||||||
abi.append(method);
|
abi.append(method);
|
||||||
|
Loading…
Reference in New Issue
Block a user