Hi, I created an ERC1155 contract and deployed it to Polygon Mumbai testnet. The contract just mints 5 NFT's as a test
//SPDX-License-Identifier: UNLICENSED
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Context.sol";
pragma solidity ^0.8.0;
contract MyContract is ERC1155, Ownable {
//public unint16 totalTokens = 5;
string public name;
string public symbol;
constructor() ERC1155("https://bafybeic3s5lnqldp2poeoyilwhxf672huzqvjk4imd2effxxbjpycnir6a.ipfs.dweb.link/{id}.json") {
//this should be in a for loop countind down from totaltokens to 0.
_mint(msg.sender, 0, 1, "");
_mint(msg.sender, 1, 1, "");
_mint(msg.sender, 2, 1, "");
_mint(msg.sender, 3, 1, "");
_mint(msg.sender, 4, 1, "");
name = "Live NFT test";
symbol = "LFTT";
super;
}
function uri(uint256 tokenId) override public view returns(string memory){
return(
string(abi.encodePacked(
"https://bafybeic3s5lnqldp2poeoyilwhxf672huzqvjk4imd2effxxbjpycnir6a.ipfs.dweb.link/",
Strings.toString(tokenId),
".json"
))
);
}
I can see the deployment and 5 minting transactions on polygonscan but when I try to enquire the balance of a token using online tools (like ethplorer) it shows as 0 and when I try to import a token to metamask it shows me a warning that the balance could not be loaded.
I created a script in ethers.js to try and enquire the balance myself and see what was returned and I received an object as follows:
BigNumber { _hex: '0x01', _isBigNumber: true }
In ethers.js I am using the following ABI:
const ERC1155_ABI = [
"function name() view returns (string)",
"function symbol() view returns (string)",
"function balanceOf(address, uint256) public view returns (uint256)",
" function safeTransferFrom(address, address, uint256, uint256, bytes) public",
];
Does anyone know if I am doing something wrong or why my token balances cannot be enquired, it's driving me nuts!! Thanks in advance!