Created
February 9, 2019 07:01
-
-
Save yuyasugano/808067de8d691c96819f7dce6294e250 to your computer and use it in GitHub Desktop.
ERC721XTokenNFT.sol modification for tokenType mapping
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
mapping(uint256 => uint256) tokenType; | |
uint256 constant NFT = 1; | |
uint256 constant FT = 2; | |
/** | |
* @dev Returns whether the specified token exists | |
* @param _tokenId uint256 ID of the token to query the existence of | |
* @return whether the token exists | |
*/ | |
function exists(uint256 _tokenId) public view returns (bool) { | |
// address owner = tokenOwner[_tokenId]; | |
// return owner != address(0); | |
return tokenType[_tokenId] != 0; | |
} | |
function _mint(uint256 _tokenId, address _to) internal { | |
require(!exists(_tokenId), "Error: Tried to mint duplicate token id"); | |
_updateTokenBalance(_to, _tokenId, 1, ObjectLib.Operations.REPLACE); | |
tokenOwner[_tokenId] = _to; | |
tokenType[_tokenId] = NFT; | |
allTokens.push(_tokenId); | |
emit Transfer(address(this), _to, _tokenId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment