Standalone
Unexpected Ether
Part I
Sending Unexpected Ether
Download quests in Questplay
Play Silverfish and win. The game is as follows:
Players take turns depositing 0.1 ETH into the game.
Once 1 ETH is deposited, the first player who rings the bell gets the collected ETH.
The game is implemented in the SimpleGameV1
contract. The contract consists of the following functions:
deposit()
: Caller deposits 0.1 ETH into the game. Only can be called once per block.claim()
: Caller rings the bell. The first player to do so once the contract's balance exceeds 1 ETH receives the contract's funds.
Your Task
In contracts/Attacker.sol
, implement attack()
such that it can always win a new SimpleGameV1
(i.e. successfully call SimpleGameV1.claim()
).
When testing, you can assume that the backend will provide attack()
with 0.5 ETH to spend. SimpleGameV1
will have 0.5 ETH already deposited.
You should only make changes to contracts/Attacker.sol
.
Run tests in Questplay
The only way to drive off these troublemakers will be to force them to lose every time. It’s time to cheat.