Skip to content

Instantly share code, notes, and snippets.

@michielmulders
Created August 5, 2018 16:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save michielmulders/e5fb9f99ad9a7aaa5719d522355724df to your computer and use it in GitHub Desktop.
Balance Limit Design Pattern Solidity Ethereum
contract LimitBalance {
uint256 public limit;
function LimitBalance(uint256 value) public {
limit = value;
}
modifier limitedPayable() {
require(this.balance <= limit);
_;
}
function deposit() public payable limitedPayable {
// some code
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment