0

I installed npm install @openzeppelin/contracts --save-dev to use token erc1155, my project is running on 0.5.0 version for all smart contracts and erc1155 is using 0.8.0 and I got this error Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity ^0.8.0". Is any version of @openzeppelin/contracts --save-dev for erc1155 use sol 0.5.0 ?

Chíp Thảo
  • 122
  • 6

1 Answers1

1

In the openzeppelin github repo, erc1155 was incorporated from version 3.1.0. You can get that specific package by running npm i @openzeppelin/contracts@3.1.0 --save-dev.
As for the compiler compatibility, you can tweak the version in truffle-config.js. It should be under

compilers: {
    solc: {
      version: "x.x.x"
    }
}
Binayak
  • 79
  • 5
  • I have tried it but `npm i @openzeppelin/contracts@3.1.0 --save-dev` uses `pragma solidity ^0.6.0;` and my project is using 0.5.0 and i still try to config the version of solidity as you provide above and i got this error instead `CompileError: @openzeppelin/contracts/token/ERC20/ERC20.sol:98:40: ParserError: Expected '{' but got reserved keyword 'override' function totalSupply() public view override returns (uint256) {` can you help me with this ? – Chíp Thảo Aug 02 '21 at 03:49