| 1023 | } |
| 1024 | |
| 1025 | std::string ABIFunctions::abiEncodingFunctionFunctionType( |
| 1026 | FunctionType const& _from, |
| 1027 | Type const& _to, |
| 1028 | EncodingOptions const& _options |
| 1029 | ) |
| 1030 | { |
| 1031 | solAssert( |
| 1032 | _from.kind() == FunctionType::Kind::External && |
| 1033 | _from.isImplicitlyConvertibleTo(_to) && |
| 1034 | _from.sizeOnStack() == _to.sizeOnStack(), |
| 1035 | "Invalid function type conversion requested" |
| 1036 | ); |
| 1037 | |
| 1038 | std::string functionName = |
| 1039 | "abi_encode_" + |
| 1040 | _from.identifier() + |
| 1041 | "_to_" + |
| 1042 | _to.identifier() + |
| 1043 | _options.toFunctionNameSuffix(); |
| 1044 | |
| 1045 | if (_options.encodeFunctionFromStack) |
| 1046 | return createFunction(functionName, [&]() { |
| 1047 | return Whiskers(R"( |
| 1048 | function <functionName>(addr, function_id, pos) { |
| 1049 | addr, function_id := <convert>(addr, function_id) |
| 1050 | mstore(pos, <combineExtFun>(addr, function_id)) |
| 1051 | } |
| 1052 | )") |
| 1053 | ("functionName", functionName) |
| 1054 | ("combineExtFun", m_utils.combineExternalFunctionIdFunction()) |
| 1055 | ("convert", m_utils.conversionFunction(_from, _to)) |
| 1056 | .render(); |
| 1057 | }); |
| 1058 | else |
| 1059 | return createFunction(functionName, [&]() { |
| 1060 | return Whiskers(R"( |
| 1061 | function <functionName>(addr_and_function_id, pos) { |
| 1062 | mstore(pos, <cleanExtFun>(addr_and_function_id)) |
| 1063 | } |
| 1064 | )") |
| 1065 | ("functionName", functionName) |
| 1066 | ("cleanExtFun", m_utils.cleanupFunction(_to)) |
| 1067 | .render(); |
| 1068 | }); |
| 1069 | } |
| 1070 | |
| 1071 | std::string ABIFunctions::abiDecodingFunction(Type const& _type, bool _fromMemory, bool _forUseOnStack) |
| 1072 | { |
nothing calls this directly
no test coverage detected