File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ contract SBT is ISBT, ERC721EnumerableUpgradeable {
83
83
uint256 tokenId ,
84
84
bytes memory metadata
85
85
) external override onlyMinter {
86
- require (tokenId < currentIndex (), "Token not found " );
86
+ require (tokenId <= currentIndex (), "Token not found " );
87
87
_setTokenURI (tokenId, metadata);
88
88
}
89
89
@@ -106,7 +106,7 @@ contract SBT is ISBT, ERC721EnumerableUpgradeable {
106
106
}
107
107
108
108
function _tokenURI (uint256 tokenId ) private view returns (string memory ) {
109
- require (tokenId < currentIndex (), "Token not found " );
109
+ require (tokenId <= currentIndex (), "Token not found " );
110
110
111
111
(
112
112
string memory name ,
@@ -229,13 +229,17 @@ contract SBT is ISBT, ERC721EnumerableUpgradeable {
229
229
}
230
230
231
231
function currentIndex () public view override returns (uint256 ) {
232
- return super .totalSupply ();
232
+ return totalSupply ();
233
+ }
234
+
235
+ function nextIndex () public view override returns (uint256 ) {
236
+ return currentIndex () + 1 ;
233
237
}
234
238
235
239
function metadataOf (
236
240
uint256 tokenId
237
241
) public view override returns (bytes memory ) {
238
- require (tokenId < currentIndex (), "Token not found " );
242
+ require (tokenId <= currentIndex (), "Token not found " );
239
243
return _sbtdata[tokenId];
240
244
}
241
245
Original file line number Diff line number Diff line change @@ -112,6 +112,12 @@ interface ISBT {
112
112
*/
113
113
function currentIndex () external view returns (uint256 );
114
114
115
+ /*
116
+ * @dev get next id of token to be minted
117
+ * @return uint256 next token id
118
+ */
119
+ function nextIndex () external view returns (uint256 );
120
+
115
121
/*
116
122
* @dev get mapped metadata bytes of token id
117
123
* @param tokenId the token id of the NFT
You can’t perform that action at this time.
0 commit comments