Last active
April 3, 2024 16:07
-
-
Save Zeegaths/5b0d1b9644e3b435aa7f5a5fcfe259c2 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
function withdraw(uint _amount) public onlyVIP { | |
require( | |
_amount <= maxETH, | |
"Cannot withdraw more than 0.5 ETH per transaction" | |
); | |
require(balances[msg.sender] >= _amount, "Not enough ether"); | |
balances[msg.sender] -= _amount; | |
(bool success, ) = payable(msg.sender).call{value: _amount}(""); | |
require(success, "Withdraw Failed!"); | |
} | |
//change public functions to external to save gas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment