Last active
August 24, 2018 19:26
-
-
Save michielmulders/2b55e939e009465a7f0f309283e299bf to your computer and use it in GitHub Desktop.
Simple Rate Limit Withdraw function Solidity Ethereum
This file contains 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
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