Are upgradable and non upgradable contracts in the same truffle project supported?

Hi @abcoathup, I’m getting this error too when dealing with both upgradable and non upgradable contracts in the same truffle project. Is this supported now?
I’m using

    "@openzeppelin/contracts": "^2.4.0",
    "@openzeppelin/contracts-ethereum-package": "^2.5.0",
    "@openzeppelin/upgrades": "^2.8.0"

and doing npx oz deploy -n local --skip-compile -k upgradeable ContractName after compiling all with truffle.


1 Like

Hi @bugduino,

OpenZeppelin Contracts Ethereum Package from v3 the contracts have an UpgradeSafe suffix. If possible I would use those, otherwise you could have a clash where your contracts are importing a contract with the same name from OpenZeppelin Contracts and OpenZeppelin Contracts Ethereum Package so you might need to have them in separate projects.

1 Like

Unfortunately I need that specific version because I’m using Solidity 0.5.16 and Contracts Ethereum Package v3 supports only Solidity 0.6.x.

In the end I was able to achieve what I wanted directly using the @openzeppelin/upgrades package in my migration file using ProxyAdmin project which should be the same used by npx oz deploy from what I understood

1 Like

@abcoathup would you recommend using the UpgradeSafe versions even on non-upgradeable contracts in the same project just to avoid those clashes, and scrap @openzeppelin/contracts altogether?

I just came upon this thread after posting a similar question of my own a few minutes ago: Importing non-upgradeable contract and libraries into upgradeable contract.

1 Like

Hi @dtp5,

I would recommend using OpenZeppelin Contracts for regular contracts and OpenZeppelin Contracts Ethereum Package for upgradeable contracts as we want to initialize our contracts in the same transaction that they are deployed. This is easily done with constructors. With upgradeable contracts we can do this as part of deploying and setting up the proxy.

Though each use case is different, so I will answer your specific question in the topic you created.

1 Like

2 posts were split to a new topic: Using OpenZeppelin Contracts and Upgrade Safe versions in the same project