Additional type info for ABI.

This commit is contained in:
chriseth 2019-07-02 16:04:52 +02:00
parent 15cba9163e
commit a30be56c27
24 changed files with 165 additions and 36 deletions

View File

@ -8,6 +8,7 @@ Language Features:
Compiler 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. * 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://``. * Metadata: Update the swarm hash, changes ``bzzr0`` to ``bzzr1`` and urls to use ``bzz-raw://``.
* Standard JSON Interface: Compile only selected sources and contracts. * Standard JSON Interface: Compile only selected sources and contracts.

View File

@ -44,14 +44,13 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
for (auto it: _contractDef.interfaceFunctions()) for (auto it: _contractDef.interfaceFunctions())
{ {
if ( if (_contractDef.isLibrary() && (
_contractDef.isLibrary() && it.second->stateMutability() > StateMutability::View ||
(it.second->stateMutability() > StateMutability::View || anyDataStoredInStorage(it.second->parameterTypes() + it.second->returnParameterTypes())
anyDataStoredInStorage(it.second->parameterTypes() + it.second->returnParameterTypes())) ))
)
continue; continue;
auto externalFunctionType = it.second->interfaceFunctionType(); FunctionType const* externalFunctionType = it.second->interfaceFunctionType();
solAssert(!!externalFunctionType, ""); solAssert(!!externalFunctionType, "");
Json::Value method; Json::Value method;
method["type"] = "function"; method["type"] = "function";
@ -63,18 +62,21 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
method["inputs"] = formatTypeList( method["inputs"] = formatTypeList(
externalFunctionType->parameterNames(), externalFunctionType->parameterNames(),
externalFunctionType->parameterTypes(), externalFunctionType->parameterTypes(),
it.second->parameterTypes(),
_contractDef.isLibrary() _contractDef.isLibrary()
); );
method["outputs"] = formatTypeList( method["outputs"] = formatTypeList(
externalFunctionType->returnParameterNames(), externalFunctionType->returnParameterNames(),
externalFunctionType->returnParameterTypes(), externalFunctionType->returnParameterTypes(),
it.second->returnParameterTypes(),
_contractDef.isLibrary() _contractDef.isLibrary()
); );
abi.append(method); abi.append(std::move(method));
} }
if (_contractDef.constructor()) if (_contractDef.constructor())
{ {
auto externalFunctionType = FunctionType(*_contractDef.constructor(), false).interfaceFunctionType(); FunctionType constrType(*_contractDef.constructor(), false);
FunctionType const* externalFunctionType = constrType.interfaceFunctionType();
solAssert(!!externalFunctionType, ""); solAssert(!!externalFunctionType, "");
Json::Value method; Json::Value method;
method["type"] = "constructor"; method["type"] = "constructor";
@ -83,19 +85,20 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
method["inputs"] = formatTypeList( method["inputs"] = formatTypeList(
externalFunctionType->parameterNames(), externalFunctionType->parameterNames(),
externalFunctionType->parameterTypes(), externalFunctionType->parameterTypes(),
constrType.parameterTypes(),
_contractDef.isLibrary() _contractDef.isLibrary()
); );
abi.append(method); abi.append(std::move(method));
} }
if (_contractDef.fallbackFunction()) if (_contractDef.fallbackFunction())
{ {
auto externalFunctionType = FunctionType(*_contractDef.fallbackFunction(), false).interfaceFunctionType(); FunctionType const* externalFunctionType = FunctionType(*_contractDef.fallbackFunction(), false).interfaceFunctionType();
solAssert(!!externalFunctionType, ""); solAssert(!!externalFunctionType, "");
Json::Value method; Json::Value method;
method["type"] = "fallback"; method["type"] = "fallback";
method["payable"] = externalFunctionType->isPayable(); method["payable"] = externalFunctionType->isPayable();
method["stateMutability"] = stateMutabilityToString(externalFunctionType->stateMutability()); method["stateMutability"] = stateMutabilityToString(externalFunctionType->stateMutability());
abi.append(method); abi.append(std::move(method));
} }
for (auto const& it: _contractDef.interfaceEvents()) for (auto const& it: _contractDef.interfaceEvents())
{ {
@ -106,15 +109,15 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
Json::Value params(Json::arrayValue); Json::Value params(Json::arrayValue);
for (auto const& p: it->parameters()) for (auto const& p: it->parameters())
{ {
auto type = p->annotation().type->interfaceType(false); Type const* type = p->annotation().type->interfaceType(false);
solAssert(type.get(), ""); solAssert(type, "");
Json::Value input; 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(); param["indexed"] = p->isIndexed();
params.append(param); params.append(std::move(param));
} }
event["inputs"] = params; event["inputs"] = std::move(params);
abi.append(event); abi.append(std::move(event));
} }
return abi; return abi;
@ -122,31 +125,39 @@ Json::Value ABI::generate(ContractDefinition const& _contractDef)
Json::Value ABI::formatTypeList( Json::Value ABI::formatTypeList(
vector<string> const& _names, vector<string> const& _names,
vector<TypePointer> const& _types, vector<TypePointer> const& _encodingTypes,
vector<TypePointer> const& _solidityTypes,
bool _forLibrary bool _forLibrary
) )
{ {
Json::Value params(Json::arrayValue); 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) for (unsigned i = 0; i < _names.size(); ++i)
{ {
solAssert(_types[i], ""); solAssert(_encodingTypes[i], "");
params.append(formatType(_names[i], *_types[i], _forLibrary)); params.append(formatType(_names[i], *_encodingTypes[i], *_solidityTypes[i], _forLibrary));
} }
return params; 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; Json::Value ret;
ret["name"] = _name; ret["name"] = _name;
string suffix = (_forLibrary && _type.dataStoredIn(DataLocation::Storage)) ? " storage" : ""; ret["internalType"] = _solidityType.toString(true);
if (_type.isValueType() || (_forLibrary && _type.dataStoredIn(DataLocation::Storage))) string suffix = (_forLibrary && _encodingType.dataStoredIn(DataLocation::Storage)) ? " storage" : "";
ret["type"] = _type.canonicalName() + suffix; if (_encodingType.isValueType() || (_forLibrary && _encodingType.dataStoredIn(DataLocation::Storage)))
else if (ArrayType const* arrayType = dynamic_cast<ArrayType const*>(&_type)) ret["type"] = _encodingType.canonicalName() + suffix;
else if (ArrayType const* arrayType = dynamic_cast<ArrayType const*>(&_encodingType))
{ {
if (arrayType->isByteArray()) if (arrayType->isByteArray())
ret["type"] = _type.canonicalName() + suffix; ret["type"] = _encodingType.canonicalName() + suffix;
else else
{ {
string suffix; string suffix;
@ -155,7 +166,12 @@ Json::Value ABI::formatType(string const& _name, Type const& _type, bool _forLib
else else
suffix = string("[") + arrayType->length().str() + "]"; suffix = string("[") + arrayType->length().str() + "]";
solAssert(arrayType->baseType(), ""); solAssert(arrayType->baseType(), "");
Json::Value subtype = formatType("", *arrayType->baseType(), _forLibrary); Json::Value subtype = formatType(
"",
*arrayType->baseType(),
*dynamic_cast<ArrayType const&>(_solidityType).baseType(),
_forLibrary
);
if (subtype.isMember("components")) if (subtype.isMember("components"))
{ {
ret["type"] = subtype["type"].asString() + suffix; 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; ret["type"] = subtype["type"].asString() + suffix;
} }
} }
else if (StructType const* structType = dynamic_cast<StructType const*>(&_type)) else if (StructType const* structType = dynamic_cast<StructType const*>(&_encodingType))
{ {
ret["type"] = "tuple"; ret["type"] = "tuple";
ret["components"] = Json::arrayValue; ret["components"] = Json::arrayValue;
for (auto const& member: structType->members(nullptr)) for (auto const& member: structType->members(nullptr))
{ {
solAssert(member.type, ""); solAssert(member.type, "");
auto t = member.type->interfaceType(_forLibrary); Type const* t = member.type->interfaceType(_forLibrary);
solAssert(t.get(), ""); solAssert(t, "");
ret["components"].append(formatType(member.name, *t.get(), _forLibrary)); ret["components"].append(formatType(member.name, *t, *member.type, _forLibrary));
} }
} }
else else

View File

@ -45,15 +45,25 @@ private:
/// @returns a json value suitable for a list of types in function input or output /// @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 /// parameters or other places. If @a _forLibrary is true, complex types are referenced
/// by name, otherwise they are anonymously expanded. /// 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( static Json::Value formatTypeList(
std::vector<std::string> const& _names, std::vector<std::string> const& _names,
std::vector<TypePointer> const& _types, std::vector<TypePointer> const& _encodingTypes,
std::vector<TypePointer> const& _solidityTypes,
bool _forLibrary bool _forLibrary
); );
/// @returns a Json object with "name", "type" and potentially "components" keys, according /// @returns a Json object with "name", "type", "internalType" and potentially
/// to the ABI specification. /// "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. /// 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
);
}; };
} }

View File

@ -9,6 +9,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// } // }
@ -17,6 +18,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "d", // "name": "d",
// "type": "uint256" // "type": "uint256"
// } // }

View File

@ -8,14 +8,17 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "param1", // "name": "param1",
// "type": "uint256" // "type": "uint256"
// }, // },
// { // {
// "internalType": "contract test",
// "name": "param2", // "name": "param2",
// "type": "address" // "type": "address"
// }, // },
// { // {
// "internalType": "bool",
// "name": "param3", // "name": "param3",
// "type": "bool" // "type": "bool"
// } // }

View File

@ -13,10 +13,12 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "", // "name": "",
// "type": "uint256" // "type": "uint256"
// }, // },
// { // {
// "internalType": "uint256",
// "name": "k", // "name": "k",
// "type": "uint256" // "type": "uint256"
// } // }
@ -25,10 +27,12 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "ret_k", // "name": "ret_k",
// "type": "uint256" // "type": "uint256"
// }, // },
// { // {
// "internalType": "uint256",
// "name": "ret_g", // "name": "ret_g",
// "type": "uint256" // "type": "uint256"
// } // }

View File

@ -11,6 +11,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "k", // "name": "k",
// "type": "uint256" // "type": "uint256"
// } // }
@ -19,6 +20,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "", // "name": "",
// "type": "uint256" // "type": "uint256"
// } // }

View File

@ -15,11 +15,13 @@ contract C {
// "components": // "components":
// [ // [
// { // {
// "internalType": "uint256[2]",
// "name": "x", // "name": "x",
// "type": "uint256[2]" // "type": "uint256[2]"
// } // }
// ], // ],
// "indexed": false, // "indexed": false,
// "internalType": "struct C.T",
// "name": "t", // "name": "t",
// "type": "tuple" // "type": "tuple"
// }, // },
@ -27,6 +29,7 @@ contract C {
// "components": // "components":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// }, // },
@ -34,19 +37,23 @@ contract C {
// "components": // "components":
// [ // [
// { // {
// "internalType": "uint256[2]",
// "name": "x", // "name": "x",
// "type": "uint256[2]" // "type": "uint256[2]"
// } // }
// ], // ],
// "internalType": "struct C.T[]",
// "name": "sub", // "name": "sub",
// "type": "tuple[]" // "type": "tuple[]"
// }, // },
// { // {
// "internalType": "bytes",
// "name": "b", // "name": "b",
// "type": "bytes" // "type": "bytes"
// } // }
// ], // ],
// "indexed": false, // "indexed": false,
// "internalType": "struct C.S",
// "name": "s", // "name": "s",
// "type": "tuple" // "type": "tuple"
// } // }

View File

@ -13,6 +13,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// } // }
@ -21,6 +22,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "d", // "name": "d",
// "type": "uint256" // "type": "uint256"
// } // }
@ -35,11 +37,13 @@ contract test {
// [ // [
// { // {
// "indexed": false, // "indexed": false,
// "internalType": "uint256",
// "name": "b", // "name": "b",
// "type": "uint256" // "type": "uint256"
// }, // },
// { // {
// "indexed": true, // "indexed": true,
// "internalType": "address",
// "name": "c", // "name": "c",
// "type": "address" // "type": "address"
// } // }
@ -59,6 +63,7 @@ contract test {
// [ // [
// { // {
// "indexed": false, // "indexed": false,
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// } // }

View File

@ -9,6 +9,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "function (uint256) external returns (uint256)",
// "name": "x", // "name": "x",
// "type": "function" // "type": "function"
// } // }

View File

@ -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"
// }
// ]

View File

@ -14,6 +14,7 @@ contract Derived is Base {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "p", // "name": "p",
// "type": "uint256" // "type": "uint256"
// } // }
@ -22,6 +23,7 @@ contract Derived is Base {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "i", // "name": "i",
// "type": "uint256" // "type": "uint256"
// } // }
@ -36,6 +38,7 @@ contract Derived is Base {
// [ // [
// { // {
// "indexed": true, // "indexed": true,
// "internalType": "bytes32",
// "name": "evtArgBase", // "name": "evtArgBase",
// "type": "bytes32" // "type": "bytes32"
// } // }
@ -53,6 +56,7 @@ contract Derived is Base {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "p", // "name": "p",
// "type": "uint256" // "type": "uint256"
// } // }
@ -61,6 +65,7 @@ contract Derived is Base {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "i", // "name": "i",
// "type": "uint256" // "type": "uint256"
// } // }
@ -74,6 +79,7 @@ contract Derived is Base {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "bytes32",
// "name": "p", // "name": "p",
// "type": "bytes32" // "type": "bytes32"
// } // }
@ -82,6 +88,7 @@ contract Derived is Base {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "bytes32",
// "name": "i", // "name": "i",
// "type": "bytes32" // "type": "bytes32"
// } // }
@ -96,6 +103,7 @@ contract Derived is Base {
// [ // [
// { // {
// "indexed": true, // "indexed": true,
// "internalType": "uint256",
// "name": "evtArgDerived", // "name": "evtArgDerived",
// "type": "uint256" // "type": "uint256"
// } // }
@ -109,6 +117,7 @@ contract Derived is Base {
// [ // [
// { // {
// "indexed": true, // "indexed": true,
// "internalType": "bytes32",
// "name": "evtArgBase", // "name": "evtArgBase",
// "type": "bytes32" // "type": "bytes32"
// } // }

View File

@ -11,10 +11,12 @@ library test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256[]",
// "name": "c", // "name": "c",
// "type": "uint256[]" // "type": "uint256[]"
// }, // },
// { // {
// "internalType": "library test",
// "name": "d", // "name": "d",
// "type": "test" // "type": "test"
// } // }
@ -23,6 +25,7 @@ library test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256[]",
// "name": "e", // "name": "e",
// "type": "uint256[]" // "type": "uint256[]"
// } // }

View File

@ -10,6 +10,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// } // }
@ -18,6 +19,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "d", // "name": "d",
// "type": "uint256" // "type": "uint256"
// } // }
@ -31,6 +33,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "b", // "name": "b",
// "type": "uint256" // "type": "uint256"
// } // }
@ -39,6 +42,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "e", // "name": "e",
// "type": "uint256" // "type": "uint256"
// } // }

View File

@ -11,6 +11,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "b", // "name": "b",
// "type": "uint256" // "type": "uint256"
// } // }
@ -19,6 +20,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "e", // "name": "e",
// "type": "uint256" // "type": "uint256"
// } // }
@ -32,6 +34,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// } // }
@ -40,6 +43,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "d", // "name": "d",
// "type": "uint256" // "type": "uint256"
// } // }

View File

@ -9,10 +9,12 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// }, // },
// { // {
// "internalType": "uint256",
// "name": "b", // "name": "b",
// "type": "uint256" // "type": "uint256"
// } // }
@ -21,6 +23,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "d", // "name": "d",
// "type": "uint256" // "type": "uint256"
// } // }

View File

@ -8,14 +8,17 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "param1", // "name": "param1",
// "type": "uint256" // "type": "uint256"
// }, // },
// { // {
// "internalType": "contract test",
// "name": "param2", // "name": "param2",
// "type": "address" // "type": "address"
// }, // },
// { // {
// "internalType": "bool",
// "name": "param3", // "name": "param3",
// "type": "bool" // "type": "bool"
// } // }

View File

@ -10,10 +10,12 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// }, // },
// { // {
// "internalType": "uint256",
// "name": "b", // "name": "b",
// "type": "uint256" // "type": "uint256"
// } // }
@ -22,6 +24,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "d", // "name": "d",
// "type": "uint256" // "type": "uint256"
// } // }
@ -35,6 +38,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint32",
// "name": "a", // "name": "a",
// "type": "uint32" // "type": "uint32"
// } // }
@ -43,6 +47,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "b", // "name": "b",
// "type": "uint256" // "type": "uint256"
// } // }

View File

@ -17,6 +17,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "enum test.ActionChoices",
// "name": "", // "name": "",
// "type": "uint8" // "type": "uint8"
// } // }
@ -29,6 +30,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "enum test.ActionChoices",
// "name": "param", // "name": "param",
// "type": "uint8" // "type": "uint8"
// } // }

View File

@ -15,6 +15,7 @@ contract C {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "x", // "name": "x",
// "type": "uint256" // "type": "uint256"
// }, // },
@ -22,6 +23,7 @@ contract C {
// "components": // "components":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// }, // },
@ -29,14 +31,17 @@ contract C {
// "components": // "components":
// [ // [
// { // {
// "internalType": "uint256[2]",
// "name": "x", // "name": "x",
// "type": "uint256[2]" // "type": "uint256[2]"
// } // }
// ], // ],
// "internalType": "struct C.T[]",
// "name": "sub", // "name": "sub",
// "type": "tuple[]" // "type": "tuple[]"
// } // }
// ], // ],
// "internalType": "struct C.S",
// "name": "s", // "name": "s",
// "type": "tuple" // "type": "tuple"
// } // }

View File

@ -17,18 +17,22 @@ contract C {
// "components": // "components":
// [ // [
// { // {
// "internalType": "contract C[]",
// "name": "x", // "name": "x",
// "type": "address[]" // "type": "address[]"
// }, // },
// { // {
// "internalType": "contract C",
// "name": "y", // "name": "y",
// "type": "address" // "type": "address"
// } // }
// ], // ],
// "internalType": "struct C.S",
// "name": "s", // "name": "s",
// "type": "tuple" // "type": "tuple"
// }, // },
// { // {
// "internalType": "contract C",
// "name": "c", // "name": "c",
// "type": "address" // "type": "address"
// } // }

View File

@ -10,14 +10,17 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "string",
// "name": "a", // "name": "a",
// "type": "string" // "type": "string"
// }, // },
// { // {
// "internalType": "bytes",
// "name": "b", // "name": "b",
// "type": "bytes" // "type": "bytes"
// }, // },
// { // {
// "internalType": "uint256[]",
// "name": "c", // "name": "c",
// "type": "uint256[]" // "type": "uint256[]"
// } // }

View File

@ -16,6 +16,7 @@ library L {
// "components": // "components":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// }, // },
@ -23,18 +24,22 @@ library L {
// "components": // "components":
// [ // [
// { // {
// "internalType": "uint256[2]",
// "name": "x", // "name": "x",
// "type": "uint256[2]" // "type": "uint256[2]"
// } // }
// ], // ],
// "internalType": "struct L.T[]",
// "name": "sub", // "name": "sub",
// "type": "tuple[]" // "type": "tuple[]"
// }, // },
// { // {
// "internalType": "bytes",
// "name": "b", // "name": "b",
// "type": "bytes" // "type": "bytes"
// } // }
// ], // ],
// "internalType": "struct L.S",
// "name": "s", // "name": "s",
// "type": "tuple" // "type": "tuple"
// } // }

View File

@ -10,10 +10,12 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "a", // "name": "a",
// "type": "uint256" // "type": "uint256"
// }, // },
// { // {
// "internalType": "uint256",
// "name": "b", // "name": "b",
// "type": "uint256" // "type": "uint256"
// } // }
@ -22,6 +24,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "d", // "name": "d",
// "type": "uint256" // "type": "uint256"
// } // }
@ -35,6 +38,7 @@ contract test {
// "inputs": // "inputs":
// [ // [
// { // {
// "internalType": "uint32",
// "name": "a", // "name": "a",
// "type": "uint32" // "type": "uint32"
// } // }
@ -43,6 +47,7 @@ contract test {
// "outputs": // "outputs":
// [ // [
// { // {
// "internalType": "uint256",
// "name": "b", // "name": "b",
// "type": "uint256" // "type": "uint256"
// } // }