IERC721
Required interface of an ERC721 compliant contract.
Methods
approve
function approve(address to, uint256 tokenId) external nonpayable
Gives permission to to
to transfer tokenId
token to another account. The approval is cleared when the token is transferred. Only a single account can be approved at a time, so approving the zero address clears previous approvals. Requirements: - The caller must own the token or be an approved operator. - tokenId
must exist. Emits an {Approval} event.
Parameters
Name | Type | Description |
---|
to | address | undefined |
tokenId | uint256 | undefined |
balanceOf
function balanceOf(address owner) external view returns (uint256)
Returns the number of tokens in owner
's account.
Parameters
Name | Type | Description |
---|
owner | address | undefined |
Returns
Name | Type | Description |
---|
_0 | uint256 | undefined |
getApproved
function getApproved(uint256 tokenId) external view returns (address)
Returns the account approved for tokenId
token. Requirements: - tokenId
must exist.
Parameters
Name | Type | Description |
---|
tokenId | uint256 | undefined |
Returns
Name | Type | Description |
---|
_0 | address | undefined |
isApprovedForAll
function isApprovedForAll(address owner, address operator) external view returns (bool)
Returns if the operator
is allowed to manage all of the assets of owner
. See {setApprovalForAll}
Parameters
Name | Type | Description |
---|
owner | address | undefined |
operator | address | undefined |
Returns
Name | Type | Description |
---|
_0 | bool | undefined |
ownerOf
function ownerOf(uint256 tokenId) external view returns (address)
Returns the owner of the tokenId
token. Requirements: - tokenId
must exist.
Parameters
Name | Type | Description |
---|
tokenId | uint256 | undefined |
Returns
Name | Type | Description |
---|
_0 | address | undefined |
safeTransferFrom
function safeTransferFrom(address from, address to, uint256 tokenId) external nonpayable
Safely transfers tokenId
token from from
to to
, checking first that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked. Requirements: - from
cannot be the zero address. - to
cannot be the zero address. - tokenId
token must exist and be owned by from
. - If the caller is not from
, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. - If to
refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.
Parameters
Name | Type | Description |
---|
from | address | undefined |
to | address | undefined |
tokenId | uint256 | undefined |
safeTransferFrom
function safeTransferFrom(address from, address to, uint256 tokenId, bytes data) external nonpayable
Safely transfers tokenId
token from from
to to
. Requirements: - from
cannot be the zero address. - to
cannot be the zero address. - tokenId
token must exist and be owned by from
. - If the caller is not from
, it must be approved to move this token by either {approve} or {setApprovalForAll}. - If to
refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. Emits a {Transfer} event.
Parameters
Name | Type | Description |
---|
from | address | undefined |
to | address | undefined |
tokenId | uint256 | undefined |
data | bytes | undefined |
setApprovalForAll
function setApprovalForAll(address operator, bool _approved) external nonpayable
Approve or remove operator
as an operator for the caller. Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. Requirements: - The operator
cannot be the caller. Emits an {ApprovalForAll} event.
Parameters
Name | Type | Description |
---|
operator | address | undefined |
_approved | bool | undefined |
transferFrom
function transferFrom(address from, address to, uint256 tokenId) external nonpayable
Transfers tokenId
token from from
to to
. WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. Requirements: - from
cannot be the zero address. - to
cannot be the zero address. - tokenId
token must be owned by from
. - If the caller is not from
, it must be approved to move this token by either {approve} or {setApprovalForAll}. Emits a {Transfer} event.
Parameters
Name | Type | Description |
---|
from | address | undefined |
to | address | undefined |
tokenId | uint256 | undefined |
Events
Approval
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId)
Emitted when owner
enables approved
to manage the tokenId
token.
Parameters
Name | Type | Description |
---|
owner indexed | address | undefined |
approved indexed | address | undefined |
tokenId indexed | uint256 | undefined |
ApprovalForAll
event ApprovalForAll(address indexed owner, address indexed operator, bool approved)
Emitted when owner
enables or disables (approved
) operator
to manage all of its assets.
Parameters
Name | Type | Description |
---|
owner indexed | address | undefined |
operator indexed | address | undefined |
approved | bool | undefined |
Transfer
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId)
Emitted when tokenId
token is transferred from from
to to
.
Parameters
Name | Type | Description |
---|
from indexed | address | undefined |
to indexed | address | undefined |
tokenId indexed | uint256 | undefined |