committed by
Nicolás Venturo
parent
ebd4b5e73d
commit
d20d03c149
@ -32,24 +32,6 @@ contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
|
|||||||
// Mapping from owner to operator approvals
|
// Mapping from owner to operator approvals
|
||||||
mapping (address => mapping (address => bool)) internal operatorApprovals;
|
mapping (address => mapping (address => bool)) internal operatorApprovals;
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Guarantees msg.sender is owner of the given token
|
|
||||||
* @param _tokenId uint256 ID of the token to validate its ownership belongs to msg.sender
|
|
||||||
*/
|
|
||||||
modifier onlyOwnerOf(uint256 _tokenId) {
|
|
||||||
require(ownerOf(_tokenId) == msg.sender);
|
|
||||||
_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev Checks msg.sender can transfer a token, by being owner, approved, or operator
|
|
||||||
* @param _tokenId uint256 ID of the token to validate
|
|
||||||
*/
|
|
||||||
modifier canTransfer(uint256 _tokenId) {
|
|
||||||
require(isApprovedOrOwner(msg.sender, _tokenId));
|
|
||||||
_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
public
|
public
|
||||||
{
|
{
|
||||||
@ -158,8 +140,8 @@ contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
|
|||||||
uint256 _tokenId
|
uint256 _tokenId
|
||||||
)
|
)
|
||||||
public
|
public
|
||||||
canTransfer(_tokenId)
|
|
||||||
{
|
{
|
||||||
|
require(isApprovedOrOwner(msg.sender, _tokenId));
|
||||||
require(_from != address(0));
|
require(_from != address(0));
|
||||||
require(_to != address(0));
|
require(_to != address(0));
|
||||||
|
|
||||||
@ -188,7 +170,6 @@ contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
|
|||||||
uint256 _tokenId
|
uint256 _tokenId
|
||||||
)
|
)
|
||||||
public
|
public
|
||||||
canTransfer(_tokenId)
|
|
||||||
{
|
{
|
||||||
// solium-disable-next-line arg-overflow
|
// solium-disable-next-line arg-overflow
|
||||||
safeTransferFrom(_from, _to, _tokenId, "");
|
safeTransferFrom(_from, _to, _tokenId, "");
|
||||||
@ -213,7 +194,6 @@ contract ERC721BasicToken is SupportsInterfaceWithLookup, ERC721Basic {
|
|||||||
bytes _data
|
bytes _data
|
||||||
)
|
)
|
||||||
public
|
public
|
||||||
canTransfer(_tokenId)
|
|
||||||
{
|
{
|
||||||
transferFrom(_from, _to, _tokenId);
|
transferFrom(_from, _to, _tokenId);
|
||||||
// solium-disable-next-line arg-overflow
|
// solium-disable-next-line arg-overflow
|
||||||
|
|||||||
Reference in New Issue
Block a user