Created
May 10, 2022 14:29
-
-
Save frenchypeanut/6c6e9e24da34d014215a6632bc077f04 to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.4; | |
import {ERC721} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol"; | |
import {Counters} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Counters.sol"; | |
/// @dev This contract is only used for testing purposes | |
contract MockERC721 is ERC721 { | |
using Counters for Counters.Counter; | |
Counters.Counter private _tokenIds; | |
string _tokenBaseURI; | |
constructor(string memory tokenName, string memory tokenSymbol) | |
ERC721(tokenName, tokenSymbol) | |
{} | |
function mint(address to_) external returns (uint256) { | |
uint256 currentTokenId = _tokenIds.current(); | |
_mint(to_, currentTokenId); | |
_tokenIds.increment(); | |
return currentTokenId; | |
} | |
function setTokenBaseURI(string memory baseURI) external { | |
_tokenBaseURI = baseURI; | |
} | |
function _baseURI() internal view virtual override returns (string memory) { | |
return _tokenBaseURI; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment