1

im doing step by step of this article and i had a problem on truffle compile part. I've got this error in cmd:

Error parsing @openzeppelin/contracts/token/ERC721/ERC721.sol: ParsedContract.sol:51:72: ParserError: Expected '{' but got reserved keyword 'override'
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
                                                                   ^------^

my contract :

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract Uniken is ERC721{

using Counters for Counters.Counter;
Counters.Counter private _tokenIds;
mapping(string => uint8) hashes;


  constructor() public ERC721("Uniken", "Ukn") {
   }
  
  function awardItem(address recipient, string memory hash, string memory metadata)
  public
  returns (uint256)

  {  
      require(hashes[hash] != 1);
        hashes[hash] = 1;  
        _tokenIds.increment(); 
        uint256 newItemId = _tokenIds.current(); 
        _mint(recipient, newItemId); 
        _setTokenURI(newItemId, metadata);  
        return newItemId;
  }

}

I'd be thankfull if anyone tell me whatis the problem?

Matinshoon
  • 55
  • 7

2 Answers2

1

It seems like it isn't seeing the ERC165 contract that ERC721 extends from. That function that it is getting stuck on should be overriding a function of the same name in ERC165, but the truffle compiler doesn't see a function named supportsInterface() in a class that ERC721 inherits from. So I would check to make sure everything imported in the ERC721 smart contract is in the right place in your folder structures, and that ERC721 is correctly inheriting ERC165.

0

After made some research , I was in truffle version 5.0 and update to the latest version of truffle -> v5.4.6, I am now able to compile

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140