The ERC777 Token Standard improves upon the popular ERC20 standard.
Its most defining feature is the use of the new ERC1820 interface standard which it uses in such a way, that each time tokens are sent the ERC777 contract does two things:
- It checks whether the sender of the transaction is a contract and whether that contract implements a
tokensToSend(_operator, _from, _to, _amount, _data, _operatorData)
function. - It checks whether the receiver of the transaction is a contract and whether that contract implements a
tokensToSend(_operator, _from, _to, _amount, _data, _operatorData)
function.
If the functions exist, then the code inside of both functions is executed. The exciting part is, that there are no restrictions on what the code inside of the two functions looks like or what it does.
$ truffle test --network ganache
Further tests for this implementation may be found here.