IERC777Recipient.sol 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.20;
  3. /**
  4. * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP.
  5. *
  6. * Accounts can be notified of {IERC777} tokens being sent to them by having a
  7. * contract implement this interface (contract holders can be their own
  8. * implementer) and registering it on the
  9. * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry].
  10. *
  11. * See {IERC1820Registry} and {IERC1820Implementer}.
  12. */
  13. interface IERC777Recipient {
  14. /**
  15. * @dev Called by an {IERC777} token contract whenever tokens are being
  16. * moved or created into a registered account (`to`). The type of operation
  17. * is conveyed by `from` being the zero address or not.
  18. *
  19. * This call occurs _after_ the token contract's state is updated, so
  20. * {IERC777-balanceOf}, etc., can be used to query the post-operation state.
  21. *
  22. * This function may revert to prevent the operation from being executed.
  23. */
  24. function tokensReceived(
  25. address operator,
  26. address from,
  27. address to,
  28. uint256 amount,
  29. bytes calldata userData,
  30. bytes calldata operatorData
  31. ) external;
  32. }