bugs in the docs code? ERC721
moneyDev1111 opened this issue · 1 comments
moneyDev1111 commented
💻 Environment
latest, foundry
🔢 Code to reproduce bug
// contracts/GameItem.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ERC721URIStorage} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract GameItem is ERC721URIStorage {
uint256 private _nextTokenId;
constructor() ERC721("GameItem", "ITM") {}
function awardItem(address player, string memory tokenURI) public returns (uint256) {
uint256 tokenId = _nextTokenId++;
_mint(player, tokenId);
_setTokenURI(tokenId, tokenURI);
return tokenId;
}
}
moneyDev1111 commented
If I write my own contract and import the ERC721URIStorage like this
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
I don't have the error from the fist screenshot
if like this
import {ERC721URIStorage} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"
I do
why so? Thank you