I want to use the ERC223 approveAndCall() || ERC677 transferAndCall() functionality in a contract.

I can take the _extraData string


And convert it into a byte[] using y=byte(x)


but in the returning tokenFallback() function I can't work out how to convert this back into an address and two arrays of address[], uint[].

Edit: Maybe I shouldn't be starting from a string. Is there a way to stick addresses, ints, uints, byte32 etc. together into a byte format, and extract (assuming you know how they were put together).

1 Answer 1


If you take a close look at that byte string and compare the values with the hex column in this table, you will find your data simply being encoded to bytes. Assuming you would correctly parse this data and extract only the bytes of an address, I'm not sure if there is an implicit type conversion to address. But if it's just bytes you want, you basically just need to split the data string into parts.

  • I don't think the output is in Hex as there are no letters. I really want to end up with an address and two arrays of address[], uint[], not a string. The parse function looks useful in general though. I'll bookmark that for later use. Thanks Commented Mar 22, 2018 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.