IERC777Sender.sol 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.19;
  3. /**
  4. * @dev Interface of the ERC777TokensSender standard as defined in the EIP.
  5. *
  6. * {IERC777} Token holders can be notified of operations performed on their
  7. * tokens by having a contract implement this interface (contract holders can be
  8. * their own 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 IERC777Sender {
  14. /**
  15. * @dev Called by an {IERC777} token contract whenever a registered holder's
  16. * (`from`) tokens are about to be moved or destroyed. The type of operation
  17. * is conveyed by `to` being the zero address or not.
  18. *
  19. * This call occurs _before_ the token contract's state is updated, so
  20. * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.
  21. *
  22. * This function may revert to prevent the operation from being executed.
  23. */
  24. function tokensToSend(
  25. address operator,
  26. address from,
  27. address to,
  28. uint256 amount,
  29. bytes calldata userData,
  30. bytes calldata operatorData
  31. ) external;
  32. }