mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixed issue on 0 transfer, added check that the caller must be an aToken
This commit is contained in:
parent
2cf84f19ce
commit
3f7d913fd4
|
@ -742,6 +742,8 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
||||||
) external override {
|
) external override {
|
||||||
_whenNotPaused();
|
_whenNotPaused();
|
||||||
|
|
||||||
|
require(msg.sender == _reserves[asset].aTokenAddress, Errors.CALLER_MUST_BE_AN_ATOKEN);
|
||||||
|
|
||||||
ValidationLogic.validateTransfer(
|
ValidationLogic.validateTransfer(
|
||||||
from,
|
from,
|
||||||
_reserves,
|
_reserves,
|
||||||
|
@ -759,7 +761,7 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
||||||
fromConfig.setUsingAsCollateral(reserveId, false);
|
fromConfig.setUsingAsCollateral(reserveId, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (balanceToBefore == 0) {
|
if (balanceToBefore == 0 && amount != 0) {
|
||||||
UserConfiguration.Map storage toConfig = _usersConfig[to];
|
UserConfiguration.Map storage toConfig = _usersConfig[to];
|
||||||
toConfig.setUsingAsCollateral(reserveId, true);
|
toConfig.setUsingAsCollateral(reserveId, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ library Errors {
|
||||||
string public constant NO_MORE_RESERVES_ALLOWED = '59';
|
string public constant NO_MORE_RESERVES_ALLOWED = '59';
|
||||||
string public constant INVALID_FLASH_LOAN_EXECUTOR_RETURN = '60';
|
string public constant INVALID_FLASH_LOAN_EXECUTOR_RETURN = '60';
|
||||||
string public constant INCONSISTENT_FLASHLOAN_PARAMS = '69';
|
string public constant INCONSISTENT_FLASHLOAN_PARAMS = '69';
|
||||||
|
string public constant CALLER_MUST_BE_AN_ATOKEN = '76';
|
||||||
|
|
||||||
// require error messages - aToken - DebtTokens
|
// require error messages - aToken - DebtTokens
|
||||||
string public constant CALLER_MUST_BE_LENDING_POOL = '28'; // 'The caller of this function must be a lending pool'
|
string public constant CALLER_MUST_BE_LENDING_POOL = '28'; // 'The caller of this function must be a lending pool'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user