Created
February 1, 2023 17:29
-
-
Save bartubozkurt/9a7d11c3854a3fcd0d41d7214e1e0b83 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
address token; | |
mapping(address => uint) canBorrowAmount; | |
/* Bad */ | |
function badBorrow(uint amounts) public { | |
require(amounts <= canBorrowAmount[msg.sender]); // 1.πππππ | |
IERC777(token).transfer(msg.sender, amounts) // 3.ππ‘π§ππ₯πππ§ππ’π‘ | |
canBorrowAmount[msg.sender] - amounts; // 2.ππππππ§π¦ | |
} | |
/* Better */ | |
function goodBorrow(uint amounts) public { | |
require(amounts <= canBorrowAmount[msg.sender]); // 1.πππππ | |
canBorrowAmount[msg.sender] - amounts; // 2.ππππππ§π¦ | |
IERC777(token).transfer(msg.sender, amounts) // 3.ππ‘π§ππ₯πππ§ππ’π‘ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment