Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EIP-6047: Extend ERC-721 to Support balance counting via Transfer event #6047

Merged
merged 18 commits into from
Feb 24, 2023
45 changes: 45 additions & 0 deletions EIPS/eip-6047.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
eip: 6047
title: Mandate emitting Transfer for EIP-721
description: Mandate emitting Transfer event for EIP-721 NFTs regardless whether minting / transferring occurs during or outside of contract creation.
author: Zainan Victor Zhou (@xinbenlv)
discussions-to: https://ethereum-magicians.org/t/eip-xxx-require-erc721-to-always-emit-transfer/11894
status: Draft
type: Standards Track
category: ERC
created: 2022-11-26
requires: 721
---

## Abstract

[EIP-721](./eip-721.md) requires `Transfer` event to be emitted whenever a transfer or mint(i.e. transfer from `0x0`) or burn (i.g. transfer to `0x0`) occurs, EXCEPT for when during Contract creation. This EIP instead MANDATES compliant contract to ALWAYS emit `Transfer` event regardless whether such transfer occurs in or outside of contract creation.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## Motivation

[EIP-721](./eip-721.md) requires `Transfer` event to be emitted whenever a transfer or mint(i.e. transfer from `0x0`) or burn (i.g. transfer to `0x0`) occurs, EXCEPT for when during Contract creation. Due to this exception granted in EIP-721 standard, compliant contracts could mint NFTs during contract creation without event being emitted. Unlike EIP-721, the [EIP-1155](./eip-1155.md) standard mandates event to be emitted regardless of whether such minting occurs during or outside of contract creation. This allows a indexing service or any off-chain service to reliably capture and account for token creation.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

This EIP removes said exception granted by EIP-721 and mandate emitting Transfer for EIP-721 during contract creation and thus all indexers and off-chain applications can account for token minting, burning and transferring only relying on EIP-721 Transfer event streams.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## 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 contract MUST implement [EIP-721](./eip-721.md)
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved
2. Compliant contract MUST emit `Transfer` event to be emitted whenever a token transfer or mint(i.e. a token transfer from `0x0`) or burn (i.g. transfer to `0x0`) occurs, except for when during Contract creation, regardless of whether such transfer, mint or burn occurs during or outside of contract creation.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## Rationale

1. To allow accounting for minting during contract creation, there is also option to just create and emit new event type such as, `Creation`, instead of emitting the same `Transfer`. We choose not to go with such option, but instead just strengthening the EIP-721 requirement, which maximize the backwards compatibility.

## Backwards Compatibility

This EIP is designed to be fully backward compatible with EIP-721.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## Security Considerations

No new security concern is introduced.
xinbenlv marked this conversation as resolved.
Show resolved Hide resolved

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).