Shiv Sharma
Shiv Sharma

Reputation: 25

An ERC1155 token metadata is not visible in polygonscan and etherscan

I have deployed a basic ERC1155 importing the openzeppelin libraries.

Here is my smart contract.

// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;

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

contract MyToken is ERC1155 {
address public platformOwner;

modifier onlyOwner() {
    require(msg.sender == platformOwner, "Not an owner");
    _;
}
constructor()
    ERC1155("https://beige-top-pelican-586.mypinata.cloud/ipfs/QmQP6RzFRCqm8PeJoZSPgM8mohyAgrtuWdy2ZqyAcKUNtx/{id}.json")
{
    platformOwner = msg.sender;
}

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);
}
}

And here is the my metadata json file looks like for -> [https://beige-top-pelican-586.mypinata.cloud/ipfs/QmQP6RzFRCqm8PeJoZSPgM8mohyAgrtuWdy2ZqyAcKUNtx/1.json][1]

{
"name": "Sun Heavens",
"description": "Lorem ipsum...",
"image": "https://lufinadevtest.oss-ap-south-1.aliyuncs.com/1715515909885-ss.png",
"properties": {
    "simple_property": "example value",
    "rich_property": {
        "name": "Name",
        "value": "123",
        "display_value": "123 Example Value",
        "class": "emphasis",
        "css": {
            "color": "#ffffff",
            "font-weight": "bold",
            "text-decoration": "underline"
        }
    },
    "array_property": {
        "name": "Name",
        "value": [
            1,
            2,
            3,
            4
        ],
        "class": "emphasis"
    }
}

}

Please have a look at this erc1155 smart contract nft, it's name and image is visible in etherscan https://etherscan.io/nft/0x54f456b544abfb785694400bcb1d85629b2d437f/47

So I want make visible my erc1155 nft's same like above.

Please provide me some reference or solution for it.

Let me know if anything else is required from my side.

I have taken the metadata format from here -> https://eips.ethereum.org/EIPS/eip-1155

Upvotes: 0

Views: 56

Answers (0)

Related Questions