For example, a function's name and parameters are given as following:
function batchTransfer(address[] _receivers, uint256 _value) public returns (bool);
Then I want to get a python dictionary whose key is the first location of the value in transaction input, and value is the corresponding value, for example:
p {};
p["0"] = 0x34672534; // the function signature
p["4"] = 'offset'; // the offset of '_receivers' value
p["36"] = '_value';
p["4+offset"] = '_receivers.length'; // the length of '_receivers'
p["4+offset+1*32"] = '_receivers[1]'
p["4+offset+2*32"] = '_receivers[2]'
Note: since when reaching this stage, only contract source codes and ABI were given, and there are no concrete inputs, namely, I should derive this dictionary by statically analyzing source codes or ABI, so the location can be expressed by expressions as shown above.
So, is there any way to implement such a parser to get this map?
Or is there already an existing one?
mapping(string -> string)
doesn't seem appropriate here. To begin with, neither0x34672534
nor_value
is of typestring
. Please refine your question.