LimitBalance.sol 538 B

123456789101112131415161718192021222324252627
  1. pragma solidity ^0.4.4;
  2. /**
  3. * LimitBalance
  4. * Simple contract to limit the balance of child contract.
  5. * Note this doesn't prevent other contracts to send funds
  6. * by using selfdestruct(address);
  7. * See: https://github.com/ConsenSys/smart-contract-best-practices#remember-that-ether-can-be-forcibly-sent-to-an-account
  8. */
  9. contract LimitBalance {
  10. uint public limit;
  11. function LimitBalance(uint _limit) {
  12. limit = _limit;
  13. }
  14. modifier limitedPayable() {
  15. if (this.balance > limit) {
  16. throw;
  17. }
  18. _;
  19. }
  20. }