Skip to content

Instantly share code, notes, and snippets.

@michielmulders
Last active August 24, 2018 19:26
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 michielmulders/2b55e939e009465a7f0f309283e299bf to your computer and use it in GitHub Desktop.
Save michielmulders/2b55e939e009465a7f0f309283e299bf to your computer and use it in GitHub Desktop.
Simple Rate Limit Withdraw function Solidity Ethereum
contract RateLimit {
uint enabledAt = now;
modifier enabledEvery(uint t) {
require(now >= enabledAt, "Access is denied. Rate limit exceeded.");
enabledAt = now + t;
_;
}
function f() public enabledEvery(1 minutes) {
// some code
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment