ERC1155HolderUpgradeable.sol 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-License-Identifier: MIT
  2. // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)
  3. pragma solidity ^0.8.0;
  4. import "./ERC1155ReceiverUpgradeable.sol";
  5. import "../../../proxy/utils/Initializable.sol";
  6. /**
  7. * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
  8. *
  9. * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
  10. * stuck.
  11. *
  12. * @dev _Available since v3.1._
  13. */
  14. contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable {
  15. function __ERC1155Holder_init() internal onlyInitializing {
  16. }
  17. function __ERC1155Holder_init_unchained() internal onlyInitializing {
  18. }
  19. function onERC1155Received(
  20. address,
  21. address,
  22. uint256,
  23. uint256,
  24. bytes memory
  25. ) public virtual override returns (bytes4) {
  26. return this.onERC1155Received.selector;
  27. }
  28. function onERC1155BatchReceived(
  29. address,
  30. address,
  31. uint256[] memory,
  32. uint256[] memory,
  33. bytes memory
  34. ) public virtual override returns (bytes4) {
  35. return this.onERC1155BatchReceived.selector;
  36. }
  37. /**
  38. * This empty reserved space is put in place to allow future versions to add new
  39. * variables without shifting down storage in the inheritance chain.
  40. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  41. */
  42. uint256[50] private __gap;
  43. }