Closed wighawag closed 6 years ago
in issue https://github.com/loomnetwork/erc721x/issues/6
I proposed a fix :
FT have the ERC721x contract address as owner, this way, the, the function exists
remain valid for both FT and NFT.
Then in the ERC721x _mint
function (the one with supply as parameter) you can check existance by calling exists
Fixed in #7, thanks for the find! Let me know if you notice something else, and yes I'll probably go for an EIP/ERC soon to standardize/improve this
Great!
By the way the message here should probably change too : https://github.com/loomnetwork/erc721x/blob/6ebcf394b6276219cd034ab8c80e1861f4790407/contracts/Core/ERC721X/ERC721XTokenNFT.sol#L81 since now FT will also have an owner but this will be the contract itself
Hi, Great to see an another implementation of fungible token, I especially like the fact that it support ERC721 too. We, at @pixowl started thinking going that route too.
On that note though, as you probably realised it leads to ambiguous functions. (
ownerOf
in particular). The way I like to see these tokens (both NFT and FT) in term of the ERC721x interface is that the tokenIds refers to tokenTypes and not token instances. the NFT tokenTypes by having only one instance can technically have an owner since being unique there will only be one owner among all the tokenType instance (since there is only one instance) On the other hand FT cannot have a specified owner since there will be multiple owner among all the instances. As suchownerOf
cannot return any of them.In your implementation you chose to revert the transaction calling
ownerOf
. Did you consider returning the ERC721x contract address itself instead ? or the zero address ? If so why did you chose the revert option ?I am bringing that up since currently in your code, you use the function
exists
to check various function including_mint
andtokenURI
. In thatexists
function you check the owner. If it does not have one, you deem the token to not exist.This seems a bit wrong to me since surely FT token can be definitely said to exist. This would also allow to check if a particular FT token type has been minted without calling
individualSupply
This now brings me to one bug in the ERC721x
_mint
function (which allow to specify a supply): Since you do not check for existence there, we can keep minting the same tokenIds multiple times including an existing NFT ERC721 tokenType. While this could be correct for an FT to increase supply (you should not push it to the allTokens array though) but this would never be correct for NFT.Overall, I like your approach but it would probably benefit to be submitted as EIP/ERC first to improve it. Also a proper spec would be needed for adoption by others.
Are you planning to write a spec as opposed to simply an interface and publish it as an official EIP ?
Looking forward to have a standard for FT and NFT together.