Created
February 15, 2022 00:41
-
-
Save EtherTyper/dc44fb06ddd886820c8d1eb20c6dfb65 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.12-nightly.2022.2.10+commit.1210c3e6.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
// contracts/GameItem.sol | |
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; | |
import "@openzeppelin/contracts/utils/Counters.sol"; | |
contract MonkeNPC is ERC721URIStorage { | |
using Counters for Counters.Counter; | |
Counters.Counter private tokenIds; | |
constructor() ERC721("True Art", "MONKE") { | |
awardItem(0x9b78dcf2FF15C32F1E33673268e5aC0f5270DA95, "https://i.ytimg.com/vi/eMonGZEB0Ik/maxresdefault.jpg"); | |
} | |
function awardItem(address player, string memory tokenURI) | |
private | |
returns (uint256) | |
{ | |
uint256 newItemId = tokenIds.current(); | |
_mint(player, newItemId); | |
_setTokenURI(newItemId, tokenURI); | |
tokenIds.increment(); | |
return newItemId; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment