Last active
February 1, 2023 16:39
-
-
Save bartubozkurt/f2ff31dc77ed8df584244e3e369834a4 to your computer and use it in GitHub Desktop.
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
/* Bad */ | |
contract BadGuy { | |
function isLove(address _addr) external returns(bool) {} | |
} | |
contract BadGirl { | |
BadGuy badguy; | |
modifier isCheck(address _addr) { | |
require(badguy.isLove(_addr)); | |
_; | |
} | |
function check() isCheck(msg.sender) public {} | |
} | |
/* Better */ | |
contract GoodGirl { | |
mapping(address => bool) love; | |
modifier isCheck(address _addr) { | |
require(love[msg.sender],"Insufficient Love, try again"); | |
_; | |
} | |
function check() isCheck(msg.sender) public {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment