calldata
CALLDATASIZE
tells the size of the transaction data.CALLDATALOAD
loads 32 bytes of the transaction data onto the stack.CALLDATACOPY
copies a number of bytes of the transaction data to memory.
offset
is the position in the calldata where the actual data of the array starts, i.e. where the first array element is located. Let's take an example:
calldataload
calldataload
calldataload
is the EVM opcode for getting 32 bytes fromcalldata
.The parameter to
calldataload
is an offset: typically the first 4 bytes ofcalldata
is a function selector, socalldataload(4)
is used to get the 32 bytes starting from the fifth byte
Last updated