diff --git a/contracts/protocol/lendingpool/LendingPool.sol b/contracts/protocol/lendingpool/LendingPool.sol index fbf9a2b0..2c91fb5a 100644 --- a/contracts/protocol/lendingpool/LendingPool.sol +++ b/contracts/protocol/lendingpool/LendingPool.sol @@ -26,6 +26,7 @@ import {ReserveConfiguration} from '../libraries/configuration/ReserveConfigurat import {UserConfiguration} from '../libraries/configuration/UserConfiguration.sol'; import {DataTypes} from '../libraries/types/DataTypes.sol'; import {LendingPoolStorage} from './LendingPoolStorage.sol'; +import {Address} from '../../dependencies/openzeppelin/contracts/Address.sol'; /** * @title LendingPool contract @@ -50,6 +51,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage using PercentageMath for uint256; using SafeERC20 for IERC20; using ReserveLogic for DataTypes.ReserveCache; + using Address for address; uint256 public constant LENDINGPOOL_REVISION = 0x2; @@ -326,6 +328,9 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage * @param user The address of the user to be rebalanced **/ function rebalanceStableBorrowRate(address asset, address user) external override whenNotPaused { + + require(!address(msg.sender).isContract(), Errors.LP_CALLER_NOT_EOA); + DataTypes.ReserveData storage reserve = _reserves[asset]; DataTypes.ReserveCache memory reserveCache = reserve.cache(); diff --git a/contracts/protocol/libraries/helpers/Errors.sol b/contracts/protocol/libraries/helpers/Errors.sol index 4b0644f5..e0fea7bb 100644 --- a/contracts/protocol/libraries/helpers/Errors.sol +++ b/contracts/protocol/libraries/helpers/Errors.sol @@ -112,6 +112,7 @@ library Errors { string public constant RL_ATOKEN_SUPPLY_NOT_ZERO = '88'; string public constant RL_STABLE_DEBT_NOT_ZERO = '89'; string public constant RL_VARIABLE_DEBT_SUPPLY_NOT_ZERO = '90'; + string public constant LP_CALLER_NOT_EOA = '91'; enum CollateralManagerErrors { NO_ERROR,