I am trying to call a function of an already deployed contract from within another contract.

import "./TutorialToken.sol";
contract Sellers
  TutorialToken _tt;

  constructor(address _f) public
      _tt = TutorialToken(_f);


However when I try and truffle migrate I get an error "Sellers" -- Invalid number of parameters for "undefined". Got 0 expected 1!

I am confused on how I call the function of an already deployed contract from within another contract.


initial deployment

const Migrations = artifacts.require('./Migrations.sol')

module.exports = function (deployer) {

deploying contracts

const TutorialToken = artifacts.require('./TutorialToken.sol')
const Sellers = artifacts.require('./Sellers.sol')

module.exports = function (deployer) {


pragma solidity ^0.5.0;

contract Migrations {
address public owner;
uint public last_completed_migration;

modifier restricted() {
    if (msg.sender == owner) _;

constructor() public {
    owner = msg.sender;

function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;

function upgrade(address new_address) public restricted {
    Migrations upgraded = Migrations(new_address);


  • What is this incomplete piece of code? Please provide a minimal working example, including both contracts and the function from which _tt.f() is invoked. Your code here will not compile! Jan 8, 2019 at 15:59
  • Also, in order to answer your question, what we would really need to see is your Truffle migration script, which is not even present here. Jan 8, 2019 at 16:00
  • I am aware this won't compile, I have taken code out in order to simplify the question. It doesn't matter what the contract TutorialToken is or what the function it is calling is, my question is about how in general one calls a method from a contract that has been already deployed, rather than making a new instance of the contract. I have updated my question to show my initial migration script and the contract deployments. Jan 8, 2019 at 16:05
  • You are trying to deploy Sellers without passing constructor arguments. Jan 8, 2019 at 16:11

1 Answer 1


You are trying to deploy the Sellers without passing constructor arguments.

You also have a suspicious comma in that piece of code up there.

Change this:

deployer.deploy(TutorialToken), // what's this comma for?

To this:

deployer.deploy(TutorialToken).then(function() {
  return deployer.deploy(Sellers, TutorialToken.address);

See Truffle documentation for more details.

Your Answer

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

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