Standalone

Unexpected Ether

close button

Part I

Sending Unexpected Ether

Download quests in Questplay

Play Silverfish and win. The game is as follows:

  1. Players take turns depositing 0.1 ETH into the game.

  2. 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:

  1. deposit(): Caller deposits 0.1 ETH into the game. Only can be called once per block.

  2. 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.