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

EIP-721 Non-Fungible Token Standard #841

Merged
merged 54 commits into from
Mar 9, 2018
Merged
Changes from 5 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
31ed49e
EIP-721 Deed Standard
fulldecent Jan 24, 2018
4f71a02
Correct spelling errors and interface name, thanks @Beskhue
fulldecent Jan 24, 2018
29f88cc
Add "title" as considered alternative, thanks @TCOA
fulldecent Jan 24, 2018
e28b0ee
Undo time travel, thanks @pirapira
fulldecent Jan 24, 2018
2fd4768
"This is a" language, thanks @pirapira
fulldecent Jan 24, 2018
f3765be
At risk of making this more boring to read, remove flavor text, thank…
fulldecent Jan 24, 2018
001b67b
Clarify real estate transferrence fees, thank you @TCOA
fulldecent Jan 24, 2018
c39a9f5
Use "unusable", thanks @TCOA
fulldecent Jan 24, 2018
8636d7b
occurred
fulldecent Jan 24, 2018
f53cc2d
Clean up Accept wording
fulldecent Jan 27, 2018
6754461
Clarify invalid deeds and counting
fulldecent Jan 28, 2018
1ca7dfb
Fix signature, thanks @Beskhue
fulldecent Jan 28, 2018
c0e6345
Use interface keyword
fulldecent Jan 28, 2018
ea4ed40
Add deed name, rename return variables
fulldecent Feb 2, 2018
6149ecc
Update deed word choice explanation
fulldecent Feb 2, 2018
481e999
remove deedName
fulldecent Feb 14, 2018
2b32af6
fix markdown language
fulldecent Feb 14, 2018
7046c02
Add implementation, thank you Nastassia Sachs
fulldecent Feb 15, 2018
ddd2525
Provide illustration for scaling use case
fulldecent Feb 15, 2018
8743a22
Eat my words, add the transfer function
fulldecent Feb 16, 2018
2b4971e
Depend on 165
fulldecent Feb 16, 2018
f8fcf19
Switch to latest Solidity compiler
fulldecent Feb 16, 2018
dd3396a
Add note about id choice
fulldecent Feb 16, 2018
290f31c
Add note as 165 progresses through standardization
fulldecent Feb 16, 2018
d45177e
Add a second implementation
fulldecent Feb 16, 2018
992bbff
Add operators extension, a starting point
fulldecent Feb 16, 2018
1d613ba
Specify functions that cannot throw
fulldecent Feb 16, 2018
792bf05
Better address BC
fulldecent Feb 16, 2018
1a1295c
Harmonize this standard to results from the ETHDenver event
fulldecent Feb 19, 2018
e694c6d
Use strong SHALL NOT language, thank you @carloschida
fulldecent Feb 23, 2018
ab00c60
Update operator language
fulldecent Feb 23, 2018
21e0d24
Rename to assets
fulldecent Feb 23, 2018
29cf090
Correct typos in JSON schema
fulldecent Feb 23, 2018
868a208
Remove my name as interface author, that isn't helping anything
fulldecent Feb 23, 2018
39396a5
Fix typo
fulldecent Feb 23, 2018
3442342
ERC-165 is now accepted, add strong support for 820 extension of 165
fulldecent Feb 23, 2018
7857e7d
Merge branch 'patch-2' into reconsider-deed-name
fulldecent Feb 25, 2018
2a56e50
Allow to query the approved contracts
fulldecent Feb 26, 2018
74dadcc
Add transfer security, give everything else a once-over
fulldecent Feb 26, 2018
707cb55
Merge branch 'patch-2' into reconsider-deed-name
fulldecent Feb 26, 2018
223e46c
More draft wording changes
fulldecent Feb 26, 2018
7e83455
Link to mentioned Solidity bug
fulldecent Feb 26, 2018
1eeddf7
Merge pull request #2 from fulldecent/reconsider-deed-name
fulldecent Feb 27, 2018
e847ffe
Use a better magic value, clarify callback, thanks @abandeali1
fulldecent Feb 27, 2018
89d0162
Bytes, not bytes[], thanks @sz-piotr
fulldecent Feb 28, 2018
2bddd12
Update transfer naming and interface IDs
fulldecent Feb 28, 2018
e855ea6
Make getApproved constant view
fulldecent Mar 1, 2018
7304cca
Update eip-721.md
fulldecent Mar 1, 2018
bed6978
Correct reference name
fulldecent Mar 2, 2018
3d22a00
Update eip-721.md
fulldecent Mar 2, 2018
438c09e
Move all links to separate references section
fulldecent Mar 7, 2018
19a5f63
Correct whitespace
fulldecent Mar 7, 2018
39687dc
Cosmetic change, remove return name, thank you @nanolucas
fulldecent Mar 7, 2018
39067a2
Fix broken link
fulldecent Mar 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions EIPS/eip-721.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ pragma solidity ^0.4.20;
import "./ERC165.sol";

/// @title Required part of ERC-721 Distinguishable Assets Registry
/// @author William Entriken (https://phor.net)
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 (DRAFT) identifier for this interface is 0xb3a99827
/// Note: the ERC-165 identifier for this interface is 0xb3a99827
interface ERC721 /* is ERC165 */ {
/// @dev This emits when ownership of any asset changes by any mechanism.
/// This event emits when assets are created (`from` == 0) and destroyed
Expand Down Expand Up @@ -121,7 +120,7 @@ interface ERC721 /* is ERC165 */ {
/// @param _approved True to appove an operators, false to revoke approval
function setApprovalForAll(address _operateor, boolean _approved) payable;

// CONFORMANCE TO ERC-165 (DRAFT) //////////////////////////////////////////
// CONFORMANCE TO ERC-165 //////////////////////////////////////////////////

/// @notice Query if this implements an interface
/// @param interfaceID The interface identifier, as specified in ERC-165
Expand All @@ -137,9 +136,8 @@ The **metadata extension** is OPTIONAL for ERC-721 implementations (see "caveats

```solidity
/// @title Optional metadata extension to ERC-721 Distinguishable Assets Registry
/// @author William Entriken (https://phor.net)
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 (DRAFT) identifier for this interface is 0x2a786f11
/// Note: the ERC-165 identifier for this interface is 0x2a786f11
interface ERC721Metadata /* is ERC721 */ {
/// @notice A descriptive name for a collection of assets in this contract
function name() external pure returns (string _name);
Expand All @@ -163,15 +161,15 @@ This is the "ERC721 Metadata JSON Schema" referenced above. Learn more about [JS
"type": "object",
"properties": {
"name": {
"type": "string"
"type": "string",
"description": "Identifies the asset to which the DAR grants ownership",
},
"description": {
"type": "string"
"type": "string",
"description": "Describes the asset to which the DAR grants ownership",
},
"image": {
"type": "string"
"type": "string",
"description": "A URI pointing to a resource with mime type image/* representing the asset to which the DAR grants ownership. Consider making any images at a width between 320 and 1080 pixels and aspect ratio between 1.91:1 and 4:5 inclusive.",
}
}
Expand All @@ -182,9 +180,8 @@ The **enumeration extension** is OPTIONAL for ERC-721 implementations (see "cave

```solidity
/// @title Optional enumeration extension to ERC-721 Distinguishable Assets Registry
/// @author William Entriken (https://phor.net)
/// @dev See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
/// Note: the ERC-165 (DRAFT) identifier for this interface is 0x5576ab6a
/// Note: the ERC-165 identifier for this interface is 0x5576ab6a
interface ERC721Enumerable /* is ERC721 */ {
/// @notice Count assets tracked by this contract
/// @return A count of valid assets tracked by this contract, where each one of
Expand Down Expand Up @@ -228,7 +225,7 @@ interface ERC721Enumerable /* is ERC721 */ {

The 0.4.20 Solidity interface grammar is not expressive enough to document the ERC-721 specification. A contract which complies with ERC-721 MUST also abide by the following:

- [Solidity issue #3412](https://github.com/ethereum/solidity/issues/3412): The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: `payable`, implicit nonpayable, `view`, and `pure`. Your implementation must meet the mutability guarantee in this interface or you may meet a stronger guarantee. For example, a `payable` function in this interface may be implemented as nonpayble (no state mutability specified) in your contract. Workraound: until Solidity fixes this issue, you can edit this interface to add stricter mutability before inheriting from your contract.
- [Solidity issue #3412](https://github.com/ethereum/solidity/issues/3412): The above interfaces include explicit mutability guarantees for each function. Mutability guarantees are, in order weak to strong: `payable`, implicit nonpayable, `view`, and `pure`. Your implementation must meet the mutability guarantee in this interface or you may meet a stronger guarantee. For example, a `payable` function in this interface may be implemented as nonpayble (no state mutability specified) in your contract. We expect a later Solidity release will allow your stricter contract to inherit from this interface, but a workaround for version 0.4.20 is that you can edit this interface to add stricter mutability before inheriting from your contract.
- [Solidity issue #3419](https://github.com/ethereum/solidity/issues/3419): A contract that implements `ERC721Metadata` or `ERC721Enumerable` SHALL also implement `ERC721`. ERC-721 implements the requirements of interface [ERC-165](https://github.com/ethereum/EIPs/pull/881).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERC-165 has been merged and can be referenced with https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md

- [Solidity issue #2330](https://github.com/ethereum/solidity/issues/2330): If a function is shown in this specification as `external` then a contract will be compliant if it uses `public` visibility.
- Solidity issues [#3494](https://github.com/ethereum/solidity/issues/3494), [#3544](https://github.com/ethereum/solidity/issues/3544): Use of `this.*.selector` is marked as a warning by Solidity, a future version of Solidity will not mark this as an error.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ethereum/solidity#3494 seems to have already been fixed

Expand Down Expand Up @@ -287,9 +284,9 @@ Creating of new assets and destruction of assets is not included in the specific

**ERC-165 interface**

This specification includes a function `supportsInterface` which is standardized in [ERC-165](https://github.com/ethereum/EIPs/pull/881) (draft pending acceptance). So any contract MAY query your contract to see if it complies with ERC-721 and the extensions. This creates a dependency, which is a risk. However, ERC-165 is an extremely simple proposal, has implementations deployed in the wild for years and the draft meets all EIP requirements for acceptance, including [the new requirements](https://github.com/ethereum/pm/blob/master/All%20Core%20Devs%20Meetings/Meeting%2031.md#10957-decision-process-for-eips) that aren't even documented yet. The lead author of this standard is also the official champion for ERC-165. One EIP reviewer [has "ACK"ed the draft](https://github.com/ethereum/EIPs/pull/881#pullrequestreview-97124296).
This specification includes a function `supportsInterface` which is standardized in [ERC-165](https://github.com/ethereum/EIPs/pull/881). So any contract MAY query your contract to see if it complies with ERC-721 and the extensions.

We chose ERC-165 over competing standard ERC-820 because of maturity. We consider ERC-165 low risk. But ERC-820, as recently as two weeks ago, [discovered a complete show-stopping flaw](https://github.com/ethereum/EIPs/issues/820#issuecomment-362049573). ERC-820 may be a great option, but we deem dependency on that standard an unacceptable risk at this time.
A future EIP may create a global registry of interfaces for contracts. We strongly support such an EIP and it would allow your contract to to implement ERC721Enumerable, ERC721Metadata, or other interfaces by delegating to a separate contract.

**Gas and complexity** (regarding the enumeration extension)

Expand Down