1

I'm a bit confused about migrations. I've just been told to use 1_migration.js file per contract, except maybe in the case of imports. I am going to change these migrations back to one per migration, but what about the first 2 contracts-- Do I need that first line and corresponding first call to .deploy(Ownable). Thank you for helping.

2_deploy_contracts.js

var Ownable = artifacts.require("./Ownable.sol");
var OmniCAT = artifacts.require("./OmniCAT.sol");
var IronLevels = artifacts.require("./IronLevels.sol");
var Dass42 = artifacts.require("./Dass42.sol");

// Make sure Ownable migrates first since OmniCat inherits
module.exports = function(deployer) {
  deployer.deploy(Ownable);
  deployer.deploy(OmniCAT);
  deployer.deploy(IronLevels);
  deployer.deploy(Dass42);  
};

contract OmniCAT is Ownable // imports Ownable
contract IronLevels is OmniCAT
contract Dass42 is OmniCAT
3

You do not need to explicitly deploy any contracts you inherit from, or any contracts that are deployed during the deployment of another contract. For instance, if you have:

contract A is B {

}

Contract B does not need to be deployed at all.

Additionally, if you have:

contract A is B {
    C cInstance = new C();
}

Then C will be deployed automatically as part of A's deployment.

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.