IERC777Sender.sol 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC777Sender.sol)
  3. pragma solidity ^0.8.20;
  4. /**
  5. * @dev Interface of the ERC-777 Tokens Sender standard as defined in the ERC.
  6. *
  7. * {IERC777} Token holders can be notified of operations performed on their
  8. * tokens by having a contract implement this interface (contract holders can be
  9. * their own implementer) and registering it on the
  10. * https://eips.ethereum.org/EIPS/eip-1820[ERC-1820 global registry].
  11. *
  12. * See {IERC1820Registry} and {IERC1820Implementer}.
  13. */
  14. interface IERC777Sender {
  15. /**
  16. * @dev Called by an {IERC777} token contract whenever a registered holder's
  17. * (`from`) tokens are about to be moved or destroyed. The type of operation
  18. * is conveyed by `to` being the zero address or not.
  19. *
  20. * This call occurs _before_ the token contract's state is updated, so
  21. * {IERC777-balanceOf}, etc., can be used to query the pre-operation state.
  22. *
  23. * This function may revert to prevent the operation from being executed.
  24. */
  25. function tokensToSend(
  26. address operator,
  27. address from,
  28. address to,
  29. uint256 amount,
  30. bytes calldata userData,
  31. bytes calldata operatorData
  32. ) external;
  33. }