Как вызвать функцию setApprovalForAll() в ERC721URIStorage

#ethereum #polygon #solidity #smartcontracts #binance-smart-chain

#ethereum #polygon #solidity #smartcontracts #binance-smart-chain

Вопрос:

Я создаю контракты NFT minter и NFT marketplace в minter, я передаю адрес контракта NFT market, чтобы сохранить его как NFT marketplace по умолчанию.

 contract ERC721NFTMinter is Ownable, ERC721URIStorage{  //@dev: NFT Marketplace address   address marketPlaceAddress;   using Counters for Counters.Counter;  Counters.Counter private _tokenIds;     constructor(address _marketplaceAddress) ERC721("Metaverse NFTs", "META-NFT"){  // nextTokenId is initialized to 1, since starting at 0 leads to higher gas cost for the first minter  //TOKENS IDS starts from 1(not 0)  _tokenIds.increment();  marketPlaceAddress = _marketplaceAddress;     }   //@dev: Main Minter function that mints ERC721 nfts  // @requere: _tokenURI; A URI string that contrains the token metadata.  // @returns: Newly minted token id  function mintNFT(string memory _tokenURI) public returns(uint256){  require(msg.sender != address(0), "ERC721NFTMinter#mintNFT: ZERO_ADDRESS");    // To automatically increment the token id so that if the biginign token   uint256 newItemId = _tokenIds.current();  _tokenIds.increment();  // mint function to mint the tokens for the sender  _safeMint(address(msg.sender), newItemId);  // sent the token URI for the metadata  _setTokenURI(newItemId, _tokenURI);  // Set permission for tokens   setApprovalForAll( marketPlaceAddress, true);   return newItemId;  }  }   

Это хорошо скомпилировано, но когда я создавал новый токен, кажется, что функция setApprovalForAll не работает

 setApprovalForAll( marketPlaceAddress, true);  

как я получаю ниже ошибку при тестировании домового

 gt; assert erc721_nft_minter.getApproved(id) == marketplace_address, 'NOT APPROVED FOR LISTING' E AssertionError: NOT APPROVED FOR LISTING E assert '0x0000000000...0000000000000' == '0x3194cBDC3d...5c3394048Cc87' E - 0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87 E   0x0000000000000000000000000000000000000000  

Я также попытался сделать что-то подобное ниже, чтобы переопределить этот метод, но выдал ошибку за это.

 function setApprovalForAll(address _operator, bool _approved) public override{  _setApprovalForAll(msg.sender, _operator, _approved);  }  

ошибка

 CompilerError: solc returned the following errors:  DeclarationError: Undeclared identifier. Did you mean "setApprovalForAll"?  --gt; contracts/NFT/ERC721/NFTMinter_ERC721.sol:57:6:  | 57 | _setApprovalForAll(msg.sender, _operator, _approved);  | ^^^^^^^^^^^^^^^^^^   ERROR: Unable to load project  

please help me to solve this