-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patherc721.sol
29 lines (23 loc) · 891 Bytes
/
erc721.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721Holder.sol";
import "@openzeppelin/contracts/drafts/Counters.sol";
contract ERC721FullContract is ERC721Full, ERC721Holder {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor(
string memory name, //代币名称
string memory symbol,//代币缩写
string memory baseURI//代币基本地址
) ERC721Full(name, symbol) public {
_setBaseURI(baseURI);
}
function awardItem(address player, string memory tokenURI) public returns (uint256) {
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(player, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
}