Error: Contract TruffleContract does not have a function Initialize

I CREATED a simple new smart contract to deploy proxies

but proxies not deploying

ERROR Error: Contract TruffleContract does not have a function Initialize

:computer: Environment
truffle5, truffle-upgrades plugin
:memo:Details
when i made “npxtruffle deploy” it show this error
ERROR Error: Contract TruffleContract does not have a function Initialize

:1234: Code to reproduce
solidity simple code
// SPDX-License-Identifier: UNLICENSE
pragma solidity ^0.8.0;

import "./IERC20Upgradeable.sol";
import "./extensions/IERC20MetadataUpgradeable.sol";
import "./utils/ContextUpgradeable.sol";
import "./proxy/utils/Initializable.sol";
import "./OwnableUpgradeable.sol";
import "./ERC20Upgradeable.sol";
import "./utils/math/SafeMathUpgradeable.sol";


contract Zoe_cash_v1 is Initializable, OwnableUpgradeable,ERC20Upgradeable {
   
    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;   

    function Initialize(uint256 _minsupply)  internal initializer {
        __ERC20_init("ZOE CASH", "ZOE");
        _minsupply = 100000000 ether;
    }
}

migration code

const Zoe_cash_v1 = artifacts.require('Zoe_cash_v1');
 
const { deployProxy } = require('@openzeppelin/truffle-upgrades');
 
module.exports = async function (deployer) {
  await deployProxy(Zoe_cash_v1, [""], { deployer, initializer: 'Initialize' });
};
1 Like

Hey!
Although you have a function named Initialize, but it is an internal function, as for what is a internal function, I think you can look at the documentation:

Internal functions can only be called inside the current contract (more specifically, 
inside the current code unit, which also includes internal library functions and
inherited functions) because they cannot be executed outside of the 
context of the current contract.

so if you want to call it, you should use public or external like this:

function Initialize(uint256 _minsupply)  public initializer {
        __ERC20_init("ZOE CASH", "ZOE");
        _minsupply = 100000000 ether;
    }
2 Likes

Hi @Guard_Colombia,

As an aside, please see the documentation on installing and usage OpenZeppelin Contracts upgradeable, as you appear to have copied the contracts locally:

https://docs.openzeppelin.com/contracts/4.x/upgradeable