Skip to content

Instantly share code, notes, and snippets.

@coderwithsense
Created January 5, 2025 23:01
Show Gist options
  • Save coderwithsense/b217f79e72b5b3584e4c05d21c0fe3ee to your computer and use it in GitHub Desktop.
Save coderwithsense/b217f79e72b5b3584e4c05d21c0fe3ee 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.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract StoryNFT is ERC721URIStorage, Ownable {
uint256 private _tokenIds;
constructor() ERC721("StoryNFT", "SNFT") Ownable(msg.sender) {}
function mintNFT(address recipient, string memory tokenURI)
public
onlyOwner
returns (uint256)
{
_tokenIds += 1;
uint256 newTokenId = _tokenIds;
_mint(recipient, newTokenId);
_setTokenURI(newTokenId, tokenURI);
return newTokenId;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment