1+ // SPDX-License-Identifier: MIT
2+
3+ pragma solidity ^ 0.8.1 ;
4+
5+ import "@openzeppelin/contracts/utils/introspection/IERC165.sol " ;
6+
7+ /**
8+ * @title ERC-721 Non-Fungible Token Standard
9+ * @dev See https://eips.ethereum.org/EIPS/eip-721
10+ * Note: the ERC-165 identifier for this interface is 0x80ac58cd.
11+ */
12+ interface IERC721 is IERC165 {
13+ /**
14+ * @dev This emits when ownership of any NFT changes by any mechanism.
15+ * This event emits when NFTs are created (`from` == 0) and destroyed
16+ * (`to` == 0). Exception: during contract creation, any number of NFTs
17+ * may be created and assigned without emitting Transfer. At the time of
18+ * any transfer, the approved address for that NFT (if any) is reset to none.
19+ */
20+ event Transfer (address indexed _from , address indexed _to , uint256 indexed _tokenId );
21+
22+ /**
23+ * @dev This emits when the approved address for an NFT is changed or
24+ * reaffirmed. The zero address indicates there is no approved address.
25+ * When a Transfer event emits, this also indicates that the approved
26+ * address for that NFT (if any) is reset to none.
27+ */
28+ event Approval (address indexed _owner , address indexed _approved , uint256 indexed _tokenId );
29+
30+ /**
31+ * @dev This emits when an operator is enabled or disabled for an owner.
32+ * The operator can manage all NFTs of the owner.
33+ */
34+ event ApprovalForAll (address indexed _owner , address indexed _operator , bool _approved );
35+
36+ /**
37+ * @notice Count all NFTs assigned to an owner
38+ * @dev NFTs assigned to the zero address are considered invalid, and this
39+ * function throws for queries about the zero address.
40+ * @param _owner An address for whom to query the balance
41+ * @return The number of NFTs owned by `_owner`, possibly zero
42+ */
43+ function balanceOf (address _owner ) external view returns (uint256 );
44+
45+ /**
46+ * @notice Find the owner of an NFT
47+ * @dev NFTs assigned to zero address are considered invalid, and queries
48+ * about them do throw.
49+ * @param _tokenId The identifier for an NFT
50+ * @return The address of the owner of the NFT
51+ */
52+ function ownerOf (uint256 _tokenId ) external view returns (address );
53+
54+ /**
55+ * @notice Transfers the ownership of an NFT from one address to another address
56+ * @dev Throws unless `msg.sender` is the current owner, an authorized
57+ * operator, or the approved address for this NFT. Throws if `_from` is
58+ * not the current owner. Throws if `_to` is the zero address. Throws if
59+ * `_tokenId` is not a valid NFT. When transfer is complete, this function
60+ * checks if `_to` is a smart contract (code size > 0). If so, it calls
61+ * `onERC721Received` on `_to` and throws if the return value is not
62+ * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`.
63+ * @param _from The current owner of the NFT
64+ * @param _to The new owner
65+ * @param _tokenId The NFT to transfer
66+ * @param data Additional data with no specified format, sent in call to `_to`
67+ */
68+ function safeTransferFrom (address _from , address _to , uint256 _tokenId , bytes calldata data ) external payable ;
69+
70+ /**
71+ * @notice Transfers the ownership of an NFT from one address to another address
72+ * @dev This works identically to the other function with an extra data parameter,
73+ * except this function just sets data to "".
74+ * @param _from The current owner of the NFT
75+ * @param _to The new owner
76+ * @param _tokenId The NFT to transfer
77+ */
78+ function safeTransferFrom (address _from , address _to , uint256 _tokenId ) external payable ;
79+
80+ /**
81+ * @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE
82+ * TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE
83+ * THEY MAY BE PERMANENTLY LOST
84+ * @dev Throws unless `msg.sender` is the current owner, an authorized
85+ * operator, or the approved address for this NFT. Throws if `_from` is
86+ * not the current owner. Throws if `_to` is the zero address. Throws if
87+ * `_tokenId` is not a valid NFT.
88+ * @param _from The current owner of the NFT
89+ * @param _to The new owner
90+ * @param _tokenId The NFT to transfer
91+ */
92+ function transferFrom (address _from , address _to , uint256 _tokenId ) external payable ;
93+
94+ /**
95+ * @notice Change or reaffirm the approved address for an NFT
96+ * @dev The zero address indicates there is no approved address.
97+ * Throws unless `msg.sender` is the current NFT owner, or an authorized
98+ * operator of the current owner.
99+ * @param _approved The new approved NFT controller
100+ * @param _tokenId The NFT to approve
101+ */
102+ function approve (address _approved , uint256 _tokenId ) external payable ;
103+
104+ /**
105+ * @notice Enable or disable approval for a third party ("operator") to manage
106+ * all of `msg.sender`'s assets
107+ * @dev Emits the ApprovalForAll event. The contract MUST allow
108+ * multiple operators per owner.
109+ * @param _operator Address to add to the set of authorized operators
110+ * @param _approved True if the operator is approved, false to revoke approval
111+ */
112+ function setApprovalForAll (address _operator , bool _approved ) external ;
113+
114+ /**
115+ * @notice Get the approved address for a single NFT
116+ * @dev Throws if `_tokenId` is not a valid NFT.
117+ * @param _tokenId The NFT to find the approved address for
118+ * @return The approved address for this NFT, or the zero address if there is none
119+ */
120+ function getApproved (uint256 _tokenId ) external view returns (address );
121+
122+ /**
123+ * @notice Query if an address is an authorized operator for another address
124+ * @param _owner The address that owns the NFTs
125+ * @param _operator The address that acts on behalf of the owner
126+ * @return True if `_operator` is an approved operator for `_owner`, false otherwise
127+ */
128+ function isApprovedForAll (address _owner , address _operator ) external view returns (bool );
129+ }
0 commit comments