I have a piece of code like so:
address x=0x01234..;
x.call(data1, data2, data3);
Will this do what I expect and call the contract at address x
while passing the data in concatenated like data1+data2+data3 (and bare, without any solidity ABI formatting)? I can't find any documentation about this.
Best Answer
The low-level
.call
function allows you to call a function by its function signature calculated asbytes4(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 followsbytes4(sha3("functionName(uint256,string,address)"))
- keep in mind that instead ofuint
you have to useuint256
. The following parameters are the actual values of the parameters. Thus, the whole call would look likeYou can also specify a specific gas or value (ether (but in Wei!) to send along) like this: