Unidentified ERC1155 contract in Opensea

Hi Everyone,

I am having trouble setting the metadata for nfts minted on a erc1155 smart contract.

I can successfully deploy and mint from the erc1155 contract but I am having trouble with setting the metadata and viewing it in opensea.

I am building an app where users can deploy a smart contract, and mint some nfts from it.

The process I have set up is as follows,

  1. deploy an ownable erc1155 smart contract. (code example below)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

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

contract MetaRoomsRoomPass is ERC1155, Ownable {
    constructor() ERC1155("") {}

    function setURI(string memory newuri) public onlyOwner {
        _setURI(newuri);
    }

    function mint(address account, uint256 id, uint256 amount, bytes memory data)
        public
        onlyOwner
    {
        _mint(account, id, amount, data);
    }

    function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
        public
        onlyOwner
    {
        _mintBatch(to, ids, amounts, data);
    }
}
  1. trigger setURI function with the string being a IPFS hash of a json (example below)
    ipfs://QmdvBsbshwWamd7ok8yn4nggfwDdUExgN8jJNvdhE2fSSD{ID}

  2. trigger mint function

The 3 transactions go through fine but when I try to view the token in opensea it just shows an 'unidentified contract' and has no metadata to show.

I'm not sure if my setURI txn is setting the URI on the contract, not on the tokens minted from it.

Do I need to add a setTokenURI function to the smart contract and call that function instead?

Thank you, I hope this makes sense. I can clarify any missing information!

I think OpenSea expects contract-level metadata in a function called contractURI. You may need to add this.

I'm not sure the URI that you shared looks right:

ipfs://QmdvBsbshwWamd7ok8yn4nggfwDdUExgN8jJNvdhE2fSSD{ID}

You may need to write {id} in lowercase, and you may be missing a slash: ...fSSD/{id}.