ERC777TokensSender and ERC777TokenRecipient

In ERC777, calling a tokensToSend(or tokensReceived) hook is mandatory when sending(or receiving) a token? I wonder if the holder does not register ERC777TokensSender contract to ERC1820 registry then it is not necessary to call tokensToSend.

EIP says:

The Token contract MUST call tokensToSend hook of the holder if the holder registers an ERC777TokensSender implementation via ERC1820.

I misunderstand something here?

1 Like

Hi @swkim109,

I think your understanding is correct.

Calling a tokensToSend hook is mandatory when sending a token when the token holder has registered an ERC777TokensSender with the ERC1820 registry.

If the token holder hasn’t registered a hook, then there is no hook to call.

My understanding is that the tokensToSend hook is primarily for when an operator is doing the sending and it is an opportunity for the token holder to check if they want the send to go through, and to revert if they don’t.

1 Like

Hi @swkim109,

Feel free to ask all the questions that you need. I hadn’t looked at tokensToSend before so had to read up. :smile:
I have only implemented tokensReceived in the Simple ERC777 token example

I think ERC777 hooks are really powerful.

Are you looking to create your own ERC777?