> For the complete documentation index, see [llms.txt](https://daoversal-my-space.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://daoversal-my-space.gitbook.io/documentation/erc-1155/erc-1155-functions.md).

# ERC-1155 Functions

**`balanceOf(address account, uint256 id) → uint256`external**

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

Requirements:

* `account` cannot be the zero address.<br>

**`balanceOfBatch(address[] accounts, uint256[] ids) → uint256[]`external**

Batched version of [`balanceOf`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155-balanceOf-address-uint256-).

Requirements:

* `accounts` and `ids` must have the same length.<br>

**`setApprovalForAll(address operator, bool approved)`external**

Grants or revokes permission to `operator` to transfer the caller’s tokens, according to `approved`,

Emits an [`ApprovalForAll`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155-ApprovalForAll-address-address-bool-) event.

Requirements:

* `operator` cannot be the caller.<br>

**`isApprovedForAll(address account, address operator) → bool`external**

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

See [`setApprovalForAll`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155-setApprovalForAll-address-bool-).<br>

**`safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data)`external**

Transfers `amount` tokens of token type `id` from `from` to `to`.

Emits a [`TransferSingle`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155-TransferSingle-address-address-address-uint256-uint256-) event.

Requirements:

* `to` cannot be the zero address.
* If the caller is not `from`, it must be have been approved to spend `from`'s tokens via [`setApprovalForAll`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155-setApprovalForAll-address-bool-).
* `from` must have a balance of tokens of type `id` of at least `amount`.
* If `to` refers to a smart contract, it must implement [`IERC1155Receiver.onERC1155Received`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes-) and return the acceptance magic value.<br>

**`safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data)`external**

Batched version of [`safeTransferFrom`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155-safeTransferFrom-address-address-uint256-uint256-bytes-).

Emits a [`TransferBatch`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155-TransferBatch-address-address-address-uint256---uint256---) event.

Requirements:

* `ids` and `amounts` must have the same length.
* If `to` refers to a smart contract, it must implement [`IERC1155Receiver.onERC1155BatchReceived`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155Receiver-onERC1155BatchReceived-address-address-uint256---uint256---bytes-) and return the acceptance magic value.

**`_mint(address account, uint256 id, uint256 amount, bytes data)`internal**

Creates `amount` tokens of token type `id`, and assigns them to `account`.

Emits a [`TransferSingle`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155-TransferSingle-address-address-address-uint256-uint256-) event.

Requirements:

* `account` cannot be the zero address.
* If `account` refers to a smart contract, it must implement [`IERC1155Receiver.onERC1155Received`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155Receiver-onERC1155Received-address-address-uint256-uint256-bytes-) and return the acceptance magic value.

**`_mintBatch(address to, uint256[] ids, uint256[] amounts, bytes data)`internal**

Batched version of [`_mint`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#ERC1155-_mint-address-uint256-uint256-bytes-).

Requirements:

* `ids` and `amounts` must have the same length.
* If `to` refers to a smart contract, it must implement [`IERC1155Receiver.onERC1155BatchReceived`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#IERC1155Receiver-onERC1155BatchReceived-address-address-uint256---uint256---bytes-) and return the acceptance magic value.

**`_burn(address account, uint256 id, uint256 amount)`internal**

Destroys `amount` tokens of token type `id` from `account`

Requirements:

* `account` cannot be the zero address.
* `account` must have at least `amount` tokens of token type `id`.

**`_burnBatch(address account, uint256[] ids, uint256[] amounts)`internal**

Batched version of [`_burn`](https://docs.openzeppelin.com/contracts/3.x/api/token/erc1155#ERC1155-_burn-address-uint256-uint256-).

Requirements:

* `ids` and `amounts` must have the same length.
