IERC1363Receiver.sol 1.5 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1363Receiver.sol)
  3. pragma solidity ^0.8.0;
  4. /**
  5. * @dev Interface for any contract that wants to support {IERC1363-transferAndCall}
  6. * or {IERC1363-transferFromAndCall} from {ERC1363} token contracts.
  7. */
  8. interface IERC1363Receiver {
  9. /*
  10. * Note: the ERC-165 identifier for this interface is 0x88a7ca5c.
  11. * 0x88a7ca5c === bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))
  12. */
  13. /**
  14. * @notice Handle the receipt of ERC1363 tokens
  15. * @dev Any ERC1363 smart contract calls this function on the recipient
  16. * after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the
  17. * transfer. Return of other than the magic value MUST result in the
  18. * transaction being reverted.
  19. * Note: the token contract address is always the message sender.
  20. * @param operator address The address which called `transferAndCall` or `transferFromAndCall` function
  21. * @param from address The address which are token transferred from
  22. * @param amount uint256 The amount of tokens transferred
  23. * @param data bytes Additional data with no specified format
  24. * @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` unless throwing
  25. */
  26. function onTransferReceived(
  27. address operator,
  28. address from,
  29. uint256 amount,
  30. bytes memory data
  31. ) external returns (bytes4);
  32. }