Naive question: (Background - just started studying truffle framework) - in one place it mentions "it is possible to write your deployment as a single promise chain if you find that syntax to be more clear" - can some one give me an example of that? Thanks.


At the botton of your link there's an example how to chain promises in javascript.

module.exports = (deployer, network) => {
  deployer.then(() => {
    return deployer.deploy(ContractA, param1, param2);
  }).then(() => {
    return deployer.deploy(ContractB, anotherparam);
  }).then(() => {
    const instanceA = ContractA.at(ContractA.address);
    return instanceA.methodInContractA(ContractB.address);
  }).then(() => {
    const instanceB = ContractB.at(ContractB.address);
    return instanceB.anotherMethodInContractB(ContractA.address, anotherparam2);

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.