Skip to content

Instantly share code, notes, and snippets.

@Zeegaths
Last active April 3, 2024 16:07
Show Gist options
  • Save Zeegaths/5b0d1b9644e3b435aa7f5a5fcfe259c2 to your computer and use it in GitHub Desktop.
Save Zeegaths/5b0d1b9644e3b435aa7f5a5fcfe259c2 to your computer and use it in GitHub Desktop.
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