* Change import path from zos-lib to upgrades in all contracts * Update readme with new naming * Update package and deps names * Change path to initializable in AST of networks.jsons * Migrate manifest version * Use new oz file locations * Rename in ERC20Migrator comments * Update SDK install instructions in README * Update gitignore to use new session file name * trigger CI * Fixes to readme and package version * Use 2.5.0 release of OpenZeppelin SDK
63 lines
1.4 KiB
Solidity
63 lines
1.4 KiB
Solidity
pragma solidity ^0.5.2;
|
|
|
|
import "@openzeppelin/upgrades/contracts/Initializable.sol";
|
|
import "../access/roles/PauserRole.sol";
|
|
|
|
/**
|
|
* @title Pausable
|
|
* @dev Base contract which allows children to implement an emergency stop mechanism.
|
|
*/
|
|
contract Pausable is Initializable, PauserRole {
|
|
event Paused(address account);
|
|
event Unpaused(address account);
|
|
|
|
bool private _paused;
|
|
|
|
function initialize(address sender) public initializer {
|
|
PauserRole.initialize(sender);
|
|
|
|
_paused = false;
|
|
}
|
|
|
|
/**
|
|
* @return true if the contract is paused, false otherwise.
|
|
*/
|
|
function paused() public view returns (bool) {
|
|
return _paused;
|
|
}
|
|
|
|
/**
|
|
* @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 onlyPauser whenNotPaused {
|
|
_paused = true;
|
|
emit Paused(msg.sender);
|
|
}
|
|
|
|
/**
|
|
* @dev called by the owner to unpause, returns to normal state
|
|
*/
|
|
function unpause() public onlyPauser whenPaused {
|
|
_paused = false;
|
|
emit Unpaused(msg.sender);
|
|
}
|
|
|
|
uint256[50] private ______gap;
|
|
}
|