This is simplest example code which uses ERC777 contract and ERC777Hooks (Sender, Recipient) to transfer tokens and emits Hooks events.
Code does:
- Deploys ERC1820 contract if not yet exist to private ethereum based blockchain.
- Deploys*** ERC777 contract
- Deploys*** ERC777Recipient, ERC777Sender contracts
- Creates Client (ETH account) on demand
- Makes a check that tokens were transferred to Client
- Logs received events: 'TokensReceivedCalled', 'TokensToSendCalled'
Tested using locally running Hyperledger Besu - version
Solidity contracts were taken from Openzeppelin
Web3j - as ethereum JSON-RPC java library
*** - creates New contract if address is not explicitly set in 'application.yml' file under 'netContracts/name/address' section