// Copy calldata to memory offset 0calldatacopy(0,0, calldata_size);// Create a new contract based on that calldata stored in memory, deposit 0 wei into it.// Return the new contract's address back to the stack.contract_address =create(0,0, calldata_size);// Delegatecall// Return 0 or 1returndata =delegatecall(gas, contract_address,0,0,0,0);// Read the storage slot 5element =sload(0x05);if (element ==0xAA) {jump(0x1E);}
The new contract must store 0xAA in storage slot 5. The runtime code is easy to write:
PUSH1 0xAA
PUSH1 0x05
SSTORE
Compile:
60aa600555
Build a creation code just like what we did in Puzzle 2: