When transfer, check pause at pool to save one external call.

This commit is contained in:
David Racero 2020-09-14 19:46:27 +02:00
parent 64066a14ec
commit 4ec61ee993
4 changed files with 9 additions and 11 deletions

View File

@ -387,6 +387,4 @@ interface ILendingPool {
function pause() external;
function unpause() external;
function paused() external view returns (bool);
}

View File

@ -888,6 +888,9 @@ contract LendingPool is VersionedInitializable, PausablePool, ILendingPool {
address user,
uint256 amount
) external override view returns (bool) {
if (PausablePool.paused()) {
return false;
}
return
GenericLogic.balanceDecreaseAllowed(
asset,
@ -927,11 +930,4 @@ contract LendingPool is VersionedInitializable, PausablePool, ILendingPool {
function unpause() external override onlyLendingPoolConfigurator {
PausablePool._unpause();
}
/**
* @dev retrieve pause status
*/
function paused() public override(PausablePool, ILendingPool) view returns (bool) {
return PausablePool.paused();
}
}

View File

@ -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
@ -44,6 +46,7 @@ contract PausablePool {
* - The contract must not be paused.
*/
modifier whenNotPaused() {
// require(!_paused, Errors.IS_PAUSED);
require(!_paused, '54');
_;
}
@ -56,6 +59,7 @@ contract PausablePool {
* - The contract must be paused.
*/
modifier whenPaused() {
// require(_paused, Errors.NOT_PAUSED);
require(_paused, '55');
_;
}

View File

@ -160,7 +160,7 @@ contract AToken is VersionedInitializable, ERC20, IAToken {
* @return true if the user can transfer amount, false otherwise
**/
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);
}
/**