Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ERC1155HolderUpgradeable

Inherits: Initializable, ERC165Upgradeable, IERC1155Receiver

Simple implementation of IERC1155Receiver that will allow a contract to hold ERC-1155 tokens. IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be stuck.

Functions

__ERC1155Holder_init

function __ERC1155Holder_init() internal onlyInitializing;

__ERC1155Holder_init_unchained

function __ERC1155Holder_init_unchained() internal onlyInitializing;

supportsInterface

Query if a contract implements an interface

Interface identification is specified in ERC-165. This function uses less than 30,000 gas.

function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(ERC165Upgradeable, IERC165)
    returns (bool);

Parameters

NameTypeDescription
interfaceIdbytes4

Returns

NameTypeDescription
<none>booltrue if the contract implements interfaceID and interfaceID is not 0xffffffff, false otherwise

onERC1155Received

function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual override returns (bytes4);

onERC1155BatchReceived

function onERC1155BatchReceived(address, address, uint256[] memory, uint256[] memory, bytes memory)
    public
    virtual
    override
    returns (bytes4);