-
Notifications
You must be signed in to change notification settings - Fork 12.4k
ERC721 full implementation #803
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
Changes from 1 commit
1192e68
ca163a8
71cbc51
3745025
559df81
d726c79
54a1d2e
851685c
3cef880
6f180a6
6fbe771
626742e
95a1f9a
15f9556
b332995
f4748da
fb4f728
6b98e4e
3f2ea8a
74db03b
981c6f7
73b77ae
eee5b0e
9deb637
fe6e4ff
4836279
619ae84
2e593f2
6c09d20
37929c8
3676b55
7815cc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -195,13 +195,12 @@ contract ERC721BasicToken is ERC721Basic { | |
| require(_from != address(0)); | ||
| require(_to != address(0)); | ||
| require(_to != ownerOf(_tokenId)); | ||
|
||
| require(ownerOf(_tokenId) == _from); | ||
|
|
||
| clearApproval(_from, _tokenId); | ||
| removeToken(_from, _tokenId); | ||
| addToken(_to, _tokenId); | ||
|
|
||
| require(!_safe || checkSafeTransfer(_from, _to, _tokenId, _data)); | ||
| require(!_safe || checkAndCallSafeTransfer(_from, _to, _tokenId, _data)); | ||
|
||
|
|
||
| Transfer(_from, _to, _tokenId); | ||
| } | ||
|
|
@@ -240,7 +239,7 @@ contract ERC721BasicToken is ERC721Basic { | |
| tokenOwner[_tokenId] = 0; | ||
| } | ||
|
|
||
| function checkSafeTransfer(address _from, address _to, uint256 _tokenId, bytes _data) internal returns (bool) { | ||
| function checkAndCallSafeTransfer(address _from, address _to, uint256 _tokenId, bytes _data) internal returns (bool) { | ||
| return !_to.isContract() || | ||
|
||
| (ERC721Receiver(_to).onERC721Received.gas(SAFE_TRANSFER_GAS_STIPEND)(_from, _tokenId, _data) == ERC721_RECEIVED); | ||
|
||
| } | ||
|
|
||
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.
Can we replace all of the
require( addr != address(0) )checks with an internal function likeisValidAddress(addr)? Or is there a gas concern here?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.
I think there are many ways for an address to be "invalid" so I would prefer to just be explicit here that we're checking for the null address.