Skip to content

Commit

Permalink
per comments from nventuro, add an event to flag the existence of thi…
Browse files Browse the repository at this point in the history
…s token ID
  • Loading branch information
KaiRo-at committed May 29, 2020
1 parent 1f6d1fe commit 59315b5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion contracts/token/ERC1155/ERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,17 @@ contract ERC1155 is ERC165, IERC1155
/**
* @dev Register a token ID so other contract functionality knows this token
* actually exists and this ID is valid. Minting will automatically call this.
* Also emits an event to flag the existence, see the spec:
* "To broadcast the existence of a token ID with no initial balance, the contract
* SHOULD emit the TransferSingle event from 0x0 to 0x0, with the token creator as
* _operator, and a _value of 0."
* @param id uint256 ID of the token to register
*/
function _registerToken(uint256 id) internal virtual {
_tokenExists[id] = true;
if (!_tokenExists[id]) {
_tokenExists[id] = true;
emit TransferSingle(msg.sender, address(0), address(0), id, 0);
}
}

/**
Expand Down

0 comments on commit 59315b5

Please sign in to comment.