Added checks on liquidationBonus

This commit is contained in:
The3D 2020-11-10 18:16:27 +01:00
parent 18446c7ecd
commit 80997ea965
2 changed files with 9 additions and 6 deletions

View File

@ -388,11 +388,14 @@ contract LendingPoolConfigurator is VersionedInitializable {
if (liquidationThreshold != 0) { if (liquidationThreshold != 0) {
//liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less //liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less
//collateral than needed to cover the debt //collateral than needed to cover the debt.
require( uint256 absoluteBonus = liquidationBonus.sub(PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION);
liquidationBonus > PercentageMath.PERCENTAGE_FACTOR, require(absoluteBonus > 0, Errors.LPC_INVALID_CONFIGURATION);
Errors.LPC_INVALID_CONFIGURATION
); //we also need to require that the liq threshold is lower or equal than the liquidation bonus, to ensure that
//there is always enough margin for liquidators to receive the bonus.
require(liquidationThreshold.add(absoluteBonus) <= PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION);
} else { } else {
require(liquidationBonus == 0, Errors.LPC_INVALID_CONFIGURATION); require(liquidationBonus == 0, Errors.LPC_INVALID_CONFIGURATION);
//if the liquidation threshold is being set to 0, //if the liquidation threshold is being set to 0,

View File

@ -1285,4 +1285,4 @@
"address": "0xaDF23b1cAa6a7B3b077c432794FfF80A4b935cdF" "address": "0xaDF23b1cAa6a7B3b077c432794FfF80A4b935cdF"
} }
} }
} }