aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-08-24 22:23:00 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-08-24 22:23:00 +0800
commitdeeac7e2e0a1b8ffd0bbc709264d7bf37eb05536 (patch)
treec60783e5d37d453485cc06016d62376638e8c1bb
parentd3fd6a8800ddd15be509971b516bb823bbd93b86 (diff)
downloaddexon-solidity-deeac7e2e0a1b8ffd0bbc709264d7bf37eb05536.tar
dexon-solidity-deeac7e2e0a1b8ffd0bbc709264d7bf37eb05536.tar.gz
dexon-solidity-deeac7e2e0a1b8ffd0bbc709264d7bf37eb05536.tar.bz2
dexon-solidity-deeac7e2e0a1b8ffd0bbc709264d7bf37eb05536.tar.lz
dexon-solidity-deeac7e2e0a1b8ffd0bbc709264d7bf37eb05536.tar.xz
dexon-solidity-deeac7e2e0a1b8ffd0bbc709264d7bf37eb05536.tar.zst
dexon-solidity-deeac7e2e0a1b8ffd0bbc709264d7bf37eb05536.zip
Rename statemutability to stateMutability in ABI/AST
-rw-r--r--Changelog.md2
-rw-r--r--docs/abi-spec.rst2
-rw-r--r--libsolidity/ast/ASTJsonConverter.cpp4
-rw-r--r--libsolidity/interface/ABI.cpp6
-rw-r--r--test/libsolidity/SolidityABIJSON.cpp56
5 files changed, 35 insertions, 35 deletions
diff --git a/Changelog.md b/Changelog.md
index 8c540a28..4144c264 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,7 +2,7 @@
Features:
* Introduce ``pure`` functions. The pureness is not enforced yet, use with care.
- * ABI JSON: Include new field ``statemutability`` with values ``pure``, ``view``, ``nonpayable`` and ``payable``.
+ * ABI JSON: Include new field ``stateMutability`` with values ``pure``, ``view``, ``nonpayable`` and ``payable``.
* Analyzer: Experimental partial support for Z3 SMT checker.
* Parser: Display previous visibility specifier in error if multiple are found.
* Parser: Introduce ``view`` keyword on functions (``constant`` remains an alias for ``view``).
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index 036b1ac8..c0969cae 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -295,7 +295,7 @@ The JSON format for a contract's interface is given by an array of function and/
- `outputs`: an array of objects similar to `inputs`, can be omitted if function doesn't return anything;
- `constant`: `true` if function is :ref:`specified to not modify blockchain state <view-functions>`);
- `payable`: `true` if function accepts ether, defaults to `false`;
-- `statemutability`: a string with one of the following values: `pure` (:ref:`specified to not read blockchain state <pure-functions>`), `view` (same as `constant` above), `nonpayable` and `payable` (same as `payable` above).
+- `stateMutability`: a string with one of the following values: `pure` (:ref:`specified to not read blockchain state <pure-functions>`), `view` (same as `constant` above), `nonpayable` and `payable` (same as `payable` above).
`type` can be omitted, defaulting to `"function"`.
diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp
index c0d635f3..afc53bfe 100644
--- a/libsolidity/ast/ASTJsonConverter.cpp
+++ b/libsolidity/ast/ASTJsonConverter.cpp
@@ -327,7 +327,7 @@ bool ASTJsonConverter::visit(FunctionDefinition const& _node)
// FIXME: remove with next breaking release
make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.stateMutability() <= StateMutability::View),
make_pair("payable", _node.isPayable()),
- make_pair("statemutability", stateMutabilityToString(_node.stateMutability())),
+ make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())),
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
make_pair("parameters", toJson(_node.parameterList())),
make_pair("isConstructor", _node.isConstructor()),
@@ -416,7 +416,7 @@ bool ASTJsonConverter::visit(FunctionTypeName const& _node)
setJsonNode(_node, "FunctionTypeName", {
make_pair("payable", _node.isPayable()),
make_pair("visibility", Declaration::visibilityToString(_node.visibility())),
- make_pair("statemutability", stateMutabilityToString(_node.stateMutability())),
+ make_pair("stateMutability", stateMutabilityToString(_node.stateMutability())),
// FIXME: remove with next breaking release
make_pair(m_legacy ? "constant" : "isDeclaredConst", _node.stateMutability() <= StateMutability::View),
make_pair("parameterTypes", toJson(*_node.parameterTypeList())),
diff --git a/libsolidity/interface/ABI.cpp b/libsolidity/interface/ABI.cpp
index dd56ff6d..3df9d1f8 100644
--- a/libsolidity/interface/ABI.cpp
+++ b/libsolidity/interface/ABI.cpp
@@ -38,7 +38,7 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
// 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["stateMutability"] = stateMutabilityToString(it.second->stateMutability());
method["inputs"] = formatTypeList(
externalFunctionType->parameterNames(),
externalFunctionType->parameterTypes(),
@@ -58,7 +58,7 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
auto externalFunction = FunctionType(*_contractDef.constructor(), false).interfaceFunctionType();
solAssert(!!externalFunction, "");
method["payable"] = externalFunction->isPayable();
- method["statemutability"] = stateMutabilityToString(externalFunction->stateMutability());
+ method["stateMutability"] = stateMutabilityToString(externalFunction->stateMutability());
method["inputs"] = formatTypeList(
externalFunction->parameterNames(),
externalFunction->parameterTypes(),
@@ -73,7 +73,7 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
Json::Value method;
method["type"] = "fallback";
method["payable"] = externalFunctionType->isPayable();
- method["statemutability"] = stateMutabilityToString(externalFunctionType->stateMutability());
+ method["stateMutability"] = stateMutabilityToString(externalFunctionType->stateMutability());
abi.append(method);
}
for (auto const& it: _contractDef.interfaceEvents())
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp
index dd51d926..0512ba1f 100644
--- a/test/libsolidity/SolidityABIJSON.cpp
+++ b/test/libsolidity/SolidityABIJSON.cpp
@@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(basic_test)
"name": "f",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -120,7 +120,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods)
"name": "f",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods)
"name": "g",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -172,7 +172,7 @@ BOOST_AUTO_TEST_CASE(multiple_params)
"name": "f",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -211,7 +211,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order)
"name": "c",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -230,7 +230,7 @@ BOOST_AUTO_TEST_CASE(multiple_methods_order)
"name": "f",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -264,7 +264,7 @@ BOOST_AUTO_TEST_CASE(view_function)
"name": "foo",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -287,7 +287,7 @@ BOOST_AUTO_TEST_CASE(view_function)
"name": "boo",
"constant": true,
"payable" : false,
- "statemutability": "view",
+ "stateMutability": "view",
"type": "function",
"inputs": [{
"name": "a",
@@ -320,7 +320,7 @@ BOOST_AUTO_TEST_CASE(constant_function)
"name": "foo",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -343,7 +343,7 @@ BOOST_AUTO_TEST_CASE(constant_function)
"name": "boo",
"constant": true,
"payable" : false,
- "statemutability": "view",
+ "stateMutability": "view",
"type": "function",
"inputs": [{
"name": "a",
@@ -375,7 +375,7 @@ BOOST_AUTO_TEST_CASE(pure_function)
"name": "foo",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -398,7 +398,7 @@ BOOST_AUTO_TEST_CASE(pure_function)
"name": "boo",
"constant": true,
"payable" : false,
- "statemutability": "pure",
+ "stateMutability": "pure",
"type": "function",
"inputs": [{
"name": "a",
@@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(events)
"name": "f",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -512,7 +512,7 @@ BOOST_AUTO_TEST_CASE(inherited)
"name": "baseFunction",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs":
[{
@@ -529,7 +529,7 @@ BOOST_AUTO_TEST_CASE(inherited)
"name": "derivedFunction",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs":
[{
@@ -585,7 +585,7 @@ BOOST_AUTO_TEST_CASE(empty_name_input_parameter_with_named_one)
"name": "f",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -628,7 +628,7 @@ BOOST_AUTO_TEST_CASE(empty_name_return_parameter)
"name": "f",
"constant": false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "function",
"inputs": [
{
@@ -672,7 +672,7 @@ BOOST_AUTO_TEST_CASE(constructor_abi)
}
],
"payable": false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "constructor"
}
])";
@@ -704,7 +704,7 @@ BOOST_AUTO_TEST_CASE(payable_constructor_abi)
}
],
"payable": true,
- "statemutability": "payable",
+ "stateMutability": "payable",
"type": "constructor"
}
])";
@@ -730,7 +730,7 @@ BOOST_AUTO_TEST_CASE(return_param_in_abi)
{
"constant" : false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"inputs" : [],
"name" : "ret",
"outputs" : [
@@ -749,7 +749,7 @@ BOOST_AUTO_TEST_CASE(return_param_in_abi)
}
],
"payable": false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type": "constructor"
}
]
@@ -771,7 +771,7 @@ BOOST_AUTO_TEST_CASE(strings_and_arrays)
{
"constant" : false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"name": "f",
"inputs": [
{ "name": "a", "type": "string" },
@@ -800,7 +800,7 @@ BOOST_AUTO_TEST_CASE(library_function)
{
"constant" : false,
"payable" : false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"name": "f",
"inputs": [
{ "name": "b", "type": "test.StructType storage" },
@@ -830,7 +830,7 @@ BOOST_AUTO_TEST_CASE(include_fallback_function)
[
{
"payable": false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"type" : "fallback"
}
]
@@ -852,7 +852,7 @@ BOOST_AUTO_TEST_CASE(payable_function)
{
"constant" : false,
"payable": false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"inputs": [],
"name": "f",
"outputs": [],
@@ -861,7 +861,7 @@ BOOST_AUTO_TEST_CASE(payable_function)
{
"constant" : false,
"payable": true,
- "statemutability": "payable",
+ "stateMutability": "payable",
"inputs": [],
"name": "g",
"outputs": [],
@@ -884,7 +884,7 @@ BOOST_AUTO_TEST_CASE(payable_fallback_function)
[
{
"payable": true,
- "statemutability": "payable",
+ "stateMutability": "payable",
"type" : "fallback"
}
]
@@ -905,7 +905,7 @@ BOOST_AUTO_TEST_CASE(function_type)
{
"constant" : false,
"payable": false,
- "statemutability": "nonpayable",
+ "stateMutability": "nonpayable",
"inputs": [{
"name": "x",
"type": "function"