✅Puzzle 4
ADDRESS, BALANCE
Puzzle
Solution
This combo:
is equivalent to:
Pseudocode:
The new contract must burn half of the balance it receives. For example, if the challenge contract has 8 wei, then 4 wei is sent to the new contract when create()
is called. Once received, the new contract must burn 4 wei so that 8 wei / 4 wei == 2
.
Burning half of the balance is equivalent to sending them to the zero address. Suppose we are sending 8 wei as msg.value, then we need to burn 4 wei in the new contract. This can be done with CALL
:
We are not returning anything because nothing needs to be returned, but the RETURN
part of the code is needed to terminate the contract.
Compile:
Last updated