I was wondering if there was a way, in theory, to call from a sc two functions from a secondary sc in which the result from the first function is a parameter of the second function so something like:

Contract 1

function one(uint a, unit b) public returns(uint){
    uint c = a+b 
    return c

function two(uint c, uint d)public returns(uint){
    uint d = c+d
    return d


Contract 2

function combine(){
     one(a + b)
     two(c + d)


I cannot combine them.

The second requires the first to be executed.

I cannot extrapolate the result of the first in any way

It has to be executed within the second contract.

  • you mean the out put of the first function to be used as a parameter of second? can you return some value which you can assign as variable and then use it? Thanks – Yogesh - EtherAuthority.io Apr 24 '19 at 12:31

Yes, this can be done. Assuming that these two contracts are deployed indipendently:

First, deploy the first contract:

contract first{

    function one(uint256 a, uint256 b) public pure returns(uint){
        uint256 c = a + b; 
        return c;

    function two(uint c, uint d)public pure returns(uint){
        uint256 e = c + d;
        return e;


using the deployment address fo the first contract, build the second contract like this:

contract second{

    first firstContract = first('put here the first contract address');

    function combine(uint256 a, uint256 b, uint256 d) public view returns(uint256){
         uint256 c = firstContract.one(a, b);
         uint256 e = firstContract.two(c, d);
         return e;


That will work. Test it on Remix.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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