Geethmaka Dissanayake
Geethmaka Dissanayake

Reputation: 157

Is there any way to use latest truffle version with older versions

I get this error all the time because the truffle version that I use is the newer version and some smart contracts uses the older versions. Is there any way that I can get rid of these errors?

Error: Truffle is currently using solc 0.8.12, but one or more of your contracts specify "pragma solidity 0.7.6".
Please update your truffle config or pragma statement(s).

Upvotes: 0

Views: 1585

Answers (2)

Niccolò Fant
Niccolò Fant

Reputation: 601

Either you downgrade your contracts' solidity version to the dependencies contracts' version or, if possible, you install some newer dependencies.

Or you can clone the contract that uses an older solidity version to your local repo and you manually change the version. (Unless of course you have a billion dependencies)

When I was using the Aave contracts i had to manually copy them locally so I could upgrade their version from 0.6.12 to ^0.8.0.

Upvotes: 1

Nerdy19
Nerdy19

Reputation: 174

There is no need to upgrade or degrade truffle just go inside truffle config file>compilers and set the solc version same as your pragma version. And this will solve your issue.

Upvotes: 3

Related Questions