This is initialize
function of my upgradeable contract
contract MyContract is
Initializable,
ERC20PresetMinterPauserUpgradeable,
OwnableUpgradeable
{
function initialize(string memory _name, string memory _symbol)
public
override
initializer
{
emit ContractInitStarted(_name, _symbol, msg.sender, block.timestamp);
__ERC20PresetMinterPauser_init(_name, _symbol);
__Ownable_init_unchained();
_mint(msg.sender, 500000000 ether);
emit ContractInitEnded(_name, _symbol, msg.sender, block.timestamp);
}
}
This is 2_deploy_contracts.js
const MyContract = artifacts.require("./MyContract .sol");
const { deployProxy } = require("@openzeppelin/truffle-upgrades");
module.exports = async function (deployer) {
await deployProxy(MyContract , ["MyContract 1.0", "TenX"], { deployer, initializer: "initialize" });
};
npx truffle deploy --network rinkeby
Initialize function is never invoked.
symbol, name and totalSupply are empty