The low-level .call
function allows you to call a function by its function signature calculated as bytes4(sha3("functionName()"))
. Also take a look at https://ethereum.stackexchange.com/a/9722/16 and Call contract and send value from Solidity. If your function has parameters, the signature looks as follows bytes4(sha3("functionName(uint256,string,address)"))
- keep in mind that instead of uint
you have to use uint256
. The following parameters are the actual values of the parameters. Thus, the whole call would look like
x.call(bytes4(sha3("functionName(uint256,string,address)")), myUIntVal, myStringVal, myAddressVal);
You can also specify a specific gas or value (ether (but in Wei!) to send along) like this:
x.call.value(1234)(bytes4(sha3("functionName(uint256,string,address)")), myUIntVal, myStringVal, myAddressVal);