Hello,
Iām posting a followup question on this topic, because I think I know where the problem is, in the smart contract.
Background: I have gone through this youtube tutorial and successfully ran the sample javascript code to generate the metadata for 100 images and successfully upload to IPFS. Then moving onto the final step of writing and deploying the smart contract to generate 100 NFTs in my collection.
I am utilizing the sample code provided in the tutorial for a basic solidity contract, and I modified the constructor with a for loop to mint 100 NFTs as shown below.
My questions:
- is the code in the constructor correct?
- why does the constructor have {id} being passed in, but seems that parameter id isnāt being used.
thanks in advance.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
//import 1155 token contract from Openzeppelin
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC1155/ERC1155.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/math/SafeMath.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
// Example contract to be deployed via https://remix.ethereum.org/ for testing purposes.
contract NFTContract is ERC1155, Ownable {
using SafeMath for uint256;
constructor()
ERC1155(
"ipfs://QmWQviBuBkheeFTmDCH8bVn5wHGqq8L5a6hbZ6EEUCkw8y/metadata/{id}.json"
)
{
// account, token_id, number
for (uint i = 1; i < 101; i++) {
_mint(msg.sender, i, 1, "");
}
}
}