From 926d25dba8b074675e679d252f0b8f59f5fb873b Mon Sep 17 00:00:00 2001 From: The3D Date: Wed, 19 Aug 2020 16:57:49 +0200 Subject: [PATCH] Cleaned up validation logic --- contracts/libraries/ReserveLogic.sol | 1 - contracts/libraries/ValidationLogic.sol | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/contracts/libraries/ReserveLogic.sol b/contracts/libraries/ReserveLogic.sol index a5bde585..4d49b114 100644 --- a/contracts/libraries/ReserveLogic.sol +++ b/contracts/libraries/ReserveLogic.sol @@ -8,7 +8,6 @@ import {IPriceOracleGetter} from '../interfaces/IPriceOracleGetter.sol'; import {SafeERC20} from '@openzeppelin/contracts/token/ERC20/SafeERC20.sol'; import {IStableDebtToken} from '../tokenization/interfaces/IStableDebtToken.sol'; import {ReserveConfiguration} from './ReserveConfiguration.sol'; - import {IReserveInterestRateStrategy} from '../interfaces/IReserveInterestRateStrategy.sol'; import {WadRayMath} from './WadRayMath.sol'; diff --git a/contracts/libraries/ValidationLogic.sol b/contracts/libraries/ValidationLogic.sol index 696f3eb7..16170de7 100644 --- a/contracts/libraries/ValidationLogic.sol +++ b/contracts/libraries/ValidationLogic.sol @@ -36,12 +36,14 @@ library ValidationLogic { * @param _amount the amount to be deposited */ function validateDeposit(ReserveLogic.ReserveData storage _reserve, uint256 _amount) - external + internal view { (bool isActive, bool isFreezed, , ) = _reserve.configuration.getFlags(); require(_amount > 0, 'Amount must be greater than 0'); + require(isActive, 'Action requires an active reserve'); + require(!isFreezed, 'Action requires an unfreezed reserve'); } /**