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

Implement ERC721 standard #627

Prev Previous commit
Next Next commit
Fix solint errors
  • Loading branch information
facuspagnuolo committed Jan 17, 2018
commit af337047a4eb323b2c914bf71eeb0b15e33a65a5
2 changes: 1 addition & 1 deletion contracts/mocks/ERC721TokenMock.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pragma solidity ^0.4.18;

import '../token/ERC721Token.sol';
import "../token/ERC721Token.sol";

/**
* @title ERC721TokenMock
Expand Down
13 changes: 7 additions & 6 deletions contracts/token/ERC721Token.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pragma solidity ^0.4.18;

import './ERC721.sol';
import '../math/SafeMath.sol';
import "./ERC721.sol";
import "../math/SafeMath.sol";

/**
* @title ERC721Token
Expand Down Expand Up @@ -97,9 +97,10 @@ contract ERC721Token is ERC721 {
function approve(address _to, uint256 _tokenId) public onlyOwnerOf(_tokenId) {
address owner = ownerOf(_tokenId);
require(_to != owner);
if(approvedFor(_tokenId) == 0 && _to == 0) return;
tokenApprovals[_tokenId] = _to;
Approval(owner, _to, _tokenId);
if (approvedFor(_tokenId) != 0 || _to != 0) {
tokenApprovals[_tokenId] = _to;
Approval(owner, _to, _tokenId);
}
}

/**
Expand Down Expand Up @@ -127,7 +128,7 @@ contract ERC721Token is ERC721 {
* @param _tokenId uint256 ID of the token being burned by the msg.sender
*/
function burn(uint256 _tokenId) onlyOwnerOf(_tokenId) internal {
if(approvedFor(_tokenId) != 0) {
if (approvedFor(_tokenId) != 0) {
clearApproval(msg.sender, _tokenId);
}
removeToken(msg.sender, _tokenId);
Expand Down