ERC721BasicToken
contract ERC721BasicToken
is ERC721Basic
See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md.
Index
Reference
Modifiers
canTransfer
modifier canTransfer(uint256 _tokenId)
Checks msg.sender can transfer a token, by being owner, approved, or operator.
- Parameters:
_tokenId
- uint256 ID of the token to validate
onlyOwnerOf
modifier onlyOwnerOf(uint256 _tokenId)
Guarantees msg.sender is owner of the given token.
- Parameters:
_tokenId
- uint256 ID of the token to validate its ownership belongs to msg.sender
Functions
_burn
function _burn(address _owner, uint256 _tokenId) internal
Reverts if the token does not exist.
- Parameters:
_owner
- address_tokenId
- uint256 ID of the token being burned by the msg.sender
_mint
function _mint(address _to, uint256 _tokenId) internal
Reverts if the given token ID already exists.
- Parameters:
_to
- The address that will own the minted token_tokenId
- uint256 ID of the token to be minted by the msg.sender
addTokenTo
function addTokenTo(address _to, uint256 _tokenId) internal
Internal function to add a token ID to the list of a given address.
- Parameters:
_to
- address representing the new owner of the given token ID_tokenId
- uint256 ID of the token to be added to the tokens list of the given address
approve
function approve(address _to, uint256 _tokenId) public
Can only be called by the token owner or an approved operator.
- Parameters:
_to
- address to be approved for the given token ID_tokenId
- uint256 ID of the token to be approved
balanceOf
function balanceOf(address _owner) public view returns (uint256)
Gets the balance of the specified address.
- Parameters:
_owner
- address to query the balance of- Returns:
- uint256 representing the amount owned by the passed address
checkAndCallSafeTransfer
function checkAndCallSafeTransfer(address _from, address _to, uint256 _tokenId, bytes _data) internal returns (bool)
The call is not executed if the target address is not a contract.
- Parameters:
_from
- address representing the previous owner of the given token ID_to
- target address that will receive the tokens_tokenId
- uint256 ID of the token to be transferred_data
- bytes optional data to send along with the call- Returns:
- whether the call correctly returned the expected magic value
clearApproval
function clearApproval(address _owner, uint256 _tokenId) internal
Reverts if the given address is not indeed the owner of the token.
- Parameters:
_owner
- owner of the token_tokenId
- uint256 ID of the token to be transferred
exists
function exists(uint256 _tokenId) public view returns (bool)
Returns whether the specified token exists.
- Parameters:
_tokenId
- uint256 ID of the token to query the existence of- Returns:
- whether the token exists
getApproved
function getApproved(uint256 _tokenId) public view returns (address)
Gets the approved address for a token ID, or zero if no address set.
- Parameters:
_tokenId
- uint256 ID of the token to query the approval of- Returns:
- address currently approved for the given token ID
isApprovedForAll
function isApprovedForAll(address _owner, address _operator) public view returns (bool)
Tells whether an operator is approved by a given owner.
- Parameters:
_owner
- owner address which you want to query the approval of_operator
- operator address which you want to query the approval of- Returns:
- bool whether the given operator is approved by the given owner
isApprovedOrOwner
function isApprovedOrOwner(address _spender, uint256 _tokenId) internal view returns (bool)
Returns whether the given spender can transfer a given token ID.
- Parameters:
_spender
- address of the spender to query_tokenId
- uint256 ID of the token to be transferred- Returns:
- bool whether the msg.sender is approved for the given token ID, is an operator of the owner, or is the owner of the token
ownerOf
function ownerOf(uint256 _tokenId) public view returns (address)
Gets the owner of the specified token ID.
- Parameters:
_tokenId
- uint256 ID of the token to query the owner of- Returns:
- owner address currently marked as the owner of the given token ID
removeTokenFrom
function removeTokenFrom(address _from, uint256 _tokenId) internal
Internal function to remove a token ID from the list of a given address.
- Parameters:
_from
- address representing the previous owner of the given token ID_tokenId
- uint256 ID of the token to be removed from the tokens list of the given address
safeTransferFrom
function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes _data) public
Requires the msg sender to be the owner, approved, or operator.
- Modifiers:
- canTransfer
- Parameters:
_from
- current owner of the token_to
- address to receive the ownership of the given token ID_tokenId
- uint256 ID of the token to be transferred_data
- bytes data to send along with a safe transfer check
safeTransferFrom
function safeTransferFrom(address _from, address _to, uint256 _tokenId) public
Requires the msg sender to be the owner, approved, or operator.
- Modifiers:
- canTransfer
- Parameters:
_from
- current owner of the token_to
- address to receive the ownership of the given token ID_tokenId
- uint256 ID of the token to be transferred
setApprovalForAll
function setApprovalForAll(address _to, bool _approved) public
An operator is allowed to transfer all tokens of the sender on their behalf.
- Parameters:
_to
- operator address to set the approval_approved
- representing the status of the approval to be set
transferFrom
function transferFrom(address _from, address _to, uint256 _tokenId) public
Requires the msg sender to be the owner, approved, or operator.
- Modifiers:
- canTransfer
- Parameters:
_from
- current owner of the token_to
- address to receive the ownership of the given token ID_tokenId
- uint256 ID of the token to be transferred