IERC1363.sol 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v5.0.0-rc.0) (interfaces/IERC1363.sol)
  3. pragma solidity ^0.8.20;
  4. import {IERC20} from "./IERC20.sol";
  5. import {IERC165} from "./IERC165.sol";
  6. /**
  7. * @dev Interface of an ERC1363 compliant contract, as defined in the
  8. * https://eips.ethereum.org/EIPS/eip-1363[EIP].
  9. *
  10. * Defines a interface for ERC20 tokens that supports executing recipient
  11. * code after `transfer` or `transferFrom`, or spender code after `approve`.
  12. */
  13. interface IERC1363 is IERC165, IERC20 {
  14. /*
  15. * Note: the ERC-165 identifier for this interface is 0xb0202a11.
  16. * 0xb0202a11 ===
  17. * bytes4(keccak256('transferAndCall(address,uint256)')) ^
  18. * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
  19. * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
  20. * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
  21. * bytes4(keccak256('approveAndCall(address,uint256)')) ^
  22. * bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
  23. */
  24. /**
  25. * @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
  26. * @param to address The address which you want to transfer to
  27. * @param amount uint256 The amount of tokens to be transferred
  28. * @return true unless throwing
  29. */
  30. function transferAndCall(address to, uint256 amount) external returns (bool);
  31. /**
  32. * @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver
  33. * @param to address The address which you want to transfer to
  34. * @param amount uint256 The amount of tokens to be transferred
  35. * @param data bytes Additional data with no specified format, sent in call to `to`
  36. * @return true unless throwing
  37. */
  38. function transferAndCall(address to, uint256 amount, bytes memory data) external returns (bool);
  39. /**
  40. * @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver
  41. * @param from address The address which you want to send tokens from
  42. * @param to address The address which you want to transfer to
  43. * @param amount uint256 The amount of tokens to be transferred
  44. * @return true unless throwing
  45. */
  46. function transferFromAndCall(address from, address to, uint256 amount) external returns (bool);
  47. /**
  48. * @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver
  49. * @param from address The address which you want to send tokens from
  50. * @param to address The address which you want to transfer to
  51. * @param amount uint256 The amount of tokens to be transferred
  52. * @param data bytes Additional data with no specified format, sent in call to `to`
  53. * @return true unless throwing
  54. */
  55. function transferFromAndCall(address from, address to, uint256 amount, bytes memory data) external returns (bool);
  56. /**
  57. * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
  58. * and then call `onApprovalReceived` on spender.
  59. * @param spender address The address which will spend the funds
  60. * @param amount uint256 The amount of tokens to be spent
  61. */
  62. function approveAndCall(address spender, uint256 amount) external returns (bool);
  63. /**
  64. * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender
  65. * and then call `onApprovalReceived` on spender.
  66. * @param spender address The address which will spend the funds
  67. * @param amount uint256 The amount of tokens to be spent
  68. * @param data bytes Additional data with no specified format, sent in call to `spender`
  69. */
  70. function approveAndCall(address spender, uint256 amount, bytes memory data) external returns (bool);
  71. }