0

I know this issue was discussed before several times, but I cant get the solution to my problem.

I'm trying to deploy a contract with Truffle on Ganache.

During the deployment in 2_deploy_contracts.js I deploy some contracts and libraries which ones are deployed.

Then when I try to deploy the contract that has the libraries and the address of the contracts in the constructor I got the following Error stack :

at Object.callback
(/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/contract.js:147:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:142:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:89:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-migrate/index.js:225:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-provider/wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:509:1)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/~/xhr2/lib/xhr2.js:469:1)

Here is 2_deploy_contracts.js :

deployer.deploy(A).then(function () { console.log("A deployed"); deployer.deploy(B, A.address, accounts[0],accounts[1]).then(function() { console.log("B deployed"); }).catch(err=>console.log("error B",err)); }).catch(err=>console.log("error A",e));

The problem occured on error B.

Anyone knows what can be the problem? I tried to add more gas but it didn't work.

Thanks in advance!

  • Can you share your 2_deploy_contracts.js code ? that would be much more helpful. – Kaki Master Of Time Feb 23 '18 at 10:02
  • There are many possibilities, e.g. bug in contract constructor that takes lot of gas (or causes throw), or simply too low gas limit settings. A quick way might be to try the contract on Remix (which connects to the same web3 provider used by Truffle) and see what errors come up – Linmao Song Feb 23 '18 at 11:25
0

Here is 2_deploy_contracts.js :

deployer.deploy(A).then(function () { console.log("A deployed"); deployer.deploy(B, A.address, accounts[0],accounts[1]).then(function() { console.log("B deployed"); }).catch(err=>console.log("error B",err)); }).catch(err=>console.log("error A",e));

  • It would be better to put this as an edit in your original question. This code looks okey. but please try to put the complete error log, and specify where did the error happen (e.g. did it happen in the "error B" ?) – Kaki Master Of Time Feb 23 '18 at 12:53

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.