Mint 500 NFT's with different (numbered) Token ID, but same picture and metadata

Hi
Just worked my way through the https://www.youtube.com/watch?v=tBMk1iZa85Y Ultimate NFT programming video.

Wondering now:
I want to mint 500 numered NFT’s, but with the same metadata-picture. Their only difference is their token number, so that OpenSea would display them as 500 different ones ( e.g. Apelien #1, Apelien #2, Apelien #3,…Apelien#n) instead of as 1 and the same NFT with 500 copies.

Would this be the best way to go about, or can this be done easier and more elegant?

//import ERC1155 token contract from Openzeppelin
(links)
contract NFTContract is ERC1155, Ownable {

uint256 public constant eu = 0; 
uint256 public constant test =1;

constructor() ERC1155("https://epst1sikrgf5.moralishost.com/{id}.json") {
    _mint(msg.sender, eu, 1, "");
    _mint(msg.sender, eu, 2, "");
    _mint(msg.sender, eu, ..., "");
    _mint(msg.sender, eu, 500, "");
}
function mint(address account, uint256 id, uint256 amount) public onlyOwner {
    _mint (account, id, amount, "");
}

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

it may work what you did there, but you may not want to mint all those 500 NFTs in constructor as you will have to pay a lot of gas

1 Like

So what is a better way then, not to get those 500 NFT’s in Constructor?

you could make a separate function to mint them in batch, it also depends on what network you deploy the smart contract, if you deploy on polygon then you’ll have probably low gas fees and you would not care about that initial gas fee in the constructor