1

Hi I am following a tutorial on Chainlink NFTs but I get this error below which reads: Contract should be marked as abstract.

enter image description here

Now I see this same question was asked before however in that person's code they never declared the constructor for ERC721. I am declaring both constructors for ERC721 and VRFConsumerBase.

Also this error goes away if I delete the inheritance of the VRFConsumerBase contract so it is causing this error I guess.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";

contract PopNFT is ERC721URIStorage, VRFConsumerBase
{
    bytes32 public keyHash; // Identifier for our Chainlink Oracle
    uint256 public fee;  // Link for the oracle
    
    constructor(address _VRFCoordinator, address _LinkToken, bytes32 _keyHash, uint256 _fee)
        VRFConsumerBase(_VRFCoordinator, _LinkToken)
        ERC721("PopNFT", "PopNFT")
    {
        fee = _fee;
        keyHash = _keyHash;
    }

}
1

1 Answer 1

2

Your contract doesn't implement the fulfillRandomness function.

As this function is not defined in the VRFConsumerBase contract (making it abstract) you must define it yourself. If you don't, your contract is not fully implemented and should therefore be abstract too.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.