mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #664 from axic/feature/interface-fallback
Introduce fallback entry in the ABI
This commit is contained in:
commit
cf974fd103
@ -74,7 +74,15 @@ string InterfaceHandler::abiInterface(ContractDefinition const& _contractDef)
|
|||||||
);
|
);
|
||||||
abi.append(method);
|
abi.append(method);
|
||||||
}
|
}
|
||||||
|
if (_contractDef.fallbackFunction())
|
||||||
|
{
|
||||||
|
auto externalFunctionType = FunctionType(*_contractDef.fallbackFunction()).interfaceFunctionType();
|
||||||
|
solAssert(!!externalFunctionType, "");
|
||||||
|
Json::Value method;
|
||||||
|
method["type"] = "fallback";
|
||||||
|
method["constant"] = externalFunctionType->isConstant();
|
||||||
|
abi.append(method);
|
||||||
|
}
|
||||||
for (auto const& it: _contractDef.interfaceEvents())
|
for (auto const& it: _contractDef.interfaceEvents())
|
||||||
{
|
{
|
||||||
Json::Value event;
|
Json::Value event;
|
||||||
|
@ -273,15 +273,6 @@ BOOST_AUTO_TEST_CASE(const_function)
|
|||||||
checkInterface(sourceCode, interface);
|
checkInterface(sourceCode, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(exclude_fallback_function)
|
|
||||||
{
|
|
||||||
char const* sourceCode = "contract test { function() {} }";
|
|
||||||
|
|
||||||
char const* interface = "[]";
|
|
||||||
|
|
||||||
checkInterface(sourceCode, interface);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(events)
|
BOOST_AUTO_TEST_CASE(events)
|
||||||
{
|
{
|
||||||
char const* sourceCode = "contract test {\n"
|
char const* sourceCode = "contract test {\n"
|
||||||
@ -626,6 +617,25 @@ BOOST_AUTO_TEST_CASE(library_function)
|
|||||||
checkInterface(sourceCode, interface);
|
checkInterface(sourceCode, interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(include_fallback_function)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract test {
|
||||||
|
function() {}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
|
||||||
|
char const* interface = R"(
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"constant" : false,
|
||||||
|
"type" : "fallback"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
)";
|
||||||
|
checkInterface(sourceCode, interface);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user