1

Here's create2 opcode used by UniswapV2Factory contract

create2(0, add(bytecode, 32), mload(bytecode), salt)

My question is how mload returns the length of creatonCode. According to my understanding mload is mem[x...x+32] opcode and it returns bytes data

1 Answers1

0

According to the Solidity document "Layout in Memory":

The length of a dynamic array is stored at the first slot of the array and followed by the array elements.

enter image description here

Here we have the number "5" at memory 0x80~0x9F, just before the content of the bytes starting at 0xA0.

LCamel
  • 61
  • 3