English 中文(简体)
未申报标识符: 需要自备( kenID) 错误
原标题:Undeclared identifier : _requireOwned(tokenId) error

使用智能合同时,

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), 但它也犯了同样的错误 。

问题回答

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC721/extensions/ERC721URIStorage.sol";




相关问题
ERC20 津贴不足

我非常经常地问这个问题。 我道歉,但我不理解许多答案。 我曾试图订立一项契约,但这一错误使我陷入了境地。 ......

Web3.js sendSignedTransaction Problem...... plz help me

i use ganache-cli for operate node in local environment. after that I wrote Smart contract solidity code in remix. And then, deployed in my ganache node. And deployed log was successful in my ganache. ...

unable to get data from blockchain using thirdweb

I am building a simple crowdfunding app using React and thirdweb , I was able to successfully create a Campaign mean data is pushed successfully , I have read docs everything works fine , but when i ...

false Transaction mined but execution failed in Remix IDE

I am getting false Transaction mined but execution failed error from the constructor function in the contract. I am just saving the address from which the contract is deployed in manager variable and ...

TypeError: (0 , ethers_1.getAddress) is not a function

I am getting this error while deploying my smart contract const main = async() => { const contractFactory = await ethers.getContractFactory( TwitterContract ); const contract = await ...

ETH sendSignedTransaction

I Try to use @ethereumjs/tx to sign Transaction. I want to send ETH from one address to second address. .... const legacy = require( @ethereumjs/tx/dist/legacyTransaction ); const utils = require( ...

热门标签