mirror of
https://github.com/status-im/nft-faucet.git
synced 2025-02-24 04:28:29 +00:00
55 lines
1.6 KiB
Solidity
55 lines
1.6 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.4;
|
|
|
|
import "@openzeppelin/contracts@4.5.0/token/ERC721/ERC721.sol";
|
|
import "@openzeppelin/contracts@4.5.0/token/ERC721/extensions/ERC721Enumerable.sol";
|
|
import "@openzeppelin/contracts@4.5.0/token/ERC721/extensions/ERC721URIStorage.sol";
|
|
import "@openzeppelin/contracts@4.5.0/access/Ownable.sol";
|
|
import "@openzeppelin/contracts@4.5.0/utils/Counters.sol";
|
|
|
|
contract NftFaucet is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
|
|
using Counters for Counters.Counter;
|
|
|
|
Counters.Counter private _tokenIdCounter;
|
|
|
|
constructor() ERC721("NftFaucet", "NFAU") {}
|
|
|
|
function safeMint(address to, string memory uri) public {
|
|
uint256 tokenId = _tokenIdCounter.current();
|
|
_tokenIdCounter.increment();
|
|
_safeMint(to, tokenId);
|
|
_setTokenURI(tokenId, uri);
|
|
}
|
|
|
|
// The following functions are overrides required by Solidity.
|
|
|
|
function _beforeTokenTransfer(address from, address to, uint256 tokenId)
|
|
internal
|
|
override(ERC721, ERC721Enumerable)
|
|
{
|
|
super._beforeTokenTransfer(from, to, tokenId);
|
|
}
|
|
|
|
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)
|
|
returns (bool)
|
|
{
|
|
return super.supportsInterface(interfaceId);
|
|
}
|
|
}
|