ParserError: Expected pragma, abstract contract Context.sol

im trying to follow the tutotial BUILDING ROBUST SMART CONTRACTS WITH OPENZEPPELIN from www.trufflesuite.com

here the link https://www.trufflesuite.com/tutorials/robust-smart-contracts-with-openzeppelin

Creating a “TutorialToken” smart contract

after installing OpenZeppelin and downloading the project template I tried to compile and get this error, I haven’t coded anything of my own yet, it’s basically an empty project and it should compile according to the tutorial but fails due to an error from the OpenZeppelinon files.
Can someone help ?

CcBaN

TutorialToken.sol

pragma solidity 0.6.0;

import "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol";

contract TutorialToken is ERC20 {
    
        string public name = "TutorialToken";
        string public symbol = "TT";
        uint8 public decimals = 2;
        uint public INITIAL_SUPPLY = 12000;


        constructor() public {
        _mint(msg.sender, INITIAL_SUPPLY);
    } 
}
truffle-config.js

  module.exports = {   // See <http://truffleframework.com/docs/advanced/configuration>   // for more about customizing your Truffle configuration!  
 networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    }   },
    compilers: {
       solc: {
    version: "0.4.24" //(Default: Truffle's installed    solc)   
    }  
  }
}
1 Like

It seems like this tutorial use the compiler version is 0.4.x, but now, the newest version is 0.8.x, so I think you should run npm i openzeppelin-solidity@2.0.0 to install.

BTW, you can have a look at some newer tutorials:

1 Like

Hi @LuaiCoder,

Welcome to the community :wave:

You could try out the new OpenZeppelin Contracts Wizard:
https://docs.openzeppelin.com/contracts/4.x/wizard

I suggest looking at OpenZeppelin Learn guides:
https://docs.openzeppelin.com/learn/

1 Like