Remove utils/Counters.sol (#4289)
Co-authored-by: Francisco Giordano <fg@frang.io>
This commit is contained in:
@ -17,11 +17,9 @@ Here's what a contract for tokenized items might look like:
|
||||
pragma solidity ^0.8.19;
|
||||
|
||||
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
|
||||
import "@openzeppelin/contracts/utils/Counters.sol";
|
||||
|
||||
contract GameItem is ERC721URIStorage {
|
||||
using Counters for Counters.Counter;
|
||||
Counters.Counter private _tokenIds;
|
||||
uint256 private _nextTokenId;
|
||||
|
||||
constructor() ERC721("GameItem", "ITM") {}
|
||||
|
||||
@ -29,12 +27,11 @@ contract GameItem is ERC721URIStorage {
|
||||
public
|
||||
returns (uint256)
|
||||
{
|
||||
uint256 newItemId = _tokenIds.current();
|
||||
_mint(player, newItemId);
|
||||
_setTokenURI(newItemId, tokenURI);
|
||||
uint256 tokenId = _nextTokenId++;
|
||||
_mint(player, tokenId);
|
||||
_setTokenURI(tokenId, tokenURI);
|
||||
|
||||
_tokenIds.increment();
|
||||
return newItemId;
|
||||
return tokenId;
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
@ -97,8 +97,6 @@ If you need support for more powerful collections than Solidity's native arrays
|
||||
[[misc]]
|
||||
== Misc
|
||||
|
||||
Want to keep track of some numbers that increment by 1 every time you want another one? Check out xref:api:utils.adoc#Counters[`Counters`]. This is useful for lots of things, like creating incremental identifiers, as shown on the xref:erc721.adoc[ERC721 guide].
|
||||
|
||||
=== Base64
|
||||
|
||||
xref:api:utils.adoc#Base64[`Base64`] util allows you to transform `bytes32` data into its Base64 `string` representation.
|
||||
|
||||
Reference in New Issue
Block a user