IERC777Recipient.sol 1.2 KB

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