2020-09-14 17:46:27 +00:00
|
|
|
pragma solidity ^0.6.8;
|
|
|
|
|
2020-09-14 17:59:00 +00:00
|
|
|
// Comments made with // are due current max code size at LendingPool
|
|
|
|
|
2020-09-14 17:46:27 +00:00
|
|
|
// import {Errors} from '../libraries/helpers/Errors.sol';
|
2020-09-14 13:24:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Contract module which allows children to implement an emergency stop
|
|
|
|
* mechanism that can be triggered by an authorized account.
|
|
|
|
*
|
|
|
|
* This module is used through inheritance. It will make available the
|
|
|
|
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
|
|
|
|
* the functions of your contract. Note that they will not be pausable by
|
|
|
|
* simply including this module, only once the modifiers are put in place.
|
|
|
|
*/
|
2020-09-14 13:59:11 +00:00
|
|
|
contract PausablePool {
|
2020-09-14 13:24:30 +00:00
|
|
|
/**
|
|
|
|
* @dev Emitted when the pause is triggered by `account`.
|
|
|
|
*/
|
2020-09-14 13:59:11 +00:00
|
|
|
event Paused();
|
2020-09-14 13:24:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Emitted when the pause is lifted by `account`.
|
|
|
|
*/
|
2020-09-14 13:59:11 +00:00
|
|
|
event Unpaused();
|
2020-09-14 13:24:30 +00:00
|
|
|
|
|
|
|
bool private _paused;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Initializes the contract in unpaused state.
|
|
|
|
*/
|
|
|
|
constructor() internal {
|
|
|
|
_paused = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Returns true if the contract is paused, and false otherwise.
|
|
|
|
*/
|
|
|
|
function paused() public virtual view returns (bool) {
|
|
|
|
return _paused;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Modifier to make a function callable only when the contract is not paused.
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
*
|
|
|
|
* - The contract must not be paused.
|
|
|
|
*/
|
|
|
|
modifier whenNotPaused() {
|
2020-09-14 17:46:27 +00:00
|
|
|
// require(!_paused, Errors.IS_PAUSED);
|
2020-09-14 13:24:30 +00:00
|
|
|
require(!_paused, '54');
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Modifier to make a function callable only when the contract is paused.
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
*
|
|
|
|
* - The contract must be paused.
|
|
|
|
*/
|
|
|
|
modifier whenPaused() {
|
2020-09-14 17:46:27 +00:00
|
|
|
// require(_paused, Errors.NOT_PAUSED);
|
2020-09-14 13:24:30 +00:00
|
|
|
require(_paused, '55');
|
|
|
|
_;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Triggers stopped state.
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
*
|
|
|
|
* - The contract must not be paused.
|
|
|
|
*/
|
|
|
|
function _pause() internal virtual whenNotPaused {
|
|
|
|
_paused = true;
|
2020-09-14 13:59:11 +00:00
|
|
|
emit Paused();
|
2020-09-14 13:24:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Returns to normal state.
|
|
|
|
*
|
|
|
|
* Requirements:
|
|
|
|
*
|
|
|
|
* - The contract must be paused.
|
|
|
|
*/
|
|
|
|
function _unpause() internal virtual whenPaused {
|
|
|
|
_paused = false;
|
2020-09-14 13:59:11 +00:00
|
|
|
emit Unpaused();
|
2020-09-14 13:24:30 +00:00
|
|
|
}
|
|
|
|
}
|