Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

GatekeeperTwo


tl; dr




contract GatekeeperTwo {

  address public entrant;

  modifier gateOne() {
    require(msg.sender != tx.origin);
    _;
  }

  modifier gateTwo() {
    uint x;
    assembly { x := extcodesize(caller()) }
    require(x == 0);
    _;
  }

  modifier gateThree(bytes8 _gateKey) {
    require(uint64(bytes8(keccak256(abi.encodePacked(msg.sender)))) ^ uint64(_gateKey) == type(uint64).max);
    _;
  }

  function enter(bytes8 _gateKey) public gateOne gateTwo gateThree(_gateKey) returns (bool) {
    entrant = tx.origin;
    return true;
  }
}


discussion




solution


  • check test/14/GatekeeperTwo.t.sol:


  • run:

> forge test --match-contract GatekeeperTwoTest -vvvv    


  • submit with script/14/GatekeeperTwo.s.sol:


  • by running:

> forge script ./script/14/GatekeeperTwo.s.sol --broadcast -vvvv --rpc-url sepolia




pwned...