Search code examples
ethereumsoliditytruffle

How to use Truffle with Solidity 6.0?


Reading official Truffle docs, I noticed Truffle not support Solidity 6.0

pragma solidity >=0.4.21 <0.6.0;

Are there any ways to use Truffle with Solidity 6.0?


Solution

  • Yes this works with this migration

    pragma solidity >=0.4.21 <0.7.0;
    
    contract Migrations {
      address public owner;
      uint public last_completed_migration;
    
      constructor() public {
        owner = msg.sender;
      }
    
      modifier restricted() {
        if (msg.sender == owner) _;
      }
    
      function setCompleted(uint completed) public restricted {
        last_completed_migration = completed;
      }
    }
    

    And this compiler settings

    compilers: {
         solc: {
           version: "^0.6.0",
    

    And also need re-install Truffle to latest version