1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

NFTメモ

Posted at

pragma solidity >0.5.0 <0.7.0;

/**
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
import "@openzeppelin/contracts/drafts/Counters.sol";
**/
// black "https://ipfs.io/ipfs/xxxxx"
// white "https://ipfs.io/ipfs/xxxxx"

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/ERC721.sol";
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/90ed1af972299070f51bf4665a85da56ac4d355e/contracts/utils/Counters.sol";
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/90ed1af972299070f51bf4665a85da56ac4d355e/contracts/math/SafeMath.sol";
//import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/90ed1af972299070f51bf4665a85da56ac4d355e/contracts/math/Math.sol";

contract GameItem is ERC721 {
//using Counters for Counters.Counter;
//Counters.Counter private _tokenIds;
uint256 internal nextTokenId = 0;

constructor() ERC721("xxxxxx", "ABC") public {
}

function awardItem(address player, string memory tokenURI) public returns (uint256) {

// function awardItem(address player) public returns (uint256) {
// _tokenIds.increment();

    // uint256 newItemId = _tokenIds.current();
    // uint256 newItemId = uint8(now);
    uint256 newItemId = nextTokenId;
    nextTokenId = nextTokenId.add(1);
    //_mint(player, newItemId);
    _mint(player, newItemId);
    //_setTokenURI(newItemId, "https://ipfs.io/ipfs/xxxxxxxxxxxx");
    _setTokenURI(newItemId, tokenURI);

    return newItemId;
}

}

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?