2

Is it possible to define a handler which is executed every time when tokens are transferred to a contract? I.e. something like an unnamed function for Ether but for user tokens:

function() public payable {
    // handle ETH
}

2 Answers 2

1

For EIP-20 tokens there is no such mechanism.

For ERC-223 tokens please refer to the token standard and look for tokenFallback function.

4
0

if you use an ERC-20 tokens, you can't use fallback function for tokens.

You can see other standards for tokens:

ERC-23

ERC-223

ERC-777

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.