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

Method abiDecodingFunctionFunctionType

libsolidity/codegen/ABIFunctions.cpp:1393–1430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1391}
1392
1393std::string ABIFunctions::abiDecodingFunctionFunctionType(FunctionType const& _type, bool _fromMemory, bool _forUseOnStack)
1394{
1395 solAssert(_type.kind() == FunctionType::Kind::External, "");
1396
1397 std::string functionName =
1398 "abi_decode_" +
1399 _type.identifier() +
1400 (_fromMemory ? "_fromMemory" : "") +
1401 (_forUseOnStack ? "_onStack" : "");
1402
1403 return createFunction(functionName, [&]() {
1404 if (_forUseOnStack)
1405 {
1406 return Whiskers(R"(
1407 function <functionName>(offset, end) -> addr, function_selector {
1408 addr, function_selector := <splitExtFun>(<decodeFun>(offset, end))
1409 }
1410 )")
1411 ("functionName", functionName)
1412 ("decodeFun", abiDecodingFunctionFunctionType(_type, _fromMemory, false))
1413 ("splitExtFun", m_utils.splitExternalFunctionIdFunction())
1414 .render();
1415 }
1416 else
1417 {
1418 return Whiskers(R"(
1419 function <functionName>(offset, end) -> fun {
1420 fun := <load>(offset)
1421 <validateExtFun>(fun)
1422 }
1423 )")
1424 ("functionName", functionName)
1425 ("load", _fromMemory ? "mload" : "calldataload")
1426 ("validateExtFun", m_utils.validatorFunction(_type, true))
1427 .render();
1428 }
1429 });
1430}
1431
1432std::string ABIFunctions::calldataAccessFunction(Type const& _type)
1433{

Callers

nothing calls this directly

Calls 7

createFunctionFunction · 0.85
WhiskersClass · 0.85
identifierMethod · 0.80
renderMethod · 0.80
validatorFunctionMethod · 0.80
kindMethod · 0.45

Tested by

no test coverage detected