Skip to content

Commit

Permalink
✨ add mock nft contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Web3HackerWorld committed Dec 10, 2023
1 parent 5540032 commit 827a155
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions contracts/MockNFT.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract MockNFT is ERC721, ERC721URIStorage, Ownable {
constructor(address initialOwner)
ERC721("MockNFT", "MNFT")
Ownable(initialOwner)
{}

function _baseURI() internal pure override returns (string memory) {
return "ipfs://bafybeifkbaxlcwp4pyfrqcx7blvebzwvenb5ef63o7jbfl4qj5cuna5wtm/";
}

function safeMint(address to, uint256 tokenId, string memory uri)
public
onlyOwner
{
_safeMint(to, tokenId);
_setTokenURI(tokenId, uri);
}

// The following functions are overrides required by Solidity.

function tokenURI(uint256 tokenId)
public
view
override(ERC721, ERC721URIStorage)
returns (string memory)
{
return super.tokenURI(tokenId);
}

function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721, ERC721URIStorage)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
}

0 comments on commit 827a155

Please sign in to comment.