mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Exclude internal functions in library ABIs
This commit is contained in:
@@ -26,12 +26,31 @@ using namespace std;
|
||||
using namespace dev;
|
||||
using namespace dev::solidity;
|
||||
|
||||
namespace
|
||||
{
|
||||
bool anyDataStoredInStorage(TypePointers const& _pointers)
|
||||
{
|
||||
for (TypePointer const& pointer: _pointers)
|
||||
if (pointer->dataStoredIn(DataLocation::Storage))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Json::Value ABI::generate(ContractDefinition const& _contractDef)
|
||||
{
|
||||
Json::Value abi(Json::arrayValue);
|
||||
|
||||
for (auto it: _contractDef.interfaceFunctions())
|
||||
{
|
||||
if (
|
||||
_contractDef.isLibrary() &&
|
||||
(it.second->stateMutability() > StateMutability::View ||
|
||||
anyDataStoredInStorage(it.second->parameterTypes() + it.second->returnParameterTypes()))
|
||||
)
|
||||
continue;
|
||||
|
||||
auto externalFunctionType = it.second->interfaceFunctionType();
|
||||
solAssert(!!externalFunctionType, "");
|
||||
Json::Value method;
|
||||
|
||||
Reference in New Issue
Block a user