Skip to content

Commit

Permalink
ERC721 OpenZeppelin non-fungible token.
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcardona committed Mar 2, 2021
1 parent b6312e8 commit 7ffb5d4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions contracts/NFT.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// contracts/mynft.sol
// spdx-license-identifier: mit
pragma solidity >= 0.6.2;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract GameItem is ERC721 {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;

constructor() ERC721("GameItem", "ITM") {}

function awardItem(address player, string memory tokenURI)
public
returns (uint256)
{
_tokenIds.increment();

uint256 newItemId = _tokenIds.current();
_mint(player, newItemId);
_setTokenURI(newItemId, tokenURI);

return newItemId;
}
}

0 comments on commit 7ffb5d4

Please sign in to comment.