I'm trying to use Remix to interact with a suite of contracts. One of the contracts being used is OpenZeppelin's Ownable contract. I copied from the link above, and pasted it into Remix, with a few changes to take out the OpenGSN stuff, and also dropping the Solidity version (due to requirements elsewhere in the suite):
pragma solidity ^0.5.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable {
address private _owner;
....
This yields the following error:
ParserError: Expected pragma. import directive, or contract/library/interface definition
abstract contract Ownable {
^-------^
I've tried all kind of things. Via a comment here I've tried retyping the first line by hand, along with the first line of the contract code. I've tried taking out the abstract
(update: I made a mistake with this, see the answers), I tried making up an import
, removing the caret (^
) from the Solidity version, and general monkeying around with the code to make it work. Nothing has gotten rid of this error.
There are a number of other questions with this precise error, though I have not been able to extrapolate from any of the ones I've seen why this error would be appearing here.
Why am I getting this error?