Skip to content

Instantly share code, notes, and snippets.

@deliriusz
Created February 28, 2023 11:53
Show Gist options
  • Save deliriusz/b720711aca005e99a1d3eed1c7dc6cf0 to your computer and use it in GitHub Desktop.
Save deliriusz/b720711aca005e99a1d3eed1c7dc6cf0 to your computer and use it in GitHub Desktop.
Try to unlock the contract for eternal glory
// 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