You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
933 B
49 lines
933 B
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 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 public {
|
|
paused = true;
|
|
emit Pause();
|
|
}
|
|
|
|
/**
|
|
* @dev called by the owner to unpause, returns to normal state
|
|
*/
|
|
function unpause() onlyOwner whenPaused public {
|
|
paused = false;
|
|
emit Unpause();
|
|
}
|
|
}
|
|
|