-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
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 4f71a02
Correct spelling errors and interface name, thanks @Beskhue
fulldecent 29f88cc
Add "title" as considered alternative, thanks @TCOA
fulldecent e28b0ee
Undo time travel, thanks @pirapira
fulldecent 2fd4768
"This is a" language, thanks @pirapira
fulldecent f3765be
At risk of making this more boring to read, remove flavor text, thank…
fulldecent 001b67b
Clarify real estate transferrence fees, thank you @TCOA
fulldecent c39a9f5
Use "unusable", thanks @TCOA
fulldecent 8636d7b
occurred
fulldecent f53cc2d
Clean up Accept wording
fulldecent 6754461
Clarify invalid deeds and counting
fulldecent 1ca7dfb
Fix signature, thanks @Beskhue
fulldecent c0e6345
Use interface keyword
fulldecent ea4ed40
Add deed name, rename return variables
fulldecent 6149ecc
Update deed word choice explanation
fulldecent 481e999
remove deedName
fulldecent 2b32af6
fix markdown language
fulldecent 7046c02
Add implementation, thank you Nastassia Sachs
fulldecent ddd2525
Provide illustration for scaling use case
fulldecent 8743a22
Eat my words, add the transfer function
fulldecent 2b4971e
Depend on 165
fulldecent f8fcf19
Switch to latest Solidity compiler
fulldecent dd3396a
Add note about id choice
fulldecent 290f31c
Add note as 165 progresses through standardization
fulldecent d45177e
Add a second implementation
fulldecent 992bbff
Add operators extension, a starting point
fulldecent 1d613ba
Specify functions that cannot throw
fulldecent 792bf05
Better address BC
fulldecent 1a1295c
Harmonize this standard to results from the ETHDenver event
fulldecent e694c6d
Use strong SHALL NOT language, thank you @carloschida
fulldecent ab00c60
Update operator language
fulldecent 21e0d24
Rename to assets
fulldecent 29cf090
Correct typos in JSON schema
fulldecent 868a208
Remove my name as interface author, that isn't helping anything
fulldecent 39396a5
Fix typo
fulldecent 3442342
ERC-165 is now accepted, add strong support for 820 extension of 165
fulldecent 7857e7d
Merge branch 'patch-2' into reconsider-deed-name
fulldecent 2a56e50
Allow to query the approved contracts
fulldecent 74dadcc
Add transfer security, give everything else a once-over
fulldecent 707cb55
Merge branch 'patch-2' into reconsider-deed-name
fulldecent 223e46c
More draft wording changes
fulldecent 7e83455
Link to mentioned Solidity bug
fulldecent 1eeddf7
Merge pull request #2 from fulldecent/reconsider-deed-name
fulldecent e847ffe
Use a better magic value, clarify callback, thanks @abandeali1
fulldecent 89d0162
Bytes, not bytes[], thanks @sz-piotr
fulldecent 2bddd12
Update transfer naming and interface IDs
fulldecent e855ea6
Make getApproved constant view
fulldecent 7304cca
Update eip-721.md
fulldecent bed6978
Correct reference name
fulldecent 3d22a00
Update eip-721.md
fulldecent 438c09e
Move all links to separate references section
fulldecent 19a5f63
Correct whitespace
fulldecent 39687dc
Cosmetic change, remove return name, thank you @nanolucas
fulldecent 39067a2
Fix broken link
fulldecent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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); | ||
|
@@ -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.", | ||
} | ||
} | ||
|
@@ -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 | ||
|
@@ -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). | ||
- [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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ethereum/solidity#3494 seems to have already been fixed |
||
|
@@ -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) | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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