Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugs in the docs code? ERC721 #5000

Closed
C0D3O opened this issue Apr 7, 2024 · 1 comment
Closed

bugs in the docs code? ERC721 #5000

C0D3O opened this issue Apr 7, 2024 · 1 comment

Comments

@C0D3O
Copy link

C0D3O commented Apr 7, 2024

馃捇 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;
	}
}

I get
image
and
image

@C0D3O
Copy link
Author

C0D3O commented Apr 7, 2024

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

@C0D3O C0D3O closed this as completed Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant