[SOLVED] Could not load the NFT metadata of a contract

I deployed a NFT contract “0x7e82c782a01d56070851a1f197da0efc139ffec3” on rinkeby with two NFT’s with ID=0 and 1.and when i tried to see the NFT’s on opensea it could not load the NFT metadata.

The NFT with id 0 and 1 are stored under https://0g4wexcx5qtg.usemoralis.com/0000000000000000000000000000000000000000000000000000000000000000.json
https://0g4wexcx5qtg.usemoralis.com/0000000000000000000000000000000000000000000000000000000000000001.json

This is the solidity program which i used

pragma solidity ^0.8.0;

//Import form Open Zeplin

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";

contract NFTContract is ERC1155, Ownable {
    uint256 public constant ArtWork = 0;
    uint256 public constant Photo = 1;

    constructor() ERC1155("https://0g4wexcx5qtg.usemoralis.com/{id}.json") {
        _mint(msg.sender, ArtWork, 1, "");
        _mint(msg.sender, Photo, 2, "");
    }

    function mint(address to,uint256 id,uint256 amount) public onlyOwner {
        _mint(to, id, amount, "");
    }

    function burn(address to,uint256 id,uint256 amount) public {
        require(msg.sender == to);   
        _burn(to, id, amount); 
    }
}

What did it go wrong?

At a first look it seems right, I can check later the deployed smart contract, and I guess that you uploaded json metadata files before deploying the smart contract

Yes, I uploaded the json data before deploying the smart contract.

it looks like it was a problem on deploy, it didn’t set a base uri for that smart contract

I really dont know what that mean…i just followed the NFT programming tutorial.
Can you elaborate it.

As per my understanding ERC1155("") functions is supposed to get the json data which is then read by the opensea. Correct me if i am mistaken.

it looks like this string is not present in the deployed smart contract code

This one is same matching url.

what I want to say, is that it looks like what it was deployed is not what you pasted as the smart contract. It looks like that

was not present when the smart contract was deployed.

2 Likes

Yup…You are right. It worked.

Bro I had to build a project for my professor’s nephew and I copied my blockchain project in her system had this same error but didnt know what was wrong and was troubled for past 2 days you solved my problem thanks man love you(no homo) :laughing: :laughing:

2 Likes