Skip to content

Commit 253878e

Browse files
add: ERC721Enumerable Interfaces (#196)
1 parent 526201d commit 253878e

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

contracts/interfaces/ISTokensManager.sol

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,25 @@ interface ISTokensManager {
183183
* @return uint256 current token id
184184
*/
185185
function currentIndex() external view returns (uint256);
186+
187+
/// @notice Count NFTs tracked by this contract
188+
/// @return A count of valid NFTs tracked by this contract, where each one of
189+
/// them has an assigned and queryable owner not equal to the zero address
190+
function totalSupply() external view returns (uint256);
191+
192+
/// @notice Enumerate valid NFTs
193+
/// @dev Throws if `_index` >= `totalSupply()`.
194+
/// @param _index A counter less than `totalSupply()`
195+
/// @return The token identifier for the `_index`th NFT,
196+
/// (sort order not specified)
197+
function tokenByIndex(uint256 _index) external view returns (uint256);
198+
199+
/// @notice Enumerate NFTs assigned to an owner
200+
/// @dev Throws if `_index` >= `balanceOf(_owner)` or if
201+
/// `_owner` is the zero address, representing invalid NFTs.
202+
/// @param _owner An address where we are interested in NFTs owned by them
203+
/// @param _index A counter less than `balanceOf(_owner)`
204+
/// @return The token identifier for the `_index`th NFT assigned to `_owner`,
205+
/// (sort order not specified)
206+
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
186207
}

contracts/interfaces/ISTokensManagerV2.sol

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,25 @@ interface ISTokensManagerV2 is ISTokensManagerStruct {
172172
* @return uint256 current token id
173173
*/
174174
function currentIndex() external view returns (uint256);
175+
176+
/// @notice Count NFTs tracked by this contract
177+
/// @return A count of valid NFTs tracked by this contract, where each one of
178+
/// them has an assigned and queryable owner not equal to the zero address
179+
function totalSupply() external view returns (uint256);
180+
181+
/// @notice Enumerate valid NFTs
182+
/// @dev Throws if `_index` >= `totalSupply()`.
183+
/// @param _index A counter less than `totalSupply()`
184+
/// @return The token identifier for the `_index`th NFT,
185+
/// (sort order not specified)
186+
function tokenByIndex(uint256 _index) external view returns (uint256);
187+
188+
/// @notice Enumerate NFTs assigned to an owner
189+
/// @dev Throws if `_index` >= `balanceOf(_owner)` or if
190+
/// `_owner` is the zero address, representing invalid NFTs.
191+
/// @param _owner An address where we are interested in NFTs owned by them
192+
/// @param _index A counter less than `balanceOf(_owner)`
193+
/// @return The token identifier for the `_index`th NFT assigned to `_owner`,
194+
/// (sort order not specified)
195+
function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256);
175196
}

0 commit comments

Comments
 (0)