Openzeppelin-contracts: Bug in ERC20 Token

Created on 6 Aug 2020  路  4Comments  路  Source: OpenZeppelin/openzeppelin-contracts

Recently I am having a lot of trouble in using ERC20 token version 3.1.0 because of a minor bug.

pragma solidity ^0.6.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

The ERC20 token is written in solidity 0.6.0 and it inherits the import "../../utils/Address.sol"; contract.
The code of Address.sol:

pragma solidity ^0.6.2;
/**
 * @dev Collection of functions related to the address type
 */
library Address {

The Address.sol is written in solidity 0.6.2.

Because if this running migrate command in truffle developer console throws
ParseError: source file require a different compiler vesion (current compiler is 0.6.0)
and
Error: truffle is currrently using solc 0.6.0 but one of your contracts specify "pragma solidity ^0.6.2"."
errors everytime.
Hope you'll look into it soon. :)

Most helpful comment

Is something preventing you from changing your compiler to 0.6.2 in truffle-config.js ?

compilers: {
    solc: {
       version: "0.6.2"   
   }
}

All 4 comments

Is something preventing you from changing your compiler to 0.6.2 in truffle-config.js ?

compilers: {
    solc: {
       version: "0.6.2"   
   }
}

Hi @visheshdvn,

Please use a solc version of 0.6.2 and above as Address.sol needs a minimum of 0.6.2.

For instructions on setting the compiler version in Truffle, please see the Truffle documentation:
https://www.trufflesuite.com/docs/truffle/reference/configuration#solc

Yes thanks @abcoathup . The solution given by @julianmrodri worked for me. I'm such a newbie in blockchain tech :confused: .. sry for wasting 2 minutes of your life if someone is reading this thread.. :laughing:

Hi @visheshdvn,

Everyone was new once. Ethereum has only been live for five years. Feel free to ask the community all the questions that you need in the community forum: https://forum.openzeppelin.com/
You can also share your knowledge (and learn too) by answering questions.

When I see a question like yours, I think of how we can improve our documentation so that no one else has to have the same problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spalladino picture spalladino  路  4Comments

nventuro picture nventuro  路  4Comments

maraoz picture maraoz  路  3Comments

shrugs picture shrugs  路  4Comments

sebastien-kr picture sebastien-kr  路  4Comments