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

Method abiDecodingFunction

libsolidity/codegen/ABIFunctions.cpp:1071–1104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1069}
1070
1071std::string ABIFunctions::abiDecodingFunction(Type const& _type, bool _fromMemory, bool _forUseOnStack)
1072{
1073 // The decoding function has to perform bounds checks unless it decodes a value type.
1074 // Conversely, bounds checks have to be performed before the decoding function
1075 // of a value type is called.
1076
1077 Type const* decodingType = _type.decodingType();
1078 solAssert(decodingType, "");
1079
1080 if (auto arrayType = dynamic_cast<ArrayType const*>(decodingType))
1081 {
1082 if (arrayType->dataStoredIn(DataLocation::CallData))
1083 {
1084 solAssert(!_fromMemory, "");
1085 return abiDecodingFunctionCalldataArray(*arrayType);
1086 }
1087 else
1088 return abiDecodingFunctionArray(*arrayType, _fromMemory);
1089 }
1090 else if (auto const* structType = dynamic_cast<StructType const*>(decodingType))
1091 {
1092 if (structType->dataStoredIn(DataLocation::CallData))
1093 {
1094 solAssert(!_fromMemory, "");
1095 return abiDecodingFunctionCalldataStruct(*structType);
1096 }
1097 else
1098 return abiDecodingFunctionStruct(*structType, _fromMemory);
1099 }
1100 else if (auto const* functionType = dynamic_cast<FunctionType const*>(decodingType))
1101 return abiDecodingFunctionFunctionType(*functionType, _fromMemory, _forUseOnStack);
1102 else
1103 return abiDecodingFunctionValueType(_type, _fromMemory);
1104}
1105
1106std::string ABIFunctions::abiDecodingFunctionValueType(Type const& _type, bool _fromMemory)
1107{

Callers

nothing calls this directly

Calls 2

decodingTypeMethod · 0.45
dataStoredInMethod · 0.45

Tested by

no test coverage detected