I'm doing oraclize calls on the json rpc of a chain to get this function:
function getTransfer(uint _transferId) public view returns(uint,address,uint){
Details memory _locked = transferDetails[_transferId];
return(_locked.amount,_locked.owner,_locked.transferId);
}
It's really not that important what it does, but when I call this function from oraclize, I get back a string with all three variables...for instance:
"0x0000000000000000000000000000000000000000000000000b1a2bc2ec500000000000000000000000000000c69c64c226fea62234afe4f5832a051ebc8605400000000000000000000000000000000000000000000000000000000000000001"
I'm working on a callback to parse this into a uint, an address, and a uint. This is what I have so far:
function __callback(string result) public returns(uint,address,uint){
emit Print(result);
string memory _int = Strings.substring(result,60,90);
emit Print(_int);
emit P2(stringToUint(_int));
uint _amount= parseInt(_int);
_int =strConcat('0x',Strings.substring(result,91,130)) ;
address _owner = parseAddr(_int);
_int =Strings.substring(result,131,194) ;
uint _transId = parseInt(_int);
return (_amount,_transId,_transId);
}
This sort of works, but the problem is that the uint's are actually in hex value (this string should return .8e18,0x,1), but I need to convert a literal string to a hex to a decimal..if you have any ideas. Also, can I use substring, or will the length of my string change with the values?
The code of the contract we're calling is here: https://ropsten.etherscan.io/address/0xd29d27cfacf7b77a16edac7c2cddf07dc4a603b8#readContract
p.s. It can break remix doing this kind of string manipulation