0

i am following a tutorial from here. And upon running truffle test. It produces following error.

2_HashnodeCrowdsale.js
    ======================

       Deploying 'HashnodeCrowdsale'
       -----------------------------
    Error:  *** Deployment Failed ***
    "HashnodeCrowdsale" -- invalid number value (arg="_goal", coderType="uint256", value=2000000000000000000).

        at /home/lubuntu/.nvm/versions/node/v10.15.3/lib/node_modules/truffle/build/webpack:/packages/truffle-deployer/src/deployment.js:364:1
        at process._tickCallback (internal/process/next_tick.js:68:7)
    Truffle v5.0.12 (core: 5.0.12)
    Node v10.15.3
  • 2
    What is this aggregation of letters??? Please post a proper question, including your actual code (Solidity and Javascript), your input, your expected output, your actual output, and a description of the problem that you're experiencing (including your efforts to solve it, and any conclusions that you've made while investigating it). – goodvibration Apr 17 at 14:38
0

It seems to be an issue with the new abi encoder in web3.js since beta36 (truffle uses beta37).

One option is to pass large number as string in the migration script

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

module.exports = function(deployer) {
  const startTime = Math.round((new Date(Date.now() - 86400000).getTime())/1000); // Yesterday
  const endTime = Math.round((new Date().getTime() + (86400000 * 20))/1000); // Today + 20 days
  deployer.deploy(HashnodeCrowdsale, 
    startTime, 
    endTime,
    5, 
    "0x5AEDA56215b167893e80B4fE645BA6d5Bab767DE", // Replace this wallet address with the last one (10th account) from Ganache UI. This will be treated as the beneficiary address. 
    "2000000000000000000", // 2 ETH            <-------------- HERE
    "500000000000000000000" // 500 ETH         <-------------- HERE TOO
  );
};

You have to note the article was published more than a year ago, in January 2018. And it is very likely that it is outdated, everything moves very fast and more than 6 moths can be considered "old".

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.