Skip to content
Available on private testnetTestnet: yesMainnet: Not availableSoftware: Core bad4a06ea · protocol pqwerai-v8-testnet/1Updated

ERC-1155 multi-tokens

ERC-1155 manages many token IDs (fungible or unique) in one contract. Deployment, minting and transfer are tested in Create NFTs.

PQItems.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

import {ERC1155} from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

/// Example ERC-1155 multi-token: one contract, many fungible or non-fungible IDs. The URI uses the {id}
/// substitution defined by ERC-1155 (64 lower-case hex characters). Unaudited tutorial code.
contract PQItems is ERC1155, Ownable {
    constructor(string memory uri_, address owner_) ERC1155(uri_) Ownable(owner_) {}

    function mint(address to, uint256 id, uint256 amount) external onlyOwner {
        _mint(to, id, amount, "");
    }
}
  • uri(id) returns a template; clients replace {id} with the 64-character lower-case hex ID.
  • safeBatchTransferFrom and balanceOfBatch move or read many IDs in one call.
  • Events: TransferSingle, TransferBatch, URI.

Tooling limits on PQWERAI today

The explorer does not decode ERC-1155 events yet and the Windows Wallet 0.6.0 does not show ERC-1155 balances. Read balances with balanceOf(account, id) until support ships.


Found a problem? Report a documentation issue · Build testnet-rc1+72057fe3ec