MCPcopy Create free account
hub / github.com/argotorg/solidity / externalSignature

Method externalSignature

libsolidity/ast/Types.cpp:3649–3685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3647}
3648
3649std::string FunctionType::externalSignature() const
3650{
3651 solAssert(m_declaration != nullptr, "External signature of function needs declaration");
3652 solAssert(!m_declaration->name().empty(), "Fallback function has no signature.");
3653 switch (kind())
3654 {
3655 case Kind::Internal:
3656 case Kind::External:
3657 case Kind::DelegateCall:
3658 case Kind::Event:
3659 case Kind::Error:
3660 case Kind::Declaration:
3661 break;
3662 default:
3663 solAssert(false, "Invalid function type for requesting external signature.");
3664 }
3665
3666 // "inLibrary" is only relevant if this is neither an event nor an error.
3667 bool inLibrary = false;
3668 if (kind() != Kind::Event && kind() != Kind::Error)
3669 if (auto const* contract = dynamic_cast<ContractDefinition const*>(m_declaration->scope()))
3670 inLibrary = contract->isLibrary();
3671
3672 auto extParams = transformParametersToExternal(m_parameterTypes, inLibrary);
3673
3674 solAssert(extParams.message().empty(), extParams.message());
3675
3676 auto typeStrings = extParams.get() | ranges::views::transform([&](Type const* _t) -> std::string
3677 {
3678 std::string typeName = _t->signatureInExternalFunction(inLibrary);
3679
3680 if (inLibrary && _t->dataStoredIn(DataLocation::Storage))
3681 typeName += " storage";
3682 return typeName;
3683 });
3684 return m_declaration->name() + "(" + boost::algorithm::join(typeStrings, ",") + ")";
3685}
3686
3687u256 FunctionType::externalIdentifier() const
3688{

Callers

nothing calls this directly

Calls 8

scopeMethod · 0.80
isLibraryMethod · 0.80
emptyMethod · 0.45
nameMethod · 0.45
getMethod · 0.45
dataStoredInMethod · 0.45

Tested by

no test coverage detected