Alert Source Discuss
đźš§ Stagnant Standards Track: SRC

SRC-6047: SRC-721 Balance indexing via Transfer event

Mandates emitting the Transfer event for SRC-721 NFTs during contract creation

Authors Zainan Victor Zhou (@xinbenlv)
Created 2022-11-26
Discussion Link https://sila-magicians.org/t/sip-xxx-require-src721-to-always-emit-transfer/11894
Requires SIP-721

Abstract

This SIP extends SRC-721 to allow the tracking and indexing of NFTs by mandating that a pre-existing event be emitted during contract creation.

SRC-721 requires a Transfer event to be emitted whenever a transfer or mint (i.e. transfer from 0x0) or burn (i.e. transfer to 0x0) occurs, except during contract creation. This SIP mandates that compliant contracts emit a Transfer event regardless of whether it occurs during or after contract creation.

Motivation

SRC-721 requires a Transfer event to be emitted whenever a transfer or mint (i.e. transfer from 0x0) or burn (i.e. transfer to 0x0) occurs, EXCEPT for during contract creation. Due to this exception, contracts can mint NFTs during contract creation without the event being emitted. Unlike SRC-721, the SRC-1155 standard mandates events to be emitted regardless of whether such minting occurs during or outside of contract creation. This allows an indexing service or any off-chain service to reliably capture and account for token creation.

This SIP removes this exception granted by SRC-721 and mandates emitting the Transfer event for SRC-721 during contract creation. In this manner, indexers and off-chain applications can track token minting, burning, and transferring while relying only on SRC-721’s Transfer event log.

Specification

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.

  1. Compliant contracts MUST implement SRC-721
  2. Compliant contracts MUST emit a Transfer event whenever a token is transferred, minted (i.e. transferred from 0x0), or burned (i.e. transferred to 0x0), including during contract creation.

Rationale

Using the existing Transfer event instead of creating a new event (e.g. Creation) allows this SIP to be backward compatible with existing indexers.

Backwards Compatibility

All contracts compliant with this SIP are compliant with SRC-721. However, not all contracts compliant with SRC-721 are compliant with this SIP.

Security Considerations

No new security concerns.

Copyright and related rights waived via CC0.

Citation

Please cite this document as:

Zainan Victor Zhou (@xinbenlv), "SRC-6047: SRC-721 Balance indexing via Transfer event [STAGNANT]," Sila Improvement Proposals, no. 6047, November 2022. Available: https://sips.sila.org/SIPS/sip-6047.