Trying to set a token fallback sort of function here. Main problem: if the receiver has code but does not include the specific function I try to execute it fails. Any way to call an external function, without the transaction failing if the function didn't exist? Like, you try to execute a certain function but if it isn't there is not a big deal.


Yes, you can use call. E.g.:

addr.call(keccak256("tokenFallback(address,amount,bytes)"), from, amount, data);

call returns true or false indicating success or failure of the call. You can just ignore it if you don't care whether the call succeeds.

Of course, as I understand it, the entire purpose of ERC 223 is to make sure that the transfer is reverted if the receiving contract doesn't implement that function. :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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