使用智能合同时,
DeclarationError: Undeclared identifier. --> @openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol:35:9: | 35 | _requireOwned(tokenId); | ^^^^^^^^^^^^^
智能合同代码:
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract RealEstate is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
constructor() ERC721("Real Estate", "REAL") {}
function mint(string memory tokenURI) public returns (uint256) {
_tokenIds.increment();
uint256 newItemId = _tokenIds.current();
_mint(msg.sender, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
function totalSupply() public view returns (uint256) {
return _tokenIds.current();
}
}
我试图删除 ERC 721 URIStorage. sol 的自备文件( tokenId), 但仍有错误 。
任何帮助都将不胜感激。
我试图删除 ERC 721 URIStorage. sol 的自备文件( tokenId), 但仍有错误 。
并试图在我的智能合同中添加自备( etkenId), 但它也犯了同样的错误 。