1

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

I can take the _extraData string

x="0xe359292df082828f595466de72062f2a1182b077",["0x3d4c4ecB5CAe14f20b916C2936a9d9A16acF14c9","0xBe227eE70d1AD43C4d1C9e173eD0f96AFDdB8a34"],["10","11"]

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

0x307865333539323932646630383238323866353935343636646537323036326632613131383262303737

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

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.

1
  • 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.