In my 2_deploy_contracts.js
file, I can successfully migrate all my contracts using the command truffle migrate
. My problem is that after migration, I want to call a function from contract D and pass it the address of contract E.
My 2_deploy_contracts.js
file looks like this (contract names replaced):
const A = artifacts.require("A");
const B = artifacts.require("B");
const C = artifacts.require("C");
const D = artifacts.require("D");
const E = artifacts.require("E");
module.exports = function(deployer) {
deployer.deploy(A);
deployer.deploy(B);
deployer.deploy(C);
deployer.deploy(D)
.then(function() {
return deployer.deploy(E, D.address);
})
.then(function() {
return D.methods.setEContractAddress(E.address); // This line
});
};
I have looked at other similar questions on this site but none have helped so far. How do I call the setEContractAddress()
function from contract D after contract E is migrated?
Thank you for your help and time!