4

I am very new to developing smart contracts. I have a simple question, do i need to write migration file separately for each contract i deploy from an account using truffle or can i deploy multiple contracts using a single migration file. How to write such file?

Any help please.

13
var Oracle = artifacts.require("./Oracle.sol");
var Test_Oracle = artifacts.require("./Test_Oracle.sol");

module.exports = function(deployer){
  deployer.deploy(Oracle);
  deployer.deploy(Test_Oracle);
}

or if you have dependencies...like a constructor argument that takes an address of another deployed contract:

var Factory = artifacts.require("./Factory.sol");
var Tokendeployer = artifacts.require("./Tokendeployer.sol");

module.exports = function(deployer) {
  deployer.deploy(Factory).then(function(){
        return deployer.deploy(Tokendeployer, Factory.address)
});
};

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.