IERC1363Spender.sol 1.1 KB

1234567891011121314151617181920212223242526
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363Spender.sol)
  3. pragma solidity ^0.8.20;
  4. /**
  5. * @title IERC1363Spender
  6. * @dev Interface for any contract that wants to support `approveAndCall`
  7. * from ERC-1363 token contracts.
  8. */
  9. interface IERC1363Spender {
  10. /**
  11. * @dev Whenever an ERC-1363 token `owner` approves this contract via `approveAndCall`
  12. * to spend their tokens, this function is called.
  13. *
  14. * NOTE: To accept the approval, this must return
  15. * `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`
  16. * (i.e. 0x7b04a2d0, or its own function selector).
  17. *
  18. * @param owner The address which called `approveAndCall` function and previously owned the tokens.
  19. * @param value The amount of tokens to be spent.
  20. * @param data Additional data with no specified format.
  21. * @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))` if approval is allowed unless throwing.
  22. */
  23. function onApprovalReceived(address owner, uint256 value, bytes calldata data) external returns (bytes4);
  24. }