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 getReserves() external view returns (address[] memory);
|
||||||
|
|
||||||
function pause() external;
|
function setPause(bool val) external;
|
||||||
|
|
||||||
function unpause() 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 {
|
function setPause(bool val) external override onlyLendingPoolConfigurator {
|
||||||
PausablePool._pause();
|
PausablePool._setPause(val);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev unpause all the Lending Pool actions
|
|
||||||
*/
|
|
||||||
function unpause() external override onlyLendingPoolConfigurator {
|
|
||||||
PausablePool._unpause();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -584,16 +584,9 @@ contract LendingPoolConfigurator is VersionedInitializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev pauses LendingPool actions
|
* @dev pauses or unpauses LendingPool actions
|
||||||
**/
|
**/
|
||||||
function pausePool() external onlyLendingPoolManager {
|
function setPoolPause(bool val) external onlyLendingPoolManager {
|
||||||
pool.pause();
|
pool.setPause(val);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev unpauses LendingPool actions
|
|
||||||
**/
|
|
||||||
function unpausePool() external onlyLendingPoolManager {
|
|
||||||
pool.unpause();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,6 @@ contract PausablePool {
|
||||||
|
|
||||||
bool private _paused;
|
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.
|
* @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.
|
* @dev Returns to normal state.
|
||||||
*
|
*
|
||||||
|
@ -85,8 +53,12 @@ contract PausablePool {
|
||||||
*
|
*
|
||||||
* - The contract must be paused.
|
* - The contract must be paused.
|
||||||
*/
|
*/
|
||||||
function _unpause() internal virtual whenPaused {
|
function _setPause(bool val) internal virtual {
|
||||||
_paused = false;
|
_paused = val;
|
||||||
|
if (_paused) {
|
||||||
|
emit Paused();
|
||||||
|
return;
|
||||||
|
}
|
||||||
emit Unpaused();
|
emit Unpaused();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user