Building OpenZeppelin Contracts with Visual Studio Code

By | 17. August 2020

Prerequisites :

This article does not claim to be a complete and perfect solution, but this is how it worked for me and might be starting point for you.

Install Visual Studio Code, install Solidity extenstion. Extract from archive (or git clone) OpenZeppelin code.

In Visual Studio Code use File ->Open folder and select OpenZeppelin contracts directory location.

This article does not claim to be a complete and perfect solution, but this is how it worked to me.

Next open one sol file, for example ERC20 token one:


To compile code focus source code window (click somewhere inside code) and press Ctrl+F5.


OpenZeppelin Contracts are targeted for Solidity version  0.6.0 (few files also for 0.6.2).

pragma solidity ^0.6.0;

In my installation Visual Studio Code tried target to Solidity version 0.7.0

There are several posts in internet how to use different Solidity version for compiling, but none of them is very straightforward and why not to use latest version if it is available.

First step is to update references in all files to new version:

pragma solidity ^0.7.0;

After that new issue will appear – Solidity v0.7.0  has breaking changes.

First thing to encounter here are :

  • Remove the public keyword from every constructor.
  • Remove the internal keyword from every constructor and add abstract to the contract (if not already present).


So next step is act as the document states  – Remove the public and abstract keywords from constructor.

Next issue was “TypeError: Member “sub” not found or not visible after argument-dependent lookup in uint256.“.


I suppose the cause of this error is

  • Repeat the using A for B statements in all derived contracts if needed.

So adding using statement on places this error occurs helps :


You might have to do several runs of fixes as after fixing some compiler will find next ones.

Finally  you should have successful compilation only with warning messages:



Leave a Reply