IERC1363Spender.sol 1.2 KB

1234567891011121314151617181920212223242526272829
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363Spender.sol)
  3. pragma solidity ^0.8.0;
  4. /**
  5. * @dev Interface for any contract that wants to support {IERC1363-approveAndCall}
  6. * from {ERC1363} token contracts.
  7. */
  8. interface IERC1363Spender {
  9. /*
  10. * Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
  11. * 0x7b04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))
  12. */
  13. /**
  14. * @notice Handle the approval of ERC1363 tokens
  15. * @dev Any ERC1363 smart contract calls this function on the recipient
  16. * after an `approve`. This function MAY throw to revert and reject the
  17. * approval. 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 owner address The address which called `approveAndCall` function
  21. * @param amount uint256 The amount of tokens to be spent
  22. * @param data bytes Additional data with no specified format
  23. * @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`unless throwing
  24. */
  25. function onApprovalReceived(address owner, uint256 amount, bytes memory data) external returns (bytes4);
  26. }