And creating a function to make the loop (instead of using the constructor directly, like in the tutorials)
// 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";
// Contract to be deployed via https://remix.ethereum.org/
contract WEBContract is ERC1155, Ownable {
using SafeMath for uint256;
uint256 public items;
constructor() ERC1155("ipfs://<FOLDER_HASH>/metadata/{id}.json") {
items = 1000;
}
function mintAll() public onlyOwner {
for (uint256 i = 1; i <= items; i++) {
mint(msg.sender, i, 1);
}
}
function mint(address to, uint256 id, uint256 amount) public onlyOwner {
_mint(to, id, amount, "");
}
function burn(address from, uint256 id, uint256 amount) public {
require(msg.sender == from);
_burn(from, id, amount);
}
}
TESTED ONLY WITH 22 ITEMS (and setting items = 22;
)