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

Method abiDecodingFunctionValueType

libsolidity/codegen/ABIFunctions.cpp:1106–1134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1104}
1105
1106std::string ABIFunctions::abiDecodingFunctionValueType(Type const& _type, bool _fromMemory)
1107{
1108 Type const* decodingType = _type.decodingType();
1109 solAssert(decodingType, "");
1110 solAssert(decodingType->sizeOnStack() == 1, "");
1111 solAssert(decodingType->isValueType(), "");
1112 solAssert(!decodingType->isDynamicallyEncoded(), "");
1113 solAssert(decodingType->calldataEncodedSize() == 32, "");
1114
1115 std::string functionName =
1116 "abi_decode_" +
1117 _type.identifier() +
1118 (_fromMemory ? "_fromMemory" : "");
1119 return createFunction(functionName, [&]() {
1120 Whiskers templ(R"(
1121 function <functionName>(offset, end) -> value {
1122 value := <load>(offset)
1123 <validator>(value)
1124 }
1125 )");
1126 templ("functionName", functionName);
1127 templ("load", _fromMemory ? "mload" : "calldataload");
1128 // Validation should use the type and not decodingType, because e.g.
1129 // the decoding type of an enum is a plain int.
1130 templ("validator", m_utils.validatorFunction(_type, true));
1131 return templ.render();
1132 });
1133
1134}
1135
1136std::string ABIFunctions::abiDecodingFunctionArray(ArrayType const& _type, bool _fromMemory)
1137{

Callers

nothing calls this directly

Calls 9

createFunctionFunction · 0.85
identifierMethod · 0.80
validatorFunctionMethod · 0.80
renderMethod · 0.80
decodingTypeMethod · 0.45
sizeOnStackMethod · 0.45
isValueTypeMethod · 0.45
isDynamicallyEncodedMethod · 0.45
calldataEncodedSizeMethod · 0.45

Tested by

no test coverage detected