How to install older OpenZeppelin Contract versions locally

I’m trying to fork a project and I’m getting an error because the Openzeppelin contracts downloaded off github are new and they have a minimum limit of greater or equal to solc 0.6.0 yet the contracts in my code require much older versions around solc 0.5.0.

Error: Error: Truffle is currently using solc ^0.5.0, but one or more of your contracts specify “pragma solidity >=0.6.0 <0.8.0”.

1 Like

Found: npm i @openzeppelin/contracts@2.5.1

still not sure how to import over remix however or if it’s still avaliable.

2 Likes

Hi @jing,

As you found you can install specific versions of OpenZeppelin Contracts using the version tag.

You can do similar if importing OpenZeppelin Contracts via GitHub.
e.g. https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/token/ERC20/ERC20.sol

:warning: you should only use an official release, the example above is for OpenZeppelin Contracts 2.5.1

1 Like