Open cedricfung opened 3 years ago
It's possible to make ERC721 or even ERC1155 work on Mixin Messenger without changes on the Kernel.
Every NFT of ERC721 has a distinct uint256 ID, we can make the ERC721 contract as a normal Kernel asset. The messenger API will only allow a whole and single NFT transfer, the transfer will make a transaction on the Kernel with a single UTXO, and the uint256 ID is included in the extra.
The ERC721 account API is the same as a normal fungible asset account. Let's say the ERC721 account has a balance of 7, then it must own 7 UTXO with 7 distinct uint256 ID extra. Beside the basic account API, list an account of ERC721 can return all the UTXOs. And to make a transfer for this kind of account, the UTXO ID must be included.
ERC1155 is no different either, just allow an account has multiple UTXOs with the same uint256 ID extra.
So this NFT feature is carefully enabled by Mixin Messenger and other wallets, if they have bad implementations, they may destroy their NFT tokens. It's the consensus of wallets, without any Mixin Kernel changes.
For some popular NFT operations: e.g. mint a new unit, burn a unit, it's easy to make it free on Mixin Messenger.
event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId);
We could make an ERC721 contract:
The IMPORTANT thing is Mixin Messenger API should never allow these special UTXOs being seperated, and always retain the UTXO extra data.
How do we handle those expirable tokens, e.g. ENS?
How do we handle those expirable tokens, e.g. ENS?
A NFT UTXO should include both the token ID and deposit address in the extra. Thus every NFT is bind to the address. Whenever the NFT on an address expires, it doesn't affect others to deposit again.
And we also must ensure that a NFT token ID can't have more than 1 copy for 1 address. e.g. a domain cedric.eth on address A and B are different, and on address A, you can only have on domain cedric.eth.
And we should never mark an NFT dead or inactive or frozen, because the expired one can be reactivated at any time without change the amount.
Is it possible to support NFT in Mixin Messenger?