Skip to content

Commit

Permalink
Remove extraneous bool check
Browse files Browse the repository at this point in the history
Update require check for requestAddress to directly check the bool condition instead of using `==`.
  • Loading branch information
wankhede04 authored Feb 14, 2023
1 parent d9a8599 commit 1795ecf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 32_Faucet/Faucet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ contract Faucet {

// 用户领取代币函数
function requestTokens() external {
require(requestedAddress[msg.sender] == false, "Can't Request Multiple Times!"); // 每个地址只能领一次
require(!requestedAddress[msg.sender], "Can't Request Multiple Times!"); // 每个地址只能领一次
IERC20 token = IERC20(tokenContract); // 创建IERC20合约对象
require(token.balanceOf(address(this)) >= amountAllowed, "Faucet Empty!"); // 水龙头空了

Expand All @@ -92,4 +92,4 @@ contract Faucet {

emit SendToken(msg.sender, amountAllowed); // 释放SendToken事件
}
}
}

0 comments on commit 1795ecf

Please sign in to comment.