Closed ghost closed 2 years ago
@renlulu Good question.
In favor of the Remote Fetch, I will only keep the read-only transitions that contain important logic (e.g. calculate royalty amount):
RoyaltyInfo
(calculates royalty amount based on the sale price)TokenURI
(provides the standard format)Also, to retrieve the immutable parameters I've added token_name
and token_symbol
fields for remote fetch.
With this approach, the transitions that provide the immutable parameter, are removed:
Name
Symbol
One thing I am curious about is the standardization of TransferFrom
.
So for existing wallet developers such as ZilPay, would it be difficult for them to support both ZRC-1 and ZRC-6 NFT since ZRC-6 transfer is not backward compatible with ZRC-1?
For ZRC-6 the great design is the highest value. We redesigned the contract and backward compatibility is not expected.
Transfer
of ZRC-1 is unnecessary and only complicates things.
Therefore, we should not support it.
After internal discussion, we decide to drop RoyaltyInfo
and TokenURI
transitions.
callback is the only way to get the result from the transition and using callbacks can complicate logic easily in other contracts. e.g. marketplace contracts.
Although we can have a stricter standard by using the transitions, we value simplicity more. Therefore we use remote fetch for the royalty information and token URI retrieval.
Do you think we should add BatchTransfer as optional transition?
Yes, I think we should add BatchTransferFrom
since we decided to include BatchMint
Description
ZRC-6 defines a new minimum interface of an NFT smart contract while improving upon ZRC-1.
The main advantages of this standard are:
ZRC-6 standardizes royalty information retrieval with a percentage-based royalty fee model and unit-less royalty payments to a single address. Funds will be paid for secondary sales only if a marketplace chooses to implement royalty payments. Marketplace contracts should transfer the actual funds.
ZRC-6 standardizes token URI with the concatenation of base token URI and token ID. A token URI is an HTTP or IPFS URL. This URL must return a JSON blob of data with the metadata for the NFT when queried.
ZRC-6 is designed for remote state read (
x <- & c.f
) such that logic to get data from a ZRC-6 contract is straightforward. ZRC-6 exposes immutable parameters via mutable fields and includes only transitions that mutate the state of the contract.ZRC-6 is designed for failure. Therefore minting, burning, and token transfers are pausable.
ZRC-6 features batch operations for minting, burning and token transfers such that only a single transaction is required.
ZRC-6 features a single transition for token transfer with destination validation. The transition can be called by a token owner, a spender, or an operator. ZRC-6 prevents transferring tokens to the zero address or the address of a ZRC-6 contract.
ZRC-6 is compatible with ZRC-X since every callback name is prefixed with
ZRC6_
.Motivation
Many of the largest NFT marketplaces have implemented incompatible royalty payment solutions.
The marketplace builders had to handle inconsistent token URIs.
Using callbacks to get data can complicate the logic easily. Unlike immutable parameters, mutable fields are available for remote state read.
Without an emergency stop mechanism, it's hard to respond to bugs and vulnerabilities gracefully.
Without batch operations, it can be very inefficient to transfer or mint multiple tokens with multiple transactions.
ZRC-1 includes
Transfer
andTransferFrom
for the token transfer. The two transitions have the same type signature and the only difference is the access control. This has added unnecessary complexity. ZRC-1 does not validate the destination for token transfer and it is not safe.The ZRC-1 and ZRC-2 contracts can share the same callback names. Contracts must have unique names for callback transitions.
How to run contract tests
Zilliqa Isolated Server Container
The Isolated Server container image is available from Docker Hub since Oct 6, 2021. I asked for it to be public so that developers can easily use it for contract testing.
To run Isolated Server Container, use this command:
For more details, visit here
Tests in Parallel
To run contract tests in parallel with Jest, you can set maxWorkers and use genesis account per worker.
This can reduce the test duration significantly when you are running a large test suite.
References