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);
}
_tt.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.
EDIT
initial deployment
const Migrations = artifacts.require('./Migrations.sol')
module.exports = function (deployer) {
deployer.deploy(Migrations)
}
deploying contracts
const TutorialToken = artifacts.require('./TutorialToken.sol')
const Sellers = artifacts.require('./Sellers.sol')
module.exports = function (deployer) {
deployer.deploy(TutorialToken),
deployer.deploy(Sellers)
}
Migrations.sol
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);
upgraded.setCompleted(last_completed_migration);
}
}
_tt.f()
is invoked. Your code here will not compile!Sellers
without passing constructor arguments.