0

I am trying to deploy my Roadmap contract from the address of another newly built contract with Truffle. I tried to do something like this:

module.exports = function(deployer) {
      deployer.deploy(MilestoneBased, RoadmapDelegate.address).then(function() {
        return deployer.deploy(Roadmap, {from: MilestoneBased.address});
  });

But I'm receiving an error "Sender account not recognized". How could I solve it? Thanks.

1 Answer 1

1

You can't deploy contracts from another contract like that.

Basically what you need to do is include the contract creation inside the contract. So it has to have a function which creates another contract with something like: OtherContract c = new OtherContract(constructorArguments);. Obviously you need to have the contract OtherContractdefinition available inside the contract.

4
  • Thanks for the response. But isn't there anyway, that we could grant access to the platform to send transactions from that contract? Commented Mar 16, 2021 at 16:18
  • No. A transaction is always sent from an EOA (Externally Owned Account). Commented Mar 16, 2021 at 16:19
  • Just a quick question, Will I be able to see the contract in Ganache if we create it inside the contract(the way that you said above)? Commented Mar 16, 2021 at 16:24
  • 1
    Well, everything happening in the blockchain is public, but some of the data may be difficult to interpret. I'm not sure how you'll see it in Ganache - at least you'll see the sub-contract address in some fashion. Commented Mar 16, 2021 at 16:57

Your Answer

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

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