From 80997ea965f3ac564e3a16040fe1574b75b68700 Mon Sep 17 00:00:00 2001 From: The3D Date: Tue, 10 Nov 2020 18:16:27 +0100 Subject: [PATCH] Added checks on liquidationBonus --- contracts/lendingpool/LendingPoolConfigurator.sol | 13 ++++++++----- deployed-contracts.json | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/contracts/lendingpool/LendingPoolConfigurator.sol b/contracts/lendingpool/LendingPoolConfigurator.sol index 098987b9..de091dbb 100644 --- a/contracts/lendingpool/LendingPoolConfigurator.sol +++ b/contracts/lendingpool/LendingPoolConfigurator.sol @@ -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, diff --git a/deployed-contracts.json b/deployed-contracts.json index 6fb4bcf1..b16e4e44 100644 --- a/deployed-contracts.json +++ b/deployed-contracts.json @@ -1285,4 +1285,4 @@ "address": "0xaDF23b1cAa6a7B3b077c432794FfF80A4b935cdF" } } -} +} \ No newline at end of file