Merge branch 'fix/135' into 'master'

Resolve "Add a validation that liq threshold <= 100%-liq bonus on configureReserveAsCollateral()"

Closes #135

See merge request aave-tech/protocol-v2!155
This commit is contained in:
Andrey Ko 2020-11-10 17:33:03 +00:00
commit 1be6b5fbc9
2 changed files with 9 additions and 6 deletions

View File

@ -388,11 +388,14 @@ contract LendingPoolConfigurator is VersionedInitializable {
if (liquidationThreshold != 0) {
//liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less
//collateral than needed to cover the debt
require(
liquidationBonus > PercentageMath.PERCENTAGE_FACTOR,
Errors.LPC_INVALID_CONFIGURATION
);
//collateral than needed to cover the debt.
uint256 absoluteBonus = liquidationBonus.sub(PercentageMath.PERCENTAGE_FACTOR, Errors.LPC_INVALID_CONFIGURATION);
require(absoluteBonus > 0, 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 {
require(liquidationBonus == 0, Errors.LPC_INVALID_CONFIGURATION);
//if the liquidation threshold is being set to 0,

View File

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