Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up| pragma solidity ^0.4.24; | |
| import "../ownership/Ownable.sol"; | |
| /** | |
| * @title Pausable | |
| * @dev Base contract which allows children to implement an emergency stop mechanism. | |
| */ | |
| contract Pausable is Ownable { | |
| event Paused(); | |
| event Unpaused(); | |
| 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() public onlyOwner whenNotPaused { | |
| paused = true; | |
| emit Paused(); | |
| } | |
| /** | |
| * @dev called by the owner to unpause, returns to normal state | |
| */ | |
| function unpause() public onlyOwner whenPaused { | |
| paused = false; | |
| emit Unpaused(); | |
| } | |
| } |