Dear Support,
I’m getting a strange issue when I try to fetch the Tokens from a contract I deployed in the Mumbai testnet.
First I have to say that this same procedure worked 2 weeks ago and but the same exact process is not working now.
I deploy a contract in remix which contains mp3 music, so after deploy, I get the contract address.
For instance :
0x805bb7aEC9acFC1319b05d72A0dcE6221bB38B06
This is the template code I used in Remix to mint the NFTs:
pragma solidity ^0.8.3;
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
contract NFT is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
address public owner;
constructor() ERC721("DecentraHits", "NFM") {
owner = msg.sender;
uint canciones = 12;
for(uint j = 0; j < canciones; j++){
createToken(string(abi.encodePacked(
"https://ipfs.moralis.io:2053/ipfs/QmbbBJDhT5n31tHZ6ZdoFvPEwxPmbB1TArwpa6d8ssVd91/metadata/",Strings.toString(j),".json")));
}
}
function createToken(string memory tokenURI) public returns (uint) {
require(msg.sender == owner, "Only owner is allowed to createTokens");
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(msg.sender, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
}
When I try to fetch the contract using Moralis, I see this in the console:
As you can see, the “metadata” is NULL, despite the fact that the Token URI is properly assigned.
Token URI:https://ipfs.moralis.io:2053/ipfs/QmTXtjyN7P1zptC2s9MhFtgpFd1dBgv9ame4CapGwFShAg/metadata/12.json
So when I try to get the metadata info using Moralis, I get errors, because there is no metadata assigned.
The strange thing is that I did the same procedure before to mint other mp3s and it worked.
Example:
0x400b1bCE49221d1C541ae391F3F174ed827952A6
With this contract, the metadata is fine:
What has changed in the last two weeks?
How can I fix this issue?
Any help is greatly appreaciated
Thanks!