I have two smart contracts,
the first which i intend to deploy first then after a couple of days the other will follow. my issue is how to import this contract i have already deployed and use its functions in my contract.
i have tried Coin1 _coin1 = Coin1(addressOfCoin1);
but it doesn't work and when i use the import statement it throws error at point of deployment.

  • 1
    Possible duplicate of Calling function from deployed contract
    – Sig Touri
    Jan 18, 2017 at 0:32
  • Upvoted even though I agree duplicate and added more helpful information on Sig's question, such as coderwithattitude question about specifying all arguments in the abstract contract; and an example of 3 files showing the abstract contract, the implementation, and the "caller".
    – eth
    Jan 18, 2017 at 7:04

1 Answer 1


in the same file define the first contract in an abstract form and within your current contract make the needed call,e.g:

 contract Coin1{
        function f() payable returns (uint);

    contract Coin2{
        Coin1 coin;
        function setcoin(address addr) { coin= Coin1(addr); }
        function callcoin() { coin.f.value(10).gas(800)(); // you call the desired function here we call info with 800 gas; }

you will find more detail on the official documentation about the External Function Calls

  • Thank you for your response but when i do this i get the following error "member not found in argument dependent lookup" do i need to specify all the arguments in the live contract in the abstract form also? Jan 16, 2017 at 12:46
  • and the constructor in coin gives me error "non empty returns directive" Jan 16, 2017 at 12:49
  • @coderwithattitude Yes, you need to specify all arguments in the abstract form. Constructors don't return values so remove the returns in your constructor to fix it.
    – eth
    Jan 18, 2017 at 5:58
  • thanks for your time, this is what worked for me incase anyone needs it. dappsforbeginners.wordpress.com/tutorials/… Jan 26, 2017 at 7:02

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