2

Is is possible to call a Smart Contract from an existing Smart Contract? Lets say you are an function and want to call an other smart Contract - is this possible? How?

q9f
  • 32,913
  • 47
  • 156
  • 395
Wi1616
  • 521
  • 4
  • 8

1 Answers1

3

This is covered in the documentation under External Function Calls:

contract InfoFeed {
    function info() payable returns (uint ret) { return 42; }
}

contract Consumer {
    InfoFeed feed;
    function setFeed(address addr) { feed = InfoFeed(addr); }
    function callFeed() { feed.info.value(10).gas(800)(); }
}

Though not an exact duplicate, this thread may be of use in creating a working example: How to make external contract function calls from one contract to another?

Richard Horrocks
  • 37,835
  • 13
  • 87
  • 144