ERC721EnumerableMock.sol 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../token/ERC721/extensions/ERC721Enumerable.sol";
  4. /**
  5. * @title ERC721Mock
  6. * This mock just provides a public safeMint, mint, and burn functions for testing purposes
  7. */
  8. contract ERC721EnumerableMock is ERC721Enumerable {
  9. string private _baseTokenURI;
  10. constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
  11. function _baseURI() internal view override returns (string memory) {
  12. return _baseTokenURI;
  13. }
  14. function setBaseURI(string calldata newBaseTokenURI) public {
  15. _baseTokenURI = newBaseTokenURI;
  16. }
  17. function baseURI() public view returns (string memory) {
  18. return _baseURI();
  19. }
  20. function exists(uint256 tokenId) public view returns (bool) {
  21. return _exists(tokenId);
  22. }
  23. function mint(address to, uint256 tokenId) public {
  24. _mint(to, tokenId);
  25. }
  26. function safeMint(address to, uint256 tokenId) public {
  27. _safeMint(to, tokenId);
  28. }
  29. function safeMint(
  30. address to,
  31. uint256 tokenId,
  32. bytes memory _data
  33. ) public {
  34. _safeMint(to, tokenId, _data);
  35. }
  36. function burn(uint256 tokenId) public {
  37. _burn(tokenId);
  38. }
  39. }