ERC777 Token
It's most defining feature is the use of the new ERC1820 interface standard which it uses in such a way, that each time a token is sent two things happen:
- 1.The ERC777 contract It checks wether the sender of the transaction is a contract and wether that contract implements a
tokensToSend(_operator, _from, _to, _amount, _data, _operatorData)
method. - 2.It checks wether the receiver of the transaction is a contract and wether that contract implements a
tokensToSend(_operator, _from, _to, _amount, _data, _operatorData)
method.
If the methods exist, then the code inside of both methods is executed.
The exiting thing is, that there are no restrictions on what the code inside of the two methods looks like or what it does.
Further information on the standard can be found here:
The contract accesses the
ERC1820Registry
contract in its constructor. It is therefore necessary that the ERC1820Registry
contract exists on the (test) network to where the erc777
token contract gets deployed. In
migrations/1_initial_migration.js
a check is performed to determine if the ERC1820Registry
contract exists - if it doesn't it is deployed.