mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
fix: drop reserve logic updated
This commit is contained in:
parent
52b903cd20
commit
d0841097e6
|
@ -828,8 +828,9 @@ contract LendingPool is VersionedInitializable, ILendingPool, LendingPoolStorage
|
||||||
* @param asset The address of the underlying asset of the reserve
|
* @param asset The address of the underlying asset of the reserve
|
||||||
**/
|
**/
|
||||||
function dropReserve(address asset) external override onlyLendingPoolConfigurator {
|
function dropReserve(address asset) external override onlyLendingPoolConfigurator {
|
||||||
_reserves[asset].dropReserve();
|
ValidationLogic.validateDropReserve(_reserves[asset]);
|
||||||
_removeReserveFromList(asset);
|
_removeReserveFromList(asset);
|
||||||
|
delete _reserves[asset];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -178,23 +178,6 @@ library ReserveLogic {
|
||||||
reserve.interestRateStrategyAddress = interestRateStrategyAddress;
|
reserve.interestRateStrategyAddress = interestRateStrategyAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @dev drop a reserve
|
|
||||||
* @param reserve The reserve object
|
|
||||||
**/
|
|
||||||
function dropReserve(DataTypes.ReserveData storage reserve) external {
|
|
||||||
require(IERC20(reserve.aTokenAddress).totalSupply() == 0, Errors.RL_ATOKEN_SUPPLY_NOT_NULL);
|
|
||||||
require(
|
|
||||||
IERC20(reserve.stableDebtTokenAddress).totalSupply() == 0,
|
|
||||||
Errors.RL_STABLE_DEBT_NOT_NULL
|
|
||||||
);
|
|
||||||
require(
|
|
||||||
IERC20(reserve.variableDebtTokenAddress).totalSupply() == 0,
|
|
||||||
Errors.RL_VARIABLE_DEBT_SUPPLY_NOT_NULL
|
|
||||||
);
|
|
||||||
reserve.id = type(uint8).max;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct UpdateInterestRatesLocalVars {
|
struct UpdateInterestRatesLocalVars {
|
||||||
address stableDebtTokenAddress;
|
address stableDebtTokenAddress;
|
||||||
uint256 availableLiquidity;
|
uint256 availableLiquidity;
|
||||||
|
|
|
@ -477,4 +477,20 @@ library ValidationLogic {
|
||||||
function validateTransfer(DataTypes.ReserveData storage reserve) internal view {
|
function validateTransfer(DataTypes.ReserveData storage reserve) internal view {
|
||||||
require(!reserve.configuration.getPaused(), Errors.VL_RESERVE_PAUSED);
|
require(!reserve.configuration.getPaused(), Errors.VL_RESERVE_PAUSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Validates a drop reserve action
|
||||||
|
* @param reserve The reserve object
|
||||||
|
**/
|
||||||
|
function validateDropReserve(DataTypes.ReserveData storage reserve) external view {
|
||||||
|
require(IERC20(reserve.aTokenAddress).totalSupply() == 0, Errors.RL_ATOKEN_SUPPLY_NOT_NULL);
|
||||||
|
require(
|
||||||
|
IERC20(reserve.stableDebtTokenAddress).totalSupply() == 0,
|
||||||
|
Errors.RL_STABLE_DEBT_NOT_NULL
|
||||||
|
);
|
||||||
|
require(
|
||||||
|
IERC20(reserve.variableDebtTokenAddress).totalSupply() == 0,
|
||||||
|
Errors.RL_VARIABLE_DEBT_SUPPLY_NOT_NULL
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user