Update docs
This commit is contained in:
19
docs/modules/api/examples/token/ERC721/GameItem.sol
Normal file
19
docs/modules/api/examples/token/ERC721/GameItem.sol
Normal file
@ -0,0 +1,19 @@
|
||||
// contracts/GameItem.sol
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import {ERC721URIStorage, ERC721} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
|
||||
|
||||
contract GameItem is ERC721URIStorage {
|
||||
uint256 private _nextTokenId;
|
||||
|
||||
constructor() ERC721("GameItem", "ITM") {}
|
||||
|
||||
function awardItem(address player, string memory tokenURI) public returns (uint256) {
|
||||
uint256 tokenId = _nextTokenId++;
|
||||
_mint(player, tokenId);
|
||||
_setTokenURI(tokenId, tokenURI);
|
||||
|
||||
return tokenId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user