Skip to content
Lattice

ERC1155

Git Source

Inherits: IERC1155

Title: ERC1155

Author: Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol)

Stateless Diamond facet for the ERC-1155 Multi-Token Standard.

All logic lives in ERC1155Lib. This contract is a pure delegator. safeTransferFrom/safeBatchTransferFrom are the movement selectors a movement-replacing extension replaces; only one such extension per diamond (D25, #234).

Notes:

  • lattice-version: 0.1.0
  • lattice-source: OpenZeppelin v5.6.1

Functions

uri

Returns the URI for token type id.

function uri(uint256 id) public view virtual returns (string memory);

Parameters

NameTypeDescription
iduint256

Returns

NameTypeDescription
<none>string

balanceOf

Returns the amount of tokens of token type id owned by account.

function balanceOf(address account, uint256 id) public view virtual returns (uint256);

Parameters

NameTypeDescription
accountaddress
iduint256

Returns

NameTypeDescription
<none>uint256

balanceOfBatch

Batched version of balanceOf.

function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        public
        view
        virtual
        returns (uint256[] memory);

Parameters

NameTypeDescription
accountsaddress[]
idsuint256[]

Returns

NameTypeDescription
<none>uint256[]

isApprovedForAll

Returns true if operator is approved to transfer account's tokens.

function isApprovedForAll(address account, address operator) public view virtual returns (bool);

Parameters

NameTypeDescription
accountaddress
operatoraddress

Returns

NameTypeDescription
<none>bool

setApprovalForAll

Grants or revokes permission to operator to transfer the caller's tokens.

function setApprovalForAll(address operator, bool approved) public virtual;

Parameters

NameTypeDescription
operatoraddress
approvedbool

safeTransferFrom

Transfers value amount of an id from from to to.

function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes calldata data) public virtual;

Parameters

NameTypeDescription
fromaddress
toaddress
iduint256
valueuint256
databytes

safeBatchTransferFrom

Batched version of safeTransferFrom.

function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) public virtual;

Parameters

NameTypeDescription
fromaddress
toaddress
idsuint256[]
valuesuint256[]
databytes

exportSelectors

ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).

Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches forge inspect ERC1155 methodIdentifiers (alphabetical by signature); kept in exact parity by ExportSelectorsParityTest. Chunks: balanceOf(address,uint256) 0x00fdd58e balanceOfBatch(address[],uint256[]) 0x4e1273f4 isApprovedForAll(address,address) 0xe985e9c5 safeBatchTransferFrom(address,address,uint256[],uint256[],bytes) 0x2eb2c2d6 safeTransferFrom(address,address,uint256,uint256,bytes) 0xf242432a setApprovalForAll(address,bool) 0xa22cb465 uri(uint256) 0x0e89341c

function exportSelectors() external pure virtual returns (bytes memory selectors);

Returns

NameTypeDescription
selectorsbytes