I've been trying to store a hardcoded call in a contract, but I'm getting confused on the encoding.
Let's say I have the following bytes:
0x9461d6f7000000000000000000000000000000000000000000000000000000000000000a796f000000000000000000000000000000000000000000000000000000000000
This translates to calling function testData(uint256 testVar, bytes32 otherVar)
with 10 & "yo".
If I store this as a bytes like so:
bytes public hardcodedCallData = "0x9461d6f7000000000000000000000000000000000000000000000000000000000000000a796f000000000000000000000000000000000000000000000000000000000000";
And then do a address.call(hardcodedCallData)
, it does not work. The fallback function is triggered instead, assuming that it is malformed. When storing it as such, it seems it decodes to bytes that look different.
I seem to have a misunderstanding on encoding here somewhere. Given calldata, how do I store it as bytes as hardcoded, so I can do the above?
I tried variations (playing with strings for example), but not able to figure this out.