4

I basically followed this Zeppelin crowdsale tutorial, just changed the names of the contracts. I was able to successfully deploy on a local Ganache, but then when trying to deploy to the live ethereum network it fails on invalid address, apparently raised by migrating 1_initial_migration.js, which looks like this:

var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

and Migrations.sol looks like this:

pragma solidity ^0.4.17;

contract Migrations {
  address public owner;
  uint public last_completed_migration;

  modifier restricted() {
    if (msg.sender == owner) _;
  }

  function Migrations() public {
    owner = msg.sender;
  }

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
  }

  function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);
    upgraded.setCompleted(last_completed_migration);
  }
}

Here is a screenshot from the terminal where truffle migration fails:

enter image description here

How is it possible that I can deploy to Ganache but not to the live network? Am I doing something wrong? Any suggestions?

2

I had faced similar issue I am able to resolve it after deleting JSON files from /build/contracts. Then I tried to redeploy the contract and it was done successfully.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.