Unable to deploy Upgradeable ERC20 using Truffle: The requested contract was not found

I’m unable to compile a simple Upgradable ERC20 contract. It works fine with a vanilla ERC20 both provided by OpenZeppelin.

:computer: Environment

Windows 10
Truffle v5.1.55
Node v10.19.0

When trying to migrate the contract using npx truffle migrate --network development I’m receiving the below output.

❯ npx truffle migrate --network development

Compiling your contracts...
> Compiling ./contracts/ZCX.sol
> Artifacts written to /home/vito/code/erc20/build/contracts
> Compiled successfully using:
   - solc: 0.7.5+commit.eb77ed08.Emscripten.clang

Starting migrations...
> Network name:    'development'
> Network id:      1607010901216
> Block gas limit: 6721975 (0x6691b7)


Error: The requested contract was not found. Make sure the source code is available for compilation
at getContractNameAndRunValidation (/home/vito/code/erc20/node_modules/@openzeppelin/upgrades-core/src/validate.ts:157:11)
at Object.assertUpgradeSafe (/home/vito/code/erc20/node_modules/@openzeppelin/upgrades-core/src/validate.ts:195:26)
at deployProxy (/home/vito/code/erc20/node_modules/@openzeppelin/truffle-upgrades/src/deploy-proxy.ts:49:3)
at process._tickCallback (internal/process/next_tick.js:68:7)
Truffle v5.1.55 (core: 5.1.55)
Node v10.19.0

:1234: Code to reproduce


// SPDX-License-Identifier: MIT
    pragma solidity >=0.6.0 <0.8.0;

    import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
    import "@openzeppelin/contracts-upgradeable/proxy/Initializable.sol";

    contract MyToken is Initializable, ERC20Upgradeable {
        function initialize(string memory name, string memory symbol, uint256 initialSupply) public virtual initializer {
            __ERC20_init(name, symbol);
            _mint(_msgSender(), initialSupply);


// migrations/2_deploy_token.js
const MyToken = artifacts.require('MyToken');
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
module.exports = async function (deployer) {
  await deployProxy(MyToken, ['My Token', 'TKN', '100000000000000000000000'], { deployer, initializer: 'initialize' });

Hi @vito,

Welcome to the community :wave:

Unfortunately I wasn’t able to reproduce your error.

I was able to use your token and migrations script to deploy to Truffle development network.

Can you try using the contract and migrations script and deploy to Truffle develop?

I am using WSL2 on Windows 10:

$ npx truffle version
Truffle v5.1.56 (core: 5.1.56)
Solidity - 0.6.12 (solc-js)
Node v10.22.1
Web3.js v1.2.9

I used the setup from: OpenZeppelin Upgrades: Step by Step Tutorial for Truffle

I installed OpenZeppelin Contracts Upgradeable

$ npm i @openzeppelin/contracts-upgradeable


Using Truffle develop

$ npx truffle develop
Truffle Develop started at


truffle(develop)> migrate

Compiling your contracts...
> Everything is up to date, there is nothing to compile.

Starting migrations...
> Network name:    'develop'
> Network id:      5777
> Block gas limit: 6721975 (0x6691b7)


   Deploying 'Migrations'


   Deploying 'MyToken'

   Deploying 'ProxyAdmin'

   Deploying 'AdminUpgradeabilityProxy'

truffle(develop)> token = await MyToken.deployed()
truffle(develop)> await token.name()
'My Token'
truffle(develop)> (await token.totalSupply()).toString()

I actually managed to solve it by moving to solc v0.6.12 clearing all compiled contracts from the build folder and re-running the migrate command.

Thanks for your assistance! This can be closed.


I also had this problem using ERC20PresetMinterPauserUpgradeable, but solved it simply by deleting the contents of the build folder.

1 Like