1

I followed the feedback given from this question, and made a few changes to ganache like ensuring I have more than enough gas in my truffle file:

require('babel-register');
require('babel-polyfill');

module.exports = {
  networks: {
    development: {
      host: '127.0.0.1',
      port: 8545,
      network_id: '*', // Match any network id
      gas: 6712388,
      gasPrice: 65000000000
    }
  }
};

But I am still running into this error telling me my network is unknown:

Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: VM Exception while processing transaction: revert at Object.InvalidResponse (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:43303:16) at /Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:331150:36 at /Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:175492:11 at /Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:314196:9 at XMLHttpRequest.request.onreadystatechange (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:315621:13) at XMLHttpRequestEventTarget.dispatchEvent (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:70159:18) at XMLHttpRequest._setReadyState (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:70449:12) at XMLHttpRequest._onHttpResponseEnd (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:70604:12) at IncomingMessage. (/Users/user/.nvm/versions/node/v6.10.1/lib/node_modules/truffle/build/cli.bundled.js:70564:24) at emitNone (events.js:91:20)

2_deploy_contracts.js looks like:

const myTokenCrowdsale = artifacts.require("./myTokenCrowdsale.sol");
const myToken = artifacts.require("./myToken.sol");
const ConvertLib = artifacts.require("ConvertLib.sol");

function latestTime () {
  return web3.eth.getBlock('latest').timestamp;
}

const duration = {
  seconds: function (val) { return val; },
  minutes: function (val) { return val * this.seconds(60); },
  hours: function (val) { return val * this.minutes(60); },
  days: function (val) { return val * this.hours(24); },
  weeks: function (val) { return val * this.days(7); },
  years: function (val) { return val * this.days(365); },
};

module.exports = function(deployer, network, accounts) {
  const RATE = 1;
  const startTime = web3.eth.getBlock(web3.eth.blockNumber).timestamp + 1; 
  const endTime = startTime + (86400 * 20);
  const cap = 2000;
  const goal = cap;



deployer.deploy(myTokenCrowdsale, startTime, endTime, RATE, accounts[0], myToken, goal);
};

I have my Crowdsale contract inheriting from multiple Zeppelin-solidity contracts, similar to their example here, and I've read that the Network error could be a result of trying to deploy a contract bigger than the test network's limit. But I can't imagine that is the problem if I'm using their example.

Any thoughts on where I'm going wrong?

1 Answer 1

0

start time is too low (it's the last block time plus one) and the crowdsale makes sure that the start time is greater than the current time (which it won't be because of a little lag). increase it to 20 seconds or more past the current time to be safe

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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