Skip to content

Instantly share code, notes, and snippets.

@adamjanes
Created October 11, 2022 09:06
Show Gist options
  • Save adamjanes/24b18538d178e96bd03dca68ffa3edc2 to your computer and use it in GitHub Desktop.
Save adamjanes/24b18538d178e96bd03dca68ffa3edc2 to your computer and use it in GitHub Desktop.
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
// import "hardhat/console.sol";
contract VerityNFT is ERC721("VerityNFT", "VERY"), Ownable {
uint256 counter;
string public baseURI;
mapping (uint256 => string[]) public tokenIdToFileArray;
constructor() {
for (uint8 i = 1; i < 4; i++) {
mint(msg.sender);
}
}
function _baseURI() internal view virtual override returns (string memory) {
return baseURI;
}
function setBaseURI(string memory _baseURIParam) public onlyOwner {
baseURI = _baseURIParam;
}
function mint(address to) internal returns (uint256) {
counter++;
_safeMint(to, counter);
return counter;
}
function addFileToToken(uint256 tokenId, string memory fileURI) public {
tokenIdToFileArray[tokenId].push(fileURI);
}
function getTokenFiles(uint256 tokenId) public view returns (string[] memory) {
return tokenIdToFileArray[tokenId];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment