From a30be56c2766eda6cbf0b16a7182501c442cbf45 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 2 Jul 2019 16:04:52 +0200 Subject: [PATCH] Additional type info for ABI. --- Changelog.md | 1 + libsolidity/interface/ABI.cpp | 80 +++++++++++-------- libsolidity/interface/ABI.h | 18 ++++- test/libsolidity/ABIJson/basic_test.sol | 2 + test/libsolidity/ABIJson/constructor_abi.sol | 3 + ...ty_name_input_parameter_with_named_one.sol | 4 + .../ABIJson/empty_name_return_parameters.sol | 2 + test/libsolidity/ABIJson/event_structs.sol | 7 ++ test/libsolidity/ABIJson/events.sol | 5 ++ test/libsolidity/ABIJson/function_type.sol | 1 + .../ABIJson/function_type_extended.sol | 23 ++++++ test/libsolidity/ABIJson/inherited.sol | 9 +++ test/libsolidity/ABIJson/library_function.sol | 3 + test/libsolidity/ABIJson/multiple_methods.sol | 4 + .../ABIJson/multiple_methods_order.sol | 4 + test/libsolidity/ABIJson/multiple_params.sol | 3 + .../ABIJson/payable_constructor_abi.sol | 3 + test/libsolidity/ABIJson/pure_function.sol | 5 ++ .../ABIJson/return_param_in_abi.sol | 2 + test/libsolidity/ABIJson/return_structs.sol | 5 ++ .../ABIJson/return_structs_with_contracts.sol | 4 + .../ABIJson/structs_and_arrays.sol | 3 + .../ABIJson/structs_in_libraries.sol | 5 ++ test/libsolidity/ABIJson/view_function.sol | 5 ++ 24 files changed, 165 insertions(+), 36 deletions(-) create mode 100644 test/libsolidity/ABIJson/function_type_extended.sol diff --git a/Changelog.md b/Changelog.md index 50f72d19f..65ad1aab9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ Language Features: Compiler Features: + * ABI: Additional internal type info in the field ``internalType``. * eWasm: Highly experimental eWasm output using ``--ewasm`` in the commandline interface or output selection of ``ewasm.wast`` in standard-json. * Metadata: Update the swarm hash, changes ``bzzr0`` to ``bzzr1`` and urls to use ``bzz-raw://``. * Standard JSON Interface: Compile only selected sources and contracts. diff --git a/libsolidity/interface/ABI.cpp b/libsolidity/interface/ABI.cpp index e97bd5b65..6d450141d 100644 --- a/libsolidity/interface/ABI.cpp +++ b/libsolidity/interface/ABI.cpp @@ -44,14 +44,13 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef) for (auto it: _contractDef.interfaceFunctions()) { - if ( - _contractDef.isLibrary() && - (it.second->stateMutability() > StateMutability::View || - anyDataStoredInStorage(it.second->parameterTypes() + it.second->returnParameterTypes())) - ) + if (_contractDef.isLibrary() && ( + it.second->stateMutability() > StateMutability::View || + anyDataStoredInStorage(it.second->parameterTypes() + it.second->returnParameterTypes()) + )) continue; - auto externalFunctionType = it.second->interfaceFunctionType(); + FunctionType const* externalFunctionType = it.second->interfaceFunctionType(); solAssert(!!externalFunctionType, ""); Json::Value method; method["type"] = "function"; @@ -63,18 +62,21 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef) method["inputs"] = formatTypeList( externalFunctionType->parameterNames(), externalFunctionType->parameterTypes(), + it.second->parameterTypes(), _contractDef.isLibrary() ); method["outputs"] = formatTypeList( externalFunctionType->returnParameterNames(), externalFunctionType->returnParameterTypes(), + it.second->returnParameterTypes(), _contractDef.isLibrary() ); - abi.append(method); + abi.append(std::move(method)); } if (_contractDef.constructor()) { - auto externalFunctionType = FunctionType(*_contractDef.constructor(), false).interfaceFunctionType(); + FunctionType constrType(*_contractDef.constructor(), false); + FunctionType const* externalFunctionType = constrType.interfaceFunctionType(); solAssert(!!externalFunctionType, ""); Json::Value method; method["type"] = "constructor"; @@ -83,19 +85,20 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef) method["inputs"] = formatTypeList( externalFunctionType->parameterNames(), externalFunctionType->parameterTypes(), + constrType.parameterTypes(), _contractDef.isLibrary() ); - abi.append(method); + abi.append(std::move(method)); } if (_contractDef.fallbackFunction()) { - auto externalFunctionType = FunctionType(*_contractDef.fallbackFunction(), false).interfaceFunctionType(); + FunctionType const* externalFunctionType = FunctionType(*_contractDef.fallbackFunction(), false).interfaceFunctionType(); solAssert(!!externalFunctionType, ""); Json::Value method; method["type"] = "fallback"; method["payable"] = externalFunctionType->isPayable(); method["stateMutability"] = stateMutabilityToString(externalFunctionType->stateMutability()); - abi.append(method); + abi.append(std::move(method)); } for (auto const& it: _contractDef.interfaceEvents()) { @@ -106,15 +109,15 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef) Json::Value params(Json::arrayValue); for (auto const& p: it->parameters()) { - auto type = p->annotation().type->interfaceType(false); - solAssert(type.get(), ""); + Type const* type = p->annotation().type->interfaceType(false); + solAssert(type, ""); Json::Value input; - auto param = formatType(p->name(), *type.get(), false); + auto param = formatType(p->name(), *type, *p->annotation().type, false); param["indexed"] = p->isIndexed(); - params.append(param); + params.append(std::move(param)); } - event["inputs"] = params; - abi.append(event); + event["inputs"] = std::move(params); + abi.append(std::move(event)); } return abi; @@ -122,31 +125,39 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef) Json::Value ABI::formatTypeList( vector const& _names, - vector const& _types, + vector const& _encodingTypes, + vector const& _solidityTypes, bool _forLibrary ) { Json::Value params(Json::arrayValue); - solAssert(_names.size() == _types.size(), "Names and types vector size does not match"); + solAssert(_names.size() == _encodingTypes.size(), "Names and types vector size does not match"); + solAssert(_names.size() == _solidityTypes.size(), ""); for (unsigned i = 0; i < _names.size(); ++i) { - solAssert(_types[i], ""); - params.append(formatType(_names[i], *_types[i], _forLibrary)); + solAssert(_encodingTypes[i], ""); + params.append(formatType(_names[i], *_encodingTypes[i], *_solidityTypes[i], _forLibrary)); } return params; } -Json::Value ABI::formatType(string const& _name, Type const& _type, bool _forLibrary) +Json::Value ABI::formatType( + string const& _name, + Type const& _encodingType, + Type const& _solidityType, + bool _forLibrary +) { Json::Value ret; ret["name"] = _name; - string suffix = (_forLibrary && _type.dataStoredIn(DataLocation::Storage)) ? " storage" : ""; - if (_type.isValueType() || (_forLibrary && _type.dataStoredIn(DataLocation::Storage))) - ret["type"] = _type.canonicalName() + suffix; - else if (ArrayType const* arrayType = dynamic_cast(&_type)) + ret["internalType"] = _solidityType.toString(true); + string suffix = (_forLibrary && _encodingType.dataStoredIn(DataLocation::Storage)) ? " storage" : ""; + if (_encodingType.isValueType() || (_forLibrary && _encodingType.dataStoredIn(DataLocation::Storage))) + ret["type"] = _encodingType.canonicalName() + suffix; + else if (ArrayType const* arrayType = dynamic_cast(&_encodingType)) { if (arrayType->isByteArray()) - ret["type"] = _type.canonicalName() + suffix; + ret["type"] = _encodingType.canonicalName() + suffix; else { string suffix; @@ -155,7 +166,12 @@ Json::Value ABI::formatType(string const& _name, Type const& _type, bool _forLib else suffix = string("[") + arrayType->length().str() + "]"; solAssert(arrayType->baseType(), ""); - Json::Value subtype = formatType("", *arrayType->baseType(), _forLibrary); + Json::Value subtype = formatType( + "", + *arrayType->baseType(), + *dynamic_cast(_solidityType).baseType(), + _forLibrary + ); if (subtype.isMember("components")) { ret["type"] = subtype["type"].asString() + suffix; @@ -165,16 +181,16 @@ Json::Value ABI::formatType(string const& _name, Type const& _type, bool _forLib ret["type"] = subtype["type"].asString() + suffix; } } - else if (StructType const* structType = dynamic_cast(&_type)) + else if (StructType const* structType = dynamic_cast(&_encodingType)) { ret["type"] = "tuple"; ret["components"] = Json::arrayValue; for (auto const& member: structType->members(nullptr)) { solAssert(member.type, ""); - auto t = member.type->interfaceType(_forLibrary); - solAssert(t.get(), ""); - ret["components"].append(formatType(member.name, *t.get(), _forLibrary)); + Type const* t = member.type->interfaceType(_forLibrary); + solAssert(t, ""); + ret["components"].append(formatType(member.name, *t, *member.type, _forLibrary)); } } else diff --git a/libsolidity/interface/ABI.h b/libsolidity/interface/ABI.h index 6787ddfdd..f52081503 100644 --- a/libsolidity/interface/ABI.h +++ b/libsolidity/interface/ABI.h @@ -45,15 +45,25 @@ private: /// @returns a json value suitable for a list of types in function input or output /// parameters or other places. If @a _forLibrary is true, complex types are referenced /// by name, otherwise they are anonymously expanded. + /// @a _solidityTypes is the list of original Solidity types where @a _encodingTypes is the list of + /// ABI types used for the actual encoding. static Json::Value formatTypeList( std::vector const& _names, - std::vector const& _types, + std::vector const& _encodingTypes, + std::vector const& _solidityTypes, bool _forLibrary ); - /// @returns a Json object with "name", "type" and potentially "components" keys, according - /// to the ABI specification. + /// @returns a Json object with "name", "type", "internalType" and potentially + /// "components" keys, according to the ABI specification. /// If it is possible to express the type as a single string, it is allowed to return a single string. - static Json::Value formatType(std::string const& _name, Type const& _type, bool _forLibrary); + /// @a _solidityType is the original Solidity type and @a _encodingTypes is the + /// ABI type used for the actual encoding. + static Json::Value formatType( + std::string const& _name, + Type const& _encodingType, + Type const& _solidityType, + bool _forLibrary + ); }; } diff --git a/test/libsolidity/ABIJson/basic_test.sol b/test/libsolidity/ABIJson/basic_test.sol index 8753ef45a..ed0b5e715 100644 --- a/test/libsolidity/ABIJson/basic_test.sol +++ b/test/libsolidity/ABIJson/basic_test.sol @@ -9,6 +9,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // } @@ -17,6 +18,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "d", // "type": "uint256" // } diff --git a/test/libsolidity/ABIJson/constructor_abi.sol b/test/libsolidity/ABIJson/constructor_abi.sol index a311cfcf9..31cc06486 100644 --- a/test/libsolidity/ABIJson/constructor_abi.sol +++ b/test/libsolidity/ABIJson/constructor_abi.sol @@ -8,14 +8,17 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "param1", // "type": "uint256" // }, // { +// "internalType": "contract test", // "name": "param2", // "type": "address" // }, // { +// "internalType": "bool", // "name": "param3", // "type": "bool" // } diff --git a/test/libsolidity/ABIJson/empty_name_input_parameter_with_named_one.sol b/test/libsolidity/ABIJson/empty_name_input_parameter_with_named_one.sol index 530d04a41..6f2baccf7 100644 --- a/test/libsolidity/ABIJson/empty_name_input_parameter_with_named_one.sol +++ b/test/libsolidity/ABIJson/empty_name_input_parameter_with_named_one.sol @@ -13,10 +13,12 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "", // "type": "uint256" // }, // { +// "internalType": "uint256", // "name": "k", // "type": "uint256" // } @@ -25,10 +27,12 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "ret_k", // "type": "uint256" // }, // { +// "internalType": "uint256", // "name": "ret_g", // "type": "uint256" // } diff --git a/test/libsolidity/ABIJson/empty_name_return_parameters.sol b/test/libsolidity/ABIJson/empty_name_return_parameters.sol index 132c9a629..9b287ba51 100644 --- a/test/libsolidity/ABIJson/empty_name_return_parameters.sol +++ b/test/libsolidity/ABIJson/empty_name_return_parameters.sol @@ -11,6 +11,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "k", // "type": "uint256" // } @@ -19,6 +20,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "", // "type": "uint256" // } diff --git a/test/libsolidity/ABIJson/event_structs.sol b/test/libsolidity/ABIJson/event_structs.sol index 134b99fce..af4d3b0bd 100644 --- a/test/libsolidity/ABIJson/event_structs.sol +++ b/test/libsolidity/ABIJson/event_structs.sol @@ -15,11 +15,13 @@ contract C { // "components": // [ // { +// "internalType": "uint256[2]", // "name": "x", // "type": "uint256[2]" // } // ], // "indexed": false, +// "internalType": "struct C.T", // "name": "t", // "type": "tuple" // }, @@ -27,6 +29,7 @@ contract C { // "components": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // }, @@ -34,19 +37,23 @@ contract C { // "components": // [ // { +// "internalType": "uint256[2]", // "name": "x", // "type": "uint256[2]" // } // ], +// "internalType": "struct C.T[]", // "name": "sub", // "type": "tuple[]" // }, // { +// "internalType": "bytes", // "name": "b", // "type": "bytes" // } // ], // "indexed": false, +// "internalType": "struct C.S", // "name": "s", // "type": "tuple" // } diff --git a/test/libsolidity/ABIJson/events.sol b/test/libsolidity/ABIJson/events.sol index 822f52f1e..287a0298f 100644 --- a/test/libsolidity/ABIJson/events.sol +++ b/test/libsolidity/ABIJson/events.sol @@ -13,6 +13,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // } @@ -21,6 +22,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "d", // "type": "uint256" // } @@ -35,11 +37,13 @@ contract test { // [ // { // "indexed": false, +// "internalType": "uint256", // "name": "b", // "type": "uint256" // }, // { // "indexed": true, +// "internalType": "address", // "name": "c", // "type": "address" // } @@ -59,6 +63,7 @@ contract test { // [ // { // "indexed": false, +// "internalType": "uint256", // "name": "a", // "type": "uint256" // } diff --git a/test/libsolidity/ABIJson/function_type.sol b/test/libsolidity/ABIJson/function_type.sol index 1a18782b6..182469af0 100644 --- a/test/libsolidity/ABIJson/function_type.sol +++ b/test/libsolidity/ABIJson/function_type.sol @@ -9,6 +9,7 @@ contract test { // "inputs": // [ // { +// "internalType": "function (uint256) external returns (uint256)", // "name": "x", // "type": "function" // } diff --git a/test/libsolidity/ABIJson/function_type_extended.sol b/test/libsolidity/ABIJson/function_type_extended.sol new file mode 100644 index 000000000..959b35c8a --- /dev/null +++ b/test/libsolidity/ABIJson/function_type_extended.sol @@ -0,0 +1,23 @@ +contract test { + function g(function(test) external returns (test[] memory) x) public {} +} +// ---- +// :test +// [ +// { +// "constant": false, +// "inputs": +// [ +// { +// "internalType": "function (contract test) external returns (contract test[])", +// "name": "x", +// "type": "function" +// } +// ], +// "name": "g", +// "outputs": [], +// "payable": false, +// "stateMutability": "nonpayable", +// "type": "function" +// } +// ] diff --git a/test/libsolidity/ABIJson/inherited.sol b/test/libsolidity/ABIJson/inherited.sol index 800475610..5d61f4aef 100644 --- a/test/libsolidity/ABIJson/inherited.sol +++ b/test/libsolidity/ABIJson/inherited.sol @@ -14,6 +14,7 @@ contract Derived is Base { // "inputs": // [ // { +// "internalType": "uint256", // "name": "p", // "type": "uint256" // } @@ -22,6 +23,7 @@ contract Derived is Base { // "outputs": // [ // { +// "internalType": "uint256", // "name": "i", // "type": "uint256" // } @@ -36,6 +38,7 @@ contract Derived is Base { // [ // { // "indexed": true, +// "internalType": "bytes32", // "name": "evtArgBase", // "type": "bytes32" // } @@ -53,6 +56,7 @@ contract Derived is Base { // "inputs": // [ // { +// "internalType": "uint256", // "name": "p", // "type": "uint256" // } @@ -61,6 +65,7 @@ contract Derived is Base { // "outputs": // [ // { +// "internalType": "uint256", // "name": "i", // "type": "uint256" // } @@ -74,6 +79,7 @@ contract Derived is Base { // "inputs": // [ // { +// "internalType": "bytes32", // "name": "p", // "type": "bytes32" // } @@ -82,6 +88,7 @@ contract Derived is Base { // "outputs": // [ // { +// "internalType": "bytes32", // "name": "i", // "type": "bytes32" // } @@ -96,6 +103,7 @@ contract Derived is Base { // [ // { // "indexed": true, +// "internalType": "uint256", // "name": "evtArgDerived", // "type": "uint256" // } @@ -109,6 +117,7 @@ contract Derived is Base { // [ // { // "indexed": true, +// "internalType": "bytes32", // "name": "evtArgBase", // "type": "bytes32" // } diff --git a/test/libsolidity/ABIJson/library_function.sol b/test/libsolidity/ABIJson/library_function.sol index 83df014e9..2aad8e164 100644 --- a/test/libsolidity/ABIJson/library_function.sol +++ b/test/libsolidity/ABIJson/library_function.sol @@ -11,10 +11,12 @@ library test { // "inputs": // [ // { +// "internalType": "uint256[]", // "name": "c", // "type": "uint256[]" // }, // { +// "internalType": "library test", // "name": "d", // "type": "test" // } @@ -23,6 +25,7 @@ library test { // "outputs": // [ // { +// "internalType": "uint256[]", // "name": "e", // "type": "uint256[]" // } diff --git a/test/libsolidity/ABIJson/multiple_methods.sol b/test/libsolidity/ABIJson/multiple_methods.sol index da664c44c..f3c5dbcfb 100644 --- a/test/libsolidity/ABIJson/multiple_methods.sol +++ b/test/libsolidity/ABIJson/multiple_methods.sol @@ -10,6 +10,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // } @@ -18,6 +19,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "d", // "type": "uint256" // } @@ -31,6 +33,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "b", // "type": "uint256" // } @@ -39,6 +42,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "e", // "type": "uint256" // } diff --git a/test/libsolidity/ABIJson/multiple_methods_order.sol b/test/libsolidity/ABIJson/multiple_methods_order.sol index b4ec583b7..18ba5e6d4 100644 --- a/test/libsolidity/ABIJson/multiple_methods_order.sol +++ b/test/libsolidity/ABIJson/multiple_methods_order.sol @@ -11,6 +11,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "b", // "type": "uint256" // } @@ -19,6 +20,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "e", // "type": "uint256" // } @@ -32,6 +34,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // } @@ -40,6 +43,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "d", // "type": "uint256" // } diff --git a/test/libsolidity/ABIJson/multiple_params.sol b/test/libsolidity/ABIJson/multiple_params.sol index cd567fba5..6a53830a3 100644 --- a/test/libsolidity/ABIJson/multiple_params.sol +++ b/test/libsolidity/ABIJson/multiple_params.sol @@ -9,10 +9,12 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // }, // { +// "internalType": "uint256", // "name": "b", // "type": "uint256" // } @@ -21,6 +23,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "d", // "type": "uint256" // } diff --git a/test/libsolidity/ABIJson/payable_constructor_abi.sol b/test/libsolidity/ABIJson/payable_constructor_abi.sol index 2b127bc82..efffc28d2 100644 --- a/test/libsolidity/ABIJson/payable_constructor_abi.sol +++ b/test/libsolidity/ABIJson/payable_constructor_abi.sol @@ -8,14 +8,17 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "param1", // "type": "uint256" // }, // { +// "internalType": "contract test", // "name": "param2", // "type": "address" // }, // { +// "internalType": "bool", // "name": "param3", // "type": "bool" // } diff --git a/test/libsolidity/ABIJson/pure_function.sol b/test/libsolidity/ABIJson/pure_function.sol index 21db31727..f1279ab3d 100644 --- a/test/libsolidity/ABIJson/pure_function.sol +++ b/test/libsolidity/ABIJson/pure_function.sol @@ -10,10 +10,12 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // }, // { +// "internalType": "uint256", // "name": "b", // "type": "uint256" // } @@ -22,6 +24,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "d", // "type": "uint256" // } @@ -35,6 +38,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint32", // "name": "a", // "type": "uint32" // } @@ -43,6 +47,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "b", // "type": "uint256" // } diff --git a/test/libsolidity/ABIJson/return_param_in_abi.sol b/test/libsolidity/ABIJson/return_param_in_abi.sol index 3c617dfc3..835a88a7b 100644 --- a/test/libsolidity/ABIJson/return_param_in_abi.sol +++ b/test/libsolidity/ABIJson/return_param_in_abi.sol @@ -17,6 +17,7 @@ contract test { // "outputs": // [ // { +// "internalType": "enum test.ActionChoices", // "name": "", // "type": "uint8" // } @@ -29,6 +30,7 @@ contract test { // "inputs": // [ // { +// "internalType": "enum test.ActionChoices", // "name": "param", // "type": "uint8" // } diff --git a/test/libsolidity/ABIJson/return_structs.sol b/test/libsolidity/ABIJson/return_structs.sol index bb9a0c1d0..07899389e 100644 --- a/test/libsolidity/ABIJson/return_structs.sol +++ b/test/libsolidity/ABIJson/return_structs.sol @@ -15,6 +15,7 @@ contract C { // "outputs": // [ // { +// "internalType": "uint256", // "name": "x", // "type": "uint256" // }, @@ -22,6 +23,7 @@ contract C { // "components": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // }, @@ -29,14 +31,17 @@ contract C { // "components": // [ // { +// "internalType": "uint256[2]", // "name": "x", // "type": "uint256[2]" // } // ], +// "internalType": "struct C.T[]", // "name": "sub", // "type": "tuple[]" // } // ], +// "internalType": "struct C.S", // "name": "s", // "type": "tuple" // } diff --git a/test/libsolidity/ABIJson/return_structs_with_contracts.sol b/test/libsolidity/ABIJson/return_structs_with_contracts.sol index ce957f1c3..46167843a 100644 --- a/test/libsolidity/ABIJson/return_structs_with_contracts.sol +++ b/test/libsolidity/ABIJson/return_structs_with_contracts.sol @@ -17,18 +17,22 @@ contract C { // "components": // [ // { +// "internalType": "contract C[]", // "name": "x", // "type": "address[]" // }, // { +// "internalType": "contract C", // "name": "y", // "type": "address" // } // ], +// "internalType": "struct C.S", // "name": "s", // "type": "tuple" // }, // { +// "internalType": "contract C", // "name": "c", // "type": "address" // } diff --git a/test/libsolidity/ABIJson/structs_and_arrays.sol b/test/libsolidity/ABIJson/structs_and_arrays.sol index 4474b98f7..b2b91f7d8 100644 --- a/test/libsolidity/ABIJson/structs_and_arrays.sol +++ b/test/libsolidity/ABIJson/structs_and_arrays.sol @@ -10,14 +10,17 @@ contract test { // "inputs": // [ // { +// "internalType": "string", // "name": "a", // "type": "string" // }, // { +// "internalType": "bytes", // "name": "b", // "type": "bytes" // }, // { +// "internalType": "uint256[]", // "name": "c", // "type": "uint256[]" // } diff --git a/test/libsolidity/ABIJson/structs_in_libraries.sol b/test/libsolidity/ABIJson/structs_in_libraries.sol index 29a709f81..c5d08430d 100644 --- a/test/libsolidity/ABIJson/structs_in_libraries.sol +++ b/test/libsolidity/ABIJson/structs_in_libraries.sol @@ -16,6 +16,7 @@ library L { // "components": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // }, @@ -23,18 +24,22 @@ library L { // "components": // [ // { +// "internalType": "uint256[2]", // "name": "x", // "type": "uint256[2]" // } // ], +// "internalType": "struct L.T[]", // "name": "sub", // "type": "tuple[]" // }, // { +// "internalType": "bytes", // "name": "b", // "type": "bytes" // } // ], +// "internalType": "struct L.S", // "name": "s", // "type": "tuple" // } diff --git a/test/libsolidity/ABIJson/view_function.sol b/test/libsolidity/ABIJson/view_function.sol index 6f731a09c..6112574d5 100644 --- a/test/libsolidity/ABIJson/view_function.sol +++ b/test/libsolidity/ABIJson/view_function.sol @@ -10,10 +10,12 @@ contract test { // "inputs": // [ // { +// "internalType": "uint256", // "name": "a", // "type": "uint256" // }, // { +// "internalType": "uint256", // "name": "b", // "type": "uint256" // } @@ -22,6 +24,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "d", // "type": "uint256" // } @@ -35,6 +38,7 @@ contract test { // "inputs": // [ // { +// "internalType": "uint32", // "name": "a", // "type": "uint32" // } @@ -43,6 +47,7 @@ contract test { // "outputs": // [ // { +// "internalType": "uint256", // "name": "b", // "type": "uint256" // }