mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
When transfer, check pause at pool to save one external call.
This commit is contained in:
parent
64066a14ec
commit
4ec61ee993
|
@ -387,6 +387,4 @@ interface ILendingPool {
|
||||||
function pause() external;
|
function pause() external;
|
||||||
|
|
||||||
function unpause() external;
|
function unpause() external;
|
||||||
|
|
||||||
function paused() external view returns (bool);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -888,6 +888,9 @@ contract LendingPool is VersionedInitializable, PausablePool, ILendingPool {
|
||||||
address user,
|
address user,
|
||||||
uint256 amount
|
uint256 amount
|
||||||
) external override view returns (bool) {
|
) external override view returns (bool) {
|
||||||
|
if (PausablePool.paused()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return
|
return
|
||||||
GenericLogic.balanceDecreaseAllowed(
|
GenericLogic.balanceDecreaseAllowed(
|
||||||
asset,
|
asset,
|
||||||
|
@ -927,11 +930,4 @@ contract LendingPool is VersionedInitializable, PausablePool, ILendingPool {
|
||||||
function unpause() external override onlyLendingPoolConfigurator {
|
function unpause() external override onlyLendingPoolConfigurator {
|
||||||
PausablePool._unpause();
|
PausablePool._unpause();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev retrieve pause status
|
|
||||||
*/
|
|
||||||
function paused() public override(PausablePool, ILendingPool) view returns (bool) {
|
|
||||||
return PausablePool.paused();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
pragma solidity ^0.6.0;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
|
// import {Errors} from '../libraries/helpers/Errors.sol';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Contract module which allows children to implement an emergency stop
|
* @dev Contract module which allows children to implement an emergency stop
|
||||||
|
@ -44,6 +46,7 @@ contract PausablePool {
|
||||||
* - The contract must not be paused.
|
* - The contract must not be paused.
|
||||||
*/
|
*/
|
||||||
modifier whenNotPaused() {
|
modifier whenNotPaused() {
|
||||||
|
// require(!_paused, Errors.IS_PAUSED);
|
||||||
require(!_paused, '54');
|
require(!_paused, '54');
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +59,7 @@ contract PausablePool {
|
||||||
* - The contract must be paused.
|
* - The contract must be paused.
|
||||||
*/
|
*/
|
||||||
modifier whenPaused() {
|
modifier whenPaused() {
|
||||||
|
// require(_paused, Errors.NOT_PAUSED);
|
||||||
require(_paused, '55');
|
require(_paused, '55');
|
||||||
_;
|
_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ contract AToken is VersionedInitializable, ERC20, IAToken {
|
||||||
* @return true if the user can transfer amount, false otherwise
|
* @return true if the user can transfer amount, false otherwise
|
||||||
**/
|
**/
|
||||||
function isTransferAllowed(address user, uint256 amount) public override view returns (bool) {
|
function isTransferAllowed(address user, uint256 amount) public override view returns (bool) {
|
||||||
return !POOL.paused() && POOL.balanceDecreaseAllowed(UNDERLYING_ASSET_ADDRESS, user, amount);
|
return POOL.balanceDecreaseAllowed(UNDERLYING_ASSET_ADDRESS, user, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user