Look at this implementation, I can see that ERC721 contracts keep track of an owner (identified by its address) for each single token (identified by its token ID, a 256 bit number):
mapping (uint256 => address) internal tokenOwner;
So when there's a transfer, from, to AND a token ID have to be provided. So far so good.
What I don't understand is the semantics of the balance operation.
/**
* @dev Returns the number of NFTs owned by `_owner`. NFTs assigned to the zero address are
* considered invalid, and this function throws for queries about the zero address.
* @param _owner Address for whom to query the balance.
*/
function balanceOf(
address _owner
)
external
view
returns (uint256)
{
require(_owner != address(0));
return ownerToNFTokenCount[_owner];
}
If each token is non-fungible and therefore by definition unique, then how can there be more than one of each? I.e. what does it mean when the balance function returns more than 1?
If each token is non-fungible and therefore by definition unique
Of course they're unique but doesn't mean users can't hold more than one of that token, just that each is different