I have two contracts, contractA
& contractB
. I want Truffle to first deploy contractA
, then pass it as an argument to contractB
's constructor.
This is what I am currently trying, but contractB
never actually gets deployed:
let contractA = artifacts.require("./contractA.sol");
let contractB = artifacts.require("./contractB.sol");
module.exports = async function(deployer, network) {
await deployer.deploy(contractA); // this gets deployed fine
deployer.deploy(contractB, contractA.address); // this *never* gets deployed
};
As a matter of fact, contractB
does not get deployed even if I change the code to this:
await deployer.deploy(contractA);
deployer.deploy(contractB, "0x123"); // does not deploy even if I enter the address manually
What am I missing here?
Best Answer
Try this: