0

I followed this way of deploying contracts using truffle.

// Deploy A, then deploy B, passing in A's newly deployed address
deployer.deploy(A).then(function() {
  return deployer.deploy(B, A.address);
});

But my contract, despite showing as deployed in the truffle console, is not recognized by my web3js code.

It works if i deploy the two contracts seperatly.

0

Try this:

deployer.deploy(A).then(function(a) {
  return deployer.deploy(B, a.address);
});

or with async/await (better readability):

deployer.then(async () => {
    var a = await deployer.deploy(A);
    var b = await deployer.deploy(B, a.address);
    // ...
});

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.