Skip to content

Instantly share code, notes, and snippets.

@arwer13
Last active October 5, 2022 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arwer13/ddcca2c6ba524deef62ec905150a3f9d to your computer and use it in GitHub Desktop.
Save arwer13/ddcca2c6ba524deef62ec905150a3f9d to your computer and use it in GitHub Desktop.
contract Foo {
uint256 constant MAX_WITHDRAWAL_ATTEMPTS = 3;
mapping(address => uint256) private numWithdrawalAttempts;
function doWithdrawalRequest() public {
require(numWithdrawalAttempts[msg.sender] <= MAX_WITHDRAWAL_ATTEMPTS);
// ...
numWithdrawalAttempts[msg.sender] = numWithdrawalAttempts[msg.sender] + 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment