I’m following a blockchain tutorial for creating dynamic NFTs but ran into compilation issues when trying to build my smart contracts.
When I execute the compile command:
truffle compile
I encounter these compilation errors:
Compiling your contracts...
===========================
> Compiling ./contracts/TokenMigration.sol
> Compiling ./contracts/BasicNFT.sol
> Compiling ./contracts/RandomGenerator.sol
> Compiling ./contracts/mocks/PriceFeedMock.sol
> Compiling ./contracts/mocks/VRFMock.sol
> Compiling @chainlink/contracts/src/v0.6/VRFConsumerBase.sol
@chainlink/contracts/src/v0.6/VRFConsumerBase.sol:103:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
abstract contract VRFConsumerBase is VRFRequestIDBase {
^------^
project:/contracts/BasicNFT.sol:3:1: ParserError: Source "@openzeppelin/contracts/token/ERC721/ERC721Full.sol" not found
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol";
project:/contracts/BasicNFT.sol:4:1: ParserError: Source "@openzeppelin/contracts/token/ERC721/ERC721Mintable.sol" not found
import "@openzeppelin/contracts/token/ERC721/ERC721Mintable.sol";
project:/contracts/RandomGenerator.sol:51:86: ParserError: Expected '{' but got reserved keyword 'override'
function fulfillRandomness(bytes32 requestId, uint256 randomValue) internal override {
^------^
Compilation failed. See above.
My project structure looks normal with all the standard directories present. Has anyone encountered similar parser errors when working with Chainlink contracts? What could be causing these compilation failures?