Sending ether between contracts that does not know each other

by Suzana Maranhão   Last Updated November 04, 2018 04:28 AM

I want to create a call from a smart contract A to a smart contract B.

Premisses:

  • I have enough ether balance in A
  • I do not know what is the name of B's function to be called
  • B's function is payable and do not accept any arguments
  • hexData is the SHA3 of the name of the B's function
  • I do not want to delegate A's storage
  • I want to fail if B's function caused an EVM exception
  • Two questions:

    a) Is it the best way to codify this need?

    function newTransferToB(address B, uint256 valueInWei, bytes4 hexData) onlyOwner {
    
        if(!B.call.value(valueInWei)(hexData)) revert();  
    
    }
    

    b) What if I do not know the number of arguments of B's function?



    Related Questions




    DApp storage for data other than tranactions

    Updated August 28, 2017 18:28 PM

    Hidden information for game contract

    Updated September 29, 2017 04:28 AM