0

Hi guys my question i very simple. I have this contract:

B.sol

...
contract A {
    ...
}
contract B is A {
    ...
}

When i migrate to blockchain my B.sol i need to deploy every single contracts inside? Choose one of the answers and explain why please.

  1. var B = artifacts.require("B");
    
    module.exports = function(deployer) {
        deployer.deploy(B);
    };
    
  2. var A= artifacts.require("A");
    var B= artifacts.require("B");
    
    module.exports = function(deployer) {
        deployer.deploy(A);
        deployer.deploy(B);
    };
    
  • I don't understand what you're asking here, can you please elaborate? – Harry Wright Jan 12 '18 at 17:21
2

Option 1 is what you want to do here. When using inheritance within your contracts, you will only deploy the most derived contract (in your case, Contract B).

Effectively, you will be deploying one contract which contains all of the code from the inherited contracts. I hope this helps.

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.