4#include "extern/cjson/cJSON.h"
5#include "helpers/client_helper.h"
6#include "helpers/json_helper.h"
7#include "IoTeXConstants.h"
8#include "IoTeXResultCodes.h"
41static const char* EthereumTypeNameToStringLT[] = {
"uint",
"int",
"address",
"bool",
"fixed",
42 "ufixed",
"bytes",
"string",
"bytes",
"",
55 EthereumTypeName type;
57 EthereumTypeName arrayType;
58 uint32_t arrayTypeSizeBytes = 0;
79 bool isDynamic =
false;
80 if(type == EthereumTypeName::BYTES_DYNAMIC)
82 else if(type == EthereumTypeName::STRING)
84 else if(type == EthereumTypeName::ARRAY_DYNAMIC)
86 else if(type == EthereumTypeName::TUPLE_DYNAMIC)
88 else if(type == EthereumTypeName::ARRAY_STATIC)
90 if(arrayType == EthereumTypeName::BYTES_DYNAMIC ||
91 arrayType == EthereumTypeName::STRING ||
92 arrayType == EthereumTypeName::ARRAY_DYNAMIC ||
93 arrayType == EthereumTypeName::TUPLE_DYNAMIC)
108 return (type == EthereumTypeName::UINT || type == EthereumTypeName::INT);
112 static ResultCode getSizeFromStringAndCheckIfArray(IotexString& str,
InputOutputAbi& out);
123 std::vector<InputOutputAbi> inputs;
125 std::vector<InputOutputAbi> outputs;
126 IotexString stateMutability;
145ResultCode parseContract(
const IotexString& contractAbi, std::vector<FunctionAbi>& out);
154ResultCode parseFunction(
const cJSON* data,
FunctionAbi& out);
163ResultCode parseInputOutput(
const cJSON* data,
InputOutputAbi& out);
184 IotexString* uint256;
191 bool isBigInt =
false;
192 EthereumTypeName type = EthereumTypeName::UNKNOWN;
202 return (type == EthereumTypeName::BYTES_DYNAMIC || type == EthereumTypeName::STRING ||
203 type == EthereumTypeName::ARRAY_DYNAMIC || type == EthereumTypeName::TUPLE_DYNAMIC);
213ParameterValue MakeParamUint(uint64_t value);
221ParameterValue MakeParamInt(int64_t value);
229ParameterValue MakeParamString(IotexString& value);
237ParameterValue MakeParamAddress(uint8_t value[ETH_ADDRESS_SIZE]);
247ParameterValue MakeParamBytes(uint8_t value[],
size_t size,
bool dynamic);
A class that represents the ABI for a contract function.
Definition: abi.h:120
void getSignature(IotexString &out)
Gets the funciton signature as a string.
Definition: abi.cpp:295
Class that represents the value of a contract function input or output parameter.
Definition: abi.h:172
bool isDynamic()
Checks if this parameter is dynamic.
Definition: abi.h:200