Mirror

Difficulty

Mirror Mirror on the Wall, Who's the Smartest of Them All?
Author: Razzor
Network: Goerli
Deployer: 0x978441D08D5Fe85B3B3006FD3E1c9bEB68A893d2

Contract Code

pragma solidity 0.8.18;
contract Mirror{
    address pendingOwner;
    bool public pwned;
    enum Difficulty{
        Ezz,
        WTF,
        SUICIDE
    }
    
    function transferOwnership(address target, address owner, Difficulty diff) external returns(address){
        require(target.code.length < 3, "HeHe :P");
        (bool success, bytes memory returnData) = address(target).call(abi.encodeWithSelector(bytes4(keccak256(abi.encodePacked("transferOwnership(address)",owner))),owner));
        require(success, "call failed");
        uint j;
        for(uint i=uint8(diff);i<2;++i){
            returnData[j] = hex'00';
            ++j;
        }
        pendingOwner = owner;
        return abi.decode(returnData,(address));

    }
    function acceptOwnership() external {
        require(msg.sender == pendingOwner, "Not the Pending Owner");
        require(!pwned, "Already pwned");
        delete pendingOwner;
        pwned = true;
    }

}