I'm trying to invoke another contract in solidity using raw calls but I'm encountering some problems.
instance.call.gas(gas).value(price)(bytes4(keccak256("method(string)")), param);
this instruction is inside my second contract and while I try to get the value of the param
from my first contract function its empty but instead its value is passed into msg.data
.
I added an event on my first contract to see how the parameters has been sent.
function method(string param) payable external {
Debug(param, msg.sender, msg.value, msg.data);
}
basically param is always empty while the data inside the msg
are always sent and in msg.data
there is my parameter value (in bytes).
I saw this discussion already and I tried to cast my string to bytes32 or passing the value without storing it into a local variable but the result is the same.
Calling a method directly with a parameter eg. instance.method2(stringParam)
will work, but I can't use it in my case since I'm trying to call a payable method and I need to sent eth.