I have two Contracts - a contract with a single constructor argument (ContractB), and a launcher that deploys new instances (Launcher).

Using Truffle for testing how can I link the contracts without deploying contract B, given that contract B will return an error if deployed without prams

Error: ContractB contract constructor expected 1 arguments, received 0

Here is the link to Git repository


var Launcher = artifacts.require("./Launcher.sol");
var ContractB = artifacts.require("./ContractB.sol");

module.exports = function(deployer) {
  deployer.link(ContractB, Launcher);

Test File

var Launcher = artifacts.require("./Launcher.sol");

contract('Launcher', function(accounts) {
  it("Launcher Deploy", function() {
    return Launcher.deployed().then(function(instance) {


pragma solidity ^0.4.18;

import "./ContractB.sol";

contract launcher {

    function launch() public returns(address) {
        ContractB contractLocation = new ContractB(msg.sender);


pragma solidity ^0.4.18;

contract ContractB {
    address public owner;
    constructor(address addr) public {
    owner = addr;

    function get() public view returns(address) {

Here is the link to Git repository

1 Answer 1


You don't deploy ContractB with migrations.

You should use a migration to deploy Launcher. There is no need to deploy ContractB because that's Launcher's job.

Couple of things to watch out for:

  • Hi Rob, Thank you for your answer but I was hoping we could keep the answer focused on truffle deployment rather than solidity code improvement Aug 17, 2018 at 7:41
  • Consider rephrasing the question. It's unclear if you are focused on deployment or testing. Aug 17, 2018 at 14:57
  • Done, hope it helps others ) Aug 18, 2018 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.