Created
February 28, 2023 11:53
-
-
Save deliriusz/b720711aca005e99a1d3eed1c7dc6cf0 to your computer and use it in GitHub Desktop.
Try to unlock the contract for eternal glory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.0; | |
interface IERC20 { | |
function balanceOf(address) external view returns (uint256); | |
function transfer(address, uint256) external view returns (bool); | |
} | |
contract Unlockooor { | |
bool public isUnlocked; | |
address public unlockooor; | |
function unlock(address mysteriousAddress) external { | |
require (msg.sender.code.length == 0); | |
require (msg.sender == tx.origin); | |
require (mysteriousAddress.code.length == 0); | |
require (IERC20(mysteriousAddress).balanceOf(msg.sender) > 0); | |
isUnlocked = true; | |
unlockooor = msg.sender; | |
} | |
function praiseUnlockooor() external view returns (string memory) { | |
if (msg.sender == unlockooor && isUnlocked) { | |
return "Oh praised by thy almighty unlockooor!!!"; | |
} | |
return "Yeah, right... Beat it!"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment