Skip to main content
4 of 6
added 971 characters in body
eth
  • 86.6k
  • 54
  • 289
  • 418

Using remix.ethereum.org, here is an example that can help.

enter image description here

The input, which is the same as calldata, is 0x29ae811475944220b52381f169021a7c3f2947dfd0d2b1fb95e6cd92358e0a7997c8a9a1000000000000000000000000000000000000000000000000000000000000000f. (This is calling file( 0x75944220b52381f169021a7c3f2947dfd0d2b1fb95e6cd92358e0a7997c8a9a1, 15))

calldataload is the EVM opcode for getting 32 bytes from calldata. The parameter to calldataload is an offset: typically the first 4 bytes of calldata is a function selector, so calldataload(4) is used to get the 32 bytes starting from the fifth byte (in this example, 0x75944...). calldata(36) then gets the next 32 bytes, which is 15 in hex, padding the uint to 32 bytes.

How calldata is stored in memory? gives another example of calldata.

The logs are:

[ { "from": "0x692a70d2e424a56d2c6c27aa97d1a86395877b3a", "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e029ae811475944220b52381f169021a7c3f2947dfd0d2b1fb95e6cd92358e0a7997c8a9a1000000000000000000000000000000000000000000000000000000000000000f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "topics": [ "0x29ae811400000000000000000000000000000000000000000000000000000000", "0x000000000000000000000000ca35b7d915458ef540ade6068dfe2f44e8fa733c", "0x75944220b52381f169021a7c3f2947dfd0d2b1fb95e6cd92358e0a7997c8a9a1", "0x000000000000000000000000000000000000000000000000000000000000000f" ] } ] 

The last two topics are the what and data arguments of file.

eth
  • 86.6k
  • 54
  • 289
  • 418