0

I'm hoping to use openzeppelin-solidity contracts. One of them uses Ownable. Is the following okay to do (via truffle compile and migrate)? Thank you.

var OmniCAT = artifacts.require("./OmniCAT.sol");
var Ownable = artifacts.require("./Ownable.sol");
module.exports = function(deployer) {
  deployer.deploy(Ownable);
  deployer.deploy(OmniCAT);
};
  • 1
    Sure, but if it's the correct way for your situation depends on whether OmniCAT inherits from Ownable. Please add your contract code if you want someone to take a look at it – Henk Aug 15 '18 at 18:24
  • You say one of them 'uses' Ownable and I think you mean it 'inherit' from Ownable. If that is the case inherited contracts should not be deployed. – Ismael Aug 18 '18 at 16:11
1

It is correct from a jssyntax point of view. But since the OmniCat uses the Ownable contract, you should wait for it to deploy then deploy OmniCat.

This is because, deployment takes time so it is done asynchronously. truffle uses promises when deploying.

in the end I think this will work better :

var OmniCAT = artifacts.require("./OmniCAT.sol");
var Ownable = artifacts.require("./Ownable.sol");
module.exports = function(deployer) {
  deployer.deploy(Ownable).then(
      Ownabledeployed =>{
        deployer.deploy(OmniCAT);
  });

};

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.