diff --git a/packages/hardhat/contracts/YourCollectible.sol b/packages/hardhat/contracts/YourCollectible.sol new file mode 100644 index 0000000..2356f8f --- /dev/null +++ b/packages/hardhat/contracts/YourCollectible.sol @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.2; //Do not change the solidity version as it negatively impacts submission grading + +import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; +import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; +import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; +import "@openzeppelin/contracts/utils/Counters.sol"; + +contract YourCollectible is + ERC721, + ERC721Enumerable, + ERC721URIStorage, + Ownable +{ + using Counters for Counters.Counter; + + Counters.Counter public tokenIdCounter; + + constructor() ERC721("YourCollectible", "YCB") {} + + function _baseURI() internal pure override returns (string memory) { + return "https://ipfs.io/ipfs/"; + } + + function mintItem(address to, string memory uri) public returns (uint256) { + tokenIdCounter.increment(); + uint256 tokenId = tokenIdCounter.current(); + _safeMint(to, tokenId); + _setTokenURI(tokenId, uri); + return tokenId; + } + + // The following functions are overrides required by Solidity. + + function _beforeTokenTransfer( + address from, + address to, + uint256 tokenId, + uint256 quantity + ) internal override(ERC721, ERC721Enumerable) { + super._beforeTokenTransfer(from, to, tokenId, quantity); + } + + function _burn( + uint256 tokenId + ) internal override(ERC721, ERC721URIStorage) { + super._burn(tokenId); + } + + function tokenURI( + uint256 tokenId + ) public view override(ERC721, ERC721URIStorage) returns (string memory) { + return super.tokenURI(tokenId); + } + + function supportsInterface( + bytes4 interfaceId + ) + public + view + override(ERC721, ERC721Enumerable, ERC721URIStorage) + returns (bool) + { + return super.supportsInterface(interfaceId); + } +} diff --git a/packages/hardhat/deploy/99_generateTsAbis.ts b/packages/hardhat/deploy/99_generateTsAbis.ts index a6c0fb3..e807a8b 100644 --- a/packages/hardhat/deploy/99_generateTsAbis.ts +++ b/packages/hardhat/deploy/99_generateTsAbis.ts @@ -101,7 +101,7 @@ function getContractDataFromDeployments() { */ const generateTsAbis: DeployFunction = async function () { // const TARGET_DIR = "../nextjs/contracts/"; - const TARGET_DIR = "../../nuxt/contracts/"; + const TARGET_DIR = "../nuxt/contracts/"; const allContractsData = getContractDataFromDeployments(); const fileContent = Object.entries(allContractsData).reduce((content, [chainId, chainConfig]) => {