I'm trying to use ERC1155 to create characters for my game, however, my characters will have a unique code called "DNA", I'm looking through the ERC1155 documentation and I need to define an "ID" for an NFT that I will create an example:
// contracts/GameChar.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract GameChar is ERC1155 {
uint256 public constant CHARACTERS = 0;
constructor() public ERC1155("https://game.example/api/item/{id}.json") {
_mint(msg.sender, CHARACTERS, 1, "");
}
}
But I'm using it in the following way...
contract GameChar is ERC1155 {
uint256 public constant CHARACTERS = 0;
constructor() public ERC1155("https://game.example/api/item/{id}.json") {}
function invokeHero(unit _dna) public {
_mint(msg.sender, _dna, 1, "");
}
}
My problem is that I need to have a List of all DNAID (TokenID) of an owner, or I need to have a way to validate that a DNAID is really from a person.
How do I get this?