How can I hard code bytes in solidity for a static call?
Ive tried:
bytes memory data = "0xfeaf968c";
bytes memory data = \xfeaf968c";
It works when I manually enter it as an input parameter, while it fails for some reason when I externally call it when its hard coded in this format.
You can use the hex keyword to hard-code bytes in your contract.
bytes memory data = hex"feaf968c";
or
bytes memory data = "\xfe\xaf\x96\x8c";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With