mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Minimize Pausable contract
This commit is contained in:
parent
6842978706
commit
eea47aedde
|
@ -430,7 +430,5 @@ interface ILendingPool {
|
|||
|
||||
function getReserves() external view returns (address[] memory);
|
||||
|
||||
function pause() external;
|
||||
|
||||
function unpause() external;
|
||||
function setPause(bool val) external;
|
||||
}
|
||||
|
|
|
@ -1004,16 +1004,9 @@ contract LendingPool is VersionedInitializable, PausablePool, ILendingPool {
|
|||
}
|
||||
|
||||
/**
|
||||
* @dev pause all the Lending Pool actions
|
||||
* @dev pause or unpause all the Lending Pool actions and aToken transfers
|
||||
*/
|
||||
function pause() external override onlyLendingPoolConfigurator {
|
||||
PausablePool._pause();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev unpause all the Lending Pool actions
|
||||
*/
|
||||
function unpause() external override onlyLendingPoolConfigurator {
|
||||
PausablePool._unpause();
|
||||
function setPause(bool val) external override onlyLendingPoolConfigurator {
|
||||
PausablePool._setPause(val);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -584,16 +584,9 @@ contract LendingPoolConfigurator is VersionedInitializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @dev pauses LendingPool actions
|
||||
* @dev pauses or unpauses LendingPool actions
|
||||
**/
|
||||
function pausePool() external onlyLendingPoolManager {
|
||||
pool.pause();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev unpauses LendingPool actions
|
||||
**/
|
||||
function unpausePool() external onlyLendingPoolManager {
|
||||
pool.unpause();
|
||||
function setPoolPause(bool val) external onlyLendingPoolManager {
|
||||
pool.setPause(val);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,13 +26,6 @@ contract PausablePool {
|
|||
|
||||
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.
|
||||
*/
|
||||
|
@ -53,31 +46,6 @@ contract PausablePool {
|
|||
_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Modifier to make a function callable only when the contract is paused.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - The contract must be paused.
|
||||
*/
|
||||
modifier whenPaused() {
|
||||
// require(_paused, Errors.NOT_PAUSED);
|
||||
require(_paused, '55');
|
||||
_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Triggers stopped state.
|
||||
*
|
||||
* Requirements:
|
||||
*
|
||||
* - The contract must not be paused.
|
||||
*/
|
||||
function _pause() internal virtual whenNotPaused {
|
||||
_paused = true;
|
||||
emit Paused();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dev Returns to normal state.
|
||||
*
|
||||
|
@ -85,8 +53,12 @@ contract PausablePool {
|
|||
*
|
||||
* - The contract must be paused.
|
||||
*/
|
||||
function _unpause() internal virtual whenPaused {
|
||||
_paused = false;
|
||||
function _setPause(bool val) internal virtual {
|
||||
_paused = val;
|
||||
if (_paused) {
|
||||
emit Paused();
|
||||
return;
|
||||
}
|
||||
emit Unpaused();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user