Level 1 Noob Hacker
Ethernaut 12 Elevator
0 / 100 EXP 100 EXP to Junior Hacker
0%

Challenge 12 / Ethernaut

Elevator

Goal

  1. Make the Elevator report that it has reached the top floor.

Your task

Read Elevator.sol, then complete Exploit.s.sol.

:~/targets/ethernaut-elevator$
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface Building {
    function isLastFloor(uint256) external returns (bool);
}

contract Elevator {
    bool public top;
    uint256 public floor;

    function goTo(uint256 _floor) public {
        Building building = Building(msg.sender);
        if (!building.isLastFloor(_floor)) {
            floor = _floor;
            top = building.isLastFloor(floor);
        }
    }
}