Truffle Migration Console displays binary text

Hi everyone, I hope this topic fits in here…
I am facing a strange issue when trying to migrate ERC1155Upgradeable in truffle. The console goes BONKERS! When I remove the call for the initialize() everything works fine. But when it get’s called in the migration file:

Any Help much appreciated :slight_smile:
:computer: Environment
Truffle, ERC1155Upgradeable, OwnableUpgradeable



const Token = artifacts.require(“MyToken”);
module.exports = async function (deployer, network, accounts) {

  deployer.deploy(MTD, {from: accounts[0]});

  var Token = await MTD.deployed();

  console.log("Deployed at address: " + Token.address);

  await Meme.initialize(); //This causes the weird behaviour. The migration fails. When removed, everything goes fine....

:1234: Code to reproduce

1 Like

UPDATE: BOOM! Big celebreations over here :partying_face: Thanks to @nventuro 's reply in THIS POST I could get it to work!
It seemed like it has something to do with truffle not handling function overloads not nicely when calling functions in the migration after deploying. But they introduced a fix that goes like this:

`await myContract.methods['initialize()']({ from: accounts[0] });` 

use the methods property!


Unfortunately it only fixed it for the initialize() call, for any additional call, the same problem occurs :thinking:
So it is not the final solution.

1 Like

Hi @ThomasEnder,

If you are deploying an upgradeable contract, I recommend using OpenZeppelin Upgrades Plugins:

The plugins will check upgrade safety, deploy a ProxyAdmin and proxy for you, and call your initialize function as part of the deployment (otherwise you would need to protect it from being called by someone else).

You can also use the following example:
OpenZeppelin Upgrades: Step by Step Tutorial for Truffle

1 Like

Thank you @abcoathup I am following the tutorial and will hopefully be able to test on testnet successfully today

1 Like