Skip to main content
3 of 3
Add formatting for future viewers
Shane Fontaine
  • 18.3k
  • 20
  • 56
  • 83

How to implement function() tokenFallback and decode the parameter bytes _extraData

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).

user1938620
  • 681
  • 1
  • 6
  • 12