I want to implement an ERC-1155 token to represent ownership of videos. Creating such a contract is relatively easy:
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract MyVideos is ERC1155 {
uint256 public constant Video1 = 0;
uint256 public constant Video2 = 1;
uint256 public constant Video3 = 2;
constructor() public ERC1155("https://video/api/item/{id}.json") {
_mint(msg.sender, Video1, 100, "IPFS hash");
_mint(msg.sender, Video2, 1000, "IPFS hash");
_mint(msg.sender, Video3, 1, "IPFS hash");
}
}
However, what I have no idea how to do is to create such ERC-1155 tokens dynamically and on the fly. Specifically, how would I add Video3 with 10000 tokens
(_mint(msg.sender, Video4, 10000, "IPFS hash");
But how do I add this new token after the contract MyVideos is already created?
I would really appreciate any help you can give me.
Many thanks!