Frequently asked questions

Is it safe to upgrade a contract compiled with a version of Solidity to another compiled with a different version?

Yes. The Solidity team guarantess that the compiler preserves storage layout among versions.

Is it possible to specify which Solidity compiler version to use in the OpenZeppelin SDK?

Yes. You can run openzeppelin compile --solc-version 5.X to compile your contracts with a specific Solidity compiler version. This choice will be saved to .openzeppelin/project.json for future runs.

{
  "manifestVersion": "2.2",
  "name": "my-project",
  "version": "1.0.0",
  "compiler": {
    "manager": "openzeppelin",
    "solcVersion": "0.5.9"
  }
}

If you are using truffle for compiling your project,, you can specify which compiler version to use in your truffle.js or truffle-config.js file, as you do normally in a truffle 5+ project:

module.exports = {
  compilers: {
     solc: {
       version: "0.5.9"
     }
  }
}

Why am I getting the error "Cannot call fallback function from the proxy admin"?

This is due to the transparent proxy pattern. You shouldn’t get this error when using the OpenZeppelin SDK via its CLI, since it relies on the ProxyAdmin contract for managing your proxies.

However, if you are using the OpenZeppelin SDK programmatically, you could run into such error. The solution is to always interact with your proxies from an account that is not the admin of the proxy, unless you want to specifically call functions of the proxy itself.

How do I use ES6 Javascript syntax in my tests?

First, make sure you add the following dev-dependencies to your project: babel-polyfill, babel-register, babel-preset-es2015, babel-preset-stage-2 and babel-preset-stage-3. npm install --save-dev babel-polyfill babel-register babel-preset-es2015 babel-preset-stage-2 babel-preset-stage-3 Next, create a .babelrc file at the root of your repo, containing:

{
  "presets": ["es2015", "stage-2", "stage-3"]
}

Finally, make sure your truffle-config.js file contains the following lines at the beginning of the file:

require('babel-register');
require('babel-polyfill');

How can I create an upgradeable instance from Solidity code?

You can create upgradeable instances from Solidity code by using your project’s App contract, and then calling its create function from Solidity. Note that to be able to do this, your project needs to be published, i.e. it needs to have the OpenZeppelin SDK Contracts Architecture enabled.

To see an example of how this is done, please refer to the example project creating-instances-from-solidity.

Opt-In Usage Data Reporting

In order to better guide the development of our tools, we ask users if they would like to opt in to contributing anonymized logs of their usage of the OpenZeppelin CLI. In this document we explain exactly what data we collect and how we anonymize it. Please visit https://openzeppelin.com/privacy for further information about our privacy practices.

When you run the OpenZeppelin CLI for the first time we ask if you would like to opt in to contributing usage logs. This is a setting that will be stored globally and will apply to future projects. You can opt-out at any time, and you can also choose to opt out on a per-project basis.

If you choose to you opt in, we generate a random user identifier and a random 32-byte salt.

Every openzeppelin subcommand you run will be first anonymized by hashing each argument together with the random salt. Note that this only applies to user-specific arguments (e.g. the name of a contract, or an address), and not to the flags themselves (e.g. --force). The anonymized commands will be logged on our servers together with the random user identifier, the network that they were run in, as well as general information about the environment (platform, architecture, and versions of node, the CLI, and web3 dependencies).