I'm currently working on a Solidity smart contract that makes use of the ERC721Enumerable extension from OpenZeppelin. However, when I attempt to compile using Truffle, I encounter a ParserError.
Here's the relevant part of my contract:
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
contract Degree is ERC721Enumerable {
// ... (contract details)
}
When I try to compile using truffle compile, I get the following error:
@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol:14:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
^------^
Compilation failed. See above.
Any ideas what could be causing this error and how I can resolve it?
I tried these:
Verifying the path to the imported OpenZeppelin contract. Checking the ERC721Enumerable.sol file directly to see if there's anything unusual at the specified line.