12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- pragma solidity ^0.4.11;
- import "../ownership/Ownable.sol";
- /**
- * @title Pausable
- * @dev Base contract which allows children to implement an emergency stop mechanism.
- */
- contract Pausable is Ownable {
- event Pause();
- event Unpause();
- bool public paused = false;
- /**
- * @dev Modifier to make a function callable only when the contract is not paused.
- */
- modifier whenNotPaused() {
- require(!paused);
- _;
- }
- /**
- * @dev Modifier to make a function callable only when the contract is paused.
- */
- modifier whenPaused() {
- require(paused);
- _;
- }
- /**
- * @dev called by the owner to pause, triggers stopped state
- */
- function pause() onlyOwner whenNotPaused {
- paused = true;
- Pause();
- }
- /**
- * @dev called by the owner to unpause, returns to normal state
- */
- function unpause() onlyOwner whenPaused {
- paused = false;
- Unpause();
- }
- }
|